x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
[safe/jmp/linux-2.6] / arch / x86 / kernel / mpparse.c
index f6fb192..a2c1edd 100644 (file)
@@ -3,7 +3,7 @@
  *     compliant MP-table parsing routines.
  *
  *     (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk>
- *     (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com>
+ *     (c) 1998, 1999, 2000, 2009 Ingo Molnar <mingo@redhat.com>
  *      (c) 2008 Alexey Starikovskiy <astarikovskiy@suse.de>
  */
 
@@ -17,6 +17,7 @@
 #include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/smp.h>
+#include <linux/pci.h>
 
 #include <asm/mtrr.h>
 #include <asm/mpspec.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
 
-#include <mach_apic.h>
-#ifdef CONFIG_X86_32
-#include <mach_apicdef.h>
-#include <mach_mpparse.h>
-#endif
-
+#include <asm/apic.h>
 /*
  * Checksum an MP configuration block.
  */
@@ -49,6 +45,11 @@ static int __init mpf_checksum(unsigned char *mp, int len)
        return sum & 0xFF;
 }
 
+int __init default_mpc_apic_id(struct mpc_cpu *m)
+{
+       return m->apicid;
+}
+
 static void __init MP_processor_info(struct mpc_cpu *m)
 {
        int apicid;
@@ -59,10 +60,7 @@ static void __init MP_processor_info(struct mpc_cpu *m)
                return;
        }
 
-       if (x86_quirks->mpc_apic_id)
-               apicid = x86_quirks->mpc_apic_id(m);
-       else
-               apicid = m->apicid;
+       apicid = x86_init.mpparse.mpc_apic_id(m);
 
        if (m->cpuflag & CPU_BOOTPROCESSOR) {
                bootup_cpu = " (Bootup-CPU)";
@@ -74,16 +72,18 @@ static void __init MP_processor_info(struct mpc_cpu *m)
 }
 
 #ifdef CONFIG_X86_IO_APIC
-static void __init MP_bus_info(struct mpc_bus *m)
+void __init default_mpc_oem_bus_info(struct mpc_bus *m, char *str)
 {
-       char str[7];
        memcpy(str, m->bustype, 6);
        str[6] = 0;
+       apic_printk(APIC_VERBOSE, "Bus #%d is %s\n", m->busid, str);
+}
 
-       if (x86_quirks->mpc_oem_bus_info)
-               x86_quirks->mpc_oem_bus_info(m, str);
-       else
-               apic_printk(APIC_VERBOSE, "Bus #%d is %s\n", m->busid, str);
+static void __init MP_bus_info(struct mpc_bus *m)
+{
+       char str[7];
+
+       x86_init.mpparse.mpc_oem_bus_info(m, str);
 
 #if MAX_MP_BUSSES < 256
        if (m->busid >= MAX_MP_BUSSES) {
@@ -100,8 +100,8 @@ static void __init MP_bus_info(struct mpc_bus *m)
                mp_bus_id_to_type[m->busid] = MP_BUS_ISA;
 #endif
        } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) {
-               if (x86_quirks->mpc_oem_pci_bus)
-                       x86_quirks->mpc_oem_pci_bus(m);
+               if (x86_init.mpparse.mpc_oem_pci_bus)
+                       x86_init.mpparse.mpc_oem_pci_bus(m);
 
                clear_bit(m->busid, mp_bus_not_pci);
 #if defined(CONFIG_EISA) || defined(CONFIG_MCA)
@@ -114,9 +114,6 @@ static void __init MP_bus_info(struct mpc_bus *m)
        } else
                printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str);
 }
-#endif
-
-#ifdef CONFIG_X86_IO_APIC
 
 static int bad_ioapic(unsigned long address)
 {
@@ -229,8 +226,12 @@ static void __init MP_intsrc_info(struct mpc_intsrc *m)
        if (++mp_irq_entries == MAX_IRQ_SOURCES)
                panic("Max # of irq sources exceeded!!\n");
 }
+#else /* CONFIG_X86_IO_APIC */
+static inline void __init MP_bus_info(struct mpc_bus *m) {}
+static inline void __init MP_ioapic_info(struct mpc_ioapic *m) {}
+static inline void __init MP_intsrc_info(struct mpc_intsrc *m) {}
+#endif /* CONFIG_X86_IO_APIC */
 
