]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
pci: introduce a pci_sbdf_t field to pci_dev
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 11 Jun 2019 15:17:38 +0000 (17:17 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Jun 2019 15:17:38 +0000 (17:17 +0200)
And use an union with the current seg, bus and devfn fields to make
fields point to the same underlying data.

No functional change.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/vpci/header.c
xen/include/xen/pci.h

index 94094f55795de9fe9becde84b2b285b79f796463..258b91deed0913e5a78fe2e45dde6c561a400dfc 100644 (file)
@@ -461,9 +461,6 @@ static int init_bars(struct pci_dev *pdev)
     unsigned int i, num_bars, rom_reg;
     struct vpci_header *header = &pdev->vpci->header;
     struct vpci_bar *bars = header->bars;
-    pci_sbdf_t sbdf = {
-        .sbdf = PCI_SBDF3(pdev->seg, pdev->bus, pdev->devfn),
-    };
     int rc;
 
     switch ( pci_conf_read8(pdev->seg, pdev->bus, slot, func, PCI_HEADER_TYPE)
@@ -530,7 +527,7 @@ static int init_bars(struct pci_dev *pdev)
         else
             bars[i].type = VPCI_BAR_MEM32;
 
-        rc = pci_size_mem_bar(sbdf, reg, &addr, &size,
+        rc = pci_size_mem_bar(pdev->sbdf, reg, &addr, &size,
                               (i == num_bars - 1) ? PCI_BAR_LAST : 0);
         if ( rc < 0 )
         {
@@ -560,7 +557,7 @@ static int init_bars(struct pci_dev *pdev)
     }
 
     /* Check expansion ROM. */
-    rc = pci_size_mem_bar(sbdf, rom_reg, &addr, &size, PCI_BAR_ROM);
+    rc = pci_size_mem_bar(pdev->sbdf, rom_reg, &addr, &size, PCI_BAR_ROM);
     if ( rc > 0 && size )
     {
         struct vpci_bar *rom = &header->bars[num_bars];
index c61fd7e2628997fbe478b9cf467fa4fc3ce65d0b..b03927cd28d85c2fe9325e9f8912c66990e3473d 100644 (file)
@@ -81,9 +81,15 @@ struct pci_dev {
     struct arch_msix *msix;
 
     struct domain *domain;
-    const u16 seg;
-    const u8 bus;
-    const u8 devfn;
+
+    const union {
+        struct {
+            uint8_t devfn;
+            uint8_t bus;
+            uint16_t seg;
+        };
+        pci_sbdf_t sbdf;
+    };
 
     u8 phantom_stride;