err_ev6.c 7.8 KB

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