Patchwork [03/12] pciinit: Remove size element from pci_bus->r structure

login
register
mail settings
Submitter Alexey Korolev
Date April 24, 2012, 6:15 a.m.
Message ID <1335248121.13579.6.camel@nzhmlwks0057.ad.endace.com>
Download mbox | patch
Permalink /patch/154600/
State New
Headers show

Comments

Alexey Korolev - April 24, 2012, 6:15 a.m.
The 'size' element of pci_bus->r structure is no
longer need as the information about bridge region
size is already stored in pci_region_entry structure.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
 src/pciinit.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

Patch

diff --git a/src/pciinit.c b/src/pciinit.c
index 74ade52..4617793 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -45,8 +45,6 @@  struct pci_bus {
         /* pci region stats */
         u32 count[32 - PCI_MEM_INDEX_SHIFT];
         u32 sum, max;
-        /* seconday bus region sizes */
-        u32 size;
         /* pci region assignments */
         u32 bases[32 - PCI_MEM_INDEX_SHIFT];
         u32 base;
@@ -439,21 +437,19 @@  static int pci_bios_check_devices(struct pci_bus *busses)
         for (type = 0; type < PCI_REGION_TYPE_COUNT; type++) {
             u32 limit = (type == PCI_REGION_TYPE_IO) ?
                 PCI_BRIDGE_IO_MIN : PCI_BRIDGE_MEM_MIN;
-            s->r[type].size = s->r[type].sum;
-            if (s->r[type].size < limit)
-                s->r[type].size = limit;
-            s->r[type].size = pci_size_roundup(s->r[type].size);
+            u32 size = s->r[type].sum;
+            if (size < limit)
+                size = limit;
+            size = pci_size_roundup(size);
             // entry->bar is -1 if the entry represents a bridge region
             struct pci_region_entry *entry = pci_region_create_entry(
-                parent, s->bus_dev, -1, s->r[type].size, type, 0);
+                parent, s->bus_dev, -1, size, type, 0);
             if (!entry)
                 return -1;
+            dprintf(1, "PCI: secondary bus %d size %x type %s\n",
+                      entry->dev->secondary_bus, size,
+                      region_type_name[entry->type]);
         }
-        dprintf(1, "PCI: secondary bus %d sizes: io %x, mem %x, prefmem %x\n",
-                secondary_bus,
-                s->r[PCI_REGION_TYPE_IO].size,
-                s->r[PCI_REGION_TYPE_MEM].size,
-                s->r[PCI_REGION_TYPE_PREFMEM].size);
     }
     return 0;
 }