miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
pci.h File Reference
#include <miniOS/types.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_device_t

Macros

#define PCI_MAX_DEVICES   64

Functions

void pci_init (void)
uint32_t pci_config_read32 (uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off)
void pci_config_write32 (uint8_t bus, uint8_t dev, uint8_t fn, uint8_t off, uint32_t val)

Variables

pci_device_t pci_devices [PCI_MAX_DEVICES]
int pci_device_count

Macro Definition Documentation

◆ PCI_MAX_DEVICES

#define PCI_MAX_DEVICES   64

Maximum number of PCI devices tracked by the kernel.

Function Documentation

◆ pci_config_read32()

uint32_t pci_config_read32 ( uint8_t bus,
uint8_t dev,
uint8_t fn,
uint8_t off )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_write32()

void pci_config_write32 ( uint8_t bus,
uint8_t dev,
uint8_t fn,
uint8_t off,
uint32_t val )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_init()

void pci_init ( void )

pci_init() - Enumerate PCI bus 0 and populate /sys/bus/pci/devices/.

Scans bus 0, slots 0-31, respecting the multi-function bit. Fills pci_devices[] with every non-empty function. Prints the device count via printk(). Then creates /sys/bus/pci/devices/<domain>:<bus>:<dev>.<fn>/ directories with vendor, device, class, subsystem_vendor, subsystem_device attribute files.

Must be called after sysfs_init() and before ata_init().

pci_init() - Enumerate PCI bus 0 and populate /sys/bus/pci/devices/.

Scans all 32 device slots on bus 0. For multi-function devices (header type bit 7 set), iterates functions 0-7; single-function devices use only fn 0. Each discovered function is stored in pci_devices[pci_device_count++]. Capped at PCI_MAX_DEVICES.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ pci_device_count

int pci_device_count
extern

Number of valid entries in pci_devices[]; set by pci_init().

◆ pci_devices

pci_device_t pci_devices[PCI_MAX_DEVICES]
extern

Global array of discovered PCI devices; populated by pci_init().