1 commit 58d5fa7a6a6fc4754d295d0999b284edd67c8620
2 Author: Siddha, Suresh B <suresh.b.siddha@intel.com>
3 Date: Wed Oct 17 18:04:33 2007 +0200
5 i386: fix 4 bit apicid assumption of mach-default
7 Fix get_apic_id() in mach-default, so that it uses 8 bits incase of
8 xAPIC case and 4 bits for legacy APIC case.
10 This fixes the i386 kernel assumption that apic id is less than 16 for
11 xAPIC platforms with 8 cpus or less and makes the kernel boot on such
14 [ tglx: arch/x86 adaptation ]
16 Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
17 Signed-off-by: Andi Kleen <ak@suse.de>
18 Cc: Andi Kleen <ak@suse.de>
19 Cc: Andrew Morton <akpm@linux-foundation.org>
20 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
21 Signed-off-by: Ingo Molnar <mingo@elte.hu>
22 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
24 diff --git a/include/asm-i386/mach-default/mach_apicdef.h b/include/asm-i386/mach-default/mach_apicdef.h
25 index 7bcb350..ae98413 100644
26 --- a/include/asm-i386/mach-default/mach_apicdef.h
27 +++ b/include/asm-i386/mach-default/mach_apicdef.h
29 #ifndef __ASM_MACH_APICDEF_H
30 #define __ASM_MACH_APICDEF_H
32 +#include <asm/apic.h>
34 #define APIC_ID_MASK (0xF<<24)
36 static inline unsigned get_apic_id(unsigned long x)
38 - return (((x)>>24)&0xF);
39 + unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
40 + if (APIC_XAPIC(ver))
41 + return (((x)>>24)&0xFF);
43 + return (((x)>>24)&0xF);
46 #define GET_APIC_ID(x) get_apic_id(x)