Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint/sandpoint The DSM-G600's satellite microc...
details: https://anonhg.NetBSD.org/src/rev/c033399cd83e
branches: trunk
changeset: 763196:c033399cd83e
user: phx <phx%NetBSD.org@localhost>
date: Sat Mar 12 16:49:16 2011 +0000
description:
The DSM-G600's satellite microcontroller provides no possibility to reboot
or powerdown the board, so we can only support reboot by falling back to
a default reboot procedure.
The default procedure will turn off interrupts and the MMU, then jump
through the firmware's reset vector (0xfff00100).
diffstat:
sys/arch/sandpoint/sandpoint/machdep.c | 24 +++++++++++++++++-----
sys/arch/sandpoint/sandpoint/satmgr.c | 35 +++++++++++----------------------
2 files changed, 30 insertions(+), 29 deletions(-)
diffs (127 lines):
diff -r ffb67777838c -r c033399cd83e sys/arch/sandpoint/sandpoint/machdep.c
--- a/sys/arch/sandpoint/sandpoint/machdep.c Sat Mar 12 16:46:31 2011 +0000
+++ b/sys/arch/sandpoint/sandpoint/machdep.c Sat Mar 12 16:49:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.54 2011/01/12 07:38:44 nisimura Exp $ */
+/* $NetBSD: machdep.c,v 1.55 2011/03/12 16:49:16 phx Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.54 2011/01/12 07:38:44 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.55 2011/03/12 16:49:16 phx Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@@ -353,7 +353,9 @@
void
cpu_reboot(int howto, char *what)
{
+ extern void jump_to_ppc_reset_entry(void); /* from locore.S */
static int syncing;
+ register_t msr;
boothowto = howto;
if ((howto & RB_NOSYNC) == 0 && syncing == 0) {
@@ -383,11 +385,21 @@
howto = RB_AUTOBOOT;
}
- if (md_reboot != NULL) {
+ if (md_reboot != NULL)
(*md_reboot)(howto);
- /* should not come here */
- }
- while (1) ; /* may practice PPC processor reset sequence here */
+
+ /*
+ * No reboot method defined. So we disable the MMU and jump
+ * through the firmware's reset vector.
+ */
+ msr = mfmsr();
+ msr &= ~PSL_EE;
+ mtmsr(msr);
+ __asm volatile("mtspr %0,%1" : : "K"(81), "r"(0));
+ msr &= ~(PSL_ME | PSL_DR | PSL_IR);
+ mtmsr(msr);
+ jump_to_ppc_reset_entry();
+ for (;;);
}
#ifdef MODULAR
diff -r ffb67777838c -r c033399cd83e sys/arch/sandpoint/sandpoint/satmgr.c
--- a/sys/arch/sandpoint/sandpoint/satmgr.c Sat Mar 12 16:46:31 2011 +0000
+++ b/sys/arch/sandpoint/sandpoint/satmgr.c Sat Mar 12 16:49:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: satmgr.c,v 1.5 2011/03/09 20:33:57 phx Exp $ */
+/* $NetBSD: satmgr.c,v 1.6 2011/03/12 16:49:16 phx Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -115,11 +115,9 @@
static void kreboot(struct satmgr_softc *);
static void sreboot(struct satmgr_softc *);
static void qreboot(struct satmgr_softc *);
-static void dreboot(struct satmgr_softc *);
static void kpwroff(struct satmgr_softc *);
static void spwroff(struct satmgr_softc *);
static void qpwroff(struct satmgr_softc *);
-static void dpwroff(struct satmgr_softc *);
static void kbutton(struct satmgr_softc *, int);
static void sbutton(struct satmgr_softc *, int);
static void qbutton(struct satmgr_softc *, int);
@@ -138,7 +136,7 @@
{ "kurobox", kreboot, kpwroff, kbutton },
{ "synology", sreboot, spwroff, sbutton },
{ "qnap", qreboot, qpwroff, qbutton },
- { "dlink", dreboot, dpwroff, dbutton }
+ { "dlink", NULL, NULL, dbutton }
};
/* single byte stride register layout */
@@ -266,11 +264,16 @@
satmgr_reboot(int howto)
{
struct satmgr_softc *sc = device_lookup_private(&satmgr_cd, 0);
-
- if ((howto & RB_POWERDOWN) == RB_AUTOBOOT)
- (*sc->sc_ops->reboot)(sc); /* REBOOT */
- else
- (*sc->sc_ops->pwroff)(sc); /* HALT or POWERDOWN */
+
+ if ((howto & RB_POWERDOWN) == RB_AUTOBOOT) {
+ if (sc->sc_ops->reboot != NULL)
+ (*sc->sc_ops->reboot)(sc); /* REBOOT */
+ else
+ return; /* default reboot */
+ } else
+ if (sc->sc_ops->pwroff != NULL)
+ (*sc->sc_ops->pwroff)(sc); /* HALT or POWERDOWN */
+
tsleep(satmgr_reboot, PWAIT, "reboot", 0);
/*NOTREACHED*/
}
@@ -699,20 +702,6 @@
}
static void
-dreboot(struct satmgr_softc *sc)
-{
-
- /* XXX cause a machine check exception? */
-}
-
-static void
-dpwroff(struct satmgr_softc *sc)
-{
-
- /* not possible */
-}
-
-static void
dbutton(struct satmgr_softc *sc, int ch)
{
Home |
Main Index |
Thread Index |
Old Index