err_marvel.c 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. /*
  2. * linux/arch/alpha/kernel/err_marvel.c
  3. *
  4. * Copyright (C) 2001 Jeff Wiedemeier (Compaq Computer Corporation)
  5. *
  6. */
  7. #include <linux/init.h>
  8. #include <linux/pci.h>
  9. #include <linux/sched.h>
  10. #include <asm/io.h>
  11. #include <asm/console.h>
  12. #include <asm/core_marvel.h>
  13. #include <asm/hwrpb.h>
  14. #include <asm/smp.h>
  15. #include <asm/err_common.h>
  16. #include <asm/err_ev7.h>
  17. #include "err_impl.h"
  18. #include "proto.h"
  19. static void
  20. marvel_print_680_frame(struct ev7_lf_subpackets *lf_subpackets)
  21. {
  22. #ifdef CONFIG_VERBOSE_MCHECK
  23. struct ev7_pal_environmental_subpacket *env;
  24. struct { int type; char *name; } ev_packets[] = {
  25. { EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE,
  26. "Ambient Temperature" },
  27. { EL_TYPE__PAL__ENV__AIRMOVER_FAN,
  28. "AirMover / Fan" },
  29. { EL_TYPE__PAL__ENV__VOLTAGE,
  30. "Voltage" },
  31. { EL_TYPE__PAL__ENV__INTRUSION,
  32. "Intrusion" },
  33. { EL_TYPE__PAL__ENV__POWER_SUPPLY,
  34. "Power Supply" },
  35. { EL_TYPE__PAL__ENV__LAN,
  36. "LAN" },
  37. { EL_TYPE__PAL__ENV__HOT_PLUG,
  38. "Hot Plug" },
  39. { 0, NULL }
  40. };
  41. int i;
  42. for (i = 0; ev_packets[i].type != 0; i++) {
  43. env = lf_subpackets->env[ev7_lf_env_index(ev_packets[i].type)];
  44. if (!env)
  45. continue;
  46. printk("%s**%s event (cabinet %d, drawer %d)\n",
  47. err_print_prefix,
  48. ev_packets[i].name,
  49. env->cabinet,
  50. env->drawer);
  51. printk("%s Module Type: 0x%x - Unit ID 0x%x - "
  52. "Condition 0x%x\n",
  53. err_print_prefix,
  54. env->module_type,
  55. env->unit_id,
  56. env->condition);
  57. }
  58. #endif /* CONFIG_VERBOSE_MCHECK */
  59. }
  60. static int
  61. marvel_process_680_frame(struct ev7_lf_subpackets *lf_subpackets, int print)
  62. {
  63. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  64. int i;
  65. for (i = ev7_lf_env_index(EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE);
  66. i <= ev7_lf_env_index(EL_TYPE__PAL__ENV__HOT_PLUG);
  67. i++) {
  68. if (lf_subpackets->env[i])
  69. status = MCHK_DISPOSITION_REPORT;
  70. }
  71. if (print)
  72. marvel_print_680_frame(lf_subpackets);
  73. return status;
  74. }
  75. #ifdef CONFIG_VERBOSE_MCHECK
  76. static void
  77. marvel_print_err_cyc(u64 err_cyc)
  78. {
  79. static char *packet_desc[] = {
  80. "No Error",
  81. "UNKNOWN",
  82. "1 cycle (1 or 2 flit packet)",
  83. "2 cycles (3 flit packet)",
  84. "9 cycles (18 flit packet)",
  85. "10 cycles (19 flit packet)",
  86. "UNKNOWN",
  87. "UNKNOWN",
  88. "UNKNOWN"
  89. };
  90. #define IO7__ERR_CYC__ODD_FLT (1UL << 0)
  91. #define IO7__ERR_CYC__EVN_FLT (1UL << 1)
  92. #define IO7__ERR_CYC__PACKET__S (6)
  93. #define IO7__ERR_CYC__PACKET__M (0x7)
  94. #define IO7__ERR_CYC__LOC (1UL << 5)
  95. #define IO7__ERR_CYC__CYCLE__S (2)
  96. #define IO7__ERR_CYC__CYCLE__M (0x7)
  97. printk("%s Packet In Error: %s\n"
  98. "%s Error in %s, cycle %ld%s%s\n",
  99. err_print_prefix,
  100. packet_desc[EXTRACT(err_cyc, IO7__ERR_CYC__PACKET)],
  101. err_print_prefix,
  102. (err_cyc & IO7__ERR_CYC__LOC) ? "DATA" : "HEADER",
  103. EXTRACT(err_cyc, IO7__ERR_CYC__CYCLE),
  104. (err_cyc & IO7__ERR_CYC__ODD_FLT) ? " [ODD Flit]": "",
  105. (err_cyc & IO7__ERR_CYC__EVN_FLT) ? " [Even Flit]": "");
  106. }
  107. static void
  108. marvel_print_po7_crrct_sym(u64 crrct_sym)
  109. {
  110. #define IO7__PO7_CRRCT_SYM__SYN__S (0)
  111. #define IO7__PO7_CRRCT_SYM__SYN__M (0x7f)
  112. #define IO7__PO7_CRRCT_SYM__ERR_CYC__S (7) /* ERR_CYC + ODD_FLT + EVN_FLT */
  113. #define IO7__PO7_CRRCT_SYM__ERR_CYC__M (0x1ff)
  114. printk("%s Correctable Error Symptoms:\n"
  115. "%s Syndrome: 0x%llx\n",
  116. err_print_prefix,
  117. err_print_prefix, EXTRACT(crrct_sym, IO7__PO7_CRRCT_SYM__SYN));
  118. marvel_print_err_cyc(EXTRACT(crrct_sym, IO7__PO7_CRRCT_SYM__ERR_CYC));
  119. }
  120. static void
  121. marvel_print_po7_uncrr_sym(u64 uncrr_sym, u64 valid_mask)
  122. {
  123. static char *clk_names[] = { "_h[0]", "_h[1]", "_n[0]", "_n[1]" };
  124. static char *clk_decode[] = {
  125. "No Error",
  126. "One extra rising edge",
  127. "Two extra rising edges",
  128. "Lost one clock"
  129. };
  130. static char *port_names[] = { "Port 0", "Port 1",
  131. "Port 2", "Port 3",
  132. "Unknown Port", "Unknown Port",
  133. "Unknown Port", "Port 7" };
  134. int scratch, i;
  135. #define IO7__PO7_UNCRR_SYM__SYN__S (0)
  136. #define IO7__PO7_UNCRR_SYM__SYN__M (0x7f)
  137. #define IO7__PO7_UNCRR_SYM__ERR_CYC__S (7) /* ERR_CYC + ODD_FLT... */
  138. #define IO7__PO7_UNCRR_SYM__ERR_CYC__M (0x1ff) /* ... + EVN_FLT */
  139. #define IO7__PO7_UNCRR_SYM__CLK__S (16)
  140. #define IO7__PO7_UNCRR_SYM__CLK__M (0xff)
  141. #define IO7__PO7_UNCRR_SYM__CDT_OVF_TO__REQ (1UL << 24)
  142. #define IO7__PO7_UNCRR_SYM__CDT_OVF_TO__RIO (1UL << 25)
  143. #define IO7__PO7_UNCRR_SYM__CDT_OVF_TO__WIO (1UL << 26)
  144. #define IO7__PO7_UNCRR_SYM__CDT_OVF_TO__BLK (1UL << 27)
  145. #define IO7__PO7_UNCRR_SYM__CDT_OVF_TO__NBK (1UL << 28)
  146. #define IO7__PO7_UNCRR_SYM__OVF__READIO (1UL << 29)
  147. #define IO7__PO7_UNCRR_SYM__OVF__WRITEIO (1UL << 30)
  148. #define IO7__PO7_UNCRR_SYM__OVF__FWD (1UL << 31)
  149. #define IO7__PO7_UNCRR_SYM__VICTIM_SP__S (32)
  150. #define IO7__PO7_UNCRR_SYM__VICTIM_SP__M (0xff)
  151. #define IO7__PO7_UNCRR_SYM__DETECT_SP__S (40)
  152. #define IO7__PO7_UNCRR_SYM__DETECT_SP__M (0xff)
  153. #define IO7__PO7_UNCRR_SYM__STRV_VTR__S (48)
  154. #define IO7__PO7_UNCRR_SYM__STRV_VTR__M (0x3ff)
  155. #define IO7__STRV_VTR__LSI__INTX__S (0)
  156. #define IO7__STRV_VTR__LSI__INTX__M (0x3)
  157. #define IO7__STRV_VTR__LSI__SLOT__S (2)
  158. #define IO7__STRV_VTR__LSI__SLOT__M (0x7)
  159. #define IO7__STRV_VTR__LSI__BUS__S (5)
  160. #define IO7__STRV_VTR__LSI__BUS__M (0x3)
  161. #define IO7__STRV_VTR__MSI__INTNUM__S (0)
  162. #define IO7__STRV_VTR__MSI__INTNUM__M (0x1ff)
  163. #define IO7__STRV_VTR__IS_MSI (1UL << 9)
  164. printk("%s Uncorrectable Error Symptoms:\n", err_print_prefix);
  165. uncrr_sym &= valid_mask;
  166. if (EXTRACT(valid_mask, IO7__PO7_UNCRR_SYM__SYN))
  167. printk("%s Syndrome: 0x%llx\n",
  168. err_print_prefix,
  169. EXTRACT(uncrr_sym, IO7__PO7_UNCRR_SYM__SYN));
  170. if (EXTRACT(valid_mask, IO7__PO7_UNCRR_SYM__ERR_CYC))
  171. marvel_print_err_cyc(EXTRACT(uncrr_sym,
  172. IO7__PO7_UNCRR_SYM__ERR_CYC));
  173. scratch = EXTRACT(uncrr_sym, IO7__PO7_UNCRR_SYM__CLK);
  174. for (i = 0; i < 4; i++, scratch >>= 2) {
  175. if (scratch & 0x3)
  176. printk("%s Clock %s: %s\n",
  177. err_print_prefix,
  178. clk_names[i], clk_decode[scratch & 0x3]);
  179. }
  180. if (uncrr_sym & IO7__PO7_UNCRR_SYM__CDT_OVF_TO__REQ)
  181. printk("%s REQ Credit Timeout or Overflow\n",
  182. err_print_prefix);
  183. if (uncrr_sym & IO7__PO7_UNCRR_SYM__CDT_OVF_TO__RIO)
  184. printk("%s RIO Credit Timeout or Overflow\n",
  185. err_print_prefix);
  186. if (uncrr_sym & IO7__PO7_UNCRR_SYM__CDT_OVF_TO__WIO)
  187. printk("%s WIO Credit Timeout or Overflow\n",
  188. err_print_prefix);
  189. if (uncrr_sym & IO7__PO7_UNCRR_SYM__CDT_OVF_TO__BLK)
  190. printk("%s BLK Credit Timeout or Overflow\n",
  191. err_print_prefix);
  192. if (uncrr_sym & IO7__PO7_UNCRR_SYM__CDT_OVF_TO__NBK)
  193. printk("%s NBK Credit Timeout or Overflow\n",
  194. err_print_prefix);
  195. if (uncrr_sym & IO7__PO7_UNCRR_SYM__OVF__READIO)
  196. printk("%s Read I/O Buffer Overflow\n",
  197. err_print_prefix);
  198. if (uncrr_sym & IO7__PO7_UNCRR_SYM__OVF__WRITEIO)
  199. printk("%s Write I/O Buffer Overflow\n",
  200. err_print_prefix);
  201. if (uncrr_sym & IO7__PO7_UNCRR_SYM__OVF__FWD)
  202. printk("%s FWD Buffer Overflow\n",
  203. err_print_prefix);
  204. if ((scratch = EXTRACT(uncrr_sym, IO7__PO7_UNCRR_SYM__VICTIM_SP))) {
  205. int lost = scratch & (1UL << 4);
  206. scratch &= ~lost;
  207. for (i = 0; i < 8; i++, scratch >>= 1) {
  208. if (!(scratch & 1))
  209. continue;
  210. printk("%s Error Response sent to %s",
  211. err_print_prefix, port_names[i]);
  212. }
  213. if (lost)
  214. printk("%s Lost Error sent somewhere else\n",
  215. err_print_prefix);
  216. }
  217. if ((scratch = EXTRACT(uncrr_sym, IO7__PO7_UNCRR_SYM__DETECT_SP))) {
  218. for (i = 0; i < 8; i++, scratch >>= 1) {
  219. if (!(scratch & 1))
  220. continue;
  221. printk("%s Error Reported by %s",
  222. err_print_prefix, port_names[i]);
  223. }
  224. }
  225. if (EXTRACT(valid_mask, IO7__PO7_UNCRR_SYM__STRV_VTR)) {
  226. char starvation_message[80];
  227. scratch = EXTRACT(uncrr_sym, IO7__PO7_UNCRR_SYM__STRV_VTR);
  228. if (scratch & IO7__STRV_VTR__IS_MSI)
  229. sprintf(starvation_message,
  230. "MSI Interrupt 0x%x",
  231. EXTRACT(scratch, IO7__STRV_VTR__MSI__INTNUM));
  232. else
  233. sprintf(starvation_message,
  234. "LSI INT%c for Bus:Slot (%d:%d)\n",
  235. 'A' + EXTRACT(scratch,
  236. IO7__STRV_VTR__LSI__INTX),
  237. EXTRACT(scratch, IO7__STRV_VTR__LSI__BUS),
  238. EXTRACT(scratch, IO7__STRV_VTR__LSI__SLOT));
  239. printk("%s Starvation Int Trigger By: %s\n",
  240. err_print_prefix, starvation_message);
  241. }
  242. }
  243. static void
  244. marvel_print_po7_ugbge_sym(u64 ugbge_sym)
  245. {
  246. char opcode_str[10];
  247. #define IO7__PO7_UGBGE_SYM__UPH_PKT_OFF__S (6)
  248. #define IO7__PO7_UGBGE_SYM__UPH_PKT_OFF__M (0xfffffffful)
  249. #define IO7__PO7_UGBGE_SYM__UPH_OPCODE__S (40)
  250. #define IO7__PO7_UGBGE_SYM__UPH_OPCODE__M (0xff)
  251. #define IO7__PO7_UGBGE_SYM__UPH_SRC_PORT__S (48)
  252. #define IO7__PO7_UGBGE_SYM__UPH_SRC_PORT__M (0xf)
  253. #define IO7__PO7_UGBGE_SYM__UPH_DEST_PID__S (52)
  254. #define IO7__PO7_UGBGE_SYM__UPH_DEST_PID__M (0x7ff)
  255. #define IO7__PO7_UGBGE_SYM__VALID (1UL << 63)
  256. if (!(ugbge_sym & IO7__PO7_UGBGE_SYM__VALID))
  257. return;
  258. switch(EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_OPCODE)) {
  259. case 0x51:
  260. sprintf(opcode_str, "Wr32");
  261. break;
  262. case 0x50:
  263. sprintf(opcode_str, "WrQW");
  264. break;
  265. case 0x54:
  266. sprintf(opcode_str, "WrIPR");
  267. break;
  268. case 0xD8:
  269. sprintf(opcode_str, "Victim");
  270. break;
  271. case 0xC5:
  272. sprintf(opcode_str, "BlkIO");
  273. break;
  274. default:
  275. sprintf(opcode_str, "0x%llx\n",
  276. EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_OPCODE));
  277. break;
  278. }
  279. printk("%s Up Hose Garbage Symptom:\n"
  280. "%s Source Port: %ld - Dest PID: %ld - OpCode: %s\n",
  281. err_print_prefix,
  282. err_print_prefix,
  283. EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_SRC_PORT),
  284. EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_DEST_PID),
  285. opcode_str);
  286. if (0xC5 != EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_OPCODE))
  287. printk("%s Packet Offset 0x%08llx\n",
  288. err_print_prefix,
  289. EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_PKT_OFF));
  290. }
  291. static void
  292. marvel_print_po7_err_sum(struct ev7_pal_io_subpacket *io)
  293. {
  294. u64 uncrr_sym_valid = 0;
  295. #define IO7__PO7_ERRSUM__CR_SBE (1UL << 32)
  296. #define IO7__PO7_ERRSUM__CR_SBE2 (1UL << 33)
  297. #define IO7__PO7_ERRSUM__CR_PIO_WBYTE (1UL << 34)
  298. #define IO7__PO7_ERRSUM__CR_CSR_NXM (1UL << 35)
  299. #define IO7__PO7_ERRSUM__CR_RPID_ACV (1UL << 36)
  300. #define IO7__PO7_ERRSUM__CR_RSP_NXM (1UL << 37)
  301. #define IO7__PO7_ERRSUM__CR_ERR_RESP (1UL << 38)
  302. #define IO7__PO7_ERRSUM__CR_CLK_DERR (1UL << 39)
  303. #define IO7__PO7_ERRSUM__CR_DAT_DBE (1UL << 40)
  304. #define IO7__PO7_ERRSUM__CR_DAT_GRBG (1UL << 41)
  305. #define IO7__PO7_ERRSUM__MAF_TO (1UL << 42)
  306. #define IO7__PO7_ERRSUM__UGBGE (1UL << 43)
  307. #define IO7__PO7_ERRSUM__UN_MAF_LOST (1UL << 44)
  308. #define IO7__PO7_ERRSUM__UN_PKT_OVF (1UL << 45)
  309. #define IO7__PO7_ERRSUM__UN_CDT_OVF (1UL << 46)
  310. #define IO7__PO7_ERRSUM__UN_DEALLOC (1UL << 47)
  311. #define IO7__PO7_ERRSUM__BH_CDT_TO (1UL << 51)
  312. #define IO7__PO7_ERRSUM__BH_CLK_HDR (1UL << 52)
  313. #define IO7__PO7_ERRSUM__BH_DBE_HDR (1UL << 53)
  314. #define IO7__PO7_ERRSUM__BH_GBG_HDR (1UL << 54)
  315. #define IO7__PO7_ERRSUM__BH_BAD_CMD (1UL << 55)
  316. #define IO7__PO7_ERRSUM__HLT_INT (1UL << 56)
  317. #define IO7__PO7_ERRSUM__HP_INT (1UL << 57)
  318. #define IO7__PO7_ERRSUM__CRD_INT (1UL << 58)
  319. #define IO7__PO7_ERRSUM__STV_INT (1UL << 59)
  320. #define IO7__PO7_ERRSUM__HRD_INT (1UL << 60)
  321. #define IO7__PO7_ERRSUM__BH_SUM (1UL << 61)
  322. #define IO7__PO7_ERRSUM__ERR_LST (1UL << 62)
  323. #define IO7__PO7_ERRSUM__ERR_VALID (1UL << 63)
  324. #define IO7__PO7_ERRSUM__ERR_MASK (IO7__PO7_ERRSUM__ERR_VALID | \
  325. IO7__PO7_ERRSUM__CR_SBE)
  326. /*
  327. * Single bit errors aren't covered by ERR_VALID.
  328. */
  329. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_SBE) {
  330. printk("%s %sSingle Bit Error(s) detected/corrected\n",
  331. err_print_prefix,
  332. (io->po7_error_sum & IO7__PO7_ERRSUM__CR_SBE2)
  333. ? "Multiple " : "");
  334. marvel_print_po7_crrct_sym(io->po7_crrct_sym);
  335. }
  336. /*
  337. * Neither are the interrupt status bits
  338. */
  339. if (io->po7_error_sum & IO7__PO7_ERRSUM__HLT_INT)
  340. printk("%s Halt Interrupt posted", err_print_prefix);
  341. if (io->po7_error_sum & IO7__PO7_ERRSUM__HP_INT) {
  342. printk("%s Hot Plug Event Interrupt posted",
  343. err_print_prefix);
  344. uncrr_sym_valid |= GEN_MASK(IO7__PO7_UNCRR_SYM__DETECT_SP);
  345. }
  346. if (io->po7_error_sum & IO7__PO7_ERRSUM__CRD_INT)
  347. printk("%s Correctable Error Interrupt posted",
  348. err_print_prefix);
  349. if (io->po7_error_sum & IO7__PO7_ERRSUM__STV_INT) {
  350. printk("%s Starvation Interrupt posted", err_print_prefix);
  351. uncrr_sym_valid |= GEN_MASK(IO7__PO7_UNCRR_SYM__STRV_VTR);
  352. }
  353. if (io->po7_error_sum & IO7__PO7_ERRSUM__HRD_INT) {
  354. printk("%s Hard Error Interrupt posted", err_print_prefix);
  355. uncrr_sym_valid |= GEN_MASK(IO7__PO7_UNCRR_SYM__DETECT_SP);
  356. }
  357. /*
  358. * Everything else is valid only with ERR_VALID, so skip to the end
  359. * (uncrr_sym check) unless ERR_VALID is set.
  360. */
  361. if (!(io->po7_error_sum & IO7__PO7_ERRSUM__ERR_VALID))
  362. goto check_uncrr_sym;
  363. /*
  364. * Since ERR_VALID is set, VICTIM_SP in uncrr_sym is valid.
  365. * For bits [29:0] to also be valid, the following bits must
  366. * not be set:
  367. * CR_PIO_WBYTE CR_CSR_NXM CR_RSP_NXM
  368. * CR_ERR_RESP MAF_TO
  369. */
  370. uncrr_sym_valid |= GEN_MASK(IO7__PO7_UNCRR_SYM__VICTIM_SP);
  371. if (!(io->po7_error_sum & (IO7__PO7_ERRSUM__CR_PIO_WBYTE |
  372. IO7__PO7_ERRSUM__CR_CSR_NXM |
  373. IO7__PO7_ERRSUM__CR_RSP_NXM |
  374. IO7__PO7_ERRSUM__CR_ERR_RESP |
  375. IO7__PO7_ERRSUM__MAF_TO)))
  376. uncrr_sym_valid |= 0x3ffffffful;
  377. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_PIO_WBYTE)
  378. printk("%s Write byte into IO7 CSR\n", err_print_prefix);
  379. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_CSR_NXM)
  380. printk("%s PIO to non-existent CSR\n", err_print_prefix);
  381. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_RPID_ACV)
  382. printk("%s Bus Requester PID (Access Violation)\n",
  383. err_print_prefix);
  384. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_RSP_NXM)
  385. printk("%s Received NXM response from EV7\n",
  386. err_print_prefix);
  387. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_ERR_RESP)
  388. printk("%s Received ERROR RESPONSE\n", err_print_prefix);
  389. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_CLK_DERR)
  390. printk("%s Clock error on data flit\n", err_print_prefix);
  391. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_DAT_DBE)
  392. printk("%s Double Bit Error Data Error Detected\n",
  393. err_print_prefix);
  394. if (io->po7_error_sum & IO7__PO7_ERRSUM__CR_DAT_GRBG)
  395. printk("%s Garbage Encoding Detected on the data\n",
  396. err_print_prefix);
  397. if (io->po7_error_sum & IO7__PO7_ERRSUM__UGBGE) {
  398. printk("%s Garbage Encoding sent up hose\n",
  399. err_print_prefix);
  400. marvel_print_po7_ugbge_sym(io->po7_ugbge_sym);
  401. }
  402. if (io->po7_error_sum & IO7__PO7_ERRSUM__UN_MAF_LOST)
  403. printk("%s Orphan response (unexpected response)\n",
  404. err_print_prefix);
  405. if (io->po7_error_sum & IO7__PO7_ERRSUM__UN_PKT_OVF)
  406. printk("%s Down hose packet overflow\n", err_print_prefix);
  407. if (io->po7_error_sum & IO7__PO7_ERRSUM__UN_CDT_OVF)
  408. printk("%s Down hose credit overflow\n", err_print_prefix);
  409. if (io->po7_error_sum & IO7__PO7_ERRSUM__UN_DEALLOC)
  410. printk("%s Unexpected or bad dealloc field\n",
  411. err_print_prefix);
  412. /*
  413. * The black hole events.
  414. */
  415. if (io->po7_error_sum & IO7__PO7_ERRSUM__MAF_TO)
  416. printk("%s BLACK HOLE: Timeout for all responses\n",
  417. err_print_prefix);
  418. if (io->po7_error_sum & IO7__PO7_ERRSUM__BH_CDT_TO)
  419. printk("%s BLACK HOLE: Credit Timeout\n", err_print_prefix);
  420. if (io->po7_error_sum & IO7__PO7_ERRSUM__BH_CLK_HDR)
  421. printk("%s BLACK HOLE: Clock check on header\n",
  422. err_print_prefix);
  423. if (io->po7_error_sum & IO7__PO7_ERRSUM__BH_DBE_HDR)
  424. printk("%s BLACK HOLE: Uncorrectable Error on header\n",
  425. err_print_prefix);
  426. if (io->po7_error_sum & IO7__PO7_ERRSUM__BH_GBG_HDR)
  427. printk("%s BLACK HOLE: Garbage on header\n",
  428. err_print_prefix);
  429. if (io->po7_error_sum & IO7__PO7_ERRSUM__BH_BAD_CMD)
  430. printk("%s BLACK HOLE: Bad EV7 command\n",
  431. err_print_prefix);
  432. if (io->po7_error_sum & IO7__PO7_ERRSUM__ERR_LST)
  433. printk("%s Lost Error\n", err_print_prefix);
  434. printk("%s Failing Packet:\n"
  435. "%s Cycle 1: %016llx\n"
  436. "%s Cycle 2: %016llx\n",
  437. err_print_prefix,
  438. err_print_prefix, io->po7_err_pkt0,
  439. err_print_prefix, io->po7_err_pkt1);
  440. /*
  441. * If there are any valid bits in UNCRR sym for this err,
  442. * print UNCRR_SYM as well.
  443. */
  444. check_uncrr_sym:
  445. if (uncrr_sym_valid)
  446. marvel_print_po7_uncrr_sym(io->po7_uncrr_sym, uncrr_sym_valid);
  447. }
  448. static void
  449. marvel_print_pox_tlb_err(u64 tlb_err)
  450. {
  451. static char *tlb_errors[] = {
  452. "No Error",
  453. "North Port Signaled Error fetching TLB entry",
  454. "PTE invalid or UCC or GBG error on this entry",
  455. "Address did not hit any DMA window"
  456. };
  457. #define IO7__POX_TLBERR__ERR_VALID (1UL << 63)
  458. #define IO7__POX_TLBERR__ERRCODE__S (0)
  459. #define IO7__POX_TLBERR__ERRCODE__M (0x3)
  460. #define IO7__POX_TLBERR__ERR_TLB_PTR__S (3)
  461. #define IO7__POX_TLBERR__ERR_TLB_PTR__M (0x7)
  462. #define IO7__POX_TLBERR__FADDR__S (6)
  463. #define IO7__POX_TLBERR__FADDR__M (0x3fffffffffful)
  464. if (!(tlb_err & IO7__POX_TLBERR__ERR_VALID))
  465. return;
  466. printk("%s TLB Error on index 0x%llx:\n"
  467. "%s - %s\n"
  468. "%s - Addr: 0x%016llx\n",
  469. err_print_prefix,
  470. EXTRACT(tlb_err, IO7__POX_TLBERR__ERR_TLB_PTR),
  471. err_print_prefix,
  472. tlb_errors[EXTRACT(tlb_err, IO7__POX_TLBERR__ERRCODE)],
  473. err_print_prefix,
  474. EXTRACT(tlb_err, IO7__POX_TLBERR__FADDR) << 6);
  475. }
  476. static void
  477. marvel_print_pox_spl_cmplt(u64 spl_cmplt)
  478. {
  479. char message[80];
  480. #define IO7__POX_SPLCMPLT__MESSAGE__S (0)
  481. #define IO7__POX_SPLCMPLT__MESSAGE__M (0x0fffffffful)
  482. #define IO7__POX_SPLCMPLT__SOURCE_BUS__S (40)
  483. #define IO7__POX_SPLCMPLT__SOURCE_BUS__M (0xfful)
  484. #define IO7__POX_SPLCMPLT__SOURCE_DEV__S (35)
  485. #define IO7__POX_SPLCMPLT__SOURCE_DEV__M (0x1ful)
  486. #define IO7__POX_SPLCMPLT__SOURCE_FUNC__S (32)
  487. #define IO7__POX_SPLCMPLT__SOURCE_FUNC__M (0x07ul)
  488. #define IO7__POX_SPLCMPLT__MSG_CLASS__S (28)
  489. #define IO7__POX_SPLCMPLT__MSG_CLASS__M (0xf)
  490. #define IO7__POX_SPLCMPLT__MSG_INDEX__S (20)
  491. #define IO7__POX_SPLCMPLT__MSG_INDEX__M (0xff)
  492. #define IO7__POX_SPLCMPLT__MSG_CLASSINDEX__S (20)
  493. #define IO7__POX_SPLCMPLT__MSG_CLASSINDEX__M (0xfff)
  494. #define IO7__POX_SPLCMPLT__REM_LOWER_ADDR__S (12)
  495. #define IO7__POX_SPLCMPLT__REM_LOWER_ADDR__M (0x7f)
  496. #define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__S (0)
  497. #define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__M (0xfff)
  498. printk("%s Split Completion Error:\n"
  499. "%s Source (Bus:Dev:Func): %ld:%ld:%ld\n",
  500. err_print_prefix,
  501. err_print_prefix,
  502. EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_BUS),
  503. EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_DEV),
  504. EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_FUNC));
  505. switch(EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__MSG_CLASSINDEX)) {
  506. case 0x000:
  507. sprintf(message, "Normal completion");
  508. break;
  509. case 0x100:
  510. sprintf(message, "Bridge - Master Abort");
  511. break;
  512. case 0x101:
  513. sprintf(message, "Bridge - Target Abort");
  514. break;
  515. case 0x102:
  516. sprintf(message, "Bridge - Uncorrectable Write Data Error");
  517. break;
  518. case 0x200:
  519. sprintf(message, "Byte Count Out of Range");
  520. break;
  521. case 0x201:
  522. sprintf(message, "Uncorrectable Split Write Data Error");
  523. break;
  524. default:
  525. sprintf(message, "%08llx\n",
  526. EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__MESSAGE));
  527. break;
  528. }
  529. printk("%s Message: %s\n", err_print_prefix, message);
  530. }
  531. static void
  532. marvel_print_pox_trans_sum(u64 trans_sum)
  533. {
  534. char *pcix_cmd[] = { "Interrupt Acknowledge",
  535. "Special Cycle",
  536. "I/O Read",
  537. "I/O Write",
  538. "Reserved",
  539. "Reserved / Device ID Message",
  540. "Memory Read",
  541. "Memory Write",
  542. "Reserved / Alias to Memory Read Block",
  543. "Reserved / Alias to Memory Write Block",
  544. "Configuration Read",
  545. "Configuration Write",
  546. "Memory Read Multiple / Split Completion",
  547. "Dual Address Cycle",
  548. "Memory Read Line / Memory Read Block",
  549. "Memory Write and Invalidate / Memory Write Block"
  550. };
  551. #define IO7__POX_TRANSUM__PCI_ADDR__S (0)
  552. #define IO7__POX_TRANSUM__PCI_ADDR__M (0x3fffffffffffful)
  553. #define IO7__POX_TRANSUM__DAC (1UL << 50)
  554. #define IO7__POX_TRANSUM__PCIX_MASTER_SLOT__S (52)
  555. #define IO7__POX_TRANSUM__PCIX_MASTER_SLOT__M (0xf)
  556. #define IO7__POX_TRANSUM__PCIX_CMD__S (56)
  557. #define IO7__POX_TRANSUM__PCIX_CMD__M (0xf)
  558. #define IO7__POX_TRANSUM__ERR_VALID (1UL << 63)
  559. if (!(trans_sum & IO7__POX_TRANSUM__ERR_VALID))
  560. return;
  561. printk("%s Transaction Summary:\n"
  562. "%s Command: 0x%llx - %s\n"
  563. "%s Address: 0x%016llx%s\n"
  564. "%s PCI-X Master Slot: 0x%llx\n",
  565. err_print_prefix,
  566. err_print_prefix,
  567. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_CMD),
  568. pcix_cmd[EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_CMD)],
  569. err_print_prefix,
  570. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCI_ADDR),
  571. (trans_sum & IO7__POX_TRANSUM__DAC) ? " (DAC)" : "",
  572. err_print_prefix,
  573. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_MASTER_SLOT));
  574. }
  575. static void
  576. marvel_print_pox_err(u64 err_sum, struct ev7_pal_io_one_port *port)
  577. {
  578. #define IO7__POX_ERRSUM__AGP_REQQ_OVFL (1UL << 4)
  579. #define IO7__POX_ERRSUM__AGP_SYNC_ERR (1UL << 5)
  580. #define IO7__POX_ERRSUM__MRETRY_TO (1UL << 6)
  581. #define IO7__POX_ERRSUM__PCIX_UX_SPL (1UL << 7)
  582. #define IO7__POX_ERRSUM__PCIX_SPLIT_TO (1UL << 8)
  583. #define IO7__POX_ERRSUM__PCIX_DISCARD_SPL (1UL << 9)
  584. #define IO7__POX_ERRSUM__DMA_RD_TO (1UL << 10)
  585. #define IO7__POX_ERRSUM__CSR_NXM_RD (1UL << 11)
  586. #define IO7__POX_ERRSUM__CSR_NXM_WR (1UL << 12)
  587. #define IO7__POX_ERRSUM__DMA_TO (1UL << 13)
  588. #define IO7__POX_ERRSUM__ALL_MABORTS (1UL << 14)
  589. #define IO7__POX_ERRSUM__MABORT (1UL << 15)
  590. #define IO7__POX_ERRSUM__MABORT_MASK (IO7__POX_ERRSUM__ALL_MABORTS|\
  591. IO7__POX_ERRSUM__MABORT)
  592. #define IO7__POX_ERRSUM__PT_TABORT (1UL << 16)
  593. #define IO7__POX_ERRSUM__PM_TABORT (1UL << 17)
  594. #define IO7__POX_ERRSUM__TABORT_MASK (IO7__POX_ERRSUM__PT_TABORT | \
  595. IO7__POX_ERRSUM__PM_TABORT)
  596. #define IO7__POX_ERRSUM__SERR (1UL << 18)
  597. #define IO7__POX_ERRSUM__ADDRERR_STB (1UL << 19)
  598. #define IO7__POX_ERRSUM__DETECTED_SERR (1UL << 20)
  599. #define IO7__POX_ERRSUM__PERR (1UL << 21)
  600. #define IO7__POX_ERRSUM__DATAERR_STB_NIOW (1UL << 22)
  601. #define IO7__POX_ERRSUM__DETECTED_PERR (1UL << 23)
  602. #define IO7__POX_ERRSUM__PM_PERR (1UL << 24)
  603. #define IO7__POX_ERRSUM__PT_SCERROR (1UL << 26)
  604. #define IO7__POX_ERRSUM__HUNG_BUS (1UL << 28)
  605. #define IO7__POX_ERRSUM__UPE_ERROR__S (51)
  606. #define IO7__POX_ERRSUM__UPE_ERROR__M (0xffUL)
  607. #define IO7__POX_ERRSUM__UPE_ERROR GEN_MASK(IO7__POX_ERRSUM__UPE_ERROR)
  608. #define IO7__POX_ERRSUM__TLB_ERR (1UL << 59)
  609. #define IO7__POX_ERRSUM__ERR_VALID (1UL << 63)
  610. #define IO7__POX_ERRSUM__TRANS_SUM__MASK (IO7__POX_ERRSUM__MRETRY_TO | \
  611. IO7__POX_ERRSUM__PCIX_UX_SPL | \
  612. IO7__POX_ERRSUM__PCIX_SPLIT_TO | \
  613. IO7__POX_ERRSUM__DMA_TO | \
  614. IO7__POX_ERRSUM__MABORT_MASK | \
  615. IO7__POX_ERRSUM__TABORT_MASK | \
  616. IO7__POX_ERRSUM__SERR | \
  617. IO7__POX_ERRSUM__ADDRERR_STB | \
  618. IO7__POX_ERRSUM__PERR | \
  619. IO7__POX_ERRSUM__DATAERR_STB_NIOW |\
  620. IO7__POX_ERRSUM__DETECTED_PERR | \
  621. IO7__POX_ERRSUM__PM_PERR | \
  622. IO7__POX_ERRSUM__PT_SCERROR | \
  623. IO7__POX_ERRSUM__UPE_ERROR)
  624. if (!(err_sum & IO7__POX_ERRSUM__ERR_VALID))
  625. return;
  626. /*
  627. * First the transaction summary errors
  628. */
  629. if (err_sum & IO7__POX_ERRSUM__MRETRY_TO)
  630. printk("%s IO7 Master Retry Timeout expired\n",
  631. err_print_prefix);
  632. if (err_sum & IO7__POX_ERRSUM__PCIX_UX_SPL)
  633. printk("%s Unexpected Split Completion\n",
  634. err_print_prefix);
  635. if (err_sum & IO7__POX_ERRSUM__PCIX_SPLIT_TO)
  636. printk("%s IO7 Split Completion Timeout expired\n",
  637. err_print_prefix);
  638. if (err_sum & IO7__POX_ERRSUM__DMA_TO)
  639. printk("%s Hung bus during DMA transaction\n",
  640. err_print_prefix);
  641. if (err_sum & IO7__POX_ERRSUM__MABORT_MASK)
  642. printk("%s Master Abort\n", err_print_prefix);
  643. if (err_sum & IO7__POX_ERRSUM__PT_TABORT)
  644. printk("%s IO7 Asserted Target Abort\n", err_print_prefix);
  645. if (err_sum & IO7__POX_ERRSUM__PM_TABORT)
  646. printk("%s IO7 Received Target Abort\n", err_print_prefix);
  647. if (err_sum & IO7__POX_ERRSUM__ADDRERR_STB) {
  648. printk("%s Address or PCI-X Attribute Parity Error\n",
  649. err_print_prefix);
  650. if (err_sum & IO7__POX_ERRSUM__SERR)
  651. printk("%s IO7 Asserted SERR\n", err_print_prefix);
  652. }
  653. if (err_sum & IO7__POX_ERRSUM__PERR) {
  654. if (err_sum & IO7__POX_ERRSUM__DATAERR_STB_NIOW)
  655. printk("%s IO7 Detected Data Parity Error\n",
  656. err_print_prefix);
  657. else
  658. printk("%s Split Completion Response with "
  659. "Parity Error\n", err_print_prefix);
  660. }
  661. if (err_sum & IO7__POX_ERRSUM__DETECTED_PERR)
  662. printk("%s PERR detected\n", err_print_prefix);
  663. if (err_sum & IO7__POX_ERRSUM__PM_PERR)
  664. printk("%s PERR while IO7 is master\n", err_print_prefix);
  665. if (err_sum & IO7__POX_ERRSUM__PT_SCERROR) {
  666. printk("%s IO7 Received Split Completion Error message\n",
  667. err_print_prefix);
  668. marvel_print_pox_spl_cmplt(port->pox_spl_cmplt);
  669. }
  670. if (err_sum & IO7__POX_ERRSUM__UPE_ERROR) {
  671. unsigned int upe_error = EXTRACT(err_sum,
  672. IO7__POX_ERRSUM__UPE_ERROR);
  673. int i;
  674. static char *upe_errors[] = {
  675. "Parity Error on MSI write data",
  676. "MSI read (MSI window is write only",
  677. "TLB - Invalid WR transaction",
  678. "TLB - Invalid RD transaction",
  679. "DMA - WR error (see north port)",
  680. "DMA - RD error (see north port)",
  681. "PPR - WR error (see north port)",
  682. "PPR - RD error (see north port)"
  683. };
  684. printk("%s UPE Error:\n", err_print_prefix);
  685. for (i = 0; i < 8; i++) {
  686. if (upe_error & (1 << i))
  687. printk("%s %s\n", err_print_prefix,
  688. upe_errors[i]);
  689. }
  690. }
  691. /*
  692. * POx_TRANS_SUM, if appropriate.
  693. */
  694. if (err_sum & IO7__POX_ERRSUM__TRANS_SUM__MASK)
  695. marvel_print_pox_trans_sum(port->pox_trans_sum);
  696. /*
  697. * Then TLB_ERR.
  698. */
  699. if (err_sum & IO7__POX_ERRSUM__TLB_ERR) {
  700. printk("%s TLB ERROR\n", err_print_prefix);
  701. marvel_print_pox_tlb_err(port->pox_tlb_err);
  702. }
  703. /*
  704. * And the single bit status errors.
  705. */
  706. if (err_sum & IO7__POX_ERRSUM__AGP_REQQ_OVFL)
  707. printk("%s AGP Request Queue Overflow\n", err_print_prefix);
  708. if (err_sum & IO7__POX_ERRSUM__AGP_SYNC_ERR)
  709. printk("%s AGP Sync Error\n", err_print_prefix);
  710. if (err_sum & IO7__POX_ERRSUM__PCIX_DISCARD_SPL)
  711. printk("%s Discarded split completion\n", err_print_prefix);
  712. if (err_sum & IO7__POX_ERRSUM__DMA_RD_TO)
  713. printk("%s DMA Read Timeout\n", err_print_prefix);
  714. if (err_sum & IO7__POX_ERRSUM__CSR_NXM_RD)
  715. printk("%s CSR NXM READ\n", err_print_prefix);
  716. if (err_sum & IO7__POX_ERRSUM__CSR_NXM_WR)
  717. printk("%s CSR NXM WRITE\n", err_print_prefix);
  718. if (err_sum & IO7__POX_ERRSUM__DETECTED_SERR)
  719. printk("%s SERR detected\n", err_print_prefix);
  720. if (err_sum & IO7__POX_ERRSUM__HUNG_BUS)
  721. printk("%s HUNG BUS detected\n", err_print_prefix);
  722. }
  723. #endif /* CONFIG_VERBOSE_MCHECK */
  724. static struct ev7_pal_io_subpacket *
  725. marvel_find_io7_with_error(struct ev7_lf_subpackets *lf_subpackets)
  726. {
  727. struct ev7_pal_io_subpacket *io = lf_subpackets->io;
  728. struct io7 *io7;
  729. int i;
  730. /*
  731. * Caller must provide the packet to fill
  732. */
  733. if (!io)
  734. return NULL;
  735. /*
  736. * Fill the subpacket with the console's standard fill pattern
  737. */
  738. memset(io, 0x55, sizeof(*io));
  739. for (io7 = NULL; NULL != (io7 = marvel_next_io7(io7)); ) {
  740. unsigned long err_sum = 0;
  741. err_sum |= io7->csrs->PO7_ERROR_SUM.csr;
  742. for (i = 0; i < IO7_NUM_PORTS; i++) {
  743. if (!io7->ports[i].enabled)
  744. continue;
  745. err_sum |= io7->ports[i].csrs->POx_ERR_SUM.csr;
  746. }
  747. /*
  748. * Is there at least one error?
  749. */
  750. if (err_sum & (1UL << 63))
  751. break;
  752. }
  753. /*
  754. * Did we find an IO7 with an error?
  755. */
  756. if (!io7)
  757. return NULL;
  758. /*
  759. * We have an IO7 with an error.
  760. *
  761. * Fill in the IO subpacket.
  762. */
  763. io->io_asic_rev = io7->csrs->IO_ASIC_REV.csr;
  764. io->io_sys_rev = io7->csrs->IO_SYS_REV.csr;
  765. io->io7_uph = io7->csrs->IO7_UPH.csr;
  766. io->hpi_ctl = io7->csrs->HPI_CTL.csr;
  767. io->crd_ctl = io7->csrs->CRD_CTL.csr;
  768. io->hei_ctl = io7->csrs->HEI_CTL.csr;
  769. io->po7_error_sum = io7->csrs->PO7_ERROR_SUM.csr;
  770. io->po7_uncrr_sym = io7->csrs->PO7_UNCRR_SYM.csr;
  771. io->po7_crrct_sym = io7->csrs->PO7_CRRCT_SYM.csr;
  772. io->po7_ugbge_sym = io7->csrs->PO7_UGBGE_SYM.csr;
  773. io->po7_err_pkt0 = io7->csrs->PO7_ERR_PKT[0].csr;
  774. io->po7_err_pkt1 = io7->csrs->PO7_ERR_PKT[1].csr;
  775. for (i = 0; i < IO7_NUM_PORTS; i++) {
  776. io7_ioport_csrs *csrs = io7->ports[i].csrs;
  777. if (!io7->ports[i].enabled)
  778. continue;
  779. io->ports[i].pox_err_sum = csrs->POx_ERR_SUM.csr;
  780. io->ports[i].pox_tlb_err = csrs->POx_TLB_ERR.csr;
  781. io->ports[i].pox_spl_cmplt = csrs->POx_SPL_COMPLT.csr;
  782. io->ports[i].pox_trans_sum = csrs->POx_TRANS_SUM.csr;
  783. io->ports[i].pox_first_err = csrs->POx_FIRST_ERR.csr;
  784. io->ports[i].pox_mult_err = csrs->POx_MULT_ERR.csr;
  785. io->ports[i].pox_dm_source = csrs->POx_DM_SOURCE.csr;
  786. io->ports[i].pox_dm_dest = csrs->POx_DM_DEST.csr;
  787. io->ports[i].pox_dm_size = csrs->POx_DM_SIZE.csr;
  788. io->ports[i].pox_dm_ctrl = csrs->POx_DM_CTRL.csr;
  789. /*
  790. * Ack this port's errors, if any. POx_ERR_SUM must be last.
  791. *
  792. * Most of the error registers get cleared and unlocked when
  793. * the associated bits in POx_ERR_SUM are cleared (by writing
  794. * 1). POx_TLB_ERR is an exception and must be explicitly
  795. * cleared.
  796. */
  797. csrs->POx_TLB_ERR.csr = io->ports[i].pox_tlb_err;
  798. csrs->POx_ERR_SUM.csr = io->ports[i].pox_err_sum;
  799. mb();
  800. csrs->POx_ERR_SUM.csr;
  801. }
  802. /*
  803. * Ack any port 7 error(s).
  804. */
  805. io7->csrs->PO7_ERROR_SUM.csr = io->po7_error_sum;
  806. mb();
  807. io7->csrs->PO7_ERROR_SUM.csr;
  808. /*
  809. * Correct the io7_pid.
  810. */
  811. lf_subpackets->io_pid = io7->pe;
  812. return io;
  813. }
  814. static int
  815. marvel_process_io_error(struct ev7_lf_subpackets *lf_subpackets, int print)
  816. {
  817. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  818. #ifdef CONFIG_VERBOSE_MCHECK
  819. struct ev7_pal_io_subpacket *io = lf_subpackets->io;
  820. int i;
  821. #endif /* CONFIG_VERBOSE_MCHECK */
  822. #define MARVEL_IO_ERR_VALID(x) ((x) & (1UL << 63))
  823. if (!lf_subpackets->logout || !lf_subpackets->io)
  824. return status;
  825. /*
  826. * The PALcode only builds an IO subpacket if there is a
  827. * locally connected IO7. In the cases of
  828. * 1) a uniprocessor kernel
  829. * 2) an mp kernel before the local secondary has called in
  830. * error interrupts are all directed to the primary processor.
  831. * In that case, we may not have an IO subpacket at all and, event
  832. * if we do, it may not be the right now.
  833. *
  834. * If the RBOX indicates an I/O error interrupt, make sure we have
  835. * the correct IO7 information. If we don't have an IO subpacket
  836. * or it's the wrong one, try to find the right one.
  837. *
  838. * RBOX I/O error interrupts are indicated by RBOX_INT<29> and
  839. * RBOX_INT<10>.
  840. */
  841. if ((lf_subpackets->io->po7_error_sum & (1UL << 32)) ||
  842. ((lf_subpackets->io->po7_error_sum |
  843. lf_subpackets->io->ports[0].pox_err_sum |
  844. lf_subpackets->io->ports[1].pox_err_sum |
  845. lf_subpackets->io->ports[2].pox_err_sum |
  846. lf_subpackets->io->ports[3].pox_err_sum) & (1UL << 63))) {
  847. /*
  848. * Either we have no IO subpacket or no error is
  849. * indicated in the one we do have. Try find the
  850. * one with the error.
  851. */
  852. if (!marvel_find_io7_with_error(lf_subpackets))
  853. return status;
  854. }
  855. /*
  856. * We have an IO7 indicating an error - we're going to report it
  857. */
  858. status = MCHK_DISPOSITION_REPORT;
  859. #ifdef CONFIG_VERBOSE_MCHECK
  860. if (!print)
  861. return status;
  862. printk("%s*Error occurred on IO7 at PID %u\n",
  863. err_print_prefix, lf_subpackets->io_pid);
  864. /*
  865. * Check port 7 first
  866. */
  867. if (lf_subpackets->io->po7_error_sum & IO7__PO7_ERRSUM__ERR_MASK) {
  868. marvel_print_po7_err_sum(io);
  869. #if 0
  870. printk("%s PORT 7 ERROR:\n"
  871. "%s PO7_ERROR_SUM: %016llx\n"
  872. "%s PO7_UNCRR_SYM: %016llx\n"
  873. "%s PO7_CRRCT_SYM: %016llx\n"
  874. "%s PO7_UGBGE_SYM: %016llx\n"
  875. "%s PO7_ERR_PKT0: %016llx\n"
  876. "%s PO7_ERR_PKT1: %016llx\n",
  877. err_print_prefix,
  878. err_print_prefix, io->po7_error_sum,
  879. err_print_prefix, io->po7_uncrr_sym,
  880. err_print_prefix, io->po7_crrct_sym,
  881. err_print_prefix, io->po7_ugbge_sym,
  882. err_print_prefix, io->po7_err_pkt0,
  883. err_print_prefix, io->po7_err_pkt1);
  884. #endif
  885. }
  886. /*
  887. * Then loop through the ports
  888. */
  889. for (i = 0; i < IO7_NUM_PORTS; i++) {
  890. if (!MARVEL_IO_ERR_VALID(io->ports[i].pox_err_sum))
  891. continue;
  892. printk("%s PID %u PORT %d POx_ERR_SUM: %016llx\n",
  893. err_print_prefix,
  894. lf_subpackets->io_pid, i, io->ports[i].pox_err_sum);
  895. marvel_print_pox_err(io->ports[i].pox_err_sum, &io->ports[i]);
  896. printk("%s [ POx_FIRST_ERR: %016llx ]\n",
  897. err_print_prefix, io->ports[i].pox_first_err);
  898. marvel_print_pox_err(io->ports[i].pox_first_err,
  899. &io->ports[i]);
  900. }
  901. #endif /* CONFIG_VERBOSE_MCHECK */
  902. return status;
  903. }
  904. static int
  905. marvel_process_logout_frame(struct ev7_lf_subpackets *lf_subpackets, int print)
  906. {
  907. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  908. /*
  909. * I/O error?
  910. */
  911. #define EV7__RBOX_INT__IO_ERROR__MASK 0x20000400ul
  912. if (lf_subpackets->logout &&
  913. (lf_subpackets->logout->rbox_int & 0x20000400ul))
  914. status = marvel_process_io_error(lf_subpackets, print);
  915. /*
  916. * Probing behind PCI-X bridges can cause machine checks on
  917. * Marvel when the probe is handled by the bridge as a split
  918. * completion transaction. The symptom is an ERROR_RESPONSE
  919. * to a CONFIG address. Since these errors will happen in
  920. * normal operation, dismiss them.
  921. *
  922. * Dismiss if:
  923. * C_STAT = 0x14 (Error Reponse)
  924. * C_STS<3> = 0 (C_ADDR valid)
  925. * C_ADDR<42> = 1 (I/O)
  926. * C_ADDR<31:22> = 111110xxb (PCI Config space)
  927. */
  928. if (lf_subpackets->ev7 &&
  929. (lf_subpackets->ev7->c_stat == 0x14) &&
  930. !(lf_subpackets->ev7->c_sts & 0x8) &&
  931. ((lf_subpackets->ev7->c_addr & 0x400ff000000ul)
  932. == 0x400fe000000ul))
  933. status = MCHK_DISPOSITION_DISMISS;
  934. return status;
  935. }
  936. void
  937. marvel_machine_check(unsigned long vector, unsigned long la_ptr)
  938. {
  939. struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr;
  940. int (*process_frame)(struct ev7_lf_subpackets *, int) = NULL;
  941. struct ev7_lf_subpackets subpacket_collection = { NULL, };
  942. struct ev7_pal_io_subpacket scratch_io_packet = { 0, };
  943. struct ev7_lf_subpackets *lf_subpackets = NULL;
  944. int disposition = MCHK_DISPOSITION_UNKNOWN_ERROR;
  945. char *saved_err_prefix = err_print_prefix;
  946. char *error_type = NULL;
  947. /*
  948. * Sync the processor
  949. */
  950. mb();
  951. draina();
  952. switch(vector) {
  953. case SCB_Q_SYSEVENT:
  954. process_frame = marvel_process_680_frame;
  955. error_type = "System Event";
  956. break;
  957. case SCB_Q_SYSMCHK:
  958. process_frame = marvel_process_logout_frame;
  959. error_type = "System Uncorrectable Error";
  960. break;
  961. case SCB_Q_SYSERR:
  962. process_frame = marvel_process_logout_frame;
  963. error_type = "System Correctable Error";
  964. break;
  965. default:
  966. /* Don't know it - pass it up. */
  967. ev7_machine_check(vector, la_ptr);
  968. return;
  969. }
  970. /*
  971. * A system event or error has occurred, handle it here.
  972. *
  973. * Any errors in the logout frame have already been cleared by the
  974. * PALcode, so just parse it.
  975. */
  976. err_print_prefix = KERN_CRIT;
  977. /*
  978. * Parse the logout frame without printing first. If the only error(s)
  979. * found are classified as "dismissable", then just dismiss them and
  980. * don't print any message
  981. */
  982. lf_subpackets =
  983. ev7_collect_logout_frame_subpackets(el_ptr,
  984. &subpacket_collection);
  985. if (process_frame && lf_subpackets && lf_subpackets->logout) {
  986. /*
  987. * We might not have the correct (or any) I/O subpacket.
  988. * [ See marvel_process_io_error() for explanation. ]
  989. * If we don't have one, point the io subpacket in
  990. * lf_subpackets at scratch_io_packet so that
  991. * marvel_find_io7_with_error() will have someplace to
  992. * store the info.
  993. */
  994. if (!lf_subpackets->io)
  995. lf_subpackets->io = &scratch_io_packet;
  996. /*
  997. * Default io_pid to the processor reporting the error
  998. * [this will get changed in marvel_find_io7_with_error()
  999. * if a different one is needed]
  1000. */
  1001. lf_subpackets->io_pid = lf_subpackets->logout->whami;
  1002. /*
  1003. * Evaluate the frames.
  1004. */
  1005. disposition = process_frame(lf_subpackets, 0);
  1006. }
  1007. switch(disposition) {
  1008. case MCHK_DISPOSITION_DISMISS:
  1009. /* Nothing to do. */
  1010. break;
  1011. case MCHK_DISPOSITION_REPORT:
  1012. /* Recognized error, report it. */
  1013. printk("%s*%s (Vector 0x%x) reported on CPU %d\n",
  1014. err_print_prefix, error_type,
  1015. (unsigned int)vector, (int)smp_processor_id());
  1016. el_print_timestamp(&lf_subpackets->logout->timestamp);
  1017. process_frame(lf_subpackets, 1);
  1018. break;
  1019. default:
  1020. /* Unknown - dump the annotated subpackets. */
  1021. printk("%s*%s (Vector 0x%x) reported on CPU %d\n",
  1022. err_print_prefix, error_type,
  1023. (unsigned int)vector, (int)smp_processor_id());
  1024. el_process_subpacket(el_ptr);
  1025. break;
  1026. }
  1027. err_print_prefix = saved_err_prefix;
  1028. /* Release the logout frame. */
  1029. wrmces(0x7);
  1030. mb();
  1031. }
  1032. void __init
  1033. marvel_register_error_handlers(void)
  1034. {
  1035. ev7_register_error_handlers();
  1036. }