Module Name: src
Committed By: jakllsch
Date: Wed Nov 11 02:43:09 UTC 2015
Modified Files:
src/sys/dev/ic: ahcisata_core.c
Log Message:
Only sync and unload dma map in ahci_atapi_complete() if appropriate.
Fixes ahcisata atapi cd(4) on arm (specifically, JETSONTK1), which insists
that a zero-length dmamap can not be synced.
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/ahcisata_core.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/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.54 src/sys/dev/ic/ahcisata_core.c:1.55
--- src/sys/dev/ic/ahcisata_core.c:1.54 Sun May 24 22:30:05 2015
+++ src/sys/dev/ic/ahcisata_core.c Wed Nov 11 02:43:09 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_core.c,v 1.54 2015/05/24 22:30:05 jmcneill Exp $ */
+/* $NetBSD: ahcisata_core.c,v 1.55 2015/11/11 02:43:09 jakllsch Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.54 2015/05/24 22:30:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.55 2015/11/11 02:43:09 jakllsch Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -1714,11 +1714,13 @@ ahci_atapi_complete(struct ata_channel *
}
chp->ch_queue->active_xfer = NULL;
- bus_dmamap_sync(sc->sc_dmat, achp->ahcic_datad[slot], 0,
- achp->ahcic_datad[slot]->dm_mapsize,
- (sc_xfer->xs_control & XS_CTL_DATA_IN) ? BUS_DMASYNC_POSTREAD :
- BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->sc_dmat, achp->ahcic_datad[slot]);
+ if (xfer->c_bcount > 0) {
+ bus_dmamap_sync(sc->sc_dmat, achp->ahcic_datad[slot], 0,
+ achp->ahcic_datad[slot]->dm_mapsize,
+ (sc_xfer->xs_control & XS_CTL_DATA_IN) ?
+ BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_unload(sc->sc_dmat, achp->ahcic_datad[slot]);
+ }
if (chp->ch_drive[drive].drive_flags & ATA_DRIVE_WAITDRAIN) {
ahci_atapi_kill_xfer(chp, xfer, KILL_GONE);