-#endif
 
 static void __init MP_lintsrc_info(struct mpc_lintsrc *m)
 {
@@ -280,6 +281,22 @@ static int __init smp_check_mpc(struct mpc_table *mpc, char *oem, char *str)
        return 1;
 }
 
+static void skip_entry(unsigned char **ptr, int *count, int size)
+{
+       *ptr += size;
+       *count += size;
+}
+
+static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)
+{
+       printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n"
+               "type %x\n", *mpt);
+       print_hex_dump(KERN_ERR, "  ", DUMP_PREFIX_ADDRESS, 16,
+                       1, mpc, mpc->length, 1);
+}
+
+void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { }
+
 static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 {
        char str[16];
@@ -292,7 +309,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
                return 0;
 
 #ifdef CONFIG_X86_32
-       mps_oem_check(mpc, oem, str);
+       generic_mps_oem_check(mpc, oem, str);
 #endif
        /* save the local APIC address, it might be non-default */
        if (!acpi_lapic)
@@ -301,89 +318,47 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
        if (early)
                return 1;
 
-       if (mpc->oemptr && x86_quirks->smp_read_mpc_oem) {
-               struct mpc_oemtable *oem_table = (void *)(long)mpc->oemptr;
-               x86_quirks->smp_read_mpc_oem(oem_table, mpc->oemsize);
-       }
+       if (mpc->oemptr)
+               x86_init.mpparse.smp_read_mpc_oem(mpc);
 
        /*
         *      Now process the configuration blocks.
         */
-       if (x86_quirks->mpc_record)
-               *x86_quirks->mpc_record = 0;
+       x86_init.mpparse.mpc_record(0);
 
        while (count < mpc->length) {
                switch (*mpt) {
                case MP_PROCESSOR:
-                       {
-                               struct mpc_cpu *m = (struct mpc_cpu *)mpt;
-                               /* ACPI may have already provided this data */
-                               if (!acpi_lapic)
-                                       MP_processor_info(m);
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       /* ACPI may have already provided this data */
+                       if (!acpi_lapic)
+                               MP_processor_info((struct mpc_cpu *)mpt);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_cpu));
+                       break;
                case MP_BUS:
-                       {
-                               struct mpc_bus *m = (struct mpc_bus *)mpt;
-#ifdef CONFIG_X86_IO_APIC
-                               MP_bus_info(m);
-#endif
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       MP_bus_info((struct mpc_bus *)mpt);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_bus));
+                       break;
                case MP_IOAPIC:
-                       {
-#ifdef CONFIG_X86_IO_APIC
-                               struct mpc_ioapic *m = (struct mpc_ioapic *)mpt;
-                               MP_ioapic_info(m);
-#endif
-                               mpt += sizeof(struct mpc_ioapic);
-                               count += sizeof(struct mpc_ioapic);
-                               break;
-                       }
+                       MP_ioapic_info((struct mpc_ioapic *)mpt);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
+                       break;
                case MP_INTSRC:
-                       {
-#ifdef CONFIG_X86_IO_APIC
-                               struct mpc_intsrc *m = (struct mpc_intsrc *)mpt;
-
-                               MP_intsrc_info(m);
-#endif
-                               mpt += sizeof(struct mpc_intsrc);
-                               count += sizeof(struct mpc_intsrc);
-                               break;
-                       }
+                       MP_intsrc_info((struct mpc_intsrc *)mpt);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
+                       break;
                case MP_LINTSRC:
-                       {
-                               struct mpc_lintsrc *m =
-                                   (struct mpc_lintsrc *)mpt;
-                               MP_lintsrc_info(m);
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       MP_lintsrc_info((struct mpc_lintsrc *)mpt);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_lintsrc));
+                       break;
                default:
                        /* wrong mptable */
-                       printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n");
-                       printk(KERN_ERR "type %x\n", *mpt);
-                       print_hex_dump(KERN_ERR, "  ", DUMP_PREFIX_ADDRESS, 16,
-                                       1, mpc, mpc->length, 1);
+                       smp_dump_mptable(mpc, mpt);
                        count = mpc->length;
                        break;
                }
-               if (x86_quirks->mpc_record)
-                       (*x86_quirks->mpc_record)++;
+               x86_init.mpparse.mpc_record(1);
        }
 
