Add DMA sync operations around accessing the dwmmc descriptor ring. Even

with it maps as cache-coherent we still need to call bus_dmamap_sync.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Andrew Turner 2016-05-13 15:15:54 +00:00
parent 2474dccf1a
commit f3ad8ea007

View File

@ -722,6 +722,9 @@ dma_done(struct dwmmc_softc *sc, struct mmc_command *cmd)
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_POSTREAD);
bus_dmamap_sync(sc->desc_tag, sc->desc_map,
BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->buf_tag, sc->buf_map);
return (0);
@ -766,6 +769,10 @@ dma_prepare(struct dwmmc_softc *sc, struct mmc_command *cmd)
if (err != 0)
panic("dmamap_load failed\n");
/* Ensure the device can see the desc */
bus_dmamap_sync(sc->desc_tag, sc->desc_map,
BUS_DMASYNC_PREWRITE);
if (data->flags & MMC_DATA_WRITE)
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_PREWRITE);