]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/x86/kernel/apic/es7000_32.c
x86/apic: Fix ugly casting and branching in cpu_mask_to_apicid_and()
[mirror_ubuntu-zesty-kernel.git] / arch / x86 / kernel / apic / es7000_32.c
CommitLineData
1da177e4
LT
1/*
2 * Written by: Garry Forsgren, Unisys Corporation
3 * Natalie Protasevich, Unisys Corporation
7da18ed9 4 *
1da177e4
LT
5 * This file contains the code to configure and interface
6 * with Unisys ES7000 series hardware system manager.
7 *
7da18ed9
IM
8 * Copyright (c) 2003 Unisys Corporation.
9 * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar
10 *
11 * All Rights Reserved.
1da177e4
LT
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of version 2 of the GNU General Public License as
15 * published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it would be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write the Free Software Foundation, Inc., 59
23 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 *
25 * Contact information: Unisys Corporation, Township Line & Union Meeting
26 * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
27 *
28 * http://www.unisys.com
29 */
5cd476ef
JP
30
31#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
32
2c4ce18c
IM
33#include <linux/notifier.h>
34#include <linux/spinlock.h>
35#include <linux/cpumask.h>
36#include <linux/threads.h>
1da177e4 37#include <linux/kernel.h>
2c4ce18c
IM
38#include <linux/module.h>
39#include <linux/reboot.h>
1da177e4 40#include <linux/string.h>
2c4ce18c 41#include <linux/types.h>
1da177e4 42#include <linux/errno.h>
1da177e4 43#include <linux/acpi.h>
2c4ce18c 44#include <linux/init.h>
5a0e3ad6 45#include <linux/gfp.h>
7da18ed9 46#include <linux/nmi.h>
2c4ce18c 47#include <linux/smp.h>
7da18ed9 48#include <linux/io.h>
2c4ce18c 49
1da177e4 50#include <asm/apicdef.h>
60063497 51#include <linux/atomic.h>
2c4ce18c
IM
52#include <asm/fixmap.h>
53#include <asm/mpspec.h>
569712b2 54#include <asm/setup.h>
2c4ce18c
IM
55#include <asm/apic.h>
56#include <asm/ipi.h>
1da177e4 57
1625324d
YL
58/*
59 * ES7000 chipsets
60 */
61
2c4ce18c
IM
62#define NON_UNISYS 0
63#define ES7000_CLASSIC 1
64#define ES7000_ZORRO 2
1625324d 65
2c4ce18c
IM
66#define MIP_REG 1
67#define MIP_PSAI_REG 4
1625324d 68
2c4ce18c
IM
69#define MIP_BUSY 1
70#define MIP_SPIN 0xf0000
71#define MIP_VALID 0x0100000000000000ULL
352887d1 72#define MIP_SW_APIC 0x1020b
1625324d 73
2c4ce18c 74#define MIP_PORT(val) ((val >> 32) & 0xffff)
1625324d 75
2c4ce18c 76#define MIP_RD_LO(val) (val & 0xffffffff)
1625324d 77
352887d1
IM
78struct mip_reg {
79 unsigned long long off_0x00;
80 unsigned long long off_0x08;
81 unsigned long long off_0x10;
82 unsigned long long off_0x18;
83 unsigned long long off_0x20;
84 unsigned long long off_0x28;
85 unsigned long long off_0x30;
86 unsigned long long off_0x38;
87};
88
1625324d 89struct mip_reg_info {
2c4ce18c
IM
90 unsigned long long mip_info;
91 unsigned long long delivery_info;
92 unsigned long long host_reg;
93 unsigned long long mip_reg;
1625324d
YL
94};
95
1625324d 96struct psai {
2c4ce18c
IM
97 unsigned long long entry_type;
98 unsigned long long addr;
99 unsigned long long bep_addr;
1625324d
YL
100};
101
1625324d 102#ifdef CONFIG_ACPI
7da18ed9 103
352887d1 104struct es7000_oem_table {
2c4ce18c
IM
105 struct acpi_table_header Header;
106 u32 OEMTableAddr;
107 u32 OEMTableSize;
1625324d 108};
7da18ed9
IM
109
110static unsigned long oem_addrX;
111static unsigned long oem_size;
112
1625324d
YL
113#endif
114
1da177e4
LT
115/*
116 * ES7000 Globals
117 */
118
7da18ed9 119static volatile unsigned long *psai;
2c4ce18c
IM
120static struct mip_reg *mip_reg;
121static struct mip_reg *host_reg;
122static int mip_port;
7da18ed9
IM
123static unsigned long mip_addr;
124static unsigned long host_addr;
1da177e4 125
2c4ce18c 126int es7000_plat;
32c50612 127
1da177e4
LT
128/*
129 * GSI override for ES7000 platforms.
130 */
131
1da177e4 132
667c5296 133static int __cpuinit wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
569712b2
YL
134{
135 unsigned long vect = 0, psaival = 0;
136
137 if (psai == NULL)
138 return -1;
139
140 vect = ((unsigned long)__pa(eip)/0x1000) << 16;
141 psaival = (0x1000000 | vect | cpu);
142
143 while (*psai & 0x1000000)
144 ;
145
146 *psai = psaival;
147
148 return 0;
149}
54ac14a8 150
871d78c6 151static int es7000_apic_is_cluster(void)
54ac14a8 152{
b5fe363b
YL
153 /* MPENTIUMIII */
154 if (boot_cpu_data.x86 == 6 &&
005155b1 155 (boot_cpu_data.x86_model >= 7 && boot_cpu_data.x86_model <= 11))
2b6163bf 156 return 1;
b5fe363b 157
54ac14a8
YL
158 return 0;
159}
569712b2 160
871d78c6 161static void setup_unisys(void)
56f1d5d5
NP
162{
163 /*
164 * Determine the generation of the ES7000 currently running.
165 *
166 * es7000_plat = 1 if the machine is a 5xx ES7000 box
167 * es7000_plat = 2 if the machine is a x86_64 ES7000 box
168 *
169 */
170 if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
9338316c 171 es7000_plat = ES7000_ZORRO;
56f1d5d5 172 else
9338316c 173 es7000_plat = ES7000_CLASSIC;
56f1d5d5
NP
174}
175
1da177e4 176/*
d3185b37 177 * Parse the OEM Table:
1da177e4 178 */
871d78c6 179static int parse_unisys_oem(char *oemptr)
1da177e4 180{
352887d1 181 int i;
1da177e4 182 int success = 0;
352887d1
IM
183 unsigned char type, size;
184 unsigned long val;
185 char *tp = NULL;
186 struct psai *psaip = NULL;
1da177e4
LT
187 struct mip_reg_info *mi;
188 struct mip_reg *host, *mip;
189
190 tp = oemptr;
191
192 tp += 8;
193
352887d1 194 for (i = 0; i <= 6; i++) {
1da177e4
LT
195 type = *tp++;
196 size = *tp++;
197 tp -= 2;
198 switch (type) {
199 case MIP_REG:
200 mi = (struct mip_reg_info *)tp;
201 val = MIP_RD_LO(mi->host_reg);
202 host_addr = val;
203 host = (struct mip_reg *)val;
204 host_reg = __va(host);
205 val = MIP_RD_LO(mi->mip_reg);
206 mip_port = MIP_PORT(mi->mip_info);
207 mip_addr = val;
208 mip = (struct mip_reg *)val;
209 mip_reg = __va(mip);
5cd476ef 210 pr_debug("host_reg = 0x%lx\n",
5171c304 211 (unsigned long)host_reg);
5cd476ef 212 pr_debug("mip_reg = 0x%lx\n",
5171c304 213 (unsigned long)mip_reg);
1da177e4
LT
214 success++;
215 break;
216 case MIP_PSAI_REG:
217 psaip = (struct psai *)tp;
218 if (tp != NULL) {
219 if (psaip->addr)
220 psai = __va(psaip->addr);
221 else
222 psai = NULL;
223 success++;
224 }
225 break;
226 default:
227 break;
228 }
1da177e4
LT
229 tp += size;
230 }
231
d3185b37 232 if (success < 2)
9338316c 233 es7000_plat = NON_UNISYS;
d3185b37 234 else
56f1d5d5 235 setup_unisys();
2c4ce18c 236
1da177e4
LT
237 return es7000_plat;
238}
239
e5428ede 240#ifdef CONFIG_ACPI
b74d446f 241static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
1da177e4 242{
ceb6c468 243 struct acpi_table_header *header = NULL;
7da18ed9 244 struct es7000_oem_table *table;
b825e6cc 245 acpi_size tbl_size;
7da18ed9
IM
246 acpi_status ret;
247 int i = 0;
a73aaedd 248
7da18ed9
IM
249 for (;;) {
250 ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size);
251 if (!ACPI_SUCCESS(ret))
252 return -1;
a73aaedd 253
7da18ed9
IM
254 if (!memcmp((char *) &header->oem_id, "UNISYS", 6))
255 break;
a73aaedd 256
b825e6cc 257 early_acpi_os_unmap_memory(header, tbl_size);
1da177e4 258 }
7da18ed9
IM
259
260 table = (void *)header;
261
262 oem_addrX = table->OEMTableAddr;
263 oem_size = table->OEMTableSize;
264
265 early_acpi_os_unmap_memory(header, tbl_size);
266
267 *oem_addr = (unsigned long)__acpi_map_table(oem_addrX, oem_size);
268
269 return 0;
1da177e4 270}
a73aaedd 271
b74d446f 272static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
a73aaedd 273{
b825e6cc
YL
274 if (!oem_addr)
275 return;
276
277 __acpi_unmap_table((char *)oem_addr, oem_size);
a73aaedd 278}
7da18ed9
IM
279
280static int es7000_check_dsdt(void)
281{
282 struct acpi_table_header header;
283
284 if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
285 !strncmp(header.oem_id, "UNISYS", 6))
286 return 1;
287 return 0;
288}
289
871d78c6 290static int es7000_acpi_ret;
2b6163bf 291
7da18ed9 292/* Hook from generic ACPI tables.c */
b74d446f 293static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
7da18ed9
IM
294{
295 unsigned long oem_addr = 0;
296 int check_dsdt;
297 int ret = 0;
298
299 /* check dsdt at first to avoid clear fix_map for oem_addr */
300 check_dsdt = es7000_check_dsdt();
301
302 if (!find_unisys_acpi_oem_table(&oem_addr)) {
303 if (check_dsdt) {
304 ret = parse_unisys_oem((char *)oem_addr);
305 } else {
306 setup_unisys();
307 ret = 1;
308 }
309 /*
310 * we need to unmap it
311 */
312 unmap_unisys_acpi_oem_table(oem_addr);
313 }
2b6163bf
YL
314
315 es7000_acpi_ret = ret;
316
317 return ret && !es7000_apic_is_cluster();
7da18ed9 318}
3b900d44 319
871d78c6 320static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
2b6163bf
YL
321{
322 int ret = es7000_acpi_ret;
323
324 return ret && es7000_apic_is_cluster();
325}
326
7da18ed9 327#else /* !CONFIG_ACPI: */
871d78c6 328static int es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
7da18ed9
IM
329{
330 return 0;
331}
3b900d44 332
871d78c6 333static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
3b900d44
IM
334{
335 return 0;
336}
7da18ed9 337#endif /* !CONFIG_ACPI */
1da177e4 338
2c4ce18c 339static void es7000_spin(int n)
1da177e4
LT
340{
341 int i = 0;
342
343 while (i++ < n)
344 rep_nop();
345}
346
871d78c6 347static int es7000_mip_write(struct mip_reg *mip_reg)
1da177e4 348{
2c4ce18c
IM
349 int status = 0;
350 int spin;
1da177e4
LT
351
352 spin = MIP_SPIN;
2c4ce18c
IM
353 while ((host_reg->off_0x38 & MIP_VALID) != 0) {
354 if (--spin <= 0) {
7da18ed9 355 WARN(1, "Timeout waiting for Host Valid Flag\n");
2c4ce18c
IM
356 return -1;
357 }
1da177e4
LT
358 es7000_spin(MIP_SPIN);
359 }
360
361 memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
362 outb(1, mip_port);
363
364 spin = MIP_SPIN;
365
2c4ce18c 366 while ((mip_reg->off_0x38 & MIP_VALID) == 0) {
1da177e4 367 if (--spin <= 0) {
7da18ed9 368 WARN(1, "Timeout waiting for MIP Valid Flag\n");
1da177e4
LT
369 return -1;
370 }
371 es7000_spin(MIP_SPIN);
372 }
373
2c4ce18c
IM
374 status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48;
375 mip_reg->off_0x38 &= ~MIP_VALID;
376
1da177e4
LT
377 return status;
378}
379
871d78c6 380static void es7000_enable_apic_mode(void)
1da177e4 381{
b0b20e5a
IM
382 struct mip_reg es7000_mip_reg;
383 int mip_status;
384
385 if (!es7000_plat)
1da177e4 386 return;
b0b20e5a 387
5cd476ef 388 pr_info("Enabling APIC mode.\n");
352887d1
IM
389 memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
390 es7000_mip_reg.off_0x00 = MIP_SW_APIC;
391 es7000_mip_reg.off_0x38 = MIP_VALID;
b0b20e5a 392
7da18ed9
IM
393 while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
394 WARN(1, "Command failed, status = %x\n", mip_status);
1da177e4 395}
2e096df8 396
2e096df8
IM
397static void es7000_wait_for_init_deassert(atomic_t *deassert)
398{
2e096df8
IM
399 while (!atomic_read(deassert))
400 cpu_relax();
2e096df8
IM
401}
402
403static unsigned int es7000_get_apic_id(unsigned long x)
404{
405 return (x >> 24) & 0xFF;
406}
407
2e096df8
IM
408static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
409{
43f39890 410 default_send_IPI_mask_sequence_phys(mask, vector);
2e096df8
IM
411}
412
413static void es7000_send_IPI_allbutself(int vector)
414{
43f39890 415 default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
2e096df8
IM
416}
417
418static void es7000_send_IPI_all(int vector)
419{
420 es7000_send_IPI_mask(cpu_online_mask, vector);
421}
422
423static int es7000_apic_id_registered(void)
424{
352887d1 425 return 1;
2e096df8
IM
426}
427
73e907de 428static const struct cpumask *target_cpus_cluster(void)
2e096df8 429{
101aaca1 430 return cpu_all_mask;
2e096df8
IM
431}
432
4f062896 433static const struct cpumask *es7000_target_cpus(void)
2e096df8 434{
4f062896 435 return cpumask_of(smp_processor_id());
2e096df8
IM
436}
437
7abc0753 438static unsigned long es7000_check_apicid_used(physid_mask_t *map, int apicid)
2e096df8
IM
439{
440 return 0;
441}
7abc0753 442
2e096df8
IM
443static unsigned long es7000_check_apicid_present(int bit)
444{
445 return physid_isset(bit, phys_cpu_present_map);
446}
447
df04cf01
TH
448static int es7000_early_logical_apicid(int cpu)
449{
450 /* on es7000, logical apicid is the same as physical */
451 return early_per_cpu(x86_bios_cpu_apicid, cpu);
452}
453
2e096df8
IM
454static unsigned long calculate_ldr(int cpu)
455{
2c4ce18c 456 unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu);
2e096df8 457
2c4ce18c 458 return SET_APIC_LOGICAL_ID(id);
2e096df8
IM
459}
460
461/*
462 * Set up the logical destination ID.
463 *
464 * Intel recommends to set DFR, LdR and TPR before enabling
465 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
466 * document number 292116). So here it goes...
467 */
468static void es7000_init_apic_ldr_cluster(void)
469{
470 unsigned long val;
471 int cpu = smp_processor_id();
472
352887d1 473 apic_write(APIC_DFR, APIC_DFR_CLUSTER);
2e096df8
IM
474 val = calculate_ldr(cpu);
475 apic_write(APIC_LDR, val);
476}
477
478static void es7000_init_apic_ldr(void)
479{
480 unsigned long val;
481 int cpu = smp_processor_id();
482
352887d1 483 apic_write(APIC_DFR, APIC_DFR_FLAT);
2e096df8
IM
484 val = calculate_ldr(cpu);
485 apic_write(APIC_LDR, val);
486}
487
488static void es7000_setup_apic_routing(void)
489{
490 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
7da18ed9 491
5cd476ef 492 pr_info("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
2e096df8
IM
493 (apic_version[apic] == 0x14) ?
494 "Physical Cluster" : "Logical Cluster",
4f062896 495 nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
2e096df8
IM
496}
497
2e096df8
IM
498static int es7000_cpu_present_to_apicid(int mps_cpu)
499{
500 if (!mps_cpu)
501 return boot_cpu_physical_apicid;
502 else if (mps_cpu < nr_cpu_ids)
2c4ce18c 503 return per_cpu(x86_bios_cpu_apicid, mps_cpu);
2e096df8
IM
504 else
505 return BAD_APICID;
506}
507
7da18ed9
IM
508static int cpu_id;
509
7abc0753 510static void es7000_apicid_to_cpu_present(int phys_apicid, physid_mask_t *retmap)
2e096df8 511{
7abc0753 512 physid_set_mask_of_physid(cpu_id, retmap);
7da18ed9 513 ++cpu_id;
2e096df8
IM
514}
515
7abc0753 516static void es7000_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap)
2e096df8
IM
517{
518 /* For clustered we don't have a good way to do this yet - hack */
7abc0753 519 physids_promote(0xFFL, retmap);
2e096df8
IM
520}
521
522static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
523{
524 boot_cpu_physical_apicid = read_apic_id();
2c4ce18c 525 return 1;
2e096df8
IM
526}
527
a5a39156 528static inline int
ff164324 529es7000_cpu_mask_to_apicid(const struct cpumask *cpumask, unsigned int *dest_id)
2e096df8 530{
0edc0b32 531 unsigned int round = 0;
ea3807ea 532 unsigned int cpu, uninitialized_var(apicid);
2e096df8 533
2e096df8 534 /*
0edc0b32 535 * The cpus in the mask must all be on the apic cluster.
2e096df8 536 */
4988a40c 537 for_each_cpu_and(cpu, cpumask, cpu_online_mask) {
7632611f 538 int new_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
2e096df8 539
0edc0b32
JS
540 if (round && APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
541 WARN(1, "Not a valid mask!");
2e096df8 542
ff164324 543 return -EINVAL;
2e096df8 544 }
0edc0b32
JS
545 apicid = new_apicid;
546 round++;
2e096df8 547 }
ff164324
AG
548 *dest_id = apicid;
549 return 0;
2e096df8
IM
550}
551
ff164324 552static int
2e096df8 553es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
ff164324
AG
554 const struct cpumask *andmask,
555 unsigned int *apicid)
2e096df8 556{
ff164324 557 *apicid = early_per_cpu(x86_cpu_to_logical_apicid, 0);
2e096df8
IM
558 cpumask_var_t cpumask;
559
560 if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
ff164324 561 return 0;
2e096df8
IM
562
563 cpumask_and(cpumask, inmask, andmask);
ff164324 564 es7000_cpu_mask_to_apicid(cpumask, apicid);
2e096df8
IM
565
566 free_cpumask_var(cpumask);
567
ff164324 568 return 0;
2e096df8
IM
569}
570
571static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
572{
573 return cpuid_apic >> index_msb;
574}
575
2e096df8
IM
576static int probe_es7000(void)
577{
578 /* probed later in mptable/ACPI hooks */
579 return 0;
580}
581
871d78c6
JS
582static int es7000_mps_ret;
583static int es7000_mps_oem_check(struct mpc_table *mpc, char *oem,
584 char *productid)
2e096df8 585{
2b6163bf
YL
586 int ret = 0;
587
2e096df8
IM
588 if (mpc->oemptr) {
589 struct mpc_oemtable *oem_table =
590 (struct mpc_oemtable *)mpc->oemptr;
591
592 if (!strncmp(oem, "UNISYS", 6))
2b6163bf 593 ret = parse_unisys_oem((char *)oem_table);
2e096df8 594 }
2b6163bf
YL
595
596 es7000_mps_ret = ret;
597
598 return ret && !es7000_apic_is_cluster();
599}
600
871d78c6
JS
601static int es7000_mps_oem_check_cluster(struct mpc_table *mpc, char *oem,
602 char *productid)
2b6163bf
YL
603{
604 int ret = es7000_mps_ret;
605
606 return ret && es7000_apic_is_cluster();
2e096df8
IM
607}
608
151586d0 609/* We've been warned by a false positive warning.Use __refdata to keep calm. */
1a8880a1 610static struct apic __refdata apic_es7000_cluster = {
2b6163bf
YL
611
612 .name = "es7000",
613 .probe = probe_es7000,
614 .acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster,
fa63030e 615 .apic_id_valid = default_apic_id_valid,
2b6163bf
YL
616 .apic_id_registered = es7000_apic_id_registered,
617
618 .irq_delivery_mode = dest_LowestPrio,
619 /* logical delivery broadcast to all procs: */
620 .irq_dest_mode = 1,
621
622 .target_cpus = target_cpus_cluster,
623 .disable_esr = 1,
624 .dest_logical = 0,
625 .check_apicid_used = es7000_check_apicid_used,
626 .check_apicid_present = es7000_check_apicid_present,
627
9d8e1066 628 .vector_allocation_domain = flat_vector_allocation_domain,
2b6163bf
YL
629 .init_apic_ldr = es7000_init_apic_ldr_cluster,
630
631 .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
632 .setup_apic_routing = es7000_setup_apic_routing,
633 .multi_timer_check = NULL,
2b6163bf
YL
634 .cpu_present_to_apicid = es7000_cpu_present_to_apicid,
635 .apicid_to_cpu_present = es7000_apicid_to_cpu_present,
636 .setup_portio_remap = NULL,
637 .check_phys_apicid_present = es7000_check_phys_apicid_present,
638 .enable_apic_mode = es7000_enable_apic_mode,
639 .phys_pkg_id = es7000_phys_pkg_id,
640 .mps_oem_check = es7000_mps_oem_check_cluster,
641
642 .get_apic_id = es7000_get_apic_id,
643 .set_apic_id = NULL,
644 .apic_id_mask = 0xFF << 24,
645
2b6163bf
YL
646 .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
647
648 .send_IPI_mask = es7000_send_IPI_mask,
649 .send_IPI_mask_allbutself = NULL,
650 .send_IPI_allbutself = es7000_send_IPI_allbutself,
651 .send_IPI_all = es7000_send_IPI_all,
652 .send_IPI_self = default_send_IPI_self,
653
1f5bcabf 654 .wakeup_secondary_cpu = wakeup_secondary_cpu_via_mip,
2b6163bf
YL
655
656 .trampoline_phys_low = 0x467,
657 .trampoline_phys_high = 0x469,
658
659 .wait_for_init_deassert = NULL,
660
661 /* Nothing to do for most platforms, since cleared by the INIT cycle: */
662 .smp_callin_clear_local_apic = NULL,
663 .inquire_remote_apic = default_inquire_remote_apic,
664
665 .read = native_apic_mem_read,
666 .write = native_apic_mem_write,
2a43195d 667 .eoi_write = native_apic_mem_write,
2b6163bf
YL
668 .icr_read = native_apic_icr_read,
669 .icr_write = native_apic_icr_write,
670 .wait_icr_idle = native_apic_wait_icr_idle,
671 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
acb8bc09 672
df04cf01 673 .x86_32_early_logical_apicid = es7000_early_logical_apicid,
2b6163bf 674};
2e096df8 675
1a8880a1 676static struct apic __refdata apic_es7000 = {
2e096df8
IM
677
678 .name = "es7000",
679 .probe = probe_es7000,
680 .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
fa63030e 681 .apic_id_valid = default_apic_id_valid,
2e096df8
IM
682 .apic_id_registered = es7000_apic_id_registered,
683
684 .irq_delivery_mode = dest_Fixed,
685 /* phys delivery to target CPUs: */
686 .irq_dest_mode = 0,
687
688 .target_cpus = es7000_target_cpus,
689 .disable_esr = 1,
690 .dest_logical = 0,
691 .check_apicid_used = es7000_check_apicid_used,
692 .check_apicid_present = es7000_check_apicid_present,
693
9d8e1066 694 .vector_allocation_domain = flat_vector_allocation_domain,
2e096df8
IM
695 .init_apic_ldr = es7000_init_apic_ldr,
696
697 .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
698 .setup_apic_routing = es7000_setup_apic_routing,
699 .multi_timer_check = NULL,
2e096df8
IM
700 .cpu_present_to_apicid = es7000_cpu_present_to_apicid,
701 .apicid_to_cpu_present = es7000_apicid_to_cpu_present,
702 .setup_portio_remap = NULL,
703 .check_phys_apicid_present = es7000_check_phys_apicid_present,
704 .enable_apic_mode = es7000_enable_apic_mode,
705 .phys_pkg_id = es7000_phys_pkg_id,
706 .mps_oem_check = es7000_mps_oem_check,
707
708 .get_apic_id = es7000_get_apic_id,
709 .set_apic_id = NULL,
710 .apic_id_mask = 0xFF << 24,
711
2e096df8
IM
712 .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
713
714 .send_IPI_mask = es7000_send_IPI_mask,
715 .send_IPI_mask_allbutself = NULL,
716 .send_IPI_allbutself = es7000_send_IPI_allbutself,
717 .send_IPI_all = es7000_send_IPI_all,
6b64ee02 718 .send_IPI_self = default_send_IPI_self,
2e096df8 719
2e096df8
IM
720 .trampoline_phys_low = 0x467,
721 .trampoline_phys_high = 0x469,
722
723 .wait_for_init_deassert = es7000_wait_for_init_deassert,
724
725 /* Nothing to do for most platforms, since cleared by the INIT cycle: */
726 .smp_callin_clear_local_apic = NULL,
2e096df8 727 .inquire_remote_apic = default_inquire_remote_apic,
c1eeb2de
YL
728
729 .read = native_apic_mem_read,
730 .write = native_apic_mem_write,
2a43195d 731 .eoi_write = native_apic_mem_write,
c1eeb2de
YL
732 .icr_read = native_apic_icr_read,
733 .icr_write = native_apic_icr_write,
734 .wait_icr_idle = native_apic_wait_icr_idle,
735 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
acb8bc09 736
df04cf01 737 .x86_32_early_logical_apicid = es7000_early_logical_apicid,
2e096df8 738};
107e0e0c
SS
739
740/*
741 * Need to check for es7000 followed by es7000_cluster, so this order
742 * in apic_drivers is important.
743 */
744apic_drivers(apic_es7000, apic_es7000_cluster);