Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax - Massive change of console initialization. H...



details:   https://anonhg.NetBSD.org/src/rev/3badc75c5519
branches:  trunk
changeset: 481641:3badc75c5519
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Thu Feb 03 04:09:01 2000 +0000

description:
- Massive change of console initialization.  Have each model its own
  consinit().
- Fix fbconnect() and relatives; 'struct fbinfo' is initialized only once,
  making sure no extraneous console resolution message is emitted.

diffstat:

 sys/arch/pmax/dev/bt478var.h      |    3 +-
 sys/arch/pmax/dev/cfb.c           |   60 +++++----
 sys/arch/pmax/dev/dc.c            |   88 ++++++++-----
 sys/arch/pmax/dev/dcvar.h         |    7 +-
 sys/arch/pmax/dev/dtop.c          |   18 ++-
 sys/arch/pmax/dev/mfb.c           |   57 +++++---
 sys/arch/pmax/dev/mfbvar.h        |    4 +-
 sys/arch/pmax/dev/pm.c            |  243 +++++++++++++++++++++++--------------
 sys/arch/pmax/dev/pmvar.h         |    7 +-
 sys/arch/pmax/dev/px.c            |   18 ++-
 sys/arch/pmax/dev/pxvar.h         |    6 +-
 sys/arch/pmax/dev/sfb.c           |   66 +++++-----
 sys/arch/pmax/dev/sfbvar.h        |    4 +-
 sys/arch/pmax/dev/xcfb.c          |   82 ++++++------
 sys/arch/pmax/dev/xcfbvar.h       |    4 +-
 sys/arch/pmax/include/fbvar.h     |   12 +-
 sys/arch/pmax/pmax/dec_3100.c     |   33 ++++-
 sys/arch/pmax/pmax/dec_3max.c     |   36 +++++-
 sys/arch/pmax/pmax/dec_3maxplus.c |   36 ++++-
 sys/arch/pmax/pmax/dec_3min.c     |   36 ++++-
 sys/arch/pmax/pmax/dec_5100.c     |   14 +-
 sys/arch/pmax/pmax/dec_maxine.c   |   62 +++++++--
 sys/arch/pmax/pmax/machdep.c      |   11 +-
 sys/arch/pmax/tc/scc.c            |   56 +++++---
 sys/arch/pmax/tc/sccvar.h         |    8 +-
 sys/arch/pmax/tc/tcbus.c          |   39 ++---
 26 files changed, 646 insertions(+), 364 deletions(-)

diffs (truncated from 1938 to 300 lines):

diff -r f04eb665eb01 -r 3badc75c5519 sys/arch/pmax/dev/bt478var.h
--- a/sys/arch/pmax/dev/bt478var.h      Thu Feb 03 03:21:52 2000 +0000
+++ b/sys/arch/pmax/dev/bt478var.h      Thu Feb 03 04:09:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt478var.h,v 1.6 2000/01/09 03:55:29 simonb Exp $      */
+/*     $NetBSD: bt478var.h,v 1.7 2000/02/03 04:09:12 nisimura Exp $    */
 
 /*
  * Copyright 1996 The Board of Trustees of The Leland Stanford
@@ -26,4 +26,5 @@
            int index, int count));
 int    bt478GetColorMap __P((struct fbinfo *fi, u_char *bits,
            int index, int count));
+void bt478CursorColor __P((struct fbinfo *fi, u_int *color));
 void   bt478CursorColor __P((struct fbinfo *fi, unsigned int color[]));
diff -r f04eb665eb01 -r 3badc75c5519 sys/arch/pmax/dev/cfb.c
--- a/sys/arch/pmax/dev/cfb.c   Thu Feb 03 03:21:52 2000 +0000
+++ b/sys/arch/pmax/dev/cfb.c   Thu Feb 03 04:09:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfb.c,v 1.37 2000/01/10 03:24:31 simonb Exp $  */
+/*     $NetBSD: cfb.c,v 1.38 2000/02/03 04:09:13 nisimura Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -80,10 +80,6 @@
  * rights to redistribute these changes.
  */
 
-#include "fb.h"
-#include "cfb.h"
-
-#if NCFB > 0
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/fcntl.h>
@@ -103,6 +99,7 @@
  */
 static struct fbuaccess                cfbu;
 static struct pmax_fbtty       cfbfb;
+static struct fbinfo           *cfb_fi;
 
 /*
  * Method table for standard framebuffer operations on a CFB.
@@ -119,7 +116,7 @@
        bt459CursorColor
 };
 
-#define        CFB_OFFSET_VRAM         0x0             /* from module's base */
+#define CFB_OFFSET_VRAM                0x0             /* from module's base */
 #define CFB_OFFSET_BT459       0x200000        /* Bt459 registers */
 #define CFB_OFFSET_IREQ                0x300000        /* Interrupt req. control */
 #define CFB_OFFSET_ROM         0x380000        /* Diagnostic ROM */
