err_titan.c 23 KB

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