Fix bus_dmamap_sync() usage.
This should not be a problem since BUS_DMASYNC_POSTWRITE is probably a no-op.
This commit is contained in:
parent
69647b7dbd
commit
41d24e831c
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ninjaata32.c,v 1.5 2006/11/16 01:32:52 christos Exp $ */
|
/* $NetBSD: ninjaata32.c,v 1.6 2006/12/19 14:12:26 itohy Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 ITOH Yasufumi <itohy@NetBSD.org>.
|
* Copyright (c) 2006 ITOH Yasufumi <itohy@NetBSD.org>.
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ninjaata32.c,v 1.5 2006/11/16 01:32:52 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ninjaata32.c,v 1.6 2006/12/19 14:12:26 itohy Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
|
@ -542,6 +542,7 @@ njata32_dma_finish(void *v, int channel, int drive,
|
||||||
int force)
|
int force)
|
||||||
{
|
{
|
||||||
struct njata32_softc *sc = v;
|
struct njata32_softc *sc = v;
|
||||||
|
struct njata32_device *dev = &sc->sc_dev[drive];
|
||||||
int bm;
|
int bm;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
@ -550,8 +551,8 @@ njata32_dma_finish(void *v, int channel, int drive,
|
||||||
NJATA32_REG_BM)));
|
NJATA32_REG_BM)));
|
||||||
|
|
||||||
KASSERT(channel == 0);
|
KASSERT(channel == 0);
|
||||||
KASSERT(sc->sc_dev[drive].d_flags & NJATA32_DEV_DMA_MAPPED);
|
KASSERT(dev->d_flags & NJATA32_DEV_DMA_MAPPED);
|
||||||
KASSERT(sc->sc_dev[drive].d_flags & NJATA32_DEV_DMA_STARTED);
|
KASSERT(dev->d_flags & NJATA32_DEV_DMA_STARTED);
|
||||||
|
|
||||||
bm = bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc),
|
bm = bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc),
|
||||||
NJATA32_REG_BM);
|
NJATA32_REG_BM);
|
||||||
|
@ -565,6 +566,11 @@ njata32_dma_finish(void *v, int channel, int drive,
|
||||||
bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), 0x1c));
|
bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), 0x1c));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_sgt,
|
||||||
|
(char *)dev->d_sgt - (char *)sc->sc_sgtpg,
|
||||||
|
sizeof(struct njata32_sgtable) * sc->sc_piobm_nsegs,
|
||||||
|
BUS_DMASYNC_POSTWRITE);
|
||||||
|
|
||||||
/* check if DMA is active */
|
/* check if DMA is active */
|
||||||
if (bm & NJATA32_BM_GO) {
|
if (bm & NJATA32_BM_GO) {
|
||||||
error = WDC_DMAST_NOIRQ;
|
error = WDC_DMAST_NOIRQ;
|
||||||
|
@ -626,7 +632,7 @@ njata32_dma_finish(void *v, int channel, int drive,
|
||||||
sc->sc_devflags = 0;
|
sc->sc_devflags = 0;
|
||||||
|
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
sc->sc_dev[drive].d_flags &= ~NJATA32_DEV_DMA_STARTED;
|
dev->d_flags &= ~NJATA32_DEV_DMA_STARTED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -648,22 +654,12 @@ njata32_piobm_done(void *v, int channel, int drive)
|
||||||
KASSERT(dev->d_flags & NJATA32_DEV_DMA_MAPPED);
|
KASSERT(dev->d_flags & NJATA32_DEV_DMA_MAPPED);
|
||||||
KASSERT((dev->d_flags & NJATA32_DEV_DMA_STARTED) == 0);
|
KASSERT((dev->d_flags & NJATA32_DEV_DMA_STARTED) == 0);
|
||||||
|
|
||||||
bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_sgt,
|
|
||||||
(char *)dev->d_sgt - (char *)sc->sc_sgtpg,
|
|
||||||
sizeof(struct njata32_sgtable) * sc->sc_piobm_nsegs,
|
|
||||||
BUS_DMASYNC_POSTWRITE);
|
|
||||||
|
|
||||||
/* unload dma map */
|
/* unload dma map */
|
||||||
bus_dmamap_sync(sc->sc_dmat, dev->d_dmamap_xfer,
|
bus_dmamap_sync(sc->sc_dmat, dev->d_dmamap_xfer,
|
||||||
0, dev->d_dmamap_xfer->dm_mapsize,
|
0, dev->d_dmamap_xfer->dm_mapsize,
|
||||||
(dev->d_flags & NJATA32_DEV_DMA_READ) ?
|
(dev->d_flags & NJATA32_DEV_DMA_READ) ?
|
||||||
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
|
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
|
||||||
|
|
||||||
bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_sgt,
|
|
||||||
(char *)dev->d_sgt - (char *)sc->sc_sgtpg,
|
|
||||||
sizeof(struct njata32_sgtable) * NJATA32_NUM_SG,
|
|
||||||
BUS_DMASYNC_POSTWRITE);
|
|
||||||
|
|
||||||
bus_dmamap_unload(sc->sc_dmat, dev->d_dmamap_xfer);
|
bus_dmamap_unload(sc->sc_dmat, dev->d_dmamap_xfer);
|
||||||
dev->d_flags &= ~NJATA32_DEV_DMA_MAPPED;
|
dev->d_flags &= ~NJATA32_DEV_DMA_MAPPED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue