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.
This commit is contained in:
dholland 2014-01-09 00:57:25 +00:00
parent 173d90915f
commit 586505dce8
2 changed files with 12 additions and 5 deletions

View File

@ -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);
}

View File

@ -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();
}