]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/pci: Fix incorrect values used in PCI config
authorPaul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tue, 22 Aug 2023 21:56:37 +0000 (00:56 +0300)
committerPaul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tue, 22 Aug 2023 22:01:47 +0000 (01:01 +0300)
Some values used in PCI configuration were defined incorrectly. For
example, because of the wrong mask and shift values for `CLASS_ID`, PCI
recursive scan was actually never performed and PCI secondary buses
were never discovered. To be more precise, a PCI recursive discovery
is performed only on devices of class code = bridge (0x6), but due
to incorect mask & shift values, we were reading 0x600 from the PCI conf.

plat/common/include/pci/pci_bus.h

index 972cb1b1adce7f8be8ae603d7b52d54f9d58cfda..643583b4c027861e3007653a233b6ffad6400a76 100644 (file)
@@ -207,8 +207,8 @@ static struct pci_bus_handler ph __unused;
 #define PCI_ENABLE_BIT              (1u << 31)
 
 #define PCI_CONF_CLASS_ID          (0x08)
-#define PCI_CONF_CLASS_ID_SHFT     (16)
-#define PCI_CONF_CLASS_ID_MASK     (0xFF00)
+#define PCI_CONF_CLASS_ID_SHFT     (24)
+#define PCI_CONF_CLASS_ID_MASK     (0xFF)
 
 #define PCI_CONF_VENDOR_ID          (0x00)
 #define PCI_CONF_VENDOR_ID_SHFT     (0)
@@ -227,11 +227,11 @@ static struct pci_bus_handler ph __unused;
 #define PCI_CONF_SUBCLASS_ID_MASK     (0x00FF)
 
 #define PCI_CONF_SECONDARY_BUS          (0x18)
-#define PCI_CONF_SECONDARY_BUS_SHFT     (0)
-#define PCI_CONF_SECONDARY_BUS_MASK     (0xFF00)
+#define PCI_CONF_SECONDARY_BUS_SHFT     (8)
+#define PCI_CONF_SECONDARY_BUS_MASK     (0xFF)
 
 #define PCI_HEADER_TYPE_MSB_MASK   (0x80)
-#define PCI_CONF_HEADER_TYPE       (0x00)
+#define PCI_CONF_HEADER_TYPE       (0x0C)
 #define PCI_CONF_HEADER_TYPE_SHFT  (16)
 #define PCI_CONF_HEADER_TYPE_MASK  (0xFF)