diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-02-17 02:02:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 06:22:20 -0500 |
commit | c1eeb2de41d7015678bdd412b48a5f071b84e29a (patch) | |
tree | 6af99f46f557f9e854e882deac52d23b2fadb5a2 /arch/x86/include/asm/genapic.h | |
parent | 06cd9a7dc8a58186060a91b6ddc031057435fd34 (diff) |
x86: fold apic_ops into genapic
Impact: cleanup
make it simpler, don't need have one extra struct.
v2: fix the sgi_uv build
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/genapic.h')
-rw-r--r-- | arch/x86/include/asm/genapic.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index 273b99452ae0..a6d0b00a544c 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | #include <asm/mpspec.h> | 6 | #include <asm/mpspec.h> |
7 | #include <asm/atomic.h> | 7 | #include <asm/atomic.h> |
8 | #include <asm/apic.h> | ||
8 | 9 | ||
9 | /* | 10 | /* |
10 | * Copyright 2004 James Cleverdon, IBM. | 11 | * Copyright 2004 James Cleverdon, IBM. |
@@ -83,10 +84,70 @@ struct genapic { | |||
83 | void (*smp_callin_clear_local_apic)(void); | 84 | void (*smp_callin_clear_local_apic)(void); |
84 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | 85 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); |
85 | void (*inquire_remote_apic)(int apicid); | 86 | void (*inquire_remote_apic)(int apicid); |
87 | |||
88 | /* apic ops */ | ||
89 | u32 (*read)(u32 reg); | ||
90 | void (*write)(u32 reg, u32 v); | ||
91 | u64 (*icr_read)(void); | ||
92 | void (*icr_write)(u32 low, u32 high); | ||
93 | void (*wait_icr_idle)(void); | ||
94 | u32 (*safe_wait_icr_idle)(void); | ||
86 | }; | 95 | }; |
87 | 96 | ||
88 | extern struct genapic *apic; | 97 | extern struct genapic *apic; |
89 | 98 | ||
99 | static inline u32 apic_read(u32 reg) | ||
100 | { | ||
101 | return apic->read(reg); | ||
102 | } | ||
103 | |||
104 | static inline void apic_write(u32 reg, u32 val) | ||
105 | { | ||
106 | apic->write(reg, val); | ||
107 | } | ||
108 | |||
109 | static inline u64 apic_icr_read(void) | ||
110 | { | ||
111 | return apic->icr_read(); | ||
112 | } | ||
113 | |||
114 | static inline void apic_icr_write(u32 low, u32 high) | ||
115 | { | ||
116 | apic->icr_write(low, high); | ||
117 | } | ||
118 | |||
119 | static inline void apic_wait_icr_idle(void) | ||
120 | { | ||
121 | apic->wait_icr_idle(); | ||
122 | } | ||
123 | |||
124 | static inline u32 safe_apic_wait_icr_idle(void) | ||
125 | { | ||
126 | return apic->safe_wait_icr_idle(); | ||
127 | } | ||
128 | |||
129 | |||
130 | static inline void ack_APIC_irq(void) | ||
131 | { | ||
132 | /* | ||
133 | * ack_APIC_irq() actually gets compiled as a single instruction | ||
134 | * ... yummie. | ||
135 | */ | ||
136 | |||
137 | /* Docs say use 0 for future compatibility */ | ||
138 | apic_write(APIC_EOI, 0); | ||
139 | } | ||
140 | |||
141 | static inline unsigned default_get_apic_id(unsigned long x) | ||
142 | { | ||
143 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
144 | |||
145 | if (APIC_XAPIC(ver)) | ||
146 | return (x >> 24) & 0xFF; | ||
147 | else | ||
148 | return (x >> 24) & 0x0F; | ||
149 | } | ||
150 | |||
90 | /* | 151 | /* |
91 | * Warm reset vector default position: | 152 | * Warm reset vector default position: |
92 | */ | 153 | */ |