plat_macros.S 2.4 KB

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