xref: /rk3399_ARM-atf/plat/common/aarch64/platform_helpers.S (revision 73308618fee8afc4518c592956b31864e57e48e7)
1/*
2 * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <drivers/console.h>
10#include <platform_def.h>
11
12	.weak	plat_report_exception
13#if !ERROR_DEPRECATED
14	.weak	plat_crash_console_init
15	.weak	plat_crash_console_putc
16	.weak	plat_crash_console_flush
17#endif
18	.weak	plat_reset_handler
19	.weak	plat_disable_acp
20	.weak	bl1_plat_prepare_exit
21	.weak	plat_panic_handler
22	.weak	bl31_plat_enable_mmu
23	.weak	bl32_plat_enable_mmu
24
25	.weak	plat_handle_uncontainable_ea
26	.weak	plat_handle_double_fault
27	.weak	plat_handle_el3_ea
28
29#define MPIDR_RES_BIT_MASK	0xff000000
30
31	/* -----------------------------------------------------
32	 * Placeholder function which should be redefined by
33	 * each platform.
34	 * -----------------------------------------------------
35	 */
36func plat_report_exception
37	ret
38endfunc plat_report_exception
39
40#if !ERROR_DEPRECATED
41func plat_crash_console_init
42	mov	x0, #0
43	ret
44endfunc plat_crash_console_init
45
46func plat_crash_console_putc
47	ret
48endfunc plat_crash_console_putc
49
50func plat_crash_console_flush
51	ret
52endfunc plat_crash_console_flush
53#endif /* ERROR_DEPRECATED */
54
55	/* -----------------------------------------------------
56	 * Placeholder function which should be redefined by
57	 * each platform. This function should preserve x19 - x29.
58	 * -----------------------------------------------------
59	 */
60func plat_reset_handler
61	ret
62endfunc plat_reset_handler
63
64	/* -----------------------------------------------------
65	 * Placeholder function which should be redefined by
66	 * each platform. This function is allowed to use
67	 * registers x0 - x17.
68	 * -----------------------------------------------------
69	 */
70func plat_disable_acp
71	ret
72endfunc plat_disable_acp
73
74	/* -----------------------------------------------------
75	 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
76	 * Called before exiting BL1. Default: do nothing
77	 * -----------------------------------------------------
78	 */
79func bl1_plat_prepare_exit
80	ret
81endfunc bl1_plat_prepare_exit
82
83	/* -----------------------------------------------------
84	 * void plat_panic_handler(void) __dead2;
85	 * Endless loop by default.
86	 * -----------------------------------------------------
87	 */
88func plat_panic_handler
89	wfi
90	b	plat_panic_handler
91endfunc plat_panic_handler
92
93	/* -----------------------------------------------------
94	 * void bl31_plat_enable_mmu(uint32_t flags);
95	 *
96	 * Enable MMU in BL31.
97	 * -----------------------------------------------------
98	 */
99func bl31_plat_enable_mmu
100	b	enable_mmu_direct_el3
101endfunc bl31_plat_enable_mmu
102
103	/* -----------------------------------------------------
104	 * void bl32_plat_enable_mmu(uint32_t flags);
105	 *
106	 * Enable MMU in BL32.
107	 * -----------------------------------------------------
108	 */
109func bl32_plat_enable_mmu
110	b	enable_mmu_direct_el1
111endfunc bl32_plat_enable_mmu
112
113
114	/* -----------------------------------------------------
115	 * Platform handler for Uncontainable External Abort.
116	 *
117	 * x0: EA reason
118	 * x1: EA syndrome
119	 * -----------------------------------------------------
120	 */
121func plat_handle_uncontainable_ea
122	b	report_unhandled_exception
123endfunc plat_handle_uncontainable_ea
124
125	/* -----------------------------------------------------
126	 * Platform handler for Double Fault.
127	 *
128	 * x0: EA reason
129	 * x1: EA syndrome
130	 * -----------------------------------------------------
131	 */
132func plat_handle_double_fault
133	b	report_unhandled_exception
134endfunc plat_handle_double_fault
135
136	/* -----------------------------------------------------
137	 * Platform handler for EL3 External Abort.
138	 * -----------------------------------------------------
139	 */
140func plat_handle_el3_ea
141	b	report_unhandled_exception
142endfunc plat_handle_el3_ea
143