gic600ae_fmu.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (c) 2021-2022, NVIDIA Corporation. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef GIC600AE_FMU_H
  7. #define GIC600AE_FMU_H
  8. /*******************************************************************************
  9. * GIC600-AE FMU register offsets and constants
  10. ******************************************************************************/
  11. #define GICFMU_ERRFR_LO U(0x000)
  12. #define GICFMU_ERRFR_HI U(0x004)
  13. #define GICFMU_ERRCTLR_LO U(0x008)
  14. #define GICFMU_ERRCTLR_HI U(0x00C)
  15. #define GICFMU_ERRSTATUS_LO U(0x010)
  16. #define GICFMU_ERRSTATUS_HI U(0x014)
  17. #define GICFMU_ERRGSR_LO U(0xE00)
  18. #define GICFMU_ERRGSR_HI U(0xE04)
  19. #define GICFMU_KEY U(0xEA0)
  20. #define GICFMU_PINGCTLR U(0xEA4)
  21. #define GICFMU_PINGNOW U(0xEA8)
  22. #define GICFMU_SMEN U(0xEB0)
  23. #define GICFMU_SMINJERR U(0xEB4)
  24. #define GICFMU_PINGMASK_LO U(0xEC0)
  25. #define GICFMU_PINGMASK_HI U(0xEC4)
  26. #define GICFMU_STATUS U(0xF00)
  27. #define GICFMU_ERRIDR U(0xFC8)
  28. /* ERRCTLR bits */
  29. #define FMU_ERRCTLR_ED_BIT BIT(0)
  30. #define FMU_ERRCTLR_CE_EN_BIT BIT(1)
  31. #define FMU_ERRCTLR_UI_BIT BIT(2)
  32. #define FMU_ERRCTLR_CI_BIT BIT(3)
  33. /* SMEN constants */
  34. #define FMU_SMEN_BLK_SHIFT U(8)
  35. #define FMU_SMEN_SMID_SHIFT U(24)
  36. #define FMU_SMEN_EN_BIT BIT(0)
  37. /* Error record IDs */
  38. #define FMU_BLK_GICD U(0)
  39. #define FMU_BLK_SPICOL U(1)
  40. #define FMU_BLK_WAKERQ U(2)
  41. #define FMU_BLK_ITS0 U(4)
  42. #define FMU_BLK_ITS1 U(5)
  43. #define FMU_BLK_ITS2 U(6)
  44. #define FMU_BLK_ITS3 U(7)
  45. #define FMU_BLK_ITS4 U(8)
  46. #define FMU_BLK_ITS5 U(9)
  47. #define FMU_BLK_ITS6 U(10)
  48. #define FMU_BLK_ITS7 U(11)
  49. #define FMU_BLK_PPI0 U(12)
  50. #define FMU_BLK_PPI1 U(13)
  51. #define FMU_BLK_PPI2 U(14)
  52. #define FMU_BLK_PPI3 U(15)
  53. #define FMU_BLK_PPI4 U(16)
  54. #define FMU_BLK_PPI5 U(17)
  55. #define FMU_BLK_PPI6 U(18)
  56. #define FMU_BLK_PPI7 U(19)
  57. #define FMU_BLK_PPI8 U(20)
  58. #define FMU_BLK_PPI9 U(21)
  59. #define FMU_BLK_PPI10 U(22)
  60. #define FMU_BLK_PPI11 U(23)
  61. #define FMU_BLK_PPI12 U(24)
  62. #define FMU_BLK_PPI13 U(25)
  63. #define FMU_BLK_PPI14 U(26)
  64. #define FMU_BLK_PPI15 U(27)
  65. #define FMU_BLK_PPI16 U(28)
  66. #define FMU_BLK_PPI17 U(29)
  67. #define FMU_BLK_PPI18 U(30)
  68. #define FMU_BLK_PPI19 U(31)
  69. #define FMU_BLK_PPI20 U(32)
  70. #define FMU_BLK_PPI21 U(33)
  71. #define FMU_BLK_PPI22 U(34)
  72. #define FMU_BLK_PPI23 U(35)
  73. #define FMU_BLK_PPI24 U(36)
  74. #define FMU_BLK_PPI25 U(37)
  75. #define FMU_BLK_PPI26 U(38)
  76. #define FMU_BLK_PPI27 U(39)
  77. #define FMU_BLK_PPI28 U(40)
  78. #define FMU_BLK_PPI29 U(41)
  79. #define FMU_BLK_PPI30 U(42)
  80. #define FMU_BLK_PPI31 U(43)
  81. #define FMU_BLK_PRESENT_MASK U(0xFFFFFFFFFFF)
  82. /* Safety Mechanism limit */
  83. #define FMU_SMID_GICD_MAX U(33)
  84. #define FMU_SMID_PPI_MAX U(12)
  85. #define FMU_SMID_ITS_MAX U(14)
  86. #define FMU_SMID_SPICOL_MAX U(5)
  87. #define FMU_SMID_WAKERQ_MAX U(2)
  88. /* MBIST Safety Mechanism ID */
  89. #define GICD_MBIST_REQ_ERROR U(23)
  90. #define GICD_FMU_CLKGATE_ERROR U(33)
  91. #define PPI_MBIST_REQ_ERROR U(10)
  92. #define PPI_FMU_CLKGATE_ERROR U(12)
  93. #define ITS_MBIST_REQ_ERROR U(13)
  94. #define ITS_FMU_CLKGATE_ERROR U(14)
  95. /* ERRSTATUS bits */
  96. #define FMU_ERRSTATUS_BLKID_SHIFT U(32)
  97. #define FMU_ERRSTATUS_BLKID_MASK U(0xFF)
  98. #define FMU_ERRSTATUS_V_BIT BIT(30)
  99. #define FMU_ERRSTATUS_UE_BIT BIT(29)
  100. #define FMU_ERRSTATUS_OV_BIT BIT(27)
  101. #define FMU_ERRSTATUS_CE_BITS (BIT(25) | BIT(24))
  102. #define FMU_ERRSTATUS_CLEAR (FMU_ERRSTATUS_V_BIT | FMU_ERRSTATUS_UE_BIT | \
  103. FMU_ERRSTATUS_OV_BIT | FMU_ERRSTATUS_CE_BITS)
  104. #define FMU_ERRSTATUS_IERR_MASK U(0xFF)
  105. #define FMU_ERRSTATUS_IERR_SHIFT U(8)
  106. #define FMU_ERRSTATUS_SERR_MASK U(0xFF)
  107. /* PINGCTLR constants */
  108. #define FMU_PINGCTLR_INTDIFF_SHIFT U(16)
  109. #define FMU_PINGCTLR_TIMEOUTVAL_SHIFT U(4)
  110. #define FMU_PINGCTLR_EN_BIT BIT(0)
  111. #ifndef __ASSEMBLER__
  112. #include <stdint.h>
  113. #include <arch_helpers.h>
  114. /*******************************************************************************
  115. * GIC600 FMU EL3 driver API
  116. ******************************************************************************/
  117. uint64_t gic_fmu_read_errfr(uintptr_t base, unsigned int n);
  118. uint64_t gic_fmu_read_errctlr(uintptr_t base, unsigned int n);
  119. uint64_t gic_fmu_read_errstatus(uintptr_t base, unsigned int n);
  120. uint64_t gic_fmu_read_errgsr(uintptr_t base);
  121. uint32_t gic_fmu_read_pingctlr(uintptr_t base);
  122. uint32_t gic_fmu_read_pingnow(uintptr_t base);
  123. uint64_t gic_fmu_read_pingmask(uintptr_t base);
  124. uint32_t gic_fmu_read_status(uintptr_t base);
  125. uint32_t gic_fmu_read_erridr(uintptr_t base);
  126. void gic_fmu_write_errctlr(uintptr_t base, unsigned int n, uint64_t val);
  127. void gic_fmu_write_errstatus(uintptr_t base, unsigned int n, uint64_t val);
  128. void gic_fmu_write_pingctlr(uintptr_t base, uint32_t val);
  129. void gic_fmu_write_pingnow(uintptr_t base, uint32_t val);
  130. void gic_fmu_write_smen(uintptr_t base, uint32_t val);
  131. void gic_fmu_write_sminjerr(uintptr_t base, uint32_t val);
  132. void gic_fmu_write_pingmask(uintptr_t base, uint64_t val);
  133. void gic_fmu_disable_all_sm_blkid(uintptr_t base, unsigned int blkid);
  134. void gic600_fmu_init(uint64_t base, uint64_t blk_present_mask, bool errctlr_ce_en, bool errctlr_ue_en);
  135. void gic600_fmu_enable_ping(uint64_t base, uint64_t blk_present_mask,
  136. unsigned int timeout_val, unsigned int interval_diff);
  137. void gic600_fmu_print_sm_info(uint64_t base, unsigned int blk, unsigned int smid);
  138. int gic600_fmu_probe(uint64_t base, int *probe_data);
  139. int gic600_fmu_ras_handler(uint64_t base, int probe_data);
  140. #endif /* __ASSEMBLER__ */
  141. #endif /* GIC600AE_FMU_H */