-#ifdef CONFIG_X86_GENERICARCH
-       generic_bigsmp_probe();
-#endif
-
-       if (apic->setup_apic_routing)
-               apic->setup_apic_routing();
-
        if (!num_processors)
                printk(KERN_ERR "MPTABLE: no processors registered!\n");
        return num_processors;
@@ -502,11 +477,11 @@ static void __init construct_ioapic_table(int mpc_default_type)
                MP_bus_info(&bus);
        }
 
-       ioapic.type = MP_IOAPIC;
-       ioapic.apicid = 2;
-       ioapic.apicver = mpc_default_type > 4 ? 0x10 : 0x01;
-       ioapic.flags = MPC_APIC_USABLE;
-       ioapic.apicaddr = 0xFEC00000;
+       ioapic.type     = MP_IOAPIC;
+       ioapic.apicid   = 2;
+       ioapic.apicver  = mpc_default_type > 4 ? 0x10 : 0x01;
+       ioapic.flags    = MPC_APIC_USABLE;
+       ioapic.apicaddr = IO_APIC_DEFAULT_PHYS_BASE;
        MP_ioapic_info(&ioapic);
 
        /*
@@ -563,10 +538,72 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 
 static struct mpf_intel *mpf_found;
 
+static unsigned long __init get_mpc_size(unsigned long physptr)
+{
+       struct mpc_table *mpc;
+       unsigned long size;
+
+       mpc = early_ioremap(physptr, PAGE_SIZE);
+       size = mpc->length;
+       early_iounmap(mpc, PAGE_SIZE);
+       apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
+
+       return size;
+}
+
+static int __init check_physptr(struct mpf_intel *mpf, unsigned int early)
+{
+       struct mpc_table *mpc;
+       unsigned long size;
+
+       size = get_mpc_size(mpf->physptr);
+       mpc = early_ioremap(mpf->physptr, size);
+       /*
+        * Read the physical hardware table.  Anything here will
+        * override the defaults.
+        */
+       if (!smp_read_mpc(mpc, early)) {
+#ifdef CONFIG_X86_LOCAL_APIC
+               smp_found_config = 0;
+#endif
+               printk(KERN_ERR "BIOS bug, MP table errors detected!...\n"
+                       "... disabling SMP support. (tell your hw vendor)\n");
+               early_iounmap(mpc, size);
+               return -1;
+       }
+       early_iounmap(mpc, size);
+
+       if (early)
+               return -1;
+
+#ifdef CONFIG_X86_IO_APIC
+       /*
+        * If there are no explicit MP IRQ entries, then we are
+        * broken.  We set up most of the low 16 IO-APIC pins to
+        * ISA defaults and hope it will work.
+        */
+       if (!mp_irq_entries) {
+               struct mpc_bus bus;
+
+               printk(KERN_ERR "BIOS bug, no explicit IRQ entries, "
+                      "using default mptable. (tell your hw vendor)\n");
+
+               bus.type = MP_BUS;
+               bus.busid = 0;
+               memcpy(bus.bustype, "ISA   ", 6);
+               MP_bus_info(&bus);
+
+               construct_default_ioirq_mptable(0);
+       }
+#endif
+
+       return 0;
+}
+
 /*
  * Scan the memory blocks for an SMP configuration block.
  */
