Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 1 | /* |
| 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> |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 11 | #include <gic_v2.h> |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 12 | #include <hi3660.h> |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 13 | #include <platform_def.h> |
| 14 | |
| 15 | .section .rodata.gic_reg_name, "aS" |
| 16 | gicc_regs: |
| 17 | .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", "" |
| 18 | gicd_pend_reg: |
| 19 | .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n" \ |
| 20 | " Offset:\t\t\tvalue\n" |
| 21 | newline: |
| 22 | .asciz "\n" |
| 23 | spacer: |
| 24 | .asciz ":\t\t0x" |
| 25 | |
| 26 | .section .rodata.cci_reg_name, "aS" |
| 27 | cci_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, GICD_REG_BASE |
| 38 | mov_imm x17, GICC_REG_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 |
| 53 | 2: |
| 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 |
| 65 | 1: |
| 66 | adr x6, cci_iface_regs |
| 67 | /* Store in x7 the base address of the first interface */ |
| 68 | mov_imm x7, (CCI400_REG_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_REG_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__ */ |