-# $OpenBSD: files.vax,v 1.45 2008/04/25 14:51:35 jmc Exp $
+# $OpenBSD: files.vax,v 1.46 2008/08/18 23:04:26 miod Exp $
# $NetBSD: files.vax,v 1.60 1999/08/27 20:04:32 ragge Exp $
#
# new style config file for vax architecture
device mem
device mba {drive = -1}
+define dzcons
+
# SBI and related devices
device sbi {tr = -1}
attach sbi at mainbus with sbi_mainbus
attach ts at uba
file arch/vax/uba/ts.c ts needs-flag
-attach dz at vsbus with dz_vsbus
+attach dz at vsbus with dz_vsbus: dzcons
file arch/vax/vsa/dz_ibus.c dz_vsbus
# VXT serial
file arch/vax/dec/dzms.c dzms needs-flag
file arch/vax/vxt/qscms.c qscms needs-flag
+file arch/vax/dec/dzinput.c dzkbd | dzms
+
# These devices aren't tested (or even compiled!)
# They are just included here to make some files happy ;)
#
--- /dev/null
+/* $OpenBSD: dzcons.c,v 1.1 2008/08/18 23:04:28 miod Exp $ */
+/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
+/*
+ * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Console routines for system using DZ11-like controllers, with the
+ * same register mapping as found on VAXstations.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <dev/cons.h>
+
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/vsbus.h>
+#include <machine/ka420.h>
+#ifdef VAX60
+#include <vax/mbus/mbusreg.h>
+#include <vax/mbus/mbusvar.h>
+#endif
+
+#include <vax/qbus/dzreg.h>
+#include <vax/qbus/dzvar.h>
+
+#include <vax/dec/dzkbdvar.h>
+
+vaddr_t dz_console_regs; /* console registers mapping */
+
+#define REG(name) short name; short X##name##X;
+static volatile struct ss_dz {/* base address of DZ-controller: 0x200a0000 */
+ REG(csr); /* 00 Csr: control/status register */
+ REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */
+ REG(tcr); /* 08 Tcr: transmit console register */
+ REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */
+ REG(lpr0); /* 10 Lpr0: */
+ REG(lpr1); /* 14 Lpr0: */
+ REG(lpr2); /* 18 Lpr0: */
+ REG(lpr3); /* 1C Lpr0: */
+} *dz;
+#undef REG
+
+cdev_decl(dz);
+cons_decl(dz);
+
+extern int getmajor(void *); /* conf.c */
+
+int dzcngetc_internal(int);
+
+/*
+ * Receive a character on the given line (blocking call).
+ * Used by both serial and keyboard cngetc routines.
+ */
+int
+dzcngetc_internal(int line)
+{
+ u_short rbuf;
+
+ for (;;) {
+ while ((dz->csr & DZ_CSR_RX_DONE) == 0)
+ ; /* Wait for char */
+ rbuf = dz->rbuf;
+ if (((rbuf >> 8) & 3) != line)
+ continue;
+ return (rbuf & 0xff);
+ }
+}
+
+/*
+ * Returns whether the dz attachment may have a keyboard plugged in.
+ * There are no specific parameters identifying the dz chip, since
+ * - VAXstation can only have one non-qbus dz chip.
+ * - ...except for the KA60 (VAXstation 3500), which can have keyboards
+ * connected to all I/O modules, if more than one.
+ * - ...and QBus dz attachments do not invoke this function as they know
+ * they are ``regular'' serial lines only.
+ */
+int
+dz_can_have_kbd()
+{
+ switch (vax_boardtype) {
+ case VAX_BTYP_410:
+ case VAX_BTYP_420:
+ case VAX_BTYP_43:
+ if ((vax_confdata & KA420_CFG_MULTU) == 0)
+ return (1);
+ break;
+
+ case VAX_BTYP_46:
+ if ((vax_siedata & 0xff) == VAX_VTYP_46)
+ return (1);
+ break;
+ case VAX_BTYP_48:
+ if (((vax_siedata >> 8) & 0xff) == VAX_STYP_48)
+ return (1);
+ break;
+
+ case VAX_BTYP_49:
+#ifdef VAX60
+ case VAX_BTYP_60:
+#endif
+ return (1);
+
+ default:
+ break;
+ }
+
+ return (0);
+}
+
+int
+dzcngetc(dev)
+ dev_t dev;
+{
+ int c = 0, s;
+ int line = minor(dev);
+
+ s = spltty();
+ do {
+ c = dzcngetc_internal(line) & 0x7f;
+ } while (c == 17 || c == 19); /* ignore XON/XOFF */
+ splx(s);
+
+ if (c == 13)
+ c = 10;
+
+ return (c);
+}
+
+void
+dzcnprobe(cndev)
+ struct consdev *cndev;
+{
+ extern vaddr_t iospace;
+ int diagcons, major;
+ paddr_t ioaddr = 0x200a0000;
+
+ if ((major = getmajor(dzopen)) < 0)
+ return;
+
+ switch (vax_boardtype) {
+ case VAX_BTYP_410:
+ case VAX_BTYP_420:
+ case VAX_BTYP_43:
+ diagcons = (vax_confdata & KA420_CFG_L3CON ? 3 : 0);
+ break;
+
+ case VAX_BTYP_46:
+ case VAX_BTYP_48:
+ diagcons = (vax_confdata & 0x100 ? 3 : 0);
+ break;
+
+ case VAX_BTYP_49:
+ ioaddr = 0x25000000;
+ diagcons = (vax_confdata & 8 ? 3 : 0);
+ break;
+
+ case VAX_BTYP_1303:
+ ioaddr = 0x25000000;
+ diagcons = 3;
+ break;
+
+#ifdef VAX60
+ case VAX_BTYP_60:
+ ioaddr = MBUS_SLOT_BASE(mbus_ioslot) + 0x600000;
+ diagcons = 3; /* XXX force serial for now */
+ break;
+#endif
+
+ default:
+ return;
+ }
+
+ cndev->cn_pri = diagcons != 0 ? CN_HIGHPRI : CN_LOWPRI;
+ cndev->cn_dev = makedev(major, dz_can_have_kbd() ? 3 : diagcons);
+ dz_console_regs = iospace;
+ ioaccess(iospace, ioaddr, 1);
+}
+
+void
+dzcninit(cndev)
+ struct consdev *cndev;
+{
+ dzcninit_internal(minor(cndev->cn_dev));
+}
+
+void
+dzcninit_internal(int line)
+{
+ int speed;
+
+ dz = (void *)dz_console_regs;
+
+ speed = line == 0 ? DZ_LPR_B4800 : DZ_LPR_B9600;
+
+ dz->csr = 0; /* Disable scanning until initting is done */
+ dz->tcr = 1 << line; /* Turn on xmitter */
+ dz->csr = DZ_CSR_MSE; /* Turn scanning back on */
+ dz->rbuf = DZ_LPR_RX_ENABLE | (speed << 8) | DZ_LPR_8_BIT_CHAR | line;
+}
+
+/*
+ * IMPORTANT! Do not use major(dev) in dzcnputc(), as dzputc() only provides
+ * meaningful minor when invoking dzcnputc().
+ */
+void
+dzcnputc(dev,ch)
+ dev_t dev;
+ int ch;
+{
+ int timeout = 1<<15; /* don't hang the machine! */
+ int s;
+ int mino = minor(dev);
+ u_short tcr;
+
+ if (mfpr(PR_MAPEN) == 0)
+ return;
+
+ /*
+ * If we are past boot stage, dz* will interrupt,
+ * therefore we block.
+ */
+ s = spltty();
+ tcr = dz->tcr; /* remember which lines to scan */
+ dz->tcr = (1 << mino);
+
+ while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
+ if (--timeout < 0)
+ break;
+ dz->tdr = ch; /* Put the character */
+ timeout = 1<<15;
+ while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
+ if (--timeout < 0)
+ break;
+
+ dz->tcr = tcr;
+ splx(s);
+}
+
+void
+dzcnpollc(dev, pollflag)
+ dev_t dev;
+ int pollflag;
+{
+ static u_char mask;
+
+ switch (vax_boardtype) {
+#ifdef VAX60
+ case VAX_BTYP_60:
+ break;
+#endif
+
+ default:
+ if (pollflag)
+ mask = vsbus_setmask(0);
+ else
+ vsbus_setmask(mask);
+ break;
+ }
+}
--- /dev/null
+/* $OpenBSD: dzinput.c,v 1.1 2008/08/18 23:04:28 miod Exp $ */
+/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
+/*
+ * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Common input routines used by dzkbd and dzms devices.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <vax/qbus/dzreg.h>
+#include <vax/qbus/dzvar.h>
+
+#include <vax/dec/dzkbdvar.h>
+
+#include <dev/cons.h>
+
+cons_decl(dz);
+
+int
+dz_print(void *aux, const char *name)
+{
+ struct dzkm_attach_args *dz_args = aux;
+
+ if (name != NULL)
+ printf(dz_args->daa_line == 0 ? "lkkbd at %s" : "lkms at %s",
+ name);
+ else
+ printf(" line %d", dz_args->daa_line);
+
+ return (UNCONF);
+}
+
+void
+dzputc(struct dz_linestate *ls, int ch)
+{
+ int line;
+ u_short tcr;
+ int s;
+
+ /*
+ * If the dz has already been attached, the MI
+ * driver will do the transmitting...
+ */
+ if (ls && ls->dz_sc) {
+ s = spltty();
+ line = ls->dz_line;
+ putc(ch, &ls->dz_tty->t_outq);
+ tcr = DZ_READ_WORD(ls->dz_sc, dr_tcr);
+ if (!(tcr & (1 << line)))
+ DZ_WRITE_WORD(ls->dz_sc, dr_tcr, tcr | (1 << line));
+ dzxint(ls->dz_sc);
+ splx(s);
+ return;
+ }
+
+ /*
+ * Otherwise, use dzcnputc to do the transmitting.
+ * This situation only happens for a console keyboard, which is
+ * why the minor is hardcoded to the line number. Also, dzcnputc()
+ * does not care about the major number, so we skip a not-so-cheap
+ * getminor() call.
+ */
+ dzcnputc(makedev(0 /*getmajor(dzopen)*/, 0), ch);
+}
-/* $OpenBSD: dzkbd.c,v 1.12 2006/08/27 16:50:43 miod Exp $ */
+/* $OpenBSD: dzkbd.c,v 1.13 2008/08/18 23:04:28 miod Exp $ */
/* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
/*
}
int
-dzkbd_cnattach(struct dz_linestate *ls)
+dzkbd_cnattach()
{
+ /*
+ * Early operation (especially keyboard initialization)
+ * requires the help of the serial console routines, which
+ * need to be initialized to work with the keyboard line.
+ */
+ dzcninit_internal(0);
dzkbd_console_internal.dzi_ks.attmt.sendchar = dzkbd_sendchar;
- dzkbd_console_internal.dzi_ks.attmt.cookie = ls;
+ dzkbd_console_internal.dzi_ks.attmt.cookie = NULL;
lk201_init(&dzkbd_console_internal.dzi_ks);
- dzkbd_console_internal.dzi_ls = ls;
+ dzkbd_console_internal.dzi_ls = NULL;
wskbd_cnattach(&dzkbd_consops, &dzkbd_console_internal,
&dzkbd_keymapdata);
dzkbd_cngetc(void *v, u_int *type, int *data)
{
struct dzkbd_internal *dzi = v;
- int c;
+#if 0
+ int line = dzi->dzi_ls != NULL ? dzi->dzi_ls->dz_line : 0;
+#else
+ int line = 0; /* keyboard */
+#endif
+ int c, s;
do {
- c = dzgetc(dzi->dzi_ls);
+ s = spltty();
+ c = dzcngetc_internal(line);
+ splx(s);
} while (lk201_decode(&dzi->dzi_ks, 1, 0, c, type, data) == LKD_NODATA);
}
-/* $OpenBSD: dzkbdvar.h,v 1.2 2006/07/29 17:06:25 miod Exp $ */
+/* $OpenBSD: dzkbdvar.h,v 1.3 2008/08/18 23:04:28 miod Exp $ */
/* $NetBSD: dzkbdvar.h,v 1.2 2001/03/06 07:40:52 matt Exp $ */
struct dzkm_attach_args {
#define DZKBD_CONSOLE 1
};
+/* dzcons.c */
+int dz_can_have_kbd(void);
+void dzcninit_internal(int);
+int dzcngetc_internal(int);
+/* dzinput.c */
+void dzputc(struct dz_linestate *, int);
+int dz_print(void *, const char *);
-/* These functions must be present for the keyboard/mouse to work */
-int dzgetc(struct dz_linestate *);
-void dzputc(struct dz_linestate *, int);
-
-/* Exported functions */
-int dzkbd_cnattach(struct dz_linestate *);
+/* dzkbd.c */
+int dzkbd_cnattach(void);
-# $OpenBSD: files.dec,v 1.4 2006/08/27 16:52:15 miod Exp $
+# $OpenBSD: files.dec,v 1.5 2008/08/18 23:04:28 miod Exp $
# $NetBSD: files.dec,v 1.4 1999/08/04 07:17:51 nisimura Exp $
#
# Config file and device description for machine-independent
# code for devices for Digital Equipment Corp. systems.
# Included by ports that need it.
+# Console on DZ11-like serial ports
+file arch/vax/dec/dzcons.c dzcons
+
# LK201 keyboard
file arch/vax/dec/lk201_ws.c lkkbd
file arch/vax/dec/wskbdmap_lk201.c lkkbd
-/* $OpenBSD: wscons_machdep.c,v 1.4 2008/01/23 16:37:57 jsing Exp $ */
+/* $OpenBSD: wscons_machdep.c,v 1.5 2008/08/18 23:04:28 miod Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
switch (vax_bustype) {
case VAX_VSBUS:
#if NDZKBD > 0
- dzkbd_cnattach(0); /* Connect keyboard and screen together */
+ dzkbd_cnattach();
#endif
break;
case VAX_VXTBUS:
-/* $OpenBSD: dz_ibus.c,v 1.25 2008/08/15 22:44:12 miod Exp $ */
+/* $OpenBSD: dz_ibus.c,v 1.26 2008/08/18 23:04:28 miod Exp $ */
/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-
#include <sys/param.h>
-#include <sys/proc.h>
#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/file.h>
-#include <sys/conf.h>
#include <sys/device.h>
-#include <sys/reboot.h>
-
-#include <dev/cons.h>
-#include <machine/mtpr.h>
#include <machine/sid.h>
-#include <machine/uvax.h>
#include <machine/vsbus.h>
#include <machine/cpu.h>
#include <machine/scb.h>
-#include <machine/nexus.h>
-#include <machine/ka420.h>
-
-#include <vax/vax/gencons.h>
#include <vax/qbus/dzreg.h>
#include <vax/qbus/dzvar.h>
#include <vax/dec/dzkbdvar.h>
+#include <dev/cons.h>
+
#include "dzkbd.h"
#include "dzms.h"
-static int dz_vsbus_match(struct device *, struct cfdata *, void *);
-static void dz_vsbus_attach(struct device *, struct device *, void *);
-
-static vaddr_t dz_regs; /* Used for console */
+int dz_vsbus_match(struct device *, struct cfdata *, void *);
+void dz_vsbus_attach(struct device *, struct device *, void *);
struct cfattach dz_vsbus_ca = {
sizeof(struct dz_softc), (cfmatch_t)dz_vsbus_match, dz_vsbus_attach
};
-#define REG(name) short name; short X##name##X;
-static volatile struct ss_dz {/* base address of DZ-controller: 0x200a0000 */
- REG(csr); /* 00 Csr: control/status register */
- REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */
- REG(tcr); /* 08 Tcr: transmit console register */
- REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */
- REG(lpr0); /* 10 Lpr0: */
- REG(lpr1); /* 14 Lpr0: */
- REG(lpr2); /* 18 Lpr0: */
- REG(lpr3); /* 1C Lpr0: */
-} *dz;
-#undef REG
-
-cons_decl(dz);
-cdev_decl(dz);
-
-int dz_can_have_kbd(void);
-
-extern int getmajor(void *); /* conf.c */
-
-#if NDZKBD > 0 || NDZMS > 0
-static int
-dz_print(void *aux, const char *name)
-{
- struct dzkm_attach_args *dz_args = aux;
-
- if (name != NULL)
- printf(dz_args->daa_line == 0 ? "lkkbd at %s" : "lkms at %s",
- name);
- else
- printf(" line %d", dz_args->daa_line);
-
- return (UNCONF);
-}
-#endif
+#define DZ_VSBUS_CSR 0
+#define DZ_VSBUS_RBUF 4
+#define DZ_VSBUS_DTR 9
+#define DZ_VSBUS_BREAK 13
+#define DZ_VSBUS_TBUF 12
+#define DZ_VSBUS_TCR 8
+#define DZ_VSBUS_DCD 13
+#define DZ_VSBUS_RING 13
-static int
+int
dz_vsbus_match(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct vsbus_attach_args *va = aux;
- struct ss_dz *dzP;
+ volatile uint16_t *dzP;
short i;
#if VAX53 || VAX49
return 0; /* don't probe unnecessarily */
#endif
- dzP = (struct ss_dz *)va->va_addr;
- i = dzP->tcr;
- dzP->csr = DZ_CSR_MSE|DZ_CSR_TXIE;
- dzP->tcr = 0;
+ dzP = (volatile uint16_t *)va->va_addr;
+ i = dzP[DZ_VSBUS_TCR / 2];
+ dzP[DZ_VSBUS_CSR / 2] = DZ_CSR_MSE|DZ_CSR_TXIE;
+ dzP[DZ_VSBUS_TCR / 2] = 0;
DELAY(1000);
- dzP->tcr = 1;
+ dzP[DZ_VSBUS_TCR / 2] = 1;
DELAY(100000);
- dzP->tcr = i;
+ dzP[DZ_VSBUS_TCR / 2] = i;
/* If the device doesn't exist, no interrupt has been generated */
return 1;
}
-static void
+void
dz_vsbus_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
#if NDZKBD > 0 || NDZMS > 0
struct dzkm_attach_args daa;
#endif
+ extern vaddr_t dz_console_regs;
+ vaddr_t dz_regs;
printf(": ");
+ /*
+ * This assumes that systems where dz@vsbus exist and can be
+ * the console device, can only have one instance of dz@vsbus.
+ * So far, so good.
+ */
+ if (dz_console_regs != 0) {
+ dz_regs = dz_console_regs;
+ printf("console, ");
+ } else
+ dz_regs = vax_map_physmem(va->va_paddr, 1);
+
/*
* XXX - This is evil and ugly, but...
* due to the nature of how bus_space_* works on VAX, this will
* be perfectly good until everything is converted.
*/
-
- if (dz_regs == 0) /* This isn't console */
- dz_regs = vax_map_physmem(va->va_paddr, 1);
- else
- printf("console, ");
-
sc->sc_ioh = dz_regs;
- sc->sc_dr.dr_csr = 0;
- sc->sc_dr.dr_rbuf = 4;
- sc->sc_dr.dr_dtr = 9;
- sc->sc_dr.dr_break = 13;
- sc->sc_dr.dr_tbuf = 12;
- sc->sc_dr.dr_tcr = 8;
- sc->sc_dr.dr_dcd = 13;
- sc->sc_dr.dr_ring = 13;
+ sc->sc_dr.dr_csr = DZ_VSBUS_CSR;
+ sc->sc_dr.dr_rbuf = DZ_VSBUS_RBUF;
+ sc->sc_dr.dr_dtr = DZ_VSBUS_DTR;
+ sc->sc_dr.dr_break = DZ_VSBUS_BREAK;
+ sc->sc_dr.dr_tbuf = DZ_VSBUS_TBUF;
+ sc->sc_dr.dr_tcr = DZ_VSBUS_TCR;
+ sc->sc_dr.dr_dcd = DZ_VSBUS_DCD;
+ sc->sc_dr.dr_ring = DZ_VSBUS_RING;
sc->sc_type = DZ_DZV;
sc->sc_dsr = 0x0f; /* XXX check if VS has modem ctrl bits */
sc->sc_rcvec = va->va_cvec;
- scb_vecalloc(sc->sc_rcvec, dzxint, sc, SCB_ISTACK,
- &sc->sc_tintrcnt);
+ scb_vecalloc(sc->sc_rcvec, dzxint, sc, SCB_ISTACK, &sc->sc_tintrcnt);
sc->sc_tcvec = va->va_cvec - 4;
- scb_vecalloc(sc->sc_tcvec, dzrint, sc, SCB_ISTACK,
- &sc->sc_rintrcnt);
+ scb_vecalloc(sc->sc_tcvec, dzrint, sc, SCB_ISTACK, &sc->sc_rintrcnt);
evcount_attach(&sc->sc_rintrcnt, sc->sc_dev.dv_xname,
(void *)&sc->sc_rcvec, &evcount_intr);
evcount_attach(&sc->sc_tintrcnt, sc->sc_dev.dv_xname,
#if NDZKBD > 0
extern struct consdev wsdisplay_cons;
- dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8)
- | DZ_LPR_8_BIT_CHAR;
daa.daa_line = 0;
+ DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE |
+ (DZ_LPR_B4800 << 8) | DZ_LPR_8_BIT_CHAR | daa.daa_line);
daa.daa_flags =
(cn_tab == &wsdisplay_cons ? DZKBD_CONSOLE : 0);
config_found(self, &daa, dz_print);
#endif
#if NDZMS > 0
- dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) |
- DZ_LPR_8_BIT_CHAR | DZ_LPR_PARENB | DZ_LPR_OPAR |
- 1 /* line */;
daa.daa_line = 1;
+ DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE |
+ (DZ_LPR_B4800 << 8) | DZ_LPR_8_BIT_CHAR | DZ_LPR_PARENB |
+ DZ_LPR_OPAR | daa.daa_line);
daa.daa_flags = 0;
config_found(self, &daa, dz_print);
#endif
splx(s);
#endif
}
-
-int
-dzcngetc(dev)
- dev_t dev;
-{
- int c = 0, s;
- int mino = minor(dev);
- u_short rbuf;
-
- s = spltty();
- do {
- while ((dz->csr & DZ_CSR_RX_DONE) == 0)
- ; /* Wait for char */
- rbuf = dz->rbuf;
- if (((rbuf >> 8) & 3) != mino)
- continue;
- c = rbuf & 0x7f;
- } while (c == 17 || c == 19); /* ignore XON/XOFF */
- splx(s);
-
- if (c == 13)
- c = 10;
-
- return (c);
-}
-
-int
-dz_can_have_kbd()
-{
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if ((vax_confdata & KA420_CFG_MULTU) == 0)
- return (1);
- break;
-
- case VAX_BTYP_46:
- if ((vax_siedata & 0xff) == VAX_VTYP_46)
- return (1);
- break;
- case VAX_BTYP_48:
- if (((vax_siedata >> 8) & 0xff) == VAX_STYP_48)
- return (1);
- break;
-
- case VAX_BTYP_49:
- return (1);
-
- default:
- break;
- }
-
- return (0);
-}
-
-void
-dzcnprobe(cndev)
- struct consdev *cndev;
-{
- extern vaddr_t iospace;
- int diagcons, major;
- paddr_t ioaddr = 0x200a0000;
-
- if ((major = getmajor(dzopen)) < 0)
- return;
-
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- diagcons = (vax_confdata & KA420_CFG_L3CON ? 3 : 0);
- break;
-
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- diagcons = (vax_confdata & 0x100 ? 3 : 0);
- break;
-
- case VAX_BTYP_49:
- ioaddr = 0x25000000;
- diagcons = (vax_confdata & 8 ? 3 : 0);
- break;
-
- case VAX_BTYP_1303:
- ioaddr = 0x25000000;
- diagcons = 3;
- break;
-
- default:
- return;
- }
- cndev->cn_pri = diagcons != 0 ? CN_HIGHPRI : CN_LOWPRI;
- cndev->cn_dev = makedev(major, dz_can_have_kbd() ? 3 : diagcons);
- dz_regs = iospace;
- dz = (void *)dz_regs;
- ioaccess(iospace, ioaddr, 1);
-}
-
-void
-dzcninit(cndev)
- struct consdev *cndev;
-{
- dz = (void *)dz_regs;
-
- dz->csr = 0; /* Disable scanning until initting is done */
- dz->tcr = (1 << minor(cndev->cn_dev)); /* Turn on xmitter */
- dz->csr = DZ_CSR_MSE; /* Turn scanning back on */
- dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B9600 << 8) |
- DZ_LPR_8_BIT_CHAR | minor(cndev->cn_dev) /* line */;
-}
-
-void
-dzcnputc(dev,ch)
- dev_t dev;
- int ch;
-{
- int timeout = 1<<15; /* don't hang the machine! */
- int s;
- int mino = minor(dev);
- u_short tcr;
-
- if (mfpr(PR_MAPEN) == 0)
- return;
-
- /*
- * If we are past boot stage, dz* will interrupt,
- * therefore we block.
- */
- s = spltty();
- tcr = dz->tcr; /* remember which lines to scan */
- dz->tcr = (1 << mino);
-
- while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
- if (--timeout < 0)
- break;
- dz->tdr = ch; /* Put the character */
- timeout = 1<<15;
- while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
- if (--timeout < 0)
- break;
-
- dz->tcr = tcr;
- splx(s);
-}
-
-void
-dzcnpollc(dev, pollflag)
- dev_t dev;
- int pollflag;
-{
- static u_char mask;
-
- if (pollflag)
- mask = vsbus_setmask(0);
- else
- vsbus_setmask(mask);
-}
-
-#if NDZKBD > 0 || NDZMS > 0
-int
-dzgetc(struct dz_linestate *ls)
-{
- int line;
- int s;
- u_short rbuf;
-
- if (ls != NULL)
- line = ls->dz_line;
- else
- line = 0; /* keyboard */
-
- s = spltty();
- for (;;) {
- for(; (dz->csr & DZ_CSR_RX_DONE) == 0;)
- ;
- rbuf = dz->rbuf;
- if (((rbuf >> 8) & 3) == line) {
- splx(s);
- return (rbuf & 0xff);
- }
- }
-}
-
-void
-dzputc(struct dz_linestate *ls, int ch)
-{
- int line;
- u_short tcr;
- int s;
-
- /* if the dz has already been attached, the MI
- driver will do the transmitting: */
- if (ls && ls->dz_sc) {
- s = spltty();
- line = ls->dz_line;
- putc(ch, &ls->dz_tty->t_outq);
- tcr = dz->tcr;
- if (!(tcr & (1 << line)))
- dz->tcr = tcr | (1 << line);
- dzxint(ls->dz_sc);
- splx(s);
- return;
- }
- /* use dzcnputc to do the transmitting: */
- dzcnputc(makedev(getmajor(dzopen), 0), ch);
-}
-#endif /* NDZKBD > 0 || NDZMS > 0 */