-static void __init __get_smp_config(unsigned int early)
+void __init default_get_smp_config(unsigned int early)
 {
        struct mpf_intel *mpf = mpf_found;
 
@@ -583,11 +620,6 @@ static void __init __get_smp_config(unsigned int early)
        if (acpi_lapic && acpi_ioapic)
                return;
 
-       if (x86_quirks->mach_get_smp_config) {
-               if (x86_quirks->mach_get_smp_config(early))
-                       return;
-       }
-
        printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n",
               mpf->specification);
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
@@ -616,45 +648,8 @@ static void __init __get_smp_config(unsigned int early)
                construct_default_ISA_mptable(mpf->feature1);
 
        } else if (mpf->physptr) {
-
-               /*
-                * Read the physical hardware table.  Anything here will
-                * override the defaults.
-                */
-               if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
-#ifdef CONFIG_X86_LOCAL_APIC
-                       smp_found_config = 0;
-#endif
-                       printk(KERN_ERR
-                              "BIOS bug, MP table errors detected!...\n");
-                       printk(KERN_ERR "... disabling SMP support. "
-                              "(tell your hw vendor)\n");
+               if (check_physptr(mpf, early))
                        return;
-               }
-
-               if (early)
-                       return;
-#ifdef CONFIG_X86_IO_APIC
-               /*
-                * If there are no explicit MP IRQ entries, then we are
-                * broken.  We set up most of the low 16 IO-APIC pins to
-                * ISA defaults and hope it will work.
-                */
-               if (!mp_irq_entries) {
-                       struct mpc_bus bus;
-
-                       printk(KERN_ERR "BIOS bug, no explicit IRQ entries, "
-                              "using default mptable. "
-                              "(tell your hw vendor)\n");
-
-                       bus.type = MP_BUS;
-                       bus.busid = 0;
-                       memcpy(bus.bustype, "ISA   ", 6);
-                       MP_bus_info(&bus);
-
-                       construct_default_ioirq_mptable(0);
-               }
-#endif
        } else
                BUG();
 
@@ -665,21 +660,18 @@ static void __init __get_smp_config(unsigned int early)
         */
 }
 
-void __init early_get_smp_config(void)
+static void __init smp_reserve_memory(struct mpf_intel *mpf)
 {
-       __get_smp_config(1);
-}
+       unsigned long size = get_mpc_size(mpf->physptr);
 
-void __init get_smp_config(void)
-{
-       __get_smp_config(0);
+       reserve_early(mpf->physptr, mpf->physptr+size, "MP-table mpc");
 }
 
-static int __init smp_scan_config(unsigned long base, unsigned long length,
-                                 unsigned reserve)
+static int __init smp_scan_config(unsigned long base, unsigned long length)
 {
        unsigned int *bp = phys_to_virt(base);
        struct mpf_intel *mpf;
+       unsigned long mem;
 
        apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n",
                        bp, length);
@@ -697,32 +689,13 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
 #endif
                        mpf_found = mpf;
 
-                       printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
-                              mpf, virt_to_phys(mpf));
+                       printk(KERN_INFO "found SMP MP-table at [%p] %llx\n",
+                              mpf, (u64)virt_to_phys(mpf));
 
-                       if (!reserve)
-                               return 1;
-                       reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
-                                       BOOTMEM_DEFAULT);
-                       if (mpf->physptr) {
-                               unsigned long size = PAGE_SIZE;
-#ifdef CONFIG_X86_32
-                               /*
-                                * We cannot access to MPC table to compute
-                                * table size yet, as only few megabytes from
-                                * the bottom is mapped now.
-                                * PC-9800's MPC table places on the very last
-                                * of physical memory; so that simply reserving
-                                * PAGE_SIZE from mpf->physptr yields BUG()
-                                * in reserve_bootmem.
-                                */
-                               unsigned long end = max_low_pfn * PAGE_SIZE;
-                               if (mpf->physptr + size > end)
-                                       size = end - mpf->physptr;
-#endif
-                               reserve_bootmem_generic(mpf->physptr, size,
-                                               BOOTMEM_DEFAULT);
-                       }
+                       mem = virt_to_phys(mpf);
+                       reserve_early(mem, mem + sizeof(*mpf), "MP-table mpf");
+                       if (mpf->physptr)
+                               smp_reserve_memory(mpf);
 
                        return 1;
                }
@@ -732,14 +705,10 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
        return 0;
 }
 
