Commit 071922c08cef62e194d83db1cc4fa75892c69651
Committed by
Linus Torvalds
1 parent
41a5311465
Exists in
master
and in
7 other branches
i386: es7000 build breakage fix
o Commit 1833d6bc72893265f22addd79cf52e6987496e0f broke the build if compiled with CONFIG_ES7000=y and CONFIG_X86_GENERICARCH=n arch/i386/kernel/built-in.o(.init.text+0x4fa9): In function `acpi_parse_madt': : undefined reference to `acpi_madt_oem_check' arch/i386/kernel/built-in.o(.init.text+0x7406): In function `smp_read_mpc': : undefined reference to `mps_oem_check' arch/i386/kernel/built-in.o(.init.text+0x8990): In function `connect_bsp_APIC': : undefined reference to `enable_apic_mode' make: *** [.tmp_vmlinux1] Error 1 o Fix the build issue. Provided the definitions of missing functions. o Don't have ES7000 machine. Only compile tested. Cc: Len Brown <lenb@kernel.org> Cc: Natalie Protasevich <protasnb@gmail.com> Cc: Roland Dreier <rolandd@cisco.com> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 58 additions and 0 deletions Inline Diff
arch/i386/mach-es7000/es7000plat.c
1 | /* | 1 | /* |
2 | * Written by: Garry Forsgren, Unisys Corporation | 2 | * Written by: Garry Forsgren, Unisys Corporation |
3 | * Natalie Protasevich, Unisys Corporation | 3 | * Natalie Protasevich, Unisys Corporation |
4 | * This file contains the code to configure and interface | 4 | * This file contains the code to configure and interface |
5 | * with Unisys ES7000 series hardware system manager. | 5 | * with Unisys ES7000 series hardware system manager. |
6 | * | 6 | * |
7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. | 7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of version 2 of the GNU General Public License as | 10 | * under the terms of version 2 of the GNU General Public License as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | * | 12 | * |
13 | * This program is distributed in the hope that it would be useful, but | 13 | * This program is distributed in the hope that it would be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | * | 16 | * |
17 | * You should have received a copy of the GNU General Public License along | 17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; if not, write the Free Software Foundation, Inc., 59 | 18 | * with this program; if not, write the Free Software Foundation, Inc., 59 |
19 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | 19 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. |
20 | * | 20 | * |
21 | * Contact information: Unisys Corporation, Township Line & Union Meeting | 21 | * Contact information: Unisys Corporation, Township Line & Union Meeting |
22 | * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or: | 22 | * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or: |
23 | * | 23 | * |
24 | * http://www.unisys.com | 24 | * http://www.unisys.com |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
35 | #include <linux/reboot.h> | 35 | #include <linux/reboot.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/nmi.h> | 39 | #include <asm/nmi.h> |
40 | #include <asm/smp.h> | 40 | #include <asm/smp.h> |
41 | #include <asm/apicdef.h> | 41 | #include <asm/apicdef.h> |
42 | #include "es7000.h" | 42 | #include "es7000.h" |
43 | #include <mach_mpparse.h> | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * ES7000 Globals | 46 | * ES7000 Globals |
46 | */ | 47 | */ |
47 | 48 | ||
48 | volatile unsigned long *psai = NULL; | 49 | volatile unsigned long *psai = NULL; |
49 | struct mip_reg *mip_reg; | 50 | struct mip_reg *mip_reg; |
50 | struct mip_reg *host_reg; | 51 | struct mip_reg *host_reg; |
51 | int mip_port; | 52 | int mip_port; |
52 | unsigned long mip_addr, host_addr; | 53 | unsigned long mip_addr, host_addr; |
53 | 54 | ||
54 | /* | 55 | /* |
55 | * GSI override for ES7000 platforms. | 56 | * GSI override for ES7000 platforms. |
56 | */ | 57 | */ |
57 | 58 | ||
58 | static unsigned int base; | 59 | static unsigned int base; |
59 | 60 | ||
60 | static int | 61 | static int |
61 | es7000_rename_gsi(int ioapic, int gsi) | 62 | es7000_rename_gsi(int ioapic, int gsi) |
62 | { | 63 | { |
63 | if (es7000_plat == ES7000_ZORRO) | 64 | if (es7000_plat == ES7000_ZORRO) |
64 | return gsi; | 65 | return gsi; |
65 | 66 | ||
66 | if (!base) { | 67 | if (!base) { |
67 | int i; | 68 | int i; |
68 | for (i = 0; i < nr_ioapics; i++) | 69 | for (i = 0; i < nr_ioapics; i++) |
69 | base += nr_ioapic_registers[i]; | 70 | base += nr_ioapic_registers[i]; |
70 | } | 71 | } |
71 | 72 | ||
72 | if (!ioapic && (gsi < 16)) | 73 | if (!ioapic && (gsi < 16)) |
73 | gsi += base; | 74 | gsi += base; |
74 | return gsi; | 75 | return gsi; |
75 | } | 76 | } |
76 | 77 | ||
77 | void __init | 78 | void __init |
78 | setup_unisys(void) | 79 | setup_unisys(void) |
79 | { | 80 | { |
80 | /* | 81 | /* |
81 | * Determine the generation of the ES7000 currently running. | 82 | * Determine the generation of the ES7000 currently running. |
82 | * | 83 | * |
83 | * es7000_plat = 1 if the machine is a 5xx ES7000 box | 84 | * es7000_plat = 1 if the machine is a 5xx ES7000 box |
84 | * es7000_plat = 2 if the machine is a x86_64 ES7000 box | 85 | * es7000_plat = 2 if the machine is a x86_64 ES7000 box |
85 | * | 86 | * |
86 | */ | 87 | */ |
87 | if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2)) | 88 | if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2)) |
88 | es7000_plat = ES7000_ZORRO; | 89 | es7000_plat = ES7000_ZORRO; |
89 | else | 90 | else |
90 | es7000_plat = ES7000_CLASSIC; | 91 | es7000_plat = ES7000_CLASSIC; |
91 | ioapic_renumber_irq = es7000_rename_gsi; | 92 | ioapic_renumber_irq = es7000_rename_gsi; |
92 | } | 93 | } |
93 | 94 | ||
94 | /* | 95 | /* |
95 | * Parse the OEM Table | 96 | * Parse the OEM Table |
96 | */ | 97 | */ |
97 | 98 | ||
98 | int __init | 99 | int __init |
99 | parse_unisys_oem (char *oemptr) | 100 | parse_unisys_oem (char *oemptr) |
100 | { | 101 | { |
101 | int i; | 102 | int i; |
102 | int success = 0; | 103 | int success = 0; |
103 | unsigned char type, size; | 104 | unsigned char type, size; |
104 | unsigned long val; | 105 | unsigned long val; |
105 | char *tp = NULL; | 106 | char *tp = NULL; |
106 | struct psai *psaip = NULL; | 107 | struct psai *psaip = NULL; |
107 | struct mip_reg_info *mi; | 108 | struct mip_reg_info *mi; |
108 | struct mip_reg *host, *mip; | 109 | struct mip_reg *host, *mip; |
109 | 110 | ||
110 | tp = oemptr; | 111 | tp = oemptr; |
111 | 112 | ||
112 | tp += 8; | 113 | tp += 8; |
113 | 114 | ||
114 | for (i=0; i <= 6; i++) { | 115 | for (i=0; i <= 6; i++) { |
115 | type = *tp++; | 116 | type = *tp++; |
116 | size = *tp++; | 117 | size = *tp++; |
117 | tp -= 2; | 118 | tp -= 2; |
118 | switch (type) { | 119 | switch (type) { |
119 | case MIP_REG: | 120 | case MIP_REG: |
120 | mi = (struct mip_reg_info *)tp; | 121 | mi = (struct mip_reg_info *)tp; |
121 | val = MIP_RD_LO(mi->host_reg); | 122 | val = MIP_RD_LO(mi->host_reg); |
122 | host_addr = val; | 123 | host_addr = val; |
123 | host = (struct mip_reg *)val; | 124 | host = (struct mip_reg *)val; |
124 | host_reg = __va(host); | 125 | host_reg = __va(host); |
125 | val = MIP_RD_LO(mi->mip_reg); | 126 | val = MIP_RD_LO(mi->mip_reg); |
126 | mip_port = MIP_PORT(mi->mip_info); | 127 | mip_port = MIP_PORT(mi->mip_info); |
127 | mip_addr = val; | 128 | mip_addr = val; |
128 | mip = (struct mip_reg *)val; | 129 | mip = (struct mip_reg *)val; |
129 | mip_reg = __va(mip); | 130 | mip_reg = __va(mip); |
130 | Dprintk("es7000_mipcfg: host_reg = 0x%lx \n", | 131 | Dprintk("es7000_mipcfg: host_reg = 0x%lx \n", |
131 | (unsigned long)host_reg); | 132 | (unsigned long)host_reg); |
132 | Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n", | 133 | Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n", |
133 | (unsigned long)mip_reg); | 134 | (unsigned long)mip_reg); |
134 | success++; | 135 | success++; |
135 | break; | 136 | break; |
136 | case MIP_PSAI_REG: | 137 | case MIP_PSAI_REG: |
137 | psaip = (struct psai *)tp; | 138 | psaip = (struct psai *)tp; |
138 | if (tp != NULL) { | 139 | if (tp != NULL) { |
139 | if (psaip->addr) | 140 | if (psaip->addr) |
140 | psai = __va(psaip->addr); | 141 | psai = __va(psaip->addr); |
141 | else | 142 | else |
142 | psai = NULL; | 143 | psai = NULL; |
143 | success++; | 144 | success++; |
144 | } | 145 | } |
145 | break; | 146 | break; |
146 | default: | 147 | default: |
147 | break; | 148 | break; |
148 | } | 149 | } |
149 | tp += size; | 150 | tp += size; |
150 | } | 151 | } |
151 | 152 | ||
152 | if (success < 2) { | 153 | if (success < 2) { |
153 | es7000_plat = NON_UNISYS; | 154 | es7000_plat = NON_UNISYS; |
154 | } else | 155 | } else |
155 | setup_unisys(); | 156 | setup_unisys(); |
156 | return es7000_plat; | 157 | return es7000_plat; |
157 | } | 158 | } |
158 | 159 | ||
159 | #ifdef CONFIG_ACPI | 160 | #ifdef CONFIG_ACPI |
160 | int __init | 161 | int __init |
161 | find_unisys_acpi_oem_table(unsigned long *oem_addr) | 162 | find_unisys_acpi_oem_table(unsigned long *oem_addr) |
162 | { | 163 | { |
163 | struct acpi_table_header *header = NULL; | 164 | struct acpi_table_header *header = NULL; |
164 | int i = 0; | 165 | int i = 0; |
165 | while (ACPI_SUCCESS(acpi_get_table("OEM1", i++, &header))) { | 166 | while (ACPI_SUCCESS(acpi_get_table("OEM1", i++, &header))) { |
166 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { | 167 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { |
167 | struct oem_table *t = (struct oem_table *)header; | 168 | struct oem_table *t = (struct oem_table *)header; |
168 | *oem_addr = (unsigned long)__acpi_map_table(t->OEMTableAddr, | 169 | *oem_addr = (unsigned long)__acpi_map_table(t->OEMTableAddr, |
169 | t->OEMTableSize); | 170 | t->OEMTableSize); |
170 | return 0; | 171 | return 0; |
171 | } | 172 | } |
172 | } | 173 | } |
173 | return -1; | 174 | return -1; |
174 | } | 175 | } |
175 | #endif | 176 | #endif |
177 | |||
178 | /* | ||
179 | * This file also gets compiled if CONFIG_X86_GENERICARCH is set. Generic | ||
180 | * arch already has got following function definitions (asm-generic/es7000.c) | ||
181 | * hence no need to define these for that case. | ||
182 | */ | ||
183 | #ifndef CONFIG_X86_GENERICARCH | ||
184 | void es7000_sw_apic(void); | ||
185 | void __init enable_apic_mode(void) | ||
186 | { | ||
187 | es7000_sw_apic(); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | __init int mps_oem_check(struct mp_config_table *mpc, char *oem, | ||
192 | char *productid) | ||
193 | { | ||
194 | if (mpc->mpc_oemptr) { | ||
195 | struct mp_config_oemtable *oem_table = | ||
196 | (struct mp_config_oemtable *)mpc->mpc_oemptr; | ||
197 | if (!strncmp(oem, "UNISYS", 6)) | ||
198 | return parse_unisys_oem((char *)oem_table); | ||
199 | } | ||
200 | return 0; | ||
201 | } | ||
202 | #ifdef CONFIG_ACPI | ||
203 | /* Hook from generic ACPI tables.c */ | ||
204 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
205 | { | ||
206 | unsigned long oem_addr; | ||
207 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
208 | if (es7000_check_dsdt()) | ||
209 | return parse_unisys_oem((char *)oem_addr); | ||
210 | else { | ||
211 | setup_unisys(); | ||
212 | return 1; | ||
213 | } | ||
214 | } | ||
215 | return 0; | ||
216 | } | ||
217 | #else | ||
218 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
219 | { | ||
220 | return 0; | ||
221 | } | ||
222 | #endif | ||
223 | #endif /* COFIG_X86_GENERICARCH */ | ||
176 | 224 | ||
177 | static void | 225 | static void |
178 | es7000_spin(int n) | 226 | es7000_spin(int n) |
179 | { | 227 | { |
180 | int i = 0; | 228 | int i = 0; |
181 | 229 | ||
182 | while (i++ < n) | 230 | while (i++ < n) |
183 | rep_nop(); | 231 | rep_nop(); |
184 | } | 232 | } |
185 | 233 | ||
186 | static int __init | 234 | static int __init |
187 | es7000_mip_write(struct mip_reg *mip_reg) | 235 | es7000_mip_write(struct mip_reg *mip_reg) |
188 | { | 236 | { |
189 | int status = 0; | 237 | int status = 0; |
190 | int spin; | 238 | int spin; |
191 | 239 | ||
192 | spin = MIP_SPIN; | 240 | spin = MIP_SPIN; |
193 | while (((unsigned long long)host_reg->off_38 & | 241 | while (((unsigned long long)host_reg->off_38 & |
194 | (unsigned long long)MIP_VALID) != 0) { | 242 | (unsigned long long)MIP_VALID) != 0) { |
195 | if (--spin <= 0) { | 243 | if (--spin <= 0) { |
196 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); | 244 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); |
197 | return -1; | 245 | return -1; |
198 | } | 246 | } |
199 | es7000_spin(MIP_SPIN); | 247 | es7000_spin(MIP_SPIN); |
200 | } | 248 | } |
201 | 249 | ||
202 | memcpy(host_reg, mip_reg, sizeof(struct mip_reg)); | 250 | memcpy(host_reg, mip_reg, sizeof(struct mip_reg)); |
203 | outb(1, mip_port); | 251 | outb(1, mip_port); |
204 | 252 | ||
205 | spin = MIP_SPIN; | 253 | spin = MIP_SPIN; |
206 | 254 | ||
207 | while (((unsigned long long)mip_reg->off_38 & | 255 | while (((unsigned long long)mip_reg->off_38 & |
208 | (unsigned long long)MIP_VALID) == 0) { | 256 | (unsigned long long)MIP_VALID) == 0) { |
209 | if (--spin <= 0) { | 257 | if (--spin <= 0) { |
210 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); | 258 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); |
211 | return -1; | 259 | return -1; |
212 | } | 260 | } |
213 | es7000_spin(MIP_SPIN); | 261 | es7000_spin(MIP_SPIN); |
214 | } | 262 | } |
215 | 263 | ||
216 | status = ((unsigned long long)mip_reg->off_0 & | 264 | status = ((unsigned long long)mip_reg->off_0 & |
217 | (unsigned long long)0xffff0000000000ULL) >> 48; | 265 | (unsigned long long)0xffff0000000000ULL) >> 48; |
218 | mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 & | 266 | mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 & |
219 | (unsigned long long)~MIP_VALID); | 267 | (unsigned long long)~MIP_VALID); |
220 | return status; | 268 | return status; |
221 | } | 269 | } |
222 | 270 | ||
223 | int | 271 | int |
224 | es7000_start_cpu(int cpu, unsigned long eip) | 272 | es7000_start_cpu(int cpu, unsigned long eip) |
225 | { | 273 | { |
226 | unsigned long vect = 0, psaival = 0; | 274 | unsigned long vect = 0, psaival = 0; |
227 | 275 | ||
228 | if (psai == NULL) | 276 | if (psai == NULL) |
229 | return -1; | 277 | return -1; |
230 | 278 | ||
231 | vect = ((unsigned long)__pa(eip)/0x1000) << 16; | 279 | vect = ((unsigned long)__pa(eip)/0x1000) << 16; |
232 | psaival = (0x1000000 | vect | cpu); | 280 | psaival = (0x1000000 | vect | cpu); |
233 | 281 | ||
234 | while (*psai & 0x1000000) | 282 | while (*psai & 0x1000000) |
235 | ; | 283 | ; |
236 | 284 | ||
237 | *psai = psaival; | 285 | *psai = psaival; |
238 | 286 | ||
239 | return 0; | 287 | return 0; |
240 | 288 | ||
241 | } | 289 | } |
242 | 290 | ||
243 | int | 291 | int |
244 | es7000_stop_cpu(int cpu) | 292 | es7000_stop_cpu(int cpu) |
245 | { | 293 | { |
246 | int startup; | 294 | int startup; |
247 | 295 | ||
248 | if (psai == NULL) | 296 | if (psai == NULL) |
249 | return -1; | 297 | return -1; |
250 | 298 | ||
251 | startup= (0x1000000 | cpu); | 299 | startup= (0x1000000 | cpu); |
252 | 300 | ||
253 | while ((*psai & 0xff00ffff) != startup) | 301 | while ((*psai & 0xff00ffff) != startup) |
254 | ; | 302 | ; |
255 | 303 | ||
256 | startup = (*psai & 0xff0000) >> 16; | 304 | startup = (*psai & 0xff0000) >> 16; |
257 | *psai &= 0xffffff; | 305 | *psai &= 0xffffff; |
258 | 306 | ||
259 | return 0; | 307 | return 0; |
260 | 308 | ||
261 | } | 309 | } |
262 | 310 | ||
263 | void __init | 311 | void __init |
264 | es7000_sw_apic() | 312 | es7000_sw_apic() |
265 | { | 313 | { |
266 | if (es7000_plat) { | 314 | if (es7000_plat) { |
267 | int mip_status; | 315 | int mip_status; |
268 | struct mip_reg es7000_mip_reg; | 316 | struct mip_reg es7000_mip_reg; |
269 | 317 | ||
270 | printk("ES7000: Enabling APIC mode.\n"); | 318 | printk("ES7000: Enabling APIC mode.\n"); |
271 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | 319 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); |
272 | es7000_mip_reg.off_0 = MIP_SW_APIC; | 320 | es7000_mip_reg.off_0 = MIP_SW_APIC; |
273 | es7000_mip_reg.off_38 = (MIP_VALID); | 321 | es7000_mip_reg.off_38 = (MIP_VALID); |
274 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) | 322 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) |
275 | printk("es7000_sw_apic: command failed, status = %x\n", | 323 | printk("es7000_sw_apic: command failed, status = %x\n", |
276 | mip_status); | 324 | mip_status); |
277 | return; | 325 | return; |
278 | } | 326 | } |
279 | } | 327 | } |
280 | 328 |
include/asm-i386/mach-es7000/mach_apic.h
1 | #ifndef __ASM_MACH_APIC_H | 1 | #ifndef __ASM_MACH_APIC_H |
2 | #define __ASM_MACH_APIC_H | 2 | #define __ASM_MACH_APIC_H |
3 | 3 | ||
4 | extern u8 bios_cpu_apicid[]; | 4 | extern u8 bios_cpu_apicid[]; |
5 | 5 | ||
6 | #define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu]) | 6 | #define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu]) |
7 | #define esr_disable (1) | 7 | #define esr_disable (1) |
8 | 8 | ||
9 | static inline int apic_id_registered(void) | 9 | static inline int apic_id_registered(void) |
10 | { | 10 | { |
11 | return (1); | 11 | return (1); |
12 | } | 12 | } |
13 | 13 | ||
14 | static inline cpumask_t target_cpus(void) | 14 | static inline cpumask_t target_cpus(void) |
15 | { | 15 | { |
16 | #if defined CONFIG_ES7000_CLUSTERED_APIC | 16 | #if defined CONFIG_ES7000_CLUSTERED_APIC |
17 | return CPU_MASK_ALL; | 17 | return CPU_MASK_ALL; |
18 | #else | 18 | #else |
19 | return cpumask_of_cpu(smp_processor_id()); | 19 | return cpumask_of_cpu(smp_processor_id()); |
20 | #endif | 20 | #endif |
21 | } | 21 | } |
22 | #define TARGET_CPUS (target_cpus()) | 22 | #define TARGET_CPUS (target_cpus()) |
23 | 23 | ||
24 | #if defined CONFIG_ES7000_CLUSTERED_APIC | 24 | #if defined CONFIG_ES7000_CLUSTERED_APIC |
25 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) | 25 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) |
26 | #define INT_DELIVERY_MODE (dest_LowestPrio) | 26 | #define INT_DELIVERY_MODE (dest_LowestPrio) |
27 | #define INT_DEST_MODE (1) /* logical delivery broadcast to all procs */ | 27 | #define INT_DEST_MODE (1) /* logical delivery broadcast to all procs */ |
28 | #define NO_BALANCE_IRQ (1) | 28 | #define NO_BALANCE_IRQ (1) |
29 | #undef WAKE_SECONDARY_VIA_INIT | 29 | #undef WAKE_SECONDARY_VIA_INIT |
30 | #define WAKE_SECONDARY_VIA_MIP | 30 | #define WAKE_SECONDARY_VIA_MIP |
31 | #else | 31 | #else |
32 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | 32 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) |
33 | #define INT_DELIVERY_MODE (dest_Fixed) | 33 | #define INT_DELIVERY_MODE (dest_Fixed) |
34 | #define INT_DEST_MODE (0) /* phys delivery to target procs */ | 34 | #define INT_DEST_MODE (0) /* phys delivery to target procs */ |
35 | #define NO_BALANCE_IRQ (0) | 35 | #define NO_BALANCE_IRQ (0) |
36 | #undef APIC_DEST_LOGICAL | 36 | #undef APIC_DEST_LOGICAL |
37 | #define APIC_DEST_LOGICAL 0x0 | 37 | #define APIC_DEST_LOGICAL 0x0 |
38 | #define WAKE_SECONDARY_VIA_INIT | 38 | #define WAKE_SECONDARY_VIA_INIT |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | 41 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) |
42 | { | 42 | { |
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | static inline unsigned long check_apicid_present(int bit) | 45 | static inline unsigned long check_apicid_present(int bit) |
46 | { | 46 | { |
47 | return physid_isset(bit, phys_cpu_present_map); | 47 | return physid_isset(bit, phys_cpu_present_map); |
48 | } | 48 | } |
49 | 49 | ||
50 | #define apicid_cluster(apicid) (apicid & 0xF0) | 50 | #define apicid_cluster(apicid) (apicid & 0xF0) |
51 | 51 | ||
52 | static inline unsigned long calculate_ldr(int cpu) | 52 | static inline unsigned long calculate_ldr(int cpu) |
53 | { | 53 | { |
54 | unsigned long id; | 54 | unsigned long id; |
55 | id = xapic_phys_to_log_apicid(cpu); | 55 | id = xapic_phys_to_log_apicid(cpu); |
56 | return (SET_APIC_LOGICAL_ID(id)); | 56 | return (SET_APIC_LOGICAL_ID(id)); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Set up the logical destination ID. | 60 | * Set up the logical destination ID. |
61 | * | 61 | * |
62 | * Intel recommends to set DFR, LdR and TPR before enabling | 62 | * Intel recommends to set DFR, LdR and TPR before enabling |
63 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | 63 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel |
64 | * document number 292116). So here it goes... | 64 | * document number 292116). So here it goes... |
65 | */ | 65 | */ |
66 | static inline void init_apic_ldr(void) | 66 | static inline void init_apic_ldr(void) |
67 | { | 67 | { |
68 | unsigned long val; | 68 | unsigned long val; |
69 | int cpu = smp_processor_id(); | 69 | int cpu = smp_processor_id(); |
70 | 70 | ||
71 | apic_write_around(APIC_DFR, APIC_DFR_VALUE); | 71 | apic_write_around(APIC_DFR, APIC_DFR_VALUE); |
72 | val = calculate_ldr(cpu); | 72 | val = calculate_ldr(cpu); |
73 | apic_write_around(APIC_LDR, val); | 73 | apic_write_around(APIC_LDR, val); |
74 | } | 74 | } |
75 | 75 | ||
76 | #ifndef CONFIG_X86_GENERICARCH | ||
77 | extern void enable_apic_mode(void); | ||
78 | #endif | ||
79 | |||
76 | extern int apic_version [MAX_APICS]; | 80 | extern int apic_version [MAX_APICS]; |
77 | static inline void setup_apic_routing(void) | 81 | static inline void setup_apic_routing(void) |
78 | { | 82 | { |
79 | int apic = bios_cpu_apicid[smp_processor_id()]; | 83 | int apic = bios_cpu_apicid[smp_processor_id()]; |
80 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | 84 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", |
81 | (apic_version[apic] == 0x14) ? | 85 | (apic_version[apic] == 0x14) ? |
82 | "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]); | 86 | "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]); |
83 | } | 87 | } |
84 | 88 | ||
85 | static inline int multi_timer_check(int apic, int irq) | 89 | static inline int multi_timer_check(int apic, int irq) |
86 | { | 90 | { |
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
89 | 93 | ||
90 | static inline int apicid_to_node(int logical_apicid) | 94 | static inline int apicid_to_node(int logical_apicid) |
91 | { | 95 | { |
92 | return 0; | 96 | return 0; |
93 | } | 97 | } |
94 | 98 | ||
95 | 99 | ||
96 | static inline int cpu_present_to_apicid(int mps_cpu) | 100 | static inline int cpu_present_to_apicid(int mps_cpu) |
97 | { | 101 | { |
98 | if (!mps_cpu) | 102 | if (!mps_cpu) |
99 | return boot_cpu_physical_apicid; | 103 | return boot_cpu_physical_apicid; |
100 | else if (mps_cpu < NR_CPUS) | 104 | else if (mps_cpu < NR_CPUS) |
101 | return (int) bios_cpu_apicid[mps_cpu]; | 105 | return (int) bios_cpu_apicid[mps_cpu]; |
102 | else | 106 | else |
103 | return BAD_APICID; | 107 | return BAD_APICID; |
104 | } | 108 | } |
105 | 109 | ||
106 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | 110 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) |
107 | { | 111 | { |
108 | static int id = 0; | 112 | static int id = 0; |
109 | physid_mask_t mask; | 113 | physid_mask_t mask; |
110 | mask = physid_mask_of_physid(id); | 114 | mask = physid_mask_of_physid(id); |
111 | ++id; | 115 | ++id; |
112 | return mask; | 116 | return mask; |
113 | } | 117 | } |
114 | 118 | ||
115 | extern u8 cpu_2_logical_apicid[]; | 119 | extern u8 cpu_2_logical_apicid[]; |
116 | /* Mapping from cpu number to logical apicid */ | 120 | /* Mapping from cpu number to logical apicid */ |
117 | static inline int cpu_to_logical_apicid(int cpu) | 121 | static inline int cpu_to_logical_apicid(int cpu) |
118 | { | 122 | { |
119 | #ifdef CONFIG_SMP | 123 | #ifdef CONFIG_SMP |
120 | if (cpu >= NR_CPUS) | 124 | if (cpu >= NR_CPUS) |
121 | return BAD_APICID; | 125 | return BAD_APICID; |
122 | return (int)cpu_2_logical_apicid[cpu]; | 126 | return (int)cpu_2_logical_apicid[cpu]; |
123 | #else | 127 | #else |
124 | return logical_smp_processor_id(); | 128 | return logical_smp_processor_id(); |
125 | #endif | 129 | #endif |
126 | } | 130 | } |
127 | 131 | ||
128 | static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused) | 132 | static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused) |
129 | { | 133 | { |
130 | printk("Processor #%d %ld:%ld APIC version %d\n", | 134 | printk("Processor #%d %ld:%ld APIC version %d\n", |
131 | m->mpc_apicid, | 135 | m->mpc_apicid, |
132 | (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, | 136 | (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, |
133 | (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, | 137 | (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, |
134 | m->mpc_apicver); | 138 | m->mpc_apicver); |
135 | return (m->mpc_apicid); | 139 | return (m->mpc_apicid); |
136 | } | 140 | } |
137 | 141 | ||
138 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | 142 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) |
139 | { | 143 | { |
140 | /* For clustered we don't have a good way to do this yet - hack */ | 144 | /* For clustered we don't have a good way to do this yet - hack */ |
141 | return physids_promote(0xff); | 145 | return physids_promote(0xff); |
142 | } | 146 | } |
143 | 147 | ||
144 | 148 | ||
145 | static inline void setup_portio_remap(void) | 149 | static inline void setup_portio_remap(void) |
146 | { | 150 | { |
147 | } | 151 | } |
148 | 152 | ||
149 | extern unsigned int boot_cpu_physical_apicid; | 153 | extern unsigned int boot_cpu_physical_apicid; |
150 | static inline int check_phys_apicid_present(int cpu_physical_apicid) | 154 | static inline int check_phys_apicid_present(int cpu_physical_apicid) |
151 | { | 155 | { |
152 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); | 156 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); |
153 | return (1); | 157 | return (1); |
154 | } | 158 | } |
155 | 159 | ||
156 | static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) | 160 | static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) |
157 | { | 161 | { |
158 | int num_bits_set; | 162 | int num_bits_set; |
159 | int cpus_found = 0; | 163 | int cpus_found = 0; |
160 | int cpu; | 164 | int cpu; |
161 | int apicid; | 165 | int apicid; |
162 | 166 | ||
163 | num_bits_set = cpus_weight(cpumask); | 167 | num_bits_set = cpus_weight(cpumask); |
164 | /* Return id to all */ | 168 | /* Return id to all */ |
165 | if (num_bits_set == NR_CPUS) | 169 | if (num_bits_set == NR_CPUS) |
166 | #if defined CONFIG_ES7000_CLUSTERED_APIC | 170 | #if defined CONFIG_ES7000_CLUSTERED_APIC |
167 | return 0xFF; | 171 | return 0xFF; |
168 | #else | 172 | #else |
169 | return cpu_to_logical_apicid(0); | 173 | return cpu_to_logical_apicid(0); |
170 | #endif | 174 | #endif |
171 | /* | 175 | /* |
172 | * The cpus in the mask must all be on the apic cluster. If are not | 176 | * The cpus in the mask must all be on the apic cluster. If are not |
173 | * on the same apicid cluster return default value of TARGET_CPUS. | 177 | * on the same apicid cluster return default value of TARGET_CPUS. |
174 | */ | 178 | */ |
175 | cpu = first_cpu(cpumask); | 179 | cpu = first_cpu(cpumask); |
176 | apicid = cpu_to_logical_apicid(cpu); | 180 | apicid = cpu_to_logical_apicid(cpu); |
177 | while (cpus_found < num_bits_set) { | 181 | while (cpus_found < num_bits_set) { |
178 | if (cpu_isset(cpu, cpumask)) { | 182 | if (cpu_isset(cpu, cpumask)) { |
179 | int new_apicid = cpu_to_logical_apicid(cpu); | 183 | int new_apicid = cpu_to_logical_apicid(cpu); |
180 | if (apicid_cluster(apicid) != | 184 | if (apicid_cluster(apicid) != |
181 | apicid_cluster(new_apicid)){ | 185 | apicid_cluster(new_apicid)){ |
182 | printk ("%s: Not a valid mask!\n",__FUNCTION__); | 186 | printk ("%s: Not a valid mask!\n",__FUNCTION__); |
183 | #if defined CONFIG_ES7000_CLUSTERED_APIC | 187 | #if defined CONFIG_ES7000_CLUSTERED_APIC |
184 | return 0xFF; | 188 | return 0xFF; |
185 | #else | 189 | #else |
186 | return cpu_to_logical_apicid(0); | 190 | return cpu_to_logical_apicid(0); |
187 | #endif | 191 | #endif |
188 | } | 192 | } |
189 | apicid = new_apicid; | 193 | apicid = new_apicid; |
190 | cpus_found++; | 194 | cpus_found++; |
191 | } | 195 | } |
192 | cpu++; | 196 | cpu++; |
193 | } | 197 | } |
194 | return apicid; | 198 | return apicid; |
195 | } | 199 | } |
196 | 200 | ||
197 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 201 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) |
198 | { | 202 | { |
199 | return cpuid_apic >> index_msb; | 203 | return cpuid_apic >> index_msb; |
200 | } | 204 | } |
201 | 205 | ||
202 | #endif /* __ASM_MACH_APIC_H */ | 206 | #endif /* __ASM_MACH_APIC_H */ |
203 | 207 |
include/asm-i386/mach-es7000/mach_mpparse.h
1 | #ifndef __ASM_MACH_MPPARSE_H | 1 | #ifndef __ASM_MACH_MPPARSE_H |
2 | #define __ASM_MACH_MPPARSE_H | 2 | #define __ASM_MACH_MPPARSE_H |
3 | 3 | ||
4 | #include <linux/acpi.h> | 4 | #include <linux/acpi.h> |
5 | 5 | ||
6 | static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, | 6 | static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, |
7 | struct mpc_config_translation *translation) | 7 | struct mpc_config_translation *translation) |
8 | { | 8 | { |
9 | Dprintk("Bus #%d is %s\n", m->mpc_busid, name); | 9 | Dprintk("Bus #%d is %s\n", m->mpc_busid, name); |
10 | } | 10 | } |
11 | 11 | ||
12 | static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, | 12 | static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, |
13 | struct mpc_config_translation *translation) | 13 | struct mpc_config_translation *translation) |
14 | { | 14 | { |
15 | } | 15 | } |
16 | 16 | ||
17 | extern int parse_unisys_oem (char *oemptr); | 17 | extern int parse_unisys_oem (char *oemptr); |
18 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | 18 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); |
19 | extern void setup_unisys(void); | 19 | extern void setup_unisys(void); |
20 | 20 | ||
21 | #ifndef CONFIG_X86_GENERICARCH | ||
22 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); | ||
23 | extern int mps_oem_check(struct mp_config_table *mpc, char *oem, | ||
24 | char *productid); | ||
25 | #endif | ||
26 | |||
21 | #ifdef CONFIG_ACPI | 27 | #ifdef CONFIG_ACPI |
22 | 28 | ||
23 | static inline int es7000_check_dsdt(void) | 29 | static inline int es7000_check_dsdt(void) |
24 | { | 30 | { |
25 | struct acpi_table_header header; | 31 | struct acpi_table_header header; |
26 | memcpy(&header, 0, sizeof(struct acpi_table_header)); | 32 | memcpy(&header, 0, sizeof(struct acpi_table_header)); |
27 | acpi_get_table_header(ACPI_SIG_DSDT, 0, &header); | 33 | acpi_get_table_header(ACPI_SIG_DSDT, 0, &header); |
28 | if (!strncmp(header.oem_id, "UNISYS", 6)) | 34 | if (!strncmp(header.oem_id, "UNISYS", 6)) |
29 | return 1; | 35 | return 1; |
30 | return 0; | 36 | return 0; |
31 | } | 37 | } |
32 | #endif | 38 | #endif |
33 | 39 | ||
34 | #endif /* __ASM_MACH_MPPARSE_H */ | 40 | #endif /* __ASM_MACH_MPPARSE_H */ |
35 | 41 |