devapc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef DEVAPC_H
  7. #define DEVAPC_H
  8. #include <stdint.h>
  9. #include <platform_def.h>
  10. /******************************************************************************
  11. * FUNCTION DEFINITION
  12. ******************************************************************************/
  13. void devapc_init(void);
  14. /******************************************************************************
  15. * STRUCTURE DEFINITION
  16. ******************************************************************************/
  17. enum DEVAPC_PERM_TYPE {
  18. NO_PROTECTION = 0,
  19. SEC_RW_ONLY,
  20. SEC_RW_NS_R,
  21. FORBIDDEN,
  22. PERM_NUM,
  23. };
  24. enum DOMAIN_ID {
  25. DOMAIN_0 = 0,
  26. DOMAIN_1,
  27. DOMAIN_2,
  28. DOMAIN_3,
  29. DOMAIN_4,
  30. DOMAIN_5,
  31. DOMAIN_6,
  32. DOMAIN_7,
  33. DOMAIN_8,
  34. DOMAIN_9,
  35. DOMAIN_10,
  36. DOMAIN_11,
  37. DOMAIN_12,
  38. DOMAIN_13,
  39. DOMAIN_14,
  40. DOMAIN_15,
  41. };
  42. /* Slave Type */
  43. enum DEVAPC_SLAVE_TYPE_SIMPLE {
  44. SLAVE_TYPE_INFRA = 0,
  45. SLAVE_TYPE_PERI,
  46. SLAVE_TYPE_PERI2,
  47. SLAVE_TYPE_PERI_PAR,
  48. };
  49. enum DEVAPC_SYS_INDEX {
  50. DEVAPC_SYS0 = 0,
  51. DEVAPC_SYS1,
  52. DEVAPC_SYS2,
  53. };
  54. enum DEVAPC_SLAVE_TYPE {
  55. SLAVE_TYPE_INFRA_AO_SYS0 = 0,
  56. SLAVE_TYPE_INFRA_AO_SYS1,
  57. SLAVE_TYPE_INFRA_AO_SYS2,
  58. SLAVE_TYPE_PERI_AO_SYS0,
  59. SLAVE_TYPE_PERI_AO_SYS1,
  60. SLAVE_TYPE_PERI_AO_SYS2,
  61. SLAVE_TYPE_PERI_AO2_SYS0,
  62. SLAVE_TYPE_PERI_PAR_AO_SYS0,
  63. };
  64. /* Slave Num */
  65. enum DEVAPC_SLAVE_NUM {
  66. SLAVE_NUM_INFRA_AO_SYS0 = 23,
  67. SLAVE_NUM_INFRA_AO_SYS1 = 256,
  68. SLAVE_NUM_INFRA_AO_SYS2 = 70,
  69. SLAVE_NUM_PERI_AO_SYS0 = 105,
  70. SLAVE_NUM_PERI_AO_SYS1 = 66,
  71. SLAVE_NUM_PERI_AO_SYS2 = 1,
  72. SLAVE_NUM_PERI_AO2_SYS0 = 115,
  73. SLAVE_NUM_PERI_PAR_AO_SYS0 = 27,
  74. };
  75. enum DEVAPC_SYS_DOM_NUM {
  76. DOM_NUM_INFRA_AO_SYS0 = 16,
  77. DOM_NUM_INFRA_AO_SYS1 = 4,
  78. DOM_NUM_INFRA_AO_SYS2 = 4,
  79. DOM_NUM_PERI_AO_SYS0 = 16,
  80. DOM_NUM_PERI_AO_SYS1 = 8,
  81. DOM_NUM_PERI_AO_SYS2 = 4,
  82. DOM_NUM_PERI_AO2_SYS0 = 16,
  83. DOM_NUM_PERI_PAR_AO_SYS0 = 16,
  84. };
  85. enum DEVAPC_CFG_INDEX {
  86. DEVAPC_DEBUGSYS_INDEX = 57,
  87. };
  88. struct APC_INFRA_PERI_DOM_16 {
  89. unsigned char d0_permission;
  90. unsigned char d1_permission;
  91. unsigned char d2_permission;
  92. unsigned char d3_permission;
  93. unsigned char d4_permission;
  94. unsigned char d5_permission;
  95. unsigned char d6_permission;
  96. unsigned char d7_permission;
  97. unsigned char d8_permission;
  98. unsigned char d9_permission;
  99. unsigned char d10_permission;
  100. unsigned char d11_permission;
  101. unsigned char d12_permission;
  102. unsigned char d13_permission;
  103. unsigned char d14_permission;
  104. unsigned char d15_permission;
  105. };
  106. struct APC_INFRA_PERI_DOM_8 {
  107. unsigned char d0_permission;
  108. unsigned char d1_permission;
  109. unsigned char d2_permission;
  110. unsigned char d3_permission;
  111. unsigned char d4_permission;
  112. unsigned char d5_permission;
  113. unsigned char d6_permission;
  114. unsigned char d7_permission;
  115. };
  116. struct APC_INFRA_PERI_DOM_4 {
  117. unsigned char d0_permission;
  118. unsigned char d1_permission;
  119. unsigned char d2_permission;
  120. unsigned char d3_permission;
  121. };
  122. #define DAPC_INFRA_AO_SYS0_ATTR(DEV_NAME, PERM_ATTR0, PERM_ATTR1, \
  123. PERM_ATTR2, PERM_ATTR3, PERM_ATTR4, PERM_ATTR5, \
  124. PERM_ATTR6, PERM_ATTR7, PERM_ATTR8, PERM_ATTR9, \
  125. PERM_ATTR10, PERM_ATTR11, PERM_ATTR12, PERM_ATTR13, \
  126. PERM_ATTR14, PERM_ATTR15) \
  127. {(unsigned char)PERM_ATTR0, (unsigned char)PERM_ATTR1, \
  128. (unsigned char)PERM_ATTR2, (unsigned char)PERM_ATTR3, \
  129. (unsigned char)PERM_ATTR4, (unsigned char)PERM_ATTR5, \
  130. (unsigned char)PERM_ATTR6, (unsigned char)PERM_ATTR7, \
  131. (unsigned char)PERM_ATTR8, (unsigned char)PERM_ATTR9, \
  132. (unsigned char)PERM_ATTR10, (unsigned char)PERM_ATTR11, \
  133. (unsigned char)PERM_ATTR12, (unsigned char)PERM_ATTR13, \
  134. (unsigned char)PERM_ATTR14, (unsigned char)PERM_ATTR15}
  135. #define DAPC_INFRA_AO_SYS1_ATTR(DEV_NAME, PERM_ATTR0, PERM_ATTR1, \
  136. PERM_ATTR2, PERM_ATTR3) \
  137. {(unsigned char)PERM_ATTR0, (unsigned char)PERM_ATTR1, \
  138. (unsigned char)PERM_ATTR2, (unsigned char)PERM_ATTR3}
  139. #define DAPC_PERI_AO_SYS1_ATTR(DEV_NAME, PERM_ATTR0, PERM_ATTR1, \
  140. PERM_ATTR2, PERM_ATTR3, PERM_ATTR4, PERM_ATTR5, \
  141. PERM_ATTR6, PERM_ATTR7) \
  142. {(unsigned char)PERM_ATTR0, (unsigned char)PERM_ATTR1, \
  143. (unsigned char)PERM_ATTR2, (unsigned char)PERM_ATTR3, \
  144. (unsigned char)PERM_ATTR4, (unsigned char)PERM_ATTR5, \
  145. (unsigned char)PERM_ATTR6, (unsigned char)PERM_ATTR7}
  146. #define DAPC_INFRA_AO_SYS2_ATTR(...) DAPC_INFRA_AO_SYS1_ATTR(__VA_ARGS__)
  147. #define DAPC_PERI_AO_SYS0_ATTR(...) DAPC_INFRA_AO_SYS0_ATTR(__VA_ARGS__)
  148. #define DAPC_PERI_AO_SYS2_ATTR(...) DAPC_INFRA_AO_SYS1_ATTR(__VA_ARGS__)
  149. #define DAPC_PERI_AO2_SYS0_ATTR(...) DAPC_INFRA_AO_SYS0_ATTR(__VA_ARGS__)
  150. #define DAPC_PERI_PAR_AO_SYS0_ATTR(...) DAPC_INFRA_AO_SYS0_ATTR(__VA_ARGS__)
  151. /******************************************************************************
  152. * UTILITY DEFINITION
  153. ******************************************************************************/
  154. #define devapc_writel(VAL, REG) mmio_write_32((uintptr_t)REG, VAL)
  155. #define devapc_readl(REG) mmio_read_32((uintptr_t)REG)
  156. /******************************************************************************/
  157. /* Device APC AO for INFRA AO */
  158. #define DEVAPC_INFRA_AO_SYS0_D0_APC_0 (DEVAPC_INFRA_AO_BASE + 0x0000)
  159. #define DEVAPC_INFRA_AO_SYS1_D0_APC_0 (DEVAPC_INFRA_AO_BASE + 0x1000)
  160. #define DEVAPC_INFRA_AO_SYS2_D0_APC_0 (DEVAPC_INFRA_AO_BASE + 0x2000)
  161. #define DEVAPC_INFRA_AO_MAS_SEC_0 (DEVAPC_INFRA_AO_BASE + 0x0A00)
  162. /******************************************************************************/
  163. /* Device APC AO for PERI AO */
  164. #define DEVAPC_PERI_AO_SYS0_D0_APC_0 (DEVAPC_PERI_AO_BASE + 0x0000)
  165. #define DEVAPC_PERI_AO_SYS1_D0_APC_0 (DEVAPC_PERI_AO_BASE + 0x1000)
  166. #define DEVAPC_PERI_AO_SYS2_D0_APC_0 (DEVAPC_PERI_AO_BASE + 0x2000)
  167. #define DEVAPC_PERI_AO_MAS_SEC_0 (DEVAPC_PERI_AO_BASE + 0x0A00)
  168. /******************************************************************************/
  169. /* Device APC AO for PERI AO2 */
  170. #define DEVAPC_PERI_AO2_SYS0_D0_APC_0 (DEVAPC_PERI_AO2_BASE + 0x0000)
  171. /******************************************************************************/
  172. /* Device APC AO for PERI PAR AO */
  173. #define DEVAPC_PERI_PAR_AO_SYS0_D0_APC_0 (DEVAPC_PERI_PAR_AO_BASE + 0x0000)
  174. #define DEVAPC_PERI_PAR_AO_MAS_SEC_0 (DEVAPC_PERI_PAR_AO_BASE + 0x0A00)
  175. /******************************************************************************/
  176. /******************************************************************************
  177. * Variable DEFINITION
  178. ******************************************************************************/
  179. #define MOD_NO_IN_1_DEVAPC 16
  180. #endif /* DEVAPC_H */