From 8ca97ee1a3ff92397105605c43d857d19ca49ff0 Mon Sep 17 00:00:00 2001 From: Mark Allyn Date: Tue, 20 Mar 2012 10:16:48 -0700 Subject: [PATCH] Drivers: staging: sep: add ioctl to insert shared address into msg BZ: 28280 Change-Id: Ic27a4cda6f6ffdf6636f4f717f2137f5ab4333ad Signed-off-by: Mark Allyn Reviewed-on: http://android.intel.com:8080/39816 Reviewed-by: Matthews, Michael L Reviewed-by: Mangalampalli, Jayant Tested-by: Mangalampalli, Jayant Reviewed-by: buildbot Tested-by: buildbot --- drivers/staging/sep/sep_driver_api.h | 3 +++ drivers/staging/sep/sep_driver_config.h | 5 +++++ drivers/staging/sep/sep_main.c | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/drivers/staging/sep/sep_driver_api.h b/drivers/staging/sep/sep_driver_api.h index 733fbe7..f915bab 100644 --- a/drivers/staging/sep/sep_driver_api.h +++ b/drivers/staging/sep/sep_driver_api.h @@ -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) diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h index b6b47bd..30a512b 100644 --- a/drivers/staging/sep/sep_driver_config.h +++ b/drivers/staging/sep/sep_driver_config.h @@ -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) diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index 4a9155f..76f0a6e 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -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; } -- 2.7.4