mptable: Refactor mptable generation some more
[coreboot.git] / src / mainboard / msi / ms7260 / mptable.c
index 368eb69afe3fedd6afc4b665b2e65fdf8f5753bd..bef81ef2c2fbd176e57d87d120fe19d8f1d29000 100644 (file)
 #include <stdint.h>
 #include <cpu/amd/amdk8_sysconf.h>
 
-extern unsigned char bus_isa;
 extern unsigned char bus_mcp55[8];     // 1
 extern unsigned apicid_mcp55;
-extern unsigned bus_type[256];
 
 static void *smp_write_config_table(void *v)
 {
        struct mp_config_table *mc;
        unsigned int sbdn;
-       int i, j;
+       int i, j, bus_isa;
 
        mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
 
-       mptable_init(mc, "MS-7260     ", LAPIC_ADDR);
+       mptable_init(mc, LAPIC_ADDR);
 
        smp_write_processors(mc);
 
        get_bus_conf();
        sbdn = sysconf.sbdn;
 
-       /* Bus: Bus ID  Type */
-       /* Define bus and ISA numbers. */
-       for (j = 0; j < 256; j++) {
-               if (bus_type[j])
-                       smp_write_bus(mc, j, "PCI   ");
-       }
-       smp_write_bus(mc, bus_isa, "ISA   ");
+       mptable_write_buses(mc, NULL, &bus_isa);
 
        /* I/O APICs: APIC ID   Version State           Address */
        {
@@ -102,23 +94,17 @@ static void *smp_write_config_table(void *v)
        }
 
        /* Local Ints:       Type       Trigger               Polarity              Bus ID   IRQ  APIC ID      PIN# */
-       smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, bus_isa, 0x0, MP_APIC_ALL, 0x0);
-       smp_write_intsrc(mc, mp_NMI,    MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, bus_isa, 0x0, MP_APIC_ALL, 0x1);
+       mptable_lintsrc(mc, bus_isa);
 
        /* There is no extension information... */
 
        /* Compute the checksums. */
-       mc->mpe_checksum =
-           smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length);
-       mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length);
-       printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n",
-                    mc, smp_next_mpe_entry(mc));
-       return smp_next_mpe_entry(mc);
+       return mptable_finalize(mc);
 }
 
 unsigned long write_smp_table(unsigned long addr)
 {
        void *v;
-       v = smp_write_floating_table(addr);
+       v = smp_write_floating_table(addr, 0);
        return (unsigned long)smp_write_config_table(v);
 }