Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 - print a warning about powerdown not sup...



details:   https://anonhg.NetBSD.org/src/rev/1e00f6ddb4d7
branches:  trunk
changeset: 335302:1e00f6ddb4d7
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 02 18:49:02 2015 +0000

description:
- 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.

diffstat:

 sys/arch/arm/arm32/arm32_reboot.c |  51 ++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 24 deletions(-)

diffs (84 lines):

diff -r a5a3f5b9ef1b -r 1e00f6ddb4d7 sys/arch/arm/arm32/arm32_reboot.c
--- a/sys/arch/arm/arm32/arm32_reboot.c Fri Jan 02 16:51:02 2015 +0000
+++ b/sys/arch/arm/arm32/arm32_reboot.c Fri Jan 02 18:49:02 2015 +0000
@@ -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 @@
 #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 @@
         */
        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 @@
        /* 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);
 }



Home | Main Index | Thread Index | Old Index