Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Only sync and unload dma map in ahci_atapi_comple...



details:   https://anonhg.NetBSD.org/src/rev/ced01b2a5e7a
branches:  trunk
changeset: 811683:ced01b2a5e7a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Nov 11 02:43:09 2015 +0000

description:
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.

diffstat:

 sys/dev/ic/ahcisata_core.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r f9d063d7478d -r ced01b2a5e7a sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Wed Nov 11 00:58:21 2015 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Wed Nov 11 02:43:09 2015 +0000
@@ -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 @@
        }
 
        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);



Home | Main Index | Thread Index | Old Index