err_titan.c 23 KB

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