summaryrefslogtreecommitdiff
path: root/drivers/scsi/cxlflash/ocxl_hw.c
diff options
context:
space:
mode:
authorUma Krishnan <ukrishn@linux.vnet.ibm.com>2018-03-26 19:32:56 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-04-19 02:32:49 +0300
commit012f394cb81c61dd1207caecaaeed20caf0a8e36 (patch)
tree4e86054818cea7255b85ac6e2de509e81be8eb1c /drivers/scsi/cxlflash/ocxl_hw.c
parent6b938ac91017d9375bda42251f559ae135623fbd (diff)
downloadlinux-012f394cb81c61dd1207caecaaeed20caf0a8e36.tar.xz
scsi: cxlflash: Support process specific mappings
Once the context is started, the assigned MMIO space can be mapped and unmapped. Provide means to map and unmap the context MMIO space. Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/cxlflash/ocxl_hw.c')
-rw-r--r--drivers/scsi/cxlflash/ocxl_hw.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index b39a03d149d0..73b0b104439c 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -151,6 +151,28 @@ err1:
}
/**
+ * ocxlflash_psa_map() - map the process specific MMIO space
+ * @ctx_cookie: Adapter context for which the mapping needs to be done.
+ *
+ * Return: MMIO pointer of the mapped region
+ */
+static void __iomem *ocxlflash_psa_map(void *ctx_cookie)
+{
+ struct ocxlflash_context *ctx = ctx_cookie;
+
+ return ioremap(ctx->psn_phys, ctx->psn_size);
+}
+
+/**
+ * ocxlflash_psa_unmap() - unmap the process specific MMIO space
+ * @addr: MMIO pointer to unmap.
+ */
+static void ocxlflash_psa_unmap(void __iomem *addr)
+{
+ iounmap(addr);
+}
+
+/**
* ocxlflash_process_element() - get process element of the adapter context
* @ctx_cookie: Adapter context associated with the process element.
*
@@ -618,6 +640,8 @@ static void *ocxlflash_fops_get_context(struct file *file)
/* Backend ops to ocxlflash services */
const struct cxlflash_backend_ops cxlflash_ocxl_ops = {
.module = THIS_MODULE,
+ .psa_map = ocxlflash_psa_map,
+ .psa_unmap = ocxlflash_psa_unmap,
.process_element = ocxlflash_process_element,
.start_context = ocxlflash_start_context,
.set_master = ocxlflash_set_master,