blob: e60db20130c6ea932ef1bc62ac838ca51a6648f7 [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
Achin Gupta4f6ad662013-10-25 09:08:21 +010020
Soby Mathew70716d62015-07-13 16:26:11 +010021#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
Achin Gupta4f6ad662013-10-25 09:08:21 +010048 /* -----------------------------------------------------
Achin Gupta4f6ad662013-10-25 09:08:21 +010049 * Placeholder function which should be redefined by
50 * each platform.
51 * -----------------------------------------------------
52 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000053func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010054 ret
Kévin Petita877c252015-03-24 14:03:57 +000055endfunc plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010056
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
Kévin Petita877c252015-03-24 14:03:57 +000065endfunc plat_crash_console_init
Soby Mathew066f7132014-07-14 16:57:23 +010066
67 /* -----------------------------------------------------
68 * Placeholder function which should be redefined by
69 * each platform.
70 * -----------------------------------------------------
71 */
72func plat_crash_console_putc
73 ret
Kévin Petita877c252015-03-24 14:03:57 +000074endfunc plat_crash_console_putc
Soby Mathewf1785fd2014-08-14 12:22:32 +010075
76 /* -----------------------------------------------------
77 * Placeholder function which should be redefined by
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000078 * 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
Masahiro Yamada4c165ca2016-09-24 18:07:46 +090087 * each platform. This function should preserve x19 - x29.
Soby Mathewf1785fd2014-08-14 12:22:32 +010088 * -----------------------------------------------------
89 */
90func plat_reset_handler
91 ret
Kévin Petita877c252015-03-24 14:03:57 +000092endfunc plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010093
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
Kévin Petita877c252015-03-24 14:03:57 +0000102endfunc plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +0100103
104 /* -----------------------------------------------------
Sandrine Bailleux87322b32015-11-10 15:01:57 +0000105 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castillod1413b22015-10-05 16:59:38 +0100106 * Called before exiting BL1. Default: do nothing
107 * -----------------------------------------------------
108 */
109func bl1_plat_prepare_exit
110 ret
111endfunc bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +0100112
113 /* -----------------------------------------------------
114 * void plat_error_handler(int err) __dead2;
115 * Endless loop by default.
116 * -----------------------------------------------------
117 */
118func plat_error_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +0100119 wfi
Juan Castillo26ae5832015-09-25 15:41:14 +0100120 b plat_error_handler
121endfunc plat_error_handler
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +0000122
123 /* -----------------------------------------------------
124 * void plat_panic_handler(void) __dead2;
125 * Endless loop by default.
126 * -----------------------------------------------------
127 */
128func plat_panic_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +0100129 wfi
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +0000130 b plat_panic_handler
131endfunc plat_panic_handler