diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2012-08-16 05:49:39 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2012-08-16 05:49:39 +0000 |
commit | 806122bfbcbd90d11c662729194b9d905d5c9e19 (patch) | |
tree | ddae42878ae17e8714fc99bf131c434e8bd300ad /sys | |
parent | 6e741428c56924dc244f79431e4481fe937a7b3e (diff) |
move the dma syncs for the ccb data into ccb_done, so we can do it once
rather than put the code everywhere.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/mfi.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 3ee4261a62f..fde2c4fc61d 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.131 2012/08/16 05:38:13 dlg Exp $ */ +/* $OpenBSD: mfi.c,v 1.132 2012/08/16 05:49:38 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -930,17 +930,6 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb) DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done %#x %#x\n", DEVNAME(sc), ccb, ccb->ccb_frame); - if (xs->data != NULL) { - DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done sync\n", - DEVNAME(sc)); - bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0, - ccb->ccb_dmamap->dm_mapsize, - (xs->flags & SCSI_DATA_IN) ? - BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - - bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap); - } - switch (hdr->mfh_cmd_status) { case MFI_STAT_OK: xs->resid = 0; @@ -1284,23 +1273,11 @@ done: void mfi_mgmt_done(struct mfi_ccb *ccb) { - struct mfi_softc *sc = ccb->ccb_sc; struct mfi_frame_header *hdr = &ccb->ccb_frame->mfr_header; DNPRINTF(MFI_D_INTR, "%s: mfi_mgmt_done %#x %#x\n", DEVNAME(sc), ccb, ccb->ccb_frame); - if (ccb->ccb_data != NULL) { - DNPRINTF(MFI_D_INTR, "%s: mfi_mgmt_done sync\n", - DEVNAME(sc)); - bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0, - ccb->ccb_dmamap->dm_mapsize, - (ccb->ccb_direction & MFI_DATA_IN) ? - BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - - bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap); - } - if (hdr->mfh_cmd_status != MFI_STAT_OK) ccb->ccb_flags |= MFI_CCB_F_ERR; @@ -2065,6 +2042,15 @@ mfi_done(struct mfi_ccb *ccb) ccb->ccb_pframe_offset, sc->sc_frames_size, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + if (ccb->ccb_len > 0) { + bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, + 0, ccb->ccb_dmamap->dm_mapsize, + (ccb->ccb_direction == MFI_DATA_IN) ? + BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); + + bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap); + } + ccb->ccb_done(ccb); } |