From 3aaeaf733132603fe49bcf000eeb91bc1f3ec8ef Mon Sep 17 00:00:00 2001 From: nisimura Date: Thu, 3 Feb 2000 04:09:01 +0000 Subject: [PATCH] - 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. --- 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 | 241 ++++++++++++++++++------------ 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 | 52 ++++--- sys/arch/pmax/tc/sccvar.h | 8 +- sys/arch/pmax/tc/tcbus.c | 39 ++--- 26 files changed, 643 insertions(+), 361 deletions(-) diff --git a/sys/arch/pmax/dev/bt478var.h b/sys/arch/pmax/dev/bt478var.h index e7f5457cd823..7160e60f1848 100644 --- a/sys/arch/pmax/dev/bt478var.h +++ b/sys/arch/pmax/dev/bt478var.h @@ -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 bt478LoadColorMap __P((struct fbinfo *fi, const u_char *bits, 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 --git a/sys/arch/pmax/dev/cfb.c b/sys/arch/pmax/dev/cfb.c index 0532713e707b..dcb0fd8378d8 100644 --- a/sys/arch/pmax/dev/cfb.c +++ b/sys/arch/pmax/dev/cfb.c @@ -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 #include #include @@ -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 @@ struct fbdriver cfb_driver = { 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 @@ struct fbdriver cfb_driver = { 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 @@ cfbmatch(parent, match, aux) { 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 @@ cfbattach(parent, self, aux) 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 @@ cfbattach(parent, self, aux) * 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 @@ cfbattach(parent, self, aux) * 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 @@ cfbinit(fi, cfbaddr, unit, silent) /* 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 @@ cfb_intr(sc) *(int*) (slot_addr + CFB_OFFSET_IREQ) = 0; return (0); } - -#endif /* NCFB */ diff --git a/sys/arch/pmax/dev/dc.c b/sys/arch/pmax/dev/dc.c index 784c00e808db..873f780924c8 100644 --- a/sys/arch/pmax/dev/dc.c +++ b/sys/arch/pmax/dev/dc.c @@ -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 /* 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 @@ static struct consdev dccons = { 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) - dev_t dev; - void *dcaddr; +dc_cnattach(addr, line) +paddr_t addr; +int line; { + void *v; + dev_t dev; struct dc_softc *sc; - dcregs *addr = (dcregs *)dcaddr; - /* 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)]; - } + if (line == 4) + line = DCCOMM_PORT; + else if (line == 0) + line = 0; + else + line = DCPRINTER_PORT; - /* reset chip */ - dc_reset(addr); + 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; - dccons.cn_dev = dev; - *cn_tab = dccons; - sc->dcsoftCAR |= 1 << DCLINE(cn_tab->cn_dev); - dc_tty_init(sc, cn_tab->cn_dev); + dc_reset(v); + dc_tty_init(sc, 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 --git a/sys/arch/pmax/dev/dcvar.h b/sys/arch/pmax/dev/dcvar.h index ab5840bf5bee..9fc1784bbd1b 100644 --- a/sys/arch/pmax/dev/dcvar.h +++ b/sys/arch/pmax/dev/dcvar.h @@ -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 @@ int dcintr __P((void * xxxunit)); * 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 (*dcDivertXInput) __P((int)); 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 */ #endif /* _KERNEL */ diff --git a/sys/arch/pmax/dev/dtop.c b/sys/arch/pmax/dev/dtop.c index 8f466b9ddace..2124c9d50875 100644 --- a/sys/arch/pmax/dev/dtop.c +++ b/sys/arch/pmax/dev/dtop.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtop.c,v 1.45 2000/01/10 03:24:32 simonb Exp $ */ +/* $NetBSD: dtop.c,v 1.46 2000/02/03 04:09:20 nisimura Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -94,7 +94,7 @@ SOFTWARE. ********************************************************/ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.45 2000/01/10 03:24:32 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.46 2000/02/03 04:09:20 nisimura Exp $"); #include "rasterconsole.h" @@ -202,6 +202,20 @@ static u_char divend[NUMDIVS] = {0xff, 0xa5, 0xbc, 0xbe, 0xb2, 0xaf, 0xa8, */ static u_long keymodes[8] = {0, 0, 0, 0, 0, 0x0003e800, 0, 0}; +struct consdev dtopcons = { + NULL, NULL, (void *)dtopKBDGetc, NULL, NULL, NODEV, 0 +}; + +void dtikbd_cnattach __P((void)); /* XXX */ + +void +dtikbd_cnattach() +{ + cn_tab = &dtopcons; + cn_tab->cn_pri = CN_NORMAL; + rcons_indev(cn_tab); /* cn_dev & cn_putc */ +} + /* * Autoconfiguration data for config.new. * Use the statically-allocated softc until old autoconfig code and diff --git a/sys/arch/pmax/dev/mfb.c b/sys/arch/pmax/dev/mfb.c index 7a3a2057b538..c420296fbd52 100644 --- a/sys/arch/pmax/dev/mfb.c +++ b/sys/arch/pmax/dev/mfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfb.c,v 1.44 2000/01/10 03:24:32 simonb Exp $ */ +/* $NetBSD: mfb.c,v 1.45 2000/02/03 04:09:14 nisimura Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -81,11 +81,8 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.44 2000/01/10 03:24:32 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.45 2000/02/03 04:09:14 nisimura Exp $"); -#include "fb.h" -#include "mfb.h" -#if NMFB > 0 #include #include #include @@ -107,6 +104,7 @@ __KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.44 2000/01/10 03:24:32 simonb Exp $"); */ static struct fbuaccess mfbu; static struct pmax_fbtty mfbfb; +static struct fbinfo *mfb_fi; static void mfbPosCursor __P((struct fbinfo *fi, int x, int y)); @@ -168,7 +166,7 @@ struct fbdriver mfb_driver = { /* * Register offsets */ -#define MFB_OFFSET_VRAM 0x200000 /* from module's base */ +#define MFB_OFFSET_VRAM 0x200000 /* from module's base */ #define MFB_OFFSET_BT431 0x180000 /* Bt431 registers */ #define MFB_OFFSET_BT455 0x100000 /* Bt455 registers */ #define MFB_OFFSET_IREQ 0x080000 /* Interrupt req. control */ @@ -181,12 +179,27 @@ struct fbdriver mfb_driver = { */ static int mfbmatch __P((struct device *, struct cfdata *, void *)); static void mfbattach __P((struct device *, struct device *, void *)); +static int mfbinit __P((struct fbinfo *, caddr_t, int, int)); static int mfb_intr __P((void *sc)); struct cfattach mfb_ca = { sizeof(struct fbinfo), mfbmatch, mfbattach }; +int +mfb_cnattach(addr) + paddr_t addr; +{ + struct fbinfo *fi; + caddr_t base; + + base = (caddr_t)MIPS_PHYS_TO_KSEG1(addr); + fbcnalloc(&fi); + if (mfbinit(fi, base, 0, 1) < 0) + return (0); + mfb_fi = fi; + return (1); +} static int mfbmatch(parent, match, aux) @@ -196,11 +209,6 @@ mfbmatch(parent, match, aux) { 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-AA ")) return (0); @@ -219,12 +227,19 @@ mfbattach(parent, self, aux) int unit = self->dv_unit; struct fbinfo *fi; - /* Allocate a struct fbinfo and point the softc at it */ - if (fballoc(mfbaddr, &fi) == 0 && !mfbinit(fi, mfbaddr, unit, 0)) - return; + if (mfb_fi) + fi = mfb_fi; + else { + if (fballoc(&fi) < 0 || mfbinit(fi, mfbaddr, 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, + (mfb_fi) ? " console" : ""); /* * 3MIN does not mask un-established TC option interrupts, @@ -233,11 +248,9 @@ mfbattach(parent, self, aux) * interrupt handler, which interrupts during vertical-retrace. */ tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, mfb_intr, fi); - fbconnect("PMAG-AA", fi, 0); printf("\n"); } - /* * Initialization */ @@ -308,7 +321,7 @@ mfbinit(fi, mfbaddr, unit, silent) * Initialize the color map, the screen, and the mouse. */ if (tb_kbdmouseconfig(fi)) - return (0); + return (-1); /* * black-on-white during first initialization of console, @@ -320,8 +333,8 @@ mfbinit(fi, mfbaddr, unit, silent) /* * Connect to the raster-console pseudo-driver. */ - fbconnect("PMAG-AA", fi, silent); - return (1); + fbconnect(fi); + return (0); } static u_char cursor_RGB[6]; /* cursor color 2 & 3 */ @@ -790,5 +803,3 @@ mfb_intr(sc) return (0); } - -#endif /* NMFB */ diff --git a/sys/arch/pmax/dev/mfbvar.h b/sys/arch/pmax/dev/mfbvar.h index d010ca4aa14a..db99b3f80e77 100644 --- a/sys/arch/pmax/dev/mfbvar.h +++ b/sys/arch/pmax/dev/mfbvar.h @@ -1,7 +1,7 @@ -/* $NetBSD: mfbvar.h,v 1.4 2000/01/08 01:02:35 simonb Exp $ */ +/* $NetBSD: mfbvar.h,v 1.5 2000/02/03 04:09:14 nisimura Exp $ */ /* * Initialize a Turbochannel MFB 1280x1024x1 2-d framebuffer, * so it can be used as a bitmapped glass-tty console device. */ -int mfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent)); +int mfb_cnattach __P((paddr_t)); diff --git a/sys/arch/pmax/dev/pm.c b/sys/arch/pmax/dev/pm.c index 4d68ad9ed887..1c23a60d8410 100644 --- a/sys/arch/pmax/dev/pm.c +++ b/sys/arch/pmax/dev/pm.c @@ -1,4 +1,4 @@ -/* $NetBSD: pm.c,v 1.32 2000/01/10 03:24:33 simonb Exp $ */ +/* $NetBSD: pm.c,v 1.33 2000/02/03 04:09:15 nisimura Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -56,54 +56,46 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.32 2000/01/10 03:24:33 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.33 2000/02/03 04:09:15 nisimura Exp $"); #include #include +#include #include #include +#include +#include #include #include #include #include /* wbflush() */ #include - #include #include #include #include + /* * These need to be mapped into user space. */ -struct fbuaccess pmu; static u_short curReg; /* copy of PCCRegs.cmdr since it's read only */ -/* - * rcons methods and globals. - */ -struct pmax_fbtty pmfb; +static struct fbuaccess pmu; +static struct pmax_fbtty pmfb; +static struct fbinfo *pm_fi; -/* - * Forward references. - */ +static int pm_video_on __P ((struct fbinfo *)); +static int pm_video_off __P ((struct fbinfo *)); static void pmInitColorMap __P((struct fbinfo *fi)); -static void pmLoadCursor __P((struct fbinfo *fi, u_short *ptr)); static void pmPosCursor __P((struct fbinfo *fi, int x, int y)); -#if 0 /* XXX not used */ -static void pccCursorOn __P((struct fbinfo *fi)); -#endif +static void pmLoadCursor __P((struct fbinfo *fi, u_short *ptr)); static void pccCursorOff __P((struct fbinfo *fi)); -static int pm_video_on __P((struct fbinfo *)); -static int pm_video_off __P((struct fbinfo *)); - -/* new-style raster-cons "driver" methods */ - -struct fbdriver pm_driver = { +static struct fbdriver pm_driver = { pm_video_on, pm_video_off, pmInitColorMap, /* pcc cursor wrapper for bt478InitColorMap */ @@ -114,69 +106,154 @@ struct fbdriver pm_driver = { bt478CursorColor, }; +static int pmmatch __P((struct device *, struct cfdata *, void *)); +static void pmattach __P((struct device *, struct device *, void *)); +static int pminit __P((struct fbinfo *, caddr_t, int)); +struct cfattach pm_ds_ca = { + sizeof(struct device), pmmatch, pmattach +}; -/* - * Machine-independent backend to attach a pm device. - * assumes the following fields in struct fbinfo *fi have been set - * by the MD front-end: - * - * fi->fi_pixels framebuffer raster memory - * fi->fi_vdac vdac register address - * fi->fi_base address of programmable cursor chip registers - * fi->fi_type.fb_depth 1 (mono) or 8 (colour) - * fi->fi_fbu QVSS-compatible user-mapped fbinfo struct - */ int -pmattach(fi, unit, cold_console_flag) - struct fbinfo *fi; - int unit; - int cold_console_flag; +pm_cnattach() { - PCCRegs *pcc = (PCCRegs *)fi->fi_base; + struct fbinfo *fi; + caddr_t base; - /* check for no frame buffer */ - if (badaddr((char *)fi->fi_pixels, 4)) +#if 0 + ULTRIX does in this way; + check the presense of monochrome bit in CSR. + if set, there is a monochrome framebuffer + if not set, try two write and read cycles of framebuffer to make + sure the presense of video memory. +#else + base = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_PCC); + if (badaddr(base, 4)) + return (0); +#endif + + fbcnalloc(&fi); + if (pminit(fi, base, 0) < 0) + return (0); + pm_fi = fi; + return (1); +} + +static int +pmmatch(parent, match, aux) + struct device *parent; + struct cfdata *match; + void *aux; +{ + struct ibus_attach_args *ia = aux; + caddr_t pmaddr = (caddr_t)ia->ia_addr; + + /* make sure that we're looking for this type of device. */ + if (strcmp(ia->ia_name, "pm") != 0) return (0); - /* Fill in the stuff that differs from monochrome to color. */ - if (fi->fi_type.fb_depth == 1) { + if (badaddr(pmaddr, 4)) + return (0); + + return (1); +} + +static void +pmattach(parent, self, aux) + struct device *parent; + struct device *self; + void *aux; +{ + struct ibus_attach_args *ia = aux; + caddr_t base = (caddr_t)ia->ia_addr; + struct fbinfo *fi; + + if (pm_fi) + fi = pm_fi; + else { + if (fballoc(&fi) < 0 || pminit(fi, base, self->dv_unit) < 0) + return; /* failed */ + } + ((struct fbsoftc *)self)->sc_fi = fi; + + printf(": %dx%dx%d%s", + fi->fi_type.fb_width, + fi->fi_type.fb_height, + fi->fi_type.fb_depth, + (pm_fi) ? " console" : ""); + + printf("\n"); +} + +int +pminit(fi, base, unit) + struct fbinfo *fi; + caddr_t base; + int unit; +{ + u_int16_t kn01csr; + PCCRegs *pcc; + + kn01csr = *(volatile u_int16_t *)MIPS_PHYS_TO_KSEG1(KN01_SYS_CSR); + + fi->fi_unit = unit; + fi->fi_pixels = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_PHYS_FBUF_START); + fi->fi_base = base; /* PCC address */ + fi->fi_vdac = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_VDAC); + + if (kn01csr & KN01_CSR_MONO) { + fi->fi_type.fb_boardtype = PMAX_FBTYPE_PM_MONO; fi->fi_type.fb_depth = 1; fi->fi_type.fb_cmsize = 0; - fi->fi_type.fb_boardtype = PMAX_FBTYPE_PM_MONO; fi->fi_type.fb_size = 0x40000; - fi->fi_linebytes = 256; - } else { + fi->fi_pixelsize = (1024 / 8) * 864; + fi->fi_linebytes = 1024 / 8; + } + else { + fi->fi_type.fb_boardtype = PMAX_FBTYPE_PM_COLOR; fi->fi_type.fb_depth = 8; fi->fi_type.fb_cmsize = 256; - fi->fi_type.fb_boardtype = PMAX_FBTYPE_PM_COLOR; fi->fi_type.fb_size = 0x100000; + fi->fi_pixelsize = 1024 * 864; fi->fi_linebytes = 1024; } - - /* Fill in main frame buffer info struct. */ - - fi->fi_driver = &pm_driver; - fi->fi_pixelsize = - ((fi->fi_type.fb_depth == 1) ? 1024 / 8 : 1024) * 864; - fi->fi_blanked = 0; fi->fi_type.fb_width = 1024; fi->fi_type.fb_height = 864; - + fi->fi_size = fi->fi_type.fb_size; + fi->fi_driver = &pm_driver; + fi->fi_blanked = 0; /* - * Compatibility glue + * Set mmap'able address of qvss-compatible user info structure. + * + * Must be in Uncached space since the fbuaccess structure is + * mapped into the user's address space uncached. + * + * XXX can go away when MI support for d_mmap entrypoints added. + */ + fi->fi_fbu = (void *)MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&pmu)); + + /* This is glass-tty state but it's in the shared structure. Ick. */ + fi->fi_fbu->scrInfo.max_row = 56; + fi->fi_fbu->scrInfo.max_col = 80; + + /* These are non-zero on the kn01 framebuffer. Why? */ + fi->fi_fbu->scrInfo.min_cur_x = -15; + fi->fi_fbu->scrInfo.min_cur_y = -15; + + init_pmaxfbu(fi); + + /* + * Initialize old-style glass-tty screen info. */ fi->fi_glasstty = &pmfb; - - - /* - * Initialize the screen. - */ - pcc->cmdr = PCC_FOPB | PCC_VBHI; + /* it's safe to assume serial driver existence in this case */ + tb_kbdmouseconfig(fi); /* Initialize the cursor register on . */ /* Turn off the hardware cursor sprite for rcons text mode. */ + pcc = (PCCRegs *)fi->fi_base; + pcc->cmdr = PCC_FOPB | PCC_VBHI; curReg = 0; /* XXX */ pccCursorOff(fi); @@ -185,38 +262,11 @@ pmattach(fi, unit, cold_console_flag) */ bt478init(fi); - /* - * Initialize old-style pmax screen info. - */ - fi->fi_fbu->scrInfo.max_row = 56; - fi->fi_fbu->scrInfo.max_col = 80; + fbconnect(fi); - init_pmaxfbu(fi); - - /* These are non-zero on the kn01 framebuffer. Why? */ - fi->fi_fbu->scrInfo.min_cur_x = -15; - fi->fi_fbu->scrInfo.min_cur_y = -15; - - -#ifdef notanymore - bt478InitColorMap(fi); /* done inside bt478init() */ -#endif - - /* - * Connect to the raster-console pseudo-driver. - */ - fi->fi_glasstty = &pmfb; /*XXX*/ - fbconnect((fi->fi_type.fb_depth == 1) ? "KN01 mfb" : "KN01 cfb", - fi, cold_console_flag); - - -#ifdef fpinitialized - fp->initialized = 1; -#endif - return (1); + return (0); } - /* * ---------------------------------------------------------------------------- * @@ -275,7 +325,7 @@ pmLoadCursor(fi, cur) * *---------------------------------------------------------------------- */ -void +static void pmPosCursor(fi, x, y) struct fbinfo *fi; int x, y; @@ -316,7 +366,8 @@ void pccCursorOn(fi) * overlay planes. video output under the cursor sprite is then * determined by the framebuffer contents. */ -void pccCursorOff(fi) +static void +pccCursorOff(fi) struct fbinfo *fi; { PCCRegs *pcc = (PCCRegs *)fi -> fi_base; @@ -329,7 +380,8 @@ void pccCursorOff(fi) * Initialize colourmap to default values. * The default cursor hardware state is off. */ -void pmInitColorMap(fi) +void +pmInitColorMap(fi) struct fbinfo *fi; { bt478InitColorMap(fi); @@ -341,7 +393,7 @@ void pmInitColorMap(fi) * Enable the video display. */ static int -pm_video_on (fi) +pm_video_on(fi) struct fbinfo *fi; { PCCRegs *pcc = (PCCRegs *)fi -> fi_base; @@ -362,7 +414,8 @@ pm_video_on (fi) * determined by colourmap entry 12 (0x0c), which we set here to * black. */ -static int pm_video_off (fi) +static int +pm_video_off(fi) struct fbinfo *fi; { PCCRegs *pcc = (PCCRegs *)fi -> fi_base; diff --git a/sys/arch/pmax/dev/pmvar.h b/sys/arch/pmax/dev/pmvar.h index ed0ecf97a48d..7eb6814a6eab 100644 --- a/sys/arch/pmax/dev/pmvar.h +++ b/sys/arch/pmax/dev/pmvar.h @@ -1,11 +1,10 @@ -/* $NetBSD: pmvar.h,v 1.7 2000/01/09 03:55:41 simonb Exp $ */ +/* $NetBSD: pmvar.h,v 1.8 2000/02/03 04:09:15 nisimura Exp $ */ /* - * Initialize a Decstation 3100/2100 baseboard framebuffer, + * Initialize a DECstation 3100/2100 baseboard framebuffer, * so it can be used as a bitmapped glass-tty console device. */ -int pminit __P((struct fbinfo *fi, caddr_t base, int unit, int silent)); -int pmattach __P((struct fbinfo *fi, int unit, int silent)); +int pm_cnattach __P((void)); extern struct pmax_fbtty pmfb; /* used in dev/pm_ds.c */ extern struct fbuaccess pmu; /* used in dev/pm_ds.c */ diff --git a/sys/arch/pmax/dev/px.c b/sys/arch/pmax/dev/px.c index a919c9207722..155aa66fbf18 100644 --- a/sys/arch/pmax/dev/px.c +++ b/sys/arch/pmax/dev/px.c @@ -1,4 +1,4 @@ -/* $NetBSD: px.c,v 1.27 2000/01/14 02:00:46 ad Exp $ */ +/* $NetBSD: px.c,v 1.28 2000/02/03 04:09:16 nisimura Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.27 2000/01/14 02:00:46 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.28 2000/02/03 04:09:16 nisimura Exp $"); /* * px.c: driver for the DEC TURBOchannel 2D and 3D accelerated framebuffers @@ -98,6 +98,7 @@ struct px_softc { static int px_match __P((struct device *, struct cfdata *, void *)); static void px_attach __P((struct device *, struct device *, void *)); +static int px_init __P((struct fbinfo *, caddr_t, int, int)); static int px_intr __P((void *xxx_sc)); static int32_t *px_alloc_pbuf __P((struct px_info *)); @@ -259,6 +260,17 @@ struct bt459_regs { #define PACK_WORD(p, o) ((p)[(o)] | ((p)[(o)+1] << 16)) +int +px_cnattach(addr) + paddr_t addr; +{ + caddr_t base; + base = (caddr_t)TC_PHYS_TO_UNCACHED(addr); + if (px_init((struct fbinfo *)1, base, 0, 1) != 1) + return (0); + return (1); +} + /* * Match a supported board. */ @@ -333,7 +345,7 @@ px_attach(parent, self, aux) * * XXX use magic number to make sure fi isn't a real struct fbinfo? */ -int +static int px_init(fi, slotbase, unit, console) struct fbinfo *fi; caddr_t slotbase; diff --git a/sys/arch/pmax/dev/pxvar.h b/sys/arch/pmax/dev/pxvar.h index 945732002780..362e631fb3aa 100644 --- a/sys/arch/pmax/dev/pxvar.h +++ b/sys/arch/pmax/dev/pxvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pxvar.h,v 1.9 2000/01/14 02:00:47 ad Exp $ */ +/* $NetBSD: pxvar.h,v 1.10 2000/02/03 04:09:17 nisimura Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -136,9 +136,7 @@ typedef struct px_map { #ifdef _KERNEL -/* XXX ugly hack to make the PX fit for findcons() */ -struct fbinfo; -int px_init __P((struct fbinfo *, char *, int, int)); +int px_cnattach __P((paddr_t)); #endif /* _KERNEL */ diff --git a/sys/arch/pmax/dev/sfb.c b/sys/arch/pmax/dev/sfb.c index 5c18d12a97b9..928ddc3474df 100644 --- a/sys/arch/pmax/dev/sfb.c +++ b/sys/arch/pmax/dev/sfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sfb.c,v 1.36 2000/01/10 03:24:34 simonb Exp $ */ +/* $NetBSD: sfb.c,v 1.37 2000/02/03 04:09:17 nisimura Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -80,9 +80,6 @@ * rights to redistribute these changes. */ -#include "fb.h" -#include "sfb.h" - #include #include #include @@ -108,6 +105,7 @@ */ static struct fbuaccess sfbu; static struct pmax_fbtty sfbfb; +static struct fbinfo *sfb_fi; /* @@ -116,6 +114,7 @@ static struct pmax_fbtty sfbfb; static int sfbmatch __P((struct device *, struct cfdata *, void *)); static void sfbattach __P((struct device *, struct device *, void *)); +static int sfbinit __P((struct fbinfo *, caddr_t, int, int)); static int sfb_intr __P((void *sc)); struct cfattach sfb_ca = { @@ -133,6 +132,20 @@ struct fbdriver sfb_driver = { bt459CursorColor }; +int +sfb_cnattach(addr) +paddr_t addr; +{ + struct fbinfo *fi; + caddr_t base; + + base = (caddr_t)MIPS_PHYS_TO_KSEG1(addr); + fbcnalloc(&fi); + if (sfbinit(fi, base, 0, 1) < 0) + return (0); + sfb_fi = fi; + return (1); +} /* match and attach routines cut-and-pasted from cfb */ @@ -148,14 +161,6 @@ sfbmatch(parent, match, aux) if (!TC_BUS_MATCHNAME(ta, "PMAGB-BA")) return (0); - /* - * if the TC rom ident matches, assume the VRAM is present too. - */ -#if 0 - if (badaddr( ((caddr_t)ta->ta_addr) + SFB_OFFSET_VRAM, 4)) - return (0); -#endif - return (1); } @@ -174,13 +179,20 @@ sfbattach(parent, self, aux) int unit = self->dv_unit; struct fbinfo *fi; - /* Allocate a struct fbinfo and point the softc at it */ - if (fballoc(sfbaddr, &fi) == 0 && !sfbinit(fi, sfbaddr, unit, 0)) - return; + if (sfb_fi) + fi = sfb_fi; + else { + if (fballoc(&fi) < 0 || sfbinit(fi, sfbaddr, unit, 0) < 0) + return; /* failed */ + } + ((struct fbsoftc *)self)->sc_fi = fi; + + printf(": %dx%dx%d%s", + fi->fi_type.fb_width, + fi->fi_type.fb_height, + fi->fi_type.fb_depth, + (sfb_fi) ? " console" : ""); - if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL) - return; - #if 0 /*XXX*/ /* @@ -198,7 +210,6 @@ sfbattach(parent, self, aux) * interrupt handler, which interrupts during vertical-retrace. */ tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, sfb_intr, fi); - fbconnect ("PMAGB-BA", fi, 0); printf("\n"); } @@ -206,7 +217,7 @@ sfbattach(parent, self, aux) /* * Initialization */ -int +static int sfbinit(fi, base, unit, silent) struct fbinfo *fi; char *base; @@ -288,19 +299,10 @@ sfbinit(fi, base, unit, silent) * Initialize the color map, the screen, and the mouse. */ if (tb_kbdmouseconfig(fi)) { - printf(" (mouse/keyboard config failed)"); - return (0); + return (-1); } - - - /*sfbInitColorMap();*/ /* done by bt459init() */ - - /* - * Connect to the raster-console pseudo-driver - */ - - fbconnect ("PMAGB-BA", fi, silent); - return (1); + fbconnect(fi); + return (0); } diff --git a/sys/arch/pmax/dev/sfbvar.h b/sys/arch/pmax/dev/sfbvar.h index 952a6158f9ff..56c78cabaae8 100644 --- a/sys/arch/pmax/dev/sfbvar.h +++ b/sys/arch/pmax/dev/sfbvar.h @@ -1,7 +1,7 @@ -/* $NetBSD: sfbvar.h,v 1.4 2000/01/08 01:02:36 simonb Exp $ */ +/* $NetBSD: sfbvar.h,v 1.5 2000/02/03 04:09:18 nisimura Exp $ */ /* * Initialize a Turbochannel SFB 2-d framebuffer, * so it can be used as a bitmapped glass-tty console device. */ -int sfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent)); +int sfb_cnattach __P((paddr_t)); diff --git a/sys/arch/pmax/dev/xcfb.c b/sys/arch/pmax/dev/xcfb.c index 32a169f6fc3c..bfbac4985477 100644 --- a/sys/arch/pmax/dev/xcfb.c +++ b/sys/arch/pmax/dev/xcfb.c @@ -1,4 +1,4 @@ - /* $NetBSD: xcfb.c,v 1.33 2000/01/10 03:24:34 simonb Exp $ */ + /* $NetBSD: xcfb.c,v 1.34 2000/02/03 04:09:18 nisimura Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -80,11 +80,7 @@ * v 9.2 90/02/13 22:16:24 shirriff Exp SPRITE (DECWRL)"; */ -#include "fb.h" - -#include "xcfb.h" #include "dtop.h" -#if NXCFB > 0 #if NDTOP == 0 xcfb needs dtop device #else @@ -98,6 +94,7 @@ xcfb needs dtop device #include #include +#include #include #include #include @@ -116,16 +113,11 @@ xcfb needs dtop device * These need to be mapped into user space. */ static struct fbuaccess xcfbu; - - -/* - * rcons methods and globals. - */ static struct pmax_fbtty xcfbfb; +static struct fbinfo *xcfb_fi; #define XCFB_FB_SIZE 0x100000 /* size of raster (mapped into userspace) */ - struct fbdriver xcfb_driver = { ims332_video_on, ims332_video_off, @@ -145,11 +137,26 @@ struct fbdriver xcfb_driver = { static int xcfbmatch __P((struct device *, struct cfdata *, void *)); static void xcfbattach __P((struct device *, struct device *, void *)); +static int xcfbinit __P((struct fbinfo *, caddr_t, int, int)); struct cfattach xcfb_ca = { sizeof(struct device), xcfbmatch, xcfbattach }; +int +xcfb_cnattach() +{ + struct fbinfo *fi; + caddr_t base; + + base = (caddr_t)MIPS_PHYS_TO_KSEG1(XINE_PHYS_CFB_START); + fbcnalloc(&fi); + if (xcfbinit(fi, base, 0, 1) < 0) + return (0); + xcfb_fi = fi; + return (1); +} + static int xcfbmatch(parent, match, aux) struct device *parent; @@ -168,35 +175,36 @@ xcfbmatch(parent, match, aux) static void xcfbattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; +struct device *parent; +struct device *self; +void *aux; { - struct tc_attach_args *ta; + struct tc_attach_args *ta = aux; + caddr_t base = (caddr_t)ta->ta_addr; + int unit = self->dv_unit; struct fbinfo *fi; - caddr_t base; - ta = aux; - base = (caddr_t)ta->ta_addr; + if (xcfb_fi) + fi = xcfb_fi; + else { + if (fballoc(&fi) < 0 || xcfbinit(fi, base, unit, 1) < 0) + return; /* failed */ + } + ((struct fbsoftc *)self)->sc_fi = fi; - /* Allocate a struct fbinfo and point the softc at it */ - if (fballoc(base, &fi) == 0 && !xcfbinit(fi, base, self->dv_unit, 0)) - return; + printf(": %dx%dx%d%s", + fi->fi_type.fb_width, + fi->fi_type.fb_height, + fi->fi_type.fb_depth, + (xcfb_fi) ? " console" : ""); - if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL) - return; - - - /*BUS_INTR_ESTABLISH(ca, xcfbintr, self->dv_unit);*/ - fbconnect("PMAG-DV", fi, 0); printf("\n"); } - /* * Initialization */ -int +static int xcfbinit(fi, base, unit, silent) struct fbinfo *fi; caddr_t base; @@ -262,23 +270,13 @@ xcfbinit(fi, base, unit, silent) /* Initialize the RAMDAC. */ ims332init (fi); - /* Connect serial device(s) */ if (tb_kbdmouseconfig(fi)) { - printf(" (mouse/keyboard config failed)"); - return (0); + return (-1); } - /* - * Connect to the raster-console pseudo-driver - */ - fbconnect("PMAG-DV", fi, silent); - -#ifdef fpinitialized - fp->initialized = 1; -#endif - return (1); + fbconnect(fi); + return (0); } #endif /* NDTOP */ -#endif /* NXCFB */ diff --git a/sys/arch/pmax/dev/xcfbvar.h b/sys/arch/pmax/dev/xcfbvar.h index fb1cce2e560f..258ae531b30f 100644 --- a/sys/arch/pmax/dev/xcfbvar.h +++ b/sys/arch/pmax/dev/xcfbvar.h @@ -1,3 +1,3 @@ -/* $NetBSD: xcfbvar.h,v 1.4 1999/12/15 14:36:41 ad Exp $ */ +/* $NetBSD: xcfbvar.h,v 1.5 2000/02/03 04:09:19 nisimura Exp $ */ -int xcfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent)); +int xcfb_cnattach __P((void)); diff --git a/sys/arch/pmax/include/fbvar.h b/sys/arch/pmax/include/fbvar.h index aba51f04ce43..1f226a905309 100644 --- a/sys/arch/pmax/include/fbvar.h +++ b/sys/arch/pmax/include/fbvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: fbvar.h,v 1.10 2000/01/09 15:34:43 ad Exp $ */ +/* $NetBSD: fbvar.h,v 1.11 2000/02/03 04:09:12 nisimura Exp $ */ /* * Copyright (c) 1992, 1993, 1995 @@ -107,12 +107,10 @@ struct fbdriver { #ifdef _KERNEL -#define kbd_docmd(cmd, val) 0 /* For now, do nothing. */ -#define romgetcursoraddr(xp, yp) 0 - -int fballoc __P((caddr_t base, struct fbinfo **fip)); -void fbattach __P((int n)); -void fbconnect __P((char *name, struct fbinfo *info, int silent)); +void fbattach __P((int)); +void fbcnalloc __P ((struct fbinfo **fip)); +int fballoc __P ((struct fbinfo **fip)); +void fbconnect __P ((struct fbinfo *fi)); int tcfb_cnattach __P((int prom_slot)); #endif /* _KERNEL */ diff --git a/sys/arch/pmax/pmax/dec_3100.c b/sys/arch/pmax/pmax/dec_3100.c index fee46becf542..b5baa537ab80 100644 --- a/sys/arch/pmax/pmax/dec_3100.c +++ b/sys/arch/pmax/pmax/dec_3100.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_3100.c,v 1.23 2000/01/14 13:45:23 simonb Exp $ */ +/* $NetBSD: dec_3100.c,v 1.24 2000/02/03 04:09:04 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -71,7 +71,7 @@ * @(#)machdep.c 8.3 (Berkeley) 1/12/94 */ -#include +#include #include #include @@ -83,9 +83,13 @@ #include #include +#include +#include #include +#include "rasterconsole.h" +#include "pm.h" #include "dc.h" #include "le_pmax.h" #include "sii.h" @@ -144,7 +148,30 @@ dec_3100_bus_reset() static void dec_3100_cons_init() { - /* notyet */ + int kbd, crt, screen; + + kbd = crt = screen = 0; + prom_findcons(&kbd, &crt, &screen); + + if (screen > 0) { +#if NRASTERCONSOLE > 0 && NPM > 0 + if (pm_cnattach() > 0) { + dckbd_cnattach(KN01_SYS_DZ); + return; + } +#else + printf("No framebuffer device configured: "); + printf("using serial console\n"); +#endif + } + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + dc_cnattach(KN01_SYS_DZ, kbd); } diff --git a/sys/arch/pmax/pmax/dec_3max.c b/sys/arch/pmax/pmax/dec_3max.c index 79a8a9ead62b..0fe4187af7c6 100644 --- a/sys/arch/pmax/pmax/dec_3max.c +++ b/sys/arch/pmax/pmax/dec_3max.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_3max.c,v 1.23 2000/01/14 13:45:24 simonb Exp $ */ +/* $NetBSD: dec_3max.c,v 1.24 2000/02/03 04:09:01 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -73,10 +73,11 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_3max.c,v 1.23 2000/01/14 13:45:24 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_3max.c,v 1.24 2000/02/03 04:09:01 nisimura Exp $"); -#include +#include #include +#include #include #include @@ -88,6 +89,9 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3max.c,v 1.23 2000/01/14 13:45:24 simonb Exp $") #include #include #include +#include + +#include "rasterconsole.h" /* * forward declarations @@ -169,7 +173,31 @@ dec_3max_bus_reset() static void dec_3max_cons_init() { - /* notyet */ + int kbd, crt, screen; + extern int tcfb_cnattach __P((int)); /* XXX */ + + kbd = crt = screen = 0; + prom_findcons(&kbd, &crt, &screen); + + if (screen > 0) { +#if NRASTERCONSOLE > 0 + if (kbd == 7 && tcfb_cnattach(crt) > 0) { + dckbd_cnattach(KN02_SYS_DZ); + return; + } +#else + printf("No framebuffer device configured for slot %d: ", crt); + printf("using serial console\n"); +#endif + } + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + dc_cnattach(KN02_SYS_DZ, kbd); } static void diff --git a/sys/arch/pmax/pmax/dec_3maxplus.c b/sys/arch/pmax/pmax/dec_3maxplus.c index ee9131adae2b..073143e495ec 100644 --- a/sys/arch/pmax/pmax/dec_3maxplus.c +++ b/sys/arch/pmax/pmax/dec_3maxplus.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_3maxplus.c,v 1.34 2000/01/14 13:45:24 simonb Exp $ */ +/* $NetBSD: dec_3maxplus.c,v 1.35 2000/02/03 04:09:02 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -73,10 +73,11 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.34 2000/01/14 13:45:24 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.35 2000/02/03 04:09:02 nisimura Exp $"); -#include +#include #include +#include #include #include @@ -84,7 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.34 2000/01/14 13:45:24 simonb Exp #include /* mclock CPUspeed estimation */ /* all these to get ioasic_base */ -#include /* struct cfdata for.. */ #include /* tc type definitions for.. */ #include /* ioasic interrrupt masks */ #include /* ioasic_base */ @@ -92,6 +92,9 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.34 2000/01/14 13:45:24 simonb Exp #include #include #include +#include + +#include "rasterconsole.h" /* * Forward declarations @@ -203,7 +206,30 @@ dec_3maxplus_bus_reset() static void dec_3maxplus_cons_init() { - /* notyet */ + int kbd, crt, screen; + extern int tcfb_cnattach __P((int)); /* XXX */ + + kbd = crt = screen = 0; + prom_findcons(&kbd, &crt, &screen); + + if (screen > 0) { +#if NRASTERCONSOLE > 0 + if (tcfb_cnattach(crt) > 0) { + scc_lk201_cnattach(ioasic_base, 0x180000); + return; + } +#endif + printf("No framebuffer device configured for slot %d: ", crt); + printf("using serial console\n"); + } + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + scc_cnattach(ioasic_base, 0x180000); } diff --git a/sys/arch/pmax/pmax/dec_3min.c b/sys/arch/pmax/pmax/dec_3min.c index 277c08d4fcc4..f2b034a4466a 100644 --- a/sys/arch/pmax/pmax/dec_3min.c +++ b/sys/arch/pmax/pmax/dec_3min.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_3min.c,v 1.33 2000/01/14 13:45:25 simonb Exp $ */ +/* $NetBSD: dec_3min.c,v 1.34 2000/02/03 04:09:02 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -73,11 +73,12 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.33 2000/01/14 13:45:25 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.34 2000/02/03 04:09:02 nisimura Exp $"); -#include +#include #include +#include #include #include @@ -86,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.33 2000/01/14 13:45:25 simonb Exp $") #include /* mcclock CPUspeed estimation */ /* all these to get ioasic_base */ -#include /* struct cfdata for.. */ #include /* tc type definitions for.. */ #include /* ioasic interrrupt masks */ #include /* ioasic_base */ @@ -94,6 +94,9 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.33 2000/01/14 13:45:25 simonb Exp $") #include #include /* 3min baseboard addresses */ #include /* 3min/maxine memory errors */ +#include + +#include "rasterconsole.h" /* @@ -212,7 +215,30 @@ dec_3min_bus_reset() static void dec_3min_cons_init() { - /* notyet */ + int kbd, crt, screen; + extern int tcfb_cnattach __P((int)); /* XXX */ + + kbd = crt = screen = 0; + prom_findcons(&kbd, &crt, &screen); + + if (screen > 0) { +#if NRASTERCONSOLE > 0 + if (tcfb_cnattach(crt) > 0) { + scc_lk201_cnattach(ioasic_base, 0x180000); + return; + } +#endif + printf("No framebuffer device configured for slot %d: ", crt); + printf("using serial console\n"); + } + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + scc_cnattach(ioasic_base, 0x180000); } diff --git a/sys/arch/pmax/pmax/dec_5100.c b/sys/arch/pmax/pmax/dec_5100.c index c8424b94b225..2e8bf639867e 100644 --- a/sys/arch/pmax/pmax/dec_5100.c +++ b/sys/arch/pmax/pmax/dec_5100.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_5100.c,v 1.18 2000/01/14 13:45:25 simonb Exp $ */ +/* $NetBSD: dec_5100.c,v 1.19 2000/02/03 04:09:04 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -45,9 +45,12 @@ #include #include /* common definitions */ #include +#include #include +#include "rasterconsole.h" + /* * Forward declarations @@ -112,7 +115,14 @@ dec_5100_bus_reset() static void dec_5100_cons_init() { - /* notyet */ + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + dc_cnattach(KN230_SYS_DZ0, 0); } diff --git a/sys/arch/pmax/pmax/dec_maxine.c b/sys/arch/pmax/pmax/dec_maxine.c index eb7d3178b607..1853eb371579 100644 --- a/sys/arch/pmax/pmax/dec_maxine.c +++ b/sys/arch/pmax/pmax/dec_maxine.c @@ -1,4 +1,4 @@ -/* $NetBSD: dec_maxine.c,v 1.25 2000/01/14 13:45:26 simonb Exp $ */ +/* $NetBSD: dec_maxine.c,v 1.26 2000/02/03 04:09:03 nisimura Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -73,26 +73,30 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_maxine.c,v 1.25 2000/01/14 13:45:26 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_maxine.c,v 1.26 2000/02/03 04:09:03 nisimura Exp $"); -#include +#include #include +#include #include -#include #include +#include -#include /* mcclock CPUspeed estimation */ - -/* all these to get ioasic_base */ -#include /* struct cfdata for.. */ -#include /* tc type definitions for.. */ -#include /* ioasic interrrupt masks */ -#include /* ioasic_base */ +#include +#include +#include +#include #include -#include /* baseboard addresses (constants) */ -#include /* 3min/maxine memory errors */ +#include + +#include +#include +#include + +#include "rasterconsole.h" +#include "xcfb.h" /* * Forward declarations @@ -191,7 +195,37 @@ dec_maxine_bus_reset() static void dec_maxine_cons_init() { - /* notyet */ + int kbd, crt, screen; + extern int tcfb_cnattach __P((int)); /* XXX */ + + kbd = crt = screen = 0; + prom_findcons(&kbd, &crt, &screen); + + if (screen > 0) { +#if NRASTERCONSOLE > 0 + if (crt == 3) { +#if NXCFB > 0 + xcfb_cnattach(); + dtikbd_cnattach(); + return; +#endif + } + else if (tcfb_cnattach(crt) > 0) { + dtikbd_cnattach(); + return; + } +#endif + printf("No framebuffer device configured for slot %d: ", crt); + printf("using serial console\n"); + } + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / 9600); /* XXX */ + + scc_cnattach(ioasic_base, 0x100000); } static void diff --git a/sys/arch/pmax/pmax/machdep.c b/sys/arch/pmax/pmax/machdep.c index e7fe07a00cc0..92f26bfe8866 100644 --- a/sys/arch/pmax/pmax/machdep.c +++ b/sys/arch/pmax/pmax/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.162 2000/01/19 20:05:47 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.163 2000/02/03 04:09:05 nisimura Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -43,7 +43,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.162 2000/01/19 20:05:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.163 2000/02/03 04:09:05 nisimura Exp $"); #include "fs_mfs.h" #include "opt_ddb.h" @@ -392,6 +392,13 @@ mach_init(argc, argv, code, cv, bim, bip) pmap_bootstrap(); } +void +consinit() +{ + + (*platform.cons_init)(); +} + /* * Machine-dependent startup code: allocate memory for variable-sized tables, * initialize cpu. diff --git a/sys/arch/pmax/tc/scc.c b/sys/arch/pmax/tc/scc.c index 2f0c8dbea373..4cb2ea82459e 100644 --- a/sys/arch/pmax/tc/scc.c +++ b/sys/arch/pmax/tc/scc.c @@ -1,4 +1,4 @@ -/* $NetBSD: scc.c,v 1.62 2000/01/18 12:19:49 simonb Exp $ */ +/* $NetBSD: scc.c,v 1.63 2000/02/03 04:09:07 nisimura Exp $ */ /* * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University @@ -66,7 +66,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.62 2000/01/18 12:19:49 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.63 2000/02/03 04:09:07 nisimura Exp $"); #include "opt_ddb.h" @@ -252,24 +252,24 @@ static struct consdev scccons = { NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0 }; - -/* - * Set up a given unit as a serial console device. - * We need console output when cold, and before any device is configured. - * Should be callable when cold, to reset the chip and set parameters - * for a remote (serial) console or kgdb line. - * XXX - * As most DECstations only bring out one rs-232 lead from an SCC - * to the bulkhead, and use the other for mouse and keyboard, we - * only allow one unit per SCC to be console. - */ void -scc_consinit(dev, sccaddr) - dev_t dev; - scc_regmap_t *sccaddr; +scc_cnattach(base, offset) + u_int32_t base; + u_int32_t offset; { + scc_regmap_t *sccaddr; struct scc_softc *sc; + int dev; + /* XXX XXX XXX */ + dev = 0; + if (systype == DS_3MIN || systype == DS_3MAXPLUS) + dev = SCCCOMM3_PORT; + else if (systype == DS_MAXINE) + dev = SCCCOMM2_PORT; + /* XXX XXX XXX */ + + sccaddr = (void *)(base + offset); /* Save address in case we're cold. */ if (cold && scc_cons_addr == 0) { scc_cons_addr = sccaddr; @@ -285,12 +285,28 @@ scc_consinit(dev, sccaddr) /* XXX make sure sccreset() called only once for this chip? */ sccreset(sc); - scccons.cn_dev = dev; - *cn_tab = scccons; + cn_tab = &scccons; + cn_tab->cn_dev = makedev(SCCDEV, dev); + cn_tab->cn_pri = CN_NORMAL; sc->scc_softCAR |= 1 << SCCLINE(cn_tab->cn_dev); scc_tty_init(sc, cn_tab->cn_dev); } +void +scc_lk201_cnattach(base, offset) + u_int32_t base; + u_int32_t offset; +{ + dev_t dev; + + dev = makedev(SCCDEV, SCCKBD_PORT); + lk_divert(sccGetc, dev); + + cn_tab = &scccons; + cn_tab->cn_pri = CN_NORMAL; + cn_tab->cn_getc = lk_getc; + rcons_indev(cn_tab); /* cn_dev & cn_putc */ +} /* * Test to see if device is present. diff --git a/sys/arch/pmax/tc/sccvar.h b/sys/arch/pmax/tc/sccvar.h index ff4741c749d4..1ce5f7dca274 100644 --- a/sys/arch/pmax/tc/sccvar.h +++ b/sys/arch/pmax/tc/sccvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sccvar.h,v 1.6 2000/01/09 23:10:45 ad Exp $ */ +/* $NetBSD: sccvar.h,v 1.7 2000/02/03 04:09:11 nisimura Exp $ */ #ifndef _PMAX_TC_SCCVAR_H_ #define _PMAX_TC_SCCVAR_H_ @@ -20,15 +20,15 @@ #define SCCCOMM3_PORT 0x2 #define SCCKBD_PORT 0x3 -struct scc_regmap; - int sccGetc __P((dev_t)); void sccPutc __P((dev_t, int)); -void scc_consinit __P((dev_t dev, struct scc_regmap *sccaddr)); /* QVSS-compatible in-kernel X input event parser, pointer tracker */ extern void (*sccDivertXInput) __P((int)); extern void (*sccMouseEvent) __P((void *)); extern void (*sccMouseButtons) __P((void *)); +void scc_cnattach __P((u_int32_t, u_int32_t)); +void scc_lk201_cnattach __P((u_int32_t, u_int32_t)); + #endif /* !_PMAX_TC_SCCVAR_H_ */ diff --git a/sys/arch/pmax/tc/tcbus.c b/sys/arch/pmax/tc/tcbus.c index 27bb20010dcd..d8a78a9b147f 100644 --- a/sys/arch/pmax/tc/tcbus.c +++ b/sys/arch/pmax/tc/tcbus.c @@ -1,7 +1,7 @@ -/* $NetBSD: tcbus.c,v 1.7 2000/01/14 13:45:28 simonb Exp $ */ +/* $NetBSD: tcbus.c,v 1.8 2000/02/03 04:09:07 nisimura Exp $ */ /* - * Copyright (c) 1999 Tohru Nishimura. All rights reserved. + * Copyright (c) 1999, 2000 Tohru Nishimura. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,7 +31,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.7 2000/01/14 13:45:28 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.8 2000/02/03 04:09:07 nisimura Exp $"); #include #include @@ -195,15 +195,15 @@ tc_ds_intr_disestablish(dev, arg) #include "sfb.h" #include "px.h" -#include -#include +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ #include #include -#include /* XXX shouldn't need this here for pxvar.h */ -#include /* XXX shouldn't need this here for pxvar.h */ -#include /* XXX shouldn't need this here for pxvar.h */ -#include #include +#include +#include #include @@ -211,9 +211,8 @@ int tcfb_cnattach(slotno) int slotno; { - tc_addr_t tcaddr; + paddr_t tcaddr; char tcname[TC_ROM_LLEN]; - struct fbinfo *fi; tcaddr = (*callv->_slot_address)(slotno); if (tc_badaddr(tcaddr) || tc_checkslot(tcaddr, tcname) == 0) @@ -221,32 +220,26 @@ tcfb_cnattach(slotno) #if NSFB > 0 if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) { - fballoc((caddr_t)tcaddr, &fi); - sfbinit(fi, (caddr_t)tcaddr, 0, 1); - return 1; + return sfb_cnattach(tcaddr); } #endif #if NCFB > 0 if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) { - fballoc((caddr_t)tcaddr, &fi); - cfbinit(fi, (caddr_t)tcaddr, 0, 1); - return 1; + return cfb_cnattach(tcaddr); } #endif #if NMFB > 0 if (strncmp("PMAG-AA ", tcname, TC_ROM_LLEN) == 0) { - fballoc((caddr_t)tcaddr, &fi); - mfbinit(fi, (caddr_t)tcaddr, 0, 1); - return 1; + return mfb_cnattach(tcaddr); } #endif #if NPX > 0 if (strncmp("PMAG-CA ", tcname, TC_ROM_LLEN) == 0 || strncmp("PMAG-DA ", tcname, TC_ROM_LLEN) == 0 || strncmp("PMAG-FA ", tcname, TC_ROM_LLEN) == 0) { - fballoc((caddr_t)tcaddr, &fi); - px_init(fi, (caddr_t)tcaddr, 0, 1); - return 1; + int px_cnattach __P((paddr_t)); /* XXX much simpler XXX */ + + return px_cnattach(tcaddr); } #endif return 0;