es7000_32.c 18 KB

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