pci: add domain identifier
authorAditya Basu <mitthu@google.com>
Fri, 16 Aug 2019 16:40:03 +0000 (12:40 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 19 Aug 2019 16:39:09 +0000 (12:39 -0400)
- Add identifier for PCI domain.
- The field is declared as "int"; refer Linux source:
include/asm-x86_64/pci.h
- Legacy domain field used to be 16-bits.

Signed-off-by: Aditya Basu <mitthu@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/pci.c
kern/arch/x86/pci.h

index ed90424..600cdab 100644 (file)
@@ -202,7 +202,7 @@ static uintptr_t pci_get_mmio_cfg(struct pci_device *pcidev)
 {
        physaddr_t paddr;
 
-       paddr = acpi_pci_get_mmio_cfg_addr(0 /* segment for legacy PCI enum*/,
+       paddr = acpi_pci_get_mmio_cfg_addr(pcidev->domain,
                                          pcidev->bus, pcidev->dev,
                                          pcidev->func);
        if (!paddr)
@@ -243,6 +243,9 @@ void pci_init(void)
                                /* we don't need to lock it til we post the
                                 * pcidev to the list*/
                                spinlock_init_irqsave(&pcidev->lock);
+                               /* we only discover domain 0 during legacy
+                                * PCI enumeration */
+                               pcidev->domain = 0;
                                pcidev->bus = i;
                                pcidev->dev = j;
                                pcidev->func = k;
index 55bfb93..9c2ab71 100644 (file)
@@ -175,6 +175,7 @@ struct pci_device {
        void                            *dev_data; /* device private pointer */
        struct device                   device;
        bool                            in_use; /* prevent double discovery */
+       int                             domain; /* legacy size was 16-bits */
        uint8_t                         bus;
        uint8_t                         dev;
        uint8_t                         func;