@@ -134,12 +131,25 @@
 
 static int     cfbmatch __P((struct device *, struct cfdata *, void *));
 static void    cfbattach __P((struct device *, struct device *, void *));
+static int     cfbinit __P((struct fbinfo *, caddr_t, int, int));
 static int     cfb_intr __P((void *sc));
 
 struct cfattach cfb_ca = {
        sizeof(struct fbsoftc), cfbmatch, cfbattach
 };
 
+int
+cfb_cnattach(addr)
+       paddr_t addr;
+{
+       struct fbinfo *fi;
+
+       fbcnalloc(&fi);
+       cfbinit(fi, (caddr_t)addr, 0, 1);
+       cfb_fi = fi;
+       return (1);
+}
+
 static int
 cfbmatch(parent, match, aux)
        struct device *parent;
@@ -148,11 +158,6 @@
 {
        struct tc_attach_args *ta = aux;
 
-#ifdef FBDRIVER_DOES_ATTACH
-       /* leave configuration  to the fb driver */
-       return 0;
-#endif
-
        /* make sure that we're looking for this type of device. */
        if (!TC_BUS_MATCHNAME(ta, "PMAG-BA "))
                return (0);
@@ -176,12 +181,20 @@
        int unit = self->dv_unit;
        struct fbinfo *fi;
        
-       /* Allocate a struct fbinfo and point the softc at it */
-       if (fballoc(base, &fi) == 0 && !cfbinit(fi, base, unit, 0))
-                       return;
+       if (cfb_fi)
+               fi = cfb_fi;
+       else {
+               /* Allocate a struct fbinfo and point the softc at it */
+               if (fballoc(&fi) < 0 || cfbinit(fi, base, unit, 0) < 0)
+                       return; /* failed */
+       }
+       ((struct fbsoftc *)self)->sc_fi = fi;
 
-       if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
-               return;
+       printf(": %dx%dx%d%s",
+               fi->fi_type.fb_width,
+               fi->fi_type.fb_height,
+               fi->fi_type.fb_depth, 
+               (cfb_fi) ? " console" : "");
 
        /*
         * 3MIN does not mask un-established TC option interrupts,
@@ -190,7 +203,6 @@
         * interrupt handler, which interrupts during vertical-retrace.
         */
        tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, cfb_intr, fi);
-       fbconnect("PMAG-BA", fi, 0);
        printf("\n");
 }
 
@@ -200,7 +212,7 @@
  * CFB initialization.  This is divorced from cfbattch() so that
  * a console framebuffer can be initialized early during boot.
  */
-int
+static int
 cfbinit(fi, cfbaddr, unit, silent)
        struct fbinfo *fi;
        caddr_t cfbaddr;
@@ -258,14 +270,10 @@
        /* Initialize old-style pmax glass-tty screen info. */
        fi->fi_glasstty = &cfbfb;
 
-       /* Initialize the color map, the screen, and the mouse. */
-       if (tb_kbdmouseconfig(fi)) {
-               printf(" (mouse/keyboard config failed)");
-               return (0);
-       }
+       if (tb_kbdmouseconfig(fi))
+               return (-1);
 
-       /* Connect to the raster-console pseudo-driver */
-       fbconnect("PMAG-BA", fi, silent);
+       fbconnect(fi);
        return (1);
 }
 
@@ -294,5 +302,3 @@
        *(int*) (slot_addr + CFB_OFFSET_IREQ) = 0;
        return (0);
 }
-
-#endif /* NCFB */
diff -r f04eb665eb01 -r 3badc75c5519 sys/arch/pmax/dev/dc.c
--- a/sys/arch/pmax/dev/dc.c    Thu Feb 03 03:21:52 2000 +0000
+++ b/sys/arch/pmax/dev/dc.c    Thu Feb 03 04:09:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dc.c,v 1.59 2000/01/10 03:24:31 simonb Exp $   */
+/*     $NetBSD: dc.c,v 1.60 2000/02/03 04:09:19 nisimura Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.59 2000/01/10 03:24:31 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.60 2000/02/03 04:09:19 nisimura Exp $");
 
 /*
  * devDC7085.c --
@@ -192,45 +192,67 @@
        NULL, NULL, dcGetc, dcPutc, dcPollc, NODEV, CN_REMOTE
 };
 
-/*
- * Special-case code to attach a console.
- * We were using PROM callbacks for console I/O,
- * and we just reset the chip under the console.
- * wire up this driver as console ASAP.
- *
- * Must be called at spltty() or higher.
- */
 void
