• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "gtask_config.h"
13 #include "tee_config.h"
14 #include <priorities.h>
15 
16 const struct task_info_st g_teeos_builtin_task_infos[] = {
17 #ifdef TEE_SUPPORT_SSA_64BIT
18     { TEE_SERVICE_SSA, SSA_SERVICE_NAME, "/ssa.elf", PRIO_TEE_AGENT, true },
19 #elif TEE_SUPPORT_SSA_32BIT
20     { TEE_SERVICE_SSA, SSA_SERVICE_NAME, "/ssa.elf", PRIO_TEE_AGENT, false },
21 #endif
22 #ifdef TEE_SUPPORT_HUK_SERVICE_64BIT
23     { TEE_SERVICE_HUK, HUK_TASK_NAME, "/huk_service.elf", PRIO_TEE_AGENT, true },
24 #elif TEE_SUPPORT_HUK_SERVICE_32BIT
25     { TEE_SERVICE_HUK, HUK_TASK_NAME, "/huk_service.elf", PRIO_TEE_AGENT, false },
26 #endif
27 #ifdef TEE_SUPPORT_PERM_64BIT
28     {TEE_SERVICE_PERM, PERM_SERVICE_NAME, "/permission_service.elf", PRIO_TEE_AGENT, true},
29 #elif TEE_SUPPORT_PERM_32BIT
30     {TEE_SERVICE_PERM, PERM_SERVICE_NAME, "/permission_service.elf", PRIO_TEE_AGENT, false},
31 #endif
32 };
33 
34 static const uint32_t g_teeos_builtin_task_num =
35     sizeof(g_teeos_builtin_task_infos) / sizeof(g_teeos_builtin_task_infos[0]);
36 
get_teeos_builtin_task_nums(void)37 uint32_t get_teeos_builtin_task_nums(void)
38 {
39     return g_teeos_builtin_task_num;
40 }
41 
get_teeos_builtin_task_infos(void)42 const struct task_info_st *get_teeos_builtin_task_infos(void)
43 {
44     return g_teeos_builtin_task_infos;
45 }
46 
47 #define SSA_SHRINK_STACK_DIV  4
48 #define SSA_DEFAULT_STACK_MUL 8
49 #define SSA_DEFAULT_HEAP_MUL  8
50 #define RPMB_DEFAULT_HEAP_MUL 8
51 #define RPMB_HUK_STACK_DIV    4
52 #define RPMB_HUK_HEAP_DIV     2
53 #define SSA_DEFAULT_HEAP_HEAPMGR_MUL  24
54 #define HUK_DEFAULT_HEAP_HEAPMGR_MUL  24
55 #define HUK_SRV_STACK_SIZE (DEFAULT_STACK_SIZE * 2)
56 #define HUK_SRV_HEAP_SIZE  (DEFAULT_HEAP_SIZE * 4)
57 #define PERM_SRV_STACK_SIZE (DEFAULT_STACK_SIZE * 4)
58 #define PERM_SRV_HEAP_SIZE  (DEFAULT_HEAP_SIZE * 12)
59 
60 /* build in service propertys for teeos */
61 const struct ta_property g_teeos_service_property[] = {
62     /* uuid  stack  heap  instance multi_session  alive ssa_enum_enable other_property other_property_len */
63     { TEE_SERVICE_REET, DEFAULT_STACK_SIZE, DEFAULT_HEAP_SIZE, true, false, false, false, NULL, 0 },
64 #if (defined TEE_SUPPORT_SSA_64BIT || defined TEE_SUPPORT_SSA_32BIT)
65     { TEE_SERVICE_SSA, DEFAULT_STACK_SIZE * SSA_DEFAULT_STACK_MUL, DEFAULT_HEAP_SIZE * SSA_DEFAULT_HEAP_MUL,
66       true, false, false, false, NULL, 0 },
67 #endif
68 #if (defined TEE_SUPPORT_HUK_SERVICE_32BIT || defined TEE_SUPPORT_HUK_SERVICE_64BIT)
69     { TEE_SERVICE_HUK, HUK_SRV_STACK_SIZE, HUK_SRV_HEAP_SIZE,
70       true, false, false, false, NULL, 0 },
71 #endif
72 #if (defined TEE_SUPPORT_PERM_64BIT || defined TEE_SUPPORT_PERM_32BIT)
73     { TEE_SERVICE_PERM, PERM_SRV_STACK_SIZE, PERM_SRV_HEAP_SIZE, true, false, false, false, NULL, 0 },
74 #endif
75 };
76 
77 static const uint32_t g_teeos_service_property_num =
78     sizeof(g_teeos_service_property) / sizeof(g_teeos_service_property[0]);
79 
get_teeos_service_property_num(void)80 uint32_t get_teeos_service_property_num(void)
81 {
82     return g_teeos_service_property_num;
83 }
84 
get_teeos_service_property_config(void)85 const struct ta_property *get_teeos_service_property_config(void)
86 {
87     return g_teeos_service_property;
88 }
89 
90