diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-17 08:09:20 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 11:52:45 -0500 |
commit | 77313190d121dd1fffa965aff6e9f0782a307bb8 (patch) | |
tree | 9cbe0d670402b3a3f6f15bc18831ed13cd0efe45 /arch | |
parent | 5c615feb90ce63f2293a7ac7809f320f46c75e0a (diff) |
x86, apic: clean up arch/x86/kernel/bigsmp_32.c
Impact: cleanup
- remove unnecessary indirections that were artifacts of the subarch code
- clean up include file section
- clean up various small details
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/bigsmp_32.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c index f49af36351fa..41732abd7004 100644 --- a/arch/x86/kernel/bigsmp_32.c +++ b/arch/x86/kernel/bigsmp_32.c | |||
@@ -1,27 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | 2 | * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs. |
3 | * | ||
3 | * Drives the local APIC in "clustered mode". | 4 | * Drives the local APIC in "clustered mode". |
4 | */ | 5 | */ |
5 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/apic.h> | ||
9 | #include <asm/fixmap.h> | ||
10 | #include <asm/apicdef.h> | ||
11 | #include <asm/ipi.h> | ||
12 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 9 | #include <linux/init.h> |
14 | #include <linux/dmi.h> | 10 | #include <linux/dmi.h> |
15 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
16 | 12 | ||
13 | #include <asm/apicdef.h> | ||
14 | #include <asm/fixmap.h> | ||
15 | #include <asm/mpspec.h> | ||
16 | #include <asm/apic.h> | ||
17 | #include <asm/ipi.h> | ||
17 | 18 | ||
18 | static inline unsigned bigsmp_get_apic_id(unsigned long x) | 19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) |
19 | { | 20 | { |
20 | return (x >> 24) & 0xFF; | 21 | return (x >> 24) & 0xFF; |
21 | } | 22 | } |
22 | 23 | ||
23 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
24 | |||
25 | static inline int bigsmp_apic_id_registered(void) | 24 | static inline int bigsmp_apic_id_registered(void) |
26 | { | 25 | { |
27 | return 1; | 26 | return 1; |
@@ -36,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) | |||
36 | #endif | 35 | #endif |
37 | } | 36 | } |
38 | 37 | ||
39 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
40 | |||
41 | static inline unsigned long | 38 | static inline unsigned long |
42 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) | 39 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) |
43 | { | 40 | { |
@@ -52,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit) | |||
52 | static inline unsigned long calculate_ldr(int cpu) | 49 | static inline unsigned long calculate_ldr(int cpu) |
53 | { | 50 | { |
54 | unsigned long val, id; | 51 | unsigned long val, id; |
52 | |||
55 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | 53 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
56 | id = xapic_phys_to_log_apicid(cpu); | 54 | id = per_cpu(x86_bios_cpu_apicid, cpu); |
57 | val |= SET_APIC_LOGICAL_ID(id); | 55 | val |= SET_APIC_LOGICAL_ID(id); |
56 | |||
58 | return val; | 57 | return val; |
59 | } | 58 | } |
60 | 59 | ||
@@ -70,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void) | |||
70 | unsigned long val; | 69 | unsigned long val; |
71 | int cpu = smp_processor_id(); | 70 | int cpu = smp_processor_id(); |
72 | 71 | ||
73 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 72 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
74 | val = calculate_ldr(cpu); | 73 | val = calculate_ldr(cpu); |
75 | apic_write(APIC_LDR, val); | 74 | apic_write(APIC_LDR, val); |
76 | } | 75 | } |
77 | 76 | ||
78 | static inline void bigsmp_setup_apic_routing(void) | 77 | static inline void bigsmp_setup_apic_routing(void) |
79 | { | 78 | { |
80 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | 79 | printk(KERN_INFO |
81 | "Physflat", nr_ioapics); | 80 | "Enabling APIC mode: Physflat. Using %d I/O APICs\n", |
81 | nr_ioapics); | ||
82 | } | 82 | } |
83 | 83 | ||
84 | static inline int bigsmp_apicid_to_node(int logical_apicid) | 84 | static inline int bigsmp_apicid_to_node(int logical_apicid) |
@@ -100,6 +100,7 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | extern u8 cpu_2_logical_apicid[]; | 102 | extern u8 cpu_2_logical_apicid[]; |
103 | |||
103 | /* Mapping from cpu number to logical apicid */ | 104 | /* Mapping from cpu number to logical apicid */ |
104 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) | 105 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) |
105 | { | 106 | { |
@@ -175,21 +176,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d) | |||
175 | { | 176 | { |
176 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | 177 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); |
177 | dmi_bigsmp = 1; | 178 | dmi_bigsmp = 1; |
179 | |||
178 | return 0; | 180 | return 0; |
179 | } | 181 | } |
180 | 182 | ||
181 | 183 | ||
182 | static const struct dmi_system_id bigsmp_dmi_table[] = { | 184 | static const struct dmi_system_id bigsmp_dmi_table[] = { |
183 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", | 185 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", |
184 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 186 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
185 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} | 187 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), |
188 | } | ||
186 | }, | 189 | }, |
187 | 190 | ||
188 | { hp_ht_bigsmp, "HP ProLiant DL740", | 191 | { hp_ht_bigsmp, "HP ProLiant DL740", |
189 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 192 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
190 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} | 193 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"), |
194 | } | ||
191 | }, | 195 | }, |
192 | { } | 196 | { } /* NULL entry stops DMI scanning */ |
193 | }; | 197 | }; |
194 | 198 | ||
195 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) | 199 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) |
@@ -204,6 +208,7 @@ static int probe_bigsmp(void) | |||
204 | dmi_bigsmp = 1; | 208 | dmi_bigsmp = 1; |
205 | else | 209 | else |
206 | dmi_check_system(bigsmp_dmi_table); | 210 | dmi_check_system(bigsmp_dmi_table); |
211 | |||
207 | return dmi_bigsmp; | 212 | return dmi_bigsmp; |
208 | } | 213 | } |
209 | 214 | ||