summaryrefslogtreecommitdiff
path: root/src/mainboard/tyan
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-10-01 12:52:52 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-10-01 12:52:52 +0000
commit2ee6779a64922af755a35ce70f85f2d67b488557 (patch)
tree4ae6d7310d71fa29baab3e937cfcd9bb408db5a6 /src/mainboard/tyan
parentdc65196f8f18c28085d40ccbeb45bba3bfe28294 (diff)
downloadcoreboot-2ee6779a64922af755a35ce70f85f2d67b488557.tar.xz
The ARRAY_SIZE macro is convenient, yet mostly unused. Switch lots of
code to use it. That makes the code more readable and also less error-prone. Abuild tested. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3624 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard/tyan')
-rw-r--r--src/mainboard/tyan/s1846/auto.c3
-rw-r--r--src/mainboard/tyan/s2735/auto.c3
-rw-r--r--src/mainboard/tyan/s2850/auto.c3
-rw-r--r--src/mainboard/tyan/s2850/cache_as_ram_auto.c3
-rw-r--r--src/mainboard/tyan/s2875/auto.c3
-rw-r--r--src/mainboard/tyan/s2875/cache_as_ram_auto.c3
-rw-r--r--src/mainboard/tyan/s2880/cache_as_ram_auto.c3
-rw-r--r--src/mainboard/tyan/s2881/auto.c3
-rw-r--r--src/mainboard/tyan/s2881/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2881/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2882/auto.c3
-rw-r--r--src/mainboard/tyan/s2882/cache_as_ram_auto.c3
-rw-r--r--src/mainboard/tyan/s2885/auto.c3
-rw-r--r--src/mainboard/tyan/s2885/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2885/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2891/auto.c3
-rw-r--r--src/mainboard/tyan/s2891/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2891/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2892/auto.c3
-rw-r--r--src/mainboard/tyan/s2892/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2892/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2895/auto.c3
-rw-r--r--src/mainboard/tyan/s2895/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2895/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2912/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2912/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s2912_fam10/get_bus_conf.c3
-rw-r--r--src/mainboard/tyan/s2912_fam10/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s4880/auto.c3
-rw-r--r--src/mainboard/tyan/s4880/cache_as_ram_auto.c3
-rw-r--r--src/mainboard/tyan/s4880/resourcemap.c2
-rw-r--r--src/mainboard/tyan/s4882/auto.c3
-rw-r--r--src/mainboard/tyan/s4882/resourcemap.c2
33 files changed, 57 insertions, 33 deletions
diff --git a/src/mainboard/tyan/s1846/auto.c b/src/mainboard/tyan/s1846/auto.c
index 8b884a02d3..d80e23d9a2 100644
--- a/src/mainboard/tyan/s1846/auto.c
+++ b/src/mainboard/tyan/s1846/auto.c
@@ -26,6 +26,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <arch/hlt.h>
+#include <stdlib.h>
#include "pc80/serial.c"
#include "arch/i386/lib/console.c"
#include "ram/ramtest.c"
@@ -67,6 +68,6 @@ static void main(unsigned long bist)
report_bist_failure(bist);
enable_smbus();
/* dump_spd_registers(&memctrl[0]); */
- sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl);
+ sdram_initialize(ARRAY_SIZE(memctrl), memctrl);
/* ram_check(0, 640 * 1024); */
}
diff --git a/src/mainboard/tyan/s2735/auto.c b/src/mainboard/tyan/s2735/auto.c
index 9cf5e50187..456c342b62 100644
--- a/src/mainboard/tyan/s2735/auto.c
+++ b/src/mainboard/tyan/s2735/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -96,7 +97,7 @@ static void main(unsigned long bist)
#endif
memreset_setup();
- sdram_initialize(sizeof(memctrl)/sizeof(memctrl[0]), memctrl);
+ sdram_initialize(ARRAY_SIZE(memctrl), memctrl);
}
#if 0
else {
diff --git a/src/mainboard/tyan/s2850/auto.c b/src/mainboard/tyan/s2850/auto.c
index e0d85dbd56..bec1afabbd 100644
--- a/src/mainboard/tyan/s2850/auto.c
+++ b/src/mainboard/tyan/s2850/auto.c
@@ -6,6 +6,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -197,6 +198,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu) / sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2850/cache_as_ram_auto.c b/src/mainboard/tyan/s2850/cache_as_ram_auto.c
index bd53a693fc..318903d227 100644
--- a/src/mainboard/tyan/s2850/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2850/cache_as_ram_auto.c
@@ -7,6 +7,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -206,7 +207,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
}
diff --git a/src/mainboard/tyan/s2875/auto.c b/src/mainboard/tyan/s2875/auto.c
index 3f23f5a237..e988a005e7 100644
--- a/src/mainboard/tyan/s2875/auto.c
+++ b/src/mainboard/tyan/s2875/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -167,6 +168,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2875/cache_as_ram_auto.c b/src/mainboard/tyan/s2875/cache_as_ram_auto.c
index e825c6ce6b..2611162714 100644
--- a/src/mainboard/tyan/s2875/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2875/cache_as_ram_auto.c
@@ -7,6 +7,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -203,7 +204,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
diff --git a/src/mainboard/tyan/s2880/cache_as_ram_auto.c b/src/mainboard/tyan/s2880/cache_as_ram_auto.c
index bb423673d8..de4b4895f8 100644
--- a/src/mainboard/tyan/s2880/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2880/cache_as_ram_auto.c
@@ -7,6 +7,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -205,7 +206,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
}
diff --git a/src/mainboard/tyan/s2881/auto.c b/src/mainboard/tyan/s2881/auto.c
index 924d7589b2..ea339fe5bd 100644
--- a/src/mainboard/tyan/s2881/auto.c
+++ b/src/mainboard/tyan/s2881/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -172,6 +173,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2881/get_bus_conf.c b/src/mainboard/tyan/s2881/get_bus_conf.c
index 82de11317b..d4c01675ab 100644
--- a/src/mainboard/tyan/s2881/get_bus_conf.c
+++ b/src/mainboard/tyan/s2881/get_bus_conf.c
@@ -8,6 +8,7 @@
#endif
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
@@ -63,7 +64,7 @@ void get_bus_conf(void)
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2881/resourcemap.c b/src/mainboard/tyan/s2881/resourcemap.c
index 22723eafad..cecb790795 100644
--- a/src/mainboard/tyan/s2881/resourcemap.c
+++ b/src/mainboard/tyan/s2881/resourcemap.c
@@ -258,7 +258,7 @@ static void setup_s2881_resource_map(void)
PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000,
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2882/auto.c b/src/mainboard/tyan/s2882/auto.c
index befd4da097..53b25a2c24 100644
--- a/src/mainboard/tyan/s2882/auto.c
+++ b/src/mainboard/tyan/s2882/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -176,6 +177,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2882/cache_as_ram_auto.c b/src/mainboard/tyan/s2882/cache_as_ram_auto.c
index dd3e6251e1..a4b894cd0d 100644
--- a/src/mainboard/tyan/s2882/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2882/cache_as_ram_auto.c
@@ -7,6 +7,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -208,7 +209,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
diff --git a/src/mainboard/tyan/s2885/auto.c b/src/mainboard/tyan/s2885/auto.c
index 7b892d0527..c926487d5a 100644
--- a/src/mainboard/tyan/s2885/auto.c
+++ b/src/mainboard/tyan/s2885/auto.c
@@ -6,6 +6,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -178,7 +179,7 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
diff --git a/src/mainboard/tyan/s2885/get_bus_conf.c b/src/mainboard/tyan/s2885/get_bus_conf.c
index 68ed3d2e87..b50f671f9b 100644
--- a/src/mainboard/tyan/s2885/get_bus_conf.c
+++ b/src/mainboard/tyan/s2885/get_bus_conf.c
@@ -8,6 +8,7 @@
#endif
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default
@@ -65,7 +66,7 @@ void get_bus_conf(void)
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2885/resourcemap.c b/src/mainboard/tyan/s2885/resourcemap.c
index bc2a8ba673..4a686020c8 100644
--- a/src/mainboard/tyan/s2885/resourcemap.c
+++ b/src/mainboard/tyan/s2885/resourcemap.c
@@ -259,7 +259,7 @@ static void setup_s2885_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2891/auto.c b/src/mainboard/tyan/s2891/auto.c
index e264f366b1..aab040f6d2 100644
--- a/src/mainboard/tyan/s2891/auto.c
+++ b/src/mainboard/tyan/s2891/auto.c
@@ -6,6 +6,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -145,6 +146,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2891/get_bus_conf.c b/src/mainboard/tyan/s2891/get_bus_conf.c
index 1f8c8fe244..779f8885d0 100644
--- a/src/mainboard/tyan/s2891/get_bus_conf.c
+++ b/src/mainboard/tyan/s2891/get_bus_conf.c
@@ -8,6 +8,7 @@
#endif
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default
@@ -71,7 +72,7 @@ void get_bus_conf(void)
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2891/resourcemap.c b/src/mainboard/tyan/s2891/resourcemap.c
index 312ce03ad7..f7929b96c0 100644
--- a/src/mainboard/tyan/s2891/resourcemap.c
+++ b/src/mainboard/tyan/s2891/resourcemap.c
@@ -260,7 +260,7 @@ static void setup_s2891_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2892/auto.c b/src/mainboard/tyan/s2892/auto.c
index 3bd9209f09..bce2bbda4d 100644
--- a/src/mainboard/tyan/s2892/auto.c
+++ b/src/mainboard/tyan/s2892/auto.c
@@ -6,6 +6,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -147,6 +148,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2892/get_bus_conf.c b/src/mainboard/tyan/s2892/get_bus_conf.c
index 4f215ce9ae..4869b31c46 100644
--- a/src/mainboard/tyan/s2892/get_bus_conf.c
+++ b/src/mainboard/tyan/s2892/get_bus_conf.c
@@ -8,6 +8,7 @@
#endif
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default
@@ -68,7 +69,7 @@ void get_bus_conf(void)
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2892/resourcemap.c b/src/mainboard/tyan/s2892/resourcemap.c
index 04d3f59edd..53482cc33e 100644
--- a/src/mainboard/tyan/s2892/resourcemap.c
+++ b/src/mainboard/tyan/s2892/resourcemap.c
@@ -260,7 +260,7 @@ static void setup_s2892_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2895/auto.c b/src/mainboard/tyan/s2895/auto.c
index a4b86627e1..6663f23f3b 100644
--- a/src/mainboard/tyan/s2895/auto.c
+++ b/src/mainboard/tyan/s2895/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -172,6 +173,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s2895/get_bus_conf.c b/src/mainboard/tyan/s2895/get_bus_conf.c
index c44095b2c3..04e9019355 100644
--- a/src/mainboard/tyan/s2895/get_bus_conf.c
+++ b/src/mainboard/tyan/s2895/get_bus_conf.c
@@ -8,6 +8,7 @@
#endif
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default
@@ -76,7 +77,7 @@ void get_bus_conf(void)
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2895/resourcemap.c b/src/mainboard/tyan/s2895/resourcemap.c
index 9de9b2e107..aed892acf1 100644
--- a/src/mainboard/tyan/s2895/resourcemap.c
+++ b/src/mainboard/tyan/s2895/resourcemap.c
@@ -261,7 +261,7 @@ static void setup_mb_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2912/get_bus_conf.c b/src/mainboard/tyan/s2912/get_bus_conf.c
index 7bb5f76788..9d6b9d7232 100644
--- a/src/mainboard/tyan/s2912/get_bus_conf.c
+++ b/src/mainboard/tyan/s2912/get_bus_conf.c
@@ -30,6 +30,7 @@
#include <cpu/amd/amdk8_sysconf.h>
+#include <stdlib.h>
#include "mb_sysconf.h"
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
@@ -107,7 +108,7 @@ void get_bus_conf(void)
m = sysconf.mb;
memset(m, 0, sizeof(struct mb_sysconf_t));
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2912/resourcemap.c b/src/mainboard/tyan/s2912/resourcemap.c
index 4801643c93..f289ce7898 100644
--- a/src/mainboard/tyan/s2912/resourcemap.c
+++ b/src/mainboard/tyan/s2912/resourcemap.c
@@ -277,7 +277,7 @@ static void setup_mb_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s2912_fam10/get_bus_conf.c b/src/mainboard/tyan/s2912_fam10/get_bus_conf.c
index f1bb721be5..d1cec8d815 100644
--- a/src/mainboard/tyan/s2912_fam10/get_bus_conf.c
+++ b/src/mainboard/tyan/s2912_fam10/get_bus_conf.c
@@ -30,6 +30,7 @@
#include <cpu/amd/amdfam10_sysconf.h>
+#include <stdlib.h>
#include "mb_sysconf.h"
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
@@ -83,7 +84,7 @@ void get_bus_conf(void)
m = sysconf.mb;
memset(m, 0, sizeof(struct mb_sysconf_t));
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]);
+ sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i];
diff --git a/src/mainboard/tyan/s2912_fam10/resourcemap.c b/src/mainboard/tyan/s2912_fam10/resourcemap.c
index cb135a3274..60633d5ef1 100644
--- a/src/mainboard/tyan/s2912_fam10/resourcemap.c
+++ b/src/mainboard/tyan/s2912_fam10/resourcemap.c
@@ -277,7 +277,7 @@ static void setup_mb_resource_map(void)
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s4880/auto.c b/src/mainboard/tyan/s4880/auto.c
index 7598e14199..36115f6a0d 100644
--- a/src/mainboard/tyan/s4880/auto.c
+++ b/src/mainboard/tyan/s4880/auto.c
@@ -7,6 +7,7 @@
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <arch/cpu.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -227,6 +228,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s4880/cache_as_ram_auto.c b/src/mainboard/tyan/s4880/cache_as_ram_auto.c
index b7064778bb..2e8eb3bb48 100644
--- a/src/mainboard/tyan/s4880/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s4880/cache_as_ram_auto.c
@@ -7,6 +7,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -254,7 +255,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
}
diff --git a/src/mainboard/tyan/s4880/resourcemap.c b/src/mainboard/tyan/s4880/resourcemap.c
index d9315a026a..cf45d55532 100644
--- a/src/mainboard/tyan/s4880/resourcemap.c
+++ b/src/mainboard/tyan/s4880/resourcemap.c
@@ -258,7 +258,7 @@ static void setup_s4880_resource_map(void)
PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000,
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}
diff --git a/src/mainboard/tyan/s4882/auto.c b/src/mainboard/tyan/s4882/auto.c
index 6daa5d8a42..7576e4de26 100644
--- a/src/mainboard/tyan/s4882/auto.c
+++ b/src/mainboard/tyan/s4882/auto.c
@@ -6,6 +6,7 @@
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
+#include <stdlib.h>
#include "option_table.h"
#include "pc80/mc146818rtc_early.c"
#include "pc80/serial.c"
@@ -227,6 +228,6 @@ static void main(unsigned long bist)
enable_smbus();
memreset_setup();
- sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
+ sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
diff --git a/src/mainboard/tyan/s4882/resourcemap.c b/src/mainboard/tyan/s4882/resourcemap.c
index 8d9307c68f..0e5be61a7c 100644
--- a/src/mainboard/tyan/s4882/resourcemap.c
+++ b/src/mainboard/tyan/s4882/resourcemap.c
@@ -258,7 +258,7 @@ static void setup_s4882_resource_map(void)
PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000,
};
int max;
- max = sizeof(register_values)/sizeof(register_values[0]);
+ max = ARRAY_SIZE(register_values);
setup_resource_map(register_values, max);
}