aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-28 08:08:38 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-28 17:20:29 -0500
commitca6c8ed4646f8ccaa4f7db618bf69b8b8fb49767 (patch)
tree0d321219bba34dab2a43bad628042440cc493ed2 /arch/x86
parent9c7642470ecf03d8b4946a2addc8fe631b8426dd (diff)
x86, apic: refactor ->get_apic_id() & GET_APIC_ID()
- spread out the namespace on a per driver basis - get rid of macro wrappers - small cleanups Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/bigsmp/apicdef.h6
-rw-r--r--arch/x86/include/asm/es7000/apicdef.h6
-rw-r--r--arch/x86/include/asm/mach-default/mach_apic.h2
-rw-r--r--arch/x86/include/asm/mach-default/mach_apicdef.h10
-rw-r--r--arch/x86/include/asm/mach-generic/mach_apicdef.h1
-rw-r--r--arch/x86/include/asm/numaq/apicdef.h7
-rw-r--r--arch/x86/include/asm/smp.h2
-rw-r--r--arch/x86/include/asm/summit/apicdef.h6
-rw-r--r--arch/x86/kernel/genapic_flat_64.c9
-rw-r--r--arch/x86/kernel/genx2apic_cluster.c4
-rw-r--r--arch/x86/kernel/genx2apic_phys.c4
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c6
-rw-r--r--arch/x86/mach-generic/bigsmp.c2
-rw-r--r--arch/x86/mach-generic/default.c2
-rw-r--r--arch/x86/mach-generic/es7000.c2
-rw-r--r--arch/x86/mach-generic/numaq.c2
-rw-r--r--arch/x86/mach-generic/summit.c2
17 files changed, 32 insertions, 41 deletions
diff --git a/arch/x86/include/asm/bigsmp/apicdef.h b/arch/x86/include/asm/bigsmp/apicdef.h
index 392c3f5ef2fe..ed25dd6503b2 100644
--- a/arch/x86/include/asm/bigsmp/apicdef.h
+++ b/arch/x86/include/asm/bigsmp/apicdef.h
@@ -3,11 +3,9 @@
3 3
4#define APIC_ID_MASK (0xFF<<24) 4#define APIC_ID_MASK (0xFF<<24)
5 5
6static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned bigsmp_get_apic_id(unsigned long x)
7{ 7{
8 return (((x)>>24)&0xFF); 8 return (x >> 24) & 0xFF;
9} 9}
10 10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif 11#endif
diff --git a/arch/x86/include/asm/es7000/apicdef.h b/arch/x86/include/asm/es7000/apicdef.h
index 8b234a3cb851..e23791762a19 100644
--- a/arch/x86/include/asm/es7000/apicdef.h
+++ b/arch/x86/include/asm/es7000/apicdef.h
@@ -3,11 +3,9 @@
3 3
4#define APIC_ID_MASK (0xFF<<24) 4#define APIC_ID_MASK (0xFF<<24)
5 5
6static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned int es7000_get_apic_id(unsigned long x)
7{ 7{
8 return (((x)>>24)&0xFF); 8 return (x >> 24) & 0xFF;
9} 9}
10 10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif 11#endif
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h
index d0605281a6b7..8719208f2735 100644
--- a/arch/x86/include/asm/mach-default/mach_apic.h
+++ b/arch/x86/include/asm/mach-default/mach_apic.h
@@ -21,7 +21,7 @@ static inline const struct cpumask *default_target_cpus(void)
21#include <asm/genapic.h> 21#include <asm/genapic.h>
22#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid) 22#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
23#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and) 23#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
24#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID))) 24#define read_apic_id() (apic->get_apic_id(apic_read(APIC_ID)))
25#define send_IPI_self (apic->send_IPI_self) 25#define send_IPI_self (apic->send_IPI_self)
26#define wakeup_secondary_cpu (apic->wakeup_cpu) 26#define wakeup_secondary_cpu (apic->wakeup_cpu)
27extern void default_setup_apic_routing(void); 27extern void default_setup_apic_routing(void);
diff --git a/arch/x86/include/asm/mach-default/mach_apicdef.h b/arch/x86/include/asm/mach-default/mach_apicdef.h
index b4dcc0971c76..e84d437ba2b2 100644
--- a/arch/x86/include/asm/mach-default/mach_apicdef.h
+++ b/arch/x86/include/asm/mach-default/mach_apicdef.h
@@ -5,20 +5,20 @@
5 5
6#ifdef CONFIG_X86_64 6#ifdef CONFIG_X86_64
7#define APIC_ID_MASK (apic->apic_id_mask) 7#define APIC_ID_MASK (apic->apic_id_mask)
8#define GET_APIC_ID(x) (apic->get_apic_id(x))
9#define SET_APIC_ID(x) (apic->set_apic_id(x)) 8#define SET_APIC_ID(x) (apic->set_apic_id(x))
10#else 9#else
11#define APIC_ID_MASK (0xF<<24) 10#define APIC_ID_MASK (0xF<<24)
12static inline unsigned get_apic_id(unsigned long x) 11
12static inline unsigned default_get_apic_id(unsigned long x)
13{ 13{
14 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); 14 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
15
15 if (APIC_XAPIC(ver)) 16 if (APIC_XAPIC(ver))
16 return (((x)>>24)&0xFF); 17 return (x >> 24) & 0xFF;
17 else 18 else
18 return (((x)>>24)&0xF); 19 return (x >> 24) & 0x0F;
19} 20}
20 21
21#define GET_APIC_ID(x) get_apic_id(x)
22#endif 22#endif
23 23
24#endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */ 24#endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */
diff --git a/arch/x86/include/asm/mach-generic/mach_apicdef.h b/arch/x86/include/asm/mach-generic/mach_apicdef.h
index acc9adddb344..645520bcd2c2 100644
--- a/arch/x86/include/asm/mach-generic/mach_apicdef.h
+++ b/arch/x86/include/asm/mach-generic/mach_apicdef.h
@@ -4,7 +4,6 @@
4#ifndef APIC_DEFINITION 4#ifndef APIC_DEFINITION
5#include <asm/genapic.h> 5#include <asm/genapic.h>
6 6
7#define GET_APIC_ID (apic->get_apic_id)
8#define APIC_ID_MASK (apic->apic_id_mask) 7#define APIC_ID_MASK (apic->apic_id_mask)
9#endif 8#endif
10 9
diff --git a/arch/x86/include/asm/numaq/apicdef.h b/arch/x86/include/asm/numaq/apicdef.h
index e012a46cc22a..29f5e3d34e5b 100644
--- a/arch/x86/include/asm/numaq/apicdef.h
+++ b/arch/x86/include/asm/numaq/apicdef.h
@@ -1,14 +1,11 @@
1#ifndef __ASM_NUMAQ_APICDEF_H 1#ifndef __ASM_NUMAQ_APICDEF_H
2#define __ASM_NUMAQ_APICDEF_H 2#define __ASM_NUMAQ_APICDEF_H
3 3
4
5#define APIC_ID_MASK (0xF<<24) 4#define APIC_ID_MASK (0xF<<24)
6 5
7static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned int numaq_get_apic_id(unsigned long x)
8{ 7{
9 return (((x)>>24)&0x0F); 8 return (x >> 24) & 0x0F;
10} 9}
11 10
12#define GET_APIC_ID(x) get_apic_id(x)
13
14#endif 11#endif
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 45ef8a1b9d7c..c63d480802af 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -189,7 +189,7 @@ static inline unsigned int read_apic_id(void)
189 189
190 reg = *(u32 *)(APIC_BASE + APIC_ID); 190 reg = *(u32 *)(APIC_BASE + APIC_ID);
191 191
192 return GET_APIC_ID(reg); 192 return apic->get_apic_id(reg);
193} 193}
194#endif 194#endif
195 195
diff --git a/arch/x86/include/asm/summit/apicdef.h b/arch/x86/include/asm/summit/apicdef.h
index f3fbca1f61c1..4286528af7c6 100644
--- a/arch/x86/include/asm/summit/apicdef.h
+++ b/arch/x86/include/asm/summit/apicdef.h
@@ -3,11 +3,9 @@
3 3
4#define APIC_ID_MASK (0xFF<<24) 4#define APIC_ID_MASK (0xFF<<24)
5 5
6static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned summit_get_apic_id(unsigned long x)
7{ 7{
8 return (x>>24)&0xFF; 8 return (x >> 24) & 0xFF;
9} 9}
10 10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif 11#endif
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index cc9e07b96094..ab47091dac2b 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -126,11 +126,12 @@ static void flat_send_IPI_all(int vector)
126 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical); 126 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical);
127} 127}
128 128
129static unsigned int get_apic_id(unsigned long x) 129static unsigned int flat_get_apic_id(unsigned long x)
130{ 130{
131 unsigned int id; 131 unsigned int id;
132 132
133 id = (((x)>>24) & 0xFFu); 133 id = (((x)>>24) & 0xFFu);
134
134 return id; 135 return id;
135} 136}
136 137
@@ -146,7 +147,7 @@ static unsigned int read_xapic_id(void)
146{ 147{
147 unsigned int id; 148 unsigned int id;
148 149
149 id = get_apic_id(apic_read(APIC_ID)); 150 id = flat_get_apic_id(apic_read(APIC_ID));
150 return id; 151 return id;
151} 152}
152 153
@@ -205,7 +206,7 @@ struct genapic apic_flat = {
205 .phys_pkg_id = flat_phys_pkg_id, 206 .phys_pkg_id = flat_phys_pkg_id,
206 .mps_oem_check = NULL, 207 .mps_oem_check = NULL,
207 208
208 .get_apic_id = get_apic_id, 209 .get_apic_id = flat_get_apic_id,
209 .set_apic_id = set_apic_id, 210 .set_apic_id = set_apic_id,
210 .apic_id_mask = 0xFFu << 24, 211 .apic_id_mask = 0xFFu << 24,
211 212
@@ -349,7 +350,7 @@ struct genapic apic_physflat = {
349 .phys_pkg_id = flat_phys_pkg_id, 350 .phys_pkg_id = flat_phys_pkg_id,
350 .mps_oem_check = NULL, 351 .mps_oem_check = NULL,
351 352
352 .get_apic_id = get_apic_id, 353 .get_apic_id = flat_get_apic_id,
353 .set_apic_id = set_apic_id, 354 .set_apic_id = set_apic_id,
354 .apic_id_mask = 0xFFu<<24, 355 .apic_id_mask = 0xFFu<<24,
355 356
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index 18b6f14376eb..c7557e051848 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -141,7 +141,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
141 return BAD_APICID; 141 return BAD_APICID;
142} 142}
143 143
144static unsigned int get_apic_id(unsigned long x) 144static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
145{ 145{
146 unsigned int id; 146 unsigned int id;
147 147
@@ -207,7 +207,7 @@ struct genapic apic_x2apic_cluster = {
207 .phys_pkg_id = x2apic_cluster_phys_pkg_id, 207 .phys_pkg_id = x2apic_cluster_phys_pkg_id,
208 .mps_oem_check = NULL, 208 .mps_oem_check = NULL,
209 209
210 .get_apic_id = get_apic_id, 210 .get_apic_id = x2apic_cluster_phys_get_apic_id,
211 .set_apic_id = set_apic_id, 211 .set_apic_id = set_apic_id,
212 .apic_id_mask = 0xFFFFFFFFu, 212 .apic_id_mask = 0xFFFFFFFFu,
213 213
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index 2cb6f49e4c50..80cba49cfd89 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -140,7 +140,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
140 return BAD_APICID; 140 return BAD_APICID;
141} 141}
142 142
143static unsigned int get_apic_id(unsigned long x) 143static unsigned int x2apic_phys_get_apic_id(unsigned long x)
144{ 144{
145 unsigned int id; 145 unsigned int id;
146 146
@@ -203,7 +203,7 @@ struct genapic apic_x2apic_phys = {
203 .phys_pkg_id = x2apic_phys_pkg_id, 203 .phys_pkg_id = x2apic_phys_pkg_id,
204 .mps_oem_check = NULL, 204 .mps_oem_check = NULL,
205 205
206 .get_apic_id = get_apic_id, 206 .get_apic_id = x2apic_phys_get_apic_id,
207 .set_apic_id = set_apic_id, 207 .set_apic_id = set_apic_id,
208 .apic_id_mask = 0xFFFFFFFFu, 208 .apic_id_mask = 0xFFFFFFFFu,
209 209
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 67e7658775e7..50310b96adc3 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -201,7 +201,7 @@ static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
201 return BAD_APICID; 201 return BAD_APICID;
202} 202}
203 203
204static unsigned int get_apic_id(unsigned long x) 204static unsigned int x2apic_get_apic_id(unsigned long x)
205{ 205{
206 unsigned int id; 206 unsigned int id;
207 207
@@ -223,7 +223,7 @@ static unsigned long set_apic_id(unsigned int id)
223static unsigned int uv_read_apic_id(void) 223static unsigned int uv_read_apic_id(void)
224{ 224{
225 225
226 return get_apic_id(apic_read(APIC_ID)); 226 return x2apic_get_apic_id(apic_read(APIC_ID));
227} 227}
228 228
229static int uv_phys_pkg_id(int initial_apicid, int index_msb) 229static int uv_phys_pkg_id(int initial_apicid, int index_msb)
@@ -268,7 +268,7 @@ struct genapic apic_x2apic_uv_x = {
268 .phys_pkg_id = uv_phys_pkg_id, 268 .phys_pkg_id = uv_phys_pkg_id,
269 .mps_oem_check = NULL, 269 .mps_oem_check = NULL,
270 270
271 .get_apic_id = get_apic_id, 271 .get_apic_id = x2apic_get_apic_id,
272 .set_apic_id = set_apic_id, 272 .set_apic_id = set_apic_id,
273 .apic_id_mask = 0xFFFFFFFFu, 273 .apic_id_mask = 0xFFFFFFFFu,
274 274
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c
index 6bf6aafeb2c6..9eca977227c4 100644
--- a/arch/x86/mach-generic/bigsmp.c
+++ b/arch/x86/mach-generic/bigsmp.c
@@ -90,7 +90,7 @@ struct genapic apic_bigsmp = {
90 .phys_pkg_id = bigsmp_phys_pkg_id, 90 .phys_pkg_id = bigsmp_phys_pkg_id,
91 .mps_oem_check = NULL, 91 .mps_oem_check = NULL,
92 92
93 .get_apic_id = get_apic_id, 93 .get_apic_id = bigsmp_get_apic_id,
94 .set_apic_id = NULL, 94 .set_apic_id = NULL,
95 .apic_id_mask = APIC_ID_MASK, 95 .apic_id_mask = APIC_ID_MASK,
96 96
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c
index e5f85cd75b43..d51a3f0335ae 100644
--- a/arch/x86/mach-generic/default.c
+++ b/arch/x86/mach-generic/default.c
@@ -71,7 +71,7 @@ struct genapic apic_default = {
71 .phys_pkg_id = default_phys_pkg_id, 71 .phys_pkg_id = default_phys_pkg_id,
72 .mps_oem_check = NULL, 72 .mps_oem_check = NULL,
73 73
74 .get_apic_id = get_apic_id, 74 .get_apic_id = default_get_apic_id,
75 .set_apic_id = NULL, 75 .set_apic_id = NULL,
76 .apic_id_mask = APIC_ID_MASK, 76 .apic_id_mask = APIC_ID_MASK,
77 77
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c
index f861163cd396..1944675db629 100644
--- a/arch/x86/mach-generic/es7000.c
+++ b/arch/x86/mach-generic/es7000.c
@@ -126,7 +126,7 @@ struct genapic apic_es7000 = {
126 .phys_pkg_id = es7000_phys_pkg_id, 126 .phys_pkg_id = es7000_phys_pkg_id,
127 .mps_oem_check = es7000_mps_oem_check, 127 .mps_oem_check = es7000_mps_oem_check,
128 128
129 .get_apic_id = get_apic_id, 129 .get_apic_id = es7000_get_apic_id,
130 .set_apic_id = NULL, 130 .set_apic_id = NULL,
131 .apic_id_mask = APIC_ID_MASK, 131 .apic_id_mask = APIC_ID_MASK,
132 132
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c
index 517882c9c15a..fcbba84c090f 100644
--- a/arch/x86/mach-generic/numaq.c
+++ b/arch/x86/mach-generic/numaq.c
@@ -90,7 +90,7 @@ struct genapic apic_numaq = {
90 .phys_pkg_id = numaq_phys_pkg_id, 90 .phys_pkg_id = numaq_phys_pkg_id,
91 .mps_oem_check = __numaq_mps_oem_check, 91 .mps_oem_check = __numaq_mps_oem_check,
92 92
93 .get_apic_id = get_apic_id, 93 .get_apic_id = numaq_get_apic_id,
94 .set_apic_id = NULL, 94 .set_apic_id = NULL,
95 .apic_id_mask = APIC_ID_MASK, 95 .apic_id_mask = APIC_ID_MASK,
96 96
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c
index 719e944ff308..5650eaf9061f 100644
--- a/arch/x86/mach-generic/summit.c
+++ b/arch/x86/mach-generic/summit.c
@@ -70,7 +70,7 @@ struct genapic apic_summit = {
70 .phys_pkg_id = summit_phys_pkg_id, 70 .phys_pkg_id = summit_phys_pkg_id,
71 .mps_oem_check = summit_mps_oem_check, 71 .mps_oem_check = summit_mps_oem_check,
72 72
73 .get_apic_id = get_apic_id, 73 .get_apic_id = summit_get_apic_id,
74 .set_apic_id = NULL, 74 .set_apic_id = NULL,
75 .apic_id_mask = APIC_ID_MASK, 75 .apic_id_mask = APIC_ID_MASK,
76 76