x86: fix MP_processor_info section mismatch warning
[deliverable/linux.git] / arch / x86 / kernel / mpparse.c
index 8898aa49079d37ec9b7b996ec11cc7d4c1420b3e..78509ee8cc74b2f58fb4d12f9d1778efb17a76b7 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/bios_ebda.h>
 #include <asm/e820.h>
 #include <asm/trampoline.h>
+#include <asm/setup.h>
 
 #include <mach_apic.h>
 #ifdef CONFIG_X86_32
@@ -48,19 +49,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
        return sum & 0xFF;
 }
 
-#ifdef CONFIG_X86_NUMAQ
-/*
- * Have to match translation table entries to main table entries by counter
- * hence the mpc_record variable .... can't see a less disgusting way of
- * doing this ....
- */
-
-static int mpc_record;
-static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY]
-    __cpuinitdata;
-#endif
-
-static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
+static void __init MP_processor_info(struct mpc_config_processor *m)
 {
        int apicid;
        char *bootup_cpu = "";
@@ -69,11 +58,12 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
                disabled_cpus++;
                return;
        }
-#ifdef CONFIG_X86_NUMAQ
-       apicid = mpc_apic_id(m, translation_table[mpc_record]);
-#else
-       apicid = m->mpc_apicid;
-#endif
+
+       if (x86_quirks->mpc_apic_id)
+               apicid = x86_quirks->mpc_apic_id(m);
+       else
+               apicid = m->mpc_apicid;
+
        if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
                bootup_cpu = " (Bootup-CPU)";
                boot_cpu_physical_apicid = m->mpc_apicid;
@@ -90,11 +80,10 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
        memcpy(str, m->mpc_bustype, 6);
        str[6] = 0;
 
-#ifdef CONFIG_X86_NUMAQ
-       mpc_oem_bus_info(m, str, translation_table[mpc_record]);
-#else
-       printk(KERN_INFO "Bus #%d is %s\n", m->mpc_busid, str);
-#endif
+       if (x86_quirks->mpc_oem_bus_info)
+               x86_quirks->mpc_oem_bus_info(m, str);
+       else
+               printk(KERN_INFO "Bus #%d is %s\n", m->mpc_busid, str);
 
 #if MAX_MP_BUSSES < 256
        if (m->mpc_busid >= MAX_MP_BUSSES) {
@@ -111,9 +100,9 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
                mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
 #endif
        } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) {
-#ifdef CONFIG_X86_NUMAQ
-               mpc_oem_pci_bus(m, translation_table[mpc_record]);
-#endif
+               if (x86_quirks->mpc_oem_pci_bus)
+                       x86_quirks->mpc_oem_pci_bus(m);
+
                clear_bit(m->mpc_busid, mp_bus_not_pci);
 #if defined(CONFIG_EISA) || defined (CONFIG_MCA)
                mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
@@ -181,7 +170,7 @@ static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq)
                mp_irq->mp_srcbusirq, mp_irq->mp_dstapic, mp_irq->mp_dstirq);
 }
 
-static void assign_to_mp_irq(struct mpc_config_intsrc *m,
+static void __init assign_to_mp_irq(struct mpc_config_intsrc *m,
                                    struct mp_config_intsrc *mp_irq)
 {
        mp_irq->mp_dstapic = m->mpc_dstapic;
@@ -205,7 +194,7 @@ static void __init assign_to_mpc_intsrc(struct mp_config_intsrc *mp_irq,
        m->mpc_dstirq = mp_irq->mp_dstirq;
 }
 
-static int mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
+static int __init mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
                                        struct mpc_config_intsrc *m)
 {
        if (mp_irq->mp_dstapic != m->mpc_dstapic)
@@ -226,7 +215,7 @@ static int mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
        return 0;
 }
 
-void MP_intsrc_info(struct mpc_config_intsrc *m)
+static void __init MP_intsrc_info(struct mpc_config_intsrc *m)
 {
        int i;
 
@@ -253,80 +242,6 @@ static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m)
                m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint);
 }
 
-#ifdef CONFIG_X86_NUMAQ
-static void __init MP_translation_info(struct mpc_config_translation *m)
-{
-       printk(KERN_INFO
-              "Translation: record %d, type %d, quad %d, global %d, local %d\n",
-              mpc_record, m->trans_type, m->trans_quad, m->trans_global,
-              m->trans_local);
-
-       if (mpc_record >= MAX_MPC_ENTRY)
-               printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n");
-       else
-               translation_table[mpc_record] = m;      /* stash this for later */
-       if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad))
-               node_set_online(m->trans_quad);
-}
-
-/*
- * Read/parse the MPC oem tables
- */
-
-static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable,
-                                   unsigned short oemsize)
-{
-       int count = sizeof(*oemtable);  /* the header size */
-       unsigned char *oemptr = ((unsigned char *)oemtable) + count;
-
-       mpc_record = 0;
-       printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n",
-              oemtable);
-       if (memcmp(oemtable->oem_signature, MPC_OEM_SIGNATURE, 4)) {
-               printk(KERN_WARNING
-                      "SMP mpc oemtable: bad signature [%c%c%c%c]!\n",
-                      oemtable->oem_signature[0], oemtable->oem_signature[1],
-                      oemtable->oem_signature[2], oemtable->oem_signature[3]);
-               return;
-       }
-       if (mpf_checksum((unsigned char *)oemtable, oemtable->oem_length)) {
-               printk(KERN_WARNING "SMP oem mptable: checksum error!\n");
-               return;
-       }
-       while (count < oemtable->oem_length) {
-               switch (*oemptr) {
-               case MP_TRANSLATION:
-                       {
-                               struct mpc_config_translation *m =
-                                   (struct mpc_config_translation *)oemptr;
-                               MP_translation_info(m);
-                               oemptr += sizeof(*m);
-                               count += sizeof(*m);
-                               ++mpc_record;
-                               break;
-                       }
-               default:
-                       {
-                               printk(KERN_WARNING
-                                      "Unrecognised OEM table entry type! - %d\n",
-                                      (int)*oemptr);
-                               return;
-                       }
-               }
-       }
-}
-
-static inline void mps_oem_check(struct mp_config_table *mpc, char *oem,
-                                char *productid)
-{
-       if (strncmp(oem, "IBM NUMA", 8))
-               printk("Warning!  May not be a NUMA-Q system!\n");
-       if (mpc->mpc_oemptr)
-               smp_read_mpc_oem((struct mp_config_oemtable *)mpc->mpc_oemptr,
-                                mpc->mpc_oemsize);
-}
-#endif /* CONFIG_X86_NUMAQ */
-
 /*
  * Read/parse the MPC
  */
