mca_drv.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /*
  2. * File: mca_drv.c
  3. * Purpose: Generic MCA handling layer
  4. *
  5. * Copyright (C) 2004 FUJITSU LIMITED
  6. * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com)
  7. */
  8. #include <linux/config.h>
  9. #include <linux/types.h>
  10. #include <linux/init.h>
  11. #include <linux/sched.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/irq.h>
  14. #include <linux/kallsyms.h>
  15. #include <linux/smp_lock.h>
  16. #include <linux/bootmem.h>
  17. #include <linux/acpi.h>
  18. #include <linux/timer.h>
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/smp.h>
  22. #include <linux/workqueue.h>
  23. #include <linux/mm.h>
  24. #include <asm/delay.h>
  25. #include <asm/machvec.h>
  26. #include <asm/page.h>
  27. #include <asm/ptrace.h>
  28. #include <asm/system.h>
  29. #include <asm/sal.h>
  30. #include <asm/mca.h>
  31. #include <asm/irq.h>
  32. #include <asm/hw_irq.h>
  33. #include "mca_drv.h"
  34. /* max size of SAL error record (default) */
  35. static int sal_rec_max = 10000;
  36. /* from mca.c */
  37. static ia64_mca_sal_to_os_state_t *sal_to_os_handoff_state;
  38. static ia64_mca_os_to_sal_state_t *os_to_sal_handoff_state;
  39. /* from mca_drv_asm.S */
  40. extern void *mca_handler_bhhook(void);
  41. static DEFINE_SPINLOCK(mca_bh_lock);
  42. typedef enum {
  43. MCA_IS_LOCAL = 0,
  44. MCA_IS_GLOBAL = 1
  45. } mca_type_t;
  46. #define MAX_PAGE_ISOLATE 1024
  47. static struct page *page_isolate[MAX_PAGE_ISOLATE];
  48. static int num_page_isolate = 0;
  49. typedef enum {
  50. ISOLATE_NG = 0,
  51. ISOLATE_OK = 1
  52. } isolate_status_t;
  53. /*
  54. * This pool keeps pointers to the section part of SAL error record
  55. */
  56. static struct {
  57. slidx_list_t *buffer; /* section pointer list pool */
  58. int cur_idx; /* Current index of section pointer list pool */
  59. int max_idx; /* Maximum index of section pointer list pool */
  60. } slidx_pool;
  61. /**
  62. * mca_page_isolate - isolate a poisoned page in order not to use it later
  63. * @paddr: poisoned memory location
  64. *
  65. * Return value:
  66. * ISOLATE_OK / ISOLATE_NG
  67. */
  68. static isolate_status_t
  69. mca_page_isolate(unsigned long paddr)
  70. {
  71. int i;
  72. struct page *p;
  73. /* whether physical address is valid or not */
  74. if ( !ia64_phys_addr_valid(paddr) )
  75. return ISOLATE_NG;
  76. /* convert physical address to physical page number */
  77. p = pfn_to_page(paddr>>PAGE_SHIFT);
  78. /* check whether a page number have been already registered or not */
  79. for( i = 0; i < num_page_isolate; i++ )
  80. if( page_isolate[i] == p )
  81. return ISOLATE_OK; /* already listed */
  82. /* limitation check */
  83. if( num_page_isolate == MAX_PAGE_ISOLATE )
  84. return ISOLATE_NG;
  85. /* kick pages having attribute 'SLAB' or 'Reserved' */
  86. if( PageSlab(p) || PageReserved(p) )
  87. return ISOLATE_NG;
  88. /* add attribute 'Reserved' and register the page */
  89. SetPageReserved(p);
  90. page_isolate[num_page_isolate++] = p;
  91. return ISOLATE_OK;
  92. }
  93. /**
  94. * mca_hanlder_bh - Kill the process which occurred memory read error
  95. * @paddr: poisoned address received from MCA Handler
  96. */
  97. void
  98. mca_handler_bh(unsigned long paddr)
  99. {
  100. printk(KERN_DEBUG "OS_MCA: process [pid: %d](%s) encounters MCA.\n",
  101. current->pid, current->comm);
  102. spin_lock(&mca_bh_lock);
  103. if (mca_page_isolate(paddr) == ISOLATE_OK) {
  104. printk(KERN_DEBUG "Page isolation: ( %lx ) success.\n", paddr);
  105. } else {
  106. printk(KERN_DEBUG "Page isolation: ( %lx ) failure.\n", paddr);
  107. }
  108. spin_unlock(&mca_bh_lock);
  109. /* This process is about to be killed itself */
  110. do_exit(SIGKILL);
  111. }
  112. /**
  113. * mca_make_peidx - Make index of processor error section
  114. * @slpi: pointer to record of processor error section
  115. * @peidx: pointer to index of processor error section
  116. */
  117. static void
  118. mca_make_peidx(sal_log_processor_info_t *slpi, peidx_table_t *peidx)
  119. {
  120. /*
  121. * calculate the start address of
  122. * "struct cpuid_info" and "sal_processor_static_info_t".
  123. */
  124. u64 total_check_num = slpi->valid.num_cache_check
  125. + slpi->valid.num_tlb_check
  126. + slpi->valid.num_bus_check
  127. + slpi->valid.num_reg_file_check
  128. + slpi->valid.num_ms_check;
  129. u64 head_size = sizeof(sal_log_mod_error_info_t) * total_check_num
  130. + sizeof(sal_log_processor_info_t);
  131. u64 mid_size = slpi->valid.cpuid_info * sizeof(struct sal_cpuid_info);
  132. peidx_head(peidx) = slpi;
  133. peidx_mid(peidx) = (struct sal_cpuid_info *)
  134. (slpi->valid.cpuid_info ? ((char*)slpi + head_size) : NULL);
  135. peidx_bottom(peidx) = (sal_processor_static_info_t *)
  136. (slpi->valid.psi_static_struct ?
  137. ((char*)slpi + head_size + mid_size) : NULL);
  138. }
  139. /**
  140. * mca_make_slidx - Make index of SAL error record
  141. * @buffer: pointer to SAL error record
  142. * @slidx: pointer to index of SAL error record
  143. *
  144. * Return value:
  145. * 1 if record has platform error / 0 if not
  146. */
  147. #define LOG_INDEX_ADD_SECT_PTR(sect, ptr) \
  148. { slidx_list_t *hl = &slidx_pool.buffer[slidx_pool.cur_idx]; \
  149. hl->hdr = ptr; \
  150. list_add(&hl->list, &(sect)); \
  151. slidx_pool.cur_idx = (slidx_pool.cur_idx + 1)%slidx_pool.max_idx; }
  152. static int
  153. mca_make_slidx(void *buffer, slidx_table_t *slidx)
  154. {
  155. int platform_err = 0;
  156. int record_len = ((sal_log_record_header_t*)buffer)->len;
  157. u32 ercd_pos;
  158. int sects;
  159. sal_log_section_hdr_t *sp;
  160. /*
  161. * Initialize index referring current record
  162. */
  163. INIT_LIST_HEAD(&(slidx->proc_err));
  164. INIT_LIST_HEAD(&(slidx->mem_dev_err));
  165. INIT_LIST_HEAD(&(slidx->sel_dev_err));
  166. INIT_LIST_HEAD(&(slidx->pci_bus_err));
  167. INIT_LIST_HEAD(&(slidx->smbios_dev_err));
  168. INIT_LIST_HEAD(&(slidx->pci_comp_err));
  169. INIT_LIST_HEAD(&(slidx->plat_specific_err));
  170. INIT_LIST_HEAD(&(slidx->host_ctlr_err));
  171. INIT_LIST_HEAD(&(slidx->plat_bus_err));
  172. INIT_LIST_HEAD(&(slidx->unsupported));
  173. /*
  174. * Extract a Record Header
  175. */
  176. slidx->header = buffer;
  177. /*
  178. * Extract each section records
  179. * (arranged from "int ia64_log_platform_info_print()")
  180. */
  181. for (ercd_pos = sizeof(sal_log_record_header_t), sects = 0;
  182. ercd_pos < record_len; ercd_pos += sp->len, sects++) {
  183. sp = (sal_log_section_hdr_t *)((char*)buffer + ercd_pos);
  184. if (!efi_guidcmp(sp->guid, SAL_PROC_DEV_ERR_SECT_GUID)) {
  185. LOG_INDEX_ADD_SECT_PTR(slidx->proc_err, sp);
  186. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_MEM_DEV_ERR_SECT_GUID)) {
  187. platform_err = 1;
  188. LOG_INDEX_ADD_SECT_PTR(slidx->mem_dev_err, sp);
  189. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_SEL_DEV_ERR_SECT_GUID)) {
  190. platform_err = 1;
  191. LOG_INDEX_ADD_SECT_PTR(slidx->sel_dev_err, sp);
  192. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_PCI_BUS_ERR_SECT_GUID)) {
  193. platform_err = 1;
  194. LOG_INDEX_ADD_SECT_PTR(slidx->pci_bus_err, sp);
  195. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID)) {
  196. platform_err = 1;
  197. LOG_INDEX_ADD_SECT_PTR(slidx->smbios_dev_err, sp);
  198. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_PCI_COMP_ERR_SECT_GUID)) {
  199. platform_err = 1;
  200. LOG_INDEX_ADD_SECT_PTR(slidx->pci_comp_err, sp);
  201. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_SPECIFIC_ERR_SECT_GUID)) {
  202. platform_err = 1;
  203. LOG_INDEX_ADD_SECT_PTR(slidx->plat_specific_err, sp);
  204. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_HOST_CTLR_ERR_SECT_GUID)) {
  205. platform_err = 1;
  206. LOG_INDEX_ADD_SECT_PTR(slidx->host_ctlr_err, sp);
  207. } else if (!efi_guidcmp(sp->guid, SAL_PLAT_BUS_ERR_SECT_GUID)) {
  208. platform_err = 1;
  209. LOG_INDEX_ADD_SECT_PTR(slidx->plat_bus_err, sp);
  210. } else {
  211. LOG_INDEX_ADD_SECT_PTR(slidx->unsupported, sp);
  212. }
  213. }
  214. slidx->n_sections = sects;
  215. return platform_err;
  216. }
  217. /**
  218. * init_record_index_pools - Initialize pool of lists for SAL record index
  219. *
  220. * Return value:
  221. * 0 on Success / -ENOMEM on Failure
  222. */
  223. static int
  224. init_record_index_pools(void)
  225. {
  226. int i;
  227. int rec_max_size; /* Maximum size of SAL error records */
  228. int sect_min_size; /* Minimum size of SAL error sections */
  229. /* minimum size table of each section */
  230. static int sal_log_sect_min_sizes[] = {
  231. sizeof(sal_log_processor_info_t) + sizeof(sal_processor_static_info_t),
  232. sizeof(sal_log_mem_dev_err_info_t),
  233. sizeof(sal_log_sel_dev_err_info_t),
  234. sizeof(sal_log_pci_bus_err_info_t),
  235. sizeof(sal_log_smbios_dev_err_info_t),
  236. sizeof(sal_log_pci_comp_err_info_t),
  237. sizeof(sal_log_plat_specific_err_info_t),
  238. sizeof(sal_log_host_ctlr_err_info_t),
  239. sizeof(sal_log_plat_bus_err_info_t),
  240. };
  241. /*
  242. * MCA handler cannot allocate new memory on flight,
  243. * so we preallocate enough memory to handle a SAL record.
  244. *
  245. * Initialize a handling set of slidx_pool:
  246. * 1. Pick up the max size of SAL error records
  247. * 2. Pick up the min size of SAL error sections
  248. * 3. Allocate the pool as enough to 2 SAL records
  249. * (now we can estimate the maxinum of section in a record.)
  250. */
  251. /* - 1 - */
  252. rec_max_size = sal_rec_max;
  253. /* - 2 - */
  254. sect_min_size = sal_log_sect_min_sizes[0];
  255. for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++)
  256. if (sect_min_size > sal_log_sect_min_sizes[i])
  257. sect_min_size = sal_log_sect_min_sizes[i];
  258. /* - 3 - */
  259. slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1;
  260. slidx_pool.buffer = (slidx_list_t *) kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL);
  261. return slidx_pool.buffer ? 0 : -ENOMEM;
  262. }
  263. /*****************************************************************************
  264. * Recovery functions *
  265. *****************************************************************************/
  266. /**
  267. * is_mca_global - Check whether this MCA is global or not
  268. * @peidx: pointer of index of processor error section
  269. * @pbci: pointer to pal_bus_check_info_t
  270. *
  271. * Return value:
  272. * MCA_IS_LOCAL / MCA_IS_GLOBAL
  273. */
  274. static mca_type_t
  275. is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci)
  276. {
  277. pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
  278. /*
  279. * PAL can request a rendezvous, if the MCA has a global scope.
  280. * If "rz_always" flag is set, SAL requests MCA rendezvous
  281. * in spite of global MCA.
  282. * Therefore it is local MCA when rendezvous has not been requested.
  283. * Failed to rendezvous, the system must be down.
  284. */
  285. switch (sal_to_os_handoff_state->imsto_rendez_state) {
  286. case -1: /* SAL rendezvous unsuccessful */
  287. return MCA_IS_GLOBAL;
  288. case 0: /* SAL rendezvous not required */
  289. return MCA_IS_LOCAL;
  290. case 1: /* SAL rendezvous successful int */
  291. case 2: /* SAL rendezvous successful int with init */
  292. default:
  293. break;
  294. }
  295. /*
  296. * If One or more Cache/TLB/Reg_File/Uarch_Check is here,
  297. * it would be a local MCA. (i.e. processor internal error)
  298. */
  299. if (psp->tc || psp->cc || psp->rc || psp->uc)
  300. return MCA_IS_LOCAL;
  301. /*
  302. * Bus_Check structure with Bus_Check.ib (internal bus error) flag set
  303. * would be a global MCA. (e.g. a system bus address parity error)
  304. */
  305. if (!pbci || pbci->ib)
  306. return MCA_IS_GLOBAL;
  307. /*
  308. * Bus_Check structure with Bus_Check.eb (external bus error) flag set
  309. * could be either a local MCA or a global MCA.
  310. *
  311. * Referring Bus_Check.bsi:
  312. * 0: Unknown/unclassified
  313. * 1: BERR#
  314. * 2: BINIT#
  315. * 3: Hard Fail
  316. * (FIXME: Are these SGI specific or generic bsi values?)
  317. */
  318. if (pbci->eb)
  319. switch (pbci->bsi) {
  320. case 0:
  321. /* e.g. a load from poisoned memory */
  322. return MCA_IS_LOCAL;
  323. case 1:
  324. case 2:
  325. case 3:
  326. return MCA_IS_GLOBAL;
  327. }
  328. return MCA_IS_GLOBAL;
  329. }
  330. /**
  331. * recover_from_read_error - Try to recover the errors which type are "read"s.
  332. * @slidx: pointer of index of SAL error record
  333. * @peidx: pointer of index of processor error section
  334. * @pbci: pointer of pal_bus_check_info
  335. *
  336. * Return value:
  337. * 1 on Success / 0 on Failure
  338. */
  339. static int
  340. recover_from_read_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci)
  341. {
  342. sal_log_mod_error_info_t *smei;
  343. pal_min_state_area_t *pmsa;
  344. struct ia64_psr *psr1, *psr2;
  345. ia64_fptr_t *mca_hdlr_bh = (ia64_fptr_t*)mca_handler_bhhook;
  346. /* Is target address valid? */
  347. if (!pbci->tv)
  348. return 0;
  349. /*
  350. * cpu read or memory-mapped io read
  351. *
  352. * offending process affected process OS MCA do
  353. * kernel mode kernel mode down system
  354. * kernel mode user mode kill the process
  355. * user mode kernel mode down system (*)
  356. * user mode user mode kill the process
  357. *
  358. * (*) You could terminate offending user-mode process
  359. * if (pbci->pv && pbci->pl != 0) *and* if you sure
  360. * the process not have any locks of kernel.
  361. */
  362. psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr);
  363. /*
  364. * Check the privilege level of interrupted context.
  365. * If it is user-mode, then terminate affected process.
  366. */
  367. if (psr1->cpl != 0) {
  368. smei = peidx_bus_check(peidx, 0);
  369. if (smei->valid.target_identifier) {
  370. /*
  371. * setup for resume to bottom half of MCA,
  372. * "mca_handler_bhhook"
  373. */
  374. pmsa = (pal_min_state_area_t *)(sal_to_os_handoff_state->pal_min_state | (6ul<<61));
  375. /* pass to bhhook as 1st argument (gr8) */
  376. pmsa->pmsa_gr[8-1] = smei->target_identifier;
  377. /* set interrupted return address (but no use) */
  378. pmsa->pmsa_br0 = pmsa->pmsa_iip;
  379. /* change resume address to bottom half */
  380. pmsa->pmsa_iip = mca_hdlr_bh->fp;
  381. pmsa->pmsa_gr[1-1] = mca_hdlr_bh->gp;
  382. /* set cpl with kernel mode */
  383. psr2 = (struct ia64_psr *)&pmsa->pmsa_ipsr;
  384. psr2->cpl = 0;
  385. psr2->ri = 0;
  386. psr2->i = 0;
  387. return 1;
  388. }
  389. }
  390. return 0;
  391. }
  392. /**
  393. * recover_from_platform_error - Recover from platform error.
  394. * @slidx: pointer of index of SAL error record
  395. * @peidx: pointer of index of processor error section
  396. * @pbci: pointer of pal_bus_check_info
  397. *
  398. * Return value:
  399. * 1 on Success / 0 on Failure
  400. */
  401. static int
  402. recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci)
  403. {
  404. int status = 0;
  405. pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
  406. if (psp->bc && pbci->eb && pbci->bsi == 0) {
  407. switch(pbci->type) {
  408. case 1: /* partial read */
  409. case 3: /* full line(cpu) read */
  410. case 9: /* I/O space read */
  411. status = recover_from_read_error(slidx, peidx, pbci);
  412. break;
  413. case 0: /* unknown */
  414. case 2: /* partial write */
  415. case 4: /* full line write */
  416. case 5: /* implicit or explicit write-back operation */
  417. case 6: /* snoop probe */
  418. case 7: /* incoming or outgoing ptc.g */
  419. case 8: /* write coalescing transactions */
  420. case 10: /* I/O space write */
  421. case 11: /* inter-processor interrupt message(IPI) */
  422. case 12: /* interrupt acknowledge or external task priority cycle */
  423. default:
  424. break;
  425. }
  426. }
  427. return status;
  428. }
  429. /**
  430. * recover_from_processor_error
  431. * @platform: whether there are some platform error section or not
  432. * @slidx: pointer of index of SAL error record
  433. * @peidx: pointer of index of processor error section
  434. * @pbci: pointer of pal_bus_check_info
  435. *
  436. * Return value:
  437. * 1 on Success / 0 on Failure
  438. */
  439. /*
  440. * Later we try to recover when below all conditions are satisfied.
  441. * 1. Only one processor error section is exist.
  442. * 2. BUS_CHECK is exist and the others are not exist.(Except TLB_CHECK)
  443. * 3. The entry of BUS_CHECK_INFO is 1.
  444. * 4. "External bus error" flag is set and the others are not set.
  445. */
  446. static int
  447. recover_from_processor_error(int platform, slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci)
  448. {
  449. pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
  450. /*
  451. * We cannot recover errors with other than bus_check.
  452. */
  453. if (psp->cc || psp->rc || psp->uc)
  454. return 0;
  455. /*
  456. * If there is no bus error, record is weird but we need not to recover.
  457. */
  458. if (psp->bc == 0 || pbci == NULL)
  459. return 1;
  460. /*
  461. * Sorry, we cannot handle so many.
  462. */
  463. if (peidx_bus_check_num(peidx) > 1)
  464. return 0;
  465. /*
  466. * Well, here is only one bus error.
  467. */
  468. if (pbci->ib || pbci->cc)
  469. return 0;
  470. if (pbci->eb && pbci->bsi > 0)
  471. return 0;
  472. if (psp->ci == 0)
  473. return 0;
  474. /*
  475. * This is a local MCA and estimated as recoverble external bus error.
  476. * (e.g. a load from poisoned memory)
  477. * This means "there are some platform errors".
  478. */
  479. if (platform)
  480. return recover_from_platform_error(slidx, peidx, pbci);
  481. /*
  482. * On account of strange SAL error record, we cannot recover.
  483. */
  484. return 0;
  485. }
  486. /**
  487. * mca_try_to_recover - Try to recover from MCA
  488. * @rec: pointer to a SAL error record
  489. *
  490. * Return value:
  491. * 1 on Success / 0 on Failure
  492. */
  493. static int
  494. mca_try_to_recover(void *rec,
  495. ia64_mca_sal_to_os_state_t *sal_to_os_state,
  496. ia64_mca_os_to_sal_state_t *os_to_sal_state)
  497. {
  498. int platform_err;
  499. int n_proc_err;
  500. slidx_table_t slidx;
  501. peidx_table_t peidx;
  502. pal_bus_check_info_t pbci;
  503. /* handoff state from/to mca.c */
  504. sal_to_os_handoff_state = sal_to_os_state;
  505. os_to_sal_handoff_state = os_to_sal_state;
  506. /* Make index of SAL error record */
  507. platform_err = mca_make_slidx(rec, &slidx);
  508. /* Count processor error sections */
  509. n_proc_err = slidx_count(&slidx, proc_err);
  510. /* Now, OS can recover when there is one processor error section */
  511. if (n_proc_err > 1)
  512. return 0;
  513. else if (n_proc_err == 0) {
  514. /* Weird SAL record ... We need not to recover */
  515. return 1;
  516. }
  517. /* Make index of processor error section */
  518. mca_make_peidx((sal_log_processor_info_t*)slidx_first_entry(&slidx.proc_err)->hdr, &peidx);
  519. /* Extract Processor BUS_CHECK[0] */
  520. *((u64*)&pbci) = peidx_check_info(&peidx, bus_check, 0);
  521. /* Check whether MCA is global or not */
  522. if (is_mca_global(&peidx, &pbci))
  523. return 0;
  524. /* Try to recover a processor error */
  525. return recover_from_processor_error(platform_err, &slidx, &peidx, &pbci);
  526. }
  527. /*
  528. * =============================================================================
  529. */
  530. int __init mca_external_handler_init(void)
  531. {
  532. if (init_record_index_pools())
  533. return -ENOMEM;
  534. /* register external mca handlers */
  535. if (ia64_reg_MCA_extension(mca_try_to_recover)){
  536. printk(KERN_ERR "ia64_reg_MCA_extension failed.\n");
  537. kfree(slidx_pool.buffer);
  538. return -EFAULT;
  539. }
  540. return 0;
  541. }
  542. void __exit mca_external_handler_exit(void)
  543. {
  544. /* unregister external mca handlers */
  545. ia64_unreg_MCA_extension();
  546. kfree(slidx_pool.buffer);
  547. }
  548. module_init(mca_external_handler_init);
  549. module_exit(mca_external_handler_exit);
  550. module_param(sal_rec_max, int, 0644);
  551. MODULE_PARM_DESC(sal_rec_max, "Max size of SAL error record");
  552. MODULE_DESCRIPTION("ia64 platform dependent mca handler driver");
  553. MODULE_LICENSE("GPL");