Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Use bus_dmamap_load(), not bus_dmamap_load_raw(...



details:   https://anonhg.NetBSD.org/src/rev/41199dda0004
branches:  trunk
changeset: 506905:41199dda0004
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Mar 08 02:21:44 2001 +0000

description:
Use bus_dmamap_load(), not bus_dmamap_load_raw(), and add
BUS_DMA_STREAMING to data transfer map loads.

diffstat:

 sys/dev/sbus/isp_sbus.c |  45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diffs (111 lines):

diff -r 440e83275b5c -r 41199dda0004 sys/dev/sbus/isp_sbus.c
--- a/sys/dev/sbus/isp_sbus.c   Thu Mar 08 02:20:39 2001 +0000
+++ b/sys/dev/sbus/isp_sbus.c   Thu Mar 08 02:21:44 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_sbus.c,v 1.40 2001/02/28 05:46:46 mjacob Exp $ */
+/* $NetBSD: isp_sbus.c,v 1.41 2001/03/08 02:21:44 thorpej Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -75,8 +75,7 @@
 #include <sys/reboot.h>
 
 /*
- * Gross! But there's no way around this until either bus_dma is corrected
- * or sparc64 iommu.c is fixed.
+ * Gross! But there's no way around this until sparc64 iommu.c is fixed.
  */
 #if    _MACHINE == sparc64
 #define        LMAP_FLAGS      BUS_DMA_NOWAIT|BUS_DMA_COHERENT
@@ -410,11 +409,6 @@
            BUS_DMA_NOWAIT)) {
                goto dmafail;
        }
-       progress++;
-       if (bus_dmamap_load_raw(dmatag, sbc->sbus_rquest_dmamap, &reqseg, reqrs,
-           len, LMAP_FLAGS) != 0) {
-               goto dmafail;
-       }
        isp->isp_rquest_dma = sbc->sbus_rquest_dmamap->dm_segs[0].ds_addr;
        progress++;
        if (bus_dmamem_map(dmatag, &reqseg, reqrs, len,
@@ -422,6 +416,11 @@
                goto dmafail;
        }
        progress++;
+       if (bus_dmamap_load(dmatag, sbc->sbus_rquest_dmamap,
+           isp->isp_rquest, len, NULL, LMAP_FLAGS) != 0) {
+               goto dmafail;
+       }
+       progress++;
 
        len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
        if (bus_dmamap_create(dmatag, len, 1, len, 0, BUS_DMA_NOWAIT,
@@ -433,29 +432,30 @@
            BUS_DMA_NOWAIT)) {
                goto dmafail;
        }
-       progress++;
-       if (bus_dmamap_load_raw(dmatag, sbc->sbus_result_dmamap, &rspseg, rsprs,
-           len, LMAP_FLAGS) != 0) {
-               goto dmafail;
-       }
+       isp->isp_result_dma = sbc->sbus_result_dmamap->dm_segs[0].ds_addr;
        progress++;
        if (bus_dmamem_map(dmatag, &rspseg, rsprs, len,
            (caddr_t *)&isp->isp_result, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
                goto dmafail;
        }
-       isp->isp_result_dma = sbc->sbus_result_dmamap->dm_segs[0].ds_addr;
+       progress++;
+       if (bus_dmamap_load(dmatag, sbc->sbus_result_dmamap,
+           isp->isp_result, len, NULL, LMAP_FLAGS) != 0) {
+               goto dmafail;
+       }
+       progress++;
        return (0);
 
 dmafail:
        isp_prt(isp, ISP_LOGERR, "Mailbox DMA Setup Failure");
 
        if (progress >= 8) {
+               bus_dmamap_unload(dmatag, sbc->sbus_result_dmamap);
+       }
+       if (progress >= 7) {
                bus_dmamem_unmap(dmatag,
                    isp->isp_result, ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)));
        }
-       if (progress >= 7) {
-               bus_dmamap_unload(dmatag,  sbc->sbus_result_dmamap);
-       }
        if (progress >= 6) {
                bus_dmamem_free(dmatag, &rspseg, rsprs);
        }
@@ -463,13 +463,13 @@
                bus_dmamap_destroy(dmatag, sbc->sbus_result_dmamap);
        }
 
-
        if (progress >= 4) {
+               bus_dmamap_unload(dmatag, sbc->sbus_rquest_dmamap);
+       }
+       if (progress >= 3) {
                bus_dmamem_unmap(dmatag,
                    isp->isp_rquest, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
-       }
-       if (progress >= 3) {
-               bus_dmamap_unload(dmatag,  sbc->sbus_rquest_dmamap);
+
        }
        if (progress >= 2) {
                bus_dmamem_free(dmatag, &reqseg, reqrs);
@@ -518,7 +518,8 @@
                /* NOTREACHED */
        }
        if (bus_dmamap_load(sbc->sbus_dmatag, dmap, xs->data, xs->datalen,
-           NULL, cansleep? BUS_DMA_WAITOK : BUS_DMA_NOWAIT) != 0) {
+           NULL, (cansleep ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT) |
+           BUS_DMA_STREAMING) != 0) {
                XS_SETERR(xs, HBA_BOTCH);
                return (CMD_COMPLETE);
        }



Home | Main Index | Thread Index | Old Index