Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Fix a Continue Operation.



details:   https://anonhg.NetBSD.org/src/rev/51c1ccfe9492
branches:  trunk
changeset: 826020:51c1ccfe9492
user:      isaki <isaki%NetBSD.org@localhost>
date:      Fri Aug 11 07:30:01 2017 +0000

description:
Fix a Continue Operation.
Patch from Y.Sugahara.

diffstat:

 sys/arch/x68k/dev/dmacvar.h    |   4 +---
 sys/arch/x68k/dev/intio_dmac.c |  36 ++++++++++++++----------------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diffs (115 lines):

diff -r d11846ce872a -r 51c1ccfe9492 sys/arch/x68k/dev/dmacvar.h
--- a/sys/arch/x68k/dev/dmacvar.h       Fri Aug 11 07:08:40 2017 +0000
+++ b/sys/arch/x68k/dev/dmacvar.h       Fri Aug 11 07:30:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmacvar.h,v 1.11 2017/08/11 07:08:40 isaki Exp $       */
+/*     $NetBSD: dmacvar.h,v 1.12 2017/08/11 07:30:01 isaki Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -55,8 +55,6 @@
        struct dmac_sg_array *dx_array; /* DMAC array chain */
        int             dx_done;
 #endif
-       int             dx_nextoff;     /* for continued operation */
-       int             dx_nextsize;
 };
 
 /*
diff -r d11846ce872a -r 51c1ccfe9492 sys/arch/x68k/dev/intio_dmac.c
--- a/sys/arch/x68k/dev/intio_dmac.c    Fri Aug 11 07:08:40 2017 +0000
+++ b/sys/arch/x68k/dev/intio_dmac.c    Fri Aug 11 07:30:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intio_dmac.c,v 1.36 2017/08/11 07:08:40 isaki Exp $    */
+/*     $NetBSD: intio_dmac.c,v 1.37 2017/08/11 07:30:01 isaki Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_m68k_arch.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.36 2017/08/11 07:08:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.37 2017/08/11 07:30:01 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -284,7 +284,6 @@
        xf->dx_array = chan->ch_map;
        xf->dx_done = 0;
 #endif
-       xf->dx_nextoff = xf->dx_nextsize = -1;
        return xf;
 }
 
@@ -300,8 +299,6 @@
                xf->dx_ocr |= DMAC_OCR_CHAIN_DISABLED;
        else {
                xf->dx_ocr |= DMAC_OCR_CHAIN_ARRAY;
-               xf->dx_nextoff = ~0;
-               xf->dx_nextsize = ~0;
        }
 
        bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CSR, 0xff);
@@ -352,6 +349,8 @@
        struct dmac_channel_stat *chan = xf->dx_channel;
        struct x68k_bus_dmamap *dmamap = xf->dx_dmamap;
        int go = DMAC_CCR_STR|DMAC_CCR_INT;
+       bus_addr_t paddr;
+       uint8_t csr;
 #ifdef DMAC_ARRAYCHAIN
        int c;
 #endif
@@ -391,20 +390,21 @@
                if (dmamap->dm_mapsize != dmamap->dm_segs[0].ds_len)
                        panic("dmac_start_xfer_offset: dmamap curruption");
 #endif
-               if (offset == xf->dx_nextoff &&
-                   size == xf->dx_nextsize) {
-                       /* Use continued operation */
+               paddr = dmamap->dm_segs[0].ds_addr + offset;
+               csr = bus_space_read_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CSR);
+               if ((csr & DMAC_CSR_ACT) != 0) {
+                       /* Use 'Continue Mode' */
+                       bus_space_write_4(dmac->sc_bst, chan->ch_bht,
+                           DMAC_REG_BAR, paddr);
+                       bus_space_write_2(dmac->sc_bst, chan->ch_bht,
+                           DMAC_REG_BTCR, (int) size);
                        go |=  DMAC_CCR_CNT;
-                       xf->dx_nextoff += size;
+                       go &= ~DMAC_CCR_STR;
                } else {
                        bus_space_write_4(dmac->sc_bst, chan->ch_bht,
-                                         DMAC_REG_MAR,
-                                         (int) dmamap->dm_segs[0].ds_addr
-                                         + offset);
+                                         DMAC_REG_MAR, paddr);
                        bus_space_write_2(dmac->sc_bst, chan->ch_bht,
                                          DMAC_REG_MTCR, (int) size);
-                       xf->dx_nextoff = offset;
-                       xf->dx_nextsize = size;
                }
 #ifdef DMAC_ARRAYCHAIN
                xf->dx_done = 1;
@@ -436,13 +436,6 @@
 #endif
        bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CCR, go);
 
-       if (xf->dx_nextoff != ~0) {
-               bus_space_write_4(dmac->sc_bst, chan->ch_bht,
-                                 DMAC_REG_BAR, xf->dx_nextoff);
-               bus_space_write_2(dmac->sc_bst, chan->ch_bht,
-                                 DMAC_REG_BTCR, xf->dx_nextsize);
-       }
-
        return 0;
 }
 
@@ -563,7 +556,6 @@
        bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CCR,
                          DMAC_CCR_INT | DMAC_CCR_SAB);
        bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CSR, 0xff);
-       xf->dx_nextoff = xf->dx_nextsize = -1;
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index