Port-cobalt archive

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

Re: Shutdown does not finish output on LCD



david_albert%comcast.net@localhost wrote:

> However the last thing shown on the LCD panel is:
> 
>     [Shutting down]
>        > swap1
> 
> This makes it hard to know when it is save to turn
> off power unless you have a serial console connected.

Then, what is your expected behaivor?

Does the attached patch help?
---
Izumi Tsutsui


Index: dev/panel.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/dev/panel.c,v
retrieving revision 1.10
diff -u -r1.10 panel.c
--- dev/panel.c 6 Apr 2006 11:50:19 -0000       1.10
+++ dev/panel.c 4 Feb 2008 14:14:33 -0000
@@ -55,6 +55,9 @@
 #define PANEL_POLLRATE (hz / 10)
 #define PANEL_REGION   0x20
 #define DATA_OFFSET    0x10
+#define PANEL_COLS     16
+#define PANEL_VCOLS    40
+#define PANEL_ROWS     2
 
 struct panel_softc {
        struct device sc_dev;
@@ -68,6 +71,7 @@
 
 static int     panel_match(struct device *, struct cfdata *, void *);
 static void    panel_attach(struct device *, struct device *, void *);
+static void    panel_shutdown(void *);
 
 static void    panel_soft(void *);
 
@@ -103,7 +107,7 @@
 {
        struct panel_softc *sc = (void *)self;
        struct mainbus_attach_args *maa = aux;
-
+       struct hd44780_io io;
        static struct lcdkp_xlate keys[] = {
                { 0xfa, 'h' },
                { 0xf6, 'k' },
@@ -123,8 +127,8 @@
            1, &sc->sc_lcd.sc_iodr);
 
        sc->sc_lcd.sc_dev_ok = 1;
-       sc->sc_lcd.sc_cols = 16;
-       sc->sc_lcd.sc_vcols = 40;
+       sc->sc_lcd.sc_cols = PANEL_COLS;
+       sc->sc_lcd.sc_vcols = PANEL_VCOLS;
        sc->sc_lcd.sc_flags = HD_8BIT | HD_MULTILINE | HD_KEYPAD;
 
        sc->sc_lcd.sc_writereg = panel_cbt_hdwritereg;
@@ -133,6 +137,17 @@
 
        hd44780_attach_subr(&sc->sc_lcd);
 
+       /* Hello World */
+       io.dat = 0;
+       io.len = PANEL_VCOLS * PANEL_ROWS;
+       memset(io.buf, ' ', io.len);
+       memcpy(io.buf, "NetBSD/cobalt   ", PANEL_COLS);
+       memcpy(io.buf + PANEL_VCOLS, "Starting up...  ", PANEL_COLS);
+       hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
+           HD_DDRAM_WRITE);
+
+       shutdownhook_establish(panel_shutdown, sc);
+
        sc->sc_kp.sc_iot = maa->ma_iot;
        sc->sc_kp.sc_ioh = MIPS_PHYS_TO_KSEG1(0x1d000000); /* XXX */
 
@@ -147,6 +162,22 @@
        printf("\n");
 }
 
+static void
+panel_shutdown(void *arg)
+{
+       struct panel_softc *sc = arg;
+       struct hd44780_io io;
+
+       /* Goodbye World */
+       io.dat = 0;
+       io.len = PANEL_VCOLS * PANEL_ROWS;
+       memset(io.buf, ' ', io.len);
+       memcpy(io.buf, "NetBSD/cobalt   ", PANEL_COLS);
+       memcpy(io.buf + PANEL_VCOLS, "Shutting down...", PANEL_COLS);
+       hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
+           HD_DDRAM_WRITE);
+}
+
 static uint8_t
 panel_cbt_kprread(bus_space_tag_t iot, bus_space_handle_t ioh)
 {



Home | Main Index | Thread Index | Old Index