]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/mpparse_32.c
x86: fill cpu to apicid and present map in mpparse
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / mpparse_32.c
index 67009cdd5eca194bbf60fb9a7209a1b94550c23b..a0cec74b80ef3fe7999e5b0536a0420914809a12 100644 (file)
@@ -42,10 +42,10 @@ unsigned int __cpuinitdata maxcpus = NR_CPUS;
  * MP-table.
  */
 int apic_version [MAX_APICS];
+#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
 int mp_bus_id_to_type [MAX_MP_BUSSES];
-int mp_bus_id_to_node [MAX_MP_BUSSES];
-int mp_bus_id_to_local [MAX_MP_BUSSES];
-int quad_local_to_mp_bus_id [NR_CPUS/4][4];
+#endif
+DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
 static int mp_current_pci_id;
 
@@ -70,11 +70,11 @@ unsigned int boot_cpu_physical_apicid = -1U;
 /* Internal processor count */
 unsigned int num_processors;
 
+unsigned disabled_cpus __cpuinitdata;
+
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map;
 
-u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
-
 /*
  * Intel MP BIOS table parsing routines:
  */
@@ -105,11 +105,14 @@ static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __cpuinit
 
 static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 {
-       int ver, apicid;
+       int ver, apicid, cpu;
+       cpumask_t tmp_map;
        physid_mask_t phys_cpu;
        
-       if (!(m->mpc_cpuflag & CPU_ENABLED))
+       if (!(m->mpc_cpuflag & CPU_ENABLED)) {
+               disabled_cpus++;
                return;
+       }
 
        apicid = mpc_apic_id(m, translation_table[mpc_record]);
 
@@ -196,6 +199,16 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 
        cpu_set(num_processors, cpu_possible_map);
        num_processors++;
+       cpus_complement(tmp_map, cpu_present_map);
+       cpu = first_cpu(tmp_map);
+
+       if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
+               /*
+                * x86_bios_cpu_apicid is required to have processors listed
+                * in same order as logical cpu numbers. Hence the first
+                * entry is BSP, and so on.
+                */
+               cpu = 0;
 
        /*
         * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
@@ -216,7 +229,18 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
                        def_to_bigsmp = 1;
                }
        }
-       bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
+       /* are we being called early in kernel startup? */
+       if (x86_cpu_to_apicid_early_ptr) {
+               u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
+               u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
+
+               cpu_to_apicid[cpu] = m->mpc_apicid;
+               bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
+       } else {
+               per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid;
+               per_cpu(x86_bios_cpu_apicid, cpu) = m->mpc_apicid;
+       }
+       cpu_set(cpu, cpu_present_map);
 }
 
 static void __init MP_bus_info (struct mpc_config_bus *m)
@@ -237,19 +261,23 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
        }
 #endif
 
-       if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
-       } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA;
-       } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI)-1) == 0) {
+       set_bit(m->mpc_busid, mp_bus_not_pci);
+       if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI)-1) == 0) {
                mpc_oem_pci_bus(m, translation_table[mpc_record]);
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
+               clear_bit(m->mpc_busid, mp_bus_not_pci);
                mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id;
                mp_current_pci_id++;
+#if defined(CONFIG_EISA) || defined (CONFIG_MCA)
+               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
+       } else if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
+               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
+       } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
+               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA;
        } else if (strncmp(str, BUSTYPE_MCA, sizeof(BUSTYPE_MCA)-1) == 0) {
                mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA;
        } else {
                printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str);
+#endif
        }
 }
 
@@ -736,7 +764,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
                        smp_found_config = 1;
                        printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
                                mpf, virt_to_phys(mpf));
-                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE);
+                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
+                                       BOOTMEM_DEFAULT);
                        if (mpf->mpf_physptr) {
                                /*
                                 * We cannot access to MPC table to compute
@@ -751,7 +780,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
                                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);
+                               reserve_bootmem(mpf->mpf_physptr, size,
+                                               BOOTMEM_DEFAULT);
                        }
 
                        mpf_found = mpf;
@@ -975,10 +1005,13 @@ void __init mp_config_acpi_legacy_irqs (void)
        int i = 0;
        int ioapic = -1;
 
+#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
        /* 
         * Fabricate the legacy ISA bus (bus #31).
         */
        mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
+#endif
+       set_bit(MP_ISA_BUS, mp_bus_not_pci);
        Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
 
        /*