blob: b8fd3a2cd6f8f3db07c837bc93890345039598dc [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Varun Wadekare095ba32019-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-arm82cb2c12017-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 Thoelke0a30cf52014-03-18 13:46:55 +00008#include <asm_macros.S>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +00009#include <drivers/console.h>
Dan Handley5f0cdb02014-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 Diaze74afb62018-10-17 16:49:26 +010013#if !ERROR_DEPRECATED
Soby Mathewc67b09b2014-07-14 16:57:23 +010014 .weak plat_crash_console_init
15 .weak plat_crash_console_putc
Antonio Nino Diaz801cf932017-02-17 17:11:27 +000016 .weak plat_crash_console_flush
Antonio Nino Diaze74afb62018-10-17 16:49:26 +010017#endif
Soby Mathew24fb8382014-08-14 12:22:32 +010018 .weak plat_reset_handler
Soby Mathewadd40352014-08-14 12:49:05 +010019 .weak plat_disable_acp
Juan Castilloe3f67122015-10-05 16:59:38 +010020 .weak bl1_plat_prepare_exit
Antonio Nino Diaz1c3ea102016-02-01 13:57:25 +000021 .weak plat_panic_handler
Jeenu Viswambharan64ee2632018-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 Viswambharanb56dc2a2018-05-17 09:52:36 +010025 .weak plat_handle_uncontainable_ea
Jeenu Viswambharand5a23af2018-05-17 11:24:01 +010026 .weak plat_handle_double_fault
Jeenu Viswambharaneaeaa4d2018-07-06 16:50:06 +010027 .weak plat_handle_el3_ea
Jeenu Viswambharanb56dc2a2018-05-17 09:52:36 +010028
Soby Mathew5c8babc2015-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 Thoelke0a30cf52014-03-18 13:46:55 +000036func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010037 ret
Kévin Petit8b779622015-03-24 14:03:57 +000038endfunc plat_report_exception
Soby Mathewc67b09b2014-07-14 16:57:23 +010039
Antonio Nino Diaze74afb62018-10-17 16:49:26 +010040#if !ERROR_DEPRECATED
Soby Mathewc67b09b2014-07-14 16:57:23 +010041func plat_crash_console_init
42 mov x0, #0
43 ret
Kévin Petit8b779622015-03-24 14:03:57 +000044endfunc plat_crash_console_init
Soby Mathewc67b09b2014-07-14 16:57:23 +010045
Soby Mathewc67b09b2014-07-14 16:57:23 +010046func plat_crash_console_putc
47 ret
Kévin Petit8b779622015-03-24 14:03:57 +000048endfunc plat_crash_console_putc
Soby Mathew24fb8382014-08-14 12:22:32 +010049
Antonio Nino Diaz801cf932017-02-17 17:11:27 +000050func plat_crash_console_flush
51 ret
52endfunc plat_crash_console_flush
Antonio Nino Diaze74afb62018-10-17 16:49:26 +010053#endif /* ERROR_DEPRECATED */
Antonio Nino Diaz801cf932017-02-17 17:11:27 +000054
55 /* -----------------------------------------------------
56 * Placeholder function which should be redefined by
Masahiro Yamada240b3142016-09-24 18:07:46 +090057 * each platform. This function should preserve x19 - x29.
Soby Mathew24fb8382014-08-14 12:22:32 +010058 * -----------------------------------------------------
59 */
60func plat_reset_handler
61 ret
Kévin Petit8b779622015-03-24 14:03:57 +000062endfunc plat_reset_handler
Soby Mathewadd40352014-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 Petit8b779622015-03-24 14:03:57 +000072endfunc plat_disable_acp
Juan Castilloe3f67122015-10-05 16:59:38 +010073
74 /* -----------------------------------------------------
Sandrine Bailleux862b5dc2015-11-10 15:01:57 +000075 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castilloe3f67122015-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 Castillo40fc6cd2015-09-25 15:41:14 +010082
83 /* -----------------------------------------------------
Antonio Nino Diaz1c3ea102016-02-01 13:57:25 +000084 * void plat_panic_handler(void) __dead2;
85 * Endless loop by default.
86 * -----------------------------------------------------
87 */
88func plat_panic_handler
Sandrine Bailleux8c9e1af2016-08-18 09:24:40 +010089 wfi
Antonio Nino Diaz1c3ea102016-02-01 13:57:25 +000090 b plat_panic_handler
91endfunc plat_panic_handler
Jeenu Viswambharan64ee2632018-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 Viswambharanb56dc2a2018-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 Viswambharand5a23af2018-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 Viswambharaneaeaa4d2018-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