aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/apic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/apic.c')
-rw-r--r--arch/i386/kernel/apic.c77
1 files changed, 16 insertions, 61 deletions
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 9204be6eedb3..7c724ffa08bb 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -803,7 +803,6 @@ no_apic:
803 803
804void __init init_apic_mappings(void) 804void __init init_apic_mappings(void)
805{ 805{
806 unsigned int orig_apicid;
807 unsigned long apic_phys; 806 unsigned long apic_phys;
808 807
809 /* 808 /*
@@ -825,11 +824,8 @@ void __init init_apic_mappings(void)
825 * Fetch the APIC ID of the BSP in case we have a 824 * Fetch the APIC ID of the BSP in case we have a
826 * default configuration (or the MP table is broken). 825 * default configuration (or the MP table is broken).
827 */ 826 */
828 orig_apicid = boot_cpu_physical_apicid; 827 if (boot_cpu_physical_apicid == -1U)
829 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 828 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
830 if ((orig_apicid != -1U) && (orig_apicid != boot_cpu_physical_apicid))
831 printk(KERN_WARNING "Boot APIC ID in local APIC unexpected (%d vs %d)",
832 orig_apicid, boot_cpu_physical_apicid);
833 829
834#ifdef CONFIG_X86_IO_APIC 830#ifdef CONFIG_X86_IO_APIC
835 { 831 {
@@ -1259,81 +1255,40 @@ fastcall void smp_error_interrupt(struct pt_regs *regs)
1259} 1255}
1260 1256
1261/* 1257/*
1262 * This initializes the IO-APIC and APIC hardware. 1258 * This initializes the IO-APIC and APIC hardware if this is
1259 * a UP kernel.
1263 */ 1260 */
1264int __init APIC_init(void) 1261int __init APIC_init_uniprocessor (void)
1265{ 1262{
1266 if (enable_local_apic < 0) { 1263 if (enable_local_apic < 0)
1267 printk(KERN_INFO "APIC disabled\n"); 1264 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
1268 return -1;
1269 }
1270 1265
1271 /* See if we have a SMP configuration or have forced enabled 1266 if (!smp_found_config && !cpu_has_apic)
1272 * the local apic.
1273 */
1274 if (!smp_found_config && !acpi_lapic && !cpu_has_apic) {
1275 enable_local_apic = -1;
1276 return -1; 1267 return -1;
1277 }
1278 1268
1279 /* 1269 /*
1280 * Complain if the BIOS pretends there is an apic. 1270 * Complain if the BIOS pretends there is one.
1281 * Then get out because we don't have an a local apic.
1282 */ 1271 */
1283 if (!cpu_has_apic && APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { 1272 if (!cpu_has_apic && APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
1284 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", 1273 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
1285 boot_cpu_physical_apicid); 1274 boot_cpu_physical_apicid);
1286 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
1287 enable_local_apic = -1;
1288 return -1; 1275 return -1;
1289 } 1276 }
1290 1277
1291 verify_local_APIC(); 1278 verify_local_APIC();
1292 1279
1293 /*
1294 * Should not be necessary because the MP table should list the boot
1295 * CPU too, but we do it for the sake of robustness anyway.
1296 * Makes no sense to do this check in clustered apic mode, so skip it
1297 */
1298 if (!check_phys_apicid_present(boot_cpu_physical_apicid)) {
1299 printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
1300 boot_cpu_physical_apicid);
1301 physid_set(boot_cpu_physical_apicid, phys_cpu_present_map);
1302 }
1303
1304 /*
1305 * Switch from PIC to APIC mode.
1306 */
1307 connect_bsp_APIC(); 1280 connect_bsp_APIC();
1308 setup_local_APIC();
1309 1281
1310#ifdef CONFIG_X86_IO_APIC 1282 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
1311 /*
1312 * Now start the IO-APICs
1313 */
1314 if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
1315 setup_IO_APIC();
1316#endif
1317 return 0;
1318}
1319 1283
1320void __init APIC_late_time_init(void) 1284 setup_local_APIC();
1321{
1322 /* Improve our loops per jiffy estimate */
1323 loops_per_jiffy = ((1000 + HZ - 1)/HZ)*cpu_khz;
1324 boot_cpu_data.loops_per_jiffy = loops_per_jiffy;
1325 cpu_data[0].loops_per_jiffy = loops_per_jiffy;
1326
1327 /* setup_apic_nmi_watchdog doesn't work properly before cpu_khz is
1328 * initialized. So redo it here to ensure the boot cpu is setup
1329 * properly.
1330 */
1331 if (nmi_watchdog == NMI_LOCAL_APIC)
1332 setup_apic_nmi_watchdog();
1333 1285
1334#ifdef CONFIG_X86_IO_APIC 1286#ifdef CONFIG_X86_IO_APIC
1335 if (smp_found_config && !skip_ioapic_setup && nr_ioapics) 1287 if (smp_found_config)
1336 IO_APIC_late_time_init(); 1288 if (!skip_ioapic_setup && nr_ioapics)
1289 setup_IO_APIC();
1337#endif 1290#endif
1338 setup_boot_APIC_clock(); 1291 setup_boot_APIC_clock();
1292
1293 return 0;
1339} 1294}