aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-28 11:09:58 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-28 17:20:34 -0500
commit018e047f3a98bd8d9e9d78b19bc38415f0c34dd7 (patch)
tree4e3b47a6e5b3e5e50ecdc668b7261399ce3457c0 /arch/x86/include
parent25dc004903a38f0b6f6626dbbab058c8709c5398 (diff)
x86, ES7000: consolidate the APIC code
Consolidate all the ES7000 APIC code into arch/x86/mach-generic/es7000.c. With this ES7000 ceases to rely on any subarchitecture include files. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/es7000/apic.h236
-rw-r--r--arch/x86/include/asm/es7000/apicdef.h9
-rw-r--r--arch/x86/include/asm/es7000/ipi.h22
-rw-r--r--arch/x86/include/asm/es7000/mpparse.h23
-rw-r--r--arch/x86/include/asm/es7000/wakecpu.h16
5 files changed, 0 insertions, 306 deletions
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h
deleted file mode 100644
index b89b45db735d..000000000000
--- a/arch/x86/include/asm/es7000/apic.h
+++ /dev/null
@@ -1,236 +0,0 @@
1#ifndef __ASM_ES7000_APIC_H
2#define __ASM_ES7000_APIC_H
3
4#include <linux/gfp.h>
5
6#define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
7
8static inline int es7000_apic_id_registered(void)
9{
10 return 1;
11}
12
13static inline const cpumask_t *target_cpus_cluster(void)
14{
15 return &CPU_MASK_ALL;
16}
17
18static inline const cpumask_t *es7000_target_cpus(void)
19{
20 return &cpumask_of_cpu(smp_processor_id());
21}
22
23#define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER)
24#define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio)
25#define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */
26
27#define APIC_DFR_VALUE (APIC_DFR_FLAT)
28
29static inline unsigned long
30es7000_check_apicid_used(physid_mask_t bitmap, int apicid)
31{
32 return 0;
33}
34static inline unsigned long es7000_check_apicid_present(int bit)
35{
36 return physid_isset(bit, phys_cpu_present_map);
37}
38
39extern void es7000_enable_apic_mode(void);
40
41#define apicid_cluster(apicid) (apicid & 0xF0)
42
43static inline unsigned long calculate_ldr(int cpu)
44{
45 unsigned long id;
46 id = xapic_phys_to_log_apicid(cpu);
47 return (SET_APIC_LOGICAL_ID(id));
48}
49
50/*
51 * Set up the logical destination ID.
52 *
53 * Intel recommends to set DFR, LdR and TPR before enabling
54 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
55 * document number 292116). So here it goes...
56 */
57static inline void es7000_init_apic_ldr_cluster(void)
58{
59 unsigned long val;
60 int cpu = smp_processor_id();
61
62 apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER);
63 val = calculate_ldr(cpu);
64 apic_write(APIC_LDR, val);
65}
66
67static inline void es7000_init_apic_ldr(void)
68{
69 unsigned long val;
70 int cpu = smp_processor_id();
71
72 apic_write(APIC_DFR, APIC_DFR_VALUE);
73 val = calculate_ldr(cpu);
74 apic_write(APIC_LDR, val);
75}
76
77extern int apic_version [MAX_APICS];
78static inline void es7000_setup_apic_routing(void)
79{
80 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
81 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
82 (apic_version[apic] == 0x14) ?
83 "Physical Cluster" : "Logical Cluster",
84 nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
85}
86
87static inline int es7000_apicid_to_node(int logical_apicid)
88{
89 return 0;
90}
91
92
93static inline int es7000_cpu_present_to_apicid(int mps_cpu)
94{
95 if (!mps_cpu)
96 return boot_cpu_physical_apicid;
97 else if (mps_cpu < nr_cpu_ids)
98 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
99 else
100 return BAD_APICID;
101}
102
103static inline physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid)
104{
105 static int id = 0;
106 physid_mask_t mask;
107 mask = physid_mask_of_physid(id);
108 ++id;
109 return mask;
110}
111
112extern u8 cpu_2_logical_apicid[];
113/* Mapping from cpu number to logical apicid */
114static inline int es7000_cpu_to_logical_apicid(int cpu)
115{
116#ifdef CONFIG_SMP
117 if (cpu >= nr_cpu_ids)
118 return BAD_APICID;
119 return (int)cpu_2_logical_apicid[cpu];
120#else
121 return logical_smp_processor_id();
122#endif
123}
124
125static inline physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
126{
127 /* For clustered we don't have a good way to do this yet - hack */
128 return physids_promote(0xff);
129}
130
131extern unsigned int boot_cpu_physical_apicid;
132
133static inline int es7000_check_phys_apicid_present(int cpu_physical_apicid)
134{
135 boot_cpu_physical_apicid = read_apic_id();
136 return (1);
137}
138
139static inline unsigned int
140es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
141{
142 int cpus_found = 0;
143 int num_bits_set;
144 int apicid;
145 int cpu;
146
147 num_bits_set = cpumask_weight(cpumask);
148 /* Return id to all */
149 if (num_bits_set == nr_cpu_ids)
150 return 0xFF;
151 /*
152 * The cpus in the mask must all be on the apic cluster. If are not
153 * on the same apicid cluster return default value of target_cpus():
154 */
155 cpu = cpumask_first(cpumask);
156 apicid = es7000_cpu_to_logical_apicid(cpu);
157
158 while (cpus_found < num_bits_set) {
159 if (cpumask_test_cpu(cpu, cpumask)) {
160 int new_apicid = es7000_cpu_to_logical_apicid(cpu);
161
162 if (apicid_cluster(apicid) !=
163 apicid_cluster(new_apicid)) {
164 printk ("%s: Not a valid mask!\n", __func__);
165
166 return 0xFF;
167 }
168 apicid = new_apicid;
169 cpus_found++;
170 }
171 cpu++;
172 }
173 return apicid;
174}
175
176static inline unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
177{
178 int cpus_found = 0;
179 int num_bits_set;
180 int apicid;
181 int cpu;
182
183 num_bits_set = cpus_weight(*cpumask);
184 /* Return id to all */
185 if (num_bits_set == nr_cpu_ids)
186 return es7000_cpu_to_logical_apicid(0);
187 /*
188 * The cpus in the mask must all be on the apic cluster. If are not
189 * on the same apicid cluster return default value of target_cpus():
190 */
191 cpu = first_cpu(*cpumask);
192 apicid = es7000_cpu_to_logical_apicid(cpu);
193 while (cpus_found < num_bits_set) {
194 if (cpu_isset(cpu, *cpumask)) {
195 int new_apicid = es7000_cpu_to_logical_apicid(cpu);
196
197 if (apicid_cluster(apicid) !=
198 apicid_cluster(new_apicid)) {
199 printk ("%s: Not a valid mask!\n", __func__);
200
201 return es7000_cpu_to_logical_apicid(0);
202 }
203 apicid = new_apicid;
204 cpus_found++;
205 }
206 cpu++;
207 }
208 return apicid;
209}
210
211
212static inline unsigned int
213es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
214 const struct cpumask *andmask)
215{
216 int apicid = es7000_cpu_to_logical_apicid(0);
217 cpumask_var_t cpumask;
218
219 if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
220 return apicid;
221
222 cpumask_and(cpumask, inmask, andmask);
223 cpumask_and(cpumask, cpumask, cpu_online_mask);
224 apicid = es7000_cpu_mask_to_apicid(cpumask);
225
226 free_cpumask_var(cpumask);
227
228 return apicid;
229}
230
231static inline int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
232{
233 return cpuid_apic >> index_msb;
234}
235
236#endif /* __ASM_ES7000_APIC_H */
diff --git a/arch/x86/include/asm/es7000/apicdef.h b/arch/x86/include/asm/es7000/apicdef.h
deleted file mode 100644
index c74881a7b3d8..000000000000
--- a/arch/x86/include/asm/es7000/apicdef.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_ES7000_APICDEF_H
2#define __ASM_ES7000_APICDEF_H
3
4static inline unsigned int es7000_get_apic_id(unsigned long x)
5{
6 return (x >> 24) & 0xFF;
7}
8
9#endif
diff --git a/arch/x86/include/asm/es7000/ipi.h b/arch/x86/include/asm/es7000/ipi.h
deleted file mode 100644
index 81e77c812baa..000000000000
--- a/arch/x86/include/asm/es7000/ipi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef __ASM_ES7000_IPI_H
2#define __ASM_ES7000_IPI_H
3
4void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
6
7static inline void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
8{
9 default_send_IPI_mask_sequence(mask, vector);
10}
11
12static inline void es7000_send_IPI_allbutself(int vector)
13{
14 default_send_IPI_mask_allbutself(cpu_online_mask, vector);
15}
16
17static inline void es7000_send_IPI_all(int vector)
18{
19 es7000_send_IPI_mask(cpu_online_mask, vector);
20}
21
22#endif /* __ASM_ES7000_IPI_H */
diff --git a/arch/x86/include/asm/es7000/mpparse.h b/arch/x86/include/asm/es7000/mpparse.h
deleted file mode 100644
index 662eb1e574de..000000000000
--- a/arch/x86/include/asm/es7000/mpparse.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __ASM_ES7000_MPPARSE_H
2#define __ASM_ES7000_MPPARSE_H
3
4#include <linux/acpi.h>
5
6extern int parse_unisys_oem (char *oemptr);
7extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
8extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
9extern void setup_unisys(void);
10
11#ifdef CONFIG_ACPI
12static inline int es7000_check_dsdt(void)
13{
14 struct acpi_table_header header;
15
16 if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
17 !strncmp(header.oem_id, "UNISYS", 6))
18 return 1;
19 return 0;
20}
21#endif
22
23#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/arch/x86/include/asm/es7000/wakecpu.h b/arch/x86/include/asm/es7000/wakecpu.h
deleted file mode 100644
index 99c72be1840e..000000000000
--- a/arch/x86/include/asm/es7000/wakecpu.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_ES7000_WAKECPU_H
2#define __ASM_ES7000_WAKECPU_H
3
4#define ES7000_TRAMPOLINE_PHYS_LOW 0x467
5#define ES7000_TRAMPOLINE_PHYS_HIGH 0x469
6
7static inline void es7000_wait_for_init_deassert(atomic_t *deassert)
8{
9#ifndef CONFIG_ES7000_CLUSTERED_APIC
10 while (!atomic_read(deassert))
11 cpu_relax();
12#endif
13 return;
14}
15
16#endif /* __ASM_MACH_WAKECPU_H */