Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.

This commit is contained in:
thorpej 2001-07-19 16:36:14 +00:00
parent e13c617dee
commit 44e529fecc
12 changed files with 53 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: isadma.c,v 1.47 2001/02/12 15:49:19 briggs Exp $ */
/* $NetBSD: isadma.c,v 1.48 2001/07/19 16:41:11 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -375,7 +375,8 @@ _isa_dmastart(ids, chan, addr, nbytes, p, flags, busdmaflags)
panic("_isa_dmastart: no DMA map for chan %d\n", chan);
error = bus_dmamap_load(ids->ids_dmat, dmam, addr, nbytes,
p, busdmaflags);
p, busdmaflags |
((flags & DMAMODE_READ) ? BUS_DMA_READ : BUS_DMA_WRITE));
if (error)
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wds.c,v 1.44 2001/07/18 20:52:48 thorpej Exp $ */
/* $NetBSD: wds.c,v 1.45 2001/07/19 16:38:40 thorpej Exp $ */
#include "opt_ddb.h"
@ -1179,13 +1179,17 @@ wds_scsipi_request(chan, req, arg)
if (flags & XS_CTL_DATA_UIO) {
error = bus_dmamap_load_uio(dmat,
scb->dmamap_xfer, (struct uio *)xs->data,
BUS_DMA_NOWAIT);
BUS_DMA_NOWAIT |
((flags & XS_CTL_DATA_IN) ? BUS_DMA_READ :
BUS_DMA_WRITE));
} else
#endif /* TFS */
{
error = bus_dmamap_load(dmat,
scb->dmamap_xfer, xs->data, xs->datalen,
NULL, BUS_DMA_NOWAIT);
NULL, BUS_DMA_NOWAIT |
((flags & XS_CTL_DATA_IN) ? BUS_DMA_READ :
BUS_DMA_WRITE));
}
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sip.c,v 1.40 2001/07/08 17:15:45 thorpej Exp $ */
/* $NetBSD: if_sip.c,v 1.41 2001/07/19 16:36:14 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -986,7 +986,7 @@ SIP_DECL(start)(struct ifnet *ifp)
* buffer.
*/
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m0,
BUS_DMA_NOWAIT);
BUS_DMA_WRITE|BUS_DMA_NOWAIT);
if (error) {
if (error == EFBIG) {
printf("%s: Tx packet consumes too many "
@ -1009,7 +1009,7 @@ SIP_DECL(start)(struct ifnet *ifp)
* and try again.
*/
if (bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m0,
BUS_DMA_NOWAIT) != 0) {
BUS_DMA_WRITE|BUS_DMA_NOWAIT) != 0) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: unable to allocate Tx mbuf\n",
@ -1028,7 +1028,7 @@ SIP_DECL(start)(struct ifnet *ifp)
m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t));
m->m_pkthdr.len = m->m_len = m0->m_pkthdr.len;
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap,
m, BUS_DMA_NOWAIT);
m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
if (error) {
printf("%s: unable to load Tx buffer, "
"error = %d\n", sc->sc_dev.dv_xname, error);
@ -2378,7 +2378,8 @@ SIP_DECL(add_rxbuf)(struct sip_softc *sc, int idx)
rxs->rxs_mbuf = m;
error = bus_dmamap_load(sc->sc_dmat, rxs->rxs_dmamap,
m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_NOWAIT);
m->m_ext.ext_buf, m->m_ext.ext_size, NULL,
BUS_DMA_READ|BUS_DMA_NOWAIT);
if (error) {
printf("%s: can't load rx DMA map %d, error = %d\n",
sc->sc_dev.dv_xname, idx, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ste.c,v 1.3 2001/06/30 01:05:25 thorpej Exp $ */
/* $NetBSD: if_ste.c,v 1.4 2001/07/19 16:36:15 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -644,7 +644,7 @@ ste_start(struct ifnet *ifp)
* and try again.
*/
if (bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m0,
BUS_DMA_NOWAIT) != 0) {
BUS_DMA_WRITE|BUS_DMA_NOWAIT) != 0) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: unable to allocate Tx mbuf\n",
@ -663,7 +663,7 @@ ste_start(struct ifnet *ifp)
m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t));
m->m_pkthdr.len = m->m_len = m0->m_pkthdr.len;
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap,
m, BUS_DMA_NOWAIT);
m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
if (error) {
printf("%s: unable to load Tx buffer, "
"error = %d\n", sc->sc_dev.dv_xname, error);
@ -1448,7 +1448,8 @@ ste_add_rxbuf(struct ste_softc *sc, int idx)
ds->ds_mbuf = m;
error = bus_dmamap_load(sc->sc_dmat, ds->ds_dmamap,
m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_NOWAIT);
m->m_ext.ext_buf, m->m_ext.ext_size, NULL,
BUS_DMA_READ|BUS_DMA_NOWAIT);
if (error) {
printf("%s: can't load rx DMA map %d, error = %d\n",
sc->sc_dev.dv_xname, idx, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ti.c,v 1.39 2001/07/07 16:46:35 thorpej Exp $ */
/* $NetBSD: if_ti.c,v 1.40 2001/07/19 16:36:15 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -760,7 +760,7 @@ static int ti_newbuf_std(sc, i, m, dmamap)
if ((error = bus_dmamap_load(sc->sc_dmat, dmamap,
mtod(m_new, caddr_t), m_new->m_len, NULL,
BUS_DMA_NOWAIT)) != 0) {
BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
printf("%s: can't load recv map, error = %d\n",
sc->sc_dev.dv_xname, error);
return (ENOMEM);
@ -829,7 +829,7 @@ static int ti_newbuf_mini(sc, i, m, dmamap)
if ((error = bus_dmamap_load(sc->sc_dmat, dmamap,
mtod(m_new, caddr_t), m_new->m_len, NULL,
BUS_DMA_NOWAIT)) != 0) {
BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
printf("%s: can't load recv map, error = %d\n",
sc->sc_dev.dv_xname, error);
return (ENOMEM);
@ -2285,7 +2285,8 @@ static int ti_encap_tigon1(sc, m_head, txidx)
}
dmamap = dma->dmamap;
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m_head, 0);
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m_head,
BUS_DMA_WRITE);
if (error) {
struct mbuf *m;
int i = 0;
@ -2391,7 +2392,8 @@ static int ti_encap_tigon2(sc, m_head, txidx)
}
dmamap = dma->dmamap;
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m_head, 0);
error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m_head,
BUS_DMA_WRITE);
if (error) {
struct mbuf *m;
int i = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_vr.c,v 1.49 2001/07/07 16:40:24 thorpej Exp $ */
/* $NetBSD: if_vr.c,v 1.50 2001/07/19 16:36:15 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -541,7 +541,8 @@ vr_add_rxbuf(sc, i)
ds->ds_mbuf = m_new;
error = bus_dmamap_load(sc->vr_dmat, ds->ds_dmamap,
m_new->m_ext.ext_buf, m_new->m_ext.ext_size, NULL, BUS_DMA_NOWAIT);
m_new->m_ext.ext_buf, m_new->m_ext.ext_size, NULL,
BUS_DMA_READ|BUS_DMA_NOWAIT);
if (error) {
printf("%s: unable to load rx DMA map %d, error = %d\n",
sc->vr_dev.dv_xname, i, error);
@ -938,7 +939,7 @@ vr_start(ifp)
*/
if ((mtod(m0, bus_addr_t) & 3) != 0 ||
bus_dmamap_load_mbuf(sc->vr_dmat, ds->ds_dmamap, m0,
BUS_DMA_NOWAIT) != 0) {
BUS_DMA_WRITE|BUS_DMA_NOWAIT) != 0) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
printf("%s: unable to allocate Tx mbuf\n",
@ -957,7 +958,7 @@ vr_start(ifp)
m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t));
m->m_pkthdr.len = m->m_len = m0->m_pkthdr.len;
error = bus_dmamap_load_mbuf(sc->vr_dmat,
ds->ds_dmamap, m, BUS_DMA_NOWAIT);
ds->ds_dmamap, m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
if (error) {
printf("%s: unable to load Tx buffer, "
"error = %d\n", sc->vr_dev.dv_xname, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp_pci.c,v 1.70 2001/07/07 16:46:35 thorpej Exp $ */
/* $NetBSD: isp_pci.c,v 1.71 2001/07/19 16:36:15 thorpej Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -852,7 +852,8 @@ isp_pci_dmasetup(struct ispsoftc *isp, struct scsipi_xfer *xs, ispreq_t *rq,
}
error = bus_dmamap_load(pcs->pci_dmat, dmap, xs->data, xs->datalen,
NULL, ((xs->xs_control & XS_CTL_NOSLEEP) ?
BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING);
BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING |
((xs->xs_control & XS_CTL_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
XS_SETERR(xs, HBA_BOTCH);
return (CMD_COMPLETE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciide.c,v 1.121 2001/07/04 16:26:17 bouyer Exp $ */
/* $NetBSD: pciide.c,v 1.122 2001/07/19 16:36:16 thorpej Exp $ */
/*
@ -1012,7 +1012,8 @@ pciide_dma_init(v, channel, drive, databuf, datalen, flags)
error = bus_dmamap_load(sc->sc_dmat,
dma_maps->dmamap_xfer,
databuf, datalen, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING);
databuf, datalen, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING |
((flags & WDC_DMA_READ) ? BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
printf("%s:%d: unable to load xfer DMA map for"
"drive %d, error=%d\n", sc->sc_wdcdev.sc_dev.dv_xname,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcscp.c,v 1.15 2001/04/25 17:53:37 bouyer Exp $ */
/* $NetBSD: pcscp.c,v 1.16 2001/07/19 16:36:16 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@ -565,7 +565,9 @@ pcscp_dma_setup(sc, addr, len, datain, dmasize)
error = bus_dmamap_load(esc->sc_dmat, dmap, *esc->sc_dmaaddr,
*esc->sc_dmalen, NULL,
((sc->sc_nexus->xs->xs_control & XS_CTL_NOSLEEP) ?
BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING);
BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING |
((sc->sc_nexus->xs->xs_control & XS_CTL_DATA_IN) ?
BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
printf("%s: unable to load dmamap, error = %d\n",
sc->sc_dev.dv_xname, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: twe.c,v 1.15 2001/05/31 11:31:43 ad Exp $ */
/* $NetBSD: twe.c,v 1.16 2001/07/19 16:36:16 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -835,7 +835,9 @@ twe_ccb_map(struct twe_softc *sc, struct twe_ccb *ccb)
* Map the data buffer into bus space and build the S/G list.
*/
rv = bus_dmamap_load(sc->sc_dmat, ccb->ccb_dmamap_xfer, data,
ccb->ccb_datasize, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING);
ccb->ccb_datasize, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING |
((ccb->ccb_flags & TWE_CCB_DATA_IN) ?
BUS_DMA_READ : BUS_DMA_WRITE));
if (rv != 0) {
if (ccb->ccb_abuf != (vaddr_t)0) {
s = splvm();

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc_tcds.c,v 1.2 2001/04/25 17:53:42 bouyer Exp $ */
/* $NetBSD: asc_tcds.c,v 1.3 2001/07/19 16:43:44 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.2 2001/04/25 17:53:42 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.3 2001/07/19 16:43:44 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -290,7 +290,7 @@ tcds_dma_setup(sc, addr, len, ispullup, dmasize)
return 0;
if (bus_dmamap_load(asc->sc_dmat, asc->sc_dmamap, *addr, size,
NULL, BUS_DMA_NOWAIT)) {
NULL, BUS_DMA_NOWAIT | (ispullup ? BUS_DMA_READ : BUS_DMA_WRITE))) {
/*
* XXX Should return an error, here, but the upper-layer
* XXX doesn't check the return value!

View File

@ -1,4 +1,4 @@
/* $NetBSD: bba.c,v 1.12 2000/07/18 06:14:05 thorpej Exp $ */
/* $NetBSD: bba.c,v 1.13 2001/07/19 16:43:44 thorpej Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -478,7 +478,7 @@ bba_trigger_output(addr, start, end, blksize, intr, arg, param)
state |= 1;
if (bus_dmamap_load(sc->sc_dmat, d->dmam, start,
(char *)end - (char *)start, NULL, BUS_DMA_NOWAIT)) {
(char *)end - (char *)start, NULL, BUS_DMA_WRITE|BUS_DMA_NOWAIT)) {
printf("bba_trigger_output: can't load DMA map\n");
goto bad;
}
@ -547,7 +547,7 @@ bba_trigger_input(addr, start, end, blksize, intr, arg, param)
state |= 1;
if (bus_dmamap_load(sc->sc_dmat, d->dmam, start,
(char *)end - (char *)start, NULL, BUS_DMA_NOWAIT)) {
(char *)end - (char *)start, NULL, BUS_DMA_READ|BUS_DMA_NOWAIT)) {
printf("bba_trigger_input: can't load DMA map\n");
goto bad;
}