diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-08-18 12:45:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-18 20:07:16 -0400 |
commit | c177b0bc03e0e11623e2099db42903fb0caf0fd3 (patch) | |
tree | 7681c1fcd3dbe25d716438cdae661a517b1ab782 /arch | |
parent | c40aaec6868401671a0ca14ed77e9b2da2d1f223 (diff) |
x86: apic - unify disconnect_bsp_APIC
- just #ifdef added
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/apic_32.c | 66 | ||||
-rw-r--r-- | arch/x86/kernel/apic_64.c | 23 |
2 files changed, 55 insertions, 34 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c index 65419c7d437f..3095bb71eaed 100644 --- a/arch/x86/kernel/apic_32.c +++ b/arch/x86/kernel/apic_32.c | |||
@@ -1420,6 +1420,7 @@ void __init connect_bsp_APIC(void) | |||
1420 | */ | 1420 | */ |
1421 | void disconnect_bsp_APIC(int virt_wire_setup) | 1421 | void disconnect_bsp_APIC(int virt_wire_setup) |
1422 | { | 1422 | { |
1423 | #ifdef CONFIG_X86_32 | ||
1423 | if (pic_mode) { | 1424 | if (pic_mode) { |
1424 | /* | 1425 | /* |
1425 | * Put the board back into PIC mode (has an effect only on | 1426 | * Put the board back into PIC mode (has an effect only on |
@@ -1431,47 +1432,48 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
1431 | "entering PIC mode.\n"); | 1432 | "entering PIC mode.\n"); |
1432 | outb(0x70, 0x22); | 1433 | outb(0x70, 0x22); |
1433 | outb(0x00, 0x23); | 1434 | outb(0x00, 0x23); |
1434 | } else { | 1435 | return; |
1435 | /* Go back to Virtual Wire compatibility mode */ | 1436 | } |
1436 | unsigned long value; | 1437 | #endif |
1437 | 1438 | ||
1438 | /* For the spurious interrupt use vector F, and enable it */ | 1439 | /* Go back to Virtual Wire compatibility mode */ |
1439 | value = apic_read(APIC_SPIV); | 1440 | unsigned int value; |
1440 | value &= ~APIC_VECTOR_MASK; | ||
1441 | value |= APIC_SPIV_APIC_ENABLED; | ||
1442 | value |= 0xf; | ||
1443 | apic_write(APIC_SPIV, value); | ||
1444 | 1441 | ||
1445 | if (!virt_wire_setup) { | 1442 | /* For the spurious interrupt use vector F, and enable it */ |
1446 | /* | 1443 | value = apic_read(APIC_SPIV); |
1447 | * For LVT0 make it edge triggered, active high, | 1444 | value &= ~APIC_VECTOR_MASK; |
1448 | * external and enabled | 1445 | value |= APIC_SPIV_APIC_ENABLED; |
1449 | */ | 1446 | value |= 0xf; |
1450 | value = apic_read(APIC_LVT0); | 1447 | apic_write(APIC_SPIV, value); |
1451 | value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | | ||
1452 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | | ||
1453 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); | ||
1454 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; | ||
1455 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); | ||
1456 | apic_write(APIC_LVT0, value); | ||
1457 | } else { | ||
1458 | /* Disable LVT0 */ | ||
1459 | apic_write(APIC_LVT0, APIC_LVT_MASKED); | ||
1460 | } | ||
1461 | 1448 | ||
1449 | if (!virt_wire_setup) { | ||
1462 | /* | 1450 | /* |
1463 | * For LVT1 make it edge triggered, active high, nmi and | 1451 | * For LVT0 make it edge triggered, active high, |
1464 | * enabled | 1452 | * external and enabled |
1465 | */ | 1453 | */ |
1466 | value = apic_read(APIC_LVT1); | 1454 | value = apic_read(APIC_LVT0); |
1467 | value &= ~( | 1455 | value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | |
1468 | APIC_MODE_MASK | APIC_SEND_PENDING | | ||
1469 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | | 1456 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | |
1470 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); | 1457 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); |
1471 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; | 1458 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; |
1472 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); | 1459 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); |
1473 | apic_write(APIC_LVT1, value); | 1460 | apic_write(APIC_LVT0, value); |
1461 | } else { | ||
1462 | /* Disable LVT0 */ | ||
1463 | apic_write(APIC_LVT0, APIC_LVT_MASKED); | ||
1474 | } | 1464 | } |
1465 | |||
1466 | /* | ||
1467 | * For LVT1 make it edge triggered, active high, | ||
1468 | * nmi and enabled | ||
1469 | */ | ||
1470 | value = apic_read(APIC_LVT1); | ||
1471 | value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | | ||
1472 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | | ||
1473 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); | ||
1474 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; | ||
1475 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); | ||
1476 | apic_write(APIC_LVT1, value); | ||
1475 | } | 1477 | } |
1476 | 1478 | ||
1477 | void __cpuinit generic_processor_info(int apicid, int version) | 1479 | void __cpuinit generic_processor_info(int apicid, int version) |
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index fe57db9f3fbb..0d969103fce7 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -1348,8 +1348,24 @@ void __init connect_bsp_APIC(void) | |||
1348 | */ | 1348 | */ |
1349 | void disconnect_bsp_APIC(int virt_wire_setup) | 1349 | void disconnect_bsp_APIC(int virt_wire_setup) |
1350 | { | 1350 | { |
1351 | #ifdef CONFIG_X86_32 | ||
1352 | if (pic_mode) { | ||
1353 | /* | ||
1354 | * Put the board back into PIC mode (has an effect only on | ||
1355 | * certain older boards). Note that APIC interrupts, including | ||
1356 | * IPIs, won't work beyond this point! The only exception are | ||
1357 | * INIT IPIs. | ||
1358 | */ | ||
1359 | apic_printk(APIC_VERBOSE, "disabling APIC mode, " | ||
1360 | "entering PIC mode.\n"); | ||
1361 | outb(0x70, 0x22); | ||
1362 | outb(0x00, 0x23); | ||
1363 | return; | ||
1364 | } | ||
1365 | #endif | ||
1366 | |||
1351 | /* Go back to Virtual Wire compatibility mode */ | 1367 | /* Go back to Virtual Wire compatibility mode */ |
1352 | unsigned long value; | 1368 | unsigned int value; |
1353 | 1369 | ||
1354 | /* For the spurious interrupt use vector F, and enable it */ | 1370 | /* For the spurious interrupt use vector F, and enable it */ |
1355 | value = apic_read(APIC_SPIV); | 1371 | value = apic_read(APIC_SPIV); |
@@ -1375,7 +1391,10 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
1375 | apic_write(APIC_LVT0, APIC_LVT_MASKED); | 1391 | apic_write(APIC_LVT0, APIC_LVT_MASKED); |
1376 | } | 1392 | } |
1377 | 1393 | ||
1378 | /* For LVT1 make it edge triggered, active high, nmi and enabled */ | 1394 | /* |
1395 | * For LVT1 make it edge triggered, active high, | ||
1396 | * nmi and enabled | ||
1397 | */ | ||
1379 | value = apic_read(APIC_LVT1); | 1398 | value = apic_read(APIC_LVT1); |
1380 | value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | | 1399 | value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | |
1381 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | | 1400 | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | |