err_ev6.c 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /*
  2. * linux/arch/alpha/kernel/err_ev6.c
  3. *
  4. * Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation)
  5. *
  6. * Error handling code supporting Alpha systems
  7. */
  8. #include <linux/sched.h>
  9. #include <asm/io.h>
  10. #include <asm/irq_regs.h>
  11. #include <asm/hwrpb.h>
  12. #include <asm/smp.h>
  13. #include <asm/err_common.h>
  14. #include <asm/err_ev6.h>
  15. #include "err_impl.h"
  16. #include "proto.h"
  17. static int
  18. ev6_parse_ibox(u64 i_stat, int print)
  19. {
  20. int status = MCHK_DISPOSITION_REPORT;
  21. #define EV6__I_STAT__PAR (1UL << 29)
  22. #define EV6__I_STAT__ERRMASK (EV6__I_STAT__PAR)
  23. if (!(i_stat & EV6__I_STAT__ERRMASK))
  24. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  25. if (!print)
  26. return status;
  27. if (i_stat & EV6__I_STAT__PAR)
  28. printk("%s Icache parity error\n", err_print_prefix);
  29. return status;
  30. }
  31. static int
  32. ev6_parse_mbox(u64 mm_stat, u64 d_stat, u64 c_stat, int print)
  33. {
  34. int status = MCHK_DISPOSITION_REPORT;
  35. #define EV6__MM_STAT__DC_TAG_PERR (1UL << 10)
  36. #define EV6__MM_STAT__ERRMASK (EV6__MM_STAT__DC_TAG_PERR)
  37. #define EV6__D_STAT__TPERR_P0 (1UL << 0)
  38. #define EV6__D_STAT__TPERR_P1 (1UL << 1)
  39. #define EV6__D_STAT__ECC_ERR_ST (1UL << 2)
  40. #define EV6__D_STAT__ECC_ERR_LD (1UL << 3)
  41. #define EV6__D_STAT__SEO (1UL << 4)
  42. #define EV6__D_STAT__ERRMASK (EV6__D_STAT__TPERR_P0 | \
  43. EV6__D_STAT__TPERR_P1 | \
  44. EV6__D_STAT__ECC_ERR_ST | \
  45. EV6__D_STAT__ECC_ERR_LD | \
  46. EV6__D_STAT__SEO)
  47. if (!(d_stat & EV6__D_STAT__ERRMASK) &&
  48. !(mm_stat & EV6__MM_STAT__ERRMASK))
  49. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  50. if (!print)
  51. return status;
  52. if (mm_stat & EV6__MM_STAT__DC_TAG_PERR)
  53. printk("%s Dcache tag parity error on probe\n",
  54. err_print_prefix);
  55. if (d_stat & EV6__D_STAT__TPERR_P0)
  56. printk("%s Dcache tag parity error - pipe 0\n",
  57. err_print_prefix);
  58. if (d_stat & EV6__D_STAT__TPERR_P1)
  59. printk("%s Dcache tag parity error - pipe 1\n",
  60. err_print_prefix);
  61. if (d_stat & EV6__D_STAT__ECC_ERR_ST)
  62. printk("%s ECC error occurred on a store\n",
  63. err_print_prefix);
  64. if (d_stat & EV6__D_STAT__ECC_ERR_LD)
  65. printk("%s ECC error occurred on a %s load\n",
  66. err_print_prefix,
  67. c_stat ? "" : "speculative ");
  68. if (d_stat & EV6__D_STAT__SEO)
  69. printk("%s Dcache second error\n", err_print_prefix);
  70. return status;
  71. }
  72. static int
  73. ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn,
  74. u64 c_stat, u64 c_sts, int print)
  75. {
  76. static const char * const sourcename[] = {
  77. "UNKNOWN", "UNKNOWN", "UNKNOWN",
  78. "MEMORY", "BCACHE", "DCACHE",
  79. "BCACHE PROBE", "BCACHE PROBE"
  80. };
  81. static const char * const streamname[] = { "D", "I" };
  82. static const char * const bitsname[] = { "SINGLE", "DOUBLE" };
  83. int status = MCHK_DISPOSITION_REPORT;
  84. int source = -1, stream = -1, bits = -1;
  85. #define EV6__C_STAT__BC_PERR (0x01)
  86. #define EV6__C_STAT__DC_PERR (0x02)
  87. #define EV6__C_STAT__DSTREAM_MEM_ERR (0x03)
  88. #define EV6__C_STAT__DSTREAM_BC_ERR (0x04)
  89. #define EV6__C_STAT__DSTREAM_DC_ERR (0x05)
  90. #define EV6__C_STAT__PROBE_BC_ERR0 (0x06) /* both 6 and 7 indicate... */
  91. #define EV6__C_STAT__PROBE_BC_ERR1 (0x07) /* ...probe bc error. */
  92. #define EV6__C_STAT__ISTREAM_MEM_ERR (0x0B)
  93. #define EV6__C_STAT__ISTREAM_BC_ERR (0x0C)
  94. #define EV6__C_STAT__DSTREAM_MEM_DBL (0x13)
  95. #define EV6__C_STAT__DSTREAM_BC_DBL (0x14)
  96. #define EV6__C_STAT__ISTREAM_MEM_DBL (0x1B)
  97. #define EV6__C_STAT__ISTREAM_BC_DBL (0x1C)
  98. #define EV6__C_STAT__SOURCE_MEMORY (0x03)
  99. #define EV6__C_STAT__SOURCE_BCACHE (0x04)
  100. #define EV6__C_STAT__SOURCE__S (0)
  101. #define EV6__C_STAT__SOURCE__M (0x07)
  102. #define EV6__C_STAT__ISTREAM__S (3)
  103. #define EV6__C_STAT__ISTREAM__M (0x01)
  104. #define EV6__C_STAT__DOUBLE__S (4)
  105. #define EV6__C_STAT__DOUBLE__M (0x01)
  106. #define EV6__C_STAT__ERRMASK (0x1F)
  107. #define EV6__C_STS__SHARED (1 << 0)
  108. #define EV6__C_STS__DIRTY (1 << 1)
  109. #define EV6__C_STS__VALID (1 << 2)
  110. #define EV6__C_STS__PARITY (1 << 3)
  111. if (!(c_stat & EV6__C_STAT__ERRMASK))
  112. return MCHK_DISPOSITION_UNKNOWN_ERROR;
  113. if (!print)
  114. return status;
  115. source = EXTRACT(c_stat, EV6__C_STAT__SOURCE);
  116. stream = EXTRACT(c_stat, EV6__C_STAT__ISTREAM);
  117. bits = EXTRACT(c_stat, EV6__C_STAT__DOUBLE);
  118. if (c_stat & EV6__C_STAT__BC_PERR) {
  119. printk("%s Bcache tag parity error\n", err_print_prefix);
  120. source = -1;
  121. }
  122. if (c_stat & EV6__C_STAT__DC_PERR) {
  123. printk("%s Dcache tag parity error\n", err_print_prefix);
  124. source = -1;
  125. }
  126. if (c_stat == EV6__C_STAT__PROBE_BC_ERR0 ||
  127. c_stat == EV6__C_STAT__PROBE_BC_ERR1) {
  128. printk("%s Bcache single-bit error on a probe hit\n",
  129. err_print_prefix);
  130. source = -1;
  131. }
  132. if (source != -1)
  133. printk("%s %s-STREAM %s-BIT ECC error from %s\n",
  134. err_print_prefix,
  135. streamname[stream], bitsname[bits], sourcename[source]);
  136. printk("%s Address: 0x%016llx\n"
  137. " Syndrome[upper.lower]: %02llx.%02llx\n",
  138. err_print_prefix,
  139. c_addr,
  140. c2_syn, c1_syn);
  141. if (source == EV6__C_STAT__SOURCE_MEMORY ||
  142. source == EV6__C_STAT__SOURCE_BCACHE)
  143. printk("%s Block status: %s%s%s%s\n",
  144. err_print_prefix,
  145. (c_sts & EV6__C_STS__SHARED) ? "SHARED " : "",
  146. (c_sts & EV6__C_STS__DIRTY) ? "DIRTY " : "",
  147. (c_sts & EV6__C_STS__VALID) ? "VALID " : "",
  148. (c_sts & EV6__C_STS__PARITY) ? "PARITY " : "");
  149. return status;
  150. }
  151. void
  152. ev6_register_error_handlers(void)
  153. {
  154. /* None right now. */
  155. }
  156. int
  157. ev6_process_logout_frame(struct el_common *mchk_header, int print)
  158. {
  159. struct el_common_EV6_mcheck *ev6mchk =
  160. (struct el_common_EV6_mcheck *)mchk_header;
  161. int status = MCHK_DISPOSITION_UNKNOWN_ERROR;
  162. status |= ev6_parse_ibox(ev6mchk->I_STAT, print);
  163. status |= ev6_parse_mbox(ev6mchk->MM_STAT, ev6mchk->DC_STAT,
  164. ev6mchk->C_STAT, print);
  165. status |= ev6_parse_cbox(ev6mchk->C_ADDR, ev6mchk->DC1_SYNDROME,
  166. ev6mchk->DC0_SYNDROME, ev6mchk->C_STAT,
  167. ev6mchk->C_STS, print);
  168. if (!print)
  169. return status;
  170. if (status != MCHK_DISPOSITION_DISMISS) {
  171. char *saved_err_prefix = err_print_prefix;
  172. /*
  173. * Dump some additional information from the frame
  174. */
  175. printk("%s EXC_ADDR: 0x%016lx IER_CM: 0x%016lx"
  176. " ISUM: 0x%016lx\n"
  177. " PAL_BASE: 0x%016lx I_CTL: 0x%016lx"
  178. " PCTX: 0x%016lx\n",
  179. err_print_prefix,
  180. ev6mchk->EXC_ADDR, ev6mchk->IER_CM, ev6mchk->ISUM,
  181. ev6mchk->PAL_BASE, ev6mchk->I_CTL, ev6mchk->PCTX);
  182. if (status == MCHK_DISPOSITION_UNKNOWN_ERROR) {
  183. printk("%s UNKNOWN error, frame follows:\n",
  184. err_print_prefix);
  185. } else {
  186. /* had decode -- downgrade print level for frame */
  187. err_print_prefix = KERN_NOTICE;
  188. }
  189. mchk_dump_logout_frame(mchk_header);
  190. err_print_prefix = saved_err_prefix;
  191. }
  192. return status;
  193. }
  194. void
  195. ev6_machine_check(unsigned long vector, unsigned long la_ptr)
  196. {
  197. struct el_common *mchk_header = (struct el_common *)la_ptr;
  198. /*
  199. * Sync the processor
  200. */
  201. mb();
  202. draina();
  203. /*
  204. * Parse the logout frame without printing first. If the only error(s)
  205. * found are have a disposition of "dismiss", then just dismiss them
  206. * and don't print any message
  207. */
  208. if (ev6_process_logout_frame(mchk_header, 0) !=
  209. MCHK_DISPOSITION_DISMISS) {
  210. char *saved_err_prefix = err_print_prefix;
  211. err_print_prefix = KERN_CRIT;
  212. /*
  213. * Either a nondismissable error was detected or no
  214. * recognized error was detected in the logout frame
  215. * -- report the error in either case
  216. */
  217. printk("%s*CPU %s Error (Vector 0x%x) reported on CPU %d:\n",
  218. err_print_prefix,
  219. (vector == SCB_Q_PROCERR)?"Correctable":"Uncorrectable",
  220. (unsigned int)vector, (int)smp_processor_id());
  221. ev6_process_logout_frame(mchk_header, 1);
  222. dik_show_regs(get_irq_regs(), NULL);
  223. err_print_prefix = saved_err_prefix;
  224. }
  225. /*
  226. * Release the logout frame
  227. */
  228. wrmces(0x7);
  229. mb();
  230. }