Skip to content

Commit

Permalink
lib: optee_client: v2 client support compile to 32 bits
Browse files Browse the repository at this point in the history
Change-Id: I25cbbe486016cbe6fb1a6eff440bb7efab46a4c6
Signed-off-by: Hisping Lin <[email protected]>
  • Loading branch information
Hisping Lin authored and JosephChen2017 committed Aug 7, 2018
1 parent a678796 commit d156c9f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/optee_clientApi/OpteeClientRPC.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ TEEC_Result OpteeRpcCmdLoadV2Ta(t_teesmc32_arg *TeeSmc32Arg)
debug("return size of TA, keymaster_size = 0x%x", keymaster_size);
TeeSmc32Param[1].u.memref.size = keymaster_size;
} else {
memcpy((void *)TeeSmc32Param[1].u.memref.buf_ptr,
memcpy((void *)(size_t)TeeSmc32Param[1].u.memref.buf_ptr,
(void *)keymaster_data, TeeSmc32Param[1].u.memref.size);
debug("memref.buf_ptr = 0x%llx; memref.size = 0x%llx",
TeeSmc32Param[1].u.memref.buf_ptr,
Expand Down Expand Up @@ -571,7 +571,7 @@ TEEC_Result OpteeRpcCallback(ARM_SMC_ARGS *ArmSmcArgs)
#endif
#ifdef CONFIG_OPTEE_V2
t_teesmc32_arg *TeeSmc32Arg =
(t_teesmc32_arg *)((size_t)ArmSmcArgs->Arg1 << 32 | ArmSmcArgs->Arg2);
(t_teesmc32_arg *)(size_t)((uint64_t)ArmSmcArgs->Arg1 << 32 | ArmSmcArgs->Arg2);
debug("TeeSmc32Arg->cmd = 0x%x", TeeSmc32Arg->cmd);
#endif
switch (TeeSmc32Arg->cmd) {
Expand Down
22 changes: 11 additions & 11 deletions lib/optee_clientApi/OpteeClientRkFs-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ static uint32_t ree_fs_new_open(size_t num_params,
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx \n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);

filename = (char *)params[1].u.memref.shm_id;
filename = (char *)(size_t)params[1].u.memref.shm_id;
if (!filename)
return TEEC_ERROR_BAD_PARAMETERS;

Expand All @@ -733,7 +733,7 @@ static uint32_t ree_fs_new_open(size_t num_params,
return TEEC_ERROR_BAD_PARAMETERS;
}

debug("ree_fs_new_open open file: %s, len: %lu \n", filename, strlen(filename));
debug("ree_fs_new_open open file: %s, len: %zu \n", filename, strlen(filename));
fd = rkss_get_fileinfo_by_name(filename, &p);
if (fd < 0) {
debug("ree_fs_new_open : no such file. %s", filename);
Expand All @@ -756,7 +756,7 @@ static TEEC_Result ree_fs_new_create(size_t num_params,
/* file open flags: O_RDWR | O_CREAT | O_TRUNC
* if file exists, we must remove it first.
*/
filename = (char *)params[1].u.memref.shm_id;
filename = (char *)(size_t)params[1].u.memref.shm_id;
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx\n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);
if (!filename)
Expand All @@ -767,7 +767,7 @@ static TEEC_Result ree_fs_new_create(size_t num_params,
return TEEC_ERROR_BAD_PARAMETERS;
}

debug("ree_fs_new_create create file: %s, len: %lu \n", filename, strlen(filename));
debug("ree_fs_new_create create file: %s, len: %zu \n", filename, strlen(filename));
fd = rkss_get_fileinfo_by_name(filename, &p);
if (fd >= 0) {
debug("ree_fs_new_create : file exist, clear it. %s", filename);
Expand Down Expand Up @@ -832,7 +832,7 @@ static TEEC_Result ree_fs_new_read(size_t num_params,
fd = params[0].u.value.b;
offs = params[0].u.value.c;

data = (uint8_t *)params[1].u.memref.shm_id;
data = (uint8_t *)(size_t)params[1].u.memref.shm_id;
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx\n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);

Expand Down Expand Up @@ -898,7 +898,7 @@ static TEEC_Result ree_fs_new_write(size_t num_params,
fd = params[0].u.value.b;
offs = params[0].u.value.c;

data = (uint8_t *)params[1].u.memref.shm_id;
data = (uint8_t *)(size_t)params[1].u.memref.shm_id;
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx\n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);
if (!data)
Expand Down Expand Up @@ -1045,7 +1045,7 @@ static TEEC_Result ree_fs_new_remove(size_t num_params,
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx \n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);

filename = (char *)params[1].u.memref.shm_id;
filename = (char *)(size_t)params[1].u.memref.shm_id;
if (!filename)
return TEEC_ERROR_BAD_PARAMETERS;

Expand Down Expand Up @@ -1092,13 +1092,13 @@ static TEEC_Result ree_fs_new_rename(size_t num_params,
struct rkss_file_info p = {0};
int ret;

old_fname = (char *)params[1].u.memref.shm_id;
old_fname = (char *)(size_t)params[1].u.memref.shm_id;
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx\n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);
if (!old_fname)
return TEEC_ERROR_BAD_PARAMETERS;

new_fname = (char *)params[2].u.memref.shm_id;
new_fname = (char *)(size_t)params[2].u.memref.shm_id;
debug("params[2].u.memref.shm_id = 0x%llx params[2].u.memref.shm_offs = 0x%llx\n",
params[2].u.memref.shm_id, params[2].u.memref.shm_offs);
if (!new_fname)
Expand Down Expand Up @@ -1137,7 +1137,7 @@ static TEEC_Result ree_fs_new_opendir(size_t num_params,
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx \n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);

dirname = (char *)params[1].u.memref.shm_id;
dirname = (char *)(size_t)params[1].u.memref.shm_id;
if (!dirname)
return TEEC_ERROR_BAD_PARAMETERS;

Expand Down Expand Up @@ -1173,7 +1173,7 @@ static TEEC_Result ree_fs_new_readdir(size_t num_params,
size_t len;
size_t dirname_len;

dirname = (char *) params[1].u.memref.shm_id;
dirname = (char *)(size_t)params[1].u.memref.shm_id;
debug("params[1].u.memref.shm_id = 0x%llx params[1].u.memref.shm_offs = 0x%llx \n",
params[1].u.memref.shm_id, params[1].u.memref.shm_offs);
if (!dirname)
Expand Down
6 changes: 3 additions & 3 deletions lib/optee_clientApi/OpteeClientSMC.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ TEEC_Result TEEC_SMC_OpenSession(TEEC_Context *context,
#endif

#ifdef CONFIG_OPTEE_V2
#ifdef CONFIG_ARM64
#if defined CONFIG_ARM64 || defined CONFIG_ARM64_BOOT_AARCH32
uint8_t * session_uuid = (uint8_t *)&TeeSmcMetaSession->uuid;
tee_uuid_to_octets(session_uuid, destination);
memcpy((void *)&TeeSmc32Param[0].u.value, &TeeSmcMetaSession->uuid, sizeof(TeeSmcMetaSession->uuid));
Expand Down Expand Up @@ -307,7 +307,7 @@ void SetTeeSmc32Params(TEEC_Operation *operation,
#endif

#ifdef CONFIG_OPTEE_V2
#ifdef CONFIG_ARM64
#if defined CONFIG_ARM64 || defined CONFIG_ARM64_BOOT_AARCH32
attr += (OPTEE_MSG_ATTR_TYPE_TMEM_INPUT_V2 - TEEC_MEMREF_TEMP_INPUT);
debug(" OPTEE_OS_V2 ARCH64 attr %x\n", attr);
#else
Expand Down Expand Up @@ -376,7 +376,7 @@ TEEC_Result OpteeSmcCall(t_teesmc32_arg *TeeSmc32Arg)

while (1) {
tee_smc_call(&ArmSmcArgs);
debug("arg0=0x%x arg1=0x%x arg2=0x%x arg3=0x%x",
debug("arg0=0x%x arg1=0x%x arg2=0x%x arg3=0x%x \n",
ArmSmcArgs.Arg0, ArmSmcArgs.Arg1, ArmSmcArgs.Arg2, ArmSmcArgs.Arg3);
if (TEESMC_RETURN_IS_RPC(ArmSmcArgs.Arg0)) {
(void) OpteeRpcCallback(&ArmSmcArgs);
Expand Down

0 comments on commit d156c9f

Please sign in to comment.