es7000_32.c 18 KB

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