blob: 1ad217a179f76a0004dd19df48dc591d0381f430 [file] [log] [blame]
Haojian Zhuang5f281b32017-05-24 08:45:05 +08001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __PLAT_MACROS_S__
8#define __PLAT_MACROS_S__
9
10#include <cci.h>
11#include <gic_v2.h>
12#include <hi6220.h>
13#include <platform_def.h>
14
15.section .rodata.gic_reg_name, "aS"
16gicc_regs:
17 .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
18gicd_pend_reg:
19 .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n" \
20 " Offset:\t\t\tvalue\n"
21newline:
22 .asciz "\n"
23spacer:
24 .asciz ":\t\t0x"
25
26.section .rodata.cci_reg_name, "aS"
27cci_iface_regs:
28 .asciz "cci_snoop_ctrl_cluster0", "cci_snoop_ctrl_cluster1" , ""
29
30/* ---------------------------------------------
31 * The below macro prints out relevant GIC
32 * registers whenever an unhandled exception is
33 * taken in BL31.
34 * ---------------------------------------------
35 */
36.macro plat_crash_print_regs
37 mov_imm x16, PLAT_ARM_GICD_BASE
38 mov_imm x17, PLAT_ARM_GICC_BASE
39
40 /* Load the gicc reg list to x6 */
41 adr x6, gicc_regs
42 /* Load the gicc regs to gp regs used by str_in_crash_buf_print */
43 ldr w8, [x17, #GICC_HPPIR]
44 ldr w9, [x17, #GICC_AHPPIR]
45 ldr w10, [x17, #GICC_CTLR]
46 /* Store to the crash buf and print to cosole */
47 bl str_in_crash_buf_print
48
49 /* Print the GICD_ISPENDR regs */
50 add x7, x16, #GICD_ISPENDR
51 adr x4, gicd_pend_reg
52 bl asm_print_str
532:
54 sub x4, x7, x16
55 cmp x4, #0x280
56 b.eq 1f
57 bl asm_print_hex
58 adr x4, spacer
59 bl asm_print_str
60 ldr x4, [x7], #8
61 bl asm_print_hex
62 adr x4, newline
63 bl asm_print_str
64 b 2b
651:
66 adr x6, cci_iface_regs
67 /* Store in x7 the base address of the first interface */
68 mov_imm x7, (CCI400_BASE + SLAVE_IFACE_OFFSET( \
69 CCI400_SL_IFACE3_CLUSTER_IX))
70 ldr w8, [x7, #SNOOP_CTRL_REG]
71 /* Store in x7 the base address of the second interface */
72 mov_imm x7, (CCI400_BASE + SLAVE_IFACE_OFFSET( \
73 CCI400_SL_IFACE4_CLUSTER_IX))
74 ldr w9, [x7, #SNOOP_CTRL_REG]
75 /* Store to the crash buf and print to console */
76 bl str_in_crash_buf_print
77.endm
78
79#endif /* __PLAT_MACROS_S__ */