summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-08-25 14:52:58 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-08-25 14:52:58 +0000
commit37829d2f9d3a06ea914a93398cda232b3250c495 (patch)
treea19112ff3f096a93490b9a2afb7c4b11085860be /sys/dev
parentec48ce018c8728f707a54f5fbac6bb3ddb5460ff (diff)
deal with 5 arg for of bus_dmamap_sync() if available
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/isp_pci.c22
-rw-r--r--sys/dev/pci/pcscp.c16
-rw-r--r--sys/dev/pci/yds.c71
3 files changed, 76 insertions, 33 deletions
diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c
index e4aaa8277f5..45306e85e0d 100644
--- a/sys/dev/pci/isp_pci.c
+++ b/sys/dev/pci/isp_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_pci.c,v 1.20 2001/08/25 10:13:29 art Exp $ */
+/* $OpenBSD: isp_pci.c,v 1.21 2001/08/25 14:52:57 jason Exp $ */
/*
* PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
*
@@ -242,6 +242,13 @@ static struct ispmdvec mdvec_2200 = {
#define BUS_DMA_COHERENT BUS_DMAMEM_NOSYNC
#endif
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define isp_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (o), (l), (f))
+#else
+#define isp_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (f))
+#endif
static int isp_pci_probe (struct device *, void *, void *);
static void isp_pci_attach (struct device *, struct device *, void *);
@@ -908,13 +915,14 @@ isp_pci_dmasetup(struct ispsoftc *isp, XS_T *xs, ispreq_t *rq, u_int16_t *iptrp,
} while (seg < segcnt);
dmasync:
- bus_dmamap_sync(pci->pci_dmat, dmap, (xs->flags & SCSI_DATA_IN) ?
+ isp_bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize,
+ (xs->flags & SCSI_DATA_IN) ?
BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
mbxsync:
ISP_SWIZZLE_REQUEST(isp, rq);
- bus_dmamap_sync(pci->pci_dmat, pci->pci_rquest_dmap,
- BUS_DMASYNC_PREWRITE);
+ isp_bus_dmamap_sync(pci->pci_dmat, pci->pci_rquest_dmap, 0,
+ pci->pci_request_dmap->dm_mapsize, BUS_DMASYNC_PREWRITE);
return (CMD_QUEUED);
}
@@ -925,7 +933,8 @@ isp_pci_intr(void *arg)
struct ispsoftc *isp = (struct ispsoftc *)arg;
struct isp_pcisoftc *p = (struct isp_pcisoftc *)isp;
- bus_dmamap_sync(p->pci_dmat, p->pci_result_dmap, BUS_DMASYNC_POSTREAD);
+ isp_bus_dmamap_sync(p->pci_dmat, p->pci_result_dmap, 0,
+ pcs->pci_result_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD);
isp->isp_osinfo.onintstack = 1;
r = isp_intr(arg);
@@ -938,7 +947,8 @@ isp_pci_dmateardown(struct ispsoftc *isp, XS_T *xs, u_int16_t handle)
{
struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
bus_dmamap_t dmap = pci->pci_xfer_dmap[isp_handle_index(handle)];
- bus_dmamap_sync(pci->pci_dmat, dmap, xs->flags & SCSI_DATA_IN ?
+ isp_bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize,
+ xs->flags & SCSI_DATA_IN ?
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(pci->pci_dmat, dmap);
}
diff --git a/sys/dev/pci/pcscp.c b/sys/dev/pci/pcscp.c
index c5d1adf2a50..a2b01b0462d 100644
--- a/sys/dev/pci/pcscp.c
+++ b/sys/dev/pci/pcscp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcscp.c,v 1.4 2001/08/25 10:13:30 art Exp $ */
+/* $OpenBSD: pcscp.c,v 1.5 2001/08/25 14:52:57 jason Exp $ */
/* $NetBSD: pcscp.c,v 1.11 2000/11/14 18:42:58 thorpej Exp $ */
/*-
@@ -149,6 +149,14 @@ struct ncr53c9x_glue pcscp_glue = {
NULL, /* gl_clear_latched_intr */
};
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define pcscp_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (o), (l), (f))
+#else
+#define pcscp_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (f))
+#endif
+
int
pcscp_match(parent, match, aux)
struct device *parent;
@@ -486,7 +494,7 @@ pcscp_dma_intr(sc)
WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain ? DMACMD_DIR : 0));
- bus_dmamap_sync(esc->sc_dmat, dmap,
+ pcscp_bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap_>dm_mapsize,
datain ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(esc->sc_dmat, dmap);
@@ -635,11 +643,11 @@ pcscp_dma_go(sc)
return;
/* sync transfer buffer */
- bus_dmamap_sync(esc->sc_dmat, dmap,
+ pcscp_bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap->dm_mapsize,
datain ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
/* sync MDL */
- bus_dmamap_sync(esc->sc_dmat, mdldmap,
+ pcscp_bus_dmamap_sync(esc->sc_dmat, mdldmap, 0, mdldmap->dm_mapsize,
BUS_DMASYNC_PREWRITE);
/* set Starting MDL Address */
diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c
index d0e86811335..2c92b9625ac 100644
--- a/sys/dev/pci/yds.c
+++ b/sys/dev/pci/yds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yds.c,v 1.4 2001/08/25 10:13:30 art Exp $ */
+/* $OpenBSD: yds.c,v 1.5 2001/08/25 14:52:57 jason Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
@@ -90,6 +90,14 @@ int yds_match __P((struct device *, void *, void *));
void yds_attach __P((struct device *, struct device *, void *));
int yds_intr __P((void *));
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define yds_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (o), (l), (f))
+#else
+#define yds_bus_dmamap_sync(t, m, o, l, f) \
+ bus_dmamap_sync((t), (m), (f))
+#endif
+
#define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
#define KERNADDR(p) ((void *)((p)->addr))
@@ -477,7 +485,9 @@ yds_allocate_slots(sc)
cb += pcs;
}
/* Sync play control data table */
- bus_dmamap_sync(sc->sc_dmatag, p->map, BUS_DMASYNC_PREWRITE);
+ yds_bus_dmamap_sync(sc->sc_dmatag, p->map, sc->ptbloff,
+ (N_PLAY_SLOT_CTRL+1) * sizeof(u_int32_t),
+ BUS_DMASYNC_PREWRITE);
return 0;
}
@@ -994,7 +1004,10 @@ yds_intr(p)
u_int dma, cpu, blk, len;
/* Sync play slot control data */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ sc->sc_pbankoff,
+ sizeof(struct play_slot_ctrl_bank) * (*sc->ptbl)*
+ N_PLAY_SLOT_CTRL_BANK,
BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD);
dma = sc->pbankp[nbank]->pgstart * sc->sc_play.factor;
cpu = sc->sc_play.offset;
@@ -1005,8 +1018,9 @@ yds_intr(p)
((cpu > dma) && (dma + len - cpu > blk * 2))) {
/* We can fill the next block */
/* Sync ring buffer first for previous write */
- bus_dmamap_sync(sc->sc_dmatag,
+ yds_bus_dmamap_sync(sc->sc_dmatag,
sc->sc_play.dma->map,
+ cpu, blk,
BUS_DMASYNC_POSTWRITE);
sc->sc_play.intr(sc->sc_play.intr_arg);
sc->sc_play.offset += blk;
@@ -1018,8 +1032,8 @@ yds_intr(p)
#endif
}
/* Sync ring buffer for next write */
- bus_dmamap_sync(sc->sc_dmatag,
- sc->sc_play.dma->map,
+ yds_bus_dmamap_sync(sc->sc_dmatag,
+ sc->sc_play.dma->map, cpu, blk,
BUS_DMASYNC_PREWRITE);
}
}
@@ -1027,7 +1041,9 @@ yds_intr(p)
u_int dma, cpu, blk, len;
/* Sync rec slot control data */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ sc->rbankoff, sizeof(struct rec_slot_ctrl_bank)*
+ N_REC_SLOT_CTRL * N_REC_SLOT_CTRL_BANK,
BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD);
dma = sc->rbank[YDS_INPUT_SLOT*2 + nbank].pgstartadr;
cpu = sc->sc_rec.offset;
@@ -1038,8 +1054,9 @@ yds_intr(p)
((cpu > dma) && (dma + len - cpu > blk * 2))) {
/* We can drain the current block */
/* Sync ring buffer first */
- bus_dmamap_sync(sc->sc_dmatag,
- sc->sc_rec.dma->map, BUS_DMASYNC_POSTREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag,
+ sc->sc_rec.dma->map, cpu, blk,
+ BUS_DMASYNC_POSTREAD);
sc->sc_rec.intr(sc->sc_rec.intr_arg);
sc->sc_rec.offset += blk;
if (sc->sc_rec.offset >= len) {
@@ -1050,8 +1067,9 @@ yds_intr(p)
#endif
}
/* Sync ring buffer for next read */
- bus_dmamap_sync(sc->sc_dmatag,
- sc->sc_rec.dma->map, BUS_DMASYNC_PREREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag,
+ sc->sc_rec.dma->map, cpu, blk,
+ BUS_DMASYNC_PREREAD);
}
}
}
@@ -1471,10 +1489,12 @@ yds_trigger_output(addr, start, end, blksize, intr, arg, param)
/* Now the play slot for the next frame is set up!! */
/* Sync play slot control data for both directions */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
- BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ sc->ptbloff, sizeof(struct play_slot_ctrl_bank) * channels *
+ NPLAY_SLOT_CTRL_BANK, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
/* Sync ring buffer */
- bus_dmamap_sync(sc->sc_dmatag, p->map, BUS_DMASYNC_PREWRITE);
+ yds_bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize,
+ BUS_DMASYNC_PREWRITE);
/* HERE WE GO!! */
YWRITE4(sc, YDS_MODE,
YREAD4(sc, YDS_MODE) | YDS_MODE_ACTV | YDS_MODE_ACTV2);
@@ -1569,10 +1589,11 @@ yds_trigger_input(addr, start, end, blksize, intr, arg, param)
#endif
/* Now the rec slot for the next frame is set up!! */
/* Sync record slot control data */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
- BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, sc->sc_rbankoff,
+ sizeof(struct rec_slot_ctrl_bank) * N_REC_SLOT_CTRL *
+ N_REC_SLOT_CTRL_BANK, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
/* Sync ring buffer */
- bus_dmamap_sync(sc->sc_dmatag, p->map, BUS_DMASYNC_PREREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize, BUS_DMASYNC_PREREAD);
/* HERE WE GO!! */
YWRITE4(sc, YDS_MODE,
YREAD4(sc, YDS_MODE) | YDS_MODE_ACTV | YDS_MODE_ACTV2);
@@ -1611,7 +1632,9 @@ yds_halt_output(addr)
if (sc->sc_play.intr) {
sc->sc_play.intr = 0;
/* Sync play slot control data */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ sc->pbankoff, sizeof(struct play_slot_ctrl_bank) *
+ (*sc->ptbl)*N_PLAY_SLOT_CTRL_BANK,
BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD);
/* Stop the play slot operation */
sc->pbankp[0]->status =
@@ -1619,8 +1642,8 @@ yds_halt_output(addr)
sc->pbankp[2]->status =
sc->pbankp[3]->status = 1;
/* Sync ring buffer */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_play.dma->map,
- BUS_DMASYNC_POSTWRITE);
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_play.dma->map, 0,
+ sc->sc_play.length, BUS_DMASYNC_POSTWRITE);
}
return 0;
@@ -1639,11 +1662,13 @@ yds_halt_input(addr)
YWRITE4(sc, YDS_MAPOF_REC, 0);
sc->sc_rec.intr = 0;
/* Sync rec slot control data */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
+ sc->sc_rbankoff, sizeof(struct rec_slot_ctrl_bank)*
+ N_REC_SLOT_CTRL*N_REC_SLOT_CTRL_BANK,
BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD);
/* Sync ring buffer */
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_rec.dma->map,
- BUS_DMASYNC_POSTREAD);
+ yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_rec.dma->map, 0,
+ sc->sc_rec.length, BUS_DMASYNC_POSTREAD);
}
return 0;