-static void __init __find_smp_config(unsigned int reserve)
+void __init default_find_smp_config(void)
 {
        unsigned int address;
 
-       if (x86_quirks->mach_find_smp_config) {
-               if (x86_quirks->mach_find_smp_config(reserve))
-                       return;
-       }
        /*
         * FIXME: Linux assumes you have 640K of base ram..
         * this continues the error...
@@ -748,9 +717,9 @@ static void __init __find_smp_config(unsigned int reserve)
         * 2) Scan the top 1K of base RAM
         * 3) Scan the 64K of bios
         */
-       if (smp_scan_config(0x0, 0x400, reserve) ||
-           smp_scan_config(639 * 0x400, 0x400, reserve) ||
-           smp_scan_config(0xF0000, 0x10000, reserve))
+       if (smp_scan_config(0x0, 0x400) ||
+           smp_scan_config(639 * 0x400, 0x400) ||
+           smp_scan_config(0xF0000, 0x10000))
                return;
        /*
         * If it is an SMP machine we should know now, unless the
@@ -771,17 +740,7 @@ static void __init __find_smp_config(unsigned int reserve)
 
        address = get_bios_ebda();
        if (address)
-               smp_scan_config(address, 0x400, reserve);
-}
-
-void __init early_find_smp_config(void)
-{
-       __find_smp_config(0);
-}
-
-void __init find_smp_config(void)
-{
-       __find_smp_config(1);
+               smp_scan_config(address, 0x400);
 }
 
 #ifdef CONFIG_X86_IO_APIC
@@ -825,7 +784,51 @@ static int  __init get_MP_intsrc_index(struct mpc_intsrc *m)
 #define SPARE_SLOT_NUM 20
 
 static struct mpc_intsrc __initdata *m_spare[SPARE_SLOT_NUM];
-#endif
+
+static void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare)
+{
+       int i;
+
+       apic_printk(APIC_VERBOSE, "OLD ");
+       print_MP_intsrc_info(m);
+
+       i = get_MP_intsrc_index(m);
+       if (i > 0) {
+               assign_to_mpc_intsrc(&mp_irqs[i], m);
+               apic_printk(APIC_VERBOSE, "NEW ");
+               print_mp_irq_info(&mp_irqs[i]);
+               return;
+       }
+       if (!i) {
+               /* legacy, do nothing */
+               return;
+       }
+       if (*nr_m_spare < SPARE_SLOT_NUM) {
+               /*
+                * not found (-1), or duplicated (-2) are invalid entries,
+                * we need to use the slot later
+                */
+               m_spare[*nr_m_spare] = m;
+               *nr_m_spare += 1;
+       }
+}
+#else /* CONFIG_X86_IO_APIC */
+static
+inline void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare) {}
+#endif /* CONFIG_X86_IO_APIC */
+
+static int
+check_slot(unsigned long mpc_new_phys, unsigned long mpc_new_length, int count)
+{
+       int ret = 0;
+
+       if (!mpc_new_phys || count <= mpc_new_length) {
+               WARN(1, "update_mptable: No spare slots (length: %x)\n", count);
+               return -1;
+       }
+
+       return ret;
+}
 
 static int  __init replace_intsrc_all(struct mpc_table *mpc,
                                        unsigned long mpc_new_phys,
@@ -833,77 +836,33 @@ static int  __init replace_intsrc_all(struct mpc_table *mpc,
 {
 #ifdef CONFIG_X86_IO_APIC
        int i;
-       int nr_m_spare = 0;
 #endif
-
        int count = sizeof(*mpc);
+       int nr_m_spare = 0;
        unsigned char *mpt = ((unsigned char *)mpc) + count;
 
        printk(KERN_INFO "mpc_length %x\n", mpc->length);
        while (count < mpc->length) {
                switch (*mpt) {
                case MP_PROCESSOR:
-                       {
-                               struct mpc_cpu *m = (struct mpc_cpu *)mpt;
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       skip_entry(&mpt, &count, sizeof(struct mpc_cpu));
+                       break;
                case MP_BUS:
-                       {
-                               struct mpc_bus *m = (struct mpc_bus *)mpt;
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       skip_entry(&mpt, &count, sizeof(struct mpc_bus));
+                       break;
                case MP_IOAPIC:
-                       {
-                               mpt += sizeof(struct mpc_ioapic);
-                               count += sizeof(struct mpc_ioapic);
-                               break;
-                       }
+                       skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
+                       break;
                case MP_INTSRC:
-                       {
-#ifdef CONFIG_X86_IO_APIC
-                               struct mpc_intsrc *m = (struct mpc_intsrc *)mpt;
-
-                               printk(KERN_INFO "OLD ");
-                               print_MP_intsrc_info(m);
-                               i = get_MP_intsrc_index(m);
-                               if (i > 0) {
-                                       assign_to_mpc_intsrc(&mp_irqs[i], m);
-                                       printk(KERN_INFO "NEW ");
-                                       print_mp_irq_info(&mp_irqs[i]);
-                               } else if (!i) {
-                                       /* legacy, do nothing */
-                               } else if (nr_m_spare < SPARE_SLOT_NUM) {
-                                       /*
-                                        * not found (-1), or duplicated (-2)
-                                        * are invalid entries,
-                                        * we need to use the slot  later
-                                        */
-                                       m_spare[nr_m_spare] = m;
-                                       nr_m_spare++;
-                               }
-#endif
-                               mpt += sizeof(struct mpc_intsrc);
-                               count += sizeof(struct mpc_intsrc);
-                               break;
-                       }
+                       check_irq_src((struct mpc_intsrc *)mpt, &nr_m_spare);
+                       skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
+                       break;
                case MP_LINTSRC:
-                       {
-                               struct mpc_lintsrc *m =
-                                   (struct mpc_lintsrc *)mpt;
-                               mpt += sizeof(*m);
-                               count += sizeof(*m);
-                               break;
-                       }
+                       skip_entry(&mpt, &count, sizeof(struct mpc_lintsrc));
+                       break;
                default:
                        /* wrong mptable */
-                       printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n");
-                       printk(KERN_ERR "type %x\n", *mpt);
-                       print_hex_dump(KERN_ERR, "  ", DUMP_PREFIX_ADDRESS, 16,
-                                       1, mpc, mpc->length, 1);
+                       smp_dump_mptable(mpc, mpt);
                        goto out;
                }
        }
@@ -920,23 +879,15 @@ static int  __init replace_intsrc_all(struct mpc_table *mpc,
                        continue;
 
                if (nr_m_spare > 0) {
-                       printk(KERN_INFO "*NEW* found ");
+                       apic_printk(APIC_VERBOSE, "*NEW* found\n");
                        nr_m_spare--;
                        assign_to_mpc_intsrc(&mp_irqs[i], m_spare[nr_m_spare]);
                        m_spare[nr_m_spare] = NULL;
                } else {
                        struct mpc_intsrc *m = (struct mpc_intsrc *)mpt;
                        count += sizeof(struct mpc_intsrc);
-                       if (!mpc_new_phys) {
-                               printk(KERN_INFO "No spare slots, try to append...take your risk, new mpc_length %x\n", count);
-                       } else {
-                               if (count <= mpc_new_length)
-                                       printk(KERN_INFO "No spare slots, try to append..., new mpc_length %x\n", count);
-                               else {
-                                       printk(KERN_ERR "mpc_new_length %lx is too small\n", mpc_new_length);
-                                       goto out;
-                               }
-                       }
+                       if (check_slot(mpc_new_phys, mpc_new_length, count) < 0)
+                               goto out;
                        assign_to_mpc_intsrc(&mp_irqs[i], m);
                        mpc->length = count;
                        mpt += sizeof(struct mpc_intsrc);
@@ -952,11 +903,14 @@ out:
        return 0;
 }
 
-static int __initdata enable_update_mptable;
+int enable_update_mptable;
 
 static int __init update_mptable_setup(char *str)
 {
        enable_update_mptable = 1;
+#ifdef CONFIG_PCI
+       pci_routeirq = 1;
+#endif
        return 0;
 }
 early_param("update_mptable", update_mptable_setup);
@@ -969,6 +923,9 @@ static int __initdata alloc_mptable;
 static int __init parse_alloc_mptable_opt(char *p)
 {
        enable_update_mptable = 1;
+#ifdef CONFIG_PCI
+       pci_routeirq = 1;
+#endif
        alloc_mptable = 1;
        if (!p)
                return 0;
@@ -981,9 +938,6 @@ void __init early_reserve_e820_mpc_new(void)
 {
        if (enable_update_mptable && alloc_mptable) {
                u64 startt = 0;
-#ifdef CONFIG_X86_TRAMPOLINE
-               startt = TRAMPOLINE_BASE;
-#endif
                mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4);
        }
 }
@@ -1016,7 +970,7 @@ static int __init update_mp_table(void)
        if (!smp_check_mpc(mpc, oem, str))
                return 0;
 
-       printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf));
+       printk(KERN_INFO "mpf: %llx\n", (u64)virt_to_phys(mpf));
        printk(KERN_INFO "physptr: %x\n", mpf->physptr);
 
        if (mpc_new_phys && mpc->length > mpc_new_length) {