diff --git a/drivers/platform/tegra/tegra-fsicom.c b/drivers/platform/tegra/tegra-fsicom.c index 2dfcc09f..f15b834e 100644 --- a/drivers/platform/tegra/tegra-fsicom.c +++ b/drivers/platform/tegra/tegra-fsicom.c @@ -19,7 +19,9 @@ /* Timeout in milliseconds */ #define TIMEOUT 1000 -/* Data type for mailbox client and channel details */ +#define IOVA_UNI_CODE 0xFE0D + +/*Data type for mailbox client and channel details*/ struct fsi_hsp_sm { struct mbox_client client; struct mbox_chan *chan; @@ -118,15 +120,16 @@ static ssize_t device_file_ioctl( struct rw_data *user_input; int ret = 0; uint32_t pdata[4] = {0}; + struct iova_data ldata; - user_input = (struct rw_data *)arg; - if (copy_from_user(&input, (void __user *)arg, - sizeof(struct rw_data))) - return -EACCES; switch (cmd) { case NVMAP_SMMU_MAP: + user_input = (struct rw_data *)arg; + if (copy_from_user(&input, (void __user *)arg, + sizeof(struct rw_data))) + return -EACCES; dmabuf = dma_buf_get(input.handle); if (IS_ERR_OR_NULL(dmabuf)) @@ -159,6 +162,9 @@ static ssize_t device_file_ioctl( break; case TEGRA_HSP_WRITE: + if (copy_from_user(&input, (void __user *)arg, + sizeof(struct rw_data))) + return -EACCES; pdata[0] = input.handle; ret = mbox_send_message(fsi_hsp_v->tx.chan, (void *)pdata); @@ -168,6 +174,18 @@ static ssize_t device_file_ioctl( task = get_current(); break; + case TEGRA_IOVA_DATA: + if (copy_from_user(&ldata, (void __user *)arg, + sizeof(struct iova_data))) + return -EACCES; + pdata[0] = ldata.offset; + pdata[1] = ldata.iova; + pdata[2] = ldata.chid; + pdata[3] = IOVA_UNI_CODE; + ret = mbox_send_message(fsi_hsp_v->tx.chan, + (void *)pdata); + break; + default: return -EINVAL; } diff --git a/include/uapi/linux/tegra-fsicom.h b/include/uapi/linux/tegra-fsicom.h index bf3fa36c..82b22df9 100644 --- a/include/uapi/linux/tegra-fsicom.h +++ b/include/uapi/linux/tegra-fsicom.h @@ -14,6 +14,13 @@ struct rw_data { uint64_t iova; }; +/*Data type for sending the offset,IOVA and channel Id details to FSI */ +struct iova_data { + uint32_t offset; + uint32_t iova; + uint32_t chid; +}; + /* signal value */ #define SIG_DRIVER_RESUME 43 #define SIG_FSI_WRITE_EVENT 44 @@ -23,5 +30,6 @@ struct rw_data { #define NVMAP_SMMU_UNMAP _IOWR('q', 2, struct rw_data *) #define TEGRA_HSP_WRITE _IOWR('q', 3, struct rw_data *) #define TEGRA_SIGNAL_REG _IOWR('q', 4, struct rw_data *) +#define TEGRA_IOVA_DATA _IOWR('q', 5, struct iova_data *) #endif /* _UAPI_TEGRA_FSICOM_H_ */