aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 2e2ecf3dd228..4c9869887db6 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -1853,6 +1853,18 @@ storvsc_xferbuf_prepare(void *arg, bus_dma_segment_t *segs, int nsegs, int error
prplist->gpa_page[i] = atop(segs[i].ds_addr);
}
reqp->prp_cnt = nsegs;
+
+ if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
+ bus_dmasync_op_t op;
+
+ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
+ op = BUS_DMASYNC_PREREAD;
+ else
+ op = BUS_DMASYNC_PREWRITE;
+
+ bus_dmamap_sync(reqp->softc->storvsc_req_dtag,
+ reqp->data_dmap, op);
+ }
}
/**
@@ -2113,6 +2125,19 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
int ori_sg_count = 0;
const struct scsi_generic *cmd;
+ if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
+ bus_dmasync_op_t op;
+
+ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
+ op = BUS_DMASYNC_POSTREAD;
+ else
+ op = BUS_DMASYNC_POSTWRITE;
+
+ bus_dmamap_sync(reqp->softc->storvsc_req_dtag,
+ reqp->data_dmap, op);
+ bus_dmamap_unload(sc->storvsc_req_dtag, reqp->data_dmap);
+ }
+
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;