aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic_32.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_32.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_32.c')
-rw-r--r--arch/x86/kernel/apic_32.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index bfac26a16099..8f8b0e1f3eb3 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1355,6 +1355,17 @@ int apic_version[MAX_APICS];
1355 1355
1356int __init APIC_init_uniprocessor(void) 1356int __init APIC_init_uniprocessor(void)
1357{ 1357{
1358#ifdef CONFIG_X86_64
1359 if (disable_apic) {
1360 printk(KERN_INFO "Apic disabled\n");
1361 return -1;
1362 }
1363 if (!cpu_has_apic) {
1364 disable_apic = 1;
1365 printk(KERN_INFO "Apic disabled by BIOS\n");
1366 return -1;
1367 }
1368#else
1358 if (!smp_found_config && !cpu_has_apic) 1369 if (!smp_found_config && !cpu_has_apic)
1359 return -1; 1370 return -1;
1360 1371
@@ -1368,34 +1379,62 @@ int __init APIC_init_uniprocessor(void)
1368 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 1379 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
1369 return -1; 1380 return -1;
1370 } 1381 }
1382#endif
1371 1383
1384#ifdef HAVE_X2APIC
1385 enable_IR_x2apic();
1386#endif
1387#ifdef CONFIG_X86_64
1388 setup_apic_routing();
1389#endif
1372 verify_local_APIC(); 1390 verify_local_APIC();
1373
1374 connect_bsp_APIC(); 1391 connect_bsp_APIC();
1375 1392
1393#ifdef CONFIG_X86_64
1394 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
1395#else
1376 /* 1396 /*
1377 * Hack: In case of kdump, after a crash, kernel might be booting 1397 * Hack: In case of kdump, after a crash, kernel might be booting
1378 * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid 1398 * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
1379 * might be zero if read from MP tables. Get it from LAPIC. 1399 * might be zero if read from MP tables. Get it from LAPIC.
1380 */ 1400 */
1381#ifdef CONFIG_CRASH_DUMP 1401# ifdef CONFIG_CRASH_DUMP
1382 boot_cpu_physical_apicid = read_apic_id(); 1402 boot_cpu_physical_apicid = read_apic_id();
1403# endif
1383#endif 1404#endif
1384 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); 1405 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
1385
1386 setup_local_APIC(); 1406 setup_local_APIC();
1387 1407
1408#ifdef CONFIG_X86_64
1409 /*
1410 * Now enable IO-APICs, actually call clear_IO_APIC
1411 * We need clear_IO_APIC before enabling vector on BP
1412 */
1413 if (!skip_ioapic_setup && nr_ioapics)
1414 enable_IO_APIC();
1415#endif
1416
1388#ifdef CONFIG_X86_IO_APIC 1417#ifdef CONFIG_X86_IO_APIC
1389 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics) 1418 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics)
1390#endif 1419#endif
1391 localise_nmi_watchdog(); 1420 localise_nmi_watchdog();
1392 end_local_APIC_setup(); 1421 end_local_APIC_setup();
1422
1393#ifdef CONFIG_X86_IO_APIC 1423#ifdef CONFIG_X86_IO_APIC
1394 if (smp_found_config) 1424 if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
1395 if (!skip_ioapic_setup && nr_ioapics) 1425 setup_IO_APIC();
1396 setup_IO_APIC(); 1426# ifdef CONFIG_X86_64
1427 else
1428 nr_ioapics = 0;
1429# endif
1397#endif 1430#endif
1431
1432#ifdef CONFIG_X86_64
1433 setup_boot_APIC_clock();
1434 check_nmi_watchdog();
1435#else
1398 setup_boot_clock(); 1436 setup_boot_clock();
1437#endif
1399 1438
1400 return 0; 1439 return 0;
1401} 1440}