blob: 2dc3b4152bfabe93d33464c03faea145fe83732a [file] [log] [blame]
Varun Wadekarb316e242015-05-19 16:48:04 +05301/*
Varun Wadekar4fe43a32018-01-02 14:10:18 -08002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Varun Wadekar4151af92019-10-04 11:40:56 -07003 * Copyright (c) 2015-2020, NVIDIA Corporation. All rights reserved.
Varun Wadekarb316e242015-05-19 16:48:04 +05304 *
dp-armfa3cf0b2017-05-03 09:38:09 +01005 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekarb316e242015-05-19 16:48:04 +05306 */
7
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00008#ifndef PLAT_MACROS_S
9#define PLAT_MACROS_S
Varun Wadekarb316e242015-05-19 16:48:04 +053010
Ambroise Vincentffbf32a2019-03-28 09:01:18 +000011#include <drivers/arm/gicv2.h>
Varun Wadekarb316e242015-05-19 16:48:04 +053012#include <tegra_def.h>
13
14.section .rodata.gic_reg_name, "aS"
15gicc_regs:
16 .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
17gicd_pend_reg:
18 .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
19newline:
20 .asciz "\n"
21spacer:
22 .asciz ":\t\t0x"
23
24/* ---------------------------------------------
25 * The below macro prints out relevant GIC
26 * registers whenever an unhandled exception is
27 * taken in BL31.
28 * ---------------------------------------------
29 */
Gerald Lejeune2c7ed5b2015-11-26 15:47:53 +010030.macro plat_crash_print_regs
Varun Wadekar4151af92019-10-04 11:40:56 -070031#ifdef TEGRA_GICC_BASE
Varun Wadekarb316e242015-05-19 16:48:04 +053032 mov_imm x16, TEGRA_GICC_BASE
Varun Wadekarbfc66052016-08-23 14:01:19 -070033
Varun Wadekarb316e242015-05-19 16:48:04 +053034 /* gicc base address is now in x16 */
35 adr x6, gicc_regs /* Load the gicc reg list to x6 */
36 /* Load the gicc regs to gp regs used by str_in_crash_buf_print */
37 ldr w8, [x16, #GICC_HPPIR]
38 ldr w9, [x16, #GICC_AHPPIR]
39 ldr w10, [x16, #GICC_CTLR]
40 /* Store to the crash buf and print to cosole */
41 bl str_in_crash_buf_print
Varun Wadekar4151af92019-10-04 11:40:56 -070042#endif
Varun Wadekarb316e242015-05-19 16:48:04 +053043 /* Print the GICD_ISPENDR regs */
Varun Wadekarbfc66052016-08-23 14:01:19 -070044 mov_imm x16, TEGRA_GICD_BASE
Varun Wadekarb316e242015-05-19 16:48:04 +053045 add x7, x16, #GICD_ISPENDR
46 adr x4, gicd_pend_reg
47 bl asm_print_str
482:
49 sub x4, x7, x16
50 cmp x4, #0x280
51 b.eq 1f
52 bl asm_print_hex
53 adr x4, spacer
54 bl asm_print_str
Varun Wadekar4fe43a32018-01-02 14:10:18 -080055 ldr w4, [x7], #4
Varun Wadekarb316e242015-05-19 16:48:04 +053056 bl asm_print_hex
57 adr x4, newline
58 bl asm_print_str
59 b 2b
601:
61.endm
62
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000063#endif /* PLAT_MACROS_S */