patch-2.4.21 linux-2.4.21/arch/ia64/sn/kernel/mca.c
Next file: linux-2.4.21/arch/ia64/sn/kernel/misctest.c
Previous file: linux-2.4.21/arch/ia64/sn/kernel/irq.c
Back to the patch index
Back to the overall index
- Lines: 325
- Date:
2003-06-13 07:51:31.000000000 -0700
- Orig file:
linux-2.4.20/arch/ia64/sn/kernel/mca.c
- Orig date:
2002-08-02 17:39:43.000000000 -0700
diff -urN linux-2.4.20/arch/ia64/sn/kernel/mca.c linux-2.4.21/arch/ia64/sn/kernel/mca.c
@@ -34,199 +34,80 @@
*/
#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/threads.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/smp_lock.h>
-#include <linux/kdb.h>
-
-#include <asm/machvec.h>
-#include <asm/page.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <asm/mca.h>
#include <asm/sal.h>
#include <asm/sn/sn_sal.h>
-#include <asm/mca.h>
-#include <asm/sn/mca.h>
-#include <asm/irq.h>
-#include <asm/hw_irq.h>
-#include <asm/acpi-ext.h>
-#include <asm/smp.h>
-#include <asm/sn/sn_cpuid.h>
-
-static char *shub_mmr_names[] = {
- "sh_event_occurred",
- "sh_first_error",
- "sh_event_overflow",
-
-/* PI */
- "sh_pi_first_error",
- "sh_pi_error_summary",
- "sh_pi_error_overflow",
-
-/* PI HW */
- "sh_pi_error_detail_1",
- "sh_pi_error_detail_2",
- "sh_pi_hw_time_stamp",
-
-/* PI UCE */
- "sh_pi_uncorrected_detail_1",
- "sh_pi_uncorrected_detail_2",
- "sh_pi_uncorrected_detail_3",
- "sh_pi_uncorrected_detail_4",
- "sh_pi_uncor_time_stamp",
-
-/* PI CE */
- "sh_pi_corrected_detail_1",
- "sh_pi_corrected_detail_2",
- "sh_pi_corrected_detail_3",
- "sh_pi_corrected_detail_4",
- "sh_pi_cor_time_stamp",
-
-/* MD */
- "sh_mem_error_summary",
- "sh_mem_error_overflow",
-/* MD HW */
- "sh_misc_err_hdr_upper",
- "sh_misc_err_hdr_lower",
- "sh_md_dqlp_mmr_xperr_val",
- "sh_md_dqlp_mmr_yperr_val",
- "sh_md_dqrp_mmr_xperr_val",
- "sh_md_dqrp_mmr_yperr_val",
- "sh_md_hw_time_stamp",
-
-/* MD UCE */
- "sh_dir_uc_err_hdr_lower",
- "sh_dir_uc_err_hdr_upper",
- "sh_md_dqlp_mmr_xuerr1",
- "sh_md_dqlp_mmr_xuerr2",
- "sh_md_dqlp_mmr_yuerr1",
- "sh_md_dqlp_mmr_yuerr2",
- "sh_md_dqrp_mmr_xuerr1",
- "sh_md_dqrp_mmr_xuerr2",
- "sh_md_dqrp_mmr_yuerr1",
- "sh_md_dqrp_mmr_yuerr2",
- "sh_md_uncor_time_stamp",
-
-/* MD CE */
- "sh_dir_cor_err_hdr_lower",
- "sh_dir_cor_err_hdr_upper",
- "sh_md_dqlp_mmr_xcerr1",
- "sh_md_dqlp_mmr_xcerr2",
- "sh_md_dqlp_mmr_ycerr1",
- "sh_md_dqlp_mmr_ycerr2",
- "sh_md_dqrp_mmr_xcerr1",
- "sh_md_dqrp_mmr_xcerr2",
- "sh_md_dqrp_mmr_ycerr1",
- "sh_md_dqrp_mmr_ycerr2",
- "sh_md_cor_time_stamp",
-
-/* MD CE, UCE */
- "sh_md_dqls_mmr_xamopw_err",
- "sh_md_dqrs_mmr_yamopw_err",
-
-/* XN */
- "sh_xn_error_summary",
- "sh_xn_first_error",
- "sh_xn_error_overflow",
-
-/* XN HW */
- "sh_xniilb_error_summary",
- "sh_xniilb_first_error",
- "sh_xniilb_error_overflow",
- "sh_xniilb_error_detail_1",
- "sh_xniilb_error_detail_2",
- "sh_xniilb_error_detail_3",
-
- "sh_ni0_error_summary_1",
- "sh_ni0_first_error_1",
- "sh_ni0_error_overflow_1",
-
- "sh_ni0_error_summary_2",
- "sh_ni0_first_error_2",
- "sh_ni0_error_overflow_2",
- "sh_ni0_error_detail_1",
- "sh_ni0_error_detail_2",
- "sh_ni0_error_detail_3",
-
- "sh_ni1_error_summary_1",
- "sh_ni1_first_error_1",
- "sh_ni1_error_overflow_1",
-
- "sh_ni1_error_summary_2",
- "sh_ni1_first_error_2",
- "sh_ni1_error_overflow_2",
-
- "sh_ni1_error_detail_1",
- "sh_ni1_error_detail_2",
- "sh_ni1_error_detail_3",
-
- "sh_xn_hw_time_stamp",
-
-/* XN HW & UCE & SBE */
- "sh_xnpi_error_summary",
- "sh_xnpi_first_error",
- "sh_xnpi_error_overflow",
- "sh_xnpi_error_detail_1",
-
- "sh_xnmd_error_summary",
- "sh_xnmd_first_error",
- "sh_xnmd_error_overflow",
- "sh_xnmd_ecc_err_report",
- "sh_xnmd_error_detail_1",
-
-/* XN UCE */
- "sh_xn_uncorrected_detail_1",
- "sh_xn_uncorrected_detail_2",
- "sh_xn_uncorrected_detail_3",
- "sh_xn_uncorrected_detail_4",
- "sh_xn_uncor_time_stamp",
-
-/* XN CE */
- "sh_xn_corrected_detail_1",
- "sh_xn_corrected_detail_2",
- "sh_xn_corrected_detail_3",
- "sh_xn_corrected_detail_4",
- "sh_xn_cor_time_stamp",
-
-/* LB HW */
- "sh_lb_error_summary",
- "sh_lb_first_error",
- "sh_lb_error_overflow",
- "sh_lb_error_detail_1",
- "sh_lb_error_detail_2",
- "sh_lb_error_detail_3",
- "sh_lb_error_detail_4",
- "sh_lb_error_detail_5",
- "sh_junk_error_status",
-};
-void
-sal_log_plat_print(int header_len, int sect_len, u8 *p_data, prfunc_t prfunc)
+
+/*
+ * Interval for calling SAL to poll for errors that do NOT cause error
+ * interrupts. SAL will raise a CPEI if any errors are present that
+ * need to be logged.
+ */
+#define CPEI_INTERVAL (5*HZ)
+
+
+struct timer_list sn_cpei_timer;
+void sn_init_cpei_timer(void);
+
+
+/*
+ * print_hook
+ *
+ * This function is the callback routine that SAL calls to log error
+ * info for platform errors.
+ */
+static int
+print_hook(const char *fmt, ...)
{
- sal_log_plat_info_t *sh_info = (sal_log_plat_info_t *) p_data;
- u64 *mmr_val = (u64 *)&(sh_info->shub_state);
- char **mmr_name = shub_mmr_names;
- int mmr_count = sizeof(sal_log_shub_state_t)>>3;
-
- while(mmr_count) {
- if(*mmr_val) {
- prfunc("%-40s: %#016lx\n",*mmr_name, *mmr_val);
- }
- mmr_name++;
- mmr_val++;
- mmr_count--;
+ static int newline=1;
+ char buf[400], *p;
+ va_list args;
+ int len=0;
+
+
+ va_start(args, fmt);
+ if (newline) {
+ strcpy(buf, "+ ");
+ len += 2;
}
+ len += vsnprintf(buf+len, sizeof(buf)-len, fmt, args);
+ /* Prefix each line with "+ " to be consistent with mca.c. */
+ p = buf;
+ while ((p=strchr(p, '\n')) && *++p != '\0') {
+ memmove(p+2, p, 1+strlen(p));
+ strncpy(p, "+ ", 2);
+ len += 2;
+ }
+ newline = (p != 0);
+
+ va_end(args);
+ printk("%s", buf);
+ return len;
}
-sn_cpei_handler(int irq, void *devid, struct pt_regs *regs)
+
+
+/*
+ * ia64_sn2_platform_plat_specific_err_print
+ *
+ * Called by the MCA handler to log platform-specific errors.
+ */
+void
+ia64_sn2_platform_plat_specific_err_print(int header_len, int sect_len, u8 *p_data, prfunc_t prfunc)
{
- struct ia64_sal_retval isrv;
+ ia64_sn_plat_specific_err_print(print_hook, p_data - sect_len);
+}
+
+
+static void
+sn_cpei_handler(int irq, void *devid, struct pt_regs *regs)
+{
/*
* this function's sole purpose is to call SAL when we receive
* a CE interrupt from SHUB or when the timer routine decides
@@ -234,46 +115,45 @@
*/
/* CALL SAL_LOG_CE */
- SAL_CALL(isrv, SN_SAL_LOG_CE, irq, 0, 0, 0, 0, 0, 0);
-}
-#include <linux/timer.h>
+ ia64_sn_plat_cpei_handler();
+}
-#define CPEI_INTERVAL (HZ/100)
-struct timer_list sn_cpei_timer;
-void sn_init_cpei_timer(void);
-void
+static void
sn_cpei_timer_handler(unsigned long dummy) {
- sn_cpei_handler(-1, NULL, NULL);
- del_timer(&sn_cpei_timer);
- sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
+ sn_cpei_handler(-1, NULL, NULL);
+ del_timer(&sn_cpei_timer);
+ sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
add_timer(&sn_cpei_timer);
}
void
sn_init_cpei_timer() {
- sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
+ sn_cpei_timer.expires = jiffies + CPEI_INTERVAL;
sn_cpei_timer.function = sn_cpei_timer_handler;
add_timer(&sn_cpei_timer);
}
+
+
+
#ifdef ajmtestceintr
struct timer_list sn_ce_timer;
void
sn_ce_timer_handler(long dummy) {
- unsigned long *pi_ce_error_inject_reg = 0xc00000092fffff00;
+ unsigned long *pi_ce_error_inject_reg = 0xc00000092fffff00;
- *pi_ce_error_inject_reg = 0x0000000000000100;
- del_timer(&sn_ce_timer);
- sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
+ *pi_ce_error_inject_reg = 0x0000000000000100;
+ del_timer(&sn_ce_timer);
+ sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
add_timer(&sn_ce_timer);
}
sn_init_ce_timer() {
- sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
+ sn_ce_timer.expires = jiffies + CPEI_INTERVAL;
sn_ce_timer.function = sn_ce_timer_handler;
add_timer(&sn_ce_timer);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)