mca.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:7k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * File: mca.c
  3.  * Purpose: SN specific MCA code.
  4.  *
  5.  * Copyright (C) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
  6.  * 
  7.  * This program is free software; you can redistribute it and/or modify it 
  8.  * under the terms of version 2 of the GNU General Public License 
  9.  * as published by the Free Software Foundation.
  10.  * 
  11.  * This program is distributed in the hope that it would be useful, but 
  12.  * WITHOUT ANY WARRANTY; without even the implied warranty of 
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
  14.  * 
  15.  * Further, this software is distributed without any warranty that it is 
  16.  * free of the rightful claim of any third person regarding infringement 
  17.  * or the like.  Any license provided herein, whether implied or 
  18.  * otherwise, applies only to this software file.  Patent licenses, if 
  19.  * any, provided herein do not apply to combinations of this program with 
  20.  * other software, or any other product whatsoever.
  21.  * 
  22.  * You should have received a copy of the GNU General Public 
  23.  * License along with this program; if not, write the Free Software 
  24.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  25.  * 
  26.  * Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 
  27.  * Mountain View, CA  94043, or:
  28.  * 
  29.  * http://www.sgi.com 
  30.  * 
  31.  * For further information regarding this notice, see: 
  32.  * 
  33.  * http://oss.sgi.com/projects/GenInfo/NoticeExplan
  34.  */
  35. #include <linux/types.h>
  36. #include <linux/init.h>
  37. #include <linux/sched.h>
  38. #include <linux/threads.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/irq.h>
  41. #include <linux/smp_lock.h>
  42. #include <linux/kdb.h>
  43. #include <asm/machvec.h>
  44. #include <asm/page.h>
  45. #include <asm/ptrace.h>
  46. #include <asm/system.h>
  47. #include <asm/sal.h>
  48. #include <asm/sn/sn_sal.h>
  49. #include <asm/mca.h>
  50. #include <asm/sn/mca.h>
  51. #include <asm/irq.h>
  52. #include <asm/hw_irq.h>
  53. #include <asm/acpi-ext.h>
  54. #include <asm/smp.h>
  55. #include <asm/sn/sn_cpuid.h>
  56. static char *shub_mmr_names[] = {
  57. "sh_event_occurred",
  58. "sh_first_error",
  59. "sh_event_overflow",
  60. /* PI */
  61. "sh_pi_first_error",
  62. "sh_pi_error_summary",
  63. "sh_pi_error_overflow",
  64. /* PI HW */
  65. "sh_pi_error_detail_1",
  66. "sh_pi_error_detail_2",
  67. "sh_pi_hw_time_stamp",
  68. /* PI UCE */
  69. "sh_pi_uncorrected_detail_1",
  70. "sh_pi_uncorrected_detail_2",
  71. "sh_pi_uncorrected_detail_3",
  72. "sh_pi_uncorrected_detail_4",
  73. "sh_pi_uncor_time_stamp",
  74. /* PI CE */
  75. "sh_pi_corrected_detail_1",
  76. "sh_pi_corrected_detail_2",
  77. "sh_pi_corrected_detail_3",
  78. "sh_pi_corrected_detail_4",
  79. "sh_pi_cor_time_stamp",
  80. /* MD */
  81. "sh_mem_error_summary",
  82. "sh_mem_error_overflow",
  83. /* MD HW */
  84. "sh_misc_err_hdr_upper",
  85. "sh_misc_err_hdr_lower",
  86. "sh_md_dqlp_mmr_xperr_val",
  87. "sh_md_dqlp_mmr_yperr_val",
  88. "sh_md_dqrp_mmr_xperr_val",
  89. "sh_md_dqrp_mmr_yperr_val",
  90. "sh_md_hw_time_stamp",
  91. /* MD UCE */
  92. "sh_dir_uc_err_hdr_lower",
  93. "sh_dir_uc_err_hdr_upper",
  94. "sh_md_dqlp_mmr_xuerr1",
  95. "sh_md_dqlp_mmr_xuerr2",
  96. "sh_md_dqlp_mmr_yuerr1",
  97. "sh_md_dqlp_mmr_yuerr2",
  98. "sh_md_dqrp_mmr_xuerr1",
  99. "sh_md_dqrp_mmr_xuerr2",
  100. "sh_md_dqrp_mmr_yuerr1",
  101. "sh_md_dqrp_mmr_yuerr2",
  102. "sh_md_uncor_time_stamp",
  103. /* MD CE */
  104. "sh_dir_cor_err_hdr_lower",
  105. "sh_dir_cor_err_hdr_upper",
  106. "sh_md_dqlp_mmr_xcerr1",
  107. "sh_md_dqlp_mmr_xcerr2",
  108. "sh_md_dqlp_mmr_ycerr1",
  109. "sh_md_dqlp_mmr_ycerr2",
  110. "sh_md_dqrp_mmr_xcerr1",
  111. "sh_md_dqrp_mmr_xcerr2",
  112. "sh_md_dqrp_mmr_ycerr1",
  113. "sh_md_dqrp_mmr_ycerr2",
  114. "sh_md_cor_time_stamp",
  115. /* MD CE, UCE */
  116. "sh_md_dqls_mmr_xamopw_err",
  117. "sh_md_dqrs_mmr_yamopw_err",
  118. /* XN */
  119. "sh_xn_error_summary",
  120. "sh_xn_first_error",
  121. "sh_xn_error_overflow",
  122. /* XN HW */
  123. "sh_xniilb_error_summary",
  124. "sh_xniilb_first_error",
  125. "sh_xniilb_error_overflow",
  126. "sh_xniilb_error_detail_1",
  127. "sh_xniilb_error_detail_2",
  128. "sh_xniilb_error_detail_3",
  129. "sh_ni0_error_summary_1",
  130. "sh_ni0_first_error_1",
  131. "sh_ni0_error_overflow_1",
  132. "sh_ni0_error_summary_2",
  133. "sh_ni0_first_error_2",
  134. "sh_ni0_error_overflow_2",
  135. "sh_ni0_error_detail_1",
  136. "sh_ni0_error_detail_2",
  137. "sh_ni0_error_detail_3",
  138. "sh_ni1_error_summary_1",
  139. "sh_ni1_first_error_1",
  140. "sh_ni1_error_overflow_1",
  141. "sh_ni1_error_summary_2",
  142. "sh_ni1_first_error_2",
  143. "sh_ni1_error_overflow_2",
  144. "sh_ni1_error_detail_1",
  145. "sh_ni1_error_detail_2",
  146. "sh_ni1_error_detail_3",
  147. "sh_xn_hw_time_stamp",
  148. /* XN HW & UCE & SBE */
  149. "sh_xnpi_error_summary",
  150. "sh_xnpi_first_error",
  151. "sh_xnpi_error_overflow",
  152. "sh_xnpi_error_detail_1",
  153. "sh_xnmd_error_summary",
  154. "sh_xnmd_first_error",
  155. "sh_xnmd_error_overflow",
  156. "sh_xnmd_ecc_err_report",
  157. "sh_xnmd_error_detail_1",
  158. /* XN UCE */
  159. "sh_xn_uncorrected_detail_1",
  160. "sh_xn_uncorrected_detail_2",
  161. "sh_xn_uncorrected_detail_3",
  162. "sh_xn_uncorrected_detail_4",
  163. "sh_xn_uncor_time_stamp",
  164. /* XN CE */
  165. "sh_xn_corrected_detail_1",
  166. "sh_xn_corrected_detail_2",
  167. "sh_xn_corrected_detail_3",
  168. "sh_xn_corrected_detail_4",
  169. "sh_xn_cor_time_stamp",
  170. /* LB HW */
  171. "sh_lb_error_summary",
  172. "sh_lb_first_error",
  173. "sh_lb_error_overflow",
  174. "sh_lb_error_detail_1",
  175. "sh_lb_error_detail_2",
  176. "sh_lb_error_detail_3",
  177. "sh_lb_error_detail_4",
  178. "sh_lb_error_detail_5",
  179. "sh_junk_error_status",
  180. };
  181. void 
  182. sal_log_plat_print(int header_len, int sect_len, u8 *p_data, prfunc_t prfunc) 
  183. {
  184. sal_log_plat_info_t *sh_info = (sal_log_plat_info_t *) p_data;
  185. u64 *mmr_val = (u64 *)&(sh_info->shub_state);
  186. char **mmr_name = shub_mmr_names;
  187. int mmr_count = sizeof(sal_log_shub_state_t)>>3;
  188. while(mmr_count) {
  189. if(*mmr_val) {
  190. prfunc("%-40s: %#016lxn",*mmr_name, *mmr_val);
  191. }
  192. mmr_name++;
  193. mmr_val++;
  194. mmr_count--;
  195. }
  196. }
  197. sn_cpei_handler(int irq, void *devid, struct pt_regs *regs)
  198. {
  199. struct ia64_sal_retval isrv;
  200. /*
  201.  * this function's sole purpose is to call SAL when we receive
  202.  * a CE interrupt from SHUB or when the timer routine decides
  203.  * we need to call SAL to check for CEs.
  204.  */
  205. /* CALL SAL_LOG_CE */
  206. SAL_CALL(isrv, SN_SAL_LOG_CE, irq, 0, 0, 0, 0, 0, 0);
  207. }
  208. #include <linux/timer.h>
  209. #define CPEI_INTERVAL   (HZ/100)
  210. struct timer_list sn_cpei_timer;
  211. void sn_init_cpei_timer(void);
  212. void
  213. sn_cpei_timer_handler(unsigned long dummy) {
  214.         sn_cpei_handler(-1, NULL, NULL);
  215.         del_timer(&sn_cpei_timer);
  216.         sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
  217.         add_timer(&sn_cpei_timer);
  218. }
  219. void
  220. sn_init_cpei_timer() {
  221.         sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
  222.         sn_cpei_timer.function = sn_cpei_timer_handler;
  223.         add_timer(&sn_cpei_timer);
  224. }
  225. #ifdef ajmtestceintr
  226. struct timer_list sn_ce_timer;
  227. void
  228. sn_ce_timer_handler(long dummy) {
  229.         unsigned long *pi_ce_error_inject_reg = 0xc00000092fffff00;
  230.         *pi_ce_error_inject_reg = 0x0000000000000100;
  231.         del_timer(&sn_ce_timer);
  232.         sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
  233.         add_timer(&sn_ce_timer);
  234. }
  235. sn_init_ce_timer() {
  236.         sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
  237.         sn_ce_timer.function = sn_ce_timer_handler;
  238.         add_timer(&sn_ce_timer);
  239. }
  240. #endif /* ajmtestceintr */