xref: /rk3399_ARM-atf/plat/common/plat_bl_common.c (revision 7fabe1a89903cab4919304faa085ee6eaaec5c9d)
1566034fcSSoby Mathew /*
2566034fcSSoby Mathew  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3566034fcSSoby Mathew  *
4566034fcSSoby Mathew  * SPDX-License-Identifier: BSD-3-Clause
5566034fcSSoby Mathew  */
6566034fcSSoby Mathew 
7566034fcSSoby Mathew #include <arch_helpers.h>
8566034fcSSoby Mathew #include <assert.h>
9566034fcSSoby Mathew #include <bl_common.h>
10566034fcSSoby Mathew #include <debug.h>
11566034fcSSoby Mathew #include <errno.h>
12a6f340feSSoby Mathew #include <platform.h>
13566034fcSSoby Mathew 
14566034fcSSoby Mathew /*
15566034fcSSoby Mathew  * The following platform functions are weakly defined. The Platforms
16566034fcSSoby Mathew  * may redefine with strong definition.
17566034fcSSoby Mathew  */
18566034fcSSoby Mathew #pragma weak bl2_el3_plat_prepare_exit
19566034fcSSoby Mathew #pragma weak plat_error_handler
20566034fcSSoby Mathew #pragma weak bl2_plat_preload_setup
21566034fcSSoby Mathew #pragma weak bl2_plat_handle_pre_image_load
22566034fcSSoby Mathew #pragma weak bl2_plat_handle_post_image_load
23566034fcSSoby Mathew #pragma weak plat_try_next_boot_source
24566034fcSSoby Mathew 
25566034fcSSoby Mathew void bl2_el3_plat_prepare_exit(void)
26566034fcSSoby Mathew {
27566034fcSSoby Mathew }
28566034fcSSoby Mathew 
29566034fcSSoby Mathew void __dead2 plat_error_handler(int err)
30566034fcSSoby Mathew {
31566034fcSSoby Mathew 	while (1)
32566034fcSSoby Mathew 		wfi();
33566034fcSSoby Mathew }
34566034fcSSoby Mathew 
35566034fcSSoby Mathew void bl2_plat_preload_setup(void)
36566034fcSSoby Mathew {
37566034fcSSoby Mathew }
38566034fcSSoby Mathew 
39*7fabe1a8SRoberto Vargas #if LOAD_IMAGE_V2
40566034fcSSoby Mathew int bl2_plat_handle_pre_image_load(unsigned int image_id)
41566034fcSSoby Mathew {
42566034fcSSoby Mathew 	return 0;
43566034fcSSoby Mathew }
44566034fcSSoby Mathew 
45566034fcSSoby Mathew int bl2_plat_handle_post_image_load(unsigned int image_id)
46566034fcSSoby Mathew {
47566034fcSSoby Mathew 	return 0;
48566034fcSSoby Mathew }
49*7fabe1a8SRoberto Vargas #endif
50566034fcSSoby Mathew 
51566034fcSSoby Mathew int plat_try_next_boot_source(void)
52566034fcSSoby Mathew {
53566034fcSSoby Mathew 	return 0;
54566034fcSSoby Mathew }
55a6f340feSSoby Mathew 
56a6f340feSSoby Mathew #if !ERROR_DEPRECATED
57a6f340feSSoby Mathew #pragma weak bl2_early_platform_setup2
58a6f340feSSoby Mathew 
59a6f340feSSoby Mathew /*
60a6f340feSSoby Mathew  * The following platform API implementation that allow compatibility for
61a6f340feSSoby Mathew  * the older platform APIs.
62a6f340feSSoby Mathew  */
63a6f340feSSoby Mathew void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
64a6f340feSSoby Mathew 			u_register_t arg2, u_register_t arg3)
65a6f340feSSoby Mathew {
66a6f340feSSoby Mathew 	bl2_early_platform_setup((void *)arg1);
67a6f340feSSoby Mathew }
68a6f340feSSoby Mathew #endif
69