Files
kernel-tenderloin-3.0/include/linux/tzcom.h
Mona Hossain 6e2e26984f tzcom: Add support for modifying specific fields in cmd_buf
Allow client to send information to replace a specific field of
the cmd buffer with the physical address.  This is done via a new
IOCTL, TZCOM_IOCTL_SEND_CMD_FD_REQ, which is used to import the
ion fd handle. This IOCTL takes in a new send_cmd_fd_op_req
structure that has the same format as send-cmd_op_req with a
new field added: an array of ion handles (ifd_data.fd) and
cmd_buf_offset.

The client sends in an array of ion fd handle along with the
offset to the command buffer field.

This new IOCTL allows a client to send information regarding
which field(s) (at cmd_buf_offset) in the cmd_buf to replace.
These field(s) are replaced with the physical addr of the
buffer addressed by the respective ifd_data.fd handle.

Change-Id: If210013d46e24776fe6f5c6aa257505b3b1e6e00
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2012-01-13 19:02:53 -08:00

137 lines
4.4 KiB
C

/* Qualcomm TrustZone communicator API */
#ifndef __TZCOM_H_
#define __TZCOM_H_
#include <linux/types.h>
#include <linux/ioctl.h>
#define MAX_ION_FD 4
/**
* struct tzcom_register_svc_op_req - for register service ioctl request
* @svc_id - service id (shared between userspace and TZ)
* @cmd_id_low - low number in cmd_id range (shared between userspace and TZ)
* @cmd_id_high - high number in cmd_id range (shared between userspace and TZ)
* @instance_id - unique id for the given service generated by tzcom driver
*/
struct tzcom_register_svc_op_req {
uint32_t svc_id; /* in */
uint32_t cmd_id_low; /* in */
uint32_t cmd_id_high; /* in */
uint32_t instance_id; /* out */
};
/**
* struct tzcom_unregister_svc_op_req - for unregister service ioctl request
* @svc_id - service id to unregister (provided in register_service request)
* @instance_id - instance id generated in register service request
*/
struct tzcom_unregister_svc_op_req {
uint32_t svc_id; /* in */
uint32_t instance_id; /* in */
};
/**
* struct tzcom_next_cmd_op_req - for read next command ioctl request
* @svc_id - has to be a registered svc_id (see @tzcom_register_svc_op_req)
* @instance_id - unique id for the given service (see @tzcom_register_svc_op_req)
* @cmd_id - command to execute on the given service, received from TZ
* @req_len - request buffer length, received from TZ
* @req - request buffer, received from TZ
*/
struct tzcom_next_cmd_op_req {
uint32_t svc_id; /* in */
uint32_t instance_id; /* in */
uint32_t cmd_id; /* out */
unsigned int req_len; /* in/out */
void *req_buf; /* in/out */
};
/**
* struct tzcom_send_cmd_op_req - for send command ioctl request
* @cmd_id - command to execute on TZBSP side
* @ifd_data_fd - ion handle to some memory allocated in user space
* @cmd_buf_offset - command buffer offset
* @cmd_len - command buffer length
* @cmd_buf - command buffer
* @resp_len - response buffer length
* @resp_buf - response buffer
*/
struct tzcom_send_cmd_op_req {
uint32_t cmd_id; /* in */
unsigned int cmd_len; /* in */
void *cmd_buf; /* in */
unsigned int resp_len; /* in/out */
void *resp_buf; /* in/out */
};
/**
* struct tzcom_ion_fd_info - ion fd handle data information
* @fd - ion handle to some memory allocated in user space
* @cmd_buf_offset - command buffer offset
*/
struct tzcom_ion_fd_info {
int32_t fd;
uint32_t cmd_buf_offset;
};
/**
* struct tzcom_send_cmd_op_req - for send command ioctl request
* @cmd_id - command to execute on TZBSP side
* @ifd_data_fd - ion handle to some memory allocated in user space
* @cmd_buf_offset - command buffer offset
* @cmd_len - command buffer length
* @cmd_buf - command buffer
* @resp_len - response buffer length
* @resp_buf - response buffer
*/
struct tzcom_send_cmd_fd_op_req {
uint32_t cmd_id; /* in */
struct tzcom_ion_fd_info ifd_data[MAX_ION_FD];
unsigned int cmd_len; /* in */
void *cmd_buf; /* in */
unsigned int resp_len; /* in/out */
void *resp_buf; /* in/out */
};
/**
* struct tzcom_cont_cmd_op_req - for continue command ioctl request. used
* as a trigger from HLOS service to notify TZCOM that it's done with its
* operation and provide the response for TZCOM can continue the incomplete
* command execution
* @cmd_id - Command to continue filled in by tzcom as tzcom knows about the
* last incomplete command.
* @instance_id - Instance id of the svc
* @resp_len - Length of the response
* @resp_buf - Response buffer where the response of the cmd should go.
*/
struct tzcom_cont_cmd_op_req {
uint32_t cmd_id; /* out */
uint32_t instance_id; /* in */
unsigned int resp_len; /* in */
void *resp_buf; /* in */
};
#define TZCOM_IOC_MAGIC 0x97
/* For HLOS service */
#define TZCOM_IOCTL_REGISTER_SERVICE_REQ \
_IOWR(TZCOM_IOC_MAGIC, 1, struct tzcom_register_svc_op_req)
/* For HLOS service */
#define TZCOM_IOCTL_UNREGISTER_SERVICE_REQ \
_IOWR(TZCOM_IOC_MAGIC, 2, struct tzcom_unregister_svc_op_req)
/* For TZ service */
#define TZCOM_IOCTL_SEND_CMD_REQ \
_IOWR(TZCOM_IOC_MAGIC, 3, struct tzcom_send_cmd_op_req)
/* For HLOS service */
#define TZCOM_IOCTL_READ_NEXT_CMD_REQ \
_IOWR(TZCOM_IOC_MAGIC, 4, struct tzcom_next_cmd_op_req)
/* For TZ service */
#define TZCOM_IOCTL_CONTINUE_CMD_REQ \
_IOWR(TZCOM_IOC_MAGIC, 5, struct tzcom_cont_cmd_op_req)
#define TZCOM_IOCTL_ABORT_REQ _IO(TZCOM_IOC_MAGIC, 6)
/* For TZ service */
#define TZCOM_IOCTL_SEND_CMD_FD_REQ \
_IOWR(TZCOM_IOC_MAGIC, 7, struct tzcom_send_cmd_fd_op_req)
#endif /* __TZCOM_H_ */