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_MEM_MANAGER_H 13 #define GTASK_MEM_MANAGER_H 14 15 #include <dlist.h> 16 #include "gtask_core.h" 17 18 TEE_Result cmd_ns_get_params(uint32_t task_id, const smc_cmd_t *cmd, uint32_t *param_type, uint64_t *params); 19 TEE_Result cmd_secure_get_params(uint32_t task_id, const smc_cmd_t *cmd, uint32_t *param_type, uint64_t *params); 20 TEE_Result cmd_global_ns_get_params(const smc_cmd_t *cmd, uint32_t *param_type, TEE_Param **params); 21 TEE_Result map_ns_operation(const smc_cmd_t *cmd); 22 TEE_Result unmap_ns_operation(smc_cmd_t *cmd); 23 void *map_ns_cmd(paddr_t cmd_phy); 24 TEE_Result map_secure_operation(uint64_t tacmd, smc_cmd_t *out_cmd, uint32_t task_id); 25 TEE_Result unmap_secure_operation(const smc_cmd_t *cmd); 26 void mem_manager_init(void); 27 TEE_Result store_s_cmd(const smc_cmd_t *cmd); 28 TEE_Result copy_pam_to_src(uint32_t cmd_id, bool ta2ta); 29 TEE_Result register_mailbox(const smc_cmd_t *cmd); 30 bool in_mailbox_range(paddr_t addr, uint32_t size); 31 TEE_Result check_cmd_in_mailbox_range(const smc_cmd_t *cmd); 32 void *mailbox_phys_to_virt(paddr_t phys); 33 TEE_Result dump_statmeminfo(const smc_cmd_t *cmd); 34 void task_del_mem_region(struct dlist_node *mem_list, bool is_service_dead); 35 36 bool is_opensession_cmd(const smc_cmd_t *cmd); 37 void release_pam_node(struct pam_node *node); 38 bool check_short_buffer(void); 39 40 #endif /* GTASK_MEM_MANAGER_H */ 41