blob: b8fd3a2cd6f8f3db07c837bc93890345039598dc [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Varun Wadekar9388afa2019-01-10 15:45:15 -08002 * Copyright (c) 2013-2019, 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>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <drivers/console.h>
Dan Handleyed6ff952014-05-14 17:44:19 +010010#include <platform_def.h>
Achin Gupta4f6ad662013-10-25 09:08:21 +010011
Achin Gupta4f6ad662013-10-25 09:08:21 +010012 .weak plat_report_exception
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010013#if !ERROR_DEPRECATED
Soby Mathew066f7132014-07-14 16:57:23 +010014 .weak plat_crash_console_init
15 .weak plat_crash_console_putc
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000016 .weak plat_crash_console_flush
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010017#endif
Soby Mathewf1785fd2014-08-14 12:22:32 +010018 .weak plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010019 .weak plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010020 .weak bl1_plat_prepare_exit
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000021 .weak plat_panic_handler
Jeenu Viswambharane834ee12018-04-27 15:17:03 +010022 .weak bl31_plat_enable_mmu
23 .weak bl32_plat_enable_mmu
Achin Gupta4f6ad662013-10-25 09:08:21 +010024
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +010025 .weak plat_handle_uncontainable_ea
Jeenu Viswambharan93bc4bd2018-05-17 11:24:01 +010026 .weak plat_handle_double_fault
Jeenu Viswambharan911fcc92018-07-06 16:50:06 +010027 .weak plat_handle_el3_ea
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +010028
Soby Mathew70716d62015-07-13 16:26:11 +010029#define MPIDR_RES_BIT_MASK 0xff000000
30
Achin Gupta4f6ad662013-10-25 09:08:21 +010031 /* -----------------------------------------------------
Achin Gupta4f6ad662013-10-25 09:08:21 +010032 * Placeholder function which should be redefined by
33 * each platform.
34 * -----------------------------------------------------
35 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000036func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010037 ret
Kévin Petita877c252015-03-24 14:03:57 +000038endfunc plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010039
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010040#if !ERROR_DEPRECATED
Soby Mathew066f7132014-07-14 16:57:23 +010041func plat_crash_console_init
42 mov x0, #0
43 ret
Kévin Petita877c252015-03-24 14:03:57 +000044endfunc plat_crash_console_init
Soby Mathew066f7132014-07-14 16:57:23 +010045
Julius Werneraae9bb12017-09-18 16:49:48 -070046func plat_crash_console_putc
47 ret
48endfunc plat_crash_console_putc
49
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000050func plat_crash_console_flush
51 ret
52endfunc plat_crash_console_flush
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010053#endif /* ERROR_DEPRECATED */
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000054
55 /* -----------------------------------------------------
56 * Placeholder function which should be redefined by
Masahiro Yamada4c165ca2016-09-24 18:07:46 +090057 * each platform. This function should preserve x19 - x29.
Soby Mathewf1785fd2014-08-14 12:22:32 +010058 * -----------------------------------------------------
59 */
60func plat_reset_handler
61 ret
Kévin Petita877c252015-03-24 14:03:57 +000062endfunc plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010063
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
Kévin Petita877c252015-03-24 14:03:57 +000072endfunc plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010073
74 /* -----------------------------------------------------
Sandrine Bailleux87322b32015-11-10 15:01:57 +000075 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castillod1413b22015-10-05 16:59:38 +010076 * Called before exiting BL1. Default: do nothing
77 * -----------------------------------------------------
78 */
79func bl1_plat_prepare_exit
80 ret
81endfunc bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +010082
83 /* -----------------------------------------------------
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000084 * void plat_panic_handler(void) __dead2;
85 * Endless loop by default.
86 * -----------------------------------------------------
87 */
88func plat_panic_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +010089 wfi
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000090 b plat_panic_handler
91endfunc plat_panic_handler
Jeenu Viswambharane834ee12018-04-27 15:17:03 +010092
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
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +0100112
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
Jeenu Viswambharan93bc4bd2018-05-17 11:24:01 +0100124
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
Jeenu Viswambharan911fcc92018-07-06 16:50:06 +0100135
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