aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic_64.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-24 05:01:50 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:02 -0400
commitfa2bd35a8d5c88c03b638c72daf7f38a132d0e8c (patch)
treea83e22fef3a1b71df13d5f5232eb3089a429f047 /arch/x86/kernel/apic_64.c
parentf28c0ae21d80ffd6eb0987901c5273843387e341 (diff)
x86: merge APIC_init_uniprocessor
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_64.c')
-rw-r--r--arch/x86/kernel/apic_64.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index dca6c246e731..16a30c22b07c 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1351,6 +1351,7 @@ int apic_version[MAX_APICS];
1351 1351
1352int __init APIC_init_uniprocessor(void) 1352int __init APIC_init_uniprocessor(void)
1353{ 1353{
1354#ifdef CONFIG_X86_64
1354 if (disable_apic) { 1355 if (disable_apic) {
1355 printk(KERN_INFO "Apic disabled\n"); 1356 printk(KERN_INFO "Apic disabled\n");
1356 return -1; 1357 return -1;
@@ -1360,37 +1361,78 @@ int __init APIC_init_uniprocessor(void)
1360 printk(KERN_INFO "Apic disabled by BIOS\n"); 1361 printk(KERN_INFO "Apic disabled by BIOS\n");
1361 return -1; 1362 return -1;
1362 } 1363 }
1364#else
1365 if (!smp_found_config && !cpu_has_apic)
1366 return -1;
1367
1368 /*
1369 * Complain if the BIOS pretends there is one.
1370 */
1371 if (!cpu_has_apic &&
1372 APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
1373 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
1374 boot_cpu_physical_apicid);
1375 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
1376 return -1;
1377 }
1378#endif
1379
1363#ifdef HAVE_X2APIC 1380#ifdef HAVE_X2APIC
1364 enable_IR_x2apic(); 1381 enable_IR_x2apic();
1365#endif 1382#endif
1383#ifdef CONFIG_X86_64
1366 setup_apic_routing(); 1384 setup_apic_routing();
1385#endif
1367 1386
1368 verify_local_APIC(); 1387 verify_local_APIC();
1369
1370 connect_bsp_APIC(); 1388 connect_bsp_APIC();
1371 1389
1372 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); 1390#ifdef CONFIG_X86_64
1373 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); 1391 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
1374 1392#else
1393 /*
1394 * Hack: In case of kdump, after a crash, kernel might be booting
1395 * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
1396 * might be zero if read from MP tables. Get it from LAPIC.
1397 */
1398# ifdef CONFIG_CRASH_DUMP
1399 boot_cpu_physical_apicid = read_apic_id();
1400# endif
1401#endif
1402 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
1375 setup_local_APIC(); 1403 setup_local_APIC();
1376 1404
1405#ifdef CONFIG_X86_64
1377 /* 1406 /*
1378 * Now enable IO-APICs, actually call clear_IO_APIC 1407 * Now enable IO-APICs, actually call clear_IO_APIC
1379 * We need clear_IO_APIC before enabling vector on BP 1408 * We need clear_IO_APIC before enabling vector on BP
1380 */ 1409 */
1381 if (!skip_ioapic_setup && nr_ioapics) 1410 if (!skip_ioapic_setup && nr_ioapics)
1382 enable_IO_APIC(); 1411 enable_IO_APIC();
1412#endif
1383 1413
1414#ifdef CONFIG_X86_IO_APIC
1384 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics) 1415 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics)
1416#endif
1385 localise_nmi_watchdog(); 1417 localise_nmi_watchdog();
1386 end_local_APIC_setup(); 1418 end_local_APIC_setup();
1387 1419
1420#ifdef CONFIG_X86_IO_APIC
1388 if (smp_found_config && !skip_ioapic_setup && nr_ioapics) 1421 if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
1389 setup_IO_APIC(); 1422 setup_IO_APIC();
1423# ifdef CONFIG_X86_64
1390 else 1424 else
1391 nr_ioapics = 0; 1425 nr_ioapics = 0;
1426# endif
1427#endif
1428
1429#ifdef CONFIG_X86_64
1392 setup_boot_APIC_clock(); 1430 setup_boot_APIC_clock();
1393 check_nmi_watchdog(); 1431 check_nmi_watchdog();
1432#else
1433 setup_boot_clock();
1434#endif
1435
1394 return 0; 1436 return 0;
1395} 1437}
1396 1438