Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Flesh out cpu_reboot().



details:   https://anonhg.NetBSD.org/src/rev/dd17fa0c9b14
branches:  trunk
changeset: 537734:dd17fa0c9b14
user:      scw <scw%NetBSD.org@localhost>
date:      Sat Oct 05 11:01:13 2002 +0000

description:
Flesh out cpu_reboot().

diffstat:

 sys/arch/evbsh5/evbsh5/machdep.c |   9 +++++-
 sys/arch/sh5/include/cpu.h       |   4 ++-
 sys/arch/sh5/sh5/sh5_machdep.c   |  58 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 68 insertions(+), 3 deletions(-)

diffs (121 lines):

diff -r 28cc111a28c2 -r dd17fa0c9b14 sys/arch/evbsh5/evbsh5/machdep.c
--- a/sys/arch/evbsh5/evbsh5/machdep.c  Sat Oct 05 10:59:10 2002 +0000
+++ b/sys/arch/evbsh5/evbsh5/machdep.c  Sat Oct 05 11:01:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.6 2002/10/04 09:24:53 scw Exp $  */
+/*     $NetBSD: machdep.c,v 1.7 2002/10/05 11:01:13 scw Exp $  */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -354,6 +354,13 @@
 void
 cpu_reboot(int how, char *bootstr)
 {
+
+       sh5_reboot(how, bootstr);
+
+#if NSYSFPGA > 0
+       sysfpga_sreset();
+#endif
+
        for (;;)
                ;
 }
diff -r 28cc111a28c2 -r dd17fa0c9b14 sys/arch/sh5/include/cpu.h
--- a/sys/arch/sh5/include/cpu.h        Sat Oct 05 10:59:10 2002 +0000
+++ b/sys/arch/sh5/include/cpu.h        Sat Oct 05 11:01:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.7 2002/10/02 16:19:59 scw Exp $      */
+/*     $NetBSD: cpu.h,v 1.8 2002/10/05 11:01:13 scw Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -251,6 +251,8 @@
 struct pcb;
 extern void savectx(struct pcb *);
 extern void dumpsys(void);
+
+extern void sh5_reboot(int, char *);
 #endif /* _KERNEL */
 
 #endif /* _SH5_CPU_H_ */
diff -r 28cc111a28c2 -r dd17fa0c9b14 sys/arch/sh5/sh5/sh5_machdep.c
--- a/sys/arch/sh5/sh5/sh5_machdep.c    Sat Oct 05 10:59:10 2002 +0000
+++ b/sys/arch/sh5/sh5/sh5_machdep.c    Sat Oct 05 11:01:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sh5_machdep.c,v 1.3 2002/09/12 12:37:49 scw Exp $      */
+/*     $NetBSD: sh5_machdep.c,v 1.4 2002/10/05 11:01:14 scw Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -37,10 +37,15 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/exec.h>
+#include <sys/mount.h>
+#include <sys/reboot.h>
 #include <sys/user.h>
 
+#include <dev/cons.h>
+
 #include <machine/cpu.h>
 #include <machine/param.h>
 #include <machine/frame.h>
@@ -91,3 +96,54 @@
        dumpsize = 0;
 }
 
+int waittime = -1;
+
+void
+sh5_reboot(int howto, char *bootstr)
+{
+
+       if (cold) {
+               howto |= RB_HALT;
+               goto haltsys;
+       }
+
+       boothowto = howto;
+       if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
+               waittime = 0;
+               vfs_shutdown();
+               /*
+                * If we've been adjusting the clock, the todr
+                * will be out of synch; adjust it now.
+                */
+               resettodr();
+       }
+
+       /* Disable interrupts. */
+       splhigh();
+
+#ifdef notyet
+       /* Do a dump if requested. */
+       if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
+               dumpsys();
+#endif
+
+haltsys:
+       doshutdownhooks();
+
+       if (howto & RB_HALT) {
+               printf("\n");
+               printf("The operating system has halted.\n");
+               printf("Please press any key to reboot.\n\n");
+               cnpollc(1);     /* for proper keyboard command handling */
+               cngetc();
+               cnpollc(0);
+       }
+
+       printf("rebooting...\n");
+       delay(1000000);
+
+       /*
+        * The board-specific code (which called us) will deal with the
+        * nitty-gritty of arranging for a reset/reboot.
+        */
+}



Home | Main Index | Thread Index | Old Index