Patchwork Some more mptables updates

login
register
about
Submitter Patrick Georgi
Date 2010-11-20 09:43:01
Message ID <4CE79825.3000706@georgi-clan.de>
Download mbox | patch
Permalink /patch/2337/
State Accepted
Headers show

Comments

Patrick Georgi - 2010-11-20 09:43:01
Hi,

conversion of mptable.c to use mptable_write_buses is still ongoing.
This patch handles a set of boards that do the bus handling reasonably
similar to each other.
All of them are abuild tested, none are boot tested.

This patch touches:
amd/dbm690t
amd/mahogany
amd/mahogany_fam10
amd/pistachio
amd/tilapia_fam10
asrock/939a785gmh
asus/m4a785-m
gigabyte/ma785gmt
gigabyte/ma78gm
iei/kino-780am2-fam10
jetway/pa78vm5
kontron/kt690
technexion/tim5690
technexion/tim8690

Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Uwe Hermann - 2010-11-21 12:34:14
On Sat, Nov 20, 2010 at 10:43:01AM +0100, Patrick Georgi wrote:
> conversion of mptable.c to use mptable_write_buses is still ongoing.
> This patch handles a set of boards that do the bus handling reasonably
> similar to each other.
> All of them are abuild tested, none are boot tested.

Looks good, but I didn't test on hardware either (yet).

Acked-by: Uwe Hermann <uwe@hermann-uwe.de>


Uwe.

Patch

Index: src/mainboard/asrock/939a785gmh/mptable.c
===================================================================
--- src/mainboard/asrock/939a785gmh/mptable.c	(revision 6098)
+++ src/mainboard/asrock/939a785gmh/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/asrock/939a785gmh/irq_tables.c
===================================================================
--- src/mainboard/asrock/939a785gmh/irq_tables.c	(revision 6098)
+++ src/mainboard/asrock/939a785gmh/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/asrock/939a785gmh/get_bus_conf.c
===================================================================
--- src/mainboard/asrock/939a785gmh/get_bus_conf.c	(revision 6098)
+++ src/mainboard/asrock/939a785gmh/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/kontron/kt690/mptable.c
===================================================================
--- src/mainboard/kontron/kt690/mptable.c	(revision 6098)
+++ src/mainboard/kontron/kt690/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 
 extern u32 apicid_sb600;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs690;
 extern u32 sbdn_sb600;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/kontron/kt690/irq_tables.c
