mptable: Refactor mptable generation some more
[coreboot.git] / src / mainboard / ibase / mb899 / mptable.c
index 53156a3f48037b7696b11e72186bcf72dcb1f696..0ff189657ed88f0cac76ef23485f90df078f3161 100644 (file)
@@ -119,38 +119,15 @@ static void *smp_write_config_table(void *v)
        smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x2, 0x0, ioapic_id, 0x10);
 
        /* Local Ints:  Type    Polarity    Trigger     Bus ID   IRQ    APIC ID PIN# */
-       smp_write_lintsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x0, MP_APIC_ALL, 0x0);
-       smp_write_lintsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x0, MP_APIC_ALL, 0x1);
+       mptable_lintsrc(mc, isa_bus);
 
        /* 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);
-}
-
-/* MP table generation in coreboot is not very well designed;
- * One of the issues is that it knows nothing about Virtual
- * Wire mode, which everyone uses since a decade or so. This
- * function fixes up our floating table. This spares us doing
- * a half-baked fix of adding a new parameter to 200+ calls
- * to smp_write_floating_table()
- */
-static void fixup_virtual_wire(void *v)
-{
-        struct intel_mp_floating *mf = v;
-
-        mf->mpf_checksum = 0;
-        mf->mpf_feature2 = MP_FEATURE_VIRTUALWIRE;
-        mf->mpf_checksum = smp_compute_checksum(mf, mf->mpf_length*16);
+       return mptable_finalize(mc);
 }
 
 unsigned long write_smp_table(unsigned long addr)
 {
        void *v;
-       v = smp_write_floating_table(addr);
-       fixup_virtual_wire(v);
+       v = smp_write_floating_table(addr, 1);
        return (unsigned long)smp_write_config_table(v);
 }