aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/apic.h
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2008-07-10 14:16:49 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-12 02:44:59 -0400
commit1b374e4d6f8b3eb2fcd034fcc24ea8ba1dfde7aa (patch)
treefaf5aa00e344e473957206bc82ffbb746e438d0b /include/asm-x86/apic.h
parent2d7a66d02e11af9ab8e16c76d22767e622b4e3d7 (diff)
x64, x2apic/intr-remap: basic apic ops support
Introduce basic apic operations which handle the apic programming. This will be used later to introduce another specific operations for x2apic. For the perfomance critial accesses like IPI's, EOI etc, we use the native operations as they are already referenced by different indirections like genapic, irq_chip etc. 64bit Paravirt ops can also define their apic operations accordingly. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: akpm@linux-foundation.org Cc: arjan@linux.intel.com Cc: andi@firstfloor.org Cc: ebiederm@xmission.com Cc: jbarnes@virtuousgeek.org Cc: steiner@sgi.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/apic.h')
-rw-r--r--include/asm-x86/apic.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 4e2c1e517f06..6fda195337c5 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -47,32 +47,59 @@ extern int disable_apic;
47#ifdef CONFIG_PARAVIRT 47#ifdef CONFIG_PARAVIRT
48#include <asm/paravirt.h> 48#include <asm/paravirt.h>
49#else 49#else
50#define apic_write native_apic_write 50#ifndef CONFIG_X86_64
51#define apic_write_atomic native_apic_write_atomic 51#define apic_write native_apic_mem_write
52#define apic_read native_apic_read 52#define apic_write_atomic native_apic_mem_write_atomic
53#define apic_read native_apic_mem_read
54#endif
53#define setup_boot_clock setup_boot_APIC_clock 55#define setup_boot_clock setup_boot_APIC_clock
54#define setup_secondary_clock setup_secondary_APIC_clock 56#define setup_secondary_clock setup_secondary_APIC_clock
55#endif 57#endif
56 58
57extern int is_vsmp_box(void); 59extern int is_vsmp_box(void);
58 60
59static inline void native_apic_write(unsigned long reg, u32 v) 61static inline void native_apic_mem_write(u32 reg, u32 v)
60{ 62{
61 *((volatile u32 *)(APIC_BASE + reg)) = v; 63 *((volatile u32 *)(APIC_BASE + reg)) = v;
62} 64}
63 65
64static inline void native_apic_write_atomic(unsigned long reg, u32 v) 66static inline void native_apic_mem_write_atomic(u32 reg, u32 v)
65{ 67{
66 (void)xchg((u32 *)(APIC_BASE + reg), v); 68 (void)xchg((u32 *)(APIC_BASE + reg), v);
67} 69}
68 70
69static inline u32 native_apic_read(unsigned long reg) 71static inline u32 native_apic_mem_read(u32 reg)
70{ 72{
71 return *((volatile u32 *)(APIC_BASE + reg)); 73 return *((volatile u32 *)(APIC_BASE + reg));
72} 74}
73 75
76#ifdef CONFIG_X86_32
74extern void apic_wait_icr_idle(void); 77extern void apic_wait_icr_idle(void);
75extern u32 safe_apic_wait_icr_idle(void); 78extern u32 safe_apic_wait_icr_idle(void);
79extern void apic_icr_write(u32 low, u32 id);
80#else
81
82struct apic_ops {
83 u32 (*read)(u32 reg);
84 void (*write)(u32 reg, u32 v);
85 void (*write_atomic)(u32 reg, u32 v);
86 u64 (*icr_read)(void);
87 void (*icr_write)(u32 low, u32 high);
88 void (*wait_icr_idle)(void);
89 u32 (*safe_wait_icr_idle)(void);
90};
91
92extern struct apic_ops *apic_ops;
93
94#define apic_read (apic_ops->read)
95#define apic_write (apic_ops->write)
96#define apic_write_atomic (apic_ops->write_atomic)
97#define apic_icr_read (apic_ops->icr_read)
98#define apic_icr_write (apic_ops->icr_write)
99#define apic_wait_icr_idle (apic_ops->wait_icr_idle)
100#define safe_apic_wait_icr_idle (apic_ops->safe_wait_icr_idle)
101#endif
102
76extern int get_physical_broadcast(void); 103extern int get_physical_broadcast(void);
77 104
78#ifdef CONFIG_X86_GOOD_APIC 105#ifdef CONFIG_X86_GOOD_APIC
@@ -95,7 +122,11 @@ static inline void ack_APIC_irq(void)
95 */ 122 */
96 123
97 /* Docs say use 0 for future compatibility */ 124 /* Docs say use 0 for future compatibility */
125#ifdef CONFIG_X86_32
98 apic_write_around(APIC_EOI, 0); 126 apic_write_around(APIC_EOI, 0);
127#else
128 native_apic_mem_write(APIC_EOI, 0);
129#endif
99} 130}
100 131
101extern int lapic_get_maxlvt(void); 132extern int lapic_get_maxlvt(void);