blob: 89523194d226b2f646a38a3a312fa723080cc88d [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Masahiro Yamada2a4fe4f2018-02-01 18:42:24 +09002 * Copyright (c) 2013-2018, 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>
Julius Werneraae9bb12017-09-18 16:49:48 -07009#include <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 .globl platform_get_core_pos
30
31#define MPIDR_RES_BIT_MASK 0xff000000
32
Achin Gupta4f6ad662013-10-25 09:08:21 +010033 /* -----------------------------------------------------
Achin Gupta4f6ad662013-10-25 09:08:21 +010034 * Placeholder function which should be redefined by
35 * each platform.
36 * -----------------------------------------------------
37 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000038func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010039 ret
Kévin Petita877c252015-03-24 14:03:57 +000040endfunc plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010041
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010042#if !ERROR_DEPRECATED
Soby Mathew066f7132014-07-14 16:57:23 +010043func plat_crash_console_init
44 mov x0, #0
45 ret
Kévin Petita877c252015-03-24 14:03:57 +000046endfunc plat_crash_console_init
Soby Mathew066f7132014-07-14 16:57:23 +010047
Julius Werneraae9bb12017-09-18 16:49:48 -070048func plat_crash_console_putc
49 ret
50endfunc plat_crash_console_putc
51
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000052func plat_crash_console_flush
53 ret
54endfunc plat_crash_console_flush
Antonio Nino Diaz6b0968e2018-10-17 16:49:26 +010055#endif /* ERROR_DEPRECATED */
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000056
57 /* -----------------------------------------------------
58 * Placeholder function which should be redefined by
Masahiro Yamada4c165ca2016-09-24 18:07:46 +090059 * each platform. This function should preserve x19 - x29.
Soby Mathewf1785fd2014-08-14 12:22:32 +010060 * -----------------------------------------------------
61 */
62func plat_reset_handler
63 ret
Kévin Petita877c252015-03-24 14:03:57 +000064endfunc plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010065
66 /* -----------------------------------------------------
67 * Placeholder function which should be redefined by
68 * each platform. This function is allowed to use
69 * registers x0 - x17.
70 * -----------------------------------------------------
71 */
72func plat_disable_acp
73 ret
Kévin Petita877c252015-03-24 14:03:57 +000074endfunc plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010075
76 /* -----------------------------------------------------
Sandrine Bailleux87322b32015-11-10 15:01:57 +000077 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castillod1413b22015-10-05 16:59:38 +010078 * Called before exiting BL1. Default: do nothing
79 * -----------------------------------------------------
80 */
81func bl1_plat_prepare_exit
82 ret
83endfunc bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +010084
85 /* -----------------------------------------------------
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000086 * void plat_panic_handler(void) __dead2;
87 * Endless loop by default.
88 * -----------------------------------------------------
89 */
90func plat_panic_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +010091 wfi
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000092 b plat_panic_handler
93endfunc plat_panic_handler
Jeenu Viswambharane834ee12018-04-27 15:17:03 +010094
95 /* -----------------------------------------------------
96 * void bl31_plat_enable_mmu(uint32_t flags);
97 *
98 * Enable MMU in BL31.
99 * -----------------------------------------------------
100 */
101func bl31_plat_enable_mmu
102 b enable_mmu_direct_el3
103endfunc bl31_plat_enable_mmu
104
105 /* -----------------------------------------------------
106 * void bl32_plat_enable_mmu(uint32_t flags);
107 *
108 * Enable MMU in BL32.
109 * -----------------------------------------------------
110 */
111func bl32_plat_enable_mmu
112 b enable_mmu_direct_el1
113endfunc bl32_plat_enable_mmu
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +0100114
115
116 /* -----------------------------------------------------
117 * Platform handler for Uncontainable External Abort.
118 *
119 * x0: EA reason
120 * x1: EA syndrome
121 * -----------------------------------------------------
122 */
123func plat_handle_uncontainable_ea
124 b report_unhandled_exception
125endfunc plat_handle_uncontainable_ea
Jeenu Viswambharan93bc4bd2018-05-17 11:24:01 +0100126
127 /* -----------------------------------------------------
128 * Platform handler for Double Fault.
129 *
130 * x0: EA reason
131 * x1: EA syndrome
132 * -----------------------------------------------------
133 */
134func plat_handle_double_fault
135 b report_unhandled_exception
136endfunc plat_handle_double_fault
Jeenu Viswambharan911fcc92018-07-06 16:50:06 +0100137
138 /* -----------------------------------------------------
139 * Platform handler for EL3 External Abort.
140 * -----------------------------------------------------
141 */
142func plat_handle_el3_ea
143 b report_unhandled_exception
144endfunc plat_handle_el3_ea