Module Name: src Committed By: isaki Date: Fri Aug 11 07:30:01 UTC 2017
Modified Files: src/sys/arch/x68k/dev: dmacvar.h intio_dmac.c Log Message: Fix a Continue Operation. Patch from Y.Sugahara. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x68k/dev/dmacvar.h cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x68k/dev/intio_dmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x68k/dev/dmacvar.h diff -u src/sys/arch/x68k/dev/dmacvar.h:1.11 src/sys/arch/x68k/dev/dmacvar.h:1.12 --- src/sys/arch/x68k/dev/dmacvar.h:1.11 Fri Aug 11 07:08:40 2017 +++ src/sys/arch/x68k/dev/dmacvar.h Fri Aug 11 07:30:01 2017 @@ -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_dma_xfer { struct dmac_sg_array *dx_array; /* DMAC array chain */ int dx_done; #endif - int dx_nextoff; /* for continued operation */ - int dx_nextsize; }; /* Index: src/sys/arch/x68k/dev/intio_dmac.c diff -u src/sys/arch/x68k/dev/intio_dmac.c:1.36 src/sys/arch/x68k/dev/intio_dmac.c:1.37 --- src/sys/arch/x68k/dev/intio_dmac.c:1.36 Fri Aug 11 07:08:40 2017 +++ src/sys/arch/x68k/dev/intio_dmac.c Fri Aug 11 07:30:01 2017 @@ -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 @@ dmac_alloc_xfer(struct dmac_channel_stat xf->dx_array = chan->ch_map; xf->dx_done = 0; #endif - xf->dx_nextoff = xf->dx_nextsize = -1; return xf; } @@ -300,8 +299,6 @@ dmac_load_xfer(struct dmac_softc *dmac, 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 @@ dmac_start_xfer_offset(struct dmac_softc 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 @@ dmac_start_xfer_offset(struct dmac_softc 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 @@ dmac_start_xfer_offset(struct dmac_softc #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 @@ dmac_abort_xfer(struct dmac_softc *dmac, 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; }