Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious p...



details:   https://anonhg.NetBSD.org/src/rev/989e18e13069
branches:  trunk
changeset: 512942:989e18e13069
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 19 16:36:14 2001 +0000

description:
Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.

diffstat:

 sys/dev/isa/isadma.c  |   5 +++--
 sys/dev/isa/wds.c     |  10 +++++++---
 sys/dev/pci/if_sip.c  |  11 ++++++-----
 sys/dev/pci/if_ste.c  |   9 +++++----
 sys/dev/pci/if_ti.c   |  12 +++++++-----
 sys/dev/pci/if_vr.c   |   9 +++++----
 sys/dev/pci/isp_pci.c |   5 +++--
 sys/dev/pci/pciide.c  |   5 +++--
 sys/dev/pci/pcscp.c   |   6 ++++--
 sys/dev/pci/twe.c     |   6 ++++--
 sys/dev/tc/asc_tcds.c |   6 +++---
 sys/dev/tc/bba.c      |   6 +++---
 12 files changed, 53 insertions(+), 37 deletions(-)

diffs (truncated from 347 to 300 lines):

diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/isa/isadma.c
--- a/sys/dev/isa/isadma.c      Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/isa/isadma.c      Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
                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);
 
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/isa/wds.c
--- a/sys/dev/isa/wds.c Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/isa/wds.c Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
                        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) {
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/if_sip.c      Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
                 * 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 @@
                 * 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 @@
                        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 @@
        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);
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/if_ste.c
--- a/sys/dev/pci/if_ste.c      Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/if_ste.c      Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
                 * 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 @@
                        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 @@
        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);
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/if_ti.c
--- a/sys/dev/pci/if_ti.c       Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/if_ti.c       Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
 
                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 @@
 
                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 @@
        }
        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 @@
        }
        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;
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/if_vr.c
--- a/sys/dev/pci/if_vr.c       Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/if_vr.c       Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
        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 @@
                 */
                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 @@
                        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);
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/isp_pci.c
--- a/sys/dev/pci/isp_pci.c     Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/isp_pci.c     Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
        }
        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);
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c      Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/pciide.c      Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
 
        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,
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/pcscp.c
--- a/sys/dev/pci/pcscp.c       Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/pcscp.c       Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
        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);
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/pci/twe.c
--- a/sys/dev/pci/twe.c Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/pci/twe.c Thu Jul 19 16:36:14 2001 +0000
@@ -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 @@
         * 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();
diff -r ed4590a3efe5 -r 989e18e13069 sys/dev/tc/asc_tcds.c
--- a/sys/dev/tc/asc_tcds.c     Thu Jul 19 16:30:52 2001 +0000
+++ b/sys/dev/tc/asc_tcds.c     Thu Jul 19 16:36:14 2001 +0000
@@ -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 $ */
 



Home | Main Index | Thread Index | Old Index