blob: cc5ffc0749835cbfda0a81dffd745eb94b22188e [file] [log] [blame]
Gary Morrison3d7f6542021-01-27 13:08:47 -06001/*
2 * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <common/debug.h>
10
11 .globl el2_panic
12
13 /***********************************************************
Govindraj Rajaa796b1b2023-01-16 17:35:07 +000014 * The common implementation of el3_panic for all BL stages
Gary Morrison3d7f6542021-01-27 13:08:47 -060015 ***********************************************************/
16
17.section .rodata.panic_str, "aS"
18 panic_msg: .asciz "PANIC at PC : 0x"
19
20/*
21 * el2_panic will be redefined by the
22 * crash reporting mechanism (if enabled)
23 */
24el2_panic:
25 mov x6, x30
26 bl plat_crash_console_init
27
28 /* Check if the console is initialized */
29 cbz x0, _panic_handler
30
31 /* The console is initialized */
32 adr x4, panic_msg
33 bl asm_print_str
34 mov x4, x6
35
36 /* The panic location is lr -4 */
37 sub x4, x4, #4
38 bl asm_print_hex
39
40 bl plat_crash_console_flush
41
42_panic_handler:
43 /* Pass to plat_panic_handler the address from where el2_panic was
johpow010033b252021-10-11 14:51:11 -050044 * called, not the address of the call from el2_panic.
45 */
Gary Morrison3d7f6542021-01-27 13:08:47 -060046 mov x30, x6
47 b plat_panic_handler