xref: /rk3399_ARM-atf/bl31/aarch64/crash_reporting.S (revision 8c106902368c40e14c558a0ab91cc57defdc7e81)
1a43d431bSSoby Mathew/*
2a43d431bSSoby Mathew * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
3a43d431bSSoby Mathew *
4a43d431bSSoby Mathew * Redistribution and use in source and binary forms, with or without
5a43d431bSSoby Mathew * modification, are permitted provided that the following conditions are met:
6a43d431bSSoby Mathew *
7a43d431bSSoby Mathew * Redistributions of source code must retain the above copyright notice, this
8a43d431bSSoby Mathew * list of conditions and the following disclaimer.
9a43d431bSSoby Mathew *
10a43d431bSSoby Mathew * Redistributions in binary form must reproduce the above copyright notice,
11a43d431bSSoby Mathew * this list of conditions and the following disclaimer in the documentation
12a43d431bSSoby Mathew * and/or other materials provided with the distribution.
13a43d431bSSoby Mathew *
14a43d431bSSoby Mathew * Neither the name of ARM nor the names of its contributors may be used
15a43d431bSSoby Mathew * to endorse or promote products derived from this software without specific
16a43d431bSSoby Mathew * prior written permission.
17a43d431bSSoby Mathew *
18a43d431bSSoby Mathew * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19a43d431bSSoby Mathew * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20a43d431bSSoby Mathew * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21a43d431bSSoby Mathew * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22a43d431bSSoby Mathew * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23a43d431bSSoby Mathew * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24a43d431bSSoby Mathew * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25a43d431bSSoby Mathew * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26a43d431bSSoby Mathew * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27a43d431bSSoby Mathew * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28a43d431bSSoby Mathew * POSSIBILITY OF SUCH DAMAGE.
29a43d431bSSoby Mathew */
30a43d431bSSoby Mathew#include <arch.h>
31a43d431bSSoby Mathew#include <asm_macros.S>
32a43d431bSSoby Mathew#include <context.h>
335e910074SAndrew Thoelke#include <cpu_data.h>
34a43d431bSSoby Mathew#include <plat_macros.S>
35e4d13389SSandrine Bailleux#include <platform_def.h>
36a43d431bSSoby Mathew
37626ed510SSoby Mathew	.globl	report_unhandled_exception
38626ed510SSoby Mathew	.globl	report_unhandled_interrupt
39626ed510SSoby Mathew	.globl	el3_panic
40a43d431bSSoby Mathew
419c22b323SAndrew Thoelke#if CRASH_REPORTING
42626ed510SSoby Mathew#define REG_SIZE	0x8
43626ed510SSoby Mathew
44a43d431bSSoby Mathew	/* ------------------------------------------------------
45a43d431bSSoby Mathew	 * The below section deals with dumping the system state
46a43d431bSSoby Mathew	 * when an unhandled exception is taken in EL3.
47a43d431bSSoby Mathew	 * The layout and the names of the registers which will
48a43d431bSSoby Mathew	 * be dumped during a unhandled exception is given below.
49a43d431bSSoby Mathew	 * ------------------------------------------------------
50a43d431bSSoby Mathew	 */
51626ed510SSoby Mathew.section .rodata.crash_prints, "aS"
52626ed510SSoby Mathewprint_spacer:
53626ed510SSoby Mathew	.asciz	" =\t\t0x"
54a43d431bSSoby Mathew
55*8c106902SSoby Mathewcpu_ectlr_reg:
56*8c106902SSoby Mathew	.asciz	"cpuectlr_el1 =\t\t0x"
57*8c106902SSoby Mathew
58626ed510SSoby Mathewgp_regs:
59626ed510SSoby Mathew	.asciz	"x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",\
60626ed510SSoby Mathew		"x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",\
61626ed510SSoby Mathew		"x16", "x17", "x18", "x19", "x20", "x21", "x22",\
62626ed510SSoby Mathew		"x23", "x24", "x25", "x26", "x27", "x28", "x29", ""
63626ed510SSoby Mathewel3_sys_regs:
64626ed510SSoby Mathew	.asciz	"scr_el3", "sctlr_el3", "cptr_el3", "tcr_el3",\
65626ed510SSoby Mathew		"daif", "mair_el3", "spsr_el3", "elr_el3", "ttbr0_el3",\
66626ed510SSoby Mathew		"esr_el3", "far_el3", ""
67a43d431bSSoby Mathew
68626ed510SSoby Mathewnon_el3_sys_regs:
69626ed510SSoby Mathew	.asciz	"spsr_el1", "elr_el1", "spsr_abt", "spsr_und",\
70a43d431bSSoby Mathew		"spsr_irq", "spsr_fiq", "sctlr_el1", "actlr_el1", "cpacr_el1",\
71a43d431bSSoby Mathew		"csselr_el1", "sp_el1", "esr_el1", "ttbr0_el1", "ttbr1_el1",\
72626ed510SSoby Mathew		"mair_el1", "amair_el1", "tcr_el1", "tpidr_el1", "tpidr_el0",\
73626ed510SSoby Mathew		"tpidrro_el0", "dacr32_el2", "ifsr32_el2", "par_el1",\
74626ed510SSoby Mathew		"mpidr_el1", "afsr0_el1", "afsr1_el1", "contextidr_el1",\
75626ed510SSoby Mathew		"vbar_el1", "cntp_ctl_el0", "cntp_cval_el0", "cntv_ctl_el0",\
76626ed510SSoby Mathew		"cntv_cval_el0", "cntkctl_el1", "fpexc32_el2", "sp_el0", ""
77a43d431bSSoby Mathew
78626ed510SSoby Mathewpanic_msg:
79626ed510SSoby Mathew	.asciz "PANIC in EL3 at x30 = 0x"
80626ed510SSoby Mathewexcpt_msg:
81626ed510SSoby Mathew	.asciz "Unhandled Exception in EL3.\nx30 =\t\t0x"
82626ed510SSoby Mathewintr_excpt_msg:
83626ed510SSoby Mathew	.asciz "Unhandled Interrupt Exception in EL3.\nx30 =\t\t0x"
84626ed510SSoby Mathew
85626ed510SSoby Mathew	/*
86626ed510SSoby Mathew	 * Helper function to print newline to console.
87626ed510SSoby Mathew	 */
88626ed510SSoby Mathewfunc print_newline
89626ed510SSoby Mathew	mov	x0, '\n'
90626ed510SSoby Mathew	b	plat_crash_console_putc
91626ed510SSoby Mathew
92626ed510SSoby Mathew	/*
93626ed510SSoby Mathew	 * Helper function to print from crash buf.
94626ed510SSoby Mathew	 * The print loop is controlled by the buf size and
95626ed510SSoby Mathew	 * ascii reg name list which is passed in x6. The
96626ed510SSoby Mathew	 * function returns the crash buf address in x0.
97626ed510SSoby Mathew	 * Clobbers : x0 - x7, sp
98626ed510SSoby Mathew	 */
99626ed510SSoby Mathewfunc size_controlled_print
100626ed510SSoby Mathew	/* Save the lr */
101626ed510SSoby Mathew	mov	sp, x30
102626ed510SSoby Mathew	/* load the crash buf address */
103626ed510SSoby Mathew	mrs	x7, tpidr_el3
104626ed510SSoby Mathewtest_size_list:
105626ed510SSoby Mathew	/* Calculate x5 always as it will be clobbered by asm_print_hex */
106626ed510SSoby Mathew	mrs	x5, tpidr_el3
107626ed510SSoby Mathew	add	x5, x5, #CPU_DATA_CRASH_BUF_SIZE
108626ed510SSoby Mathew	/* Test whether we have reached end of crash buf */
109626ed510SSoby Mathew	cmp	x7, x5
110626ed510SSoby Mathew	b.eq	exit_size_print
111626ed510SSoby Mathew	ldrb	w4, [x6]
112626ed510SSoby Mathew	/* Test whether we are at end of list */
113626ed510SSoby Mathew	cbz	w4, exit_size_print
114626ed510SSoby Mathew	mov	x4, x6
115626ed510SSoby Mathew	/* asm_print_str updates x4 to point to next entry in list */
116626ed510SSoby Mathew	bl	asm_print_str
117626ed510SSoby Mathew	/* update x6 with the updated list pointer */
118626ed510SSoby Mathew	mov	x6, x4
119626ed510SSoby Mathew	adr	x4, print_spacer
120626ed510SSoby Mathew	bl	asm_print_str
121626ed510SSoby Mathew	ldr	x4, [x7], #REG_SIZE
122626ed510SSoby Mathew	bl	asm_print_hex
123626ed510SSoby Mathew	bl	print_newline
124626ed510SSoby Mathew	b	test_size_list
125626ed510SSoby Mathewexit_size_print:
126626ed510SSoby Mathew	mov	x30, sp
127626ed510SSoby Mathew	ret
128626ed510SSoby Mathew
129626ed510SSoby Mathew	/*
130626ed510SSoby Mathew	 * Helper function to store x8 - x15 registers to
131626ed510SSoby Mathew	 * the crash buf. The system registers values are
132626ed510SSoby Mathew	 * copied to x8 to x15 by the caller which are then
133626ed510SSoby Mathew	 * copied to the crash buf by this function.
134626ed510SSoby Mathew	 * x0 points to the crash buf. It then calls
135626ed510SSoby Mathew	 * size_controlled_print to print to console.
136626ed510SSoby Mathew	 * Clobbers : x0 - x7, sp
137626ed510SSoby Mathew	 */
138626ed510SSoby Mathewfunc str_in_crash_buf_print
139626ed510SSoby Mathew	/* restore the crash buf address in x0 */
140626ed510SSoby Mathew	mrs	x0, tpidr_el3
141626ed510SSoby Mathew	stp	x8, x9, [x0]
142626ed510SSoby Mathew	stp	x10, x11, [x0, #REG_SIZE * 2]
143626ed510SSoby Mathew	stp	x12, x13, [x0, #REG_SIZE * 4]
144626ed510SSoby Mathew	stp	x14, x15, [x0, #REG_SIZE * 6]
145626ed510SSoby Mathew	b	size_controlled_print
146626ed510SSoby Mathew
147626ed510SSoby Mathew	/* ------------------------------------------------------
148626ed510SSoby Mathew	 * This macro calculates the offset to crash buf from
149626ed510SSoby Mathew	 * cpu_data and stores it in tpidr_el3. It also saves x0
150626ed510SSoby Mathew	 * and x1 in the crash buf by using sp as a temporary
151626ed510SSoby Mathew	 * register.
152626ed510SSoby Mathew	 * ------------------------------------------------------
153626ed510SSoby Mathew	 */
154626ed510SSoby Mathew	.macro prepare_crash_buf_save_x0_x1
155626ed510SSoby Mathew	/* we can corrupt this reg to free up x0 */
156626ed510SSoby Mathew	mov	sp, x0
157626ed510SSoby Mathew	/* tpidr_el3 contains the address to cpu_data structure */
158626ed510SSoby Mathew	mrs	x0, tpidr_el3
159626ed510SSoby Mathew	/* Calculate the Crash buffer offset in cpu_data */
160626ed510SSoby Mathew	add	x0, x0, #CPU_DATA_CRASH_BUF_OFFSET
161626ed510SSoby Mathew	/* Store crash buffer address in tpidr_el3 */
162626ed510SSoby Mathew	msr	tpidr_el3, x0
163626ed510SSoby Mathew	str	x1, [x0, #REG_SIZE]
164626ed510SSoby Mathew	mov	x1, sp
165626ed510SSoby Mathew	str	x1, [x0]
166626ed510SSoby Mathew	.endm
167a43d431bSSoby Mathew
168a43d431bSSoby Mathew	/* -----------------------------------------------------
169626ed510SSoby Mathew	 * This function allows to report a crash (if crash
170626ed510SSoby Mathew	 * reporting is enabled) when an unhandled exception
171626ed510SSoby Mathew	 * occurs. It prints the CPU state via the crash console
172626ed510SSoby Mathew	 * making use of the crash buf. This function will
173626ed510SSoby Mathew	 * not return.
174a43d431bSSoby Mathew	 * -----------------------------------------------------
175a43d431bSSoby Mathew	 */
176626ed510SSoby Mathewfunc report_unhandled_exception
177626ed510SSoby Mathew	prepare_crash_buf_save_x0_x1
178626ed510SSoby Mathew	adr	x0, excpt_msg
179626ed510SSoby Mathew	mov	sp, x0
180626ed510SSoby Mathew	/* This call will not return */
181626ed510SSoby Mathew	b	do_crash_reporting
182a43d431bSSoby Mathew
183a43d431bSSoby Mathew
184626ed510SSoby Mathew	/* -----------------------------------------------------
185626ed510SSoby Mathew	 * This function allows to report a crash (if crash
186626ed510SSoby Mathew	 * reporting is enabled) when an unhandled interrupt
187626ed510SSoby Mathew	 * occurs. It prints the CPU state via the crash console
188626ed510SSoby Mathew	 * making use of the crash buf. This function will
189626ed510SSoby Mathew	 * not return.
190626ed510SSoby Mathew	 * -----------------------------------------------------
191626ed510SSoby Mathew	 */
192626ed510SSoby Mathewfunc report_unhandled_interrupt
193626ed510SSoby Mathew	prepare_crash_buf_save_x0_x1
194626ed510SSoby Mathew	adr	x0, intr_excpt_msg
195626ed510SSoby Mathew	mov	sp, x0
196626ed510SSoby Mathew	/* This call will not return */
197626ed510SSoby Mathew	b	do_crash_reporting
198a43d431bSSoby Mathew
199626ed510SSoby Mathew	/* -----------------------------------------------------
200626ed510SSoby Mathew	 * This function allows to report a crash (if crash
201626ed510SSoby Mathew	 * reporting is enabled) when panic() is invoked from
202626ed510SSoby Mathew	 * C Runtime. It prints the CPU state via the crash
203626ed510SSoby Mathew	 * console making use of the crash buf. This function
204626ed510SSoby Mathew	 * will not return.
205626ed510SSoby Mathew	 * -----------------------------------------------------
206626ed510SSoby Mathew	 */
207626ed510SSoby Mathewfunc el3_panic
208626ed510SSoby Mathew	msr	spsel, #1
209626ed510SSoby Mathew	prepare_crash_buf_save_x0_x1
210626ed510SSoby Mathew	adr	x0, panic_msg
211626ed510SSoby Mathew	mov	sp, x0
212626ed510SSoby Mathew	/* This call will not return */
213626ed510SSoby Mathew	b	do_crash_reporting
214a43d431bSSoby Mathew
215626ed510SSoby Mathew	/* ------------------------------------------------------------
216626ed510SSoby Mathew	 * The common crash reporting functionality. It requires x0
217626ed510SSoby Mathew	 * and x1 has already been stored in crash buf, sp points to
218626ed510SSoby Mathew	 * crash message and tpidr_el3 contains the crash buf address.
219626ed510SSoby Mathew	 * The function does the following:
220626ed510SSoby Mathew	 *   - Retrieve the crash buffer from tpidr_el3
221626ed510SSoby Mathew	 *   - Store x2 to x6 in the crash buffer
222626ed510SSoby Mathew	 *   - Initialise the crash console.
223626ed510SSoby Mathew	 *   - Print the crash message by using the address in sp.
224626ed510SSoby Mathew	 *   - Print x30 value to the crash console.
225626ed510SSoby Mathew	 *   - Print x0 - x7 from the crash buf to the crash console.
226626ed510SSoby Mathew	 *   - Print x8 - x29 (in groups of 8 registers) using the
227626ed510SSoby Mathew	 *     crash buf to the crash console.
228626ed510SSoby Mathew	 *   - Print el3 sys regs (in groups of 8 registers) using the
229626ed510SSoby Mathew	 *     crash buf to the crash console.
230626ed510SSoby Mathew	 *   - Print non el3 sys regs (in groups of 8 registers) using
231626ed510SSoby Mathew	 *     the crash buf to the crash console.
232626ed510SSoby Mathew	 * ------------------------------------------------------------
233626ed510SSoby Mathew	 */
234626ed510SSoby Mathewfunc do_crash_reporting
235626ed510SSoby Mathew	/* Retrieve the crash buf from tpidr_el3 */
236626ed510SSoby Mathew	mrs	x0, tpidr_el3
237626ed510SSoby Mathew	/* Store x2 - x6, x30 in the crash buffer */
238626ed510SSoby Mathew	stp	x2, x3, [x0, #REG_SIZE * 2]
239626ed510SSoby Mathew	stp	x4, x5, [x0, #REG_SIZE * 4]
240626ed510SSoby Mathew	stp	x6, x30, [x0, #REG_SIZE * 6]
241626ed510SSoby Mathew	/* Initialize the crash console */
242626ed510SSoby Mathew	bl	plat_crash_console_init
243626ed510SSoby Mathew	/* Verify the console is initialized */
244626ed510SSoby Mathew	cbz	x0, crash_panic
245626ed510SSoby Mathew	/* Print the crash message. sp points to the crash message */
246626ed510SSoby Mathew	mov	x4, sp
247626ed510SSoby Mathew	bl	asm_print_str
248626ed510SSoby Mathew	/* load the crash buf address */
249626ed510SSoby Mathew	mrs	x0, tpidr_el3
250626ed510SSoby Mathew	/* report x30 first from the crash buf */
251626ed510SSoby Mathew	ldr	x4, [x0, #REG_SIZE * 7]
252626ed510SSoby Mathew	bl	asm_print_hex
253626ed510SSoby Mathew	bl	print_newline
254626ed510SSoby Mathew	/* Load the crash buf address */
255626ed510SSoby Mathew	mrs	x0, tpidr_el3
256626ed510SSoby Mathew	/* Now mov x7 into crash buf */
257626ed510SSoby Mathew	str	x7, [x0, #REG_SIZE * 7]
258a43d431bSSoby Mathew
259626ed510SSoby Mathew	/* Report x0 - x29 values stored in crash buf*/
260626ed510SSoby Mathew	/* Store the ascii list pointer in x6 */
261626ed510SSoby Mathew	adr	x6, gp_regs
262626ed510SSoby Mathew	/* Print x0 to x7 from the crash buf */
263626ed510SSoby Mathew	bl	size_controlled_print
264626ed510SSoby Mathew	/* Store x8 - x15 in crash buf and print */
265626ed510SSoby Mathew	bl	str_in_crash_buf_print
266626ed510SSoby Mathew	/* Load the crash buf address */
267626ed510SSoby Mathew	mrs	x0, tpidr_el3
268626ed510SSoby Mathew	/* Store the rest of gp regs and print */
269626ed510SSoby Mathew	stp	x16, x17, [x0]
270626ed510SSoby Mathew	stp	x18, x19, [x0, #REG_SIZE * 2]
271626ed510SSoby Mathew	stp	x20, x21, [x0, #REG_SIZE * 4]
272626ed510SSoby Mathew	stp	x22, x23, [x0, #REG_SIZE * 6]
273626ed510SSoby Mathew	bl	size_controlled_print
274626ed510SSoby Mathew	/* Load the crash buf address */
275626ed510SSoby Mathew	mrs	x0, tpidr_el3
276626ed510SSoby Mathew	stp	x24, x25, [x0]
277626ed510SSoby Mathew	stp	x26, x27, [x0, #REG_SIZE * 2]
278626ed510SSoby Mathew	stp	x28, x29, [x0, #REG_SIZE * 4]
279626ed510SSoby Mathew	bl	size_controlled_print
280a43d431bSSoby Mathew
281626ed510SSoby Mathew	/* Print the el3 sys registers */
282626ed510SSoby Mathew	adr	x6, el3_sys_regs
283626ed510SSoby Mathew	mrs	x8, scr_el3
284626ed510SSoby Mathew	mrs	x9, sctlr_el3
285626ed510SSoby Mathew	mrs	x10, cptr_el3
286626ed510SSoby Mathew	mrs	x11, tcr_el3
287626ed510SSoby Mathew	mrs	x12, daif
288626ed510SSoby Mathew	mrs	x13, mair_el3
289626ed510SSoby Mathew	mrs	x14, spsr_el3
290626ed510SSoby Mathew	mrs	x15, elr_el3
291626ed510SSoby Mathew	bl	str_in_crash_buf_print
292626ed510SSoby Mathew	mrs	x8, ttbr0_el3
293626ed510SSoby Mathew	mrs	x9, esr_el3
294626ed510SSoby Mathew	mrs	x10, far_el3
295626ed510SSoby Mathew	bl	str_in_crash_buf_print
296a43d431bSSoby Mathew
297626ed510SSoby Mathew	/* Print the non el3 sys registers */
298626ed510SSoby Mathew	adr	x6, non_el3_sys_regs
299626ed510SSoby Mathew	mrs	x8, spsr_el1
300626ed510SSoby Mathew	mrs	x9, elr_el1
301626ed510SSoby Mathew	mrs	x10, spsr_abt
302626ed510SSoby Mathew	mrs	x11, spsr_und
303626ed510SSoby Mathew	mrs	x12, spsr_irq
304626ed510SSoby Mathew	mrs	x13, spsr_fiq
305626ed510SSoby Mathew	mrs	x14, sctlr_el1
306626ed510SSoby Mathew	mrs	x15, actlr_el1
307626ed510SSoby Mathew	bl	str_in_crash_buf_print
308626ed510SSoby Mathew	mrs	x8, cpacr_el1
309626ed510SSoby Mathew	mrs	x9, csselr_el1
310a43d431bSSoby Mathew	mrs	x10, sp_el1
311a43d431bSSoby Mathew	mrs	x11, esr_el1
312a43d431bSSoby Mathew	mrs	x12, ttbr0_el1
313a43d431bSSoby Mathew	mrs	x13, ttbr1_el1
314a43d431bSSoby Mathew	mrs	x14, mair_el1
315a43d431bSSoby Mathew	mrs	x15, amair_el1
316626ed510SSoby Mathew	bl	str_in_crash_buf_print
317626ed510SSoby Mathew	mrs	x8, tcr_el1
318626ed510SSoby Mathew	mrs	x9, tpidr_el1
319626ed510SSoby Mathew	mrs	x10, tpidr_el0
320626ed510SSoby Mathew	mrs	x11, tpidrro_el0
321626ed510SSoby Mathew	mrs	x12, dacr32_el2
322626ed510SSoby Mathew	mrs	x13, ifsr32_el2
323626ed510SSoby Mathew	mrs	x14, par_el1
324626ed510SSoby Mathew	mrs	x15, mpidr_el1
325626ed510SSoby Mathew	bl	str_in_crash_buf_print
326626ed510SSoby Mathew	mrs	x8, afsr0_el1
327626ed510SSoby Mathew	mrs	x9, afsr1_el1
328626ed510SSoby Mathew	mrs	x10, contextidr_el1
329626ed510SSoby Mathew	mrs	x11, vbar_el1
330626ed510SSoby Mathew	mrs	x12, cntp_ctl_el0
331626ed510SSoby Mathew	mrs	x13, cntp_cval_el0
332626ed510SSoby Mathew	mrs	x14, cntv_ctl_el0
333626ed510SSoby Mathew	mrs	x15, cntv_cval_el0
334626ed510SSoby Mathew	bl	str_in_crash_buf_print
335626ed510SSoby Mathew	mrs	x8, cntkctl_el1
336626ed510SSoby Mathew	mrs	x9, fpexc32_el2
337626ed510SSoby Mathew	mrs	x10, sp_el0
338626ed510SSoby Mathew	bl	str_in_crash_buf_print
339a43d431bSSoby Mathew
340*8c106902SSoby Mathew	/* Print the CPUECTLR_EL1 reg */
341*8c106902SSoby Mathew	mrs	x0, midr_el1
342*8c106902SSoby Mathew	lsr	x0, x0, #MIDR_PN_SHIFT
343*8c106902SSoby Mathew	and	x0, x0, #MIDR_PN_MASK
344*8c106902SSoby Mathew	cmp	x0, #MIDR_PN_A57
345*8c106902SSoby Mathew	b.eq	1f
346*8c106902SSoby Mathew	cmp	x0, #MIDR_PN_A53
347*8c106902SSoby Mathew	b.ne	2f
348*8c106902SSoby Mathew1:
349*8c106902SSoby Mathew	adr	x4, cpu_ectlr_reg
350*8c106902SSoby Mathew	bl	asm_print_str
351*8c106902SSoby Mathew	mrs	x4, CPUECTLR_EL1
352*8c106902SSoby Mathew	bl	asm_print_hex
353*8c106902SSoby Mathew	bl	print_newline
354*8c106902SSoby Mathew2:
355*8c106902SSoby Mathew
356626ed510SSoby Mathew	/* Print the gic registers */
357626ed510SSoby Mathew	plat_print_gic_regs
358a43d431bSSoby Mathew
359*8c106902SSoby Mathew	/* Print the interconnect registers */
360*8c106902SSoby Mathew	plat_print_interconnect_regs
361*8c106902SSoby Mathew
362626ed510SSoby Mathew	/* Done reporting */
363626ed510SSoby Mathew	b	crash_panic
364a43d431bSSoby Mathew
365626ed510SSoby Mathew#else	/* CRASH_REPORTING */
366626ed510SSoby Mathewfunc report_unhandled_exception
367626ed510SSoby Mathewreport_unhandled_interrupt:
368626ed510SSoby Mathew	b	crash_panic
3699c22b323SAndrew Thoelke#endif	/* CRASH_REPORING */
3709c22b323SAndrew Thoelke
371a43d431bSSoby Mathew
372626ed510SSoby Mathewfunc crash_panic
373626ed510SSoby Mathew	b	crash_panic
374