Module Name: src
Committed By: christos
Date: Fri Jan 2 18:49:02 UTC 2015
Modified Files:
src/sys/arch/arm/arm32: arm32_reboot.c
Log Message:
- print a warning about powerdown not supported like other ports do
- merge duplicated code
- if halt is requested and there is no console, keep looping instead of
rebooting.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm32/arm32_reboot.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/arm/arm32/arm32_reboot.c
diff -u src/sys/arch/arm/arm32/arm32_reboot.c:1.6 src/sys/arch/arm/arm32/arm32_reboot.c:1.7
--- src/sys/arch/arm/arm32/arm32_reboot.c:1.6 Sun Aug 18 02:28:18 2013
+++ src/sys/arch/arm/arm32/arm32_reboot.c Fri Jan 2 13:49:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_reboot.c,v 1.6 2013/08/18 06:28:18 matt Exp $ */
+/* $NetBSD: arm32_reboot.c,v 1.7 2015/01/02 18:49:02 christos Exp $ */
/*
* Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
@@ -122,7 +122,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_reboot.c,v 1.6 2013/08/18 06:28:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_reboot.c,v 1.7 2015/01/02 18:49:02 christos Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -136,6 +136,29 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_reboot
#include <arm/locore.h>
#include <arm/arm32/machdep.h>
+static int
+docpureset(int howto)
+{
+ if (howto & RB_POWERDOWN)
+ printf("WARNING: powerdown not supported\r\n");
+
+ if (howto & RB_HALT) {
+ printf("The operating system has halted.\r\n");
+ printf("Please press any key to reboot.\r\n");
+ cnpollc(true); /* for proper keyboard command handling */
+ /* If there is no keyboard, cngetc() returns 0, so loop */
+ while (cngetc() == 0)
+ delay(100000);
+ cnpollc(false);
+ }
+
+ printf("rebooting...\r\n");
+ if (cpu_reset_address)
+ (*cpu_reset_address)();
+ cpu_reset();
+ /*NOTREACHED*/
+}
+
void
cpu_reboot(int howto, char *bootstr)
{
@@ -146,15 +169,7 @@ cpu_reboot(int howto, char *bootstr)
*/
if (cold) {
doshutdownhooks();
- printf("The operating system has halted.\r\n");
- printf("Please press any key to reboot.\r\n");
- cnpollc(true); /* for proper keyboard command handling */
- cngetc();
- cnpollc(false);
- printf("rebooting...\r\n");
- if (cpu_reset_address)
- (*cpu_reset_address)();
- cpu_reset();
+ docpureset(RB_HALT | howto);
}
/*
@@ -187,17 +202,5 @@ cpu_reboot(int howto, char *bootstr)
/* Make sure IRQ's are disabled */
IRQdisable;
- if (howto & RB_HALT) {
- printf("The operating system has halted.\r\n");
- printf("Please press any key to reboot.\r\n");
- cnpollc(true); /* for proper keyboard command handling */
- cngetc();
- cnpollc(false);
- }
-
- printf("rebooting...\r\n");
- if (cpu_reset_address)
- (*cpu_reset_address)();
- cpu_reset();
- /*NOTREACHED*/
+ docpureset(howto);
}