From c25cc11ae32e10a7d0c9f04c29bfb7eca4d9c210 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Fri, 21 May 2010 14:33:48 +0000 Subject: Use lists instead of arrays for resources in devices to reduce memory usage. Signed-off-by: Myles Watson Acked-by: Patrick Georgi git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5576 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/southbridge/amd/sb600/sb600_lpc.c | 6 ++---- src/southbridge/amd/sb700/sb700_lpc.c | 6 ++---- src/southbridge/broadcom/bcm5785/bcm5785_lpc.c | 6 ++---- src/southbridge/nvidia/ck804/ck804_lpc.c | 5 ++--- src/southbridge/nvidia/mcp55/mcp55_lpc.c | 5 ++--- src/southbridge/sis/sis966/sis966_lpc.c | 5 ++--- 6 files changed, 12 insertions(+), 21 deletions(-) (limited to 'src/southbridge') diff --git a/src/southbridge/amd/sb600/sb600_lpc.c b/src/southbridge/amd/sb600/sb600_lpc.c index 1f3253f55b..0653772385 100644 --- a/src/southbridge/amd/sb600/sb600_lpc.c +++ b/src/southbridge/amd/sb600/sb600_lpc.c @@ -108,7 +108,6 @@ static void sb600_lpc_enable_childrens_resources(device_t dev) { u32 link; u32 reg, reg_x; - int i; int var_num = 0; u16 reg_var[3]; @@ -122,10 +121,9 @@ static void sb600_lpc_enable_childrens_resources(device_t dev) enable_resources(child); if (child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for (i = 0; i < child->resources; i++) { - struct resource *res; + struct resource *res; + for (res = child->resource_list; res; res = res->next) { u32 base, end; /* don't need long long */ - res = &child->resource[i]; if (!(res->flags & IORESOURCE_IO)) continue; base = res->base; diff --git a/src/southbridge/amd/sb700/sb700_lpc.c b/src/southbridge/amd/sb700/sb700_lpc.c index 0dcf0d1095..ab0a5ba6cc 100644 --- a/src/southbridge/amd/sb700/sb700_lpc.c +++ b/src/southbridge/amd/sb700/sb700_lpc.c @@ -120,7 +120,6 @@ static void sb700_lpc_enable_childrens_resources(device_t dev) { u32 link; u32 reg, reg_x; - int i; int var_num = 0; u16 reg_var[3]; @@ -134,10 +133,9 @@ static void sb700_lpc_enable_childrens_resources(device_t dev) enable_resources(child); if (child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for (i = 0; i < child->resources; i++) { - struct resource *res; + struct resource *res; + for (res = child->resource_list; res; res = res->next) { u32 base, end; /* don't need long long */ - res = &child->resource[i]; if (!(res->flags & IORESOURCE_IO)) continue; base = res->base; diff --git a/src/southbridge/broadcom/bcm5785/bcm5785_lpc.c b/src/southbridge/broadcom/bcm5785/bcm5785_lpc.c index 29c08ab74e..a80f5d79d5 100644 --- a/src/southbridge/broadcom/bcm5785/bcm5785_lpc.c +++ b/src/southbridge/broadcom/bcm5785/bcm5785_lpc.c @@ -69,7 +69,6 @@ static void bcm5785_lpc_enable_childrens_resources(device_t dev) { unsigned link; uint32_t reg; - int i; reg = pci_read_config8(dev, 0x44); @@ -78,10 +77,9 @@ static void bcm5785_lpc_enable_childrens_resources(device_t dev) for (child = dev->link[link].children; child; child = child->sibling) { enable_resources(child); if(child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for(i=0;iresources;i++) { - struct resource *res; + struct resource *res; + for(res = child->resource_list; res; res = res->next) { unsigned long base, end; // don't need long long - res = &child->resource[i]; if(!(res->flags & IORESOURCE_IO)) continue; base = res->base; end = resource_end(res); diff --git a/src/southbridge/nvidia/ck804/ck804_lpc.c b/src/southbridge/nvidia/ck804/ck804_lpc.c index 3458738f9b..a6637cad1c 100644 --- a/src/southbridge/nvidia/ck804/ck804_lpc.c +++ b/src/southbridge/nvidia/ck804/ck804_lpc.c @@ -242,10 +242,9 @@ static void ck804_lpc_enable_childrens_resources(device_t dev) for (child = dev->link[link].children; child; child = child->sibling) { enable_resources(child); if (child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for (i = 0; i < child->resources; i++) { - struct resource *res; + struct resource *res; + for (res = child->resource_list; res; res = res->next) { unsigned long base, end; // don't need long long - res = &child->resource[i]; if (!(res->flags & IORESOURCE_IO)) continue; base = res->base; diff --git a/src/southbridge/nvidia/mcp55/mcp55_lpc.c b/src/southbridge/nvidia/mcp55/mcp55_lpc.c index 1d2a066b1b..0f9a50ca4f 100644 --- a/src/southbridge/nvidia/mcp55/mcp55_lpc.c +++ b/src/southbridge/nvidia/mcp55/mcp55_lpc.c @@ -217,10 +217,9 @@ static void mcp55_lpc_enable_childrens_resources(device_t dev) for (child = dev->link[link].children; child; child = child->sibling) { enable_resources(child); if(child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for(i=0;iresources;i++) { - struct resource *res; + struct resource *res; + for(res = child->resource_list; res; res = res->next) { unsigned long base, end; // don't need long long - res = &child->resource[i]; if(!(res->flags & IORESOURCE_IO)) continue; base = res->base; end = resource_end(res); diff --git a/src/southbridge/sis/sis966/sis966_lpc.c b/src/southbridge/sis/sis966/sis966_lpc.c index 2efc3802b2..a3b79f078a 100644 --- a/src/southbridge/sis/sis966/sis966_lpc.c +++ b/src/southbridge/sis/sis966/sis966_lpc.c @@ -210,10 +210,9 @@ static void sis966_lpc_enable_childrens_resources(device_t dev) for (child = dev->link[link].children; child; child = child->sibling) { enable_resources(child); if(child->enabled && (child->path.type == DEVICE_PATH_PNP)) { - for(i=0;iresources;i++) { - struct resource *res; + struct resource *res; + for(res = child->resource_list; res; res = res->next) { unsigned long base, end; // don't need long long - res = &child->resource[i]; if(!(res->flags & IORESOURCE_IO)) continue; base = res->base; end = resource_end(res); -- cgit v1.2.3