x86: Fix section mismatches in mpparse
[pandora-kernel.git] / arch / x86 / kernel / mpparse.c
index 58ddf62..70fd7e4 100644 (file)
@@ -282,6 +282,14 @@ static void skip_entry(unsigned char **ptr, int *count, int 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);
+}
+
 static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 {
        char str[16];
@@ -319,31 +327,28 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
                case MP_PROCESSOR:
                        /* ACPI may have already provided this data */
                        if (!acpi_lapic)
-                               MP_processor_info((struct mpc_cpu *)&mpt);
+                               MP_processor_info((struct mpc_cpu *)mpt);
                        skip_entry(&mpt, &count, sizeof(struct mpc_cpu));
                        break;
                case MP_BUS:
-                       MP_bus_info((struct mpc_bus *)&mpt);
+                       MP_bus_info((struct mpc_bus *)mpt);
                        skip_entry(&mpt, &count, sizeof(struct mpc_bus));
                        break;
                case MP_IOAPIC:
-                       MP_ioapic_info((struct mpc_ioapic *)&mpt);
+                       MP_ioapic_info((struct mpc_ioapic *)mpt);
                        skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
                        break;
                case MP_INTSRC:
-                       MP_intsrc_info((struct mpc_intsrc *)&mpt);
+                       MP_intsrc_info((struct mpc_intsrc *)mpt);
                        skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
                        break;
                case MP_LINTSRC:
-                       MP_lintsrc_info((struct mpc_lintsrc *)&mpt);
+                       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;
                }
@@ -550,6 +555,55 @@ static unsigned long __init get_mpc_size(unsigned long physptr)
        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.
  */
@@ -603,51 +657,8 @@ static void __init __get_smp_config(unsigned int early)
                construct_default_ISA_mptable(mpf->feature1);
 
        } else if (mpf->physptr) {
-               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");
-                       printk(KERN_ERR "... disabling SMP support. "
-                              "(tell your hw vendor)\n");
-                       early_iounmap(mpc, size);
+               if (check_physptr(mpf, early))
                        return;
-               }
-               early_iounmap(mpc, size);
-
-               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();
 
@@ -668,7 +679,7 @@ void __init get_smp_config(void)
        __get_smp_config(0);
 }
 
-static void smp_reserve_bootmem(struct mpf_intel *mpf)
+static void __init smp_reserve_bootmem(struct mpf_intel *mpf)
 {
        unsigned long size = get_mpc_size(mpf->physptr);
 #ifdef CONFIG_X86_32
@@ -827,7 +838,7 @@ static int  __init get_MP_intsrc_index(struct mpc_intsrc *m)
 
 static struct mpc_intsrc __initdata *m_spare[SPARE_SLOT_NUM];
 
-static void check_irq_src(struct mpc_intsrc *m, int *nr_m_spare)
+static void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare)
 {
        int i;
 
@@ -855,7 +866,8 @@ static void check_irq_src(struct mpc_intsrc *m, int *nr_m_spare)
        }
 }
 #else /* CONFIG_X86_IO_APIC */
-static inline void check_irq_src(struct mpc_intsrc *m, int *nr_m_spare) {}
+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,
@@ -902,7 +914,7 @@ static int  __init replace_intsrc_all(struct mpc_table *mpc,
                        skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
                        break;
                case MP_INTSRC:
-                       check_irq_src((struct mpc_intsrc *)&mpt, &nr_m_spare);
+                       check_irq_src((struct mpc_intsrc *)mpt, &nr_m_spare);
                        skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
                        break;
                case MP_LINTSRC:
@@ -910,10 +922,7 @@ static int  __init replace_intsrc_all(struct mpc_table *mpc,
                        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;
                }
        }