mptable: Refactor mptable generation some more
[coreboot.git] / src / mainboard / amd / inagua / mptable.c
index 86f08db7c1cb79a9caaa3077a52b610ac5f7139d..fa7de7d122087d90709f4304cab4d7d08dda6129 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdint.h>
 #include <arch/cpu.h>
 #include <cpu/x86/lapic.h>
+#include <SBPLATFORM.h>
 
 #define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 extern u8 bus_sb800[2];
@@ -116,11 +117,8 @@ static void *smp_write_config_table(void *v)
   u32 dword;
   u8 byte;
     
-  dword = 0;
-  dword = pm_ioread(0x34) & 0xF0;
-  dword |= (pm_ioread(0x35) & 0xFF) << 8;
-  dword |= (pm_ioread(0x36) & 0xFF) << 16;
-  dword |= (pm_ioread(0x37) & 0xFF) << 24;
+  ReadPMIO(SB_PMIOA_REG34, AccWidthUint32, &dword);
+  dword &= 0xFFFFFFF0;
   /* Set IO APIC ID onto IO_APIC_ID */
   write32 (dword, 0x00);
   write32 (dword + 0x10, IO_APIC_ID << 24);
@@ -231,17 +229,12 @@ static void *smp_write_config_table(void *v)
   /* 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);
 }