plat_macros.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLAT_MACROS_S
  7. #define PLAT_MACROS_S
  8. #include <drivers/arm/gicv2.h>
  9. #include <platform_def.h>
  10. .section .rodata.gic_reg_name, "aS"
  11. gicc_regs:
  12. .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
  13. gicd_pend_reg:
  14. .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
  15. newline:
  16. .asciz "\n"
  17. spacer:
  18. .asciz ":\t\t0x"
  19. /* ---------------------------------------------
  20. * The below required platform porting macro
  21. * prints out relevant GIC and CCI registers
  22. * whenever an unhandled exception is taken in
  23. * BL31.
  24. * Clobbers: x0 - x10, x16, x17, sp
  25. * ---------------------------------------------
  26. */
  27. .macro plat_crash_print_regs
  28. /* GICC registers */
  29. mov_imm x17, AML_GICC_BASE
  30. adr x6, gicc_regs
  31. ldr w8, [x17, #GICC_HPPIR]
  32. ldr w9, [x17, #GICC_AHPPIR]
  33. ldr w10, [x17, #GICC_CTLR]
  34. bl str_in_crash_buf_print
  35. /* GICD registers */
  36. mov_imm x16, AML_GICD_BASE
  37. add x7, x16, #GICD_ISPENDR
  38. adr x4, gicd_pend_reg
  39. bl asm_print_str
  40. gicd_ispendr_loop:
  41. sub x4, x7, x16
  42. cmp x4, #0x280
  43. b.eq exit_print_gic_regs
  44. bl asm_print_hex
  45. adr x4, spacer
  46. bl asm_print_str
  47. ldr x4, [x7], #8
  48. bl asm_print_hex
  49. adr x4, newline
  50. bl asm_print_str
  51. b gicd_ispendr_loop
  52. exit_print_gic_regs:
  53. .endm
  54. #endif /* PLAT_MACROS_S */