1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 13 #ifndef TEE_INTERNAL_TASK_PUB_H 14 #define TEE_INTERNAL_TASK_PUB_H 15 16 #include <stddef.h> 17 #include "tee_defines.h" 18 #include "ta_framework.h" 19 #include "tee_service_public.h" 20 21 /* 22 * here 10 is based on experience, we need to ensure that 23 * the number of clients accessing the service does not exceed this SRV_MAX_CLIENTS 24 */ 25 #define SRV_MAX_CLIENTS (10 * TA_SESSION_MAX) 26 27 /* 28 * these pub cmd should be defined very carefully, 29 * cannot conflict with cmd of internal tasks 30 */ 31 enum TEE_INTERNAL_TASK_MSG_CMD { 32 TEE_TASK_MSG_BASE = 0x1000, 33 TEE_TASK_OPEN_TA_SESSION = TEE_TASK_MSG_BASE + 1, /* gtask send TA open session msg to internal task */ 34 TEE_TASK_CLOSE_TA_SESSION = TEE_TASK_MSG_BASE + 2, /* gtask send TA close session msg to internal task */ 35 TEE_TASK_REGISTER_AGENT = TEE_TASK_MSG_BASE + 3, /* only for ssa, gtask -> ssa */ 36 TEE_TASK_SET_CALLER_INFO = TEE_TASK_MSG_BASE + 4, /* internal task send caller ta gtask */ 37 TEE_TASK_SET_CALLER_INFO_ACK = TEE_TASK_MSG_BASE + 5, /* gtask -> internal task */ 38 TEE_TASK_AGENT_SMC_CMD = TEE_TASK_MSG_BASE + 6, /* system agent service -> gtask */ 39 TEE_TASK_AGENT_SMC_ACK = TEE_TASK_MSG_BASE + 7, /* gtask -> system agent service */ 40 TEE_TASK_UNRESISTER_SERVICE = TEE_TASK_MSG_BASE + 8, /* dynamic service to gtask */ 41 TEE_TASK_CREATE_TA_SERVICE = TEE_TASK_MSG_BASE + 9, /* gtask send TA create service msg to internal task */ 42 TEE_TASK_RELEASE_TA_SERVICE = TEE_TASK_MSG_BASE + 10, /* gtask send TA release service msg to internal task */ 43 TEE_TASK_MSG_END 44 }; 45 46 struct reg_agent_buf { 47 uint32_t agentid; 48 paddr_t phys_addr; 49 uint32_t size; 50 }; 51 52 struct task_caller_info { 53 uint32_t taskid; 54 uint32_t cmd; 55 }; 56 57 #endif 58