xref: /rk3399_ARM-atf/plat/common/aarch64/platform_helpers.S (revision 82cb2c1ad9897473743f08437d0a3995bed561b9)
1/*
2 * Copyright (c) 2013-2017, 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 <platform_def.h>
10
11	.weak	plat_report_exception
12	.weak	plat_crash_console_init
13	.weak	plat_crash_console_putc
14	.weak	plat_crash_console_flush
15	.weak	plat_reset_handler
16	.weak	plat_disable_acp
17	.weak	bl1_plat_prepare_exit
18	.weak	plat_error_handler
19	.weak	plat_panic_handler
20
21#if !ENABLE_PLAT_COMPAT
22	.globl	platform_get_core_pos
23
24#define MPIDR_RES_BIT_MASK	0xff000000
25
26	/* ------------------------------------------------------------------
27	 *  int platform_get_core_pos(int mpidr)
28	 *  Returns the CPU index of the CPU specified by mpidr. This is
29	 *  defined when platform compatibility is disabled to enable Trusted
30	 *  Firmware components like SPD using the old  platform API to work.
31	 *  This API is deprecated and it assumes that the mpidr specified is
32	 *  that of a valid and present CPU. Instead, plat_my_core_pos()
33	 *  should be used for CPU index of the current CPU and
34	 *  plat_core_pos_by_mpidr() should be used for CPU index of a
35	 *  CPU specified by its mpidr.
36	 * ------------------------------------------------------------------
37	 */
38func_deprecated platform_get_core_pos
39	bic	x0, x0, #MPIDR_RES_BIT_MASK
40	mrs	x1, mpidr_el1
41	bic	x1, x1, #MPIDR_RES_BIT_MASK
42	cmp	x0, x1
43	beq	plat_my_core_pos
44	b	platform_core_pos_helper
45endfunc_deprecated platform_get_core_pos
46#endif
47
48	/* -----------------------------------------------------
49	 * Placeholder function which should be redefined by
50	 * each platform.
51	 * -----------------------------------------------------
52	 */
53func plat_report_exception
54	ret
55endfunc plat_report_exception
56
57	/* -----------------------------------------------------
58	 * Placeholder function which should be redefined by
59	 * each platform.
60	 * -----------------------------------------------------
61	 */
62func plat_crash_console_init
63	mov	x0, #0
64	ret
65endfunc plat_crash_console_init
66
67	/* -----------------------------------------------------
68	 * Placeholder function which should be redefined by
69	 * each platform.
70	 * -----------------------------------------------------
71	 */
72func plat_crash_console_putc
73	ret
74endfunc plat_crash_console_putc
75
76	/* -----------------------------------------------------
77	 * Placeholder function which should be redefined by
78	 * each platform.
79	 * -----------------------------------------------------
80	 */
81func plat_crash_console_flush
82	ret
83endfunc plat_crash_console_flush
84
85	/* -----------------------------------------------------
86	 * Placeholder function which should be redefined by
87	 * each platform. This function should preserve x19 - x29.
88	 * -----------------------------------------------------
89	 */
90func plat_reset_handler
91	ret
92endfunc plat_reset_handler
93
94	/* -----------------------------------------------------
95	 * Placeholder function which should be redefined by
96	 * each platform. This function is allowed to use
97	 * registers x0 - x17.
98	 * -----------------------------------------------------
99	 */
100func plat_disable_acp
101	ret
102endfunc plat_disable_acp
103
104	/* -----------------------------------------------------
105	 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
106	 * Called before exiting BL1. Default: do nothing
107	 * -----------------------------------------------------
108	 */
109func bl1_plat_prepare_exit
110	ret
111endfunc bl1_plat_prepare_exit
112
113	/* -----------------------------------------------------
114	 * void plat_error_handler(int err) __dead2;
115	 * Endless loop by default.
116	 * -----------------------------------------------------
117	 */
118func plat_error_handler
119	wfi
120	b	plat_error_handler
121endfunc plat_error_handler
122
123	/* -----------------------------------------------------
124	 * void plat_panic_handler(void) __dead2;
125	 * Endless loop by default.
126	 * -----------------------------------------------------
127	 */
128func plat_panic_handler
129	wfi
130	b	plat_panic_handler
131endfunc plat_panic_handler
132