mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-20 19:44:23 +00:00
feat(mediatek): add SiP service for OP-TEE
Add SiP service for the SMC call from the secure world. Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Signed-off-by: jason-ch chen <Jason-ch.Chen@mediatek.com> Change-Id: I7a5cfaac5c46ea65be793c3d291e4332cc0b2e54
This commit is contained in:
parent
1678bbb572
commit
621eaab5cc
3 changed files with 33 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, MediaTek Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, MediaTek Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -76,6 +76,7 @@
|
|||
|
||||
MTK_SIP_SMC_FROM_BL33_TABLE(SMC_ID_EXPAND_AS_DESCRIPTOR_INDEX);
|
||||
MTK_SIP_SMC_FROM_NS_EL1_TABLE(SMC_ID_EXPAND_AS_DESCRIPTOR_INDEX);
|
||||
MTK_SIP_SMC_FROM_S_EL1_TABLE(SMC_ID_EXPAND_AS_DESCRIPTOR_INDEX);
|
||||
|
||||
IMPORT_SYM(uintptr_t, __MTK_SMC_POOL_START__, MTK_SMC_POOL_START);
|
||||
IMPORT_SYM(uintptr_t, __MTK_SMC_POOL_END_UNALIGNED__, MTK_SMC_POOL_END_UNALIGNED);
|
||||
|
@ -134,6 +135,28 @@ static int mtk_smc_handler_init(void)
|
|||
}
|
||||
MTK_EARLY_PLAT_INIT(mtk_smc_handler_init);
|
||||
|
||||
/* This function handles Mediatek defined SiP Calls from Secure world */
|
||||
static u_register_t mtk_smc_handler_sel1(uint32_t smc_id,
|
||||
u_register_t x1,
|
||||
u_register_t x2,
|
||||
u_register_t x3,
|
||||
u_register_t x4,
|
||||
void *cookie,
|
||||
void *handle,
|
||||
u_register_t flags)
|
||||
{
|
||||
u_register_t ret = MTK_SIP_E_SUCCESS;
|
||||
struct smccc_res smc_ret = {0};
|
||||
|
||||
switch (smc_id) {
|
||||
MTK_SIP_SMC_FROM_S_EL1_TABLE(SMC_ID_EXPAND_AS_SMC_OPERATION);
|
||||
default:
|
||||
INFO("SEL1 SMC ID:0x%x not support\n", smc_id);
|
||||
ret = SMC_UNK;
|
||||
}
|
||||
SMC_RET4(handle, ret, smc_ret.a1, smc_ret.a2, smc_ret.a3);
|
||||
}
|
||||
|
||||
/* This function handles Mediatek defined SiP Calls from Bootloader */
|
||||
static uintptr_t mtk_smc_handler_bl33(uint32_t smc_id,
|
||||
u_register_t x1,
|
||||
|
@ -209,8 +232,8 @@ static uintptr_t mtk_smc_handler(uint32_t smc_id,
|
|||
|
||||
if (!ns) {
|
||||
/* SiP SMC service secure world's call */
|
||||
INFO("Secure SMC ID:0x%x not supported\n", smc_id);
|
||||
SMC_RET1(handle, ret);
|
||||
return mtk_smc_handler_sel1(smc_num, x1, x2, x3, x4,
|
||||
cookie, handle, flags);
|
||||
}
|
||||
if (is_from_bl33(smc_ori)) {
|
||||
/* SiP SMC service secure bootloader's call */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, MediaTek Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, MediaTek Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -19,6 +19,9 @@
|
|||
_func(MTK_SIP_DP_CONTROL, 0x523) \
|
||||
_func(MTK_SIP_KERNEL_GIC_OP, 0x526)
|
||||
|
||||
#define MTK_SIP_SMC_FROM_S_EL1_TABLE(_func) \
|
||||
_func(MTK_SIP_TEE_MPU_PERM_SET, 0x031)
|
||||
|
||||
#define MTK_SIP_SMC_FROM_BL33_TABLE(_func) \
|
||||
_func(MTK_SIP_KERNEL_BOOT, 0x115)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2022-2023, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -55,11 +55,13 @@
|
|||
|
||||
MTK_SIP_SMC_FROM_BL33_TABLE(SMC_ID_EXPAND_AS_EXTERN_SMC_INDEX);
|
||||
MTK_SIP_SMC_FROM_NS_EL1_TABLE(SMC_ID_EXPAND_AS_EXTERN_SMC_INDEX);
|
||||
MTK_SIP_SMC_FROM_S_EL1_TABLE(SMC_ID_EXPAND_AS_EXTERN_SMC_INDEX);
|
||||
|
||||
/* Expand SiP SMC ID table as enum */
|
||||
enum {
|
||||
MTK_SIP_SMC_FROM_BL33_TABLE(SMC_ID_EXPAND_AS_ENUM)
|
||||
MTK_SIP_SMC_FROM_NS_EL1_TABLE(SMC_ID_EXPAND_AS_ENUM)
|
||||
MTK_SIP_SMC_FROM_S_EL1_TABLE(SMC_ID_EXPAND_AS_ENUM)
|
||||
MTK_SIP_SMC_MAX_NUMBER
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue