err_marvel.c 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  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 %lld%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: %lld - Dest PID: %lld - 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): %lld:%lld:%lld\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. static const char * const pcix_cmd[] = {
  535. "Interrupt Acknowledge",
  536. "Special Cycle",
  537. "I/O Read",
  538. "I/O Write",
  539. "Reserved",
  540. "Reserved / Device ID Message",
  541. "Memory Read",
  542. "Memory Write",
  543. "Reserved / Alias to Memory Read Block",
  544. "Reserved / Alias to Memory Write Block",
  545. "Configuration Read",
  546. "Configuration Write",
  547. "Memory Read Multiple / Split Completion",
  548. "Dual Address Cycle",
  549. "Memory Read Line / Memory Read Block",
  550. "Memory Write and Invalidate / Memory Write Block"
  551. };
  552. #define IO7__POX_TRANSUM__PCI_ADDR__S (0)
  553. #define IO7__POX_TRANSUM__PCI_ADDR__M (0x3fffffffffffful)
  554. #define IO7__POX_TRANSUM__DAC (1UL << 50)
  555. #define IO7__POX_TRANSUM__PCIX_MASTER_SLOT__S (52)
  556. #define IO7__POX_TRANSUM__PCIX_MASTER_SLOT__M (0xf)
  557. #define IO7__POX_TRANSUM__PCIX_CMD__S (56)
  558. #define IO7__POX_TRANSUM__PCIX_CMD__M (0xf)
  559. #define IO7__POX_TRANSUM__ERR_VALID (1UL << 63)
  560. if (!(trans_sum & IO7__POX_TRANSUM__ERR_VALID))
  561. return;
  562. printk("%s Transaction Summary:\n"
  563. "%s Command: 0x%llx - %s\n"
  564. "%s Address: 0x%016llx%s\n"
  565. "%s PCI-X Master Slot: 0x%llx\n",
  566. err_print_prefix,
  567. err_print_prefix,
  568. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_CMD),
  569. pcix_cmd[EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_CMD)],
  570. err_print_prefix,
  571. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCI_ADDR),
  572. (trans_sum & IO7__POX_TRANSUM__DAC) ? " (DAC)" : "",
  573. err_print_prefix,
  574. EXTRACT(trans_sum, IO7__POX_TRANSUM__PCIX_MASTER_SLOT));
  575. }
  576. static void
  577. marvel_print_pox_err(u64 err_sum, struct ev7_pal_io_one_port *port)
  578. {
  579. #define IO7__POX_ERRSUM__AGP_REQQ_OVFL (1UL << 4)
  580. #define IO7__POX_ERRSUM__AGP_SYNC_ERR (1UL << 5)
  581. #define IO7__POX_ERRSUM__MRETRY_TO (1UL << 6)
  582. #define IO7__POX_ERRSUM__PCIX_UX_SPL (1UL << 7)
  583. #define IO7__POX_ERRSUM__PCIX_SPLIT_TO (1UL << 8)
  584. #define IO7__POX_ERRSUM__PCIX_DISCARD_SPL (1UL << 9)
  585. #define IO7__POX_ERRSUM__DMA_RD_TO (1UL << 10)
  586. #define IO7__POX_ERRSUM__CSR_NXM_RD (1UL << 11)
  587. #define IO7__POX_ERRSUM__CSR_NXM_WR (1UL << 12)
  588. #define IO7__POX_ERRSUM__DMA_TO (1UL << 13)
  589. #define IO7__POX_ERRSUM__ALL_MABORTS (1UL << 14)
  590. #define IO7__POX_ERRSUM__MABORT (1UL << 15)
  591. #define IO7__POX_ERRSUM__MABORT_MASK (IO7__POX_ERRSUM__ALL_MABORTS|\
  592. IO7__POX_ERRSUM__MABORT)
  593. #define IO7__POX_ERRSUM__PT_TABORT (1UL << 16)
  594. #define IO7__POX_ERRSUM__PM_TABORT (1UL << 17)
  595. #define IO7__POX_ERRSUM__TABORT_MASK (IO7__POX_ERRSUM__PT_TABORT | \
  596. IO7__POX_ERRSUM__PM_TABORT)
  597. #define IO7__POX_ERRSUM__SERR (1UL << 18)
  598. #define IO7__POX_ERRSUM__ADDRERR_STB (1UL << 19)
  599. #define IO7__POX_ERRSUM__DETECTED_SERR (1UL << 20)
  600. #define IO7__POX_ERRSUM__PERR (1UL << 21)
  601. #define IO7__POX_ERRSUM__DATAERR_STB_NIOW (1UL << 22)
  602. #define IO7__POX_ERRSUM__DETECTED_PERR (1UL << 23)
  603. #define IO7__POX_ERRSUM__PM_PERR (1UL << 24)
  604. #define IO7__POX_ERRSUM__PT_SCERROR (1UL << 26)
  605. #define IO7__POX_ERRSUM__HUNG_BUS (1UL << 28)
  606. #define IO7__POX_ERRSUM__UPE_ERROR__S (51)
  607. #define IO7__POX_ERRSUM__UPE_ERROR__M (0xffUL)
  608. #define IO7__POX_ERRSUM__UPE_ERROR GEN_MASK(IO7__POX_ERRSUM__UPE_ERROR)
  609. #define IO7__POX_ERRSUM__TLB_ERR (1UL << 59)
  610. #define IO7__POX_ERRSUM__ERR_VALID (1UL << 63)
  611. #define IO7__POX_ERRSUM__TRANS_SUM__MASK (IO7__POX_ERRSUM__MRETRY_TO | \
  612. IO7__POX_ERRSUM__PCIX_UX_SPL | \
  613. IO7__POX_ERRSUM__PCIX_SPLIT_TO | \
  614. IO7__POX_ERRSUM__DMA_TO | \
  615. IO7__POX_ERRSUM__MABORT_MASK | \
  616. IO7__POX_ERRSUM__TABORT_MASK | \
  617. IO7__POX_ERRSUM__SERR | \
  618. IO7__POX_ERRSUM__ADDRERR_STB | \
  619. IO7__POX_ERRSUM__PERR | \
  620. IO7__POX_ERRSUM__DATAERR_STB_NIOW |\
  621. IO7__POX_ERRSUM__DETECTED_PERR | \
  622. IO7__POX_ERRSUM__PM_PERR | \
  623. IO7__POX_ERRSUM__PT_SCERROR | \
  624. IO7__POX_ERRSUM__UPE_ERROR)
  625. if (!(err_sum & IO7__POX_ERRSUM__ERR_VALID))
  626. return;
  627. /*
  628. * First the transaction summary errors
  629. */
  630. if (err_sum & IO7__POX_ERRSUM__MRETRY_TO)
  631. printk("%s IO7 Master Retry Timeout expired\n",
  632. err_print_prefix);
  633. if (err_sum & IO7__POX_ERRSUM__PCIX_UX_SPL)
  634. printk("%s Unexpected Split Completion\n",
  635. err_print_prefix);
  636. if (err_sum & IO7__POX_ERRSUM__PCIX_SPLIT_TO)
  637. printk("%s IO7 Split Completion Timeout expired\n",
  638. err_print_prefix);
  639. if (err_sum & IO7__POX_ERRSUM__DMA_TO)
  640. printk("%s Hung bus during DMA transaction\n",
  641. err_print_prefix);
  642. if (err_sum & IO7__POX_ERRSUM__MABORT_MASK)
  643. printk("%s Master Abort\n", err_print_prefix);
  644. if (err_sum & IO7__POX_ERRSUM__PT_TABORT)
  645. printk("%s IO7 Asserted Target Abort\n", err_print_prefix);
  646. if (err_sum & IO7__POX_ERRSUM__PM_TABORT)
  647. printk("%s IO7 Received Target Abort\n", err_print_prefix);
  648. if (err_sum & IO7__POX_ERRSUM__ADDRERR_STB) {
  649. printk("%s Address or PCI-X Attribute Parity Error\n",
  650. err_print_prefix);
  651. if (err_sum & IO7__POX_ERRSUM__SERR)
  652. printk("%s IO7 Asserted SERR\n", err_print_prefix);
  653. }
  654. if (err_sum & IO7__POX_ERRSUM__PERR) {
  655. if (err_sum & IO7__POX_ERRSUM__DATAERR_STB_NIOW)
  656. printk("%s IO7 Detected Data Parity Error\n",
  657. err_print_prefix);
  658. else
  659. printk("%s Split Completion Response with "
  660. "Parity Error\n", err_print_prefix);
  661. }
  662. if (err_sum & IO7__POX_ERRSUM__DETECTED_PERR)
  663. printk("%s PERR detected\n", err_print_prefix);
  664. if (err_sum & IO7__POX_ERRSUM__PM_PERR)
  665. printk("%s PERR while IO7 is master\n", err_print_prefix);
  666. if (err_sum & IO7__POX_ERRSUM__PT_SCERROR) {
  667. printk("%s IO7 Received Split Completion Error message\n",
  668. err_print_prefix);
  669. marvel_print_pox_spl_cmplt(port->pox_spl_cmplt);
  670. }
  671. if (err_sum & IO7__POX_ERRSUM__UPE_ERROR) {
  672. unsigned int upe_error = EXTRACT(err_sum,
  673. IO7__POX_ERRSUM__UPE_ERROR);
  674. int i;
  675. static char *upe_errors[] = {
  676. "Parity Error on MSI write data",
  677. "MSI read (MSI window is write only",
  678. "TLB - Invalid WR transaction",
  679. "TLB - Invalid RD transaction",
  680. "DMA - WR error (see north port)",
  681. "DMA - RD error (see north port)",
  682. "PPR - WR error (see north port)",
  683. "PPR - RD error (see north port)"
  684. };
  685. printk("%s UPE Error:\n", err_print_prefix);
  686. for (i = 0; i < 8; i++) {
  687. if (upe_error & (1 << i))
  688. printk("%s %s\n", err_print_prefix,
  689. upe_errors[i]);
  690. }
  691. }
  692. /*
  693. * POx_TRANS_SUM, if appropriate.
  694. */
  695. if (err_sum & IO7__POX_ERRSUM__TRANS_SUM__MASK)
  696. marvel_print_pox_trans_sum(port->pox_trans_sum);
  697. /*
  698. * Then TLB_ERR.
  699. */
  700. if (err_sum & IO7__POX_ERRSUM__TLB_ERR) {
  701. printk("%s TLB ERROR\n", err_print_prefix);
  702. marvel_print_pox_tlb_err(port->pox_tlb_err);
  703. }
  704. /*
  705. * And the single bit status errors.
  706. */
  707. if (err_sum & IO7__POX_ERRSUM__AGP_REQQ_OVFL)
  708. printk("%s AGP Request Queue Overflow\n", err_print_prefix);
  709. if (err_sum & IO7__POX_ERRSUM__AGP_SYNC_ERR)
  710. printk("%s AGP Sync Error\n", err_print_prefix);
  711. if (err_sum & IO7__POX_ERRSUM__PCIX_DISCARD_SPL)
  712. printk("%s Discarded split completion\n", err_print_prefix);
  713. if (err_sum & IO7__POX_ERRSUM__DMA_RD_TO)
  714. printk("%s DMA Read Timeout\n", err_print_prefix);
  715. if (err_sum & IO7__POX_ERRSUM__CSR_NXM_RD)
  716. printk("%s CSR NXM READ\n", err_print_prefix);
  717. if (err_sum & IO7__POX_ERRSUM__CSR_NXM_WR)
  718. printk("%s CSR NXM WRITE\n", err_print_prefix);
  719. if (err_sum & IO7__POX_ERRSUM__DETECTED_SERR)
  720. printk("%s SERR detected\n", err_print_prefix);
  721. if (err_sum & IO7__POX_ERRSUM__HUNG_BUS)
  722. printk("%s HUNG BUS detected\n", err_print_prefix);
  723. }
  724. #endif /* CONFIG_VERBOSE_MCHECK */
  725. static struct ev7_pal_io_subpacket *
  726. marvel_find_io7_with_error(struct ev7_lf_subpackets *lf_subpackets)
  727. {
  728. struct ev7_pal_io_subpacket *io = lf_subpackets->io;
  729. struct io7 *io7;
  730. int i;
  731. /*
  732. * Caller must provide the packet to fill
  733. */
  734. if (!io)
  735. return NULL;
  736. /*
  737. * Fill the subpacket with the console's standard fill pattern
  738. */
  739. memset(io, 0x55, sizeof(*io));
  740. for (io7 = NULL; NULL != (io7 = marvel_next_io7(io7)); ) {
  741. unsigned long err_sum = 0;
  742. err_sum |= io7->csrs->PO7_ERROR_SUM.csr;
  743. for (i = 0; i < IO7_NUM_PORTS; i++) {
  744. if (!io7->ports[i].enabled)
  745. continue;
  746. err_sum |= io7->ports[i].csrs->POx_ERR_SUM.csr;
  747. }
  748. /*
  749. * Is there at least one error?
  750. */
  751. if (err_sum & (1UL << 63))
  752. break;
  753. }
  754. /*
  755. * Did we find an IO7 with an error?
  756. */
  757. if (!io7)
  758. return NULL;
  759. /*
  760. * We have an IO7 with an error.
  761. *
  762. * Fill in the IO subpacket.
  763. */
  764. io->io_asic_rev = io7->csrs->IO_ASIC_REV.csr;
  765. io->io_sys_rev = io7->csrs->IO_SYS_REV.csr;
  766. io->io7_uph = io7->csrs->IO7_UPH.csr;
  767. io->hpi_ctl = io7->csrs->HPI_CTL.csr;
  768. io->crd_ctl = io7->csrs->CRD_CTL.csr;
  769. io->hei_ctl = io7->csrs->HEI_CTL.csr;
  770. io->po7_error_sum = io7->csrs->PO7_ERROR_SUM.csr;
  771. io->po7_uncrr_sym = io7->csrs->PO7_UNCRR_SYM.csr;
  772. io->po7_crrct_sym = io7->csrs->PO7_CRRCT_SYM.csr;
  773. io->po7_ugbge_sym = io7->csrs->PO7_UGBGE_SYM.csr;
  774. io->po7_err_pkt0 = io7->csrs->PO7_ERR_PKT[0].csr;
  775. io->po7_err_pkt1 = io7->csrs->PO7_ERR_PKT[1].csr;
  776. for (i = 0; i < IO7_NUM_PORTS; i++) {
  777. io7_ioport_csrs *csrs = io7->ports[i].csrs;
  778. if (!io7->ports[i].enabled)
  779. continue;
  780. io->ports[i].pox_err_sum = csrs->POx_ERR_SUM.csr;
  781. io->ports[i].pox_tlb_err = csrs->POx_TLB_ERR.csr;
  782. io->ports[i].pox_spl_cmplt = csrs->POx_SPL_COMPLT.csr;
  783. io->ports[i].pox_trans_sum = csrs->POx_TRANS_SUM.csr;
  784. io->ports[i].pox_first_err = csrs->POx_FIRST_ERR.csr;
  785. io->ports[i].pox_mult_err = csrs->POx_MULT_ERR.csr;
  786. io->ports[i].pox_dm_source = csrs->POx_DM_SOURCE.csr;
  787. io->ports[i].pox_dm_dest = csrs->POx_DM_DEST.csr;
  788. io->ports[i].pox_dm_size = csrs->POx_DM_SIZE.csr;
  789. io->ports[i].pox_dm_ctrl = csrs->POx_DM_CTRL.csr;
  790. /*
  791. * Ack this port's errors, if any. POx_ERR_SUM must be last.
  792. *
  793. * Most of the error registers get cleared and unlocked when
  794. * the associated bits in POx_ERR_SUM are cleared (by writing
  795. * 1). POx_TLB_ERR is an exception and must be explicitly
  796. * cleared.
  797. */
  798. csrs->POx_TLB_ERR.csr = io->ports[i].pox_tlb_err;
  799. csrs->POx_ERR_SUM.csr = io->ports[i].pox_err_sum;
  800. mb();
  801. csrs->POx_ERR_SUM.csr;
  802. }
  803. /*
  804. * Ack any port 7 error(s).
  805. */
  806. io7->csrs->PO7_ERROR_SUM.csr = io->po7_error_sum;
  807. mb();
  808. io7->csrs->PO7_ERROR_SUM.csr;
  809. /*
  810. * Correct the io7_pid.
  811. */
  812. lf_subpackets->io_pid = io7->pe;
  813. return io;
  814. }
  815. static int
  816. marvel_process_io_error(struct ev7_lf_subpackets *lf_subpackets, int print)
  817. {
  818. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  819. #ifdef CONFIG_VERBOSE_MCHECK
  820. struct ev7_pal_io_subpacket *io = lf_subpackets->io;
  821. int i;
  822. #endif /* CONFIG_VERBOSE_MCHECK */
  823. #define MARVEL_IO_ERR_VALID(x) ((x) & (1UL << 63))
  824. if (!lf_subpackets->logout || !lf_subpackets->io)
  825. return status;
  826. /*
  827. * The PALcode only builds an IO subpacket if there is a
  828. * locally connected IO7. In the cases of
  829. * 1) a uniprocessor kernel
  830. * 2) an mp kernel before the local secondary has called in
  831. * error interrupts are all directed to the primary processor.
  832. * In that case, we may not have an IO subpacket at all and, event
  833. * if we do, it may not be the right now.
  834. *
  835. * If the RBOX indicates an I/O error interrupt, make sure we have
  836. * the correct IO7 information. If we don't have an IO subpacket
  837. * or it's the wrong one, try to find the right one.
  838. *
  839. * RBOX I/O error interrupts are indicated by RBOX_INT<29> and
  840. * RBOX_INT<10>.
  841. */
  842. if ((lf_subpackets->io->po7_error_sum & (1UL << 32)) ||
  843. ((lf_subpackets->io->po7_error_sum |
  844. lf_subpackets->io->ports[0].pox_err_sum |
  845. lf_subpackets->io->ports[1].pox_err_sum |
  846. lf_subpackets->io->ports[2].pox_err_sum |
  847. lf_subpackets->io->ports[3].pox_err_sum) & (1UL << 63))) {
  848. /*
  849. * Either we have no IO subpacket or no error is
  850. * indicated in the one we do have. Try find the
  851. * one with the error.
  852. */
  853. if (!marvel_find_io7_with_error(lf_subpackets))
  854. return status;
  855. }
  856. /*
  857. * We have an IO7 indicating an error - we're going to report it
  858. */
  859. status = MCHK_DISPOSITION_REPORT;
  860. #ifdef CONFIG_VERBOSE_MCHECK
  861. if (!print)
  862. return status;
  863. printk("%s*Error occurred on IO7 at PID %u\n",
  864. err_print_prefix, lf_subpackets->io_pid);
  865. /*
  866. * Check port 7 first
  867. */
  868. if (lf_subpackets->io->po7_error_sum & IO7__PO7_ERRSUM__ERR_MASK) {
  869. marvel_print_po7_err_sum(io);
  870. #if 0
  871. printk("%s PORT 7 ERROR:\n"
  872. "%s PO7_ERROR_SUM: %016llx\n"
  873. "%s PO7_UNCRR_SYM: %016llx\n"
  874. "%s PO7_CRRCT_SYM: %016llx\n"
  875. "%s PO7_UGBGE_SYM: %016llx\n"
  876. "%s PO7_ERR_PKT0: %016llx\n"
  877. "%s PO7_ERR_PKT1: %016llx\n",
  878. err_print_prefix,
  879. err_print_prefix, io->po7_error_sum,
  880. err_print_prefix, io->po7_uncrr_sym,
  881. err_print_prefix, io->po7_crrct_sym,
  882. err_print_prefix, io->po7_ugbge_sym,
  883. err_print_prefix, io->po7_err_pkt0,
  884. err_print_prefix, io->po7_err_pkt1);
  885. #endif
  886. }
  887. /*
  888. * Then loop through the ports
  889. */
  890. for (i = 0; i < IO7_NUM_PORTS; i++) {
  891. if (!MARVEL_IO_ERR_VALID(io->ports[i].pox_err_sum))
  892. continue;
  893. printk("%s PID %u PORT %d POx_ERR_SUM: %016llx\n",
  894. err_print_prefix,
  895. lf_subpackets->io_pid, i, io->ports[i].pox_err_sum);
  896. marvel_print_pox_err(io->ports[i].pox_err_sum, &io->ports[i]);
  897. printk("%s [ POx_FIRST_ERR: %016llx ]\n",
  898. err_print_prefix, io->ports[i].pox_first_err);
  899. marvel_print_pox_err(io->ports[i].pox_first_err,
  900. &io->ports[i]);
  901. }
  902. #endif /* CONFIG_VERBOSE_MCHECK */
  903. return status;
  904. }
  905. static int
  906. marvel_process_logout_frame(struct ev7_lf_subpackets *lf_subpackets, int print)
  907. {
  908. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  909. /*
  910. * I/O error?
  911. */
  912. #define EV7__RBOX_INT__IO_ERROR__MASK 0x20000400ul
  913. if (lf_subpackets->logout &&
  914. (lf_subpackets->logout->rbox_int & 0x20000400ul))
  915. status = marvel_process_io_error(lf_subpackets, print);
  916. /*
  917. * Probing behind PCI-X bridges can cause machine checks on
  918. * Marvel when the probe is handled by the bridge as a split
  919. * completion transaction. The symptom is an ERROR_RESPONSE
  920. * to a CONFIG address. Since these errors will happen in
  921. * normal operation, dismiss them.
  922. *
  923. * Dismiss if:
  924. * C_STAT = 0x14 (Error Response)
  925. * C_STS<3> = 0 (C_ADDR valid)
  926. * C_ADDR<42> = 1 (I/O)
  927. * C_ADDR<31:22> = 111110xxb (PCI Config space)
  928. */
  929. if (lf_subpackets->ev7 &&
  930. (lf_subpackets->ev7->c_stat == 0x14) &&
  931. !(lf_subpackets->ev7->c_sts & 0x8) &&
  932. ((lf_subpackets->ev7->c_addr & 0x400ff000000ul)
  933. == 0x400fe000000ul))
  934. status = MCHK_DISPOSITION_DISMISS;
  935. return status;
  936. }
  937. void
  938. marvel_machine_check(unsigned long vector, unsigned long la_ptr)
  939. {
  940. struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr;
  941. int (*process_frame)(struct ev7_lf_subpackets *, int) = NULL;
  942. struct ev7_lf_subpackets subpacket_collection = { NULL, };
  943. struct ev7_pal_io_subpacket scratch_io_packet = { 0, };
  944. struct ev7_lf_subpackets *lf_subpackets = NULL;
  945. int disposition = MCHK_DISPOSITION_UNKNOWN_ERROR;
  946. char *saved_err_prefix = err_print_prefix;
  947. char *error_type = NULL;
  948. /*
  949. * Sync the processor
  950. */
  951. mb();
  952. draina();
  953. switch(vector) {
  954. case SCB_Q_SYSEVENT:
  955. process_frame = marvel_process_680_frame;
  956. error_type = "System Event";
  957. break;
  958. case SCB_Q_SYSMCHK:
  959. process_frame = marvel_process_logout_frame;
  960. error_type = "System Uncorrectable Error";
  961. break;
  962. case SCB_Q_SYSERR:
  963. process_frame = marvel_process_logout_frame;
  964. error_type = "System Correctable Error";
  965. break;
  966. default:
  967. /* Don't know it - pass it up. */
  968. ev7_machine_check(vector, la_ptr);
  969. return;
  970. }
  971. /*
  972. * A system event or error has occurred, handle it here.
  973. *
  974. * Any errors in the logout frame have already been cleared by the
  975. * PALcode, so just parse it.
  976. */
  977. err_print_prefix = KERN_CRIT;
  978. /*
  979. * Parse the logout frame without printing first. If the only error(s)
  980. * found are classified as "dismissable", then just dismiss them and
  981. * don't print any message
  982. */
  983. lf_subpackets =
  984. ev7_collect_logout_frame_subpackets(el_ptr,
  985. &subpacket_collection);
  986. if (process_frame && lf_subpackets && lf_subpackets->logout) {
  987. /*
  988. * We might not have the correct (or any) I/O subpacket.
  989. * [ See marvel_process_io_error() for explanation. ]
  990. * If we don't have one, point the io subpacket in
  991. * lf_subpackets at scratch_io_packet so that
  992. * marvel_find_io7_with_error() will have someplace to
  993. * store the info.
  994. */
  995. if (!lf_subpackets->io)
  996. lf_subpackets->io = &scratch_io_packet;
  997. /*
  998. * Default io_pid to the processor reporting the error
  999. * [this will get changed in marvel_find_io7_with_error()
  1000. * if a different one is needed]
  1001. */
  1002. lf_subpackets->io_pid = lf_subpackets->logout->whami;
  1003. /*
  1004. * Evaluate the frames.
  1005. */
  1006. disposition = process_frame(lf_subpackets, 0);
  1007. }
  1008. switch(disposition) {
  1009. case MCHK_DISPOSITION_DISMISS:
  1010. /* Nothing to do. */
  1011. break;
  1012. case MCHK_DISPOSITION_REPORT:
  1013. /* Recognized error, report it. */
  1014. printk("%s*%s (Vector 0x%x) reported on CPU %d\n",
  1015. err_print_prefix, error_type,
  1016. (unsigned int)vector, (int)smp_processor_id());
  1017. el_print_timestamp(&lf_subpackets->logout->timestamp);
  1018. process_frame(lf_subpackets, 1);
  1019. break;
  1020. default:
  1021. /* Unknown - dump the annotated subpackets. */
  1022. printk("%s*%s (Vector 0x%x) reported on CPU %d\n",
  1023. err_print_prefix, error_type,
  1024. (unsigned int)vector, (int)smp_processor_id());
  1025. el_process_subpacket(el_ptr);
  1026. break;
  1027. }
  1028. err_print_prefix = saved_err_prefix;
  1029. /* Release the logout frame. */
  1030. wrmces(0x7);
  1031. mb();
  1032. }
  1033. void __init
  1034. marvel_register_error_handlers(void)
  1035. {
  1036. ev7_register_error_handlers();
  1037. }