mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
Merge changes from topic "aarch32_debug_aborts" into integration
* changes: feat(stm32mp1): add plat_report_*_abort functions feat(debug): add helpers for aborts on AARCH32 feat(debug): add AARCH32 CP15 fault registers
This commit is contained in:
commit
4f2c4ecfb0
10 changed files with 160 additions and 33 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -23,8 +23,8 @@ vector_base bl1_vector_table
|
||||||
b bl1_entrypoint
|
b bl1_entrypoint
|
||||||
b report_exception /* Undef */
|
b report_exception /* Undef */
|
||||||
b bl1_aarch32_smc_handler /* SMC call */
|
b bl1_aarch32_smc_handler /* SMC call */
|
||||||
b report_exception /* Prefetch abort */
|
b report_prefetch_abort /* Prefetch abort */
|
||||||
b report_exception /* Data abort */
|
b report_data_abort /* Data abort */
|
||||||
b report_exception /* Reserved */
|
b report_exception /* Reserved */
|
||||||
b report_exception /* IRQ */
|
b report_exception /* IRQ */
|
||||||
b report_exception /* FIQ */
|
b report_exception /* FIQ */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,8 +14,8 @@ vector_base bl2_vector_table
|
||||||
b bl2_entrypoint
|
b bl2_entrypoint
|
||||||
b report_exception /* Undef */
|
b report_exception /* Undef */
|
||||||
b report_exception /* SVC call */
|
b report_exception /* SVC call */
|
||||||
b report_exception /* Prefetch abort */
|
b report_prefetch_abort /* Prefetch abort */
|
||||||
b report_exception /* Data abort */
|
b report_data_abort /* Data abort */
|
||||||
b report_exception /* Reserved */
|
b report_exception /* Reserved */
|
||||||
b report_exception /* IRQ */
|
b report_exception /* IRQ */
|
||||||
b report_exception /* FIQ */
|
b report_exception /* FIQ */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,8 +16,8 @@ vector_base bl2_vector_table
|
||||||
b bl2_entrypoint
|
b bl2_entrypoint
|
||||||
b report_exception /* Undef */
|
b report_exception /* Undef */
|
||||||
b report_exception /* SVC call */
|
b report_exception /* SVC call */
|
||||||
b report_exception /* Prefetch abort */
|
b report_prefetch_abort /* Prefetch abort */
|
||||||
b report_exception /* Data abort */
|
b report_data_abort /* Data abort */
|
||||||
b report_exception /* Reserved */
|
b report_exception /* Reserved */
|
||||||
b report_exception /* IRQ */
|
b report_exception /* IRQ */
|
||||||
b report_exception /* FIQ */
|
b report_exception /* FIQ */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,8 +16,8 @@ vector_base bl2u_vector_table
|
||||||
b bl2u_entrypoint
|
b bl2u_entrypoint
|
||||||
b report_exception /* Undef */
|
b report_exception /* Undef */
|
||||||
b report_exception /* SVC call */
|
b report_exception /* SVC call */
|
||||||
b report_exception /* Prefetch abort */
|
b report_prefetch_abort /* Prefetch abort */
|
||||||
b report_exception /* Data abort */
|
b report_data_abort /* Data abort */
|
||||||
b report_exception /* Reserved */
|
b report_exception /* Reserved */
|
||||||
b report_exception /* IRQ */
|
b report_exception /* IRQ */
|
||||||
b report_exception /* FIQ */
|
b report_exception /* FIQ */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -51,8 +51,8 @@ vector_base sp_min_vector_table
|
||||||
b sp_min_entrypoint
|
b sp_min_entrypoint
|
||||||
b plat_panic_handler /* Undef */
|
b plat_panic_handler /* Undef */
|
||||||
b sp_min_handle_smc /* Syscall */
|
b sp_min_handle_smc /* Syscall */
|
||||||
b plat_panic_handler /* Prefetch abort */
|
b report_prefetch_abort /* Prefetch abort */
|
||||||
b plat_panic_handler /* Data abort */
|
b report_data_abort /* Data abort */
|
||||||
b plat_panic_handler /* Reserved */
|
b plat_panic_handler /* Reserved */
|
||||||
b plat_panic_handler /* IRQ */
|
b plat_panic_handler /* IRQ */
|
||||||
b sp_min_handle_fiq /* FIQ */
|
b sp_min_handle_fiq /* FIQ */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
.globl asm_assert
|
.globl asm_assert
|
||||||
.globl do_panic
|
.globl do_panic
|
||||||
.globl report_exception
|
.globl report_exception
|
||||||
|
.globl report_prefetch_abort
|
||||||
|
.globl report_data_abort
|
||||||
|
|
||||||
/* Since the max decimal input number is 65536 */
|
/* Since the max decimal input number is 65536 */
|
||||||
#define MAX_DEC_DIVISOR 10000
|
#define MAX_DEC_DIVISOR 10000
|
||||||
|
@ -205,3 +207,33 @@ func report_exception
|
||||||
bl plat_report_exception
|
bl plat_report_exception
|
||||||
no_ret plat_panic_handler
|
no_ret plat_panic_handler
|
||||||
endfunc report_exception
|
endfunc report_exception
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* This function is called from the vector table for
|
||||||
|
* unhandled exceptions. The lr_abt is given as an
|
||||||
|
* argument to platform handler.
|
||||||
|
***********************************************************/
|
||||||
|
func report_prefetch_abort
|
||||||
|
#if ARM_ARCH_MAJOR == 7 && !defined(ARMV7_SUPPORTS_VIRTUALIZATION)
|
||||||
|
b report_exception
|
||||||
|
#else
|
||||||
|
mrs r0, lr_abt
|
||||||
|
bl plat_report_prefetch_abort
|
||||||
|
no_ret plat_panic_handler
|
||||||
|
#endif
|
||||||
|
endfunc report_prefetch_abort
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* This function is called from the vector table for
|
||||||
|
* unhandled exceptions. The lr_abt is given as an
|
||||||
|
* argument to platform handler.
|
||||||
|
***********************************************************/
|
||||||
|
func report_data_abort
|
||||||
|
#if ARM_ARCH_MAJOR == 7 && !defined(ARMV7_SUPPORTS_VIRTUALIZATION)
|
||||||
|
b report_exception
|
||||||
|
#else
|
||||||
|
mrs r0, lr_abt
|
||||||
|
bl plat_report_data_abort
|
||||||
|
no_ret plat_panic_handler
|
||||||
|
#endif
|
||||||
|
endfunc report_data_abort
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -617,6 +617,12 @@
|
||||||
#define ICC_ASGI1R_EL1_64 p15, 1, c12
|
#define ICC_ASGI1R_EL1_64 p15, 1, c12
|
||||||
#define ICC_SGI0R_EL1_64 p15, 2, c12
|
#define ICC_SGI0R_EL1_64 p15, 2, c12
|
||||||
|
|
||||||
|
/* Fault registers. The format is: coproc, opt1, CRn, CRm, opt2 */
|
||||||
|
#define DFSR p15, 0, c5, c0, 0
|
||||||
|
#define IFSR p15, 0, c5, c0, 1
|
||||||
|
#define DFAR p15, 0, c6, c0, 0
|
||||||
|
#define IFAR p15, 0, c6, c0, 2
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Definitions of MAIR encodings for device and normal memory
|
* Definitions of MAIR encodings for device and normal memory
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
|
@ -118,6 +118,8 @@ unsigned int plat_ic_get_interrupt_id(unsigned int raw);
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
uintptr_t plat_get_my_stack(void);
|
uintptr_t plat_get_my_stack(void);
|
||||||
void plat_report_exception(unsigned int exception_type);
|
void plat_report_exception(unsigned int exception_type);
|
||||||
|
void plat_report_prefetch_abort(unsigned int fault_address);
|
||||||
|
void plat_report_data_abort(unsigned int fault_address);
|
||||||
int plat_crash_console_init(void);
|
int plat_crash_console_init(void);
|
||||||
int plat_crash_console_putc(int c);
|
int plat_crash_console_putc(int c);
|
||||||
void plat_crash_console_flush(void);
|
void plat_crash_console_flush(void);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,8 @@
|
||||||
#include <asm_macros.S>
|
#include <asm_macros.S>
|
||||||
|
|
||||||
.weak plat_report_exception
|
.weak plat_report_exception
|
||||||
|
.weak plat_report_prefetch_abort
|
||||||
|
.weak plat_report_data_abort
|
||||||
.weak plat_reset_handler
|
.weak plat_reset_handler
|
||||||
.weak plat_disable_acp
|
.weak plat_disable_acp
|
||||||
.weak bl1_plat_prepare_exit
|
.weak bl1_plat_prepare_exit
|
||||||
|
@ -23,6 +25,24 @@ func plat_report_exception
|
||||||
bx lr
|
bx lr
|
||||||
endfunc plat_report_exception
|
endfunc plat_report_exception
|
||||||
|
|
||||||
|
/* -----------------------------------------------------
|
||||||
|
* Placeholder function which should be redefined by
|
||||||
|
* each platform.
|
||||||
|
* -----------------------------------------------------
|
||||||
|
*/
|
||||||
|
func plat_report_prefetch_abort
|
||||||
|
bx lr
|
||||||
|
endfunc plat_report_prefetch_abort
|
||||||
|
|
||||||
|
/* -----------------------------------------------------
|
||||||
|
* Placeholder function which should be redefined by
|
||||||
|
* each platform.
|
||||||
|
* -----------------------------------------------------
|
||||||
|
*/
|
||||||
|
func plat_report_data_abort
|
||||||
|
bx lr
|
||||||
|
endfunc plat_report_data_abort
|
||||||
|
|
||||||
/* -----------------------------------------------------
|
/* -----------------------------------------------------
|
||||||
* Placeholder function which should be redefined by
|
* Placeholder function which should be redefined by
|
||||||
* each platform.
|
* each platform.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
.globl platform_mem_init
|
.globl platform_mem_init
|
||||||
.globl plat_report_exception
|
.globl plat_report_exception
|
||||||
|
.globl plat_report_prefetch_abort
|
||||||
|
.globl plat_report_data_abort
|
||||||
.globl plat_get_my_entrypoint
|
.globl plat_get_my_entrypoint
|
||||||
.globl plat_secondary_cold_boot_setup
|
.globl plat_secondary_cold_boot_setup
|
||||||
.globl plat_reset_handler
|
.globl plat_reset_handler
|
||||||
|
@ -30,20 +32,18 @@ func platform_mem_init
|
||||||
bx lr
|
bx lr
|
||||||
endfunc platform_mem_init
|
endfunc platform_mem_init
|
||||||
|
|
||||||
func plat_report_exception
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
func plat_report_exception
|
||||||
mov r8, lr
|
mov r8, lr
|
||||||
|
|
||||||
/* Test if an abort occurred */
|
/*
|
||||||
|
* Test if an abort occurred
|
||||||
|
* In this case the error message has already been displayed
|
||||||
|
* by dedicated functions
|
||||||
|
*/
|
||||||
cmp r0, #MODE32_abt
|
cmp r0, #MODE32_abt
|
||||||
bne undef_inst_lbl
|
beq 1f
|
||||||
ldr r4, =abort_str
|
|
||||||
bl asm_print_str
|
|
||||||
mrs r4, lr_abt
|
|
||||||
sub r4, r4, #4
|
|
||||||
b print_exception_info
|
|
||||||
|
|
||||||
undef_inst_lbl:
|
|
||||||
/* Test for an undefined instruction */
|
/* Test for an undefined instruction */
|
||||||
cmp r0, #MODE32_und
|
cmp r0, #MODE32_und
|
||||||
bne other_exception_lbl
|
bne other_exception_lbl
|
||||||
|
@ -69,12 +69,69 @@ print_exception_info:
|
||||||
ldr r4, =end_error_str
|
ldr r4, =end_error_str
|
||||||
bl asm_print_str
|
bl asm_print_str
|
||||||
|
|
||||||
|
1:
|
||||||
bx r8
|
bx r8
|
||||||
#else
|
|
||||||
bx lr
|
|
||||||
#endif
|
|
||||||
endfunc plat_report_exception
|
endfunc plat_report_exception
|
||||||
|
|
||||||
|
func plat_report_prefetch_abort
|
||||||
|
mov r8, lr
|
||||||
|
mov r9, r0
|
||||||
|
|
||||||
|
ldr r4, =prefetch_abort_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
mov r4, r9
|
||||||
|
sub r4, r4, #4
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =ifsr_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
ldcopr r4, IFSR
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =ifar_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
ldcopr r4, IFAR
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =end_error_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
bx r8
|
||||||
|
endfunc plat_report_prefetch_abort
|
||||||
|
|
||||||
|
func plat_report_data_abort
|
||||||
|
mov r8, lr
|
||||||
|
mov r9, r0
|
||||||
|
|
||||||
|
ldr r4, =data_abort_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
mov r4, r9
|
||||||
|
sub r4, r4, #8
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =dfsr_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
ldcopr r4, DFSR
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =dfar_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
ldcopr r4, DFAR
|
||||||
|
bl asm_print_hex
|
||||||
|
|
||||||
|
ldr r4, =end_error_str
|
||||||
|
bl asm_print_str
|
||||||
|
|
||||||
|
bx r8
|
||||||
|
endfunc plat_report_data_abort
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
func plat_reset_handler
|
func plat_reset_handler
|
||||||
bx lr
|
bx lr
|
||||||
endfunc plat_reset_handler
|
endfunc plat_reset_handler
|
||||||
|
@ -256,14 +313,24 @@ endfunc plat_panic_handler
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
.section .rodata.rev_err_str, "aS"
|
.section .rodata.rev_err_str, "aS"
|
||||||
abort_str:
|
prefetch_abort_str:
|
||||||
.asciz "\nAbort at: 0x"
|
.asciz "\nPrefetch Abort at: 0x"
|
||||||
|
data_abort_str:
|
||||||
|
.asciz "\nData Abort at: 0x"
|
||||||
undefined_str:
|
undefined_str:
|
||||||
.asciz "\nUndefined instruction at: 0x"
|
.asciz "\nUndefined instruction at: 0x"
|
||||||
exception_start_str:
|
exception_start_str:
|
||||||
.asciz "\nException mode=0x"
|
.asciz "\nException mode=0x"
|
||||||
exception_end_str:
|
exception_end_str:
|
||||||
.asciz " at: 0x"
|
.asciz " at: 0x"
|
||||||
|
dfsr_str:
|
||||||
|
.asciz " DFSR = 0x"
|
||||||
|
dfar_str:
|
||||||
|
.asciz " DFAR = 0x"
|
||||||
|
ifsr_str:
|
||||||
|
.asciz " IFSR = 0x"
|
||||||
|
ifar_str:
|
||||||
|
.asciz " IFAR = 0x"
|
||||||
end_error_str:
|
end_error_str:
|
||||||
.asciz "\n\r"
|
.asciz "\n\r"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue