blob: bc650c96b2d5e2b0cbc6dc08896d5ca64f380a87 [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
Soby Mathewf1785fd2014-08-14 12:22:32 +010013 .weak plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010014 .weak plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010015 .weak bl1_plat_prepare_exit
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000016 .weak plat_panic_handler
Jeenu Viswambharane834ee12018-04-27 15:17:03 +010017 .weak bl31_plat_enable_mmu
18 .weak bl32_plat_enable_mmu
Achin Gupta4f6ad662013-10-25 09:08:21 +010019
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +010020 .weak plat_handle_uncontainable_ea
Jeenu Viswambharan93bc4bd2018-05-17 11:24:01 +010021 .weak plat_handle_double_fault
Jeenu Viswambharan911fcc92018-07-06 16:50:06 +010022 .weak plat_handle_el3_ea
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +010023
Soby Mathew70716d62015-07-13 16:26:11 +010024#define MPIDR_RES_BIT_MASK 0xff000000
25
Achin Gupta4f6ad662013-10-25 09:08:21 +010026 /* -----------------------------------------------------
Achin Gupta4f6ad662013-10-25 09:08:21 +010027 * Placeholder function which should be redefined by
28 * each platform.
29 * -----------------------------------------------------
30 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000031func plat_report_exception
Achin Gupta4f6ad662013-10-25 09:08:21 +010032 ret
Kévin Petita877c252015-03-24 14:03:57 +000033endfunc plat_report_exception
Soby Mathew066f7132014-07-14 16:57:23 +010034
Antonio Nino Diazd3ec5432017-02-17 17:11:27 +000035 /* -----------------------------------------------------
36 * Placeholder function which should be redefined by
Masahiro Yamada4c165ca2016-09-24 18:07:46 +090037 * each platform. This function should preserve x19 - x29.
Soby Mathewf1785fd2014-08-14 12:22:32 +010038 * -----------------------------------------------------
39 */
40func plat_reset_handler
41 ret
Kévin Petita877c252015-03-24 14:03:57 +000042endfunc plat_reset_handler
Soby Mathew8e2f2872014-08-14 12:49:05 +010043
44 /* -----------------------------------------------------
45 * Placeholder function which should be redefined by
46 * each platform. This function is allowed to use
47 * registers x0 - x17.
48 * -----------------------------------------------------
49 */
50func plat_disable_acp
51 ret
Kévin Petita877c252015-03-24 14:03:57 +000052endfunc plat_disable_acp
Juan Castillod1413b22015-10-05 16:59:38 +010053
54 /* -----------------------------------------------------
Sandrine Bailleux87322b32015-11-10 15:01:57 +000055 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
Juan Castillod1413b22015-10-05 16:59:38 +010056 * Called before exiting BL1. Default: do nothing
57 * -----------------------------------------------------
58 */
59func bl1_plat_prepare_exit
60 ret
61endfunc bl1_plat_prepare_exit
Juan Castillo26ae5832015-09-25 15:41:14 +010062
63 /* -----------------------------------------------------
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000064 * void plat_panic_handler(void) __dead2;
65 * Endless loop by default.
66 * -----------------------------------------------------
67 */
68func plat_panic_handler
Sandrine Bailleux628198b2016-08-18 09:24:40 +010069 wfi
Antonio Nino Diaz1f21bcf2016-02-01 13:57:25 +000070 b plat_panic_handler
71endfunc plat_panic_handler
Jeenu Viswambharane834ee12018-04-27 15:17:03 +010072
73 /* -----------------------------------------------------
74 * void bl31_plat_enable_mmu(uint32_t flags);
75 *
76 * Enable MMU in BL31.
77 * -----------------------------------------------------
78 */
79func bl31_plat_enable_mmu
80 b enable_mmu_direct_el3
81endfunc bl31_plat_enable_mmu
82
83 /* -----------------------------------------------------
84 * void bl32_plat_enable_mmu(uint32_t flags);
85 *
86 * Enable MMU in BL32.
87 * -----------------------------------------------------
88 */
89func bl32_plat_enable_mmu
90 b enable_mmu_direct_el1
91endfunc bl32_plat_enable_mmu
Jeenu Viswambharan9d4c9c12018-05-17 09:52:36 +010092
93
94 /* -----------------------------------------------------
95 * Platform handler for Uncontainable External Abort.
96 *
97 * x0: EA reason
98 * x1: EA syndrome
99 * -----------------------------------------------------
100 */
101func plat_handle_uncontainable_ea
102 b report_unhandled_exception
103endfunc plat_handle_uncontainable_ea
Jeenu Viswambharan93bc4bd2018-05-17 11:24:01 +0100104
105 /* -----------------------------------------------------
106 * Platform handler for Double Fault.
107 *
108 * x0: EA reason
109 * x1: EA syndrome
110 * -----------------------------------------------------
111 */
112func plat_handle_double_fault
113 b report_unhandled_exception
114endfunc plat_handle_double_fault
Jeenu Viswambharan911fcc92018-07-06 16:50:06 +0100115
116 /* -----------------------------------------------------
117 * Platform handler for EL3 External Abort.
118 * -----------------------------------------------------
119 */
120func plat_handle_el3_ea
121 b report_unhandled_exception
122endfunc plat_handle_el3_ea