err_titan.c 23 KB

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