FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
pci.h File Reference

The Header files for actual PCI source. More...

#include <basics.h>
#include <hal.h>
#include <graphics.h>
#include <drivers/rtl8139.h>
#include <debugger.h>
#include <ahci.h>
#include <nvme.h>
#include <isr.h>
#include <pci_id.h>
Include dependency graph for pci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pci_location_t

Macros

#define PCI_CONFIG_ADDRESS   0xCF8
#define PCI_CONFIG_DATA   0xCFC

Typedefs

typedef void(* pci_probe_fn) (uint8_t bus, uint8_t slot, uint8_t function)

Functions

uint16 pci_read_word (uint16 bus, uint16 slot, uint16 func, uint16 offset)
 Read a 16-bit value from a PCI configuration register.
uint16 getVendorID (uint16 bus, uint16 device, uint16 function)
 Gets the Vendor ID from PCI.
uint16 getDeviceID (uint16 bus, uint16 device, uint16 function)
 Gets the Device ID from PCI.
uint16 getClassId (uint16 bus, uint16 device, uint16 function)
 Gets the Class ID from PCI.
uint16 getSubClassId (uint16 bus, uint16 device, uint16 function)
 Gets the Sub-class ID from PCI.
uint8 getRevision (uint16 bus, uint16 slot, uint16 func)
uint8 getProgIF (uint16 bus, uint16 device, uint16 function)
void probe_pci (void)
 Scans (Probes) PCI Devices.
void print_lspci (void)
uint32 pci_config_read_dword (uint8 bus, uint8 slot, uint8 func, uint8 offset)
 Function to read a 32-bit value from the PCI configuration space.
void pci_config_write_dword (uint8 bus, uint8 slot, uint8 func, uint8 offset, uint32_t value)
uint32 get_ahci_bar_address (uint8 bus, int slot, int func, int bar_num)
 Gets the AHCI bar address.
int proc_pci_register ()
 Registers the PCI devices into the procfs.

Variables

cstring display_adapter_name
cstring GPUName [2]
cstring using_graphics_card
uint64 * graphics_base_Address
int total_devices

Detailed Description

The Header files for actual PCI source.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2023-10-29

Definition in file pci.h.

Macro Definition Documentation

◆ PCI_CONFIG_ADDRESS

#define PCI_CONFIG_ADDRESS   0xCF8

Definition at line 33 of file pci.h.

◆ PCI_CONFIG_DATA

#define PCI_CONFIG_DATA   0xCFC

Definition at line 34 of file pci.h.

Typedef Documentation

◆ pci_probe_fn

typedef void(* pci_probe_fn) (uint8_t bus, uint8_t slot, uint8_t function)

Definition at line 36 of file pci.h.

Function Documentation

◆ get_ahci_bar_address()

uint32 get_ahci_bar_address ( uint8 bus,
int slot,
int func,
int bar_num )

Gets the AHCI bar address.

Parameters
busThe PCI bus number.
slotThe PCI slot number.
funcThe PCI function number.
bar_numThe Base Address Register Number.
Returns
uint32

◆ getClassId()

uint16 getClassId ( uint16 bus,
uint16 device,
uint16 function )

Gets the Class ID from PCI.

Parameters
bus
device
function
Returns
uint16 Class ID

◆ getDeviceID()

uint16 getDeviceID ( uint16 bus,
uint16 device,
uint16 function )

Gets the Device ID from PCI.

Parameters
bus
device
function
Returns
uint16 Device ID

◆ getSubClassId()

uint16 getSubClassId ( uint16 bus,
uint16 device,
uint16 function )

Gets the Sub-class ID from PCI.

Parameters
bus
device
function
Returns
uint16 Sub-class ID

◆ getVendorID()

uint16 getVendorID ( uint16 bus,
uint16 device,
uint16 function )

Gets the Vendor ID from PCI.

Parameters
bus
device
function
Returns
uint16 Vendor ID

◆ pci_config_read_dword()

uint32 pci_config_read_dword ( uint8 bus,
uint8 slot,
uint8 func,
uint8 offset )

Function to read a 32-bit value from the PCI configuration space.

Parameters
bus
slot
func
offset
Returns
uint32

◆ pci_read_word()

uint16 pci_read_word ( uint16 bus,
uint16 slot,
uint16 func,
uint16 offset )

Read a 16-bit value from a PCI configuration register.

This function reads a 16-bit value from a specified PCI configuration register using the provided bus, slot, function, and offset parameters.

Parameters
busThe PCI bus number.
slotThe PCI slot number.
funcThe PCI function number.
offsetThe offset within the PCI configuration register to read.
Returns
The 16-bit value read from the specified PCI configuration register.

◆ proc_pci_register()

int proc_pci_register ( )

Registers the PCI devices into the procfs.

Returns
int 0 always