From 0f6f2c78442c9007279ad8030ee6e53b06b2956d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 16 Aug 2003 11:06:37 -0700 Subject: [PATCH] [ALPHA] Convert DEBUG_MCHECK define to runtime variable. From Jay Estabrook . --- arch/alpha/Kconfig | 18 ++++++++++++++ arch/alpha/kernel/core_cia.c | 8 ++++-- arch/alpha/kernel/core_lca.c | 6 ++--- arch/alpha/kernel/core_t2.c | 46 ++++++++++++++++++++--------------- arch/alpha/kernel/err_titan.c | 5 ++-- arch/alpha/kernel/irq_alpha.c | 14 ++++++----- arch/alpha/kernel/proto.h | 5 ++-- arch/alpha/kernel/setup.c | 44 +++++++++++++++++++++++++++++++++ 8 files changed, 111 insertions(+), 35 deletions(-) diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index e63b35d5c019f..1124b016ce553 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -556,6 +556,24 @@ config ALPHA_LARGE_VMALLOC config VERBOSE_MCHECK bool "Verbose Machine Checks" +config VERBOSE_MCHECK_ON + int "Verbose Printing Mode (0=off, 1=on, 2=all)" + depends on VERBOSE_MCHECK + default 1 + ---help--- + This option allows the default printing mode to be set, and then + possibly overridden by a boot command argument. + + For example, if one wanted the option of printing verbose + machine checks, but wanted the default to be as if verbose + machine check printing was turned off, then one would choose + the printing mode to be 0. Then, upon reboot, one could add + the boot command line "verbose_mcheck=1" to get the normal + verbose machine check printing, or "verbose_mcheck=2" to get + the maximum information available. + + Take the default (1) unless you want more control or more info. + source "drivers/pci/Kconfig" source "drivers/eisa/Kconfig" diff --git a/arch/alpha/kernel/core_cia.c b/arch/alpha/kernel/core_cia.c index 54d7a6c31e76c..459e209e9e40d 100644 --- a/arch/alpha/kernel/core_cia.c +++ b/arch/alpha/kernel/core_cia.c @@ -1099,7 +1099,8 @@ cia_decode_parity_error(struct el_CIA_sysdata_mcheck *cia) printk(KERN_CRIT " Command: %s, Parity bit: %d\n", cmd, par); printk(KERN_CRIT " Address: %#010lx, Mask: %#lx\n", addr, mask); } -#endif +#endif /* CONFIG_VERBOSE_MCHECK */ + static int cia_decode_mchk(unsigned long la_ptr) @@ -1114,6 +1115,9 @@ cia_decode_mchk(unsigned long la_ptr) return 0; #ifdef CONFIG_VERBOSE_MCHECK + if (!alpha_verbose_mcheck) + return 1; + switch (ffs(cia->cia_err & 0xfff) - 1) { case 0: /* CIA_ERR_COR_ERR */ cia_decode_ecc_error(cia, "Corrected ECC error"); @@ -1186,7 +1190,7 @@ cia_decode_mchk(unsigned long la_ptr) if (cia->cia_err & CIA_ERR_LOST_IOA_TIMEOUT) printk(KERN_CRIT "CIA lost machine check: " "I/O timeout\n"); -#endif +#endif /* CONFIG_VERBOSE_MCHECK */ return 1; } diff --git a/arch/alpha/kernel/core_lca.c b/arch/alpha/kernel/core_lca.c index 7f8768ff9d00d..41c05ba20ba6b 100644 --- a/arch/alpha/kernel/core_lca.c +++ b/arch/alpha/kernel/core_lca.c @@ -460,8 +460,8 @@ lca_machine_check(unsigned long vector, unsigned long la_ptr, } /* Dump the logout area to give all info. */ -#if DEBUG_MCHECK > 1 - { +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { unsigned long * ptr = (unsigned long *) la_ptr; long i; for (i = 0; i < el.c->size / sizeof(long); i += 2) { @@ -469,7 +469,7 @@ lca_machine_check(unsigned long vector, unsigned long la_ptr, i*sizeof(long), ptr[i], ptr[i+1]); } } -#endif +#endif /* CONFIG_VERBOSE_MCHECK */ } /* diff --git a/arch/alpha/kernel/core_t2.c b/arch/alpha/kernel/core_t2.c index 0054ae2fc3c33..e028ecf0ad4bd 100644 --- a/arch/alpha/kernel/core_t2.c +++ b/arch/alpha/kernel/core_t2.c @@ -557,9 +557,9 @@ t2_machine_check(unsigned long vector, unsigned long la_ptr, struct pt_regs * regs) { int cpu = smp_processor_id(); -#if DEBUG_MCHECK > 0 +#ifdef CONFIG_VERBOSE_MCHECK struct el_common *mchk_header = (struct el_common *)la_ptr; -#endif /* DEBUG_MCHECK */ +#endif /* Clear the error before any reporting. */ mb(); @@ -580,39 +580,45 @@ t2_machine_check(unsigned long vector, unsigned long la_ptr, * * Just dismiss it for now on this CPU... */ -#if DEBUG_MCHECK > 0 - printk("t2_machine_check(cpu%d): any_expected 0x%x -" - " (assumed) spurious -" - " code 0x%x\n", cpu, t2_mcheck_any_expected, - (unsigned int)mchk_header->code); -#endif /* DEBUG_MCHECK */ +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { + printk("t2_machine_check(cpu%d): any_expected 0x%x -" + " (assumed) spurious -" + " code 0x%x\n", cpu, t2_mcheck_any_expected, + (unsigned int)mchk_header->code); + } +#endif return; } if (!mcheck_expected(cpu) && !t2_mcheck_any_expected) { if (t2_mcheck_last_taken & (1 << cpu)) { -#if DEBUG_MCHECK > 0 +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { printk("t2_machine_check(cpu%d): last_taken 0x%x - " "unexpected mcheck - code 0x%x\n", cpu, t2_mcheck_last_taken, (unsigned int)mchk_header->code); -#endif /* DEBUG_MCHECK */ - t2_mcheck_last_taken = 0; - mb(); - return; + } +#endif + t2_mcheck_last_taken = 0; + mb(); + return; } else { t2_mcheck_last_taken = 0; mb(); } } -#if DEBUG_MCHECK > 0 - printk("%s t2_mcheck(cpu%d): last_taken 0x%x - " - "any_expected 0x%x - code 0x%x\n", - (mcheck_expected(cpu) ? "EX" : "UN"), cpu, - t2_mcheck_last_taken, t2_mcheck_any_expected, - (unsigned int)mchk_header->code); -#endif /* DEBUG_MCHECK */ +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { + printk("%s t2_mcheck(cpu%d): last_taken 0x%x - " + "any_expected 0x%x - code 0x%x\n", + (mcheck_expected(cpu) ? "EX" : "UN"), cpu, + t2_mcheck_last_taken, t2_mcheck_any_expected, + (unsigned int)mchk_header->code); + } +#endif process_mcheck_info(vector, la_ptr, regs, "T2", mcheck_expected(cpu)); } diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c index 8dab97547d67a..505cdb3db1400 100644 --- a/arch/alpha/kernel/err_titan.c +++ b/arch/alpha/kernel/err_titan.c @@ -438,8 +438,9 @@ titan_machine_check(u64 vector, u64 la_ptr, struct pt_regs *regs) (unsigned int)vector, (int)smp_processor_id()); #ifdef CONFIG_VERBOSE_MCHECK - titan_process_logout_frame(mchk_header, 1); - dik_show_regs(regs, NULL); + titan_process_logout_frame(mchk_header, alpha_verbose_mcheck); + if (alpha_verbose_mcheck) + dik_show_regs(regs, NULL); #endif /* CONFIG_VERBOSE_MCHECK */ err_print_prefix = saved_err_prefix; diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index 0c2b0190db0fe..e6ded33c6e22c 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c @@ -130,9 +130,11 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, * ignore it. */ -#if DEBUG_MCHECK > 0 - printk(KERN_CRIT "%s machine check %s\n", machine, - expected ? "expected." : "NOT expected!!!"); +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { + printk(KERN_CRIT "%s machine check %s\n", machine, + expected ? "expected." : "NOT expected!!!"); + } #endif if (expected) { @@ -188,8 +190,8 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, dik_show_regs(regs, NULL); -#if DEBUG_MCHECK > 1 - { +#ifdef CONFIG_VERBOSE_MCHECK + if (alpha_verbose_mcheck > 1) { /* Dump the logout area to give all info. */ unsigned long *ptr = (unsigned long *)la_ptr; long i; @@ -198,7 +200,7 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, i*sizeof(long), ptr[i], ptr[i+1]); } } -#endif +#endif /* CONFIG_VERBOSE_MCHECK */ } /* diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h index 2320a47cef48a..6368af8b92991 100644 --- a/arch/alpha/kernel/proto.h +++ b/arch/alpha/kernel/proto.h @@ -110,6 +110,9 @@ extern unsigned long wildfire_node_mem_size(int); /* setup.c */ extern unsigned long srm_hae; extern int boot_cpuid; +#ifdef CONFIG_VERBOSE_MCHECK +extern unsigned long alpha_verbose_mcheck; +#endif /* srmcons.c */ #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM) @@ -205,8 +208,6 @@ extern struct mcheck_info #define mcheck_extra(cpu) ((void)(cpu), __mcheck_info.extra) #endif -#define DEBUG_MCHECK 0 /* 0 = minimal, 1 = debug, 2 = debug+dump. */ - extern void process_mcheck_info(unsigned long vector, unsigned long la_ptr, struct pt_regs *regs, const char *machine, int expected); diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 021c51c66b993..0858e8a744136 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -63,6 +63,12 @@ static struct notifier_block alpha_panic_block = { struct hwrpb_struct *hwrpb; unsigned long srm_hae; +#ifdef CONFIG_VERBOSE_MCHECK +/* 0=minimum, 1=verbose, 2=all */ +/* These can be overridden via the command line, ie "verbose_mcheck=2") */ +unsigned long alpha_verbose_mcheck = CONFIG_VERBOSE_MCHECK_ON; +#endif + /* Which processor we booted from. */ int boot_cpuid; @@ -538,6 +544,12 @@ setup_arch(char **cmdline_p) get_mem_size_limit(p+9) << PAGE_SHIFT; continue; } +#ifdef CONFIG_VERBOSE_MCHECK + if (strncmp(p, "verbose_mcheck=", 15) == 0) { + alpha_verbose_mcheck = simple_strtol(p+15, NULL, 0); + continue; + } +#endif } /* Replace the command line, now that we've killed it with strsep. */ @@ -597,6 +609,38 @@ setup_arch(char **cmdline_p) var_name, alpha_mv.vector_name, (alpha_using_srm ? "SRM" : "MILO")); + printk("Major Options: " +#ifdef CONFIG_SMP + "SMP " +#endif +#ifdef CONFIG_ALPHA_EV56 + "EV56 " +#endif +#ifdef CONFIG_ALPHA_EV67 + "EV67 " +#endif +#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS + "LEGACY_START " +#endif +#ifdef CONFIG_VERBOSE_MCHECK + "VERBOSE_MCHECK " +#endif + +#ifdef CONFIG_DISCONTIGMEM + "DISCONTIGMEM " +#ifdef CONFIG_NUMA + "NUMA " +#endif +#endif + +#ifdef CONFIG_DEBUG_SPINLOCK + "DEBUG_SPINLOCK " +#endif +#ifdef CONFIG_MAGIC_SYSRQ + "MAGIC_SYSRQ " +#endif + "\n"); + printk("Command line: %s\n", command_line); /* -- 2.53.0