summaryrefslogtreecommitdiff
path: root/sys/arch/vax/qbus
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-07-29 17:06:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-07-29 17:06:28 +0000
commit79edeb311081330b02ec8a86c84211f82b1f78d5 (patch)
treefe08045fafe951b275a5413e71e0cbd0fc67fdbd /sys/arch/vax/qbus
parent7be8c12978f2b3f6aaf65e85a36ba1b0a634b759 (diff)
Sync dz and lk{kbd,ms} code with NetBSD, this allows keyboards to work when
initialized by the PROM.
Diffstat (limited to 'sys/arch/vax/qbus')
-rw-r--r--sys/arch/vax/qbus/dz.c47
-rw-r--r--sys/arch/vax/qbus/dz_uba.c13
-rw-r--r--sys/arch/vax/qbus/dzreg.h18
3 files changed, 33 insertions, 45 deletions
diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c
index 0001eae092a..16cc70b7a38 100644
--- a/sys/arch/vax/qbus/dz.c
+++ b/sys/arch/vax/qbus/dz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dz.c,v 1.12 2004/09/19 21:34:42 mickey Exp $ */
+/* $OpenBSD: dz.c,v 1.13 2006/07/29 17:06:27 miod Exp $ */
/* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */
/*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@@ -68,13 +68,6 @@
#define DZ_WRITE_WORD(adr, val) \
bus_space_write_2(sc->sc_iot, sc->sc_ioh, sc->sc_dr.adr, val)
-/* A DZ-11 has 8 ports while a DZV/DZQ-11 has only 4. We use 8 by default */
-
-#define NDZLINE 8
-
-#define DZ_C2I(c) ((c)<<3) /* convert controller # to index */
-#define DZ_I2C(c) ((c)>>3) /* convert minor to controller # */
-#define DZ_PORT(u) ((u)&07) /* extract the port # */
/* Flags used to monitor modem bits, make them understood outside driver */
@@ -125,9 +118,6 @@ int dz_timer = 0; /* true if timer started */
struct timeout dz_timeout;
-#define DZ_DZ 8 /* Unibus DZ-11 board linecount */
-#define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */
-
void
dzattach(struct dz_softc *sc)
{
@@ -143,8 +133,11 @@ dzattach(struct dz_softc *sc)
/* Initialize our softc structure. Should be done in open? */
- for (n = 0; n < sc->sc_type; n++)
+ for (n = 0; n < sc->sc_type; n++) {
+ sc->sc_dz[n].dz_sc = sc;
+ sc->sc_dz[n].dz_line = n;
sc->sc_dz[n].dz_tty = ttymalloc();
+ }
/* Alas no interrupt on modem bit changes, so we manually scan */
@@ -154,7 +147,6 @@ dzattach(struct dz_softc *sc)
timeout_add(&dz_timeout, hz);
}
printf("\n");
- return;
}
/* Receiver Interrupt */
@@ -197,7 +189,7 @@ dzrint(void *arg)
if (c & DZ_RBUF_PARITY_ERR)
cc |= TTY_PE;
-#if defined(DDB) && (defined(VAX410) || defined(VAX43) || defined(VAX46) || defined(VAX53))
+#if defined(DDB) && (defined(VAX410) || defined(VAX43) || defined(VAX46) || defined(VAX48) || defined(VAX49) || defined(VAX53))
if (tp->t_dev == cn_tab->cn_dev) {
int j = kdbrint(cc);
@@ -263,6 +255,8 @@ dzxint(void *arg)
tcr &= 255;
tcr &= ~(1 << line);
DZ_WRITE_BYTE(dr_tcr, tcr);
+ if (sc->sc_dz[line].dz_catch)
+ continue;
if (tp->t_state & TS_FLUSH)
tp->t_state &= ~TS_FLUSH;
@@ -291,12 +285,16 @@ dzopen(dev_t dev, int flag, int mode, struct proc *p)
sc = dz_cd.cd_devs[unit];
- if (sc->sc_openings++ == 0)
- dzdrain(sc);
-
if (line >= sc->sc_type)
return ENXIO;
+ /* if some other device is using the line, it's busy */
+ if (sc->sc_dz[line].dz_catch)
+ return EBUSY;
+
+ if (sc->sc_openings++ == 0)
+ dzdrain(sc);
+
tp = sc->sc_dz[line].dz_tty;
if (tp == NULL)
return (ENODEV);
@@ -402,6 +400,7 @@ dzioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
+
error = ttioctl(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
@@ -478,8 +477,10 @@ dzstart(struct tty *tp)
sc = dz_cd.cd_devs[unit];
s = spltty();
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
+ if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
+ splx(s);
return;
+ }
cl = &tp->t_outq;
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
@@ -488,8 +489,10 @@ dzstart(struct tty *tp)
}
selwakeup(&tp->t_wsel);
}
- if (cl->c_cc == 0)
+ if (cl->c_cc == 0) {
+ splx(s);
return;
+ }
tp->t_state |= TS_BUSY;
@@ -693,7 +696,6 @@ dzscan(void *arg)
}
splx(s);
timeout_add(&dz_timeout, hz);
- return;
}
/*
@@ -711,7 +713,7 @@ dzreset(struct device *dev)
for (i = 0; i < sc->sc_type; i++) {
tp = sc->sc_dz[i].dz_tty;
- if (((tp->t_state & TS_ISOPEN) == 0))
+ if ((tp->t_state & TS_ISOPEN) == 0)
continue;
dzparam(tp, &tp->t_termios);
@@ -725,7 +727,8 @@ dzreset(struct device *dev)
* Drain RX fifo.
*/
static void
-dzdrain(struct dz_softc *sc) {
+dzdrain(struct dz_softc *sc)
+{
while (DZ_READ_WORD(dr_rbuf) & DZ_RBUF_DATA_VALID)
/*EMPTY*/;
}
diff --git a/sys/arch/vax/qbus/dz_uba.c b/sys/arch/vax/qbus/dz_uba.c
index 9a342aeccf3..5c64cc823f2 100644
--- a/sys/arch/vax/qbus/dz_uba.c
+++ b/sys/arch/vax/qbus/dz_uba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dz_uba.c,v 1.5 2004/07/09 15:57:16 deraadt Exp $ */
+/* $OpenBSD: dz_uba.c,v 1.6 2006/07/29 17:06:27 miod Exp $ */
/* $NetBSD: dz_uba.c,v 1.11 2000/06/04 06:17:02 matt Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -71,11 +71,12 @@ dz_uba_match(parent, cf, aux)
void *aux;
{
struct uba_attach_args *ua = aux;
+#ifdef notdef
bus_space_tag_t iot = ua->ua_iot;
+#endif
bus_space_handle_t ioh = ua->ua_ioh;
int n;
- iot = iot; /* Silly GCC */
/* Reset controller to initialize, enable TX interrupts */
/* to catch floating vector info elsewhere when completed */
@@ -129,16 +130,16 @@ dz_uba_attach(parent, self, aux)
sc->sc_type = DZ_DZ;
/* Now register the TX & RX interrupt handlers */
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec,
+ sc->sc_tcvec = ua->ua_cvec;
+ uba_intr_establish(ua->ua_icookie, sc->sc_tcvec,
dzxint, sc, &sc->sc_tintrcnt);
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4,
+ sc->sc_rcvec = ua->ua_cvec - 4;
+ uba_intr_establish(ua->ua_icookie, sc->sc_rcvec,
dzrint, sc, &sc->sc_rintrcnt);
uba_reset_establish(dzreset, self);
- sc->sc_rcvec = ua->ua_cvec - 4;
evcount_attach(&sc->sc_rintrcnt, sc->sc_dev.dv_xname,
(void *)&sc->sc_rcvec, &evcount_intr);
- sc->sc_tcvec = ua->ua_cvec;
evcount_attach(&sc->sc_tintrcnt, sc->sc_dev.dv_xname,
(void *)&sc->sc_tcvec, &evcount_intr);
diff --git a/sys/arch/vax/qbus/dzreg.h b/sys/arch/vax/qbus/dzreg.h
index 8f046c50fa0..613a581c866 100644
--- a/sys/arch/vax/qbus/dzreg.h
+++ b/sys/arch/vax/qbus/dzreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dzreg.h,v 1.1 2000/04/27 03:14:47 bjc Exp $ */
+/* $OpenBSD: dzreg.h,v 1.2 2006/07/29 17:06:27 miod Exp $ */
/* $NetBSD: dzreg.h,v 1.4 1999/05/27 16:03:13 ragge Exp $ */
/*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@@ -51,20 +51,6 @@ struct DZregs
typedef struct DZregs dzregs;
-#if 0
-struct dz_regs {
- volatile unsigned short *dr_csr;
- volatile unsigned short *dr_rbuf;
-#define dr_lpr dr_rbuf
- volatile unsigned char *dr_dtr;
- volatile unsigned char *dr_break;
- volatile unsigned char *dr_tbuf;
- volatile unsigned char *dr_tcr;
- volatile unsigned short *dr_tcrw;
- volatile unsigned char *dr_ring;
- volatile unsigned char *dr_dcd;
-};
-#else
struct dz_regs {
bus_addr_t dr_csr;
bus_addr_t dr_rbuf;
@@ -86,8 +72,6 @@ struct dz_regs {
#define DZ_UBA_DCD 7
#define DZ_UBA_RING 6
-#endif
-
/* CSR bits */
#define DZ_CSR_TX_READY 0100000 /* Transmitter Ready */