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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #define APIC_ID_MASK (0xF<<24) |
| 7 | |
| 8 | static inline unsigned get_apic_id(unsigned long x) |
| 9 | { |
Siddha, Suresh B | 58d5fa7 | 2007-10-17 18:04:33 +0200 | [diff] [blame] | 10 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
| 11 | if (APIC_XAPIC(ver)) |
| 12 | return (((x)>>24)&0xFF); |
| 13 | else |
| 14 | return (((x)>>24)&0xF); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | #define GET_APIC_ID(x) get_apic_id(x) |
| 18 | |
| 19 | #endif |