From bfe26529fc77755dc5dd9e41473ebbe84044c5f3 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 19 Sep 2025 17:57:08 -0400 Subject: kern: pci: Add 'class' and 'subclass' to device This commit adds the PCI class and revion (subclass) IDs to the PCI device descriptor provided by L5. Signed-off-by: Ian Moffett --- src/sys/io/pci/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/sys/io/pci/pci.c') diff --git a/src/sys/io/pci/pci.c b/src/sys/io/pci/pci.c index 49046c8..6385c6e 100644 --- a/src/sys/io/pci/pci.c +++ b/src/sys/io/pci/pci.c @@ -59,6 +59,8 @@ pci_register_dev(struct pci_device *dev) { struct pci_device *devp; pcireg_t vend_dev; + uint32_t classrev; + uint8_t class, subclass; uint16_t device_id; uint16_t vendor_id; @@ -71,6 +73,11 @@ pci_register_dev(struct pci_device *dev) vendor_id = vend_dev & 0xFFFF; device_id = (vend_dev >> 16) & 0xFFFF; + /* Get the class and revision */ + classrev = pci_readl(dev, PCIREG_CLASSREV); + class = PCIREG_CLASS(classrev); + subclass = PCIREG_SUBCLASS(classrev); + /* Does this device exist? */ if (vendor_id == 0xFFFF) { return; @@ -78,6 +85,8 @@ pci_register_dev(struct pci_device *dev) dev->vendor = vendor_id; dev->device = device_id; + dev->class = class; + dev->subclass = subclass; /* * Log out the BDF notation as well as vendor, -- cgit v1.2.3