Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_MACH_APICDEF_H |
| 2 | #define __ASM_MACH_APICDEF_H |
| 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 |
| 7 | #define APIC_ID_MASK (0xFFu<<24) |
Yinghai Lu | 9b96710 | 2008-03-21 15:14:07 -0700 | [diff] [blame] | 8 | #define GET_APIC_ID(x) (((x)>>24)&0xFFu) |
Glauber de Oliveira Costa | f6bc402 | 2008-03-19 14:25:53 -0300 | [diff] [blame] | 9 | #define SET_APIC_ID(x) (((x)<<24)) |
| 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 | |
| 24 | #endif |