From 8bfc2cdea1cba3c77229454afcc9e4803afacc78 Mon Sep 17 00:00:00 2001 From: uebayasi Date: Sat, 12 Jul 2014 22:37:03 +0000 Subject: [PATCH] reboot(9), panic(9): Call panic(9) for unrecoverable MD H/W errors (NMIs) Some architectures have ability to detect hardware sanity and notify system (NMI, firmware callback, etc.). Handle these hardware severe errors, same as software errors, with panic(9). According to miod@, SGI IP27 NMI is triggered by pushing some "hidden" button, which "usual" users/admins don't know. Pushing such a button is "RB_USERREQ" (human-triggered) in that the button is pushed by a human, but not "RB_USERREQ" in that no user intervention in system (== no command input) is done. miod@ agreed that changing these from RB_USERREQ to !RB_USERREQ (== panic(9)) is not a big problem. OK miod@ kettenis@ --- sys/arch/hppa/hppa/machdep.c | 8 +++----- sys/arch/hppa64/hppa64/machdep.c | 8 +++----- sys/arch/sgi/sgi/ip27_machdep.c | 7 +++---- sys/arch/sgi/sgi/ip30_machdep.c | 7 +++---- sys/arch/sparc64/dev/psycho.c | 7 +++---- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 0aed6c706ba..3e62f4d2c68 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.227 2014/07/12 14:12:44 uebayasi Exp $ */ +/* $OpenBSD: machdep.c,v 1.228 2014/07/12 22:37:03 uebayasi Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -995,10 +994,9 @@ cpu_dumpsize(void) void hpmc_dump(void) { - printf("HPMC\n"); - cold = 0; - reboot(RB_NOSYNC); + panic("HPMC"); + /* NOTREACHED */ } int diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index d9158d892cd..86a68cf1a4a 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.65 2014/07/12 14:12:44 uebayasi Exp $ */ +/* $OpenBSD: machdep.c,v 1.66 2014/07/12 22:37:03 uebayasi Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -628,10 +627,9 @@ cpu_dumpsize(void) void hpmc_dump(void) { - printf("HPMC\n"); - cold = 0; - reboot(RB_NOSYNC); + panic("HPMC"); + /* NOTREACHED */ } int diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c index 4e4a5da76d2..f7c748ff312 100644 --- a/sys/arch/sgi/sgi/ip27_machdep.c +++ b/sys/arch/sgi/sgi/ip27_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip27_machdep.c,v 1.61 2014/07/12 18:44:42 tedu Exp $ */ +/* $OpenBSD: ip27_machdep.c,v 1.62 2014/07/12 22:37:03 uebayasi Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -933,6 +932,6 @@ ip27_nmi(void *arg) #ifdef DDB (void)kdb_trap(-1, &nmi_frame); #endif - printf("Resetting system...\n"); - reboot(RB_USERREQ); + panic("NMI"); + /* NOTREACHED */ } diff --git a/sys/arch/sgi/sgi/ip30_machdep.c b/sys/arch/sgi/sgi/ip30_machdep.c index 6992aefa535..2964bd13b3d 100644 --- a/sys/arch/sgi/sgi/ip30_machdep.c +++ b/sys/arch/sgi/sgi/ip30_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip30_machdep.c,v 1.61 2014/07/12 14:12:44 uebayasi Exp $ */ +/* $OpenBSD: ip30_machdep.c,v 1.62 2014/07/12 22:37:03 uebayasi Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -482,8 +481,8 @@ ip30_nmi_handler() kdb_trap(-1, fr0); splx(s); - printf("Resetting system...\n"); - reboot(RB_USERREQ); + panic("NMI"); + /* NOTREACHED */ } #endif diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index f83d2a8ab49..5dde1429d63 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.72 2014/07/12 18:44:43 tedu Exp $ */ +/* $OpenBSD: psycho.c,v 1.73 2014/07/12 22:37:03 uebayasi Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -43,7 +43,6 @@ #include #include #include -#include #include @@ -838,8 +837,8 @@ psycho_powerfail(void *arg) /* * We lost power. Try to shut down NOW. */ - printf("Power Failure Detected: Shutting down NOW.\n"); - reboot(RB_POWERDOWN | RB_HALT); + panic("Power Failure Detected"); + /* NOTREACHED */ return (1); } -- 2.20.1