blob: 797a93639084990dc65bd9797b0ff3eb6fcab203 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +00002 * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005 */
6
7#include <arch.h>
Andrew Thoelke38bde412014-03-18 13:46:55 +00008#include <asm_macros.S>
Dan Handleyed6ff952014-05-14 17:44:19 +01009#include <platform_def.h>
Achin Gupta4f6ad662013-10-25 09:08:21 +010010
Achin Gupta4f6ad662013-10-25 09:08:21 +010011 .weak plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010012 .weak plat_crash_console_init
13 .weak plat_crash_console_putc
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000014 .weak plat_crash_console_flush
Soby Mathewf1785fd2014-08-14 12:22:32 +010015 .weak plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010016 .weak plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010017 .weak bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +010018 .weak plat_error_handler
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000019 .weak plat_panic_handler
Roberto Vargasbc1ae1f2017-09-26 12:53:01 +010020 .weak bl2_plat_preload_setup
21 .weak plat_try_next_boot_source
Achin Gupta4f6ad662013-10-25 09:08:21 +010022
Soby Mathew70716d62015-07-13 16:26:11 +010023#if !ENABLE_PLAT_COMPAT
24 .globl platform_get_core_pos
25
26#define MPIDR_RES_BIT_MASK 0xff000000
27
28 /* ------------------------------------------------------------------
29 * int platform_get_core_pos(int mpidr)
30 * Returns the CPU index of the CPU specified by mpidr. This is
31 * defined when platform compatibility is disabled to enable Trusted
32 * Firmware components like SPD using the old platform API to work.
33 * This API is deprecated and it assumes that the mpidr specified is
34 * that of a valid and present CPU. Instead, plat_my_core_pos()
35 * should be used for CPU index of the current CPU and
36 * plat_core_pos_by_mpidr() should be used for CPU index of a
37 * CPU specified by its mpidr.
38 * ------------------------------------------------------------------
39 */
40func_deprecated platform_get_core_pos
41 bic x0, x0, #MPIDR_RES_BIT_MASK
42 mrs x1, mpidr_el1
43 bic x1, x1, #MPIDR_RES_BIT_MASK
44 cmp x0, x1
45 beq plat_my_core_pos
46 b platform_core_pos_helper
47endfunc_deprecated platform_get_core_pos
48#endif
49
Achin Gupta4f6ad662013-10-25 09:08:21 +010050 /* -----------------------------------------------------
Achin Gupta4f6ad662013-10-25 09:08:21 +010051 * Placeholder function which should be redefined by
52 * each platform.
53 * -----------------------------------------------------
54 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000055func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010056 ret
Kévin Petita877c252015-03-24 14:03:57 +000057endfunc plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010058
59 /* -----------------------------------------------------
60 * Placeholder function which should be redefined by
61 * each platform.
62 * -----------------------------------------------------
63 */
64func plat_crash_console_init
65 mov x0, #0
66 ret
Kévin Petita877c252015-03-24 14:03:57 +000067endfunc plat_crash_console_init
Soby Mathew066f7132014-07-14 16:57:23 +010068
69 /* -----------------------------------------------------
70 * Placeholder function which should be redefined by
71 * each platform.
72 * -----------------------------------------------------
73 */
74func plat_crash_console_putc
75 ret
Kévin Petita877c252015-03-24 14:03:57 +000076endfunc plat_crash_console_putc
Soby Mathewf1785fd2014-08-14 12:22:32 +010077
78 /* -----------------------------------------------------
79 * Placeholder function which should be redefined by
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000080 * each platform.
81 * -----------------------------------------------------
82 */
83func plat_crash_console_flush
84 ret
85endfunc plat_crash_console_flush
86
87 /* -----------------------------------------------------
88 * Placeholder function which should be redefined by
Masahiro Yamada4c165ca2016-09-24 18:07:46 +090089 * each platform. This function should preserve x19 - x29.
Soby Mathewf1785fd2014-08-14 12:22:32 +010090 * -----------------------------------------------------
91 */
92func plat_reset_handler
93 ret
Kévin Petita877c252015-03-24 14:03:57 +000094endfunc plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010095
96 /* -----------------------------------------------------
97 * Placeholder function which should be redefined by
98 * each platform. This function is allowed to use
99 * registers x0 - x17.
100 * -----------------------------------------------------
101 */
102func plat_disable_acp
103 ret
Kévin Petita877c252015-03-24 14:03:57 +0000104endfunc plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +0100105
106 /* -----------------------------------------------------
Sandrine Bailleux87322b32015-11-10 15:01:57 +0000107 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castillod1413b22015-10-05 16:59:38 +0100108 * Called before exiting BL1. Default: do nothing
109 * -----------------------------------------------------
110 */
111func bl1_plat_prepare_exit
112 ret
113endfunc bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +0100114
115 /* -----------------------------------------------------
116 * void plat_error_handler(int err) __dead2;
117 * Endless loop by default.
118 * -----------------------------------------------------
119 */
120func plat_error_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +0100121 wfi
Juan Castillo26ae5832015-09-25 15:41:14 +0100122 b plat_error_handler
123endfunc plat_error_handler
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +0000124
125 /* -----------------------------------------------------
126 * void plat_panic_handler(void) __dead2;
127 * Endless loop by default.
128 * -----------------------------------------------------
129 */
130func plat_panic_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +0100131 wfi
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +0000132 b plat_panic_handler
133endfunc plat_panic_handler
Roberto Vargasbc1ae1f2017-09-26 12:53:01 +0100134
135 /* -----------------------------------------------------
136 * Placeholder function which should be redefined by
137 * each platfrom.
138 * -----------------------------------------------------
139 */
140func bl2_plat_preload_setup
141 ret
142endfunc bl2_plat_preload_setup
143
144 /* -----------------------------------------------------
145 * Placeholder function which should be redefined by
146 * each platfrom.
147 * -----------------------------------------------------
148 */
149func plat_try_next_boot_source
150 mov x0, #0
151 ret
152endfunc plat_try_next_boot_source