1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3 * Copyright (c) 2020, Linaro Limited
4 * Copyright (c) 2014, STMicroelectronics International N.V.
5 */
6
7 #include <initcall.h>
8 #include <trace.h>
9 #include <kernel/linker.h>
10
11 /*
12 * Note: this function is weak just to make it possible to exclude it from
13 * the unpaged area.
14 */
call_preinitcalls(void)15 void __weak call_preinitcalls(void)
16 {
17 const struct initcall *call = NULL;
18 TEE_Result ret = TEE_SUCCESS;
19
20 for (call = preinitcall_begin; call < preinitcall_end; call++) {
21 DMSG("level %d %s()", call->level, call->func_name);
22 ret = call->func();
23 if (ret != TEE_SUCCESS) {
24 EMSG("Preinitcall __text_start + 0x%08" PRIxVA
25 " failed", (vaddr_t)call - VCORE_START_VA);
26 }
27 }
28 }
29
30 /*
31 * Note: this function is weak just to make it possible to exclude it from
32 * the unpaged area.
33 */
call_initcalls(void)34 void __weak call_initcalls(void)
35 {
36 const struct initcall *call = NULL;
37 TEE_Result ret = TEE_SUCCESS;
38
39 for (call = initcall_begin; call < initcall_end; call++) {
40 DMSG("level %d %s()", call->level, call->func_name);
41 ret = call->func();
42 if (ret != TEE_SUCCESS) {
43 EMSG("Initcall __text_start + 0x%08" PRIxVA
44 " failed", (vaddr_t)call - VCORE_START_VA);
45 }
46 }
47 }
48
49 /*
50 * Note: this function is weak just to make it possible to exclude it from
51 * the unpaged area.
52 */
call_finalcalls(void)53 void __weak call_finalcalls(void)
54 {
55 const struct initcall *call = NULL;
56 TEE_Result ret = TEE_SUCCESS;
57
58 for (call = finalcall_begin; call < finalcall_end; call++) {
59 DMSG("level %d %s()", call->level, call->func_name);
60 ret = call->func();
61 if (ret != TEE_SUCCESS) {
62 EMSG("Finalcall __text_start + 0x%08" PRIxVA
63 " failed", (vaddr_t)call - VCORE_START_VA);
64 }
65 }
66 }
67