Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/qbus Fix map register/DMA wait queues.
details: https://anonhg.NetBSD.org/src/rev/d2d5a7806d8b
branches: trunk
changeset: 473530:d2d5a7806d8b
user: ragge <ragge%NetBSD.org@localhost>
date: Sun Jun 06 19:14:48 1999 +0000
description:
Fix map register/DMA wait queues.
Still to do:
BDP handling. Currently missing.
Ubareset's won't work at all.
diffstat:
sys/dev/qbus/dhu.c | 44 ++++---
sys/dev/qbus/dl.c | 7 +-
sys/dev/qbus/dz.c | 9 +-
sys/dev/qbus/dz_uba.c | 9 +-
sys/dev/qbus/files.uba | 21 ++-
sys/dev/qbus/uba.c | 280 ++++--------------------------------------------
sys/dev/qbus/ubavar.h | 66 +---------
sys/dev/qbus/uda.c | 202 ++++++++++++++++++----------------
8 files changed, 195 insertions(+), 443 deletions(-)
diffs (truncated from 1069 to 300 lines):
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/dhu.c
--- a/sys/dev/qbus/dhu.c Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/dhu.c Sun Jun 06 19:14:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dhu.c,v 1.15 1999/05/28 20:17:29 ragge Exp $ */
+/* $NetBSD: dhu.c,v 1.16 1999/06/06 19:14:48 ragge Exp $ */
/*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
* Copyright (c) 1992, 1993
@@ -71,10 +71,11 @@
int sc_type; /* controller type, DHU or DHV */
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
+ bus_dma_tag_t sc_dmat;
struct {
struct tty *dhu_tty; /* what we work on */
+ bus_dmamap_t dhu_dmah;
int dhu_state; /* to manage TX output status */
- int dhu_txaddr; /* UBA map address to TX buf */
short dhu_cc; /* character count on TX */
short dhu_modem; /* modem bits state */
} sc_dhu[NDHULINE];
@@ -207,10 +208,11 @@
register struct dhu_softc *sc = (void *)self;
register struct uba_attach_args *ua = aux;
register unsigned c;
- register int n;
+ register int n, i;
sc->sc_iot = ua->ua_iot;
sc->sc_ioh = ua->ua_ioh;
+ sc->sc_dmat = ua->ua_dmat;
/* Process the 8 bytes of diagnostic info put into */
/* the FIFO following the master reset operation. */
@@ -233,6 +235,18 @@
sc->sc_type = (c & DHU_STAT_DHU)? IS_DHU: IS_DHV;
printf("\n%s: DH%s-11\n", self->dv_xname, (c & DHU_STAT_DHU)?"U":"V");
+ for (i = 0; i < sc->sc_type; i++) {
+ struct tty *tp;
+ tp = sc->sc_dhu[i].dhu_tty = ttymalloc();
+ sc->sc_dhu[i].dhu_state = STATE_IDLE;
+ bus_dmamap_create(sc->sc_dmat, tp->t_outq.c_cn, 1,
+ tp->t_outq.c_cn, 0, BUS_DMA_ALLOCNOW|BUS_DMA_NOWAIT,
+ &sc->sc_dhu[i].dhu_dmah);
+ bus_dmamap_load(sc->sc_dmat, sc->sc_dhu[i].dhu_dmah,
+ tp->t_outq.c_cs, tp->t_outq.c_cn, 0, BUS_DMA_NOWAIT);
+
+ }
+
/* Now stuff TX interrupt handler in place */
scb_vecalloc(ua->ua_cvec + 4, dhuxint, self->dv_unit, SCB_ISTACK);
}
@@ -365,24 +379,12 @@
if (line >= sc->sc_type)
return ENXIO;
- tp = sc->sc_dhu[line].dhu_tty;
- if (tp == NULL) {
-
- tp = sc->sc_dhu[line].dhu_tty = ttymalloc();
- if (tp == NULL)
- return ENXIO;
-
- sc->sc_dhu[line].dhu_state = STATE_IDLE;
+ s = spltty();
+ DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
+ sc->sc_dhu[line].dhu_modem = DHU_READ_WORD(DHU_UBA_STAT);
+ (void) splx(s);
- sc->sc_dhu[line].dhu_txaddr =
- uballoc((struct uba_softc *)sc->sc_dev.dv_parent,
- tp->t_outq.c_cs, tp->t_outq.c_cn, 0);
-
- s = spltty();
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
- sc->sc_dhu[line].dhu_modem = DHU_READ_WORD(DHU_UBA_STAT);
- (void) splx(s);
- }
+ tp = sc->sc_dhu[line].dhu_tty;
tp->t_oproc = dhustart;
tp->t_param = dhuparam;
@@ -634,7 +636,7 @@
sc->sc_dhu[line].dhu_state = STATE_DMA_RUNNING;
- addr = UBAI_ADDR(sc->sc_dhu[line].dhu_txaddr) +
+ addr = sc->sc_dhu[line].dhu_dmah->dm_segs[0].ds_addr +
(tp->t_outq.c_cf - tp->t_outq.c_cs);
DHU_WRITE_WORD(DHU_UBA_TBUFCNT, cc);
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/dl.c
--- a/sys/dev/qbus/dl.c Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/dl.c Sun Jun 06 19:14:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dl.c,v 1.9 1999/05/27 16:00:45 ragge Exp $ */
+/* $NetBSD: dl.c,v 1.10 1999/06/06 19:14:49 ragge Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -97,10 +97,9 @@
#include <machine/bus.h>
#include <machine/scb.h>
-#include <dev/dec/qbus/ubareg.h>
-#include <dev/dec/qbus/ubavar.h>
+#include <dev/qbus/ubavar.h>
-#include <dev/dec/qbus/dlreg.h>
+#include <dev/qbus/dlreg.h>
#include "ioconf.h"
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/dz.c
--- a/sys/dev/qbus/dz.c Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/dz.c Sun Jun 06 19:14:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dz.c,v 1.17 1999/05/27 16:02:32 ragge Exp $ */
+/* $NetBSD: dz.c,v 1.18 1999/06/06 19:14:49 ragge Exp $ */
/*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
* Copyright (c) 1992, 1993
@@ -61,11 +61,8 @@
#include <machine/trap.h>
#include <machine/cpu.h>
-#include <dev/dec/qbus/ubareg.h>
-#include <dev/dec/qbus/ubavar.h>
-
-#include <dev/dec/qbus/dzreg.h>
-#include <dev/dec/qbus/dzvar.h>
+#include <dev/qbus/dzreg.h>
+#include <dev/qbus/dzvar.h>
#define DZ_READ_BYTE(adr) \
bus_space_read_1(sc->sc_iot, sc->sc_ioh, sc->sc_dr.adr)
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/dz_uba.c
--- a/sys/dev/qbus/dz_uba.c Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/dz_uba.c Sun Jun 06 19:14:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dz_uba.c,v 1.6 1999/05/27 16:02:50 ragge Exp $ */
+/* $NetBSD: dz_uba.c,v 1.7 1999/06/06 19:14:49 ragge Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@@ -49,11 +49,10 @@
#include <machine/trap.h>
#include <machine/scb.h>
-#include <dev/dec/qbus/ubareg.h>
-#include <dev/dec/qbus/ubavar.h>
+#include <dev/qbus/ubavar.h>
-#include <dev/dec/qbus/dzreg.h>
-#include <dev/dec/qbus/dzvar.h>
+#include <dev/qbus/dzreg.h>
+#include <dev/qbus/dzvar.h>
#include "ioconf.h"
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/files.uba
--- a/sys/dev/qbus/files.uba Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/files.uba Sun Jun 06 19:14:48 1999 +0000
@@ -1,19 +1,30 @@
-# $NetBSD: files.uba,v 1.4 1999/05/27 16:03:57 ragge Exp $
+# $NetBSD: files.uba,v 1.5 1999/06/06 19:14:49 ragge Exp $
#
# Config file and device description for machine-independent
# code for devices Digital Equipment Corp. Unibus and Q22 bus.
# Included by ports that need it.
device uba { csr }
-file dev/dec/uba/uba.c uba & new_uba
+file dev/qbus/uba.c uba & new_uba
# DZ-11 (-compatible) tty device driver.
device dz { }: tty
attach dz at uba with dz_uba
-file dev/dec/qbus/dz.c dz needs-flag
-file dev/dec/qbus/dz_uba.c dz_uba & new_uba
+file dev/qbus/dz.c dz needs-flag
+file dev/qbus/dz_uba.c dz_uba & new_uba
# DL-11 at UBA
device dl: tty
attach dl at uba
-file dev/dec/qbus/dl.c dl needs-flag
+file dev/qbus/dl.c dl needs-flag
+
+# DHU-11 at UBA
+device dhu: tty
+attach dhu at uba
+file dev/qbus/dhu.c dhu needs-flag
+
+device mtc: mscp
+attach mtc at uba
+device uda: mscp
+attach uda at uba
+file dev/qbus/uda.c uda | mtc
diff -r db23dc8640e9 -r d2d5a7806d8b sys/dev/qbus/uba.c
--- a/sys/dev/qbus/uba.c Sun Jun 06 19:10:49 1999 +0000
+++ b/sys/dev/qbus/uba.c Sun Jun 06 19:14:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uba.c,v 1.46 1999/05/27 16:04:13 ragge Exp $ */
+/* $NetBSD: uba.c,v 1.47 1999/06/06 19:14:49 ragge Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@@ -58,261 +58,52 @@
#include <machine/scb.h>
#include <machine/cpu.h>
-#ifdef __vax__
-#include <machine/pte.h>
-#endif
+#include <dev/qbus/ubavar.h>
-#include <dev/dec/qbus/ubareg.h>
-#include <dev/dec/qbus/ubavar.h>
+#include "ioconf.h"
static int ubasearch __P((struct device *, struct cfdata *, void *));
static int ubaprint __P((void *, const char *));
-static void ubainitmaps __P((struct uba_softc *));
-
-extern struct cfdriver uba_cd;
-
-#define spluba spl7
/*
- * Do transfer on device argument. The controller
- * and uba involved are implied by the device.
- * We queue for resource wait in the uba code if necessary.
- * We return 1 if the transfer was started, 0 if it was not.
- *
- * The onq argument must be zero iff the device is not on the
- * queue for this UBA. If onq is set, the device must be at the
- * head of the queue. In any case, if the transfer is started,
- * the device will be off the queue, and if not, it will be on.
- *
- * Drivers that allocate one BDP and hold it for some time should
- * set ud_keepbdp. In this case um_bdp tells which BDP is allocated
- * to the controller, unless it is zero, indicating that the controller
- * does not now have a BDP.
+ * If we failed to allocate uba resources, put us on a queue to wait
+ * until there is available resources. Resources to compete about
+ * are map registers and BDPs. This is normally only a problem on
+ * Unibus systems, Qbus systems have more map registers than usable.
*/
-int
-ubaqueue(uu, bp)
- register struct uba_unit *uu;
- struct buf *bp;
+void
+uba_enqueue(uu)
+ struct uba_unit *uu;
{
- register struct uba_softc *uh;
- register int s;
+ struct uba_softc *uh;
+ int s;
uh = (void *)((struct device *)(uu->uu_softc))->dv_parent;
- s = spluba();
- /*
- * Honor exclusive BDP use requests.
- */
- if ((uu->uu_xclu && uh->uh_users > 0) || uh->uh_xclu)
- goto rwait;
- if (uu->uu_keepbdp) {
- /*
- * First get just a BDP (though in fact it comes with
- * one map register too).
- */
- if (uu->uu_bdp == 0) {
- uu->uu_bdp = uballoc(uh, (caddr_t)0, 0,
- UBA_NEEDBDP|UBA_CANTWAIT);
- if (uu->uu_bdp == 0)
- goto rwait;
- }
- /* now share it with this transfer */
- uu->uu_ubinfo = ubasetup(uh, bp,
- uu->uu_bdp|UBA_HAVEBDP|UBA_CANTWAIT);
- } else
- uu->uu_ubinfo = ubasetup(uh, bp, UBA_NEEDBDP|UBA_CANTWAIT);
- if (uu->uu_ubinfo == 0)
- goto rwait;
- uh->uh_users++;
- if (uu->uu_xclu)
- uh->uh_xclu = 1;
- splx(s);
- return (1);
-
-rwait:
+ s = splimp();
SIMPLEQ_INSERT_TAIL(&uh->uh_resq, uu, uu_resq);
splx(s);
Home |
Main Index |
Thread Index |
Old Index