Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 1 | /* |
Varun Wadekar | 4fe43a3 | 2018-01-02 14:10:18 -0800 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef PLAT_MACROS_S |
| 8 | #define PLAT_MACROS_S |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 9 | |
Ambroise Vincent | ffbf32a | 2019-03-28 09:01:18 +0000 | [diff] [blame] | 10 | #include <drivers/arm/gicv2.h> |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 11 | #include <tegra_def.h> |
| 12 | |
| 13 | .section .rodata.gic_reg_name, "aS" |
| 14 | gicc_regs: |
| 15 | .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", "" |
| 16 | gicd_pend_reg: |
| 17 | .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n" |
| 18 | newline: |
| 19 | .asciz "\n" |
| 20 | spacer: |
| 21 | .asciz ":\t\t0x" |
| 22 | |
| 23 | /* --------------------------------------------- |
| 24 | * The below macro prints out relevant GIC |
| 25 | * registers whenever an unhandled exception is |
| 26 | * taken in BL31. |
| 27 | * --------------------------------------------- |
| 28 | */ |
Gerald Lejeune | 2c7ed5b | 2015-11-26 15:47:53 +0100 | [diff] [blame] | 29 | .macro plat_crash_print_regs |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 30 | mov_imm x16, TEGRA_GICC_BASE |
Varun Wadekar | bfc6605 | 2016-08-23 14:01:19 -0700 | [diff] [blame] | 31 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 32 | /* gicc base address is now in x16 */ |
| 33 | adr x6, gicc_regs /* Load the gicc reg list to x6 */ |
| 34 | /* Load the gicc regs to gp regs used by str_in_crash_buf_print */ |
| 35 | ldr w8, [x16, #GICC_HPPIR] |
| 36 | ldr w9, [x16, #GICC_AHPPIR] |
| 37 | ldr w10, [x16, #GICC_CTLR] |
| 38 | /* Store to the crash buf and print to cosole */ |
| 39 | bl str_in_crash_buf_print |
| 40 | |
| 41 | /* Print the GICD_ISPENDR regs */ |
Varun Wadekar | bfc6605 | 2016-08-23 14:01:19 -0700 | [diff] [blame] | 42 | mov_imm x16, TEGRA_GICD_BASE |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 43 | add x7, x16, #GICD_ISPENDR |
| 44 | adr x4, gicd_pend_reg |
| 45 | bl asm_print_str |
| 46 | 2: |
| 47 | sub x4, x7, x16 |
| 48 | cmp x4, #0x280 |
| 49 | b.eq 1f |
| 50 | bl asm_print_hex |
| 51 | adr x4, spacer |
| 52 | bl asm_print_str |
Varun Wadekar | 4fe43a3 | 2018-01-02 14:10:18 -0800 | [diff] [blame] | 53 | ldr w4, [x7], #4 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 54 | bl asm_print_hex |
| 55 | adr x4, newline |
| 56 | bl asm_print_str |
| 57 | b 2b |
| 58 | 1: |
| 59 | .endm |
| 60 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 61 | #endif /* PLAT_MACROS_S */ |