-dc_consinit(dev, dcaddr)
+dc_cnattach(addr, line)
+paddr_t addr;
+int line;
+{
+       void *v;
        dev_t dev;
-       void *dcaddr;
-{
        struct dc_softc *sc;
-       dcregs *addr = (dcregs *)dcaddr;
+
+       if (line == 4)
+               line = DCCOMM_PORT;
+       else if (line == 0)
+               line = 0;
+       else
+               line = DCPRINTER_PORT;
 
-       /* save address in case we're cold */
-       if (cold && dc_cons_addr == 0) {
-               /* called while very cold to initalize console output */
-               dc_cons_addr = addr;
-               sc = &coldcons_softc;
-               sc->dc_pdma[0].p_addr = (void*)addr;
-               sc->dc_pdma[1].p_addr = (void*)addr;
-               sc->dc_pdma[2].p_addr = (void*)addr;
-               sc->dc_pdma[3].p_addr = (void*)addr;
-       } else {
-               /* being called from dcattach() to reset console */
-               sc = dc_cd.cd_devs[DCUNIT(dev)];
-       }
+       dev = makedev(DCDEV, line);
+       v = (void *)MIPS_PHYS_TO_KSEG1(addr);
+       sc = &coldcons_softc;
+       sc->dc_pdma[0].p_addr = v;
+       sc->dc_pdma[1].p_addr = v;
+       sc->dc_pdma[2].p_addr = v;
+       sc->dc_pdma[3].p_addr = v;
+       dc_cons_addr = v;
 
-       /* reset chip */
-       dc_reset(addr);
+       dc_reset(v);
+       dc_tty_init(sc, dev);
 
-       dccons.cn_dev = dev;
-       *cn_tab = dccons;
-       sc->dcsoftCAR |= 1 << DCLINE(cn_tab->cn_dev);
-       dc_tty_init(sc, cn_tab->cn_dev);
+       cn_tab = &dccons;
+       cn_tab->cn_pri = CN_REMOTE;
+       cn_tab->cn_dev = dev;
 }
 
+#if NRASTERCONSOLE > 0
+void
+dckbd_cnattach(addr)
+paddr_t addr;
+{
+       void *v;
+       dev_t dev;
+       struct dc_softc *sc;
+
+       dev = makedev(DCDEV, DCKBD_PORT);
+       v = (void *)MIPS_PHYS_TO_KSEG1(addr);
+       sc = &coldcons_softc;
+       sc->dc_pdma[0].p_addr = v;
+       sc->dc_pdma[1].p_addr = v;
+       sc->dc_pdma[2].p_addr = v;
+       sc->dc_pdma[3].p_addr = v;
+       dc_cons_addr = v;
+
+       dc_reset(v);
+       dc_kbd_init(sc, dev);
+       lk_divert(dcGetc, dev);
+
+       cn_tab = &dccons;
+       cn_tab->cn_pri = CN_NORMAL;
+       cn_tab->cn_getc = lk_getc;
+       rcons_indev(cn_tab); /* cn_dev & cn_putc */
+}
+#endif
 
 /*
  * Attach DC7085 (dz-11) device.
diff -r f04eb665eb01 -r 3badc75c5519 sys/arch/pmax/dev/dcvar.h
--- a/sys/arch/pmax/dev/dcvar.h Thu Feb 03 03:21:52 2000 +0000
+++ b/sys/arch/pmax/dev/dcvar.h Thu Feb 03 04:09:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dcvar.h,v 1.8 2000/01/09 03:55:34 simonb Exp $ */
+/*     $NetBSD: dcvar.h,v 1.9 2000/02/03 04:09:13 nisimura Exp $       */
 
 /*
  * External declarations from DECstation dc serial driver.
@@ -39,8 +39,6 @@
  * Following declaratios for console code.
  * XXX should be redesigned to expose less driver internals.
  */
-void   dc_consinit __P((dev_t dev, void *dcaddr));
-int    dc_ds_consinit __P((dev_t dev));
 int    dcGetc __P((dev_t dev));
 void   dcPutc __P((dev_t dev, int c));
 
@@ -49,5 +47,8 @@
 extern void    (*dcMouseEvent) __P((void *));
 extern void    (*dcMouseButtons) __P((void *));
 
+void dc_cnattach __P((paddr_t, int));
+void dckbd_cnattach __P((paddr_t));
+
 #endif /* _DCVAR_H */



Home | Main Index | Thread Index | Old Index