File: initcall.c

package info (click to toggle)
optee-os 4.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,960 kB
  • sloc: ansic: 444,388; asm: 12,922; python: 3,719; makefile: 1,681; sh: 238
file content (74 lines) | stat: -rw-r--r-- 1,626 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: BSD-2-Clause
/*
 * Copyright (c) 2020, Linaro Limited
 * Copyright (c) 2014, STMicroelectronics International N.V.
 */

#include <initcall.h>
#include <trace.h>
#include <kernel/linker.h>

static void do_init_calls(const char *type __maybe_unused,
			  const struct initcall *begin,
			  const struct initcall *end)
{
	const struct initcall *call = NULL;
	TEE_Result ret = TEE_SUCCESS;

	for (call = begin; call < end; call++) {
		DMSG("%s level %d %s()", type, call->level, call->func_name);
		ret = call->func();
		if (ret) {
			EMSG("%s __text_start + 0x%08"PRIxVA" failed",
			     type, (vaddr_t)call - VCORE_START_VA);
		}
	}
}

#define DO_INIT_CALLS(name) \
	do_init_calls(#name, name##_begin, name##_end)

/*
 * Note: this function is weak just to make it possible to exclude it from
 * the unpaged area.
 */
void __weak call_preinitcalls(void)
{
	DO_INIT_CALLS(preinitcall);
}

/*
 * Note: this function is weak just to make it possible to exclude it from
 * the unpaged area.
 */
void __weak call_early_initcalls(void)
{
	DO_INIT_CALLS(early_initcall);
}

/*
 * Note: this function is weak just to make it possible to exclude it from
 * the unpaged area.
 */
void __weak call_service_initcalls(void)
{
	DO_INIT_CALLS(service_initcall);
}

/*
 * Note: this function is weak just to make it possible to exclude it from
 * the unpaged area.
 */
void __weak call_driver_initcalls(void)
{
	DO_INIT_CALLS(driver_initcall);
}

/*
 * Note: this function is weak just to make it possible to exclude it from
 * the unpaged area.
 */
void __weak call_finalcalls(void)
{
	DO_INIT_CALLS(finalcall);
}