Merge commit 'v2.6.26' into x86/core
[pandora-kernel.git] / arch / x86 / kernel / apic_32.c
index dd8de26..3e58b67 100644 (file)
@@ -55,9 +55,10 @@ unsigned long mp_lapic_addr;
 /*
  * Knob to control our willingness to enable the local APIC.
  *
- * -1=force-disable, +1=force-enable
+ * +1=force-enable
  */
-static int enable_local_apic __initdata;
+static int force_enable_local_apic;
+int disable_apic;
 
 /* Local APIC timer verification ok */
 static int local_apic_timer_verify_ok;
@@ -81,6 +82,11 @@ int pic_mode;
 /* Have we found an MP table */
 int smp_found_config;
 
+static struct resource lapic_resource = {
+       .name = "Local APIC",
+       .flags = IORESOURCE_MEM | IORESOURCE_BUSY,
+};
+
 static unsigned int calibration_result;
 
 static int lapic_next_event(unsigned long delta,
@@ -550,7 +556,7 @@ void __init setup_boot_APIC_clock(void)
                        lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
                else
                        printk(KERN_WARNING "APIC timer registered as dummy,"
-                              " due to nmi_watchdog=1!\n");
+                               " due to nmi_watchdog=%d!\n", nmi_watchdog);
        }
 
        /* Setup the lapic or request the broadcast */
@@ -968,7 +974,7 @@ void __cpuinit setup_local_APIC(void)
         * Double-check whether this APIC is really registered.
         */
        if (!apic_id_registered())
-               BUG();
+               WARN_ON_ONCE(1);
 
        /*
         * Intel recommends to set DFR, LDR and TPR before enabling
@@ -1099,7 +1105,7 @@ static int __init detect_init_APIC(void)
        u32 h, l, features;
 
        /* Disabled by kernel option? */
-       if (enable_local_apic < 0)
+       if (disable_apic)
                return -1;
 
        switch (boot_cpu_data.x86_vendor) {
@@ -1122,7 +1128,7 @@ static int __init detect_init_APIC(void)
                 * Over-ride BIOS and try to enable the local APIC only if
                 * "lapic" specified.
                 */
-               if (enable_local_apic <= 0) {
+               if (!force_enable_local_apic) {
                        printk(KERN_INFO "Local APIC disabled by BIOS -- "
                               "you can enable it with \"lapic\"\n");
                        return -1;
@@ -1197,36 +1203,6 @@ void __init init_apic_mappings(void)
        if (boot_cpu_physical_apicid == -1U)
                boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 
-#ifdef CONFIG_X86_IO_APIC
-       {
-               unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
-               int i;
-
-               for (i = 0; i < nr_ioapics; i++) {
-                       if (smp_found_config) {
-                               ioapic_phys = mp_ioapics[i].mp_apicaddr;
-                               if (!ioapic_phys) {
-                                       printk(KERN_ERR
-                                              "WARNING: bogus zero IO-APIC "
-                                              "address found in MPTABLE, "
-                                              "disabling IO/APIC support!\n");
-                                       smp_found_config = 0;
-                                       skip_ioapic_setup = 1;
-                                       goto fake_ioapic_page;
-                               }
-                       } else {
-fake_ioapic_page:
-                               ioapic_phys = (unsigned long)
-                                             alloc_bootmem_pages(PAGE_SIZE);
-                               ioapic_phys = __pa(ioapic_phys);
-                       }
-                       set_fixmap_nocache(idx, ioapic_phys);
-                       printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
-                              __fix_to_virt(idx), ioapic_phys);
-                       idx++;
-               }
-       }
-#endif
 }
 
 /*
@@ -1238,7 +1214,7 @@ int apic_version[MAX_APICS];
 
 int __init APIC_init_uniprocessor(void)
 {
-       if (enable_local_apic < 0)
+       if (disable_apic)
                clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
 
        if (!smp_found_config && !cpu_has_apic)
@@ -1712,14 +1688,14 @@ static void apic_pm_activate(void) { }
  */
 static int __init parse_lapic(char *arg)
 {
-       enable_local_apic = 1;
+       force_enable_local_apic = 1;
        return 0;
 }
 early_param("lapic", parse_lapic);
 
 static int __init parse_nolapic(char *arg)
 {
-       enable_local_apic = -1;
+       disable_apic = 1;
        clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
        return 0;
 }
@@ -1749,3 +1725,21 @@ static int __init apic_set_verbosity(char *str)
 }
 __setup("apic=", apic_set_verbosity);
 
+static int __init lapic_insert_resource(void)
+{
+       if (!apic_phys)
+               return -1;
+
+       /* Put local APIC into the resource map. */
+       lapic_resource.start = apic_phys;
+       lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1;
+       insert_resource(&iomem_resource, &lapic_resource);
+
+       return 0;
+}
+
+/*
+ * need call insert after e820_reserve_resources()
+ * that is using request_resource
+ */
+late_initcall(lapic_insert_resource);