summaryrefslogtreecommitdiff
path: root/sys/arch/pmax/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/pmax/dev')
-rw-r--r--sys/arch/pmax/dev/bt459.c3
-rw-r--r--sys/arch/pmax/dev/bt478.c20
-rw-r--r--sys/arch/pmax/dev/bt478var.h28
-rw-r--r--sys/arch/pmax/dev/cfb.c8
-rw-r--r--sys/arch/pmax/dev/cfbvar.h8
-rw-r--r--sys/arch/pmax/dev/dc.c756
-rw-r--r--sys/arch/pmax/dev/dc_cons.h17
-rw-r--r--sys/arch/pmax/dev/dc_ds.c106
-rw-r--r--sys/arch/pmax/dev/dc_ds_cons.h14
-rw-r--r--sys/arch/pmax/dev/dc_ioasic.c109
-rw-r--r--sys/arch/pmax/dev/dc_ioasic_cons.h14
-rw-r--r--sys/arch/pmax/dev/dcvar.h35
-rw-r--r--sys/arch/pmax/dev/device.h6
-rw-r--r--sys/arch/pmax/dev/dtop.c8
-rw-r--r--sys/arch/pmax/dev/fb.c9
-rw-r--r--sys/arch/pmax/dev/fb_usrreq.c29
-rw-r--r--sys/arch/pmax/dev/fbreg.h12
-rw-r--r--sys/arch/pmax/dev/ims332.c3
-rw-r--r--sys/arch/pmax/dev/mfb.c10
-rw-r--r--sys/arch/pmax/dev/mfbreg.h2
-rw-r--r--sys/arch/pmax/dev/mfbvar.h8
-rw-r--r--sys/arch/pmax/dev/pm.c203
-rw-r--r--sys/arch/pmax/dev/pm_ds.c198
-rw-r--r--sys/arch/pmax/dev/pmvar.h1
-rw-r--r--sys/arch/pmax/dev/qvss_compat.c2
-rw-r--r--sys/arch/pmax/dev/rcons.c21
-rw-r--r--sys/arch/pmax/dev/rz.c30
-rw-r--r--sys/arch/pmax/dev/scsi.c4
-rw-r--r--sys/arch/pmax/dev/sfb.c8
-rw-r--r--sys/arch/pmax/dev/sfbreg.h2
-rw-r--r--sys/arch/pmax/dev/sfbvar.h8
-rw-r--r--sys/arch/pmax/dev/sii.c157
-rw-r--r--sys/arch/pmax/dev/sii_ds.c96
-rw-r--r--sys/arch/pmax/dev/siivar.h51
-rw-r--r--sys/arch/pmax/dev/tz.c7
-rw-r--r--sys/arch/pmax/dev/xcfb.c18
-rw-r--r--sys/arch/pmax/dev/xcfbvar.h2
37 files changed, 1384 insertions, 629 deletions
diff --git a/sys/arch/pmax/dev/bt459.c b/sys/arch/pmax/dev/bt459.c
index 45667ff2c1c..430a7135d24 100644
--- a/sys/arch/pmax/dev/bt459.c
+++ b/sys/arch/pmax/dev/bt459.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bt459.c,v 1.4 1996/04/08 00:57:41 jonathan Exp $ */
+/* $NetBSD: bt459.c,v 1.5 1996/10/13 13:13:50 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -86,7 +86,6 @@
#include <sys/device.h>
#include <sys/select.h>
-#include <machine/machConst.h>
#include <machine/pmioctl.h>
#include <machine/fbio.h>
diff --git a/sys/arch/pmax/dev/bt478.c b/sys/arch/pmax/dev/bt478.c
index aa8a8485a3b..8133423eea3 100644
--- a/sys/arch/pmax/dev/bt478.c
+++ b/sys/arch/pmax/dev/bt478.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bt478.c,v 1.4 1996/04/08 00:57:43 jonathan Exp $ */
+/* $NetBSD: bt478.c,v 1.6 1996/10/13 13:13:51 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -62,13 +62,14 @@
#include <sys/device.h>
#include <sys/select.h>
-#include <machine/machConst.h>
+#include <pmax/cpuregs.h>
#include <machine/pmioctl.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
#include <pmax/dev/bt478.h>
+#include <pmax/dev/bt478var.h>
#include <pmax/pmax/kn01.h>
/*
@@ -76,23 +77,10 @@
*/
-int bt478init __P((struct fbinfo *fi));
-void bt478RestoreCursorColor __P((struct fbinfo *fi));
-/* qvss ioctl interface uses this */
+/* XXX qvss ioctl interface uses this */
void bt478CursorColor __P((struct fbinfo *fi, unsigned int color[]));
-void bt478BlankCursor __P((struct fbinfo *fi));
-/*static*/ void bt478InitColorMap __P((struct fbinfo *fi));
-int bt478GetColorMap __P((struct fbinfo *fi, caddr_t bits,
- int index, int count));
-int bt478LoadColorMap __P((struct fbinfo *fi, caddr_t bits,
- int index, int count));
-
-
-
-extern int pmax_boardtype;
-extern u_short defCursor[32];
static u_char bg_RGB[3]; /* background color for the cursor */
static u_char fg_RGB[3]; /* foreground color for the cursor */
diff --git a/sys/arch/pmax/dev/bt478var.h b/sys/arch/pmax/dev/bt478var.h
new file mode 100644
index 00000000000..77288e4aff3
--- /dev/null
+++ b/sys/arch/pmax/dev/bt478var.h
@@ -0,0 +1,28 @@
+/* $NetBSD: bt478var.h,v 1.2 1996/09/21 03:22:24 jonathan Exp $ */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/*
+ * External declarations exported from the bt478 low-level
+ * chipset driver.
+ */
+
+int bt478init __P((struct fbinfo *fi));
+void bt478BlankCursor __P((struct fbinfo *fi));
+void bt478RestoreCursorColor __P((struct fbinfo *fi));
+void bt478InitColorMap __P((struct fbinfo *fi));
+int bt478LoadColorMap __P ((struct fbinfo *fi, caddr_t bits,
+ int index, int count));
+int bt478GetColorMap __P ((struct fbinfo *fi, caddr_t bits,
+ int index, int count));
diff --git a/sys/arch/pmax/dev/cfb.c b/sys/arch/pmax/dev/cfb.c
index 3fb3b7db294..d27602a3aa9 100644
--- a/sys/arch/pmax/dev/cfb.c
+++ b/sys/arch/pmax/dev/cfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cfb.c,v 1.18.4.2 1996/09/09 20:45:26 thorpej Exp $ */
+/* $NetBSD: cfb.c,v 1.24 1996/10/13 13:13:52 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -93,10 +93,11 @@
#include <sys/device.h>
#include <dev/tc/tcvar.h>
-#include <machine/machConst.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
#include <machine/pmioctl.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
+#include <pmax/dev/cfbvar.h> /* XXX dev/tc ? */
#include <pmax/pmax/pmaxtype.h>
@@ -105,6 +106,7 @@
#include <machine/autoconf.h>
+
#define PMAX /* enable /dev/pm compatibility */
/*
@@ -142,8 +144,6 @@ struct fbdriver cfb_driver = {
int cfbinit __P((struct fbinfo *fi, caddr_t cfbaddr, int unit, int silent));
extern void fbScreenInit __P((struct fbinfo *fi));
-void genConfigMouse(), genDeconfigMouse();
-void genKbdEvent(), genMouseEvent(), genMouseButtons();
extern int pmax_boardtype;
diff --git a/sys/arch/pmax/dev/cfbvar.h b/sys/arch/pmax/dev/cfbvar.h
new file mode 100644
index 00000000000..1f245ed1daf
--- /dev/null
+++ b/sys/arch/pmax/dev/cfbvar.h
@@ -0,0 +1,8 @@
+/* $NetBSD: cfbvar.h,v 1.1 1996/09/21 03:06:37 jonathan Exp $ */
+
+/*
+ * Initialize a Turbochannel CFB dumb 2-d framebuffer,
+ * so it can be used as a bitmapped glass-tty console device.
+ */
+extern int
+cfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent));
diff --git a/sys/arch/pmax/dev/dc.c b/sys/arch/pmax/dev/dc.c
index 0a180c1cd49..8b5712d7372 100644
--- a/sys/arch/pmax/dev/dc.c
+++ b/sys/arch/pmax/dev/dc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dc.c,v 1.16.4.5 1996/06/16 17:15:51 mhitch Exp $ */
+/* $NetBSD: dc.c,v 1.30 1996/10/16 02:10:33 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)dc.c 8.2 (Berkeley) 11/30/93
+ * @(#)dc.c 8.5 (Berkeley) 6/2/95
*/
/*
@@ -56,11 +56,10 @@
* v 1.4 89/08/29 11:55:30 nelson Exp SPRITE (DECWRL)";
*/
-#include "dc.h"
-#if NDC > 0
/*
* DC7085 (DZ-11 look alike) Driver
*/
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
@@ -77,7 +76,6 @@
#include <machine/conf.h>
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/machConst.h>
#include <dev/tc/tcvar.h>
#include <dev/tc/ioasicvar.h>
@@ -87,21 +85,25 @@
#include <pmax/pmax/pmaxtype.h>
#include <pmax/pmax/cons.h>
-#include <pmax/dev/pdma.h>
#include <pmax/dev/lk201.h>
+/*
+ * XXX in dcvar.h or not?
+ * #include <pmax/dev/pdma.h>
+ */
#include "dcvar.h"
+
#include "tc.h"
#include <pmax/dev/lk201var.h> /* XXX KbdReset band friends */
-extern int pmax_boardtype;
+#include <pmax/dev/dcvar.h>
+#include <pmax/dev/dc_cons.h>
+
extern struct cfdriver mainbus_cd;
-struct dc_softc {
- struct device sc_dv;
- struct pdma dc_pdma[4];
-};
+#define DCUNIT(dev) (minor(dev) >> 2)
+#define DCLINE(dev) (minor(dev) & 3)
/*
* Autoconfiguration data for config.
@@ -109,47 +111,49 @@ struct dc_softc {
* Use the statically-allocated softc until old autoconfig code and
* config.old are completely gone.
*/
-int dcmatch __P((struct device * parent, void *cfdata, void *aux));
-void dcattach __P((struct device *parent, struct device *self, void *aux));
+int old_dcmatch __P((struct device * parent, void *cfdata, void *aux));
+void old_dcattach __P((struct device *parent, struct device *self, void *aux));
-int dc_doprobe __P((void *addr, int unit, int flags, int pri));
-int dcintr __P((void * xxxunit));
extern struct cfdriver dc_cd;
-
-struct cfattach dc_ca = {
- sizeof(struct dc_softc), dcmatch, dcattach
-};
-
struct cfdriver dc_cd = {
NULL, "dc", DV_TTY
};
-#define NDCLINE (NDC*4)
+/*
+ * Forward declarations
+ */
+struct tty *dctty __P((dev_t dev));
void dcstart __P((struct tty *));
+void dcrint __P((struct dc_softc *sc));
void dcxint __P((struct tty *));
-void dcPutc __P((dev_t, int));
+int dcmctl __P((dev_t dev, int bits, int how));
void dcscan __P((void *));
+int dcparam __P((struct tty *tp, struct termios *t));
+static int cold_dcparam __P((struct tty *tp, struct termios *t,
+ dcregs *dcaddr, int allow_19200));
+
extern void ttrstrt __P((void *));
-int dcGetc __P((dev_t));
-int dcparam __P((struct tty *, struct termios *));
-
-struct tty *dc_tty[NDCLINE];
-int dc_cnt = NDCLINE;
-void (*dcDivertXInput)(); /* X windows keyboard input routine */
-void (*dcMouseEvent)(); /* X windows mouse motion event routine */
-void (*dcMouseButtons)(); /* X windows mouse buttons event routine */
+
+void dc_reset __P ((dcregs *dcaddr));
+
+/* console I/O */
+int dcGetc __P((dev_t));
+void dcPutc __P((dev_t, int));
+void dcPollc __P((dev_t, int));
+void dc_consinit __P((dev_t dev, dcregs *dcaddr));
+
+
+/* QVSS-compatible in-kernel X input event parser, pointer tracker */
+void (*dcDivertXInput) __P((int cc)); /* X windows keyboard input routine */
+void (*dcMouseEvent) __P((int)); /* X windows mouse motion event routine */
+void (*dcMouseButtons) __P((int)); /* X windows mouse buttons event routine */
#ifdef DEBUG
int debugChar;
#endif
-/*
- * Software copy of brk register since it isn't readable
- */
-int dc_brk[NDC];
-char dcsoftCAR[NDC]; /* mask of dc's with carrier on (DSR) */
/*
* The DC7085 doesn't interrupt on carrier transitions, so
@@ -160,7 +164,6 @@ int dc_timer; /* true if timer started */
/*
* Pdma structures for fast output code
*/
-struct pdma dcpdma[NDCLINE];
struct speedtab dcspeedtab[] = {
{ 0, 0, },
@@ -177,6 +180,9 @@ struct speedtab dcspeedtab[] = {
{ 4800, LPR_B4800 },
{ 9600, LPR_B9600 },
{ 19200,LPR_B19200 },
+#ifdef notyet
+ { 19200,LPR_B38400 }, /* Overloaded with 19200, per chip. */
+#endif
{ -1, -1 }
};
@@ -189,96 +195,10 @@ struct speedtab dcspeedtab[] = {
#endif
/*
- * Forward declarations
+ * Console line variables, for use when cold
*/
-struct tty *dctty __P((dev_t dev));
-void dcrint __P((int));
-int dcmctl __P((dev_t dev, int bits, int how));
-
-
-
-/*
- * Match driver based on name
- */
-int
-dcmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct confargs *ca = aux;
-#if NTC>0
- struct ioasicdev_attach_args *d = aux;
-#endif
-
- static int nunits = 0;
-
-#if NTC > 0
- if (parent->dv_cfdata->cf_driver == &ioasic_cd) {
- if (strcmp(d->iada_modname, "dc") != 0 &&
- strcmp(d->iada_modname, "dc7085") != 0)
- return (0);
- }
- else
-#endif /* NTC */
-
- if (parent->dv_cfdata->cf_driver == &mainbus_cd) {
- if (strcmp(ca->ca_name, "dc") != 0 &&
- strcmp(ca->ca_name, "mdc") != 0 &&
- strcmp(ca->ca_name, "dc7085") != 0)
- return (0);
- }
- else
- return (0);
-
- /*
- * Use statically-allocated softc and attach code until
- * old config is completely gone. Don't over-run softc.
- */
- if (nunits > NDC) {
- printf("dc: too many units for old config\n");
- return (0);
- }
- nunits++;
- return (1);
-}
-
-void
-dcattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- register struct confargs *ca = aux;
-#if NTC > 0
- struct ioasicdev_attach_args *d = aux;
-#endif /* NTC */
- caddr_t dcaddr;
-
-
-#if NTC > 0
- if (parent->dv_cfdata->cf_driver == &ioasic_cd) {
- dcaddr = (caddr_t)d->iada_addr;
- (void) dc_doprobe((void*)MACH_PHYS_TO_UNCACHED(dcaddr),
- self->dv_unit, self->dv_cfdata->cf_flags,
- (int)d->iada_cookie);
- /* tie pseudo-slot to device */
- ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_TTY,
- dcintr, self);
- }
- else
-#endif /* NTC */
- if (parent->dv_cfdata->cf_driver == &mainbus_cd) {
- dcaddr = (caddr_t)ca->ca_addr;
- (void) dc_doprobe((void*)MACH_PHYS_TO_UNCACHED(dcaddr),
- self->dv_unit, self->dv_cfdata->cf_flags,
- ca->ca_slot);
-
- /* tie pseudo-slot to device */
- BUS_INTR_ESTABLISH(ca, dcintr, self);
- }
- printf("\n");
-}
+extern int cold;
+dcregs *dc_cons_addr = 0;
/*
* Is there a framebuffer console device using this serial driver?
@@ -295,66 +215,113 @@ raster_console()
}
+/* XXX move back into dc_consinit when debugged */
+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;
+ register dcregs *dcaddr;
+{
+ struct termios cterm;
+ struct tty ctty;
+
+ /* save address in case we're cold */
+ if (cold && dc_cons_addr == 0)
+ dc_cons_addr = dcaddr;
+
+ /* reset chip */
+ dc_reset(dcaddr);
+
+ dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
+ LPR_B9600 | DCLINE(dev);
+ wbflush();
+ DELAY(10);
+
+ bzero(&cterm, sizeof(cterm));
+ bzero(&ctty, sizeof(ctty));
+ ctty.t_dev = dev;
+ dccons.cn_dev = dev;
+ cterm.c_cflag |= CLOCAL;
+ cterm.c_cflag = CS8;
+ cterm.c_ospeed = 9600;
+ *cn_tab = dccons;
+ cold_dcparam(&ctty, &cterm, dcaddr, 0); /* XXX untested */
+}
+
+
/*
- * DC7085 (dz-11) probe routine from old-style config.
- * This is only here out of intertia.
+ * Attach DC7085 (dz-11) device.
*/
int
-dc_doprobe(addr, unit, flags, priority)
+dcattach(sc, addr, dtr_mask, rtscts_mask, speed,
+ console_line)
+ register struct dc_softc *sc;
void *addr;
- int unit, flags, priority;
+ int dtr_mask, rtscts_mask, speed, console_line;
{
register dcregs *dcaddr;
register struct pdma *pdp;
register struct tty *tp;
- register int cntr;
+ register int line;
int s;
-
- if (unit >= NDC)
- return (0);
- if (badaddr(addr, 2))
- return (0);
+
+ dcaddr = (dcregs *)addr;
/*
* For a remote console, wait a while for previous output to
* complete.
+ * XXX both cn_dev == 0 and cn_pri == CN_DEAD are bug workarounds.
+ * The interface between ttys and cpu_cons.c should be reworked.
*/
- if (major(cn_tab->cn_dev) == DCDEV && unit == 0 &&
- cn_tab->cn_pri == CN_REMOTE)
+ if (sc->sc_dv.dv_unit == 0 && /* XXX why only unit 0? */
+ (major(cn_tab->cn_dev) == DCDEV || major(cn_tab->cn_dev) == 0) &&
+ (cn_tab->cn_pri == CN_REMOTE || (cn_tab->cn_pri == CN_DEAD))) {
DELAY(10000);
-
- /* reset chip */
- dcaddr = (dcregs *)addr;
- dcaddr->dc_csr = CSR_CLR;
- wbflush();
- while (dcaddr->dc_csr & CSR_CLR)
- ;
- dcaddr->dc_csr = CSR_MSE | CSR_TIE | CSR_RIE;
+ }
+ /* reset chip and enable interrupts */
+ dc_reset(dcaddr);
+ dcaddr->dc_csr |= (CSR_MSE | CSR_TIE | CSR_RIE);
/* init pseudo DMA structures */
- pdp = &dcpdma[unit * 4];
- for (cntr = 0; cntr < 4; cntr++) {
+ pdp = &sc->dc_pdma[0];
+ for (line = 0; line < 4; line++) {
pdp->p_addr = (void *)dcaddr;
- tp = dc_tty[unit * 4 + cntr] = ttymalloc();
- if (cntr != DCKBD_PORT && cntr != DCMOUSE_PORT)
+ tp = sc->dc_tty[line] = ttymalloc();
+ if (line != DCKBD_PORT && line != DCMOUSE_PORT)
tty_attach(tp);
+ tp->t_dev = makedev(DCDEV, 4 * sc->sc_dv.dv_unit + line);
pdp->p_arg = (int) tp;
pdp->p_fcn = dcxint;
pdp++;
}
- dcsoftCAR[unit] = flags | 0xB;
+ sc->dcsoftCAR = sc->sc_dv.dv_cfdata->cf_flags | 0xB;
if (dc_timer == 0) {
dc_timer = 1;
timeout(dcscan, (void *)0, hz);
}
+ sc->dc_19200 = speed;
+ sc->dc_modem = dtr_mask;
+ sc->dc_rtscts = rtscts_mask;
+
+
/*
* Special handling for consoles.
*/
- if (unit == 0) {
- if (cn_tab->cn_pri == CN_INTERNAL ||
- cn_tab->cn_pri == CN_NORMAL) {
+ if (sc->sc_dv.dv_unit == 0) {
+ if (raster_console()) {
s = spltty();
dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
LPR_B4800 | DCKBD_PORT;
@@ -366,20 +333,42 @@ dc_doprobe(addr, unit, flags, priority)
KBDReset(makedev(DCDEV, DCKBD_PORT), dcPutc);
MouseInit(makedev(DCDEV, DCMOUSE_PORT), dcPutc, dcGetc);
splx(s);
- } else if (major(cn_tab->cn_dev) == DCDEV) {
+ }
+ else if (major(cn_tab->cn_dev) == DCDEV) {
s = spltty();
- dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
- LPR_B9600 | minor(cn_tab->cn_dev);
- wbflush();
- DELAY(1000);
- /*cn_tab.cn_disabled = 0;*/ /* FIXME */
+ dc_consinit(cn_tab->cn_dev, dcaddr);
+ dcaddr->dc_csr |= (CSR_MSE | CSR_TIE | CSR_RIE);
splx(s);
}
}
-
return (1);
}
+
+/*
+ * Reset chip. Does not change modem control output bits
+ * or modem state register.
+ * Does not enable interrupts; caller must explicitly or
+ * TIE and RIE on if desired (XXX not true yet)
+ */
+void
+dc_reset(dcaddr)
+ register dcregs *dcaddr;
+{
+ /* Reset CSR and wait until cleared. */
+ dcaddr->dc_csr = CSR_CLR;
+ wbflush();
+ DELAY(10);
+ while (dcaddr->dc_csr & CSR_CLR)
+ ;
+
+ /* Enable scanner. */
+ dcaddr->dc_csr = CSR_MSE;
+ wbflush();
+ DELAY(10);
+}
+
+
int
dcopen(dev, flag, mode, p)
dev_t dev;
@@ -387,15 +376,22 @@ dcopen(dev, flag, mode, p)
struct proc *p;
{
register struct tty *tp;
- register int unit;
+ register struct dc_softc *sc;
+ register int unit, line;
int s, error = 0;
- unit = minor(dev);
- if (unit >= dc_cnt || dcpdma[unit].p_addr == (void *)0)
+ unit = DCUNIT(dev);
+ line = DCLINE(dev);
+ if (unit >= dc_cd.cd_ndevs || line > 4)
return (ENXIO);
- tp = dc_tty[unit];
+
+ sc = dc_cd.cd_devs[unit];
+ if (sc->dc_pdma[line].p_addr == (void *)0)
+ return (ENXIO);
+
+ tp = sc->dc_tty[line];
if (tp == NULL) {
- tp = dc_tty[unit] = ttymalloc();
+ tp = sc->dc_tty[line] = ttymalloc();
tty_attach(tp);
}
tp->t_oproc = dcstart;
@@ -421,7 +417,14 @@ dcopen(dev, flag, mode, p)
ttsetwater(tp);
} else if ((tp->t_state & TS_XCLUDE) && curproc->p_ucred->cr_uid != 0)
return (EBUSY);
+#ifdef HW_FLOW_CONTROL
+ (void) dcmctl(dev, DML_DTR | DML_RTS, DMSET);
+#else
(void) dcmctl(dev, DML_DTR, DMSET);
+#endif
+ if ((sc->dcsoftCAR & (1 << line)) ||
+ (dcmctl(dev, 0, DMGET) & DML_CAR))
+ tp->t_state |= TS_CARR_ON;
s = spltty();
while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
!(tp->t_state & TS_CARR_ON)) {
@@ -443,16 +446,22 @@ dcclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
+ register struct dc_softc *sc;
register struct tty *tp;
- register int unit, bit;
+ register int line, bit;
+ int s;
- unit = minor(dev);
- tp = dc_tty[unit];
- bit = 1 << ((unit & 03) + 8);
- if (dc_brk[unit >> 2] & bit) {
- dc_brk[unit >> 2] &= ~bit;
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ line = DCLINE(dev);
+ tp = sc->dc_tty[line];
+ bit = 1 << (line + 8);
+ s = spltty();
+ /* turn off the break bit if it is set */
+ if (sc->dc_brk & bit) {
+ sc->dc_brk &= ~bit;
ttyoutput(0, tp);
}
+ splx(s);
(*linesw[tp->t_line].l_close)(tp, flag);
if ((tp->t_cflag & HUPCL) || (tp->t_state & TS_WOPEN) ||
!(tp->t_state & TS_ISOPEN))
@@ -465,9 +474,20 @@ dcread(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
+ register struct dc_softc *sc;
register struct tty *tp;
- tp = dc_tty[minor(dev)];
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ tp = sc->dc_tty[DCLINE(dev)];
+
+#ifdef HW_FLOW_CONTROL
+ if ((tp->t_cflag & CRTS_IFLOW) && (tp->t_state & TS_TBLOCK) &&
+ tp->t_rawq.c_cc < TTYHOG/5) {
+ tp->t_state &= ~TS_TBLOCK;
+ (void) dcmctl(dev, DML_RTS, DMBIS);
+ }
+#endif /* HW_FLOW_CONTROL */
+
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
@@ -476,9 +496,11 @@ dcwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
{
+ register struct dc_softc *sc;
register struct tty *tp;
- tp = dc_tty[minor(dev)];
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ tp = sc->dc_tty[DCLINE(dev)];
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
@@ -486,7 +508,11 @@ struct tty *
dctty(dev)
dev_t dev;
{
- struct tty *tp = dc_tty [minor (dev)];
+ register struct dc_softc *sc;
+ register struct tty *tp;
+
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ tp = sc->dc_tty[DCLINE(dev)];
return (tp);
}
@@ -499,12 +525,18 @@ dcioctl(dev, cmd, data, flag, p)
int flag;
struct proc *p;
{
+ register struct dc_softc *sc;
register struct tty *tp;
- register int unit = minor(dev);
- register int dc = unit >> 2;
+ register int unit;
+ register int line;
int error;
- tp = dc_tty[unit];
+
+ unit = DCUNIT(dev);
+ line = DCLINE(dev);
+ sc = dc_cd.cd_devs[unit];
+ tp = sc->dc_tty[line];
+
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
@@ -515,12 +547,12 @@ dcioctl(dev, cmd, data, flag, p)
switch (cmd) {
case TIOCSBRK:
- dc_brk[dc] |= 1 << ((unit & 03) + 8);
+ sc->dc_brk |= 1 << (line + 8);
ttyoutput(0, tp);
break;
case TIOCCBRK:
- dc_brk[dc] &= ~(1 << ((unit & 03) + 8));
+ sc->dc_brk &= ~(1 << (line + 8));
ttyoutput(0, tp);
break;
@@ -554,55 +586,77 @@ dcioctl(dev, cmd, data, flag, p)
return (0);
}
+/*
+ * Set line parameters
+ */
+
int
dcparam(tp, t)
register struct tty *tp;
register struct termios *t;
{
+ register struct dc_softc *sc;
+ register dcregs *dcaddr;
+
+
+ /*
+ * Extract softc data, and pass entire request onto
+ * cold_dcparam() for argument checking and execution.
+ */
+ sc = dc_cd.cd_devs[DCUNIT(tp->t_dev)];
+ dcaddr = (dcregs *)sc->dc_pdma[0].p_addr;
+ return (cold_dcparam(tp, t, dcaddr, sc->dc_19200));
+
+}
+
+int
+cold_dcparam(tp, t, dcaddr, allow_19200)
+ register struct tty *tp;
+ register struct termios *t;
register dcregs *dcaddr;
+ int allow_19200;
+{
register int lpr;
register int cflag = t->c_cflag;
int unit = minor(tp->t_dev);
int ospeed = ttspeedtab(t->c_ospeed, dcspeedtab);
+ int s;
+ int line;
+
+ line = DCLINE(tp->t_dev);
/* check requested parameters */
if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed) ||
(cflag & CSIZE) == CS5 || (cflag & CSIZE) == CS6 ||
- (pmax_boardtype == DS_PMAX && t->c_ospeed == 19200))
+ (t->c_ospeed >= 19200 && allow_19200 != 1))
return (EINVAL);
/* and copy to tty */
tp->t_ispeed = t->c_ispeed;
tp->t_ospeed = t->c_ospeed;
tp->t_cflag = cflag;
- dcaddr = (dcregs *)dcpdma[unit].p_addr;
-
/*
* Handle console cases specially.
*/
if (raster_console()) {
if (unit == DCKBD_PORT) {
- dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
+ lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
LPR_B4800 | DCKBD_PORT;
- wbflush();
- return (0);
+ goto out;
} else if (unit == DCMOUSE_PORT) {
- dcaddr->dc_lpr = LPR_RXENAB | LPR_B4800 | LPR_OPAR |
+ lpr = LPR_RXENAB | LPR_B4800 | LPR_OPAR |
LPR_PARENB | LPR_8_BIT_CHAR | DCMOUSE_PORT;
- wbflush();
- return (0);
+ goto out;
}
} else if (tp->t_dev == cn_tab->cn_dev) {
- dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
- LPR_B9600 | unit;
- wbflush();
- return (0);
+ lpr = LPR_RXENAB | LPR_8_BIT_CHAR | LPR_B9600 | line;
+ goto out;
}
if (ospeed == 0) {
(void) dcmctl(unit, 0, DMSET); /* hang up line */
return (0);
}
- lpr = LPR_RXENAB | ospeed | (unit & 03);
+ lpr = LPR_RXENAB | ospeed | line;
if ((cflag & CSIZE) == CS7)
lpr |= LPR_7_BIT_CHAR;
else
@@ -613,12 +667,16 @@ dcparam(tp, t)
lpr |= LPR_OPAR;
if (cflag & CSTOPB)
lpr |= LPR_2_STOP;
+out:
+ s = spltty();
dcaddr->dc_lpr = lpr;
wbflush();
+ splx(s);
DELAY(10);
return (0);
}
+
/*
* Check for interrupts from all devices.
*/
@@ -630,40 +688,42 @@ dcintr(xxxunit)
register dcregs *dcaddr;
register unsigned csr;
- register int unit = sc->sc_dv.dv_unit;
-
- unit <<= 2;
- dcaddr = (dcregs *)dcpdma[unit].p_addr;
+ dcaddr = (dcregs *)sc->dc_pdma[0].p_addr;
while ((csr = dcaddr->dc_csr) & (CSR_RDONE | CSR_TRDY)) {
if (csr & CSR_RDONE)
- dcrint(unit);
+ dcrint(sc);
if (csr & CSR_TRDY)
- dcxint(dc_tty[unit + ((csr >> 8) & 03)]);
+ dcxint(sc->dc_tty[((csr >> 8) & 03)]);
}
/* XXX check for spurious interrupts */
return 0;
}
void
-dcrint(unit)
- register int unit;
+dcrint(sc)
+ register struct dc_softc * sc;
{
register dcregs *dcaddr;
register struct tty *tp;
register int c, cc;
int overrun = 0;
+ register struct tty **dc_tty;
- dcaddr = (dcregs *)dcpdma[unit].p_addr;
+ dc_tty = ((struct dc_softc*)dc_cd.cd_devs[0])->dc_tty; /* XXX */
+
+ dcaddr = (dcregs *)sc->dc_pdma[0].p_addr; /*XXX*/
while ((c = dcaddr->dc_rbuf) < 0) { /* char present */
cc = c & 0xff;
- tp = dc_tty[unit + ((c >> 8) & 03)];
+ tp = sc->dc_tty[((c >> 8) & 03)];
+
if ((c & RBUF_OERR) && overrun == 0) {
- log(LOG_WARNING, "dc%d,%d: silo overflow\n", unit >> 2,
+ log(LOG_WARNING, "%s,%d: silo overflow\n",
+ sc->sc_dv.dv_xname,
(c >> 8) & 03);
overrun = 1;
}
/* the keyboard requires special translation */
- if (tp == dc_tty[DCKBD_PORT] && raster_console()) {
+ if (raster_console() && tp == dc_tty[DCKBD_PORT]) {
#ifdef KADB
if (cc == LK_DO) {
spl0();
@@ -695,6 +755,13 @@ dcrint(unit)
cc |= TTY_FE;
if (c & RBUF_PERR)
cc |= TTY_PE;
+#ifdef HW_FLOW_CONTROL
+ if ((tp->t_cflag & CRTS_IFLOW) && !(tp->t_state & TS_TBLOCK) &&
+ tp->t_rawq.c_cc + tp->t_canq.c_cc >= TTYHOG) {
+ tp->t_state &= ~TS_TBLOCK;
+ (void) dcmctl(tp->t_dev, DML_RTS, DMBIC);
+ }
+#endif /* HWW_FLOW_CONTROL */
(*linesw[tp->t_line].l_rint)(cc, tp);
}
DELAY(10);
@@ -704,14 +771,48 @@ void
dcxint(tp)
register struct tty *tp;
{
+ register struct dc_softc *sc;
register struct pdma *dp;
register dcregs *dcaddr;
- int unit = minor(tp->t_dev);
+ int line, linemask;
- dp = &dcpdma[unit];
+ sc = dc_cd.cd_devs[DCUNIT(tp->t_dev)]; /* XXX */
+
+ line = DCLINE(tp->t_dev);
+ linemask = 1 << line;
+
+ dp = &sc->dc_pdma[line];
if (dp->p_mem < dp->p_end) {
dcaddr = (dcregs *)dp->p_addr;
- dcaddr->dc_tdr = dc_brk[unit >> 2] | *dp->p_mem++;
+
+#ifdef HW_FLOW_CONTROL
+ /* check for hardware flow control of output */
+ if ((tp->t_cflag & CCTS_OFLOW) && (sc->dc_rtscts & linemask)) {
+ switch (line) {
+ case 2:
+ if (dcaddr->dc_msr & MSR_CTS2)
+ break;
+ goto stop;
+
+ case 3:
+ if (dcaddr->dc_msr & MSR_CTS3)
+ break;
+ stop:
+ tp->t_state &= ~TS_BUSY;
+ tp->t_state |= TS_TTSTOP;
+ ndflush(&tp->t_outq, dp->p_mem -
+ (caddr_t)tp->t_outq.c_cf);
+ dp->p_end = dp->p_mem = tp->t_outq.c_cf;
+ dcaddr->dc_tcr &= ~(1 << line);
+ wbflush();
+ DELAY(10);
+ return;
+ }
+ }
+#endif /* HW_FLOW_CONTROL */
+ dcaddr->dc_tdr = sc->dc_brk | *(u_char *)dp->p_mem;
+ dp->p_mem++;
+
wbflush();
DELAY(10);
return;
@@ -729,7 +830,7 @@ dcxint(tp)
dcstart(tp);
if (tp->t_outq.c_cc == 0 || !(tp->t_state & TS_BUSY)) {
dcaddr = (dcregs *)dp->p_addr;
- dcaddr->dc_tcr &= ~(1 << (unit & 03));
+ dcaddr->dc_tcr &= ~(1 << line);
wbflush();
DELAY(10);
}
@@ -739,12 +840,15 @@ void
dcstart(tp)
register struct tty *tp;
{
+ register struct dc_softc *sc;
register struct pdma *dp;
register dcregs *dcaddr;
register int cc;
- int s;
+ int line, s;
- dp = &dcpdma[minor(tp->t_dev)];
+ sc = dc_cd.cd_devs[DCUNIT(tp->t_dev)];
+ line = DCLINE(tp->t_dev);
+ dp = &sc->dc_pdma[line];
dcaddr = (dcregs *)dp->p_addr;
s = spltty();
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
@@ -759,7 +863,7 @@ dcstart(tp)
if (tp->t_outq.c_cc == 0)
goto out;
/* handle console specially */
- if (tp == dc_tty[DCKBD_PORT] && raster_console()) {
+ if (raster_console() && tp == sc->dc_tty[DCKBD_PORT]) {
while (tp->t_outq.c_cc > 0) {
cc = getc(&tp->t_outq) & 0x7f;
cnputc(cc);
@@ -777,14 +881,13 @@ dcstart(tp)
}
goto out;
}
- cc = ndqb(&tp->t_outq, 0);
- if (cc == 0)
+ cc = ndqb(&tp->t_outq, 0);
+ if (cc == 0)
goto out;
-
tp->t_state |= TS_BUSY;
dp->p_end = dp->p_mem = tp->t_outq.c_cf;
dp->p_end += cc;
- dcaddr->dc_tcr |= 1 << (minor(tp->t_dev) & 03);
+ dcaddr->dc_tcr |= 1 << line;
wbflush();
out:
splx(s);
@@ -794,14 +897,16 @@ out:
* Stop output on a line.
*/
/*ARGSUSED*/
-int
+int /* was void TTTTT */
dcstop(tp, flag)
register struct tty *tp;
{
+ register struct dc_softc *sc;
register struct pdma *dp;
register int s;
- dp = &dcpdma[minor(tp->t_dev)];
+ sc = dc_cd.cd_devs[DCUNIT(tp->t_dev)];
+ dp = &sc->dc_pdma[DCLINE(tp->t_dev)];
s = spltty();
if (tp->t_state & TS_BUSY) {
dp->p_end = dp->p_mem;
@@ -809,8 +914,6 @@ dcstop(tp, flag)
tp->t_state |= TS_FLUSH;
}
splx(s);
-
- return (0);
}
int
@@ -818,38 +921,62 @@ dcmctl(dev, bits, how)
dev_t dev;
int bits, how;
{
+ register struct dc_softc *sc;
register dcregs *dcaddr;
- register int unit, mbits;
+ register int line, mbits;
int b, s;
- register int msr;
+ register int tcr, msr;
- unit = minor(dev);
- b = 1 << (unit & 03);
- dcaddr = (dcregs *)dcpdma[unit].p_addr;
+ line = DCLINE(dev);
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ b = 1 << line;
+ dcaddr = (dcregs *)sc->dc_pdma[line].p_addr;
s = spltty();
- /* only channel 2 has modem control (what about line 3?) */
+ /* only channel 2 has modem control on a DECstation 2100/3100 */
mbits = DML_DTR | DML_DSR | DML_CAR;
- switch (unit & 03) {
- case 2:
+#ifdef HW_FLOW_CONTROL
+ mbits != DML_RTS;
+#endif /* HW_FLOW_CONTROL */
+ switch (line) {
+ case 2: /* pmax partial-modem comms port, full-modem port on 3max */
mbits = 0;
- if (dcaddr->dc_tcr & TCR_DTR2)
+ tcr = dcaddr->dc_tcr;
+ if (tcr & TCR_DTR2)
mbits |= DML_DTR;
+ if ((sc->dc_rtscts & (1<<line)) && (tcr & TCR_RTS2))
+ mbits |= DML_RTS;
msr = dcaddr->dc_msr;
if (msr & MSR_CD2)
mbits |= DML_CAR;
if (msr & MSR_DSR2) {
- if (pmax_boardtype == DS_PMAX)
+ /*
+ * XXX really tests for DS_PMAX instead of DS_3MAX
+ * but close enough for now. Vaxes?
+ */
+ if ((sc->dc_rtscts & (1 << line )) == 0 &&
+ (sc->dc_modem & (1 << line )))
mbits |= DML_CAR | DML_DSR;
else
mbits |= DML_DSR;
}
break;
- case 3:
- if (pmax_boardtype != DS_PMAX) {
+ case 3: /* no modem control on pmax, console port on 3max */
+ /*
+ * XXX really tests for DS_3MAX instead of DS_PMAX
+ * but close enough for now. Vaxes?
+ */
+ if ( sc->dc_modem & (1 << line )) {
mbits = 0;
- if (dcaddr->dc_tcr & TCR_DTR3)
+ tcr = dcaddr->dc_tcr;
+ if (tcr & TCR_DTR3)
mbits |= DML_DTR;
+#ifdef HW_FLOW_CONTROL
+ /* XXX OK for get, but not for set? */
+ /*if ( sc->dc_rtscts & (1 << line ))*/
+ if (tcr & TCR_RTS3)
+ mbits |= DML_RTS;
+#endif /*HW_FLOW_CONTROL*/
msr = dcaddr->dc_msr;
if (msr & MSR_CD3)
mbits |= DML_CAR;
@@ -874,24 +1001,42 @@ dcmctl(dev, bits, how)
(void) splx(s);
return (mbits);
}
- switch (unit & 03) {
- case 2:
+ switch (line) {
+ case 2: /* 2 */
+ tcr = dcaddr->dc_tcr;
if (mbits & DML_DTR)
- dcaddr->dc_tcr |= TCR_DTR2;
+ tcr |= TCR_DTR2;
else
- dcaddr->dc_tcr &= ~TCR_DTR2;
+ tcr &= ~TCR_DTR2;
+ /*if (pmax_boardtype != DS_PMAX)*/
+ if (sc->dc_rtscts & (1 << line)) {
+ if (mbits & DML_RTS)
+ tcr |= TCR_RTS2;
+ else
+ tcr &= ~TCR_RTS2;
+ }
+ dcaddr->dc_tcr = tcr;
break;
case 3:
- if (pmax_boardtype != DS_PMAX) {
+ /* XXX DTR not supported on this line on 2100/3100 */
+ /*if (pmax_boardtype != DS_PMAX)*/
+ if (sc->dc_modem & (1 << line)) {
+ tcr = dcaddr->dc_tcr;
if (mbits & DML_DTR)
- dcaddr->dc_tcr |= TCR_DTR3;
+ tcr |= TCR_DTR3;
else
- dcaddr->dc_tcr &= ~TCR_DTR3;
+ tcr &= ~TCR_DTR3;
+#ifdef HW_FLOW_CONTROL
+ /*if (sc->dc_rtscts & (1 << line))*/
+ if (mbits & DML_RTS)
+ tcr |= TCR_RTS3;
+ else
+ tcr &= ~TCR_RTS3;
+#endif /* HW_FLOW_CONTROL */
+ dcaddr->dc_tcr = tcr;
}
}
- if ((mbits & DML_DTR) && (dcsoftCAR[unit >> 2] & b))
- dc_tty[unit]->t_state |= TS_CARR_ON;
(void) splx(s);
return (mbits);
}
@@ -904,27 +1049,56 @@ void
dcscan(arg)
void *arg;
{
+ register struct dc_softc *sc = dc_cd.cd_devs[0]; /* XXX */
register dcregs *dcaddr;
register struct tty *tp;
- register int i, bit, car;
+ register int unit, limit, dtr, dsr;
int s;
+ /* only channel 2 has modem control on a DECstation 2100/3100 */
+ dtr = TCR_DTR2;
+ dsr = MSR_DSR2;
+#ifdef HW_FLOW_CONTROL
+ /*limit = (pmax_boardtype == DS_PMAX) ? 2 : 3;*/
+ limit = (sc->dc_rtscts & (1 << 3)) :3 : 2; /*XXX*/
+#else
+ limit = 2;
+#endif
s = spltty();
- /* only channel 2 has modem control (what about line 3?) */
- dcaddr = (dcregs *)dcpdma[i = 2].p_addr;
- tp = dc_tty[i];
- bit = TCR_DTR2;
- if (dcsoftCAR[i >> 2] & bit)
- car = 1;
- else
- car = dcaddr->dc_msr & MSR_DSR2;
- if (car) {
- /* carrier present */
- if (!(tp->t_state & TS_CARR_ON))
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- } else if ((tp->t_state & TS_CARR_ON) &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- dcaddr->dc_tcr &= ~bit;
+ for (unit = 2; unit <= limit; unit++, dtr >>= 2, dsr >>= 8) {
+ tp = sc->dc_tty[unit];
+ dcaddr = (dcregs *)sc->dc_pdma[unit].p_addr;
+ if ((dcaddr->dc_msr & dsr) || (sc->dcsoftCAR & (1 << unit))) {
+ /* carrier present */
+ if (!(tp->t_state & TS_CARR_ON))
+ (void)(*linesw[tp->t_line].l_modem)(tp, 1);
+ } else if ((tp->t_state & TS_CARR_ON) &&
+ (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
+ dcaddr->dc_tcr &= ~dtr;
+#ifdef HW_FLOW_CONTROL
+ /*
+ * If we are using hardware flow control and output is stopped,
+ * then resume transmit.
+ */
+ if ((tp->t_cflag & CCTS_OFLOW) && (tp->t_state & TS_TTSTOP) &&
+ /*pmax_boardtype != DS_PMAX*/
+ (sc->dc_rtscts & (1 << unit)) ) {
+ switch (unit) {
+ case 2:
+ if (dcaddr->dc_msr & MSR_CTS2)
+ break;
+ continue;
+
+ case 3:
+ if (dcaddr->dc_msr & MSR_CTS3)
+ break;
+ continue;
+ }
+ tp->t_state &= ~TS_TTSTOP;
+ dcstart(tp);
+ }
+#endif /* HW_FLOW_CONTROL */
+ }
splx(s);
timeout(dcscan, (void *)0, hz);
}
@@ -950,9 +1124,17 @@ dcGetc(dev)
{
register dcregs *dcaddr;
register int c;
+ register int line;
int s;
- dcaddr = (dcregs *)dcpdma[minor(dev)].p_addr;
+ line = DCLINE(dev);
+ if (cold && dc_cons_addr) {
+ dcaddr = dc_cons_addr;
+ } else {
+ struct dc_softc *sc;
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ dcaddr = (dcregs *)sc->dc_pdma[line].p_addr;
+ }
if (!dcaddr)
return (0);
s = spltty();
@@ -961,7 +1143,7 @@ dcGetc(dev)
continue;
c = dcaddr->dc_rbuf;
DELAY(10);
- if (((c >> 8) & 03) == (minor(dev) & 03))
+ if (((c >> 8) & 03) == line)
break;
}
splx(s);
@@ -979,13 +1161,23 @@ dcPutc(dev, c)
register dcregs *dcaddr;
register u_short tcr;
register int timeout;
- int s, line;
+ int s, out_line, activeline;
+ int brk;
s = spltty();
-
- dcaddr = (dcregs *)dcpdma[minor(dev)].p_addr;
+ out_line = DCLINE(dev);
+ if (cold && dc_cons_addr) {
+ brk = 0;
+ dcaddr = dc_cons_addr;
+ } else {
+ struct dc_softc *sc;
+
+ sc = dc_cd.cd_devs[DCUNIT(dev)];
+ dcaddr = (dcregs *)sc->dc_pdma[out_line].p_addr;
+ brk = sc->dc_brk;
+ }
tcr = dcaddr->dc_tcr;
- dcaddr->dc_tcr = tcr | (1 << minor(dev));
+ dcaddr->dc_tcr = tcr | (1 << out_line);
wbflush();
DELAY(10);
while (1) {
@@ -999,13 +1191,13 @@ dcPutc(dev, c)
printf("dcPutc: timeout waiting for CSR_TRDY\n");
break;
}
- line = (dcaddr->dc_csr >> 8) & 3;
+ activeline = (dcaddr->dc_csr >> 8) & 3;
/*
* Check to be sure its the right port.
*/
- if (line != minor(dev)) {
- tcr |= 1 << line;
- dcaddr->dc_tcr &= ~(1 << line);
+ if (activeline != out_line) {
+ tcr |= 1 << activeline;
+ dcaddr->dc_tcr &= ~(1 << out_line);
wbflush();
DELAY(10);
continue;
@@ -1013,7 +1205,7 @@ dcPutc(dev, c)
/*
* Start sending the character.
*/
- dcaddr->dc_tdr = dc_brk[0] | (c & 0xff);
+ dcaddr->dc_tdr = brk | (c & 0xff);
wbflush();
DELAY(10);
/*
@@ -1028,15 +1220,15 @@ dcPutc(dev, c)
timeout = 1000000;
while (!(dcaddr->dc_csr & CSR_TRDY) && timeout > 0)
timeout--;
- line = (dcaddr->dc_csr >> 8) & 3;
- if (line != minor(dev)) {
- tcr |= 1 << line;
- dcaddr->dc_tcr &= ~(1 << line);
+ activeline = (dcaddr->dc_csr >> 8) & 3;
+ if (activeline != out_line) {
+ tcr |= 1 << activeline;
+ dcaddr->dc_tcr &= ~(1 << activeline);
wbflush();
DELAY(10);
continue;
}
- dcaddr->dc_tcr &= ~(1 << minor(dev));
+ dcaddr->dc_tcr &= ~(1 << out_line);
wbflush();
DELAY(10);
break;
@@ -1054,4 +1246,18 @@ dcPutc(dev, c)
splx(s);
}
-#endif /* NDC */
+
+
+/*
+ * Enable/disable polling mode
+ */
+void
+dcPollc(dev, on)
+ dev_t dev;
+ int on;
+{
+#if defined(DIAGNOSTIC) || defined(DEBUG)
+ printf("dc_Pollc(%d, %d): not implemented\n", minor(dev), on);
+#endif
+}
+
diff --git a/sys/arch/pmax/dev/dc_cons.h b/sys/arch/pmax/dev/dc_cons.h
new file mode 100644
index 00000000000..8110a2a2629
--- /dev/null
+++ b/sys/arch/pmax/dev/dc_cons.h
@@ -0,0 +1,17 @@
+/* $NetBSD: dc_cons.h,v 1.1 1996/10/13 03:42:17 jonathan Exp $ */
+
+#ifdef _KERNEL
+#ifndef _DC_CONS_H
+#define _DC_CONS_H
+
+/*
+ * Following declaratios for console code.
+ * XXX should be redesigned to expose less driver internals.
+ */
+void dc_consinit __P((dev_t dev, dcregs *dcaddr));
+extern int dcGetc __P ((dev_t dev));
+extern int dcparam __P((register struct tty *tp, register struct termios *t));
+extern void dcPutc __P((dev_t dev, int c));
+
+#endif /* _DCVAR_H */
+#endif /* _KERNEL */
diff --git a/sys/arch/pmax/dev/dc_ds.c b/sys/arch/pmax/dev/dc_ds.c
new file mode 100644
index 00000000000..c316c83a42d
--- /dev/null
+++ b/sys/arch/pmax/dev/dc_ds.c
@@ -0,0 +1,106 @@
+/* $NetBSD: dc_ds.c,v 1.4 1996/10/14 17:28:46 jonathan Exp $ */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ * this driver contributed by Jonathan Stone
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+#include <machine/autoconf.h>
+#include <machine/dc7085cons.h> /* XXX */
+#include <pmax/dev/dcvar.h>
+#include <pmax/dev/dc_ds_cons.h>
+#include <pmax/pmax/kn01.h>
+
+extern struct cfdriver mainbus_cd; /* XXX */
+
+/*
+ * Autoconfig definition of driver front-end
+ */
+int dc_ds_match __P((struct device * parent, void *cfdata, void *aux));
+void dc_ds_attach __P((struct device *parent, struct device *self, void *aux));
+
+struct cfattach dc_ds_ca = {
+ sizeof(struct dc_softc), dc_ds_match, dc_ds_attach
+};
+
+
+/*
+ * Initialize a line for (polled) console I/O
+ */
+int
+dc_ds_consinit(dev)
+ dev_t dev;
+{
+#if defined(DEBUG) && 1 /* XXX untested */
+ printf("dc_ds(%d,%d): serial console at 0x%x\n",
+ minor(dev) >> 2, minor(dev) & 03,
+ MACH_PHYS_TO_UNCACHED(KN01_SYS_DZ));
+#endif
+ /* let any pending PROM output from boot drain */
+ DELAY(100000);
+ dc_consinit(dev, (void *)MACH_PHYS_TO_UNCACHED(KN01_SYS_DZ));
+ return (1);
+}
+
+
+/*
+ * Match driver on decstation (2100,3100,5100) based on name
+ */
+int
+dc_ds_match(parent, match, aux)
+ struct device *parent;
+ void *match;
+ void *aux;
+{
+ struct confargs *ca = aux;
+
+ if (strcmp(ca->ca_name, "dc") != 0 &&
+ strcmp(ca->ca_name, "mdc") != 0 &&
+ strcmp(ca->ca_name, "dc7085") != 0)
+ return (0);
+
+ if (badaddr((caddr_t)ca->ca_addr, 2))
+ return (0);
+
+ return (1);
+}
+
+
+void
+dc_ds_attach(parent, self, aux)
+ struct device *parent;
+ struct device *self;
+ void *aux;
+{
+ register struct confargs *ca = aux;
+ caddr_t dcaddr;
+ struct dc_softc *sc = (void*) self;
+
+
+ dcaddr = (caddr_t)ca->ca_addr;
+ (void) dcattach(sc, (void*)MACH_PHYS_TO_UNCACHED(dcaddr),
+ /* dtr/dsr mask: comm port only */
+ 1 << DCCOMM_PORT,
+ /* rts/cts mask: none */
+ 0x0,
+ 0, DCCOMM_PORT);
+
+ /* tie pseudo-slot to device */
+ BUS_INTR_ESTABLISH(ca, dcintr, self);
+ printf("\n");
+}
diff --git a/sys/arch/pmax/dev/dc_ds_cons.h b/sys/arch/pmax/dev/dc_ds_cons.h
new file mode 100644
index 00000000000..6b19ba04b89
--- /dev/null
+++ b/sys/arch/pmax/dev/dc_ds_cons.h
@@ -0,0 +1,14 @@
+/* $NetBSD: dc_ds_cons.h,v 1.1 1996/09/25 20:48:55 jonathan Exp $ */
+
+#ifdef _KERNEL
+#ifndef _DC_DS_CONS_H
+#define _DC_DS_CONS_H
+
+/*
+ * Following declaratios for console code.
+ * XXX should be redesigned to expose less driver internals.
+ */
+int dc_ds_consinit __P((dev_t dev));
+
+#endif /* _DC_DS_CONS_H */
+#endif /* _KERNEL */
diff --git a/sys/arch/pmax/dev/dc_ioasic.c b/sys/arch/pmax/dev/dc_ioasic.c
new file mode 100644
index 00000000000..b6f9b9ad977
--- /dev/null
+++ b/sys/arch/pmax/dev/dc_ioasic.c
@@ -0,0 +1,109 @@
+/* $NetBSD: dc_ioasic.c,v 1.4 1996/10/14 17:15:42 jonathan Exp $ */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ * this driver contributed by Jonathan Stone
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+#include <machine/autoconf.h>
+#include <dev/tc/tcvar.h>
+#include <dev/tc/ioasicvar.h>
+#include <machine/dc7085cons.h>
+#include <pmax/dev/dcvar.h>
+#include <pmax/dev/dc_ioasic_cons.h>
+#include <pmax/pmax/kn02.h>
+/*
+ * Autoconfig definition of driver front-end
+ */
+int dc_ioasic_match __P((struct device * parent, void *cfdata, void *aux));
+void dc_ioasic_attach __P((struct device *parent, struct device *self, void *aux));
+
+struct cfattach dc_ioasic_ca = {
+ sizeof(struct dc_softc), dc_ioasic_match, dc_ioasic_attach
+};
+
+
+/*
+ * Initialize a line for (polled) console I/O
+ */
+int
+dc_ioasic_consinit(dev)
+ dev_t dev;
+{
+
+#if defined(DEBUG) && 0
+ printf("dc_ioasic(%d,%d): serial console at 0x%x\n",
+ minor(dev) >> 2, minor(dev) & 03,
+ MACH_PHYS_TO_UNCACHED(KN02_SYS_DZ));
+ DELAY(100000);
+#endif
+ dc_consinit(dev, (void *)MACH_PHYS_TO_UNCACHED(KN02_SYS_DZ));
+ return(1);
+}
+
+
+/*
+ * Match driver on 5000/200
+ * (not a real ioasic, but we configure it as one)
+ */
+int
+dc_ioasic_match(parent, match, aux)
+ struct device *parent;
+ void *match;
+ void *aux;
+{
+ struct ioasicdev_attach_args *d = aux;
+
+ if (strcmp(d->iada_modname, "dc") != 0 &&
+ strcmp(d->iada_modname, "dc7085") != 0)
+ return (0);
+
+ if (badaddr((caddr_t)(d->iada_addr), 2))
+ return (0);
+
+ return (1);
+}
+
+
+void
+dc_ioasic_attach(parent, self, aux)
+ struct device *parent;
+ struct device *self;
+ void *aux;
+{
+ struct dc_softc *sc = (void*) self;
+ struct ioasicdev_attach_args *d = aux;
+ caddr_t dcaddr;
+
+ dcaddr = (caddr_t)d->iada_addr;
+ printf("address 0x%p\n", dcaddr);
+ (void) dcattach(sc, (void*)MACH_PHYS_TO_UNCACHED(dcaddr),
+ /* dtr/dsr mask */ (1<< DCPRINTER_PORT) + (1 << DCCOMM_PORT),
+#ifdef HW_FLOW_CONTROL
+ /* rts/cts mask */ (1<< DCPRINTER_PORT) + (1 << DCCOMM_PORT),
+#else
+ 0,
+#endif
+ 1, 3);
+ /* tie pseudo-slot to device */
+ ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_TTY,
+ dcintr, self);
+
+ printf("\n");
+}
+
diff --git a/sys/arch/pmax/dev/dc_ioasic_cons.h b/sys/arch/pmax/dev/dc_ioasic_cons.h
new file mode 100644
index 00000000000..d3ebda1de28
--- /dev/null
+++ b/sys/arch/pmax/dev/dc_ioasic_cons.h
@@ -0,0 +1,14 @@
+/* $NetBSD: dc_ioasic_cons.h,v 1.1 1996/09/25 20:48:56 jonathan Exp $ */
+
+#ifdef _KERNEL
+#ifndef _DC_IOASIC_CONS_H
+#define _DC_IOASIC_CONS_H
+
+/*
+ * Following declaratios for console code.
+ * XXX should be redesigned to expose less driver internals.
+ */
+int dc_ioasic_consinit __P((dev_t dev));
+
+#endif /* _DCVAR_H */
+#endif /* _KERNEL */
diff --git a/sys/arch/pmax/dev/dcvar.h b/sys/arch/pmax/dev/dcvar.h
index 1e5c3e9b8f2..d9aad4033a3 100644
--- a/sys/arch/pmax/dev/dcvar.h
+++ b/sys/arch/pmax/dev/dcvar.h
@@ -1,10 +1,43 @@
-/* $NetBSD: dcvar.h,v 1.2 1996/01/29 22:52:18 jonathan Exp $ */
+/* $NetBSD: dcvar.h,v 1.3 1996/09/25 20:48:57 jonathan Exp $ */
/*
* External declarations from DECstation dc serial driver.
*/
+#ifdef _KERNEL
+#ifndef _DCVAR_H
+#define _DCVAR_H
+
+#include <pmax/dev/pdma.h>
+
+struct dc_softc {
+ struct device sc_dv;
+ struct pdma dc_pdma[4];
+ struct tty *dc_tty[4];
+ /*
+ * Software copy of brk register since it isn't readable
+ */
+ int dc_brk;
+
+ char dc_19200; /* this unit supports 19200 */
+ char dcsoftCAR; /* mask, lines with carrier on (DSR) */
+ char dc_rtscts; /* mask, lines with hw flow control */
+ char dc_modem; /* mask, lines with DTR wired */
+};
+
+int dcattach __P((struct dc_softc *sc, void *addr,
+ int dtrmask, int rts_ctsmask,
+ int speed, int consline));
+int dcintr __P((void * xxxunit));
+
+/*
+ * Following declaratios for console code.
+ * XXX shuould be separated, or redesigned.
+ */
extern int dcGetc __P ((dev_t dev));
extern int dcparam __P((register struct tty *tp, register struct termios *t));
extern void dcPutc __P((dev_t dev, int c));
+void dc_consinit __P((dev_t dev, dcregs *dcaddr));
+#endif /* _DCVAR_H */
+#endif /* _KERNEL */
diff --git a/sys/arch/pmax/dev/device.h b/sys/arch/pmax/dev/device.h
index 6b8602b8219..0d122f5ff7b 100644
--- a/sys/arch/pmax/dev/device.h
+++ b/sys/arch/pmax/dev/device.h
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.9 1996/04/10 16:27:38 jonathan Exp $ */
+/* $NetBSD: device.h,v 1.11 1996/10/01 01:04:50 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -54,7 +54,8 @@ struct pmax_driver {
/* routine to start operation */
void (*d_start) __P((struct ScsiCmd *cmd));
/* routine to call when operation complete */
- void (*d_done) __P((int, int, int, int));
+ void (*d_done) __P(( int unit, int errno, int buflen,
+ int status_byte));
/* routine to call when interrupt is seen */
int (*d_intr) __P((void* sc));
};
@@ -84,7 +85,6 @@ struct pmax_scsi_device {
int sd_ctlr; /* SCSI interface number */
int sd_drive; /* SCSI address number */
int sd_slave; /* LUN if device has multiple units */
- int sd_dk; /* used for disk statistics */
int sd_flags; /* flags */
int sd_alive; /* true if init routine succeeded */
diff --git a/sys/arch/pmax/dev/dtop.c b/sys/arch/pmax/dev/dtop.c
index a13ac2dd887..6db3e880403 100644
--- a/sys/arch/pmax/dev/dtop.c
+++ b/sys/arch/pmax/dev/dtop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dtop.c,v 1.14.4.2 1996/06/16 17:17:14 mhitch Exp $ */
+/* $NetBSD: dtop.c,v 1.20 1996/10/13 13:13:55 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -114,8 +114,8 @@ SOFTWARE.
#include <dev/cons.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
#include <machine/pmioctl.h>
-#include <machine/machConst.h>
#include <machine/dc7085cons.h>
#include <pmax/pmax/asic.h>
@@ -690,7 +690,7 @@ dtopparam(tp, t)
* Stop output on a line.
*/
/*ARGSUSED*/
-int
+void
dtopstop(tp, flag)
register struct tty *tp;
int flag;
@@ -703,8 +703,6 @@ dtopstop(tp, flag)
tp->t_state |= TS_FLUSH;
}
splx(s);
-
- return (0);
}
/*
diff --git a/sys/arch/pmax/dev/fb.c b/sys/arch/pmax/dev/fb.c
index 0edc22e46bc..78819923641 100644
--- a/sys/arch/pmax/dev/fb.c
+++ b/sys/arch/pmax/dev/fb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fb.c,v 1.10.4.1 1996/08/13 08:32:18 jonathan Exp $ */
+/* $NetBSD: fb.c,v 1.18 1996/10/14 04:55:26 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -65,6 +65,7 @@
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/device.h>
+#include <sys/poll.h>
#include <sys/tty.h>
#include <sys/time.h>
#include <sys/kernel.h>
@@ -83,7 +84,7 @@
#include <sys/conf.h>
#include <machine/conf.h>
-#include <machine/machConst.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
#include <machine/pmioctl.h>
#include <machine/fbio.h>
@@ -115,9 +116,7 @@
*/
/* qvss/pm compatible and old 4.4bsd/pmax driver functions */
-void fbKbdEvent(), fbMouseEvent(), fbMouseButtons();
-void fbBlitc __P((int c, struct fbinfo *fi));
-void fbPutc __P((dev_t dev, int c));
+
extern int pmax_boardtype;
extern void fbScreenInit __P (( struct fbinfo *fi));
diff --git a/sys/arch/pmax/dev/fb_usrreq.c b/sys/arch/pmax/dev/fb_usrreq.c
index 5d87a27dfff..9b01185eb50 100644
--- a/sys/arch/pmax/dev/fb_usrreq.c
+++ b/sys/arch/pmax/dev/fb_usrreq.c
@@ -199,29 +199,40 @@ fbioctl(dev, cmd, data, flag, p)
return (0);
}
+/* fbselect(dev, events, p) should be fbpoll(dev, events, p) */
+/* see also pmax/conf.c TTTTT */
+
+
/*
- * Select on Digital-OS-compatible in-kernel input-event ringbuffer.
+ * Poll on Digital-OS-compatible in-kernel input-event ringbuffer.
*/
int
-fbselect(dev, flag, p)
+fbselect(dev, events, p)
dev_t dev;
- int flag;
+ int events;
struct proc *p;
{
struct fbinfo *fi = fbcd.cd_devs[minor(dev)];
+ int revents = 0;
- switch (flag) {
- case FREAD:
+ if (events & (POLLIN | POLLRDNORM)) {
if (fi->fi_fbu->scrInfo.qe.eHead !=
fi->fi_fbu->scrInfo.qe.eTail)
- return (1);
- selrecord(p, &fi->fi_selp);
- break;
+ revents |= (events & (POLLIN|POLLRDNORM));
+ else
+ selrecord(p, &fi->fi_selp);
}
- return (0);
+ /* XXX mice are not writable, what to do for poll on write? */
+#ifdef notdef
+ if (events & (POLLOUT | POLLWRNORM))
+ revents |= events & (POLLOUT | POLLWRNORM);
+#endif
+
+ return (revents);
}
+
/*
* Return the physical page number that corresponds to byte offset 'off'.
*/
diff --git a/sys/arch/pmax/dev/fbreg.h b/sys/arch/pmax/dev/fbreg.h
index 3d60490f464..78ac957580d 100644
--- a/sys/arch/pmax/dev/fbreg.h
+++ b/sys/arch/pmax/dev/fbreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fbreg.h,v 1.5 1995/09/12 07:51:35 jonathan Exp $ */
+/* $NetBSD: fbreg.h,v 1.6 1996/09/21 03:25:20 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -49,9 +49,9 @@ struct fbuaccess {
};
struct pmax_fbtty {
- /*int initialized; /* Set up yet? */
int row, col; /* Screen pos for glass tty */
- void (*KBDPutc)(); /* Send char to keyboard func */
+ void (*KBDPutc) __P ((dev_t dev, int c));
+ /* Send char to keyboard func */
dev_t kbddev; /* Device for KBDPutc */
};
@@ -76,9 +76,7 @@ extern void fbMouseButtons __P((MouseReport *, struct fbinfo *));
extern void fbScroll __P((struct fbinfo *));
extern void fbPutc __P((dev_t, int));
extern void fbBlitc __P((int, struct fbinfo *));
-extern int kbdMapChar __P((int));
-extern void KBDReset __P((dev_t, void (*)(dev_t, int)));
-extern void MouseInit __P((dev_t, void (*)(dev_t, int), int (*)(dev_t)));
-extern int KBDGetc __P((void));
extern int tb_kbdmouseconfig __P((struct fbinfo *fi));
extern int fbmmap_fb __P((struct fbinfo *, dev_t, caddr_t, struct proc *));
+
+extern void init_pmaxfbu __P((struct fbinfo *fi));
diff --git a/sys/arch/pmax/dev/ims332.c b/sys/arch/pmax/dev/ims332.c
index 83abb3f9b63..66a144fead9 100644
--- a/sys/arch/pmax/dev/ims332.c
+++ b/sys/arch/pmax/dev/ims332.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ims332.c,v 1.2.4.1 1996/09/09 20:16:32 thorpej Exp $ */
+/* $NetBSD: ims332.c,v 1.4 1996/10/13 13:13:57 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993, 1995
@@ -48,7 +48,6 @@
#include <machine/fbio.h>
#include <machine/fbvar.h>
-#include <machine/machConst.h>
#include <pmax/dev/ims332.h>
static u_int ims332_read_register (struct fbinfo *, int);
diff --git a/sys/arch/pmax/dev/mfb.c b/sys/arch/pmax/dev/mfb.c
index d1b243ce73e..1fb35093fbe 100644
--- a/sys/arch/pmax/dev/mfb.c
+++ b/sys/arch/pmax/dev/mfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mfb.c,v 1.13.4.2 1996/09/09 20:07:04 thorpej Exp $ */
+/* $NetBSD: mfb.c,v 1.20 1996/10/13 13:13:59 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -91,13 +91,14 @@
#include <sys/device.h>
#include <sys/systm.h>
-#include <machine/autoconf.h>
#include <dev/tc/tcvar.h>
+#include <machine/autoconf.h>
-#include <machine/machConst.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
#include <machine/pmioctl.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
+#include <pmax/dev/cfbvar.h> /* XXX dev/tc ? */
#include <pmax/pmax/pmaxtype.h>
@@ -120,7 +121,6 @@ extern int pmax_boardtype;
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
-extern void fbScreenInit __P((struct fbinfo *fia));
void mfbPosCursor __P((struct fbinfo *fi, int x, int y));
@@ -162,8 +162,6 @@ static u_char bt431_read_reg __P((bt431_regmap_t *regs, int regno));
/*
* old pmax-framebuffer hackery
*/
-void genConfigMouse(), genDeconfigMouse();
-void genKbdEvent(), genMouseEvent(), genMouseButtons();
extern u_short defCursor[32];
diff --git a/sys/arch/pmax/dev/mfbreg.h b/sys/arch/pmax/dev/mfbreg.h
index 039ad395a42..a4a9b1d2549 100644
--- a/sys/arch/pmax/dev/mfbreg.h
+++ b/sys/arch/pmax/dev/mfbreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mfbreg.h,v 1.4.6.1 1996/08/13 08:03:52 jonathan Exp $ */
+/* $NetBSD: mfbreg.h,v 1.5 1996/08/22 04:37:41 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
diff --git a/sys/arch/pmax/dev/mfbvar.h b/sys/arch/pmax/dev/mfbvar.h
new file mode 100644
index 00000000000..9ba98ecbe5a
--- /dev/null
+++ b/sys/arch/pmax/dev/mfbvar.h
@@ -0,0 +1,8 @@
+/* $NetBSD: mfbvar.h,v 1.1 1996/09/21 03:06:37 jonathan Exp $ */
+
+/*
+ * Initialize a Turbochannel MFB 1280x1024x1 2-d framebuffer,
+ * so it can be used as a bitmapped glass-tty console device.
+ */
+extern int
+mcfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent));
diff --git a/sys/arch/pmax/dev/pm.c b/sys/arch/pmax/dev/pm.c
index fa4244302ba..9fbf2f6f050 100644
--- a/sys/arch/pmax/dev/pm.c
+++ b/sys/arch/pmax/dev/pm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pm.c,v 1.14.4.1 1996/09/09 20:49:38 thorpej Exp $ */
+/* $NetBSD: pm.c,v 1.19 1996/10/13 03:39:35 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -56,14 +56,6 @@
*/
-#include "fb.h"
-#include "pm.h"
-#include "dc.h"
-#if NPM > 0
-#if NDC == 0
-pm needs dc device
-#else
-
#include <sys/param.h>
#include <sys/time.h>
#include <sys/kernel.h>
@@ -73,31 +65,27 @@ pm needs dc device
#include <sys/proc.h>
#include <sys/mman.h>
#include <sys/malloc.h>
+#include <sys/systm.h>
#include <vm/vm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/machConst.h>
-#include <machine/dc7085cons.h>
#include <machine/pmioctl.h>
-
#include <machine/fbio.h>
#include <machine/fbvar.h>
-#include <pmax/pmax/kn01.h>
-#include <pmax/pmax/pmaxtype.h>
-#include <pmax/pmax/cons.h>
-
#include <pmax/dev/fbreg.h>
+#include <pmax/dev/pmvar.h>
#include <pmax/dev/pmreg.h>
-#include <pmax/dev/bt478.h>
+#include <pmax/dev/bt478var.h>
/*
* These need to be mapped into user space.
*/
+extern struct fbuaccess pmu;
struct fbuaccess pmu;
static u_short curReg; /* copy of PCCRegs.cmdr since it's read only */
@@ -105,7 +93,6 @@ static u_short curReg; /* copy of PCCRegs.cmdr since it's read only */
* rcons methods and globals.
*/
struct pmax_fbtty pmfb;
-struct fbinfo pmfi; /*XXX*/
/*
* Forward references.
@@ -117,53 +104,31 @@ void pmPosCursor __P((struct fbinfo *fi, int x, int y));
void bt478CursorColor __P((struct fbinfo *fi, u_int *color));
void bt478InitColorMap __P((struct fbinfo *fi));
-static void pmLoadColorMap __P ((ColorMap *ptr)); /*XXX*/
-
-int pminit __P((struct fbinfo *fi, int unit, int silent));
+int pminit __P((struct fbinfo *fi, int unit, int cold_console_flag));
+int pmattach __P((struct fbinfo *fi, int unit, int cold_console_flag));
static int pm_video_on __P ((struct fbinfo *));
static int pm_video_off __P ((struct fbinfo *));
-int bt478LoadColorMap __P ((struct fbinfo *, caddr_t, int, int));
-int bt478GetColorMap __P ((struct fbinfo *, caddr_t, int, int));
-
-
-#if 0
-static void pmVDACInit();
-void pmKbdEvent(), pmMouseEvent(), pmMouseButtons();
-#endif
-
-/* pm framebuffers are only found in {dec,vax}station 3100s with dc7085s */
-
-extern void dcPutc();
-extern void (*dcDivertXInput)();
-extern void (*dcMouseEvent)();
-extern void (*dcMouseButtons)();
-extern int pmax_boardtype;
-extern u_short defCursor[32];
-void genConfigMouse(), genDeconfigMouse();
-void genKbdEvent(), genMouseEvent(), genMouseButtons();
-extern void pmEventQueueInit __P((pmEventQueue *qe));
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
/*
- * Autoconfiguration data for config.new.
- * Use static-sized softc until config.old and old autoconfig
- * code is completely gone.
+ * Definition of driver for autoconfiguration.
*/
-int pmmatch __P((struct device *, void *, void *));
-void pmattach __P((struct device *, struct device *, void *));
+int old_pmmatch __P((struct device *, void *, void *));
+void old_pmattach __P((struct device *, struct device *, void *));
-struct cfattach pm_ca = {
- sizeof(struct device), pmmatch, pmattach
+struct cfattach old_pm_ca = {
+ sizeof(struct device), old_pmmatch, old_pmattach
};
+extern struct cfdriver pm_cd;
struct cfdriver pm_cd = {
NULL, "pm", DV_DULL
};
@@ -182,12 +147,11 @@ struct fbdriver pm_driver = {
};
int
-pmmatch(parent, match, aux)
+old_pmmatch(parent, match, aux)
struct device *parent;
void *match;
void *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
caddr_t pmaddr = (caddr_t)ca->ca_addr;
@@ -202,13 +166,14 @@ pmmatch(parent, match, aux)
}
void
-pmattach(parent, self, aux)
+old_pmattach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
{
- struct confargs *ca = aux;
- caddr_t pmaddr = (caddr_t)ca->ca_addr;
+ /*struct confargs *ca = aux;*/
+ /*caddr_t pmaddr = (caddr_t)ca->ca_addr;*/
+ extern struct fbinfo pmfi; /* XXX */
if (!pminit(&pmfi, 0, 0))
return;
@@ -220,43 +185,32 @@ pmattach(parent, self, aux)
}
+
/*
- * pmax FB initialization. This is abstracted out from pmbattch() so
- * that a console framebuffer can be initialized early in boot.
+ * 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
*/
-pminit(fi, unit, silent)
+int
+pmattach(fi, unit, cold_console_flag)
struct fbinfo *fi;
int unit;
- int silent;
+ int cold_console_flag;
{
- register PCCRegs *pcc = (PCCRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);
-
- /*XXX*/
- /*
- * If this device is being intialized as the console, malloc()
- * is not yet up and we must use statically-allocated space.
- */
- if (fi == NULL) {
- fi = &pmfi; /* XXX */
- fi->fi_cmap_bits = (caddr_t)cmap_bits;
- } else {
- fi->fi_cmap_bits = malloc(CMAP_BITS, M_DEVBUF, M_NOWAIT);
- if (fi->fi_cmap_bits == NULL) {
- printf("pm%d: no memory for cmap 0x%x\n", unit);
- return (0);
- }
- }
+ register PCCRegs *pcc = (PCCRegs *)fi->fi_base;
- /* Set address of frame buffer... */
- fi->fi_pixels = (caddr_t)MACH_PHYS_TO_UNCACHED(KN01_PHYS_FBUF_START);
+ /* check for no frame buffer */
+ if (badaddr((char *)fi->fi_pixels, 4))
+ return (0);
/* Fill in the stuff that differs from monochrome to color. */
- if (*(volatile u_short *)MACH_PHYS_TO_UNCACHED(KN01_SYS_CSR) &
- KN01_CSR_MONO) {
- /* check for no frame buffer */
- if (badaddr((char *)fi->fi_pixels, 4))
- return (0);
-
+ if (fi->fi_type.fb_depth == 1) {
fi->fi_type.fb_depth = 1;
fi->fi_type.fb_cmsize = 0;
fi->fi_type.fb_boardtype = PMAX_FBTYPE_PM_MONO;
@@ -275,38 +229,29 @@ pminit(fi, unit, silent)
fi->fi_driver = &pm_driver;
fi->fi_pixelsize =
((fi->fi_type.fb_depth == 1) ? 1024 / 8 : 1024) * 864;
- fi->fi_unit = unit;
- fi->fi_base = (caddr_t)pcc;
- fi->fi_vdac = (caddr_t)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);
fi->fi_blanked = 0;
- fi->fi_cmap_bits = (caddr_t)&cmap_bits [CMAP_BITS * unit];
+
+ if (cold_console_flag) {
+ fi->fi_cmap_bits = (caddr_t)cmap_bits;
+ } else {
+ fi->fi_cmap_bits = malloc(CMAP_BITS, M_DEVBUF, M_NOWAIT);
+ if (fi->fi_cmap_bits == NULL) {
+ printf("pm%d: no memory for cmap\n", unit);
+ return (0);
+ }
+ }
fi->fi_type.fb_width = 1024;
fi->fi_type.fb_height = 864;
/*
- * compatibility glue
+ * Compatibility glue
*/
fi->fi_glasstty = &pmfb;
/*
- * Must be in Uncached space since the fbuaccess structure is
- * mapped into the user's address space uncached.
- */
- fi->fi_fbu = (struct fbuaccess *)
- MACH_PHYS_TO_UNCACHED(MACH_CACHED_TO_PHYS(&pmu));
- fi->fi_glasstty->KBDPutc = dcPutc;
- fi->fi_glasstty->kbddev = makedev(DCDEV, DCKBD_PORT);
-
- if (fi->fi_type.fb_depth == 1) {
- /* check for no frame buffer */
- if (badaddr((char *)fi->fi_pixels, 4))
- return (0);
- }
-
- /*
* Initialize the screen.
*/
pcc->cmdr = PCC_FOPB | PCC_VBHI;
@@ -343,7 +288,7 @@ pminit(fi, unit, silent)
*/
fi->fi_glasstty = &pmfb; /*XXX*/
fbconnect((fi->fi_type.fb_depth == 1) ? "KN01 mfb" : "KN01 cfb",
- fi, silent);
+ fi, cold_console_flag);
#ifdef fpinitialized
@@ -353,10 +298,6 @@ pminit(fi, unit, silent)
}
-static u_char bg_RGB[3]; /* background color for the cursor */
-static u_char fg_RGB[3]; /* foreground color for the cursor */
-
-
/*
* ----------------------------------------------------------------------------
*
@@ -377,51 +318,19 @@ pmLoadCursor(fi, cur)
struct fbinfo *fi;
unsigned short *cur;
{
- register PCCRegs *pcc = (PCCRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);
+ register PCCRegs *pcc = (PCCRegs *)fi->fi_base;
register int i;
curReg |= PCC_LODSA;
pcc->cmdr = curReg;
for (i = 0; i < 32; i++) {
pcc->memory = cur[i];
- MachEmptyWriteBuffer();
+ wbflush();
}
curReg &= ~PCC_LODSA;
pcc->cmdr = curReg;
}
-/* should zap pmloadcolormap too, but i haven't fixed the callers yet */
-
-/*
- * ----------------------------------------------------------------------------
- *
- * pmLoadColorMap --
- *
- * Load the color map.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The color map is loaded.
- *
- * ----------------------------------------------------------------------------
- */
-static void
-pmLoadColorMap(ptr)
- ColorMap *ptr;
-{
- register VDACRegs *vdac = (VDACRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);
-
- if (ptr->index > 256)
- return;
-
- vdac->mapWA = ptr->index; MachEmptyWriteBuffer();
- vdac->map = ptr->Entry.red; MachEmptyWriteBuffer();
- vdac->map = ptr->Entry.green; MachEmptyWriteBuffer();
- vdac->map = ptr->Entry.blue; MachEmptyWriteBuffer();
-}
-
/*
@@ -444,7 +353,7 @@ pmPosCursor(fi, x, y)
register struct fbinfo *fi;
register int x, y;
{
- register PCCRegs *pcc = (PCCRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);
+ register PCCRegs *pcc = (PCCRegs *)fi->fi_base;
if (y < fi->fi_fbu->scrInfo.min_cur_y ||
y > fi->fi_fbu->scrInfo.max_cur_y)
@@ -458,9 +367,12 @@ pmPosCursor(fi, x, y)
pcc->ypos = PCC_Y_OFFSET + y;
}
-/* enable the video display. */
-static int pm_video_on (fi)
+/*
+ * Enable the video display.
+ */
+static int
+pm_video_on (fi)
struct fbinfo *fi;
{
register PCCRegs *pcc = (PCCRegs *)fi -> fi_base;
@@ -489,6 +401,3 @@ static int pm_video_off (fi)
fi -> fi_blanked = 1;
return 0;
}
-
-#endif /* NDC */
-#endif /* NPM */
diff --git a/sys/arch/pmax/dev/pm_ds.c b/sys/arch/pmax/dev/pm_ds.c
new file mode 100644
index 00000000000..a1619140ba2
--- /dev/null
+++ b/sys/arch/pmax/dev/pm_ds.c
@@ -0,0 +1,198 @@
+/* $NetBSD: pm_ds.c,v 1.3 1996/10/23 02:34:23 mhitch Exp $ */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ * this driver contributed by Jonathan Stone
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+#include <machine/autoconf.h>
+
+#include <pmax/pmax/kn01.h>
+#include <pmax/pmax/cons.h>
+
+#include <sys/ioctl.h>
+#include <machine/pmioctl.h>
+#include <machine/fbio.h>
+#include <machine/fbvar.h>
+
+#include <pmax/dev/fbreg.h>
+#include <machine/dc7085cons.h> /* XXX */
+#include <pmax/dev/pmvar.h> /* XXX move */
+
+#include "fb.h"
+#include "pm.h"
+#include "dc.h"
+
+#if 0
+#if NDC == 0
+pm needs dc device
+#endif
+#endif
+
+
+extern int pminit __P((struct fbinfo *fi, int unit, int cold_console_flag));
+int ds_pm_init __P ((struct fbinfo *fi, int unti, int cold_console_flag));
+
+int pm_ds_match __P((struct device *, void *, void *));
+void pm_ds_attach __P((struct device *, struct device *, void *));
+
+/*
+ * Define decstation pm front-end driver for autoconfig
+ */
+extern struct cfattach pm_ds_ca;
+struct cfattach pm_ds_ca = {
+ sizeof(struct device), pm_ds_match, pm_ds_attach
+};
+
+/* XXX pmvar.h */
+extern struct fbuacces pmu;
+
+/* static struct for cold console init */
+struct fbinfo pmfi; /*XXX*/
+
+/*
+ * rcons methods and globals.
+ */
+extern struct pmax_fbtty pmfb;
+
+/*
+ * XXX
+ * pmax raster-console infrastructure needs to reset the mouse, so
+ * we need a driver callback.
+ * pm framebuffers are only found in {dec,vax}station 3100s with dc7085s..
+ * we hardcode an entry point.
+ * XXX
+ */
+void dcPutc __P((dev_t, int)); /* XXX */
+
+
+/*
+ * Intialize pm framebuffer as console while cold
+ */
+int
+ds_pm_init (fi, unit, cold_console_flag)
+ struct fbinfo *fi;
+ int unit;
+ int cold_console_flag;
+{
+ /* only have one pm, address &c hardcoded in pminit() */
+ return (pminit(fi, unit, cold_console_flag));
+}
+
+int
+pm_ds_match(parent, match, aux)
+ struct device *parent;
+ void *match;
+ void *aux;
+{
+ struct confargs *ca = aux;
+ caddr_t pmaddr = (caddr_t)ca->ca_addr;
+
+ /* make sure that we're looking for this type of device. */
+ if (strcmp(ca->ca_name, "pm") != 0)
+ return (0);
+
+ if (badaddr(pmaddr, 4))
+ return (0);
+
+ return (1);
+}
+
+void
+pm_ds_attach(parent, self, aux)
+ struct device *parent;
+ struct device *self;
+ void *aux;
+{
+ /*struct confargs *ca = aux;*/
+ /*caddr_t pmaddr = (caddr_t)ca->ca_addr;*/
+
+ if (!pminit(&pmfi, 0, 0))
+ return;
+
+ /* no interrupts for PM */
+ /*BUS_INTR_ESTABLISH(ca, sccintr, self->dv_unit);*/
+ printf("\n");
+ return;
+}
+
+
+/*
+ * pmax FB initialization. This is abstracted out from pmattach() so
+ * that a console framebuffer can be initialized early in boot.
+ *
+ * Compute cursor-chip address, raster address, depth, initialize
+ * statically-allocated "softc", and pass to pmattach().
+ */
+int
+pminit(fi, unit, cold_console_flag)
+ struct fbinfo *fi;
+ int unit;
+ int cold_console_flag;
+{
+ /*
+ * If this device is being initialized as the console, malloc()
+ * is not yet up and we must use statically-allocated space.
+ */
+ if (fi == NULL) {
+ fi = &pmfi; /* XXX */
+ }
+ /* cmap_bits set in MI back-end */
+
+
+ /* Set address of frame buffer... */
+ fi->fi_unit = unit;
+ fi->fi_pixels = (caddr_t)MACH_PHYS_TO_UNCACHED(KN01_PHYS_FBUF_START);
+ fi->fi_base = (caddr_t)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);
+ fi->fi_vdac = (caddr_t)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);
+
+ /* check for no frame buffer */
+ if (badaddr((char *)fi->fi_pixels, 4))
+ return (0);
+
+ /* Fill in the stuff that differs from monochrome to color. */
+ if (*(volatile u_short *)MACH_PHYS_TO_UNCACHED(KN01_SYS_CSR) &
+ KN01_CSR_MONO) {
+ fi->fi_type.fb_depth = 1;
+ }
+ else {
+ fi->fi_type.fb_depth = 8;
+ }
+
+ /*
+ * 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 = (struct fbuaccess *)
+ MACH_PHYS_TO_UNCACHED(MACH_CACHED_TO_PHYS(&pmu));
+
+ fi->fi_glasstty = &pmfb;
+
+ /*
+ * set putc/getc entry point
+ */
+ fi->fi_glasstty->KBDPutc = dcPutc; /* XXX */
+ fi->fi_glasstty->kbddev = makedev(DCDEV, DCKBD_PORT);
+
+ /* call back-end to initialize hardware and attach to rcons */
+ return (pmattach(fi, unit, cold_console_flag));
+}
diff --git a/sys/arch/pmax/dev/pmvar.h b/sys/arch/pmax/dev/pmvar.h
index c56f1b8c9ac..cf80db9e4e0 100644
--- a/sys/arch/pmax/dev/pmvar.h
+++ b/sys/arch/pmax/dev/pmvar.h
@@ -3,3 +3,4 @@
* so it can be used as a bitmapped glass-tty console device.
*/
int pminit __P((struct fbinfo *fi, int unit, int silent));
+int pmattach __P((struct fbinfo *fi, int unit, int silent));
diff --git a/sys/arch/pmax/dev/qvss_compat.c b/sys/arch/pmax/dev/qvss_compat.c
index f618efd81f9..85f0b394ee0 100644
--- a/sys/arch/pmax/dev/qvss_compat.c
+++ b/sys/arch/pmax/dev/qvss_compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: qvss_compat.c,v 1.4 1996/05/19 01:16:18 jonathan Exp $ */
+/* $NetBSD: qvss_compat.c,v 1.6 1996/10/13 03:39:36 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
diff --git a/sys/arch/pmax/dev/rcons.c b/sys/arch/pmax/dev/rcons.c
index 6d07990b995..9ac3b6a1330 100644
--- a/sys/arch/pmax/dev/rcons.c
+++ b/sys/arch/pmax/dev/rcons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rcons.c,v 1.9 1996/05/19 01:06:14 jonathan Exp $ */
+/* $NetBSD: rcons.c,v 1.14 1996/10/13 13:14:00 jonathan Exp $ */
/*
* Copyright (c) 1995
@@ -73,7 +73,6 @@
#include <dev/rcons/raster.h>
#include <machine/fbvar.h>
-#include <machine/machConst.h>
#include <machine/pmioctl.h>
#include <pmax/dev/fbreg.h>
@@ -340,30 +339,32 @@ rconsioctl(dev, cmd, data, flag, p)
}
/* ARGSUSED */
-int
-rconsstop (tp, rw)
+int /* was void TTTTT */
+rconsstop(tp, rw)
struct tty *tp;
int rw;
{
- return (0);
+
}
/*ARGSUSED*/
void
-rconsreset (tp, rw)
+rconsreset(tp, rw)
struct tty *tp;
int rw;
{
+
}
-/*ARGSUSED*/
+/* was ttpoll instead of ttselect TTTTT */
+
int
-rconsselect(dev, which, p)
+rconspoll(dev, events, p)
dev_t dev;
- int which;
+ int events;
struct proc *p;
{
- return (ttselect(dev, which, p));
+ return (ttselect(dev, events, p));
}
/*ARGSUSED*/
diff --git a/sys/arch/pmax/dev/rz.c b/sys/arch/pmax/dev/rz.c
index d387755c60f..d0ec6e419cc 100644
--- a/sys/arch/pmax/dev/rz.c
+++ b/sys/arch/pmax/dev/rz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rz.c,v 1.15.4.1 1996/06/16 17:20:48 mhitch Exp $ */
+/* $NetBSD: rz.c,v 1.20 1996/10/13 03:39:38 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -52,7 +52,6 @@
#include <sys/errno.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
-#include <sys/dkstat.h> /* XXX */
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/malloc.h>
@@ -158,7 +157,6 @@ struct rz_softc {
#define sc_copenpart sc_dkdev.dk_copenmask /* XXX compat */
#define sc_bshift sc_dkdev.dk_blkshift /* XXX compat */
char sc_xname[8]; /* XXX external name */
- u_int sc_wpms; /* average xfer rate in 16bit wds/sec */
struct rzstats sc_stats; /* statisic counts */
struct buf sc_tab; /* queue of pending operations */
struct buf sc_buf; /* buf for doing I/O */
@@ -218,6 +216,13 @@ static char legal_cmds[256] = {
};
/*
+ * Private forward declarations
+ */
+
+static int rzready __P((register struct rz_softc *sc));
+static void rzlblkstrat __P((register struct buf *bp, register int bsize));
+
+/*
* Test to see if the unit is ready and if not, try to make it ready.
* Also, find the drive capacity.
*/
@@ -432,9 +437,6 @@ rzprobe(xxxsd)
}
}
- /* XXX Support old-style instrumentation for now. */
- sc->sc_wpms = 32 * (60 * DEV_BSIZE / 2);
-
/* Attach the disk. */
disk_attach(&sc->sc_dkdev);
@@ -663,14 +665,6 @@ rzstart(unit)
unit, bp->b_bcount);
#endif
sc->sc_stats.rztransfers++;
-
- /* XXX Support old-style instrumentation for now. */
- if ((n = sc->sc_sd->sd_dk) >= 0) {
- dk_busy |= 1 << n;
- ++dk_seek[n];
- ++dk_xfer[n];
- dk_wds[n] += bp->b_bcount >> 6;
- }
}
@@ -701,10 +695,6 @@ rzdone(unit, error, resid, status)
return;
}
- /* XXX Support old-style instrumentation for now. */
- if (sd->sd_dk >= 0)
- dk_busy &= ~(1 << sd->sd_dk);
-
disk_unbusy(&sc->sc_dkdev, (bp->b_bcount - resid));
if (sc->sc_flags & RZF_SENSEINPROGRESS) {
@@ -937,10 +927,6 @@ rzopen(dev, flags, mode, p)
}
sc->sc_openpart |= mask;
- /* XXX Support old-style instrumentation for now. */
- if (sc->sc_sd->sd_dk >= 0)
- dk_wpms[sc->sc_sd->sd_dk] = sc->sc_wpms;
-
return (0);
}
diff --git a/sys/arch/pmax/dev/scsi.c b/sys/arch/pmax/dev/scsi.c
index ceab29a1625..a9f712ead8c 100644
--- a/sys/arch/pmax/dev/scsi.c
+++ b/sys/arch/pmax/dev/scsi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scsi.c,v 1.5 1996/04/07 22:53:55 jonathan Exp $ */
+/* $NetBSD: scsi.c,v 1.7 1996/10/13 03:39:39 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -236,4 +236,4 @@ scsiPrintInquiry(inqbuf, i)
revl[i+1] = 0;
printf(" %s %s rev %s", vid, pid, revl);
}
-} \ No newline at end of file
+}
diff --git a/sys/arch/pmax/dev/sfb.c b/sys/arch/pmax/dev/sfb.c
index 1e744970f3d..838c0d0e79a 100644
--- a/sys/arch/pmax/dev/sfb.c
+++ b/sys/arch/pmax/dev/sfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sfb.c,v 1.11.4.3 1996/09/09 20:47:40 thorpej Exp $ */
+/* $NetBSD: sfb.c,v 1.18 1996/10/13 13:14:01 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -90,17 +90,19 @@
#include <sys/device.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
+#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
-#include <dev/tc/tcvar.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
+#include <pmax/dev/sfbvar.h> /* XXX dev/tc ? */
#include <pmax/dev/bt459.h>
#include <pmax/dev/sfbreg.h>
-#include <machine/machConst.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
+
#include <pmax/pmax/pmaxtype.h>
#include <machine/pmioctl.h>
#include <pmax/dev/fbreg.h>
diff --git a/sys/arch/pmax/dev/sfbreg.h b/sys/arch/pmax/dev/sfbreg.h
index 3e760dab0ca..8942855832c 100644
--- a/sys/arch/pmax/dev/sfbreg.h
+++ b/sys/arch/pmax/dev/sfbreg.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)sfb.c 8.1 (Berkeley) 6/10/93
- * $Id: sfbreg.h,v 1.2 1996/09/15 21:12:35 deraadt Exp $
+ * $Id: sfbreg.h,v 1.3 1996/12/22 15:17:40 graichen Exp $
*/
#define SFB_OFFSET_VRAM 0x201000 /* from module's base */
diff --git a/sys/arch/pmax/dev/sfbvar.h b/sys/arch/pmax/dev/sfbvar.h
new file mode 100644
index 00000000000..b72a71f62bc
--- /dev/null
+++ b/sys/arch/pmax/dev/sfbvar.h
@@ -0,0 +1,8 @@
+/* $NetBSD: sfbvar.h,v 1.1 1996/09/21 03:06:36 jonathan Exp $ */
+
+/*
+ * Initialize a Turbochannel SFB 2-d framebuffer,
+ * so it can be used as a bitmapped glass-tty console device.
+ */
+extern int
+scfbinit __P((struct fbinfo *fi, caddr_t base, int unit, int silent));
diff --git a/sys/arch/pmax/dev/sii.c b/sys/arch/pmax/dev/sii.c
index f170f614ee6..aadc25d0c94 100644
--- a/sys/arch/pmax/dev/sii.c
+++ b/sys/arch/pmax/dev/sii.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sii.c,v 1.12.4.2 1996/09/09 20:24:36 thorpej Exp $ */
+/* $NetBSD: sii.c,v 1.20 1996/10/22 23:15:10 mhitch Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -60,74 +60,37 @@
#endif
#include <machine/autoconf.h>
-#include <machine/machConst.h>
+
+/* old 4.4bsd/pmax scsi drivers */
#include <pmax/dev/device.h>
#include <pmax/dev/scsi.h>
#include <pmax/dev/siireg.h>
+#include <pmax/dev/siivar.h>
-#include <pmax/pmax/kn01.h>
-
-typedef struct scsi_state {
- int statusByte; /* status byte returned during STATUS_PHASE */
- int dmaDataPhase; /* which data phase to expect */
- int dmaCurPhase; /* SCSI phase if DMA is in progress */
- int dmaPrevPhase; /* SCSI phase of DMA suspended by disconnect */
- u_short *dmaAddr[2]; /* DMA buffer memory address */
- int dmaBufIndex; /* which of the above is currently in use */
- int dmalen; /* amount to transfer in this chunk */
- int cmdlen; /* total remaining amount of cmd to transfer */
- u_char *cmd; /* current pointer within scsicmd->cmd */
- int buflen; /* total remaining amount of data to transfer */
- char *buf; /* current pointer within scsicmd->buf */
- u_short flags; /* see below */
- u_short prevComm; /* command reg before disconnect */
- u_short dmaCtrl; /* DMA control register if disconnect */
- u_short dmaAddrL; /* DMA address register if disconnect */
- u_short dmaAddrH; /* DMA address register if disconnect */
- u_short dmaCnt; /* DMA count if disconnect */
- u_short dmaByte; /* DMA byte if disconnect on odd boundary */
- u_short dmaReqAck; /* DMA synchronous xfer offset or 0 if async */
-} State;
-
-/* state flags */
-#define FIRST_DMA 0x01 /* true if no data DMA started yet */
-#define PARITY_ERR 0x02 /* true if parity error seen */
-
-#define SII_NCMD 7
-struct siisoftc {
- struct device sc_dev; /* us as a device */
- SIIRegs *sc_regs; /* HW address of SII controller chip */
- int sc_flags;
- int sc_target; /* target SCSI ID if connected */
- ScsiCmd *sc_cmd[SII_NCMD]; /* active command indexed by ID */
- State sc_st[SII_NCMD]; /* state info for each active command */
-#ifdef NEW_SCSI
- struct scsi_link sc_link; /* scsi lint struct */
-#endif
-};
+
+/* Machine-indepedent back-end attach entry point */
+void siiattach __P((struct siisoftc *sc));
/*
- * Device definition for autoconfiguration.
- *
+ * Autoconfig definition of driver front-end
*/
-int siimatch __P((struct device * parent, void *cfdata, void *aux));
-void siiattach __P((struct device *parent, struct device *self, void *aux));
-int siiprint(void*, const char*);
-
-int sii_doprobe __P((void *addr, int unit, int flags, int pri,
- struct device *self));
-int siiintr __P((void *sc));
-
-extern struct cfdriver sii_cd;
+#include <machine/machConst.h>
+int old_siimatch __P((struct device * parent, void *cfdata, void *aux));
+void old_siiattach __P((struct device *parent, struct device *self, void *aux));
+extern struct cfattach sii_ca;
struct cfattach sii_ca = {
- sizeof(struct siisoftc), siimatch, siiattach
+ sizeof(struct siisoftc), old_siimatch, old_siiattach
};
+extern struct cfdriver sii_cd;
struct cfdriver sii_cd = {
NULL, "sii", DV_DULL
};
+int siiprint(void*, char*);
+int siiintr __P((void *sc));
+
#ifdef USE_NEW_SCSI
/* Glue to the machine-independent scsi */
struct scsi_adapter asc_switch = {
@@ -149,15 +112,6 @@ struct scsi_device sii_dev = {
};
#endif
-/*
- * Definition of the controller for the old auto-configuration program
- * and old-style pmax scsi drivers.
- */
-void siistart();
-struct pmax_driver siidriver = {
- "sii", NULL, siistart, 0,
-};
-
/*
* MACROS for timing out spin loops.
@@ -211,10 +165,12 @@ u_char sii_buf[256]; /* used for extended messages */
#define NOWAIT 0
#define WAIT 1
-/* define a safe address in the SCSI buffer for doing status & message DMA */
-#define SII_BUF_ADDR (MACH_PHYS_TO_UNCACHED(KN01_SYS_SII_B_START) \
- + SII_MAX_DMA_XFER_LENGTH * 14)
+/*
+ * Define a safe address in the SCSI buffer for doing status & message DMA
+ * XXX why not add another field to softc?
+ */
+#define SII_BUF_ADDR(sc) ((sc)->sc_buf + SII_MAX_DMA_XFER_LENGTH * 14)
/*
* Other forward references
@@ -239,12 +195,20 @@ void CopyToBuffer __P((u_short *src, /* NOTE: must be short aligned */
void CopyFromBuffer __P((volatile u_short *src, char *dst, int length));
+/*
+ * Definition of the controller for the old-style, non-MI
+ * pmax scsi drivers, and for autoconfiguring devices via those
+ * drivers.
+ */
+struct pmax_driver siidriver = {
+ "sii", NULL, siistart, 0,
+};
/*
* Match driver based on name
*/
int
-siimatch(parent, match, aux)
+old_siimatch(parent, match, aux)
struct device *parent;
void *match;
void *aux;
@@ -267,21 +231,32 @@ siimatch(parent, match, aux)
}
void
-siiattach(parent, self, aux)
+old_siiattach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
{
register struct confargs *ca = aux;
register struct siisoftc *sc = (struct siisoftc *) self;
- register void *siiaddr;
- register int i;
-
- siiaddr = (void*)MACH_PHYS_TO_UNCACHED(ca->ca_addr);
- sc->sc_regs = (SIIRegs *)siiaddr;
+ sc->sc_regs = (SIIRegs *)MACH_PHYS_TO_UNCACHED(ca->ca_addr);
sc->sc_flags = sc->sc_dev.dv_cfdata->cf_flags;
+
+ siiattach(sc);
+
+ /* tie pseudo-slot to device */
+ BUS_INTR_ESTABLISH(ca, siiintr, sc);
+ printf("\n");
+}
+
+void
+siiattach(sc)
+ register struct siisoftc *sc;
+{
+ register int i;
+
sc->sc_target = -1; /* no command active */
+
/*
* Give each target its own DMA buffer region.
* Make it big enough for 2 max transfers so we can ping pong buffers
@@ -289,8 +264,7 @@ siiattach(parent, self, aux)
*/
for (i = 0; i < SII_NCMD; i++) {
sc->sc_st[i].dmaAddr[0] = (u_short *)
- MACH_PHYS_TO_UNCACHED(KN01_SYS_SII_B_START) +
- 2 * SII_MAX_DMA_XFER_LENGTH * i;
+ sc->sc_buf + 2 * SII_MAX_DMA_XFER_LENGTH * i;
sc->sc_st[i].dmaAddr[1] = sc->sc_st[i].dmaAddr[0] +
SII_MAX_DMA_XFER_LENGTH;
}
@@ -299,13 +273,13 @@ siiattach(parent, self, aux)
(void) pmax_add_scsi(&siidriver, sc->sc_dev.dv_unit);
sii_Reset(sc, RESET);
-
- /*priority = ca->ca_slot;*/
- /* tie pseudo-slot to device */
- BUS_INTR_ESTABLISH(ca, siiintr, sc);
- printf("\n");
+#ifdef USE_NEW_SCSI
+ /* XXX probe SCSI bus and attach slave devices */
+#endif
}
+
+
/*
* Start activity on a SCSI device.
* We maintain information on each device separately since devices can
@@ -518,11 +492,11 @@ sii_StartCmd(sc, target)
state->dmaCurPhase = SII_MSG_OUT_PHASE,
state->dmalen = 6;
CopyToBuffer((u_short *)sii_buf,
- (volatile u_short *)SII_BUF_ADDR, 6);
+ (volatile u_short *)SII_BUF_ADDR(sc), 6);
regs->slcsr = target;
regs->dmctrl = state->dmaReqAck;
- regs->dmaddrl = (u_short)(SII_BUF_ADDR >> 1);
- regs->dmaddrh = (u_short)(SII_BUF_ADDR >> 17) & 03;
+ regs->dmaddrl = (u_short)(SII_BUF_ADDR(sc) >> 1);
+ regs->dmaddrh = (u_short)(SII_BUF_ADDR(sc) >> 17) & 03;
regs->dmlotc = 6;
regs->comm = SII_DMA | SII_INXFER | SII_SELECT | SII_ATN |
SII_CON | SII_MSG_OUT_PHASE;
@@ -1748,15 +1722,16 @@ sii_DoSync(regs, state)
regs->dstat = SII_DNE;
wbflush();
}
-#else
- CopyToBuffer((u_short *)sii_buf, (volatile u_short *)SII_BUF_ADDR, 5);
+#else /* 0 */
+ CopyToBuffer((u_short *)sii_buf,
+ (volatile u_short *)SII_BUF_ADDR(sc), 5);
printf("sii_DoSync: %x %x %x ds %x\n",
- ((volatile u_short *)SII_BUF_ADDR)[0],
- ((volatile u_short *)SII_BUF_ADDR)[2],
- ((volatile u_short *)SII_BUF_ADDR)[4],
+ ((volatile u_short *)SII_BUF_ADDR(sc))[0],
+ ((volatile u_short *)SII_BUF_ADDR(sc))[2],
+ ((volatile u_short *)SII_BUF_ADDR(sc))[4],
regs->dstat); /* XXX */
- regs->dmaddrl = (u_short)(SII_BUF_ADDR >> 1);
- regs->dmaddrh = (u_short)(SII_BUF_ADDR >> 17) & 03;
+ regs->dmaddrl = (u_short)(SII_BUF_ADDR(sc) >> 1);
+ regs->dmaddrh = (u_short)(SII_BUF_ADDR(sc) >> 17) & 03;
regs->dmlotc = 5;
regs->comm = SII_DMA | SII_INXFER | SII_ATN |
(regs->cstat & SII_STATE_MSK) | SII_MSG_OUT_PHASE;
@@ -1776,7 +1751,7 @@ sii_DoSync(regs, state)
/* clear the DNE, other errors handled later */
regs->dstat = SII_DNE;
wbflush();
-#endif
+#endif /* 0 */
#if 0
SII_WAIT_UNTIL(dstat, regs->dstat, dstat & (SII_CI | SII_DI),
diff --git a/sys/arch/pmax/dev/sii_ds.c b/sys/arch/pmax/dev/sii_ds.c
new file mode 100644
index 00000000000..5d5789bd3c3
--- /dev/null
+++ b/sys/arch/pmax/dev/sii_ds.c
@@ -0,0 +1,96 @@
+/* $NetBSD: sii_ds.c,v 1.2 1996/10/13 16:59:15 christos Exp $ */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ * this driver contributed by Jonathan Stone
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+#include <machine/autoconf.h>
+#include <pmax/dev/device.h> /* XXX old pmax SCSI drivers */
+#include <pmax/dev/siireg.h>
+#include <pmax/dev/siivar.h>
+
+#include <pmax/pmax/kn01.h> /* kn01 (ds3100) address constants */
+
+extern struct cfdriver mainbus_cd; /* XXX */
+
+/*
+ * Autoconfig definition of driver front-end
+ */
+int sii_ds_match __P((struct device * parent, void *cfdata, void *aux));
+void sii_ds_attach __P((struct device *parent, struct device *self, void *aux));
+
+
+extern struct cfattach sii_ds_ca;
+struct cfattach sii_ds_ca = {
+ sizeof(struct siisoftc), sii_ds_match, sii_ds_attach
+};
+
+
+/* define a safe address in the SCSI buffer for doing status & message DMA */
+#define SII_BUF_ADDR (MACH_PHYS_TO_UNCACHED(KN01_SYS_SII_B_START) \
+ + SII_MAX_DMA_XFER_LENGTH * 14)
+
+/*
+ * Match driver on Decstation (2100, 3100, 5100) based on name and probe.
+ */
+int
+sii_ds_match(parent, match, aux)
+ struct device *parent;
+ void *match;
+ void *aux;
+{
+ struct confargs *ca = aux;
+ register void * siiaddr;
+
+ if (strcmp(ca->ca_name, "sii") != 0 &&
+ strncmp(ca->ca_name, "PMAZ-AA ", 8) != 0) /*XXX*/
+ return (0);
+
+ /* XXX check for bad address, untested */
+ siiaddr = (void *)ca->ca_addr;
+ if (siiaddr != (void *)MACH_PHYS_TO_UNCACHED(KN01_SYS_SII)) {
+ printf("(siimatch: bad addr %x, substituting %x\n",
+ ca->ca_addr, MACH_PHYS_TO_UNCACHED(KN01_SYS_SII));
+ siiaddr = (void *)MACH_PHYS_TO_UNCACHED(KN01_SYS_SII);
+ }
+ if (badaddr(siiaddr, 4))
+ return (0);
+ return (1);
+}
+
+void
+sii_ds_attach(parent, self, aux)
+ struct device *parent;
+ struct device *self;
+ void *aux;
+{
+ register struct confargs *ca = aux;
+ register struct siisoftc *sc = (struct siisoftc *) self;
+
+ sc->sc_regs = (SIIRegs *)MACH_PHYS_TO_UNCACHED(ca->ca_addr);
+
+ /* set up scsi buffer. XXX Why statically allocated? */
+ sc->sc_buf = (void*)(MACH_PHYS_TO_UNCACHED(KN01_SYS_SII_B_START));
+
+siiattach(sc);
+
+ /* tie pseudo-slot to device */
+ BUS_INTR_ESTABLISH(ca, siiintr, sc);
+ printf("\n");
+}
diff --git a/sys/arch/pmax/dev/siivar.h b/sys/arch/pmax/dev/siivar.h
new file mode 100644
index 00000000000..b36103ef4ce
--- /dev/null
+++ b/sys/arch/pmax/dev/siivar.h
@@ -0,0 +1,51 @@
+/* $NetBSD: siivar.h,v 1.1 1996/10/13 03:02:41 jonathan Exp $ */
+
+#ifndef _SIIVAR_H
+#define _SIIVAR_H
+
+typedef struct scsi_state {
+ int statusByte; /* status byte returned during STATUS_PHASE */
+ int dmaDataPhase; /* which data phase to expect */
+ int dmaCurPhase; /* SCSI phase if DMA is in progress */
+ int dmaPrevPhase; /* SCSI phase of DMA suspended by disconnect */
+ u_short *dmaAddr[2]; /* DMA buffer memory address */
+ int dmaBufIndex; /* which of the above is currently in use */
+ int dmalen; /* amount to transfer in this chunk */
+ int cmdlen; /* total remaining amount of cmd to transfer */
+ u_char *cmd; /* current pointer within scsicmd->cmd */
+ int buflen; /* total remaining amount of data to transfer */
+ char *buf; /* current pointer within scsicmd->buf */
+ u_short flags; /* see below */
+ u_short prevComm; /* command reg before disconnect */
+ u_short dmaCtrl; /* DMA control register if disconnect */
+ u_short dmaAddrL; /* DMA address register if disconnect */
+ u_short dmaAddrH; /* DMA address register if disconnect */
+ u_short dmaCnt; /* DMA count if disconnect */
+ u_short dmaByte; /* DMA byte if disconnect on odd boundary */
+ u_short dmaReqAck; /* DMA synchronous xfer offset or 0 if async */
+} State;
+
+/* state flags */
+#define FIRST_DMA 0x01 /* true if no data DMA started yet */
+#define PARITY_ERR 0x02 /* true if parity error seen */
+
+#define SII_NCMD 7
+struct siisoftc {
+ struct device sc_dev; /* us as a device */
+ void *sc_buf; /* DMA buffer (may be special mem) */
+ SIIRegs *sc_regs; /* HW address of SII controller chip */
+ int sc_flags;
+ int sc_target; /* target SCSI ID if connected */
+ ScsiCmd *sc_cmd[SII_NCMD]; /* active command indexed by ID */
+ State sc_st[SII_NCMD]; /* state info for each active command */
+#ifdef NEW_SCSI
+ struct scsi_link sc_link; /* scsi lint struct */
+#endif
+};
+
+int siiintr __P((void *sc));
+
+/* Machine-indepedent back-end attach entry point */
+void siiattach __P((struct siisoftc *sc));
+
+#endif /* _SIIVAR_H */
diff --git a/sys/arch/pmax/dev/tz.c b/sys/arch/pmax/dev/tz.c
index a8b99d367ea..13bcc3fc275 100644
--- a/sys/arch/pmax/dev/tz.c
+++ b/sys/arch/pmax/dev/tz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tz.c,v 1.10 1996/04/10 16:33:44 jonathan Exp $ */
+/* $NetBSD: tz.c,v 1.14 1996/10/13 12:34:20 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)tz.c 8.4 (Berkeley) 1/11/94
+ * @(#)tz.c 8.5 (Berkeley) 6/2/95
*
* from: Header: /sprite/src/kernel/dev/RCS/devSCSITape.c,
* v 8.14 89/07/31 17:26:13 mendel Exp SPRITE (Berkeley)
@@ -130,6 +130,9 @@ tzprobe(xxxsd)
register int i;
ScsiInquiryData inqbuf;
+ if (sd->sd_unit >= NTZ)
+ return (0);
+
/* init some parameters that don't change */
sc->sc_sd = sd;
sc->sc_cmd.sd = sd;
diff --git a/sys/arch/pmax/dev/xcfb.c b/sys/arch/pmax/dev/xcfb.c
index 8efa14f43b8..d2f9e6103e1 100644
--- a/sys/arch/pmax/dev/xcfb.c
+++ b/sys/arch/pmax/dev/xcfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xcfb.c,v 1.14.4.1 1996/05/30 04:04:01 mhitch Exp $ */
+/* $NetBSD: xcfb.c,v 1.20 1996/10/14 01:39:57 mhitch Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -105,9 +105,9 @@ xcfb needs dtop device
#include <sys/device.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
-#include <machine/machConst.h>
-#include <machine/pmioctl.h>
+#include <pmax/cpuregs.h> /* mips cached->uncached */
+#include <machine/pmioctl.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
@@ -157,16 +157,6 @@ struct fbdriver xcfb_driver = {
/*
* Forward references.
*/
-extern void fbScreenInit __P((struct fbinfo *fi));
-
-
-void genKbdEvent(), genMouseEvent(), genMouseButtons();
-
-extern void dtopKBDPutc();
-extern void (*dtopDivertXInput)();
-extern void (*dtopMouseEvent)();
-extern void (*dtopMouseButtons)();
-extern int pmax_boardtype;
extern u_short defCursor[32];
@@ -212,7 +202,7 @@ xcfbattach(parent, self, aux)
{
struct tc_attach_args *ta = aux;
- if (!xcfbinit(NULL, (caddr_t)ta->ta_addr, self->dv_unit, 0));
+ if (!xcfbinit(NULL, (caddr_t)ta->ta_addr, self->dv_unit, 0))
return;
/* no interrupts for XCFB */
diff --git a/sys/arch/pmax/dev/xcfbvar.h b/sys/arch/pmax/dev/xcfbvar.h
index e6261cb2cd6..68ff17d0ff5 100644
--- a/sys/arch/pmax/dev/xcfbvar.h
+++ b/sys/arch/pmax/dev/xcfbvar.h
@@ -1,3 +1,5 @@
+/* $NetBSD: xcfbvar.h,v 1.2 1996/09/21 03:06:38 jonathan Exp $ */
+
/*
* Initialize a Personal Decstation baseboard framebuffer,
* so it can be used as a bitmapped glass-tty console device.