===================================================================
--- src/mainboard/kontron/kt690/irq_tables.c	(revision 6098)
+++ src/mainboard/kontron/kt690/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 extern unsigned long sbdn_sb600;
Index: src/mainboard/kontron/kt690/get_bus_conf.c
===================================================================
--- src/mainboard/kontron/kt690/get_bus_conf.c	(revision 6098)
+++ src/mainboard/kontron/kt690/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs690[8];
 u8 bus_sb600[2];
 u32 apicid_sb600;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs690;
 u32 sbdn_sb600;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs690[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs690[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb600[0] = bus_rs690[0];
 
-	bus_type[bus_rs690[0]] = 1;
-
 	/* sb600 */
 	dev = dev_find_slot(bus_sb600[0], PCI_DEVFN(sbdn_sb600 + 0x14, 4));
 	if (dev) {
 		bus_sb600[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb600[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs690 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs690[0], PCI_DEVFN(sbdn_rs690 + i, 0));
 		if (dev) {
 			bus_rs690[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs690[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs690[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/gigabyte/ma78gm/mptable.c
===================================================================
--- src/mainboard/gigabyte/ma78gm/mptable.c	(revision 6098)
+++ src/mainboard/gigabyte/ma78gm/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/gigabyte/ma78gm/irq_tables.c
===================================================================
--- src/mainboard/gigabyte/ma78gm/irq_tables.c	(revision 6098)
+++ src/mainboard/gigabyte/ma78gm/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/gigabyte/ma78gm/get_bus_conf.c
===================================================================
--- src/mainboard/gigabyte/ma78gm/get_bus_conf.c	(revision 6098)
+++ src/mainboard/gigabyte/ma78gm/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/gigabyte/ma785gmt/mptable.c
===================================================================
--- src/mainboard/gigabyte/ma785gmt/mptable.c	(revision 6098)
+++ src/mainboard/gigabyte/ma785gmt/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/gigabyte/ma785gmt/irq_tables.c
===================================================================
--- src/mainboard/gigabyte/ma785gmt/irq_tables.c	(revision 6098)
+++ src/mainboard/gigabyte/ma785gmt/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/gigabyte/ma785gmt/get_bus_conf.c
===================================================================
--- src/mainboard/gigabyte/ma785gmt/get_bus_conf.c	(revision 6098)
+++ src/mainboard/gigabyte/ma785gmt/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/amd/pistachio/mptable.c
===================================================================
--- src/mainboard/amd/pistachio/mptable.c	(revision 6098)
+++ src/mainboard/amd/pistachio/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 
 extern u32 apicid_sb600;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs690;
 extern u32 sbdn_sb600;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/amd/pistachio/irq_tables.c
===================================================================
--- src/mainboard/amd/pistachio/irq_tables.c	(revision 6098)
+++ src/mainboard/amd/pistachio/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 extern u32 sbdn_sb600;
Index: src/mainboard/amd/pistachio/get_bus_conf.c
===================================================================
--- src/mainboard/amd/pistachio/get_bus_conf.c	(revision 6098)
+++ src/mainboard/amd/pistachio/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs690[8];
 u8 bus_sb600[2];
 u32 apicid_sb600;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs690;
 u32 sbdn_sb600;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs690[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs690[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb600[0] = bus_rs690[0];
 
-	bus_type[bus_rs690[0]] = 1;
-
 	/* sb600 */
 	dev = dev_find_slot(bus_sb600[0], PCI_DEVFN(sbdn_sb600 + 0x14, 4));
 	if (dev) {
 		bus_sb600[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb600[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs690 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs690[0], PCI_DEVFN(sbdn_rs690 + i, 0));
 		if (dev) {
 			bus_rs690[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs690[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs690[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/amd/mahogany/mptable.c
===================================================================
--- src/mainboard/amd/mahogany/mptable.c	(revision 6098)
+++ src/mainboard/amd/mahogany/mptable.c	(working copy)
@@ -26,20 +26,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -49,12 +47,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/amd/mahogany/irq_tables.c
===================================================================
--- src/mainboard/amd/mahogany/irq_tables.c	(revision 6098)
+++ src/mainboard/amd/mahogany/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/amd/mahogany/get_bus_conf.c
===================================================================
--- src/mainboard/amd/mahogany/get_bus_conf.c	(revision 6098)
+++ src/mainboard/amd/mahogany/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/amd/dbm690t/mptable.c
===================================================================
--- src/mainboard/amd/dbm690t/mptable.c	(revision 6098)
+++ src/mainboard/amd/dbm690t/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 
 extern u32 apicid_sb600;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs690;
 extern u32 sbdn_sb600;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/amd/dbm690t/irq_tables.c
===================================================================
--- src/mainboard/amd/dbm690t/irq_tables.c	(revision 6098)
+++ src/mainboard/amd/dbm690t/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 extern unsigned long sbdn_sb600;
Index: src/mainboard/amd/dbm690t/get_bus_conf.c
===================================================================
--- src/mainboard/amd/dbm690t/get_bus_conf.c	(revision 6098)
+++ src/mainboard/amd/dbm690t/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs690[8];
 u8 bus_sb600[2];
 u32 apicid_sb600;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs690;
 u32 sbdn_sb600;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs690[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs690[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb600[0] = bus_rs690[0];
 
-	bus_type[bus_rs690[0]] = 1;
-
 	/* sb600 */
 	dev = dev_find_slot(bus_sb600[0], PCI_DEVFN(sbdn_sb600 + 0x14, 4));
 	if (dev) {
 		bus_sb600[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb600[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs690 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs690[0], PCI_DEVFN(sbdn_rs690 + i, 0));
 		if (dev) {
 			bus_rs690[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs690[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs690[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/amd/mahogany_fam10/mptable.c
===================================================================
--- src/mainboard/amd/mahogany_fam10/mptable.c	(revision 6098)
+++ src/mainboard/amd/mahogany_fam10/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/amd/mahogany_fam10/irq_tables.c
===================================================================
--- src/mainboard/amd/mahogany_fam10/irq_tables.c	(revision 6098)
+++ src/mainboard/amd/mahogany_fam10/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/amd/mahogany_fam10/get_bus_conf.c
===================================================================
--- src/mainboard/amd/mahogany_fam10/get_bus_conf.c	(revision 6098)
+++ src/mainboard/amd/mahogany_fam10/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/amd/tilapia_fam10/mptable.c
===================================================================
--- src/mainboard/amd/tilapia_fam10/mptable.c	(revision 6098)
+++ src/mainboard/amd/tilapia_fam10/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/amd/tilapia_fam10/irq_tables.c
===================================================================
--- src/mainboard/amd/tilapia_fam10/irq_tables.c	(revision 6098)
+++ src/mainboard/amd/tilapia_fam10/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/amd/tilapia_fam10/get_bus_conf.c
===================================================================
--- src/mainboard/amd/tilapia_fam10/get_bus_conf.c	(revision 6098)
+++ src/mainboard/amd/tilapia_fam10/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/iei/kino-780am2-fam10/mptable.c
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/mptable.c	(revision 6098)
+++ src/mainboard/iei/kino-780am2-fam10/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/iei/kino-780am2-fam10/irq_tables.c
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/irq_tables.c	(revision 6098)
+++ src/mainboard/iei/kino-780am2-fam10/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/iei/kino-780am2-fam10/get_bus_conf.c
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/get_bus_conf.c	(revision 6098)
+++ src/mainboard/iei/kino-780am2-fam10/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/jetway/pa78vm5/mptable.c
===================================================================
--- src/mainboard/jetway/pa78vm5/mptable.c	(revision 6098)
+++ src/mainboard/jetway/pa78vm5/mptable.c	(working copy)
@@ -26,20 +26,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -49,12 +47,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/jetway/pa78vm5/irq_tables.c
===================================================================
--- src/mainboard/jetway/pa78vm5/irq_tables.c	(revision 6098)
+++ src/mainboard/jetway/pa78vm5/irq_tables.c	(working copy)
@@ -45,7 +45,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs780[8];
 extern u8 bus_sb700[2];
 extern unsigned long sbdn_sb700;
Index: src/mainboard/jetway/pa78vm5/get_bus_conf.c
===================================================================
--- src/mainboard/jetway/pa78vm5/get_bus_conf.c	(revision 6098)
+++ src/mainboard/jetway/pa78vm5/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/technexion/tim8690/mptable.c
===================================================================
--- src/mainboard/technexion/tim8690/mptable.c	(revision 6098)
+++ src/mainboard/technexion/tim8690/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 
 extern u32 apicid_sb600;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs690;
 extern u32 sbdn_sb600;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/technexion/tim8690/irq_tables.c
===================================================================
--- src/mainboard/technexion/tim8690/irq_tables.c	(revision 6098)
+++ src/mainboard/technexion/tim8690/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 extern unsigned long sbdn_sb600;
Index: src/mainboard/technexion/tim8690/get_bus_conf.c
===================================================================
--- src/mainboard/technexion/tim8690/get_bus_conf.c	(revision 6098)
+++ src/mainboard/technexion/tim8690/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs690[8];
 u8 bus_sb600[2];
 u32 apicid_sb600;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs690;
 u32 sbdn_sb600;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs690[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs690[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb600[0] = bus_rs690[0];
 
-	bus_type[bus_rs690[0]] = 1;
-
 	/* sb600 */
 	dev = dev_find_slot(bus_sb600[0], PCI_DEVFN(sbdn_sb600 + 0x14, 4));
 	if (dev) {
 		bus_sb600[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb600[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs690 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs690[0], PCI_DEVFN(sbdn_rs690 + i, 0));
 		if (dev) {
 			bus_rs690[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs690[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs690[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/technexion/tim5690/mptable.c
===================================================================
--- src/mainboard/technexion/tim5690/mptable.c	(revision 6098)
+++ src/mainboard/technexion/tim5690/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 
 extern u32 apicid_sb600;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs690;
 extern u32 sbdn_sb600;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/technexion/tim5690/irq_tables.c
===================================================================
--- src/mainboard/technexion/tim5690/irq_tables.c	(revision 6098)
+++ src/mainboard/technexion/tim5690/irq_tables.c	(working copy)
@@ -51,7 +51,6 @@ 
 	pirq_info->slot = slot;
 	pirq_info->rfu = rfu;
 }
-extern u8 bus_isa;
 extern u8 bus_rs690[8];
 extern u8 bus_sb600[2];
 extern unsigned long sbdn_sb600;
Index: src/mainboard/technexion/tim5690/get_bus_conf.c
===================================================================
--- src/mainboard/technexion/tim5690/get_bus_conf.c	(revision 6098)
+++ src/mainboard/technexion/tim5690/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs690[8];
 u8 bus_sb600[2];
 u32 apicid_sb600;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs690;
 u32 sbdn_sb600;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs690[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs690[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb600[0] = bus_rs690[0];
 
-	bus_type[bus_rs690[0]] = 1;
-
 	/* sb600 */
 	dev = dev_find_slot(bus_sb600[0], PCI_DEVFN(sbdn_sb600 + 0x14, 4));
 	if (dev) {
 		bus_sb600[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb600[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs690 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs690[0], PCI_DEVFN(sbdn_rs690 + i, 0));
 		if (dev) {
 			bus_rs690[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs690[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs690[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else
Index: src/mainboard/asus/m4a785-m/mptable.c
===================================================================
--- src/mainboard/asus/m4a785-m/mptable.c	(revision 6098)
+++ src/mainboard/asus/m4a785-m/mptable.c	(working copy)
@@ -25,20 +25,18 @@ 
 #include <stdint.h>
 #include <cpu/amd/amdfam10_sysconf.h>
 
-extern u8 bus_isa;
 extern u8 bus_rs780[11];
 extern u8 bus_sb700[2];
 
 extern u32 apicid_sb700;
 
-extern u32 bus_type[256];
 extern u32 sbdn_rs780;
 extern u32 sbdn_sb700;
 
 static void *smp_write_config_table(void *v)
 {
 	struct mp_config_table *mc;
-	int j;
+	int bus_isa;
 
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
@@ -48,12 +46,7 @@ 
 
 	get_bus_conf();
 
-	/* Bus:         Bus ID  Type */
-	/* define bus and isa numbers */
-	for (j = 0; j < bus_isa; j++) {
-		smp_write_bus(mc, j, (char *)"PCI   ");
-	}
-	smp_write_bus(mc, bus_isa, (char *)"ISA   ");
+	mptable_write_buses(mc, NULL, &bus_isa);
 
 	/* I/O APICs:   APIC ID Version State   Address */
 	{
Index: src/mainboard/asus/m4a785-m/get_bus_conf.c
===================================================================
--- src/mainboard/asus/m4a785-m/get_bus_conf.c	(revision 6098)
+++ src/mainboard/asus/m4a785-m/get_bus_conf.c	(working copy)
@@ -32,7 +32,6 @@ 
 /* Global variables for MB layouts and these will be shared by irqtable mptable
 * and acpi_tables busnum is default.
 */
-u8 bus_isa;
 u8 bus_rs780[11];
 u8 bus_sb700[2];
 u32 apicid_sb700;
@@ -54,8 +53,6 @@ 
 	0x20202020,
 };
 
-u32 bus_type[256];
-
 u32 sbdn_rs780;
 u32 sbdn_sb700;
 
@@ -67,7 +64,7 @@ 
 {
 	u32 apicid_base;
 	device_t dev;
-	int i, j;
+	int i;
 
 	if (get_bus_conf_done == 1)
 		return;		/* do it only once */
@@ -92,25 +89,13 @@ 
 		bus_rs780[i] = 0;
 	}
 
-	for (i = 0; i < 256; i++) {
-		bus_type[i] = 0; /* default ISA bus. */
-	}
-
-	bus_type[0] = 1;	/* pci */
-
 	bus_rs780[0] = (sysconf.pci1234[0] >> 16) & 0xff;
 	bus_sb700[0] = bus_rs780[0];
 
-	bus_type[bus_rs780[0]] = 1;
-
 	/* sb700 */
 	dev = dev_find_slot(bus_sb700[0], PCI_DEVFN(sbdn_sb700 + 0x14, 4));
 	if (dev) {
 		bus_sb700[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-		bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-		bus_isa++;
-		for (j = bus_sb700[1]; j < bus_isa; j++)
-			bus_type[j] = 1;
 	}
 
 	/* rs780 */
@@ -118,16 +103,10 @@ 
 		dev = dev_find_slot(bus_rs780[0], PCI_DEVFN(sbdn_rs780 + i, 0));
 		if (dev) {
 			bus_rs780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
-			if(255 != bus_rs780[i]) {
-				bus_isa = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
-				bus_isa++;
-				bus_type[bus_rs780[i]] = 1; /* PCI bus. */
-			}
 		}
 	}
 
 	/* I/O APICs:   APIC ID Version State   Address */
-	bus_isa = 10;
 #if CONFIG_LOGICAL_CPUS==1
 	apicid_base = get_apicid_base(1);
 #else