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 #ifndef TEE_INIT_H 13 #define TEE_INIT_H 14 15 #include "tee_defines.h" 16 #include "ta_framework.h" 17 18 #define INVALID_DEV_ID 0xFFFFFFFFU 19 20 struct running_info { 21 TEE_UUID uuid; 22 uint32_t dev_id; 23 uint32_t session_id; 24 uint32_t global_handle; 25 uint32_t session_type; 26 }; 27 28 void tee_pre_init(int init_build, const struct ta_init_msg *init_msg); 29 TEE_Result tee_init(const struct ta_init_msg *init_msg); 30 void tee_exit(void); 31 void tee_session_init(uint32_t session_id); 32 void tee_session_exit(uint32_t session_id); 33 void tee_init_context(uint32_t session_id, uint32_t dev_id); 34 TEE_UUID *get_current_uuid(void); 35 uint32_t get_current_session_id(void); 36 uint32_t get_current_dev_id(void); 37 void set_global_handle(uint32_t handle); 38 uint32_t get_global_handle(void); 39 void set_running_uuid(void); 40 void set_current_session_type(uint32_t session_type); 41 struct running_info *get_tls_running_info(void); 42 TEE_UUID *get_running_uuid(void); 43 #endif 44