Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp700/dev Delay some things to attach time - pdc_in...



details:   https://anonhg.NetBSD.org/src/rev/86ad67f231cd
branches:  trunk
changeset: 773555:86ad67f231cd
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Feb 05 21:46:37 2012 +0000

description:
Delay some things to attach time - pdc_init is too early.

Minor tidyup while I'm here.

OK riz@

diffstat:

 sys/arch/hp700/dev/pdc.c |  38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diffs (101 lines):

diff -r 0d7c3fd8c80b -r 86ad67f231cd sys/arch/hp700/dev/pdc.c
--- a/sys/arch/hp700/dev/pdc.c  Sun Feb 05 19:30:42 2012 +0000
+++ b/sys/arch/hp700/dev/pdc.c  Sun Feb 05 21:46:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pdc.c,v 1.40 2011/10/01 15:51:17 chs Exp $     */
+/*     $NetBSD: pdc.c,v 1.41 2012/02/05 21:46:37 skrll Exp $   */
 
 /*     $OpenBSD: pdc.c,v 1.14 2001/04/29 21:05:43 mickey Exp $ */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.40 2011/10/01 15:51:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.41 2012/02/05 21:46:37 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -63,8 +63,8 @@
 
 static struct pdc_result pdcret1 PDC_ALIGNMENT;
 static struct pdc_result pdcret2 PDC_ALIGNMENT;
+static char pdc_consbuf[IODC_MINIOSIZ] PDC_ALIGNMENT;
 
-char pdc_consbuf[IODC_MINIOSIZ] PDC_ALIGNMENT;
 iodcio_t pdc_cniodc, pdc_kbdiodc;
 pz_device_t *pz_kbd, *pz_cons;
 
@@ -105,10 +105,6 @@
 void
 pdc_init(void)
 {
-       static struct todr_chip_handle todr = {
-               .todr_settime = pdcsettod,
-               .todr_gettime = pdcgettod,
-       };
        static int kbd_iodc[IODC_MAXSIZE/sizeof(int)];
        static int cn_iodc[IODC_MAXSIZE/sizeof(int)];
        int err;
@@ -116,12 +112,11 @@
 
        pagezero_cookie = hp700_pagezero_map();
 
-       /*
-        * locore has updated pdc with (pdcio_t)PAGE0->mem_pdc
-        */
        pz_kbd = &PAGE0->mem_kbd;
        pz_cons = &PAGE0->mem_cons;
 
+       pdc = (pdcio_t)PAGE0->mem_pdc;
+
        /* XXX should we reset the console/kbd here?
           well, /boot did that for us anyway */
        if ((err = pdc_call((iodcio_t)pdc, 0, PDC_IODC, PDC_IODC_READ,
@@ -133,19 +128,13 @@
 #endif
        }
 
+       hp700_pagezero_unmap(pagezero_cookie);
+
        pdc_cniodc = (iodcio_t)cn_iodc;
        pdc_kbdiodc = (iodcio_t)kbd_iodc;
 
        /* XXX make pdc current console */
        cn_tab = &constab[0];
-
-       cn_init_magic(&pdc_cnm_state);
-       cn_set_magic("+++++");
-
-       hp700_pagezero_unmap(pagezero_cookie);
-
-       /* attach the TOD clock */
-       todr_attach(&todr);
 }
 
 void
@@ -235,13 +224,22 @@
 void
 pdcattach(device_t parent, device_t self, void *aux)
 {
+       static struct todr_chip_handle todr = {
+               .todr_settime = pdcsettod,
+               .todr_gettime = pdcgettod,
+       };
        struct pdc_softc *sc = device_private(self);
 
        sc->sc_dv = self;
        pdc_attached = 1;
 
-       if (!pdc)
-               pdc_init();
+       KASSERT(pdc != NULL);
+
+       cn_init_magic(&pdc_cnm_state);
+       cn_set_magic("+++++");
+
+       /* attach the TOD clock */
+       todr_attach(&todr);
 
        aprint_normal("\n");
 



Home | Main Index | Thread Index | Old Index