es7000_32.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. /*
  2. * Written by: Garry Forsgren, Unisys Corporation
  3. * Natalie Protasevich, Unisys Corporation
  4. * This file contains the code to configure and interface
  5. * with Unisys ES7000 series hardware system manager.
  6. *
  7. * Copyright (c) 2003 Unisys Corporation. All Rights Reserved.
  8. *
  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
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it would be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  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
  19. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  20. *
  21. * Contact information: Unisys Corporation, Township Line & Union Meeting
  22. * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
  23. *
  24. * http://www.unisys.com
  25. */
  26. #include <linux/module.h>
  27. #include <linux/types.h>
  28. #include <linux/kernel.h>
  29. #include <linux/smp.h>
  30. #include <linux/string.h>
  31. #include <linux/spinlock.h>
  32. #include <linux/errno.h>
  33. #include <linux/notifier.h>
  34. #include <linux/reboot.h>
  35. #include <linux/init.h>
  36. #include <linux/acpi.h>
  37. #include <asm/io.h>
  38. #include <asm/nmi.h>
  39. #include <asm/smp.h>
  40. #include <asm/atomic.h>
  41. #include <asm/apicdef.h>
  42. #include <asm/apic.h>
  43. #include <asm/setup.h>
  44. /*
  45. * ES7000 chipsets
  46. */
  47. #define NON_UNISYS 0
  48. #define ES7000_CLASSIC 1
  49. #define ES7000_ZORRO 2
  50. #define MIP_REG 1
  51. #define MIP_PSAI_REG 4
  52. #define MIP_BUSY 1
  53. #define MIP_SPIN 0xf0000
  54. #define MIP_VALID 0x0100000000000000ULL
  55. #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff)
  56. #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff)
  57. struct mip_reg_info {
  58. unsigned long long mip_info;
  59. unsigned long long delivery_info;
  60. unsigned long long host_reg;
  61. unsigned long long mip_reg;
  62. };
  63. struct part_info {
  64. unsigned char type;
  65. unsigned char length;
  66. unsigned char part_id;
  67. unsigned char apic_mode;
  68. unsigned long snum;
  69. char ptype[16];
  70. char sname[64];
  71. char pname[64];
  72. };
  73. struct psai {
  74. unsigned long long entry_type;
  75. unsigned long long addr;
  76. unsigned long long bep_addr;
  77. };
  78. struct es7000_mem_info {
  79. unsigned char type;
  80. unsigned char length;
  81. unsigned char resv[6];
  82. unsigned long long start;
  83. unsigned long long size;
  84. };
  85. struct es7000_oem_table {
  86. unsigned long long hdr;
  87. struct mip_reg_info mip;
  88. struct part_info pif;
  89. struct es7000_mem_info shm;
  90. struct psai psai;
  91. };
  92. #ifdef CONFIG_ACPI
  93. struct oem_table {
  94. struct acpi_table_header Header;
  95. u32 OEMTableAddr;
  96. u32 OEMTableSize;
  97. };
  98. extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
  99. extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
  100. #endif
  101. struct mip_reg {
  102. unsigned long long off_0;
  103. unsigned long long off_8;
  104. unsigned long long off_10;
  105. unsigned long long off_18;
  106. unsigned long long off_20;
  107. unsigned long long off_28;
  108. unsigned long long off_30;
  109. unsigned long long off_38;
  110. };
  111. #define MIP_SW_APIC 0x1020b
  112. #define MIP_FUNC(VALUE) (VALUE & 0xff)
  113. /*
  114. * ES7000 Globals
  115. */
  116. static volatile unsigned long *psai = NULL;
  117. static struct mip_reg *mip_reg;
  118. static struct mip_reg *host_reg;
  119. static int mip_port;
  120. static unsigned long mip_addr, host_addr;
  121. int es7000_plat;
  122. /*
  123. * GSI override for ES7000 platforms.
  124. */
  125. static unsigned int base;
  126. static int
  127. es7000_rename_gsi(int ioapic, int gsi)
  128. {
  129. if (es7000_plat == ES7000_ZORRO)
  130. return gsi;
  131. if (!base) {
  132. int i;
  133. for (i = 0; i < nr_ioapics; i++)
  134. base += nr_ioapic_registers[i];
  135. }
  136. if (!ioapic && (gsi < 16))
  137. gsi += base;
  138. return gsi;
  139. }
  140. static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
  141. {
  142. unsigned long vect = 0, psaival = 0;
  143. if (psai == NULL)
  144. return -1;
  145. vect = ((unsigned long)__pa(eip)/0x1000) << 16;
  146. psaival = (0x1000000 | vect | cpu);
  147. while (*psai & 0x1000000)
  148. ;
  149. *psai = psaival;
  150. return 0;
  151. }
  152. static int __init es7000_update_genapic(void)
  153. {
  154. apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
  155. /* MPENTIUMIII */
  156. if (boot_cpu_data.x86 == 6 &&
  157. (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) {
  158. es7000_update_genapic_to_cluster();
  159. apic->wait_for_init_deassert = NULL;
  160. apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
  161. }
  162. return 0;
  163. }
  164. void __init
  165. setup_unisys(void)
  166. {
  167. /*
  168. * Determine the generation of the ES7000 currently running.
  169. *
  170. * es7000_plat = 1 if the machine is a 5xx ES7000 box
  171. * es7000_plat = 2 if the machine is a x86_64 ES7000 box
  172. *
  173. */
  174. if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
  175. es7000_plat = ES7000_ZORRO;
  176. else
  177. es7000_plat = ES7000_CLASSIC;
  178. ioapic_renumber_irq = es7000_rename_gsi;
  179. x86_quirks->update_genapic = es7000_update_genapic;
  180. }
  181. /*
  182. * Parse the OEM Table
  183. */
  184. int __init
  185. parse_unisys_oem (char *oemptr)
  186. {
  187. int i;
  188. int success = 0;
  189. unsigned char type, size;
  190. unsigned long val;
  191. char *tp = NULL;
  192. struct psai *psaip = NULL;
  193. struct mip_reg_info *mi;
  194. struct mip_reg *host, *mip;
  195. tp = oemptr;
  196. tp += 8;
  197. for (i=0; i <= 6; i++) {
  198. type = *tp++;
  199. size = *tp++;
  200. tp -= 2;
  201. switch (type) {
  202. case MIP_REG:
  203. mi = (struct mip_reg_info *)tp;
  204. val = MIP_RD_LO(mi->host_reg);
  205. host_addr = val;
  206. host = (struct mip_reg *)val;
  207. host_reg = __va(host);
  208. val = MIP_RD_LO(mi->mip_reg);
  209. mip_port = MIP_PORT(mi->mip_info);
  210. mip_addr = val;
  211. mip = (struct mip_reg *)val;
  212. mip_reg = __va(mip);
  213. pr_debug("es7000_mipcfg: host_reg = 0x%lx \n",
  214. (unsigned long)host_reg);
  215. pr_debug("es7000_mipcfg: mip_reg = 0x%lx \n",
  216. (unsigned long)mip_reg);
  217. success++;
  218. break;
  219. case MIP_PSAI_REG:
  220. psaip = (struct psai *)tp;
  221. if (tp != NULL) {
  222. if (psaip->addr)
  223. psai = __va(psaip->addr);
  224. else
  225. psai = NULL;
  226. success++;
  227. }
  228. break;
  229. default:
  230. break;
  231. }
  232. tp += size;
  233. }
  234. if (success < 2) {
  235. es7000_plat = NON_UNISYS;
  236. } else
  237. setup_unisys();
  238. return es7000_plat;
  239. }
  240. #ifdef CONFIG_ACPI
  241. static unsigned long oem_addrX;
  242. static unsigned long oem_size;
  243. int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
  244. {
  245. struct acpi_table_header *header = NULL;
  246. int i = 0;
  247. acpi_size tbl_size;
  248. while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) {
  249. if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) {
  250. struct oem_table *t = (struct oem_table *)header;
  251. oem_addrX = t->OEMTableAddr;
  252. oem_size = t->OEMTableSize;
  253. early_acpi_os_unmap_memory(header, tbl_size);
  254. *oem_addr = (unsigned long)__acpi_map_table(oem_addrX,
  255. oem_size);
  256. return 0;
  257. }
  258. early_acpi_os_unmap_memory(header, tbl_size);
  259. }
  260. return -1;
  261. }
  262. void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
  263. {
  264. if (!oem_addr)
  265. return;
  266. __acpi_unmap_table((char *)oem_addr, oem_size);
  267. }
  268. #endif
  269. static void
  270. es7000_spin(int n)
  271. {
  272. int i = 0;
  273. while (i++ < n)
  274. rep_nop();
  275. }
  276. static int __init
  277. es7000_mip_write(struct mip_reg *mip_reg)
  278. {
  279. int status = 0;
  280. int spin;
  281. spin = MIP_SPIN;
  282. while (((unsigned long long)host_reg->off_38 &
  283. (unsigned long long)MIP_VALID) != 0) {
  284. if (--spin <= 0) {
  285. printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
  286. return -1;
  287. }
  288. es7000_spin(MIP_SPIN);
  289. }
  290. memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
  291. outb(1, mip_port);
  292. spin = MIP_SPIN;
  293. while (((unsigned long long)mip_reg->off_38 &
  294. (unsigned long long)MIP_VALID) == 0) {
  295. if (--spin <= 0) {
  296. printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
  297. return -1;
  298. }
  299. es7000_spin(MIP_SPIN);
  300. }
  301. status = ((unsigned long long)mip_reg->off_0 &
  302. (unsigned long long)0xffff0000000000ULL) >> 48;
  303. mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
  304. (unsigned long long)~MIP_VALID);
  305. return status;
  306. }
  307. void __init es7000_enable_apic_mode(void)
  308. {
  309. struct mip_reg es7000_mip_reg;
  310. int mip_status;
  311. if (!es7000_plat)
  312. return;
  313. printk("ES7000: Enabling APIC mode.\n");
  314. memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
  315. es7000_mip_reg.off_0 = MIP_SW_APIC;
  316. es7000_mip_reg.off_38 = MIP_VALID;
  317. while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
  318. printk("es7000_enable_apic_mode: command failed, status = %x\n",
  319. mip_status);
  320. }
  321. }
  322. /*
  323. * APIC driver for the Unisys ES7000 chipset.
  324. */
  325. #include <linux/threads.h>
  326. #include <linux/cpumask.h>
  327. #include <asm/mpspec.h>
  328. #include <asm/fixmap.h>
  329. #include <asm/apicdef.h>
  330. #include <linux/kernel.h>
  331. #include <linux/string.h>
  332. #include <linux/init.h>
  333. #include <linux/acpi.h>
  334. #include <linux/smp.h>
  335. #include <asm/ipi.h>
  336. #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER)
  337. #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio)
  338. #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */
  339. #define APIC_DFR_VALUE (APIC_DFR_FLAT)
  340. extern void es7000_enable_apic_mode(void);
  341. extern int apic_version [MAX_APICS];
  342. extern u8 cpu_2_logical_apicid[];
  343. extern unsigned int boot_cpu_physical_apicid;
  344. extern int parse_unisys_oem (char *oemptr);
  345. extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
  346. extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
  347. extern void setup_unisys(void);
  348. #define apicid_cluster(apicid) (apicid & 0xF0)
  349. #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
  350. static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
  351. {
  352. /* Careful. Some cpus do not strictly honor the set of cpus
  353. * specified in the interrupt destination when using lowest
  354. * priority interrupt delivery mode.
  355. *
  356. * In particular there was a hyperthreading cpu observed to
  357. * deliver interrupts to the wrong hyperthread when only one
  358. * hyperthread was specified in the interrupt desitination.
  359. */
  360. *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
  361. }
  362. static void es7000_wait_for_init_deassert(atomic_t *deassert)
  363. {
  364. #ifndef CONFIG_ES7000_CLUSTERED_APIC
  365. while (!atomic_read(deassert))
  366. cpu_relax();
  367. #endif
  368. return;
  369. }
  370. static unsigned int es7000_get_apic_id(unsigned long x)
  371. {
  372. return (x >> 24) & 0xFF;
  373. }
  374. #ifdef CONFIG_ACPI
  375. static int es7000_check_dsdt(void)
  376. {
  377. struct acpi_table_header header;
  378. if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
  379. !strncmp(header.oem_id, "UNISYS", 6))
  380. return 1;
  381. return 0;
  382. }
  383. #endif
  384. static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
  385. {
  386. default_send_IPI_mask_sequence_phys(mask, vector);
  387. }
  388. static void es7000_send_IPI_allbutself(int vector)
  389. {
  390. default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
  391. }
  392. static void es7000_send_IPI_all(int vector)
  393. {
  394. es7000_send_IPI_mask(cpu_online_mask, vector);
  395. }
  396. static int es7000_apic_id_registered(void)
  397. {
  398. return 1;
  399. }
  400. static const cpumask_t *target_cpus_cluster(void)
  401. {
  402. return &CPU_MASK_ALL;
  403. }
  404. static const cpumask_t *es7000_target_cpus(void)
  405. {
  406. return &cpumask_of_cpu(smp_processor_id());
  407. }
  408. static unsigned long
  409. es7000_check_apicid_used(physid_mask_t bitmap, int apicid)
  410. {
  411. return 0;
  412. }
  413. static unsigned long es7000_check_apicid_present(int bit)
  414. {
  415. return physid_isset(bit, phys_cpu_present_map);
  416. }
  417. static unsigned long calculate_ldr(int cpu)
  418. {
  419. unsigned long id = xapic_phys_to_log_apicid(cpu);
  420. return (SET_APIC_LOGICAL_ID(id));
  421. }
  422. /*
  423. * Set up the logical destination ID.
  424. *
  425. * Intel recommends to set DFR, LdR and TPR before enabling
  426. * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
  427. * document number 292116). So here it goes...
  428. */
  429. static void es7000_init_apic_ldr_cluster(void)
  430. {
  431. unsigned long val;
  432. int cpu = smp_processor_id();
  433. apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER);
  434. val = calculate_ldr(cpu);
  435. apic_write(APIC_LDR, val);
  436. }
  437. static void es7000_init_apic_ldr(void)
  438. {
  439. unsigned long val;
  440. int cpu = smp_processor_id();
  441. apic_write(APIC_DFR, APIC_DFR_VALUE);
  442. val = calculate_ldr(cpu);
  443. apic_write(APIC_LDR, val);
  444. }
  445. static void es7000_setup_apic_routing(void)
  446. {
  447. int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
  448. printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
  449. (apic_version[apic] == 0x14) ?
  450. "Physical Cluster" : "Logical Cluster",
  451. nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
  452. }
  453. static int es7000_apicid_to_node(int logical_apicid)
  454. {
  455. return 0;
  456. }
  457. static int es7000_cpu_present_to_apicid(int mps_cpu)
  458. {
  459. if (!mps_cpu)
  460. return boot_cpu_physical_apicid;
  461. else if (mps_cpu < nr_cpu_ids)
  462. return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
  463. else
  464. return BAD_APICID;
  465. }
  466. static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid)
  467. {
  468. static int id = 0;
  469. physid_mask_t mask;
  470. mask = physid_mask_of_physid(id);
  471. ++id;
  472. return mask;
  473. }
  474. /* Mapping from cpu number to logical apicid */
  475. static int es7000_cpu_to_logical_apicid(int cpu)
  476. {
  477. #ifdef CONFIG_SMP
  478. if (cpu >= nr_cpu_ids)
  479. return BAD_APICID;
  480. return (int)cpu_2_logical_apicid[cpu];
  481. #else
  482. return logical_smp_processor_id();
  483. #endif
  484. }
  485. static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
  486. {
  487. /* For clustered we don't have a good way to do this yet - hack */
  488. return physids_promote(0xff);
  489. }
  490. static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
  491. {
  492. boot_cpu_physical_apicid = read_apic_id();
  493. return (1);
  494. }
  495. static unsigned int
  496. es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
  497. {
  498. int cpus_found = 0;
  499. int num_bits_set;
  500. int apicid;
  501. int cpu;
  502. num_bits_set = cpumask_weight(cpumask);
  503. /* Return id to all */
  504. if (num_bits_set == nr_cpu_ids)
  505. return 0xFF;
  506. /*
  507. * The cpus in the mask must all be on the apic cluster. If are not
  508. * on the same apicid cluster return default value of target_cpus():
  509. */
  510. cpu = cpumask_first(cpumask);
  511. apicid = es7000_cpu_to_logical_apicid(cpu);
  512. while (cpus_found < num_bits_set) {
  513. if (cpumask_test_cpu(cpu, cpumask)) {
  514. int new_apicid = es7000_cpu_to_logical_apicid(cpu);
  515. if (apicid_cluster(apicid) !=
  516. apicid_cluster(new_apicid)) {
  517. printk ("%s: Not a valid mask!\n", __func__);
  518. return 0xFF;
  519. }
  520. apicid = new_apicid;
  521. cpus_found++;
  522. }
  523. cpu++;
  524. }
  525. return apicid;
  526. }
  527. static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
  528. {
  529. int cpus_found = 0;
  530. int num_bits_set;
  531. int apicid;
  532. int cpu;
  533. num_bits_set = cpus_weight(*cpumask);
  534. /* Return id to all */
  535. if (num_bits_set == nr_cpu_ids)
  536. return es7000_cpu_to_logical_apicid(0);
  537. /*
  538. * The cpus in the mask must all be on the apic cluster. If are not
  539. * on the same apicid cluster return default value of target_cpus():
  540. */
  541. cpu = first_cpu(*cpumask);
  542. apicid = es7000_cpu_to_logical_apicid(cpu);
  543. while (cpus_found < num_bits_set) {
  544. if (cpu_isset(cpu, *cpumask)) {
  545. int new_apicid = es7000_cpu_to_logical_apicid(cpu);
  546. if (apicid_cluster(apicid) !=
  547. apicid_cluster(new_apicid)) {
  548. printk ("%s: Not a valid mask!\n", __func__);
  549. return es7000_cpu_to_logical_apicid(0);
  550. }
  551. apicid = new_apicid;
  552. cpus_found++;
  553. }
  554. cpu++;
  555. }
  556. return apicid;
  557. }
  558. static unsigned int
  559. es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
  560. const struct cpumask *andmask)
  561. {
  562. int apicid = es7000_cpu_to_logical_apicid(0);
  563. cpumask_var_t cpumask;
  564. if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
  565. return apicid;
  566. cpumask_and(cpumask, inmask, andmask);
  567. cpumask_and(cpumask, cpumask, cpu_online_mask);
  568. apicid = es7000_cpu_mask_to_apicid(cpumask);
  569. free_cpumask_var(cpumask);
  570. return apicid;
  571. }
  572. static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
  573. {
  574. return cpuid_apic >> index_msb;
  575. }
  576. void __init es7000_update_genapic_to_cluster(void)
  577. {
  578. apic->target_cpus = target_cpus_cluster;
  579. apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
  580. apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
  581. apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
  582. apic->cpu_mask_to_apicid = es7000_cpu_mask_to_apicid_cluster;
  583. }
  584. static int probe_es7000(void)
  585. {
  586. /* probed later in mptable/ACPI hooks */
  587. return 0;
  588. }
  589. static __init int
  590. es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
  591. {
  592. if (mpc->oemptr) {
  593. struct mpc_oemtable *oem_table =
  594. (struct mpc_oemtable *)mpc->oemptr;
  595. if (!strncmp(oem, "UNISYS", 6))
  596. return parse_unisys_oem((char *)oem_table);
  597. }
  598. return 0;
  599. }
  600. #ifdef CONFIG_ACPI
  601. /* Hook from generic ACPI tables.c */
  602. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  603. {
  604. unsigned long oem_addr = 0;
  605. int check_dsdt;
  606. int ret = 0;
  607. /* check dsdt at first to avoid clear fix_map for oem_addr */
  608. check_dsdt = es7000_check_dsdt();
  609. if (!find_unisys_acpi_oem_table(&oem_addr)) {
  610. if (check_dsdt)
  611. ret = parse_unisys_oem((char *)oem_addr);
  612. else {
  613. setup_unisys();
  614. ret = 1;
  615. }
  616. /*
  617. * we need to unmap it
  618. */
  619. unmap_unisys_acpi_oem_table(oem_addr);
  620. }
  621. return ret;
  622. }
  623. #else
  624. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  625. {
  626. return 0;
  627. }
  628. #endif
  629. struct genapic apic_es7000 = {
  630. .name = "es7000",
  631. .probe = probe_es7000,
  632. .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
  633. .apic_id_registered = es7000_apic_id_registered,
  634. .irq_delivery_mode = dest_Fixed,
  635. /* phys delivery to target CPUs: */
  636. .irq_dest_mode = 0,
  637. .target_cpus = es7000_target_cpus,
  638. .disable_esr = 1,
  639. .dest_logical = 0,
  640. .check_apicid_used = es7000_check_apicid_used,
  641. .check_apicid_present = es7000_check_apicid_present,
  642. .vector_allocation_domain = es7000_vector_allocation_domain,
  643. .init_apic_ldr = es7000_init_apic_ldr,
  644. .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
  645. .setup_apic_routing = es7000_setup_apic_routing,
  646. .multi_timer_check = NULL,
  647. .apicid_to_node = es7000_apicid_to_node,
  648. .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid,
  649. .cpu_present_to_apicid = es7000_cpu_present_to_apicid,
  650. .apicid_to_cpu_present = es7000_apicid_to_cpu_present,
  651. .setup_portio_remap = NULL,
  652. .check_phys_apicid_present = es7000_check_phys_apicid_present,
  653. .enable_apic_mode = es7000_enable_apic_mode,
  654. .phys_pkg_id = es7000_phys_pkg_id,
  655. .mps_oem_check = es7000_mps_oem_check,
  656. .get_apic_id = es7000_get_apic_id,
  657. .set_apic_id = NULL,
  658. .apic_id_mask = 0xFF << 24,
  659. .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid,
  660. .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
  661. .send_IPI_mask = es7000_send_IPI_mask,
  662. .send_IPI_mask_allbutself = NULL,
  663. .send_IPI_allbutself = es7000_send_IPI_allbutself,
  664. .send_IPI_all = es7000_send_IPI_all,
  665. .send_IPI_self = default_send_IPI_self,
  666. .wakeup_cpu = NULL,
  667. .trampoline_phys_low = 0x467,
  668. .trampoline_phys_high = 0x469,
  669. .wait_for_init_deassert = es7000_wait_for_init_deassert,
  670. /* Nothing to do for most platforms, since cleared by the INIT cycle: */
  671. .smp_callin_clear_local_apic = NULL,
  672. .store_NMI_vector = NULL,
  673. .inquire_remote_apic = default_inquire_remote_apic,
  674. .read = native_apic_mem_read,
  675. .write = native_apic_mem_write,
  676. .icr_read = native_apic_icr_read,
  677. .icr_write = native_apic_icr_write,
  678. .wait_icr_idle = native_apic_wait_icr_idle,
  679. .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
  680. };