Module Name:    src
Committed By:   snj
Date:           Sat Oct  3 23:45:24 UTC 2009

Modified Files:
        src/sys/arch/cobalt/dev [netbsd-5]: panel.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1053):
        sys/arch/cobalt/dev/panel.c: revision 1.20
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Also check howto to print appropriate "Rebooting..." or "Halting..." messages.


To generate a diff of this commit:
cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/sys/arch/cobalt/dev/panel.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/cobalt/dev/panel.c
diff -u src/sys/arch/cobalt/dev/panel.c:1.18.8.1 src/sys/arch/cobalt/dev/panel.c:1.18.8.2
--- src/sys/arch/cobalt/dev/panel.c:1.18.8.1	Sat Oct  3 23:44:07 2009
+++ src/sys/arch/cobalt/dev/panel.c	Sat Oct  3 23:45:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $ */
+/* $NetBSD: panel.c,v 1.18.8.2 2009/10/03 23:45:24 snj Exp $ */
 
 /*
  * Copyright (c) 2002 Dennis I. Chernoivanov
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18.8.1 2009/10/03 23:44:07 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.18.8.2 2009/10/03 23:45:24 snj 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

Reply via email to