Commit Graph

1 Commits

Author SHA1 Message Date
Daniel Samson d702d2e9ae
Decode PCI class codes in device discovery
`pci_device` alone says nothing — an ISA bridge, an AHCI controller, and an xHCI USB
controller are all just `pci_device` by DeviceClass. The identity lives in the 24-bit
class code (base class / subclass / prog-IF) that discovery already recorded in
ids.pci_class but the dump threw away.

New system/devices/pci-class.zig (module `pci-class`): pure reference data from the PCI
spec (per the OSDev PCI table) decoding the triple into names — className, subclassName,
progIfName, plus ClassCode.unpack. No hardware access, so it's shared by kernel
discovery and any future user-space PCI tool. device_tree.dump now prints, under each
PCI function, its class/subclass/prog-IF as both hex and name:

    pci0:00:1f.0 [pci_device]
      class 0x06 (Bridge)  subclass 0x01 (ISA Bridge)  progif 0x00
    pci0:00:1f.2 [pci_device]
      class 0x01 (Mass Storage Controller)  subclass 0x06 (Serial ATA Controller)  progif 0x01 (AHCI 1.0)

Host test covers the decoder (bridge/AHCI/xHCI, the "Other" 0x80 convention, unknowns).
Suite 41/41 plus host tests.
2026-07-10 21:35:20 +01:00