Drivers: staging: sep: add ioctl to insert shared address into msg
authorMark Allyn <mark.a.allyn@intel.com>
Tue, 20 Mar 2012 17:16:48 +0000 (10:16 -0700)
committerbuildbot <buildbot@intel.com>
Wed, 4 Apr 2012 02:02:17 +0000 (19:02 -0700)
BZ: 28280

Change-Id: Ic27a4cda6f6ffdf6636f4f717f2137f5ab4333ad
Signed-off-by: Mark Allyn <mark.a.allyn@intel.com>
Reviewed-on: http://android.intel.com:8080/39816
Reviewed-by: Matthews, Michael L <michael.l.matthews@intel.com>
Reviewed-by: Mangalampalli, Jayant <jayant.mangalampalli@intel.com>
Tested-by: Mangalampalli, Jayant <jayant.mangalampalli@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/staging/sep/sep_driver_api.h
drivers/staging/sep/sep_driver_config.h
drivers/staging/sep/sep_main.c

index 733fbe7..f915bab 100644 (file)
@@ -217,6 +217,9 @@ struct sep_private_data {
 #define SEP_IOCENDTRANSACTION   \
        _IO(SEP_IOC_MAGIC_NUMBER, 15)
 
+#define SEP_DRIVER_INSERT_SHARE_ADDR_CMD \
+       _IO(SEP_IOC_MAGIC_NUMBER, 0x30)
+
 #define SEP_IOCPREPAREDCB                                      \
        _IOW(SEP_IOC_MAGIC_NUMBER, 35, struct build_dcb_struct)
 
index b6b47bd..30a512b 100644 (file)
@@ -157,6 +157,11 @@ held by the proccess (struct file) */
 /* message area offset */
 #define SEP_DRIVER_MESSAGE_AREA_OFFSET_IN_BYTES                        0
 
+#define SEP_DRIVER_MESSAGE_START_AFTER_OPCODE                  5
+
+#define SEP_SHARED_AREA_PHYSADDRESS_OFFSET \
+       (SEP_DRIVER_MESSAGE_START_AFTER_OPCODE + 6)
+
 /* static pool area offset */
 #define SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES \
        (SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES)
index 4a9155f..76f0a6e 100644 (file)
@@ -2714,6 +2714,7 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        struct sep_dma_context **dma_ctx = &private_data->dma_ctx;
        struct sep_queue_info **my_queue_elem = &private_data->my_queue_elem;
        int error = 0;
+       u32 *shared_place = NULL; /* used only for secure dma operation */
 
        dev_dbg(&sep->pdev->dev, "[PID%d] ioctl cmd 0x%x\n",
                current->pid, cmd);
@@ -2830,6 +2831,22 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                dev_dbg(&sep->pdev->dev, "[PID%d] SEP_IOCFREEDCB end\n",
                        current->pid);
                break;
+       case SEP_DRIVER_INSERT_SHARE_ADDR_CMD:
+
+               /**
+                * This is used only for some secure dma operations
+                * Where the physical location of the shared memory
+                * area is to be inserted into a specific location
+                * of the message pool
+                */
+               dev_dbg(&sep->pdev->dev, "Inserting shared memory physical\n");
+               shared_place = (u32 *)sep->shared_addr;
+               shared_place += SEP_SHARED_AREA_PHYSADDRESS_OFFSET;
+               *shared_place = (u32)sep->shared_bus;
+               dev_dbg(&sep->pdev->dev, "addr inserted %x by %x wd offset\n",
+                       SEP_SHARED_AREA_PHYSADDRESS_OFFSET * 4,
+                       SEP_SHARED_AREA_PHYSADDRESS_OFFSET);
+               break;
        default:
                error = -ENOTTY;
                dev_dbg(&sep->pdev->dev, "[PID%d] default end\n",
@@ -2839,6 +2856,8 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 end_function:
        dev_dbg(&sep->pdev->dev, "[PID%d] ioctl end\n", current->pid);
+       dev_dbg(&sep->pdev->dev, "[PID%d] SEP_DRIVER_INSERT_SHARE_ADDR_CMD %x\n",
+               SEP_DRIVER_INSERT_SHARE_ADDR_CMD);
 
        return error;
 }