err_ev7.c 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /*
  2. * linux/arch/alpha/kernel/err_ev7.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/hwrpb.h>
  12. #include <asm/smp.h>
  13. #include <asm/err_common.h>
  14. #include <asm/err_ev7.h>
  15. #include "err_impl.h"
  16. #include "proto.h"
  17. struct ev7_lf_subpackets *
  18. ev7_collect_logout_frame_subpackets(struct el_subpacket *el_ptr,
  19. struct ev7_lf_subpackets *lf_subpackets)
  20. {
  21. struct el_subpacket *subpacket;
  22. int i;
  23. /*
  24. * A Marvel machine check frame is always packaged in an
  25. * el_subpacket of class HEADER, type LOGOUT_FRAME.
  26. */
  27. if (el_ptr->class != EL_CLASS__HEADER ||
  28. el_ptr->type != EL_TYPE__HEADER__LOGOUT_FRAME)
  29. return NULL;
  30. /*
  31. * It is a logout frame header. Look at the one subpacket.
  32. */
  33. el_ptr = (struct el_subpacket *)
  34. ((unsigned long)el_ptr + el_ptr->length);
  35. /*
  36. * It has to be class PAL, type LOGOUT_FRAME.
  37. */
  38. if (el_ptr->class != EL_CLASS__PAL ||
  39. el_ptr->type != EL_TYPE__PAL__LOGOUT_FRAME)
  40. return NULL;
  41. lf_subpackets->logout = (struct ev7_pal_logout_subpacket *)
  42. el_ptr->by_type.raw.data_start;
  43. /*
  44. * Process the subpackets.
  45. */
  46. subpacket = (struct el_subpacket *)
  47. ((unsigned long)el_ptr + el_ptr->length);
  48. for (i = 0;
  49. subpacket && i < lf_subpackets->logout->subpacket_count;
  50. subpacket = (struct el_subpacket *)
  51. ((unsigned long)subpacket + subpacket->length), i++) {
  52. /*
  53. * All subpackets should be class PAL.
  54. */
  55. if (subpacket->class != EL_CLASS__PAL) {
  56. printk("%s**UNEXPECTED SUBPACKET CLASS %d "
  57. "IN LOGOUT FRAME (packet %d\n",
  58. err_print_prefix, subpacket->class, i);
  59. return NULL;
  60. }
  61. /*
  62. * Remember the subpacket.
  63. */
  64. switch(subpacket->type) {
  65. case EL_TYPE__PAL__EV7_PROCESSOR:
  66. lf_subpackets->ev7 =
  67. (struct ev7_pal_processor_subpacket *)
  68. subpacket->by_type.raw.data_start;
  69. break;
  70. case EL_TYPE__PAL__EV7_RBOX:
  71. lf_subpackets->rbox = (struct ev7_pal_rbox_subpacket *)
  72. subpacket->by_type.raw.data_start;
  73. break;
  74. case EL_TYPE__PAL__EV7_ZBOX:
  75. lf_subpackets->zbox = (struct ev7_pal_zbox_subpacket *)
  76. subpacket->by_type.raw.data_start;
  77. break;
  78. case EL_TYPE__PAL__EV7_IO:
  79. lf_subpackets->io = (struct ev7_pal_io_subpacket *)
  80. subpacket->by_type.raw.data_start;
  81. break;
  82. case EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE:
  83. case EL_TYPE__PAL__ENV__AIRMOVER_FAN:
  84. case EL_TYPE__PAL__ENV__VOLTAGE:
  85. case EL_TYPE__PAL__ENV__INTRUSION:
  86. case EL_TYPE__PAL__ENV__POWER_SUPPLY:
  87. case EL_TYPE__PAL__ENV__LAN:
  88. case EL_TYPE__PAL__ENV__HOT_PLUG:
  89. lf_subpackets->env[ev7_lf_env_index(subpacket->type)] =
  90. (struct ev7_pal_environmental_subpacket *)
  91. subpacket->by_type.raw.data_start;
  92. break;
  93. default:
  94. /*
  95. * Don't know what kind of frame this is.
  96. */
  97. return NULL;
  98. }
  99. }
  100. return lf_subpackets;
  101. }
  102. void
  103. ev7_machine_check(unsigned long vector, unsigned long la_ptr)
  104. {
  105. struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr;
  106. char *saved_err_prefix = err_print_prefix;
  107. /*
  108. * Sync the processor
  109. */
  110. mb();
  111. draina();
  112. err_print_prefix = KERN_CRIT;
  113. printk("%s*CPU %s Error (Vector 0x%x) reported on CPU %d\n",
  114. err_print_prefix,
  115. (vector == SCB_Q_PROCERR) ? "Correctable" : "Uncorrectable",
  116. (unsigned int)vector, (int)smp_processor_id());
  117. el_process_subpacket(el_ptr);
  118. err_print_prefix = saved_err_prefix;
  119. /*
  120. * Release the logout frame
  121. */
  122. wrmces(0x7);
  123. mb();
  124. }
  125. static char *el_ev7_processor_subpacket_annotation[] = {
  126. "Subpacket Header", "I_STAT", "DC_STAT",
  127. "C_ADDR", "C_SYNDROME_1", "C_SYNDROME_0",
  128. "C_STAT", "C_STS", "MM_STAT",
  129. "EXC_ADDR", "IER_CM", "ISUM",
  130. "PAL_BASE", "I_CTL", "PROCESS_CONTEXT",
  131. "CBOX_CTL", "CBOX_STP_CTL", "CBOX_ACC_CTL",
  132. "CBOX_LCL_SET", "CBOX_GLB_SET", "BBOX_CTL",
  133. "BBOX_ERR_STS", "BBOX_ERR_IDX", "CBOX_DDP_ERR_STS",
  134. "BBOX_DAT_RMP", NULL
  135. };
  136. static char *el_ev7_zbox_subpacket_annotation[] = {
  137. "Subpacket Header",
  138. "ZBOX(0): DRAM_ERR_STATUS_2 / DRAM_ERR_STATUS_1",
  139. "ZBOX(0): DRAM_ERROR_CTL / DRAM_ERR_STATUS_3",
  140. "ZBOX(0): DIFT_TIMEOUT / DRAM_ERR_ADR",
  141. "ZBOX(0): FRC_ERR_ADR / DRAM_MAPPER_CTL",
  142. "ZBOX(0): reserved / DIFT_ERR_STATUS",
  143. "ZBOX(1): DRAM_ERR_STATUS_2 / DRAM_ERR_STATUS_1",
  144. "ZBOX(1): DRAM_ERROR_CTL / DRAM_ERR_STATUS_3",
  145. "ZBOX(1): DIFT_TIMEOUT / DRAM_ERR_ADR",
  146. "ZBOX(1): FRC_ERR_ADR / DRAM_MAPPER_CTL",
  147. "ZBOX(1): reserved / DIFT_ERR_STATUS",
  148. "CBOX_CTL", "CBOX_STP_CTL",
  149. "ZBOX(0)_ERROR_PA", "ZBOX(1)_ERROR_PA",
  150. "ZBOX(0)_ORED_SYNDROME","ZBOX(1)_ORED_SYNDROME",
  151. NULL
  152. };
  153. static char *el_ev7_rbox_subpacket_annotation[] = {
  154. "Subpacket Header", "RBOX_CFG", "RBOX_N_CFG",
  155. "RBOX_S_CFG", "RBOX_E_CFG", "RBOX_W_CFG",
  156. "RBOX_N_ERR", "RBOX_S_ERR", "RBOX_E_ERR",
  157. "RBOX_W_ERR", "RBOX_IO_CFG", "RBOX_IO_ERR",
  158. "RBOX_L_ERR", "RBOX_WHOAMI", "RBOX_IMASL",
  159. "RBOX_INTQ", "RBOX_INT", NULL
  160. };
  161. static char *el_ev7_io_subpacket_annotation[] = {
  162. "Subpacket Header", "IO_ASIC_REV", "IO_SYS_REV",
  163. "IO7_UPH", "HPI_CTL", "CRD_CTL",
  164. "HEI_CTL", "PO7_ERROR_SUM","PO7_UNCRR_SYM",
  165. "PO7_CRRCT_SYM", "PO7_UGBGE_SYM","PO7_ERR_PKT0",
  166. "PO7_ERR_PKT1", "reserved", "reserved",
  167. "PO0_ERR_SUM", "PO0_TLB_ERR", "PO0_SPL_COMPLT",
  168. "PO0_TRANS_SUM", "PO0_FIRST_ERR","PO0_MULT_ERR",
  169. "DM CSR PH", "DM CSR PH", "DM CSR PH",
  170. "DM CSR PH", "reserved",
  171. "PO1_ERR_SUM", "PO1_TLB_ERR", "PO1_SPL_COMPLT",
  172. "PO1_TRANS_SUM", "PO1_FIRST_ERR","PO1_MULT_ERR",
  173. "DM CSR PH", "DM CSR PH", "DM CSR PH",
  174. "DM CSR PH", "reserved",
  175. "PO2_ERR_SUM", "PO2_TLB_ERR", "PO2_SPL_COMPLT",
  176. "PO2_TRANS_SUM", "PO2_FIRST_ERR","PO2_MULT_ERR",
  177. "DM CSR PH", "DM CSR PH", "DM CSR PH",
  178. "DM CSR PH", "reserved",
  179. "PO3_ERR_SUM", "PO3_TLB_ERR", "PO3_SPL_COMPLT",
  180. "PO3_TRANS_SUM", "PO3_FIRST_ERR","PO3_MULT_ERR",
  181. "DM CSR PH", "DM CSR PH", "DM CSR PH",
  182. "DM CSR PH", "reserved",
  183. NULL
  184. };
  185. static struct el_subpacket_annotation el_ev7_pal_annotations[] = {
  186. SUBPACKET_ANNOTATION(EL_CLASS__PAL,
  187. EL_TYPE__PAL__EV7_PROCESSOR,
  188. 1,
  189. "EV7 Processor Subpacket",
  190. el_ev7_processor_subpacket_annotation),
  191. SUBPACKET_ANNOTATION(EL_CLASS__PAL,
  192. EL_TYPE__PAL__EV7_ZBOX,
  193. 1,
  194. "EV7 ZBOX Subpacket",
  195. el_ev7_zbox_subpacket_annotation),
  196. SUBPACKET_ANNOTATION(EL_CLASS__PAL,
  197. EL_TYPE__PAL__EV7_RBOX,
  198. 1,
  199. "EV7 RBOX Subpacket",
  200. el_ev7_rbox_subpacket_annotation),
  201. SUBPACKET_ANNOTATION(EL_CLASS__PAL,
  202. EL_TYPE__PAL__EV7_IO,
  203. 1,
  204. "EV7 IO Subpacket",
  205. el_ev7_io_subpacket_annotation)
  206. };
  207. static struct el_subpacket *
  208. ev7_process_pal_subpacket(struct el_subpacket *header)
  209. {
  210. struct ev7_pal_subpacket *packet;
  211. if (header->class != EL_CLASS__PAL) {
  212. printk("%s ** Unexpected header CLASS %d TYPE %d, aborting\n",
  213. err_print_prefix,
  214. header->class, header->type);
  215. return NULL;
  216. }
  217. packet = (struct ev7_pal_subpacket *)header->by_type.raw.data_start;
  218. switch(header->type) {
  219. case EL_TYPE__PAL__LOGOUT_FRAME:
  220. printk("%s*** MCHK occurred on LPID %lld (RBOX %llx)\n",
  221. err_print_prefix,
  222. packet->by_type.logout.whami,
  223. packet->by_type.logout.rbox_whami);
  224. el_print_timestamp(&packet->by_type.logout.timestamp);
  225. printk("%s EXC_ADDR: %016llx\n"
  226. " HALT_CODE: %llx\n",
  227. err_print_prefix,
  228. packet->by_type.logout.exc_addr,
  229. packet->by_type.logout.halt_code);
  230. el_process_subpackets(header,
  231. packet->by_type.logout.subpacket_count);
  232. break;
  233. default:
  234. printk("%s ** PAL TYPE %d SUBPACKET\n",
  235. err_print_prefix,
  236. header->type);
  237. el_annotate_subpacket(header);
  238. break;
  239. }
  240. return (struct el_subpacket *)((unsigned long)header + header->length);
  241. }
  242. struct el_subpacket_handler ev7_pal_subpacket_handler =
  243. SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket);
  244. void __init
  245. ev7_register_error_handlers(void)
  246. {
  247. int i;
  248. for (i = 0; i < ARRAY_SIZE(el_ev7_pal_annotations); i++)
  249. cdl_register_subpacket_annotation(&el_ev7_pal_annotations[i]);
  250. cdl_register_subpacket_handler(&ev7_pal_subpacket_handler);
  251. }