err_marvel.c 37 KB

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