| 1 |
/* |
| 2 |
* Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <drivers/arm/cci.h> |
| 8 |
#include <drivers/arm/gic_common.h> |
| 9 |
#include <drivers/arm/gicv2.h> |
| 10 |
|
| 11 |
#include "rcar_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 BL3-1. |
| 27 |
* Clobbers: x0 - x10, x16, x17, sp |
| 28 |
* --------------------------------------------- |
| 29 |
*/ |
| 30 |
.macro plat_print_gic_regs |
| 31 |
mov_imm x17, RCAR_GICC_BASE |
| 32 |
mov_imm x16, RCAR_GICD_BASE |
| 33 |
print_gicc_regs: |
| 34 |
/* gicc base address is now in x17 */ |
| 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, [x17, #GICC_HPPIR] |
| 38 |
ldr w9, [x17, #GICC_AHPPIR] |
| 39 |
ldr w10, [x17, #GICC_CTLR] |
| 40 |
/* Store to the crash buf and print to console */ |
| 41 |
bl str_in_crash_buf_print |
| 42 |
|
| 43 |
/* Print the GICD_ISPENDR regs */ |
| 44 |
add x7, x16, #GICD_ISPENDR |
| 45 |
adr x4, gicd_pend_reg |
| 46 |
bl asm_print_str |
| 47 |
gicd_ispendr_loop: |
| 48 |
sub x4, x7, x16 |
| 49 |
cmp x4, #0x280 |
| 50 |
b.eq exit_print_gic_regs |
| 51 |
bl asm_print_hex |
| 52 |
adr x4, spacer |
| 53 |
bl asm_print_str |
| 54 |
ldr x4, [x7], #8 |
| 55 |
bl asm_print_hex |
| 56 |
adr x4, newline |
| 57 |
bl asm_print_str |
| 58 |
b gicd_ispendr_loop |
| 59 |
exit_print_gic_regs: |
| 60 |
.endm |
| 61 |
|
| 62 |
.section .rodata.cci_reg_name, "aS" |
| 63 |
cci_iface_regs: |
| 64 |
.asciz "cci_snoop_ctrl_cluster0", "cci_snoop_ctrl_cluster1" , "" |
| 65 |
|
| 66 |
/* ------------------------------------------------ |
| 67 |
* The below macro prints out relevant interconnect |
| 68 |
* registers whenever an unhandled exception is |
| 69 |
* taken in BL3-1. |
| 70 |
* Clobbers: x0 - x9, sp |
| 71 |
* ------------------------------------------------ |
| 72 |
*/ |
| 73 |
.macro plat_print_interconnect_regs |
| 74 |
adr x6, cci_iface_regs |
| 75 |
/* Store in x7 the base address of the first interface */ |
| 76 |
mov_imm x7, (CCI500_BASE + SLAVE_IFACE3_OFFSET) |
| 77 |
ldr w8, [x7, #SNOOP_CTRL_REG] |
| 78 |
/* Store in x7 the base address of the second interface */ |
| 79 |
mov_imm x7, (CCI500_BASE + SLAVE_IFACE4_OFFSET) |
| 80 |
ldr w9, [x7, #SNOOP_CTRL_REG] |
| 81 |
/* Store to the crash buf and print to console */ |
| 82 |
bl str_in_crash_buf_print |
| 83 |
.endm |
| 84 |
|
| 85 |
.macro plat_crash_print_regs |
| 86 |
plat_print_gic_regs |
| 87 |
plat_print_interconnect_regs |
| 88 |
.endm |