Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/cobalt/dev Replace shutdownhook_establish(9) with p...
details: https://anonhg.NetBSD.org/src/rev/39666bfa3e5f
branches: trunk
changeset: 747068:39666bfa3e5f
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Mon Aug 31 15:18:55 2009 +0000
description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Also check howto to print appropriate "Rebooting..." or "Halting..." messages.
diffstat:
sys/arch/cobalt/dev/panel.c | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diffs (85 lines):
diff -r a366a176b057 -r 39666bfa3e5f sys/arch/cobalt/dev/panel.c
--- a/sys/arch/cobalt/dev/panel.c Mon Aug 31 14:48:41 2009 +0000
+++ b/sys/arch/cobalt/dev/panel.c Mon Aug 31 15:18:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: panel.c,v 1.19 2009/08/20 11:43:59 tsutsui Exp $ */
+/* $NetBSD: panel.c,v 1.20 2009/08/31 15:18:55 tsutsui Exp $ */
/*
* Copyright (c) 2002 Dennis I. Chernoivanov
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.19 2009/08/20 11:43:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.20 2009/08/31 15:18:55 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@
#include <sys/device.h>
#include <sys/callout.h>
#include <sys/select.h>
+#include <sys/reboot.h>
#include <machine/bus.h>
#include <machine/autoconf.h>
@@ -76,14 +77,18 @@
"NetBSD/cobalt ",
"Starting up... "
};
-static const struct lcd_message shutdown_message = {
+static const struct lcd_message halt_message = {
"NetBSD/cobalt ",
- "Shutting down..."
+ "Halting... "
+};
+static const struct lcd_message reboot_message = {
+ "NetBSD/cobalt ",
+ "Rebooting... "
};
static int panel_match(device_t, cfdata_t, void *);
static void panel_attach(device_t, device_t, void *);
-static void panel_shutdown(void *);
+static bool panel_shutdown(device_t, int);
static void panel_soft(void *);
@@ -158,7 +163,7 @@
hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
HD_DDRAM_WRITE);
- shutdownhook_establish(panel_shutdown, sc);
+ pmf_device_register1(self, NULL, NULL, panel_shutdown);
sc->sc_kp.sc_iot = maa->ma_iot;
sc->sc_kp.sc_ioh = MIPS_PHYS_TO_KSEG1(PANEL_BASE); /* XXX */
@@ -173,18 +178,23 @@
selinit(&sc->sc_selq);
}
-static void
-panel_shutdown(void *arg)
+static bool
+panel_shutdown(device_t self, int howto)
{
- struct panel_softc *sc = arg;
+ struct panel_softc *sc = device_private(self);
struct hd44780_io io;
/* Goodbye World */
io.dat = 0;
io.len = PANEL_VCOLS * PANEL_ROWS;
- memcpy(io.buf, &shutdown_message, io.len);
+ if (howto & RB_HALT)
+ memcpy(io.buf, &halt_message, io.len);
+ else
+ memcpy(io.buf, &reboot_message, io.len);
hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
HD_DDRAM_WRITE);
+
+ return true;
}
static uint8_t
Home |
Main Index |
Thread Index |
Old Index