mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
tee: add api tee_unprotect_mem [1/1]
PD#TV-17133 Problem: need API to unprotect mem for codec and so on Solution: add api tee_unprotect_mem Verify: Android Q + TM2 Test: manual Change-Id: I9dc205e209988297724c9461254c028e779ae1eb Signed-off-by: Pengguang Zhu <pengguang.zhu@amlogic.com>
This commit is contained in:
@@ -52,7 +52,11 @@ static int disable_flag;
|
||||
#define TEE_SMC_CALL_GET_OS_REVISION \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_GET_OS_REVISION)
|
||||
|
||||
#define TEE_SMC_FUNCID_LOAD_VIDEO_FW 15
|
||||
#define TEE_SMC_FUNCID_CONFIG_DEVICE_SECURE 14
|
||||
#define TEE_SMC_CONFIG_DEVICE_SECURE \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_CONFIG_DEVICE_SECURE)
|
||||
|
||||
#define TEE_SMC_FUNCID_LOAD_VIDEO_FW 15
|
||||
#define TEE_SMC_LOAD_VIDEO_FW \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_LOAD_VIDEO_FW)
|
||||
|
||||
@@ -68,9 +72,9 @@ static int disable_flag;
|
||||
#define TEE_SMC_PROTECT_MEM_BY_TYPE \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_PROTECT_MEM_BY_TYPE)
|
||||
|
||||
#define TEE_SMC_FUNCID_UNPROTECT_MEM_BY_TYPE 0xE024
|
||||
#define TEE_SMC_UNPROTECT_MEM_BY_TYPE \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_UNPROTECT_MEM_BY_TYPE)
|
||||
#define TEE_SMC_FUNCID_UNPROTECT_MEM 0xE024
|
||||
#define TEE_SMC_UNPROTECT_MEM \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_UNPROTECT_MEM)
|
||||
|
||||
static struct class *tee_sys_class;
|
||||
|
||||
@@ -231,6 +235,26 @@ uint32_t tee_protect_mem_by_type(uint32_t type,
|
||||
}
|
||||
EXPORT_SYMBOL(tee_protect_mem_by_type);
|
||||
|
||||
void tee_unprotect_mem(uint32_t handle)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
arm_smccc_smc(TEE_SMC_UNPROTECT_MEM,
|
||||
handle, 0, 0, 0, 0, 0, 0, &res);
|
||||
}
|
||||
EXPORT_SYMBOL(tee_unprotect_mem);
|
||||
|
||||
int tee_config_device_state(int dev_id, int secure)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
arm_smccc_smc(TEE_SMC_CONFIG_DEVICE_SECURE,
|
||||
dev_id, secure, 0, 0, 0, 0, 0, &res);
|
||||
|
||||
return res.a0;
|
||||
}
|
||||
EXPORT_SYMBOL(tee_config_device_state);
|
||||
|
||||
int tee_create_sysfs(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -18,12 +18,23 @@
|
||||
#ifndef __TEE_H__
|
||||
#define __TEE_H__
|
||||
|
||||
/* memory type used by tee_protect_mem_by_type() */
|
||||
#define TEE_MEM_TYPE_GPU 0x6
|
||||
#define TEE_MEM_TYPE_VDIN 0x7
|
||||
#define TEE_MEM_TYPE_ENCODER 0x8
|
||||
#define TEE_MEM_TYPE_HCODEC 0x8
|
||||
#define TEE_MEM_TYPE_GE2D 0x9
|
||||
#define TEE_MEM_TYPE_DEMUX 0xa
|
||||
|
||||
/* device ID used by tee_config_device_state() */
|
||||
#define DMC_DEV_ID_GPU 1
|
||||
#define DMC_DEV_ID_HEVC 4
|
||||
#define DMC_DEV_ID_PARSER 7
|
||||
#define DMC_DEV_ID_VPU 8
|
||||
#define DMC_DEV_ID_VDIN 9
|
||||
#define DMC_DEV_ID_VDEC 13
|
||||
#define DMC_DEV_ID_HCODEC 14
|
||||
#define DMC_DEV_ID_GE2D 15
|
||||
|
||||
extern bool tee_enabled(void);
|
||||
extern int is_secload_get(void);
|
||||
extern int tee_load_video_fw(uint32_t index, uint32_t vdec);
|
||||
@@ -34,5 +45,9 @@ extern void tee_unprotect_tvp_mem(uint32_t handle);
|
||||
extern uint32_t tee_protect_mem_by_type(uint32_t type,
|
||||
uint32_t start, uint32_t size,
|
||||
uint32_t *handle);
|
||||
extern void tee_unprotect_mem(uint32_t handle);
|
||||
|
||||
extern int tee_config_device_state(int dev_id, int secure);
|
||||
|
||||
#endif /* __TEE_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user