Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 1 | #ifndef ASM_X86__MACH_DEFAULT__MACH_APICDEF_H |
| 2 | #define ASM_X86__MACH_DEFAULT__MACH_APICDEF_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Siddha, Suresh B | 58d5fa7 | 2007-10-17 18:04:33 +0200 | [diff] [blame] | 4 | #include <asm/apic.h> |
| 5 | |
Glauber de Oliveira Costa | f6bc402 | 2008-03-19 14:25:53 -0300 | [diff] [blame] | 6 | #ifdef CONFIG_X86_64 |
Yinghai Lu | f910a9d | 2008-07-12 01:01:20 -0700 | [diff] [blame] | 7 | #define APIC_ID_MASK (genapic->apic_id_mask) |
| 8 | #define GET_APIC_ID(x) (genapic->get_apic_id(x)) |
| 9 | #define SET_APIC_ID(x) (genapic->set_apic_id(x)) |
Glauber de Oliveira Costa | f6bc402 | 2008-03-19 14:25:53 -0300 | [diff] [blame] | 10 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #define APIC_ID_MASK (0xF<<24) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | static inline unsigned get_apic_id(unsigned long x) |
Yinghai Lu | 9b96710 | 2008-03-21 15:14:07 -0700 | [diff] [blame] | 13 | { |
Siddha, Suresh B | 58d5fa7 | 2007-10-17 18:04:33 +0200 | [diff] [blame] | 14 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
| 15 | if (APIC_XAPIC(ver)) |
| 16 | return (((x)>>24)&0xFF); |
| 17 | else |
| 18 | return (((x)>>24)&0xF); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | #define GET_APIC_ID(x) get_apic_id(x) |
Yinghai Lu | 9b96710 | 2008-03-21 15:14:07 -0700 | [diff] [blame] | 22 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 24 | #endif /* ASM_X86__MACH_DEFAULT__MACH_APICDEF_H */ |