summaryrefslogtreecommitdiff
path: root/drivers/scsi/isci/core/sci_util.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-02-24 02:57:27 +0300
committerDan Williams <dan.j.williams@intel.com>2011-07-03 14:55:28 +0400
commit6389a77596f36cf04ad8b1c7d43ec1d6cdfe89cb (patch)
tree71790cd9538bed25e1e448f83c6d92269993b2ae /drivers/scsi/isci/core/sci_util.c
parent103a00c200ab3bb9e598923eb7ba3354fcb3de8d (diff)
downloadlinux-6389a77596f36cf04ad8b1c7d43ec1d6cdfe89cb.tar.xz
isci: have the driver use native SG calls and DMA-API
Remove abstraction for SG building and get rid of callbacks for getting DMA memory mapping. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/core/sci_util.c')
-rw-r--r--drivers/scsi/isci/core/sci_util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/scsi/isci/core/sci_util.c b/drivers/scsi/isci/core/sci_util.c
index 03f919ffb413..cb3e9f73828d 100644
--- a/drivers/scsi/isci/core/sci_util.c
+++ b/drivers/scsi/isci/core/sci_util.c
@@ -84,3 +84,18 @@ void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t ph
return (char *)ireq + offset;
}
+dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sds_request,
+ void *virt_addr)
+{
+ struct isci_request *isci_request =
+ (struct isci_request *)sci_object_get_association(sds_request);
+
+ char *requested_addr = (char *)virt_addr;
+ char *base_addr = (char *)isci_request;
+
+ BUG_ON(requested_addr < base_addr);
+ BUG_ON((requested_addr - base_addr) >=
+ isci_request->request_alloc_size);
+
+ return isci_request->request_daddr + (requested_addr - base_addr);
+}