-/* $OpenBSD: ufshci.c,v 1.15 2024/05/09 08:13:57 mglocker Exp $ */
+/* $OpenBSD: ufshci.c,v 1.16 2024/05/09 08:16:32 mglocker Exp $ */
/*
* Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org>
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
return -1;
}
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * slot, sizeof(*utrd), BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * slot, sizeof(*ucd), BUS_DMASYNC_PREWRITE);
+
/* 7.2.1 Basic Steps when Building a UTP Transfer Request: 14) */
ccb->ccb_status = CCB_STATUS_INPROGRESS;
ufshci_doorbell_write(sc, slot);
{
struct scsi_xfer *xs = ccb->ccb_cookie;
bus_dmamap_t dmap = ccb->ccb_dmamap;
+ struct ufshci_ucd *ucd;
+ struct ufshci_utrd *utrd;
bus_dmamap_sync(sc->sc_dmat, dmap, 0, dmap->dm_mapsize,
ISSET(xs->flags, SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD :
bus_dmamap_unload(sc->sc_dmat, dmap);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * ccb->ccb_slot, sizeof(*ucd),
+ BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * ccb->ccb_slot, sizeof(*utrd),
+ BUS_DMASYNC_POSTWRITE);
+
ccb->ccb_cookie = NULL;
ccb->ccb_status = CCB_STATUS_FREE;
ccb->ccb_done = NULL;
ufshci_scsi_done(struct ufshci_softc *sc, struct ufshci_ccb *ccb)
{
struct scsi_xfer *xs = ccb->ccb_cookie;
+ struct ufshci_ucd *ucd;
+ struct ufshci_utrd *utrd;
+
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_ucd),
+ sizeof(*ucd) * ccb->ccb_slot, sizeof(*ucd),
+ BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_sync(sc->sc_dmat, UFSHCI_DMA_MAP(sc->sc_dmamem_utrd),
+ sizeof(*utrd) * ccb->ccb_slot, sizeof(*utrd),
+ BUS_DMASYNC_POSTWRITE);
ccb->ccb_cookie = NULL;
ccb->ccb_status = CCB_STATUS_FREE;