err_titan.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. /*
  2. * linux/arch/alpha/kernel/err_titan.c
  3. *
  4. * Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation)
  5. *
  6. * Error handling code supporting TITAN systems
  7. */
  8. #include <linux/init.h>
  9. #include <linux/pci.h>
  10. #include <linux/sched.h>
  11. #include <asm/io.h>
  12. #include <asm/core_titan.h>
  13. #include <asm/hwrpb.h>
  14. #include <asm/smp.h>
  15. #include <asm/err_common.h>
  16. #include <asm/err_ev6.h>
  17. #include <asm/irq_regs.h>
  18. #include "err_impl.h"
  19. #include "proto.h"
  20. static int
  21. titan_parse_c_misc(u64 c_misc, int print)
  22. {
  23. #ifdef CONFIG_VERBOSE_MCHECK
  24. char *src;
  25. int nxs = 0;
  26. #endif
  27. int status = MCHK_DISPOSITION_REPORT;
  28. #define TITAN__CCHIP_MISC__NXM (1UL << 28)
  29. #define TITAN__CCHIP_MISC__NXS__S (29)
  30. #define TITAN__CCHIP_MISC__NXS__M (0x7)
  31. if (!(c_misc & TITAN__CCHIP_MISC__NXM))
  32. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  33. #ifdef CONFIG_VERBOSE_MCHECK
  34. if (!print)
  35. return status;
  36. nxs = EXTRACT(c_misc, TITAN__CCHIP_MISC__NXS);
  37. switch(nxs) {
  38. case 0: /* CPU 0 */
  39. case 1: /* CPU 1 */
  40. case 2: /* CPU 2 */
  41. case 3: /* CPU 3 */
  42. src = "CPU";
  43. /* num is already the CPU number */
  44. break;
  45. case 4: /* Pchip 0 */
  46. case 5: /* Pchip 1 */
  47. src = "Pchip";
  48. nxs -= 4;
  49. break;
  50. default:/* reserved */
  51. src = "Unknown, NXS =";
  52. /* leave num untouched */
  53. break;
  54. }
  55. printk("%s Non-existent memory access from: %s %d\n",
  56. err_print_prefix, src, nxs);
  57. #endif /* CONFIG_VERBOSE_MCHECK */
  58. return status;
  59. }
  60. static int
  61. titan_parse_p_serror(int which, u64 serror, int print)
  62. {
  63. int status = MCHK_DISPOSITION_REPORT;
  64. #ifdef CONFIG_VERBOSE_MCHECK
  65. static const char * const serror_src[] = {
  66. "GPCI", "APCI", "AGP HP", "AGP LP"
  67. };
  68. static const char * const serror_cmd[] = {
  69. "DMA Read", "DMA RMW", "SGTE Read", "Reserved"
  70. };
  71. #endif /* CONFIG_VERBOSE_MCHECK */
  72. #define TITAN__PCHIP_SERROR__LOST_UECC (1UL << 0)
  73. #define TITAN__PCHIP_SERROR__UECC (1UL << 1)
  74. #define TITAN__PCHIP_SERROR__CRE (1UL << 2)
  75. #define TITAN__PCHIP_SERROR__NXIO (1UL << 3)
  76. #define TITAN__PCHIP_SERROR__LOST_CRE (1UL << 4)
  77. #define TITAN__PCHIP_SERROR__ECCMASK (TITAN__PCHIP_SERROR__UECC | \
  78. TITAN__PCHIP_SERROR__CRE)
  79. #define TITAN__PCHIP_SERROR__ERRMASK (TITAN__PCHIP_SERROR__LOST_UECC | \
  80. TITAN__PCHIP_SERROR__UECC | \
  81. TITAN__PCHIP_SERROR__CRE | \
  82. TITAN__PCHIP_SERROR__NXIO | \
  83. TITAN__PCHIP_SERROR__LOST_CRE)
  84. #define TITAN__PCHIP_SERROR__SRC__S (52)
  85. #define TITAN__PCHIP_SERROR__SRC__M (0x3)
  86. #define TITAN__PCHIP_SERROR__CMD__S (54)
  87. #define TITAN__PCHIP_SERROR__CMD__M (0x3)
  88. #define TITAN__PCHIP_SERROR__SYN__S (56)
  89. #define TITAN__PCHIP_SERROR__SYN__M (0xff)
  90. #define TITAN__PCHIP_SERROR__ADDR__S (15)
  91. #define TITAN__PCHIP_SERROR__ADDR__M (0xffffffffUL)
  92. if (!(serror & TITAN__PCHIP_SERROR__ERRMASK))
  93. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  94. #ifdef CONFIG_VERBOSE_MCHECK
  95. if (!print)
  96. return status;
  97. printk("%s PChip %d SERROR: %016llx\n",
  98. err_print_prefix, which, serror);
  99. if (serror & TITAN__PCHIP_SERROR__ECCMASK) {
  100. printk("%s %sorrectable ECC Error:\n"
  101. " Source: %-6s Command: %-8s Syndrome: 0x%08x\n"
  102. " Address: 0x%llx\n",
  103. err_print_prefix,
  104. (serror & TITAN__PCHIP_SERROR__UECC) ? "Unc" : "C",
  105. serror_src[EXTRACT(serror, TITAN__PCHIP_SERROR__SRC)],
  106. serror_cmd[EXTRACT(serror, TITAN__PCHIP_SERROR__CMD)],
  107. (unsigned)EXTRACT(serror, TITAN__PCHIP_SERROR__SYN),
  108. EXTRACT(serror, TITAN__PCHIP_SERROR__ADDR));
  109. }
  110. if (serror & TITAN__PCHIP_SERROR__NXIO)
  111. printk("%s Non Existent I/O Error\n", err_print_prefix);
  112. if (serror & TITAN__PCHIP_SERROR__LOST_UECC)
  113. printk("%s Lost Uncorrectable ECC Error\n",
  114. err_print_prefix);
  115. if (serror & TITAN__PCHIP_SERROR__LOST_CRE)
  116. printk("%s Lost Correctable ECC Error\n", err_print_prefix);
  117. #endif /* CONFIG_VERBOSE_MCHECK */
  118. return status;
  119. }
  120. static int
  121. titan_parse_p_perror(int which, int port, u64 perror, int print)
  122. {
  123. int cmd;
  124. unsigned long addr;
  125. int status = MCHK_DISPOSITION_REPORT;
  126. #ifdef CONFIG_VERBOSE_MCHECK
  127. static const char * const perror_cmd[] = {
  128. "Interrupt Acknowledge", "Special Cycle",
  129. "I/O Read", "I/O Write",
  130. "Reserved", "Reserved",
  131. "Memory Read", "Memory Write",
  132. "Reserved", "Reserved",
  133. "Configuration Read", "Configuration Write",
  134. "Memory Read Multiple", "Dual Address Cycle",
  135. "Memory Read Line", "Memory Write and Invalidate"
  136. };
  137. #endif /* CONFIG_VERBOSE_MCHECK */
  138. #define TITAN__PCHIP_PERROR__LOST (1UL << 0)
  139. #define TITAN__PCHIP_PERROR__SERR (1UL << 1)
  140. #define TITAN__PCHIP_PERROR__PERR (1UL << 2)
  141. #define TITAN__PCHIP_PERROR__DCRTO (1UL << 3)
  142. #define TITAN__PCHIP_PERROR__SGE (1UL << 4)
  143. #define TITAN__PCHIP_PERROR__APE (1UL << 5)
  144. #define TITAN__PCHIP_PERROR__TA (1UL << 6)
  145. #define TITAN__PCHIP_PERROR__DPE (1UL << 7)
  146. #define TITAN__PCHIP_PERROR__NDS (1UL << 8)
  147. #define TITAN__PCHIP_PERROR__IPTPR (1UL << 9)
  148. #define TITAN__PCHIP_PERROR__IPTPW (1UL << 10)
  149. #define TITAN__PCHIP_PERROR__ERRMASK (TITAN__PCHIP_PERROR__LOST | \
  150. TITAN__PCHIP_PERROR__SERR | \
  151. TITAN__PCHIP_PERROR__PERR | \
  152. TITAN__PCHIP_PERROR__DCRTO | \
  153. TITAN__PCHIP_PERROR__SGE | \
  154. TITAN__PCHIP_PERROR__APE | \
  155. TITAN__PCHIP_PERROR__TA | \
  156. TITAN__PCHIP_PERROR__DPE | \
  157. TITAN__PCHIP_PERROR__NDS | \
  158. TITAN__PCHIP_PERROR__IPTPR | \
  159. TITAN__PCHIP_PERROR__IPTPW)
  160. #define TITAN__PCHIP_PERROR__DAC (1UL << 47)
  161. #define TITAN__PCHIP_PERROR__MWIN (1UL << 48)
  162. #define TITAN__PCHIP_PERROR__CMD__S (52)
  163. #define TITAN__PCHIP_PERROR__CMD__M (0x0f)
  164. #define TITAN__PCHIP_PERROR__ADDR__S (14)
  165. #define TITAN__PCHIP_PERROR__ADDR__M (0x1fffffffful)
  166. if (!(perror & TITAN__PCHIP_PERROR__ERRMASK))
  167. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  168. cmd = EXTRACT(perror, TITAN__PCHIP_PERROR__CMD);
  169. addr = EXTRACT(perror, TITAN__PCHIP_PERROR__ADDR) << 2;
  170. /*
  171. * Initializing the BIOS on a video card on a bus without
  172. * a south bridge (subtractive decode agent) can result in
  173. * master aborts as the BIOS probes the capabilities of the
  174. * card. XFree86 does such initialization. If the error
  175. * is a master abort (No DevSel as PCI Master) and the command
  176. * is an I/O read or write below the address where we start
  177. * assigning PCI I/O spaces (SRM uses 0x1000), then mark the
  178. * error as dismissable so starting XFree86 doesn't result
  179. * in a series of uncorrectable errors being reported. Also
  180. * dismiss master aborts to VGA frame buffer space
  181. * (0xA0000 - 0xC0000) and legacy BIOS space (0xC0000 - 0x100000)
  182. * for the same reason.
  183. *
  184. * Also mark the error dismissible if it looks like the right
  185. * error but only the Lost bit is set. Since the BIOS initialization
  186. * can cause multiple master aborts and the error interrupt can
  187. * be handled on a different CPU than the BIOS code is run on,
  188. * it is possible for a second master abort to occur between the
  189. * time the PALcode reads PERROR and the time it writes PERROR
  190. * to acknowledge the error. If this timing happens, a second
  191. * error will be signalled after the first, and if no additional
  192. * errors occur, will look like a Lost error with no additional
  193. * errors on the same transaction as the previous error.
  194. */
  195. if (((perror & TITAN__PCHIP_PERROR__NDS) ||
  196. ((perror & TITAN__PCHIP_PERROR__ERRMASK) ==
  197. TITAN__PCHIP_PERROR__LOST)) &&
  198. ((((cmd & 0xE) == 2) && (addr < 0x1000)) ||
  199. (((cmd & 0xE) == 6) && (addr >= 0xA0000) && (addr < 0x100000)))) {
  200. status = MCHK_DISPOSITION_DISMISS;
  201. }
  202. #ifdef CONFIG_VERBOSE_MCHECK
  203. if (!print)
  204. return status;
  205. printk("%s PChip %d %cPERROR: %016llx\n",
  206. err_print_prefix, which,
  207. port ? 'A' : 'G', perror);
  208. if (perror & TITAN__PCHIP_PERROR__IPTPW)
  209. printk("%s Invalid Peer-to-Peer Write\n", err_print_prefix);
  210. if (perror & TITAN__PCHIP_PERROR__IPTPR)
  211. printk("%s Invalid Peer-to-Peer Read\n", err_print_prefix);
  212. if (perror & TITAN__PCHIP_PERROR__NDS)
  213. printk("%s No DEVSEL as PCI Master [Master Abort]\n",
  214. err_print_prefix);
  215. if (perror & TITAN__PCHIP_PERROR__DPE)
  216. printk("%s Data Parity Error\n", err_print_prefix);
  217. if (perror & TITAN__PCHIP_PERROR__TA)
  218. printk("%s Target Abort\n", err_print_prefix);
  219. if (perror & TITAN__PCHIP_PERROR__APE)
  220. printk("%s Address Parity Error\n", err_print_prefix);
  221. if (perror & TITAN__PCHIP_PERROR__SGE)
  222. printk("%s Scatter-Gather Error, Invalid PTE\n",
  223. err_print_prefix);
  224. if (perror & TITAN__PCHIP_PERROR__DCRTO)
  225. printk("%s Delayed-Completion Retry Timeout\n",
  226. err_print_prefix);
  227. if (perror & TITAN__PCHIP_PERROR__PERR)
  228. printk("%s PERR Asserted\n", err_print_prefix);
  229. if (perror & TITAN__PCHIP_PERROR__SERR)
  230. printk("%s SERR Asserted\n", err_print_prefix);
  231. if (perror & TITAN__PCHIP_PERROR__LOST)
  232. printk("%s Lost Error\n", err_print_prefix);
  233. printk("%s Command: 0x%x - %s\n"
  234. " Address: 0x%lx\n",
  235. err_print_prefix,
  236. cmd, perror_cmd[cmd],
  237. addr);
  238. if (perror & TITAN__PCHIP_PERROR__DAC)
  239. printk("%s Dual Address Cycle\n", err_print_prefix);
  240. if (perror & TITAN__PCHIP_PERROR__MWIN)
  241. printk("%s Hit in Monster Window\n", err_print_prefix);
  242. #endif /* CONFIG_VERBOSE_MCHECK */
  243. return status;
  244. }
  245. static int
  246. titan_parse_p_agperror(int which, u64 agperror, int print)
  247. {
  248. int status = MCHK_DISPOSITION_REPORT;
  249. #ifdef CONFIG_VERBOSE_MCHECK
  250. int cmd, len;
  251. unsigned long addr;
  252. static const char * const agperror_cmd[] = {
  253. "Read (low-priority)", "Read (high-priority)",
  254. "Write (low-priority)", "Write (high-priority)",
  255. "Reserved", "Reserved",
  256. "Flush", "Fence"
  257. };
  258. #endif /* CONFIG_VERBOSE_MCHECK */
  259. #define TITAN__PCHIP_AGPERROR__LOST (1UL << 0)
  260. #define TITAN__PCHIP_AGPERROR__LPQFULL (1UL << 1)
  261. #define TITAN__PCHIP_AGPERROR__HPQFULL (1UL << 2)
  262. #define TITAN__PCHIP_AGPERROR__RESCMD (1UL << 3)
  263. #define TITAN__PCHIP_AGPERROR__IPTE (1UL << 4)
  264. #define TITAN__PCHIP_AGPERROR__PTP (1UL << 5)
  265. #define TITAN__PCHIP_AGPERROR__NOWINDOW (1UL << 6)
  266. #define TITAN__PCHIP_AGPERROR__ERRMASK (TITAN__PCHIP_AGPERROR__LOST | \
  267. TITAN__PCHIP_AGPERROR__LPQFULL | \
  268. TITAN__PCHIP_AGPERROR__HPQFULL | \
  269. TITAN__PCHIP_AGPERROR__RESCMD | \
  270. TITAN__PCHIP_AGPERROR__IPTE | \
  271. TITAN__PCHIP_AGPERROR__PTP | \
  272. TITAN__PCHIP_AGPERROR__NOWINDOW)
  273. #define TITAN__PCHIP_AGPERROR__DAC (1UL << 48)
  274. #define TITAN__PCHIP_AGPERROR__MWIN (1UL << 49)
  275. #define TITAN__PCHIP_AGPERROR__FENCE (1UL << 59)
  276. #define TITAN__PCHIP_AGPERROR__CMD__S (50)
  277. #define TITAN__PCHIP_AGPERROR__CMD__M (0x07)
  278. #define TITAN__PCHIP_AGPERROR__ADDR__S (15)
  279. #define TITAN__PCHIP_AGPERROR__ADDR__M (0xffffffffUL)
  280. #define TITAN__PCHIP_AGPERROR__LEN__S (53)
  281. #define TITAN__PCHIP_AGPERROR__LEN__M (0x3f)
  282. if (!(agperror & TITAN__PCHIP_AGPERROR__ERRMASK))
  283. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  284. #ifdef CONFIG_VERBOSE_MCHECK
  285. if (!print)
  286. return status;
  287. cmd = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__CMD);
  288. addr = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__ADDR) << 3;
  289. len = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__LEN);
  290. printk("%s PChip %d AGPERROR: %016llx\n", err_print_prefix,
  291. which, agperror);
  292. if (agperror & TITAN__PCHIP_AGPERROR__NOWINDOW)
  293. printk("%s No Window\n", err_print_prefix);
  294. if (agperror & TITAN__PCHIP_AGPERROR__PTP)
  295. printk("%s Peer-to-Peer set\n", err_print_prefix);
  296. if (agperror & TITAN__PCHIP_AGPERROR__IPTE)
  297. printk("%s Invalid PTE\n", err_print_prefix);
  298. if (agperror & TITAN__PCHIP_AGPERROR__RESCMD)
  299. printk("%s Reserved Command\n", err_print_prefix);
  300. if (agperror & TITAN__PCHIP_AGPERROR__HPQFULL)
  301. printk("%s HP Transaction Received while Queue Full\n",
  302. err_print_prefix);
  303. if (agperror & TITAN__PCHIP_AGPERROR__LPQFULL)
  304. printk("%s LP Transaction Received while Queue Full\n",
  305. err_print_prefix);
  306. if (agperror & TITAN__PCHIP_AGPERROR__LOST)
  307. printk("%s Lost Error\n", err_print_prefix);
  308. printk("%s Command: 0x%x - %s, %d Quadwords%s\n"
  309. " Address: 0x%lx\n",
  310. err_print_prefix, cmd, agperror_cmd[cmd], len,
  311. (agperror & TITAN__PCHIP_AGPERROR__FENCE) ? ", FENCE" : "",
  312. addr);
  313. if (agperror & TITAN__PCHIP_AGPERROR__DAC)
  314. printk("%s Dual Address Cycle\n", err_print_prefix);
  315. if (agperror & TITAN__PCHIP_AGPERROR__MWIN)
  316. printk("%s Hit in Monster Window\n", err_print_prefix);
  317. #endif /* CONFIG_VERBOSE_MCHECK */
  318. return status;
  319. }
  320. static int
  321. titan_parse_p_chip(int which, u64 serror, u64 gperror,
  322. u64 aperror, u64 agperror, int print)
  323. {
  324. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  325. status |= titan_parse_p_serror(which, serror, print);
  326. status |= titan_parse_p_perror(which, 0, gperror, print);
  327. status |= titan_parse_p_perror(which, 1, aperror, print);
  328. status |= titan_parse_p_agperror(which, agperror, print);
  329. return status;
  330. }
  331. int
  332. titan_process_logout_frame(struct el_common *mchk_header, int print)
  333. {
  334. struct el_TITAN_sysdata_mcheck *tmchk =
  335. (struct el_TITAN_sysdata_mcheck *)
  336. ((unsigned long)mchk_header + mchk_header->sys_offset);
  337. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  338. status |= titan_parse_c_misc(tmchk->c_misc, print);
  339. status |= titan_parse_p_chip(0, tmchk->p0_serror, tmchk->p0_gperror,
  340. tmchk->p0_aperror, tmchk->p0_agperror,
  341. print);
  342. status |= titan_parse_p_chip(1, tmchk->p1_serror, tmchk->p1_gperror,
  343. tmchk->p1_aperror, tmchk->p1_agperror,
  344. print);
  345. return status;
  346. }
  347. void
  348. titan_machine_check(unsigned long vector, unsigned long la_ptr)
  349. {
  350. struct el_common *mchk_header = (struct el_common *)la_ptr;
  351. struct el_TITAN_sysdata_mcheck *tmchk =
  352. (struct el_TITAN_sysdata_mcheck *)
  353. ((unsigned long)mchk_header + mchk_header->sys_offset);
  354. u64 irqmask;
  355. /*
  356. * Mask of Titan interrupt sources which are reported as machine checks
  357. *
  358. * 63 - CChip Error
  359. * 62 - PChip 0 H_Error
  360. * 61 - PChip 1 H_Error
  361. * 60 - PChip 0 C_Error
  362. * 59 - PChip 1 C_Error
  363. */
  364. #define TITAN_MCHECK_INTERRUPT_MASK 0xF800000000000000UL
  365. /*
  366. * Sync the processor
  367. */
  368. mb();
  369. draina();
  370. /*
  371. * Only handle system errors here
  372. */
  373. if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) {
  374. ev6_machine_check(vector, la_ptr);
  375. return;
  376. }
  377. /*
  378. * It's a system error, handle it here
  379. *
  380. * The PALcode has already cleared the error, so just parse it
  381. */
  382. /*
  383. * Parse the logout frame without printing first. If the only error(s)
  384. * found are classified as "dismissable", then just dismiss them and
  385. * don't print any message
  386. */
  387. if (titan_process_logout_frame(mchk_header, 0) !=
  388. MCHK_DISPOSITION_DISMISS) {
  389. char *saved_err_prefix = err_print_prefix;
  390. err_print_prefix = KERN_CRIT;
  391. /*
  392. * Either a nondismissable error was detected or no
  393. * recognized error was detected in the logout frame
  394. * -- report the error in either case
  395. */
  396. printk("%s"
  397. "*System %s Error (Vector 0x%x) reported on CPU %d:\n",
  398. err_print_prefix,
  399. (vector == SCB_Q_SYSERR)?"Correctable":"Uncorrectable",
  400. (unsigned int)vector, (int)smp_processor_id());
  401. #ifdef CONFIG_VERBOSE_MCHECK
  402. titan_process_logout_frame(mchk_header, alpha_verbose_mcheck);
  403. if (alpha_verbose_mcheck)
  404. dik_show_regs(get_irq_regs(), NULL);
  405. #endif /* CONFIG_VERBOSE_MCHECK */
  406. err_print_prefix = saved_err_prefix;
  407. /*
  408. * Convert any pending interrupts which report as system
  409. * machine checks to interrupts
  410. */
  411. irqmask = tmchk->c_dirx & TITAN_MCHECK_INTERRUPT_MASK;
  412. titan_dispatch_irqs(irqmask);
  413. }
  414. /*
  415. * Release the logout frame
  416. */
  417. wrmces(0x7);
  418. mb();
  419. }
  420. /*
  421. * Subpacket Annotations
  422. */
  423. static char *el_titan_pchip0_extended_annotation[] = {
  424. "Subpacket Header", "P0_SCTL", "P0_SERREN",
  425. "P0_APCTL", "P0_APERREN", "P0_AGPERREN",
  426. "P0_ASPRST", "P0_AWSBA0", "P0_AWSBA1",
  427. "P0_AWSBA2", "P0_AWSBA3", "P0_AWSM0",
  428. "P0_AWSM1", "P0_AWSM2", "P0_AWSM3",
  429. "P0_ATBA0", "P0_ATBA1", "P0_ATBA2",
  430. "P0_ATBA3", "P0_GPCTL", "P0_GPERREN",
  431. "P0_GSPRST", "P0_GWSBA0", "P0_GWSBA1",
  432. "P0_GWSBA2", "P0_GWSBA3", "P0_GWSM0",
  433. "P0_GWSM1", "P0_GWSM2", "P0_GWSM3",
  434. "P0_GTBA0", "P0_GTBA1", "P0_GTBA2",
  435. "P0_GTBA3", NULL
  436. };
  437. static char *el_titan_pchip1_extended_annotation[] = {
  438. "Subpacket Header", "P1_SCTL", "P1_SERREN",
  439. "P1_APCTL", "P1_APERREN", "P1_AGPERREN",
  440. "P1_ASPRST", "P1_AWSBA0", "P1_AWSBA1",
  441. "P1_AWSBA2", "P1_AWSBA3", "P1_AWSM0",
  442. "P1_AWSM1", "P1_AWSM2", "P1_AWSM3",
  443. "P1_ATBA0", "P1_ATBA1", "P1_ATBA2",
  444. "P1_ATBA3", "P1_GPCTL", "P1_GPERREN",
  445. "P1_GSPRST", "P1_GWSBA0", "P1_GWSBA1",
  446. "P1_GWSBA2", "P1_GWSBA3", "P1_GWSM0",
  447. "P1_GWSM1", "P1_GWSM2", "P1_GWSM3",
  448. "P1_GTBA0", "P1_GTBA1", "P1_GTBA2",
  449. "P1_GTBA3", NULL
  450. };
  451. static char *el_titan_memory_extended_annotation[] = {
  452. "Subpacket Header", "AAR0", "AAR1",
  453. "AAR2", "AAR3", "P0_SCTL",
  454. "P0_GPCTL", "P0_APCTL", "P1_SCTL",
  455. "P1_GPCTL", "P1_SCTL", NULL
  456. };
  457. static struct el_subpacket_annotation el_titan_annotations[] = {
  458. SUBPACKET_ANNOTATION(EL_CLASS__REGATTA_FAMILY,
  459. EL_TYPE__REGATTA__TITAN_PCHIP0_EXTENDED,
  460. 1,
  461. "Titan PChip 0 Extended Frame",
  462. el_titan_pchip0_extended_annotation),
  463. SUBPACKET_ANNOTATION(EL_CLASS__REGATTA_FAMILY,
  464. EL_TYPE__REGATTA__TITAN_PCHIP1_EXTENDED,
  465. 1,
  466. "Titan PChip 1 Extended Frame",
  467. el_titan_pchip1_extended_annotation),
  468. SUBPACKET_ANNOTATION(EL_CLASS__REGATTA_FAMILY,
  469. EL_TYPE__REGATTA__TITAN_MEMORY_EXTENDED,
  470. 1,
  471. "Titan Memory Extended Frame",
  472. el_titan_memory_extended_annotation),
  473. SUBPACKET_ANNOTATION(EL_CLASS__REGATTA_FAMILY,
  474. EL_TYPE__TERMINATION__TERMINATION,
  475. 1,
  476. "Termination Subpacket",
  477. NULL)
  478. };
  479. static struct el_subpacket *
  480. el_process_regatta_subpacket(struct el_subpacket *header)
  481. {
  482. if (header->class != EL_CLASS__REGATTA_FAMILY) {
  483. printk("%s ** Unexpected header CLASS %d TYPE %d, aborting\n",
  484. err_print_prefix,
  485. header->class, header->type);
  486. return NULL;
  487. }
  488. switch(header->type) {
  489. case EL_TYPE__REGATTA__PROCESSOR_ERROR_FRAME:
  490. case EL_TYPE__REGATTA__SYSTEM_ERROR_FRAME:
  491. case EL_TYPE__REGATTA__ENVIRONMENTAL_FRAME:
  492. case EL_TYPE__REGATTA__PROCESSOR_DBL_ERROR_HALT:
  493. case EL_TYPE__REGATTA__SYSTEM_DBL_ERROR_HALT:
  494. printk("%s ** Occurred on CPU %d:\n",
  495. err_print_prefix,
  496. (int)header->by_type.regatta_frame.cpuid);
  497. privateer_process_logout_frame((struct el_common *)
  498. header->by_type.regatta_frame.data_start, 1);
  499. break;
  500. default:
  501. printk("%s ** REGATTA TYPE %d SUBPACKET\n",
  502. err_print_prefix, header->type);
  503. el_annotate_subpacket(header);
  504. break;
  505. }
  506. return (struct el_subpacket *)((unsigned long)header + header->length);
  507. }
  508. static struct el_subpacket_handler titan_subpacket_handler =
  509. SUBPACKET_HANDLER_INIT(EL_CLASS__REGATTA_FAMILY,
  510. el_process_regatta_subpacket);
  511. void __init
  512. titan_register_error_handlers(void)
  513. {
  514. size_t i;
  515. for (i = 0; i < ARRAY_SIZE (el_titan_annotations); i++)
  516. cdl_register_subpacket_annotation(&el_titan_annotations[i]);
  517. cdl_register_subpacket_handler(&titan_subpacket_handler);
  518. ev6_register_error_handlers();
  519. }
  520. /*
  521. * Privateer
  522. */
  523. static int
  524. privateer_process_680_frame(struct el_common *mchk_header, int print)
  525. {
  526. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  527. #ifdef CONFIG_VERBOSE_MCHECK
  528. struct el_PRIVATEER_envdata_mcheck *emchk =
  529. (struct el_PRIVATEER_envdata_mcheck *)
  530. ((unsigned long)mchk_header + mchk_header->sys_offset);
  531. /* TODO - categorize errors, for now, no error */
  532. if (!print)
  533. return status;
  534. /* TODO - decode instead of just dumping... */
  535. printk("%s Summary Flags: %016llx\n"
  536. " CChip DIRx: %016llx\n"
  537. " System Management IR: %016llx\n"
  538. " CPU IR: %016llx\n"
  539. " Power Supply IR: %016llx\n"
  540. " LM78 Fault Status: %016llx\n"
  541. " System Doors: %016llx\n"
  542. " Temperature Warning: %016llx\n"
  543. " Fan Control: %016llx\n"
  544. " Fatal Power Down Code: %016llx\n",
  545. err_print_prefix,
  546. emchk->summary,
  547. emchk->c_dirx,
  548. emchk->smir,
  549. emchk->cpuir,
  550. emchk->psir,
  551. emchk->fault,
  552. emchk->sys_doors,
  553. emchk->temp_warn,
  554. emchk->fan_ctrl,
  555. emchk->code);
  556. #endif /* CONFIG_VERBOSE_MCHECK */
  557. return status;
  558. }
  559. int
  560. privateer_process_logout_frame(struct el_common *mchk_header, int print)
  561. {
  562. struct el_common_EV6_mcheck *ev6mchk =
  563. (struct el_common_EV6_mcheck *)mchk_header;
  564. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  565. /*
  566. * Machine check codes
  567. */
  568. #define PRIVATEER_MCHK__CORR_ECC 0x86 /* 630 */
  569. #define PRIVATEER_MCHK__DC_TAG_PERR 0x9E /* 630 */
  570. #define PRIVATEER_MCHK__PAL_BUGCHECK 0x8E /* 670 */
  571. #define PRIVATEER_MCHK__OS_BUGCHECK 0x90 /* 670 */
  572. #define PRIVATEER_MCHK__PROC_HRD_ERR 0x98 /* 670 */
  573. #define PRIVATEER_MCHK__ISTREAM_CMOV_PRX 0xA0 /* 670 */
  574. #define PRIVATEER_MCHK__ISTREAM_CMOV_FLT 0xA2 /* 670 */
  575. #define PRIVATEER_MCHK__SYS_HRD_ERR 0x202 /* 660 */
  576. #define PRIVATEER_MCHK__SYS_CORR_ERR 0x204 /* 620 */
  577. #define PRIVATEER_MCHK__SYS_ENVIRON 0x206 /* 680 */
  578. switch(ev6mchk->MCHK_Code) {
  579. /*
  580. * Vector 630 - Processor, Correctable
  581. */
  582. case PRIVATEER_MCHK__CORR_ECC:
  583. case PRIVATEER_MCHK__DC_TAG_PERR:
  584. /*
  585. * Fall through to vector 670 for processing...
  586. */
  587. /*
  588. * Vector 670 - Processor, Uncorrectable
  589. */
  590. case PRIVATEER_MCHK__PAL_BUGCHECK:
  591. case PRIVATEER_MCHK__OS_BUGCHECK:
  592. case PRIVATEER_MCHK__PROC_HRD_ERR:
  593. case PRIVATEER_MCHK__ISTREAM_CMOV_PRX:
  594. case PRIVATEER_MCHK__ISTREAM_CMOV_FLT:
  595. status |= ev6_process_logout_frame(mchk_header, print);
  596. break;
  597. /*
  598. * Vector 620 - System, Correctable
  599. */
  600. case PRIVATEER_MCHK__SYS_CORR_ERR:
  601. /*
  602. * Fall through to vector 660 for processing...
  603. */
  604. /*
  605. * Vector 660 - System, Uncorrectable
  606. */
  607. case PRIVATEER_MCHK__SYS_HRD_ERR:
  608. status |= titan_process_logout_frame(mchk_header, print);
  609. break;
  610. /*
  611. * Vector 680 - System, Environmental
  612. */
  613. case PRIVATEER_MCHK__SYS_ENVIRON: /* System, Environmental */
  614. status |= privateer_process_680_frame(mchk_header, print);
  615. break;
  616. /*
  617. * Unknown
  618. */
  619. default:
  620. status |= MCHK_DISPOSITION_REPORT;
  621. if (print) {
  622. printk("%s** Unknown Error, frame follows\n",
  623. err_print_prefix);
  624. mchk_dump_logout_frame(mchk_header);
  625. }
  626. }
  627. return status;
  628. }
  629. void
  630. privateer_machine_check(unsigned long vector, unsigned long la_ptr)
  631. {
  632. struct el_common *mchk_header = (struct el_common *)la_ptr;
  633. struct el_TITAN_sysdata_mcheck *tmchk =
  634. (struct el_TITAN_sysdata_mcheck *)
  635. (la_ptr + mchk_header->sys_offset);
  636. u64 irqmask;
  637. char *saved_err_prefix = err_print_prefix;
  638. #define PRIVATEER_680_INTERRUPT_MASK (0xE00UL)
  639. #define PRIVATEER_HOTPLUG_INTERRUPT_MASK (0xE00UL)
  640. /*
  641. * Sync the processor.
  642. */
  643. mb();
  644. draina();
  645. /*
  646. * Only handle system events here.
  647. */
  648. if (vector != SCB_Q_SYSEVENT)
  649. return titan_machine_check(vector, la_ptr);
  650. /*
  651. * Report the event - System Events should be reported even if no
  652. * error is indicated since the event could indicate the return
  653. * to normal status.
  654. */
  655. err_print_prefix = KERN_CRIT;
  656. printk("%s*System Event (Vector 0x%x) reported on CPU %d:\n",
  657. err_print_prefix,
  658. (unsigned int)vector, (int)smp_processor_id());
  659. privateer_process_680_frame(mchk_header, 1);
  660. err_print_prefix = saved_err_prefix;
  661. /*
  662. * Convert any pending interrupts which report as 680 machine
  663. * checks to interrupts.
  664. */
  665. irqmask = tmchk->c_dirx & PRIVATEER_680_INTERRUPT_MASK;
  666. /*
  667. * Dispatch the interrupt(s).
  668. */
  669. titan_dispatch_irqs(irqmask);
  670. /*
  671. * Release the logout frame.
  672. */
  673. wrmces(0x7);
  674. mb();
  675. }