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 GTASK_SERVICE_MANAGER_H 13 #define GTASK_SERVICE_MANAGER_H 14 15 #include <dlist.h> 16 #include <ipclib.h> 17 18 #define INVALID_SERVICE_INDEX (-1) 19 #define SERVICE_INDEX_MAX 2048 20 21 bool dynamic_service_exist(const TEE_UUID *uuid, bool build_in); 22 TEE_Result register_service(const char *name, const TEE_UUID *uuid, bool dyn_conf_registed, 23 const struct service_attr *service_attr); 24 TEE_Result ta_framework_init(void); 25 void init_service_property(const TEE_UUID *uuid, uint32_t stack, uint32_t heap, 26 bool single_instance, bool multi_session, bool keep_alive, 27 bool ssa_enum_enable, bool mem_page_align, const char *other_buff, 28 uint32_t other_len); 29 bool need_load_srv(const TEE_UUID *uuid); 30 TEE_Result start_internal_task(const TEE_UUID *uuid, uint16_t task_prio, const char *task_name, uint32_t *task_id); 31 bool is_gtask_by_uuid(const TEE_UUID *task_uuid); 32 struct dlist_node *get_service_head_ptr(void); 33 #ifdef CONFIG_ENABLE_DUMP_SRV_SESS 34 TEE_Result dump_service_session_info(const smc_cmd_t *cmd); 35 #endif 36 37 struct service_struct *find_service_dead(const TEE_UUID *uuid, uint32_t service_index); 38 bool find_task(uint32_t task_id, struct service_struct **service, struct session_struct **session); 39 bool find_task_dead(uint32_t task_id, struct service_struct **service, struct session_struct **session); 40 bool is_system_service(const struct service_struct *service); 41 void process_release_service(struct service_struct *service, uint32_t if_reuse_elf); 42 void recycle_srvc_thread(struct service_struct *service); 43 TEE_Result age_service(void); 44 void decr_ref_cnt(struct service_struct *service); 45 void get_interval(const TEE_Time *cur, const TEE_Time *base, uint64_t *interval); 46 void age_timeout_lib(void); 47 48 #endif /* GTASK_SERVICE_MANAGER_H */ 49