es7000_32.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  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. #define APIC_DEFINITION 1
  326. #include <linux/threads.h>
  327. #include <linux/cpumask.h>
  328. #include <asm/mpspec.h>
  329. #include <asm/apic.h>
  330. #include <asm/fixmap.h>
  331. #include <asm/apicdef.h>
  332. #include <linux/kernel.h>
  333. #include <linux/string.h>
  334. #include <linux/init.h>
  335. #include <linux/acpi.h>
  336. #include <linux/smp.h>
  337. #include <asm/ipi.h>
  338. #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER)
  339. #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio)
  340. #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */
  341. #define APIC_DFR_VALUE (APIC_DFR_FLAT)
  342. extern void es7000_enable_apic_mode(void);
  343. extern int apic_version [MAX_APICS];
  344. extern u8 cpu_2_logical_apicid[];
  345. extern unsigned int boot_cpu_physical_apicid;
  346. extern int parse_unisys_oem (char *oemptr);
  347. extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
  348. extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
  349. extern void setup_unisys(void);
  350. #define apicid_cluster(apicid) (apicid & 0xF0)
  351. #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
  352. static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
  353. {
  354. /* Careful. Some cpus do not strictly honor the set of cpus
  355. * specified in the interrupt destination when using lowest
  356. * priority interrupt delivery mode.
  357. *
  358. * In particular there was a hyperthreading cpu observed to
  359. * deliver interrupts to the wrong hyperthread when only one
  360. * hyperthread was specified in the interrupt desitination.
  361. */
  362. *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
  363. }
  364. static void es7000_wait_for_init_deassert(atomic_t *deassert)
  365. {
  366. #ifndef CONFIG_ES7000_CLUSTERED_APIC
  367. while (!atomic_read(deassert))
  368. cpu_relax();
  369. #endif
  370. return;
  371. }
  372. static unsigned int es7000_get_apic_id(unsigned long x)
  373. {
  374. return (x >> 24) & 0xFF;
  375. }
  376. #ifdef CONFIG_ACPI
  377. static int es7000_check_dsdt(void)
  378. {
  379. struct acpi_table_header header;
  380. if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
  381. !strncmp(header.oem_id, "UNISYS", 6))
  382. return 1;
  383. return 0;
  384. }
  385. #endif
  386. static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
  387. {
  388. default_send_IPI_mask_sequence_phys(mask, vector);
  389. }
  390. static void es7000_send_IPI_allbutself(int vector)
  391. {
  392. default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
  393. }
  394. static void es7000_send_IPI_all(int vector)
  395. {
  396. es7000_send_IPI_mask(cpu_online_mask, vector);
  397. }
  398. static int es7000_apic_id_registered(void)
  399. {
  400. return 1;
  401. }
  402. static const cpumask_t *target_cpus_cluster(void)
  403. {
  404. return &CPU_MASK_ALL;
  405. }
  406. static const cpumask_t *es7000_target_cpus(void)
  407. {
  408. return &cpumask_of_cpu(smp_processor_id());
  409. }
  410. static unsigned long
  411. es7000_check_apicid_used(physid_mask_t bitmap, int apicid)
  412. {
  413. return 0;
  414. }
  415. static unsigned long es7000_check_apicid_present(int bit)
  416. {
  417. return physid_isset(bit, phys_cpu_present_map);
  418. }
  419. static unsigned long calculate_ldr(int cpu)
  420. {
  421. unsigned long id = xapic_phys_to_log_apicid(cpu);
  422. return (SET_APIC_LOGICAL_ID(id));
  423. }
  424. /*
  425. * Set up the logical destination ID.
  426. *
  427. * Intel recommends to set DFR, LdR and TPR before enabling
  428. * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
  429. * document number 292116). So here it goes...
  430. */
  431. static void es7000_init_apic_ldr_cluster(void)
  432. {
  433. unsigned long val;
  434. int cpu = smp_processor_id();
  435. apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER);
  436. val = calculate_ldr(cpu);
  437. apic_write(APIC_LDR, val);
  438. }
  439. static void es7000_init_apic_ldr(void)
  440. {
  441. unsigned long val;
  442. int cpu = smp_processor_id();
  443. apic_write(APIC_DFR, APIC_DFR_VALUE);
  444. val = calculate_ldr(cpu);
  445. apic_write(APIC_LDR, val);
  446. }
  447. static void es7000_setup_apic_routing(void)
  448. {
  449. int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
  450. printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
  451. (apic_version[apic] == 0x14) ?
  452. "Physical Cluster" : "Logical Cluster",
  453. nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
  454. }
  455. static int es7000_apicid_to_node(int logical_apicid)
  456. {
  457. return 0;
  458. }
  459. static int es7000_cpu_present_to_apicid(int mps_cpu)
  460. {
  461. if (!mps_cpu)
  462. return boot_cpu_physical_apicid;
  463. else if (mps_cpu < nr_cpu_ids)
  464. return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
  465. else
  466. return BAD_APICID;
  467. }
  468. static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid)
  469. {
  470. static int id = 0;
  471. physid_mask_t mask;
  472. mask = physid_mask_of_physid(id);
  473. ++id;
  474. return mask;
  475. }
  476. /* Mapping from cpu number to logical apicid */
  477. static int es7000_cpu_to_logical_apicid(int cpu)
  478. {
  479. #ifdef CONFIG_SMP
  480. if (cpu >= nr_cpu_ids)
  481. return BAD_APICID;
  482. return (int)cpu_2_logical_apicid[cpu];
  483. #else
  484. return logical_smp_processor_id();
  485. #endif
  486. }
  487. static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
  488. {
  489. /* For clustered we don't have a good way to do this yet - hack */
  490. return physids_promote(0xff);
  491. }
  492. static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
  493. {
  494. boot_cpu_physical_apicid = read_apic_id();
  495. return (1);
  496. }
  497. static unsigned int
  498. es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
  499. {
  500. int cpus_found = 0;
  501. int num_bits_set;
  502. int apicid;
  503. int cpu;
  504. num_bits_set = cpumask_weight(cpumask);
  505. /* Return id to all */
  506. if (num_bits_set == nr_cpu_ids)
  507. return 0xFF;
  508. /*
  509. * The cpus in the mask must all be on the apic cluster. If are not
  510. * on the same apicid cluster return default value of target_cpus():
  511. */
  512. cpu = cpumask_first(cpumask);
  513. apicid = es7000_cpu_to_logical_apicid(cpu);
  514. while (cpus_found < num_bits_set) {
  515. if (cpumask_test_cpu(cpu, cpumask)) {
  516. int new_apicid = es7000_cpu_to_logical_apicid(cpu);
  517. if (apicid_cluster(apicid) !=
  518. apicid_cluster(new_apicid)) {
  519. printk ("%s: Not a valid mask!\n", __func__);
  520. return 0xFF;
  521. }
  522. apicid = new_apicid;
  523. cpus_found++;
  524. }
  525. cpu++;
  526. }
  527. return apicid;
  528. }
  529. static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
  530. {
  531. int cpus_found = 0;
  532. int num_bits_set;
  533. int apicid;
  534. int cpu;
  535. num_bits_set = cpus_weight(*cpumask);
  536. /* Return id to all */
  537. if (num_bits_set == nr_cpu_ids)
  538. return es7000_cpu_to_logical_apicid(0);
  539. /*
  540. * The cpus in the mask must all be on the apic cluster. If are not
  541. * on the same apicid cluster return default value of target_cpus():
  542. */
  543. cpu = first_cpu(*cpumask);
  544. apicid = es7000_cpu_to_logical_apicid(cpu);
  545. while (cpus_found < num_bits_set) {
  546. if (cpu_isset(cpu, *cpumask)) {
  547. int new_apicid = es7000_cpu_to_logical_apicid(cpu);
  548. if (apicid_cluster(apicid) !=
  549. apicid_cluster(new_apicid)) {
  550. printk ("%s: Not a valid mask!\n", __func__);
  551. return es7000_cpu_to_logical_apicid(0);
  552. }
  553. apicid = new_apicid;
  554. cpus_found++;
  555. }
  556. cpu++;
  557. }
  558. return apicid;
  559. }
  560. static unsigned int
  561. es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
  562. const struct cpumask *andmask)
  563. {
  564. int apicid = es7000_cpu_to_logical_apicid(0);
  565. cpumask_var_t cpumask;
  566. if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
  567. return apicid;
  568. cpumask_and(cpumask, inmask, andmask);
  569. cpumask_and(cpumask, cpumask, cpu_online_mask);
  570. apicid = es7000_cpu_mask_to_apicid(cpumask);
  571. free_cpumask_var(cpumask);
  572. return apicid;
  573. }
  574. static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
  575. {
  576. return cpuid_apic >> index_msb;
  577. }
  578. void __init es7000_update_genapic_to_cluster(void)
  579. {
  580. apic->target_cpus = target_cpus_cluster;
  581. apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
  582. apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
  583. apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
  584. apic->cpu_mask_to_apicid = es7000_cpu_mask_to_apicid_cluster;
  585. }
  586. static int probe_es7000(void)
  587. {
  588. /* probed later in mptable/ACPI hooks */
  589. return 0;
  590. }
  591. static __init int
  592. es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
  593. {
  594. if (mpc->oemptr) {
  595. struct mpc_oemtable *oem_table =
  596. (struct mpc_oemtable *)mpc->oemptr;
  597. if (!strncmp(oem, "UNISYS", 6))
  598. return parse_unisys_oem((char *)oem_table);
  599. }
  600. return 0;
  601. }
  602. #ifdef CONFIG_ACPI
  603. /* Hook from generic ACPI tables.c */
  604. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  605. {
  606. unsigned long oem_addr = 0;
  607. int check_dsdt;
  608. int ret = 0;
  609. /* check dsdt at first to avoid clear fix_map for oem_addr */
  610. check_dsdt = es7000_check_dsdt();
  611. if (!find_unisys_acpi_oem_table(&oem_addr)) {
  612. if (check_dsdt)
  613. ret = parse_unisys_oem((char *)oem_addr);
  614. else {
  615. setup_unisys();
  616. ret = 1;
  617. }
  618. /*
  619. * we need to unmap it
  620. */
  621. unmap_unisys_acpi_oem_table(oem_addr);
  622. }
  623. return ret;
  624. }
  625. #else
  626. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  627. {
  628. return 0;
  629. }
  630. #endif
  631. struct genapic apic_es7000 = {
  632. .name = "es7000",
  633. .probe = probe_es7000,
  634. .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
  635. .apic_id_registered = es7000_apic_id_registered,
  636. .irq_delivery_mode = dest_Fixed,
  637. /* phys delivery to target CPUs: */
  638. .irq_dest_mode = 0,
  639. .target_cpus = es7000_target_cpus,
  640. .disable_esr = 1,
  641. .dest_logical = 0,
  642. .check_apicid_used = es7000_check_apicid_used,
  643. .check_apicid_present = es7000_check_apicid_present,
  644. .vector_allocation_domain = es7000_vector_allocation_domain,
  645. .init_apic_ldr = es7000_init_apic_ldr,
  646. .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
  647. .setup_apic_routing = es7000_setup_apic_routing,
  648. .multi_timer_check = NULL,
  649. .apicid_to_node = es7000_apicid_to_node,
  650. .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid,
  651. .cpu_present_to_apicid = es7000_cpu_present_to_apicid,
  652. .apicid_to_cpu_present = es7000_apicid_to_cpu_present,
  653. .setup_portio_remap = NULL,
  654. .check_phys_apicid_present = es7000_check_phys_apicid_present,
  655. .enable_apic_mode = es7000_enable_apic_mode,
  656. .phys_pkg_id = es7000_phys_pkg_id,
  657. .mps_oem_check = es7000_mps_oem_check,
  658. .get_apic_id = es7000_get_apic_id,
  659. .set_apic_id = NULL,
  660. .apic_id_mask = 0xFF << 24,
  661. .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid,
  662. .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
  663. .send_IPI_mask = es7000_send_IPI_mask,
  664. .send_IPI_mask_allbutself = NULL,
  665. .send_IPI_allbutself = es7000_send_IPI_allbutself,
  666. .send_IPI_all = es7000_send_IPI_all,
  667. .send_IPI_self = default_send_IPI_self,
  668. .wakeup_cpu = NULL,
  669. .trampoline_phys_low = 0x467,
  670. .trampoline_phys_high = 0x469,
  671. .wait_for_init_deassert = es7000_wait_for_init_deassert,
  672. /* Nothing to do for most platforms, since cleared by the INIT cycle: */
  673. .smp_callin_clear_local_apic = NULL,
  674. .store_NMI_vector = NULL,
  675. .inquire_remote_apic = default_inquire_remote_apic,
  676. .read = native_apic_mem_read,
  677. .write = native_apic_mem_write,
  678. .icr_read = native_apic_icr_read,
  679. .icr_write = native_apic_icr_write,
  680. .wait_icr_idle = native_apic_wait_icr_idle,
  681. .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
  682. };