Module Name:    src
Committed By:   dholland
Date:           Thu Jan  9 00:57:25 UTC 2014

Modified Files:
        src/sys/arch/amd64/amd64: machdep.c
        src/sys/arch/i386/i386: machdep.c

Log Message:
Make the amd64 post-halt-press-a-key code match i386, and introduce
into both a message for the case where cngetc() doesn't work. If
there's no console attached, this won't accomplish anything; but if
there's a screen but no keyboard, or the keyboard's wedged, or
whatever, it might provide useful information.

Suggested back in 2009 by some stuff in PR 37924 and has been hanging
about in one of my trees ever since.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.740 -r1.741 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.200 src/sys/arch/amd64/amd64/machdep.c:1.201
--- src/sys/arch/amd64/amd64/machdep.c:1.200	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Jan  9 00:57:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.200 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.201 2014/01/09 00:57:25 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.200 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.201 2014/01/09 00:57:25 dholland Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -728,7 +728,13 @@ haltsys:
 		printf("The operating system has halted.\n");
 		printf("Please press any key to reboot.\n\n");
 		cnpollc(1);	/* for proper keyboard command handling */
-		cngetc();
+		if (cngetc() == 0) {
+			/* no console attached, so just hlt */
+			printf("No keyboard - cannot reboot after all.\n");
+			for(;;) {
+				x86_hlt();
+			}
+		}
 		cnpollc(0);
 	}
 

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.740 src/sys/arch/i386/i386/machdep.c:1.741
--- src/sys/arch/i386/i386/machdep.c:1.740	Sun Dec  8 20:45:30 2013
+++ src/sys/arch/i386/i386/machdep.c	Thu Jan  9 00:57:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 dsl Exp $	*/
+/*	$NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -842,6 +842,7 @@ haltsys:
 		cnpollc(1);	/* for proper keyboard command handling */
 		if (cngetc() == 0) {
 			/* no console attached, so just hlt */
+			printf("No keyboard - cannot reboot after all.\n");
 			for(;;) {
 				x86_hlt();
 			}

Reply via email to