[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH] plat/common: PCI bus probes the device identifier



Looks good. Thanks!

Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 01.10.2018 16:18, Sharan Santhanam wrote:
While probing the devices on the pci bus, the device identifier are
read from the configuration space. The pci device is identified with
* class_id
* vendor_id
* device_id
* subsystem_id
* subsystemvendor_id

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
  plat/common/pci_bus.c | 30 ++++++++++++++++++++++++------
  1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
index c653e81..71713c9 100644
--- a/plat/common/pci_bus.c
+++ b/plat/common/pci_bus.c
@@ -80,6 +80,22 @@ static struct pci_bus_handler ph;
  #define PCI_DEVICE_SHIFT            (11)
  #define PCI_ENABLE_BIT              (1 << 31)
+#define PCI_CONF_CLASS_ID (0x08)
+#define PCI_CONF_CLASS_ID_SHFT     (8)
+#define PCI_CONF_CLASS_ID_MASK     (0x00FFFFFF)
+
+#define PCI_CONF_VENDOR_ID          (0x00)
+#define PCI_CONF_VENDOR_ID_SHFT     (0)
+#define PCI_CONF_VENDOR_ID_MASK     (0x0000FFFF)
+
+#define PCI_CONF_DEVICE_ID          (0x00)
+#define PCI_CONF_DEVICE_ID_SHFT     (16)
+#define PCI_CONF_DEVICE_ID_MASK     (0x0000FFFF)
+
+#define PCI_CONF_SUBSYSVEN_ID          (0x2c)
+#define PCI_CONF_SUBSYSVEN_ID_SHFT     (0)
+#define PCI_CONF_SUBSYSVEN_ID_MASK     (0xFFFF)
+
  #define PCI_CONF_SUBSYS_ID          (0x2c)
  #define PCI_CONF_SUBSYS_ID_SHFT     (16)
  #define PCI_CONF_SUBSYS_ID_MASK     (0xFFFF)
@@ -236,14 +252,16 @@ static int pci_probe(void)
                                continue;
                        }
- /* TODO: Implement fetch more information from PCI */
-                       devid.class_id            = PCI_CLASS_ANY_ID;
-                       /* TODO: Implement fetch more information from PCI */
-                       devid.device_id           = PCI_ANY_ID;
-                       /* TODO: Implement fetch more information from PCI */
-                       devid.subsystem_vendor_id = PCI_ANY_ID;
+                       PCI_CONF_READ(uint32_t, &devid.class_id,
+                                       config_addr, CLASS_ID);
+                       PCI_CONF_READ(uint16_t, &devid.vendor_id,
+                                       config_addr, VENDOR_ID);
+                       PCI_CONF_READ(uint16_t, &devid.device_id,
+                                       config_addr, DEVICE_ID);
                        PCI_CONF_READ(uint16_t, &devid.subsystem_device_id,
                                        config_addr, SUBSYS_ID);
+                       PCI_CONF_READ(uint16_t, &devid.subsystem_vendor_id,
+                                       config_addr, SUBSYSVEN_ID);
uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): ",
                                   (int) addr.bus,


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.