@@ -380,9 +295,17 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
                return 0;
 
 #ifdef CONFIG_X86_32
-       mps_oem_check(mpc, oem, str);
+       /*
+        * need to make sure summit and es7000's mps_oem_check is safe to be
+        * called early via genericarch 's mps_oem_check
+        */
+       if (early) {
+#ifdef CONFIG_X86_NUMAQ
+               numaq_mps_oem_check(mpc, oem, str);
+#endif
+       } else
+               mps_oem_check(mpc, oem, str);
 #endif
-
        /* save the local APIC address, it might be non-default */
        if (!acpi_lapic)
                mp_lapic_addr = mpc->mpc_lapic;
@@ -390,12 +313,17 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
        if (early)
                return 1;
 
+       if (mpc->mpc_oemptr && x86_quirks->smp_read_mpc_oem) {
+               struct mp_config_oemtable *oem_table = (struct mp_config_oemtable *)(unsigned long)mpc->mpc_oemptr;
+               x86_quirks->smp_read_mpc_oem(oem_table, mpc->mpc_oemsize);
+       }
+
        /*
         *      Now process the configuration blocks.
         */
-#ifdef CONFIG_X86_NUMAQ
-       mpc_record = 0;
-#endif
+       if (x86_quirks->mpc_record)
+               *x86_quirks->mpc_record = 0;
+
        while (count < mpc->mpc_length) {
                switch (*mpt) {
                case MP_PROCESSOR:
@@ -461,10 +389,14 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
                        count = mpc->mpc_length;
                        break;
                }
-#ifdef CONFIG_X86_NUMAQ
-               ++mpc_record;
-#endif
+               if (x86_quirks->mpc_record)
+                       (*x86_quirks->mpc_record)++;
        }
+
+#ifdef CONFIG_X86_GENERICARCH
+       generic_bigsmp_probe();
+#endif
+
        setup_apic_routing();
        if (!num_processors)
                printk(KERN_ERR "MPTABLE: no processors registered!\n");
@@ -648,10 +580,14 @@ static struct intel_mp_floating *mpf_found;
 /*
  * Scan the memory blocks for an SMP configuration block.
  */
-static void __init __get_smp_config(unsigned early)
+static void __init __get_smp_config(unsigned int early)
 {
        struct intel_mp_floating *mpf = mpf_found;
 
+       if (x86_quirks->mach_get_smp_config) {
+               if (x86_quirks->mach_get_smp_config(early))
+                       return;
+       }
        if (acpi_lapic && early)
                return;
        /*
@@ -773,12 +709,17 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
                        smp_found_config = 1;
 #endif
                        mpf_found = mpf;
-#ifdef CONFIG_X86_32
+
                        printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
                               mpf, virt_to_phys(mpf));
-                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
+
+                       if (!reserve)
+                               return 1;
+                       reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
                                        BOOTMEM_DEFAULT);
                        if (mpf->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
@@ -788,24 +729,15 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
                                 * PAGE_SIZE from mpg->mpf_physptr yields BUG()
                                 * in reserve_bootmem.
                                 */
-                               unsigned long size = PAGE_SIZE;
                                unsigned long end = max_low_pfn * PAGE_SIZE;
                                if (mpf->mpf_physptr + size > end)
                                        size = end - mpf->mpf_physptr;
-                               reserve_bootmem(mpf->mpf_physptr, size,
+#endif
+                               reserve_bootmem_generic(mpf->mpf_physptr, size,
                                                BOOTMEM_DEFAULT);
                        }
 
-#else
-                       if (!reserve)
-                               return 1;
-
-                       reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE);
-                       if (mpf->mpf_physptr)
-                               reserve_bootmem_generic(mpf->mpf_physptr,
-                                                       PAGE_SIZE);
-#endif
-               return 1;
+                       return 1;
                }
                bp += 4;
                length -= 16;
@@ -813,10 +745,14 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
        return 0;
 }
 
-static void __init __find_smp_config(unsigned reserve)
+static void __init __find_smp_config(unsigned int reserve)
 {
        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...
@@ -1034,7 +970,7 @@ out:
        return 0;
 }
 
-int __initdata enable_update_mptable;
+static int __initdata enable_update_mptable;
 
 static int __init update_mptable_setup(char *str)
 {
This page took 0.033431 seconds and 5 git commands to generate.