|
| 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) |
| static char | hex_nibble (uint8_t n) |
| static void | hex8 (char *out, uint8_t val) |
| static void | hex16 (char *out, uint16_t val) |
| static void | hex32 (char *out, uint32_t val) |
| static void | pci_write_attr16 (sysfs_node_t *dir, const char *name, uint16_t val) |
| static void | pci_write_attr32 (sysfs_node_t *dir, const char *name, uint32_t val) |
| static void | pci_write_class (sysfs_node_t *dir, uint8_t class_code, uint8_t subclass) |
| static void | pci_write_dec (sysfs_node_t *dir, const char *name, uint8_t val) |
| static void | pci_populate_sysfs (void) |
| void | pci_init (void) |
PCI bus enumeration and /sys/bus/pci/devices/ stub sysfs population.
Implements pci_init() which scans PCI bus 0, fills the global pci_devices[] array, and creates a static /sys directory tree populated at boot. Also provides the shared pci_config_read32()/pci_config_write32() helpers that replace the duplicates previously in ata.c.
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.
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().