diff options
author | Myles Watson <mylesgw@gmail.com> | 2010-05-21 14:33:48 +0000 |
---|---|---|
committer | Myles Watson <mylesgw@gmail.com> | 2010-05-21 14:33:48 +0000 |
commit | c25cc11ae32e10a7d0c9f04c29bfb7eca4d9c210 (patch) | |
tree | fb5ada475647efc61ee1f51f50e3adad4ac74b6e /src/northbridge/amd | |
parent | c5b87c8f895502b235e1619a23bd89dda955000e (diff) | |
download | coreboot-c25cc11ae32e10a7d0c9f04c29bfb7eca4d9c210.tar.xz |
Use lists instead of arrays for resources in devices to reduce memory usage.
Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5576 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/northbridge/amd')
-rw-r--r-- | src/northbridge/amd/amdfam10/northbridge.c | 21 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/northbridge.c | 16 | ||||
-rw-r--r-- | src/northbridge/amd/gx2/northbridge.c | 6 | ||||
-rw-r--r-- | src/northbridge/amd/lx/northbridge.c | 10 |
4 files changed, 24 insertions, 29 deletions
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c index 3d968a9ded..009b57becc 100644 --- a/src/northbridge/amd/amdfam10/northbridge.c +++ b/src/northbridge/amd/amdfam10/northbridge.c @@ -592,7 +592,7 @@ static void amdfam10_create_vga_resource(device_t dev, unsigned nodeid) static void amdfam10_set_resources(device_t dev) { u32 nodeid, link; - int i; + struct resource *res; /* Find the nodeid */ nodeid = amdfam10_nodeid(dev); @@ -600,8 +600,8 @@ static void amdfam10_set_resources(device_t dev) amdfam10_create_vga_resource(dev, nodeid); /* Set each resource we have found */ - for(i = 0; i < dev->resources; i++) { - amdfam10_set_resource(dev, &dev->resource[i], nodeid); + for(res = dev->resource_list; res; res = res->next) { + amdfam10_set_resource(dev, res, nodeid); } for(link = 0; link < dev->links; link++) { @@ -889,7 +889,7 @@ static void pci_domain_set_resources(device_t dev) { #if CONFIG_PCI_64BIT_PREF_MEM == 1 struct resource *io, *mem1, *mem2; - struct resource *resource, *last; + struct resource *res; #endif unsigned long mmio_basek; u32 pci_tolm; @@ -943,14 +943,13 @@ static void pci_domain_set_resources(device_t dev) mem2->base, mem2->limit, mem2->size, mem2->align); } - last = &dev->resource[dev->resources]; - for(resource = &dev->resource[0]; resource < last; resource++) + for(res = &dev->resource_list; res; res = res->next) { - resource->flags |= IORESOURCE_ASSIGNED; - resource->flags &= ~IORESOURCE_STORED; - link = (resource>>2) & 3; - resource->flags |= IORESOURCE_STORED; - report_resource_stored(dev, resource, ""); + res->flags |= IORESOURCE_ASSIGNED; + res->flags &= ~IORESOURCE_STORED; + link = (res>>2) & 3; + res->flags |= IORESOURCE_STORED; + report_resource_stored(dev, res, ""); } #endif diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index 6938ec62b3..7910f291aa 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -520,14 +520,13 @@ static void amdk8_create_vga_resource(device_t dev, unsigned nodeid) static void amdk8_set_resources(device_t dev) { unsigned nodeid, link; - int i; + struct resource *res; /* Find the nodeid */ nodeid = amdk8_nodeid(dev); /* Set each resource we have found */ - for(i = 0; i < dev->resources; i++) { - struct resource *res = &dev->resource[i]; + for(res = dev->resource_list; res; res = res->next) { struct resource *old = NULL; unsigned index; @@ -846,7 +845,7 @@ static void amdk8_domain_set_resources(device_t dev) { #if CONFIG_PCI_64BIT_PREF_MEM == 1 struct resource *io, *mem1, *mem2; - struct resource *resource, *last; + struct resource *res; #endif unsigned long mmio_basek; uint32_t pci_tolm; @@ -905,12 +904,11 @@ static void amdk8_domain_set_resources(device_t dev) mem2->base, mem2->limit, mem2->size, mem2->align); #endif - last = &dev->resource[dev->resources]; - for(resource = &dev->resource[0]; resource < last; resource++) + for(res = dev->resource_list; res; res = res->next) { - resource->flags |= IORESOURCE_ASSIGNED; - resource->flags |= IORESOURCE_STORED; - report_resource_stored(dev, resource, ""); + res->flags |= IORESOURCE_ASSIGNED; + res->flags |= IORESOURCE_STORED; + report_resource_stored(dev, res, ""); } #endif diff --git a/src/northbridge/amd/gx2/northbridge.c b/src/northbridge/amd/gx2/northbridge.c index 98acbc9f95..42fdcbb496 100644 --- a/src/northbridge/amd/gx2/northbridge.c +++ b/src/northbridge/amd/gx2/northbridge.c @@ -297,11 +297,9 @@ static void northbridge_init(device_t dev) static void set_resources(struct device *dev) { #if 0 - struct resource *resource, *last; + struct resource *res; - last = &dev->resource[dev->resources]; - - for(resource = &dev->resource[0]; resource < last; resource++) { + for(res = &dev->resource_list; res; res = res->next) { pci_set_resource(dev, resource); } #endif diff --git a/src/northbridge/amd/lx/northbridge.c b/src/northbridge/amd/lx/northbridge.c index 6eba99d9df..8fd8d9ecd2 100644 --- a/src/northbridge/amd/lx/northbridge.c +++ b/src/northbridge/amd/lx/northbridge.c @@ -318,18 +318,18 @@ static void northbridge_init(device_t dev) static void northbridge_set_resources(struct device *dev) { - struct resource *resource, *last; unsigned link; uint8_t line; - last = &dev->resource[dev->resources]; - - for (resource = &dev->resource[0]; resource < last; resource++) { +#if 0 + struct resource *res; + for (res = dev->resource_list; res; res = res->next) { // andrei: do not change the base address, it will make the VSA virtual registers unusable - //pci_set_resource(dev, resource); + //pci_set_resource(dev, res); // FIXME: static allocation may conflict with dynamic mappings! } +#endif for (link = 0; link < dev->links; link++) { struct bus *bus; |