smi_reg.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. #ifndef _SMI_REG_H_
  2. #define _SMI_REG_H_
  3. #define SMI_COMMON_EXT_BASE (smi_reg_base_common_ext)
  4. #define LARB0_BASE (smi_reg_base_barb0)
  5. #define LARB1_BASE (smi_reg_base_barb1)
  6. #if defined(SMI_D2)
  7. #define LARB2_BASE (smi_reg_base_barb2)
  8. #elif defined(SMI_D1) || defined(SMI_D3) || defined(SMI_J)
  9. #define LARB2_BASE (smi_reg_base_barb2)
  10. #define LARB3_BASE (smi_reg_base_barb3)
  11. #endif
  12. /* ================================================= */
  13. /* common macro definitions */
  14. #define F_VAL(val, msb, lsb) (((val)&((1<<(msb-lsb+1))-1))<<lsb)
  15. #define F_MSK(msb, lsb) F_VAL(0xffffffff, msb, lsb)
  16. #define F_BIT_SET(bit) (1<<(bit))
  17. #define F_BIT_VAL(val, bit) ((!!(val))<<(bit))
  18. #define F_MSK_SHIFT(regval, msb, lsb) (((regval)&F_MSK(msb, lsb))>>lsb)
  19. /* ===================================================== */
  20. /* M4U register definition */
  21. /* ===================================================== */
  22. #define REG_MMUg_PT_BASE (0x0)
  23. #define F_MMUg_PT_VA_MSK 0xffff0000
  24. #define REG_MMUg_PT_BASE_SEC (0x4)
  25. #define F_MMUg_PT_VA_MSK_SEC 0xffff0000
  26. #define REG_MMU_PROG_EN 0x10
  27. #define F_MMU0_PROG_EN 1
  28. #define F_MMU1_PROG_EN 2
  29. #define REG_MMU_PROG_VA 0x14
  30. #define F_PROG_VA_LOCK_BIT (1<<11)
  31. #define F_PROG_VA_LAYER_BIT F_BIT_SET(9)
  32. #define F_PROG_VA_SIZE16X_BIT F_BIT_SET(8)
  33. #define F_PROG_VA_SECURE_BIT (1<<7)
  34. #define F_PROG_VA_MASK 0xfffff000
  35. #define REG_MMU_PROG_DSC 0x18
  36. #define REG_MMU_INVLD (0x20)
  37. #define F_MMU_INV_ALL 0x2
  38. #define F_MMU_INV_RANGE 0x1
  39. #define REG_MMU_INVLD_SA (0x24)
  40. #define REG_MMU_INVLD_EA (0x28)
  41. #define REG_MMU_INVLD_SEC (0x2c)
  42. #define F_MMU_INV_SEC_ALL 0x2
  43. #define F_MMU_INV_SEC_RANGE 0x1
  44. #define REG_MMU_INVLD_SA_SEC (0x30)
  45. #define REG_MMU_INVLD_EA_SEC (0x34)
  46. #define REG_INVLID_SEL (0x38)
  47. #define F_MMU_INV_EN_L1 (1<<0)
  48. #define F_MMU_INV_EN_L2 (1<<1)
  49. #define REG_INVLID_SEL_SEC (0x3c)
  50. #define F_MMU_INV_SEC_EN_L1 (1<<0)
  51. #define F_MMU_INV_SEC_EN_L2 (1<<1)
  52. #define F_MMU_INV_SEC_INV_DONE (1<<2)
  53. #define F_MMU_INV_SEC_INV_INT_SET (1<<3)
  54. #define F_MMU_INV_SEC_INV_INT_CLR (1<<4)
  55. #define F_MMU_INV_SEC_DBG (1<<5)
  56. #define REG_MMU_SEC_ABORT_INFO (0x40)
  57. #define REG_MMU_STANDARD_AXI_MODE (0x48)
  58. #define REG_MMU_PRIORITY (0x4c)
  59. #define REG_MMU_DCM_DIS (0x50)
  60. #define REG_MMU_WR_LEN (0x54)
  61. #define REG_MMU_HW_DEBUG (0x58)
  62. #define F_MMU_HW_DBG_L2_SCAN_ALL F_BIT_SET(1)
  63. #define F_MMU_HW_DBG_PFQ_BRDCST F_BIT_SET(0)
  64. #define REG_MMU_NON_BLOCKING_DIS 0x5C
  65. #define F_MMU_NON_BLOCK_DISABLE_BIT 1
  66. #define F_MMU_NON_BLOCK_HALF_ENTRY_BIT 2
  67. #define REG_MMU_LEGACY_4KB_MODE (0x60)
  68. #define REG_MMU_PFH_DIST0 0x80
  69. #define REG_MMU_PFH_DIST1 0x84
  70. #define REG_MMU_PFH_DIST2 0x88
  71. #define REG_MMU_PFH_DIST3 0x8c
  72. #define REG_MMU_PFH_DIST4 0x90
  73. #define REG_MMU_PFH_DIST5 0x94
  74. #define REG_MMU_PFH_DIST6 0x98
  75. #define REG_MMU_PFH_DIST(port) (0x80+(((port)>>3)<<2))
  76. #define F_MMU_PFH_DIST_VAL(port, val) ((val&0xf)<<(((port)&0x7)<<2))
  77. #define F_MMU_PFH_DIST_MASK(port) F_MMU_PFH_DIST_VAL((port), 0xf)
  78. #define REG_MMU_PFH_DIR0 0xF0
  79. #define REG_MMU_PFH_DIR1 0xF4
  80. #define REG_MMU_PFH_DIR(port) (((port) < 32) ? REG_MMU_PFH_DIR0 : REG_MMU_PFH_DIR1)
  81. #define F_MMU_PFH_DIR(port, val) ((!!(val))<<((port)&0x1f))
  82. #define REG_MMU_READ_ENTRY 0x100
  83. #define F_READ_ENTRY_EN F_BIT_SET(31)
  84. #define F_READ_ENTRY_MM1_MAIN F_BIT_SET(26)
  85. #define F_READ_ENTRY_MM0_MAIN F_BIT_SET(25)
  86. #define F_READ_ENTRY_MMx_MAIN(id) F_BIT_SET(25+id)
  87. #define F_READ_ENTRY_PFH F_BIT_SET(24)
  88. #define F_READ_ENTRY_MAIN_IDX(idx) F_VAL(idx, 21, 16)
  89. #define F_READ_ENTRY_PFH_IDX(idx) F_VAL(idx, 11, 5)
  90. /* #define F_READ_ENTRY_PFH_HI_LO(high) F_VAL(high, 4,4) */
  91. /* #define F_READ_ENTRY_PFH_PAGE(page) F_VAL(page, 3,2) */
  92. #define F_READ_ENTRY_PFH_PAGE_IDX(idx) F_VAL(idx, 4, 2)
  93. #define F_READ_ENTRY_PFH_WAY(way) F_VAL(way, 1, 0)
  94. #define REG_MMU_DES_RDATA 0x104
  95. #define REG_MMU_PFH_TAG_RDATA 0x108
  96. #define F_PFH_TAG_VA_GET(mmu, tag) (F_MSK_SHIFT(tag, 14, 4)<<(MMU_SET_MSB_OFFSET(mmu)+1))
  97. #define F_PFH_TAG_LAYER_BIT F_BIT_SET(3)
  98. #define F_PFH_TAG_16X_BIT F_BIT_SET(2) /* this bit is always 0 -- cost down. */
  99. #define F_PFH_TAG_SEC_BIT F_BIT_SET(1)
  100. #define F_PFH_TAG_AUTO_PFH F_BIT_SET(0)
  101. /* tag related macro */
  102. /* #define MMU0_SET_ORDER 7 */
  103. /* #define MMU1_SET_ORDER 6 */
  104. #define MMU_SET_ORDER(mmu) (7-(mmu))
  105. #define MMU_SET_NR(mmu) (1<<MMU_SET_ORDER(mmu))
  106. #define MMU_SET_LSB_OFFSET 15
  107. #define MMU_SET_MSB_OFFSET(mmu) (MMU_SET_LSB_OFFSET+MMU_SET_ORDER(mmu)-1)
  108. #define MMU_PFH_VA_TO_SET(mmu, va) F_MSK_SHIFT(va, MMU_SET_MSB_OFFSET(mmu), MMU_SET_LSB_OFFSET)
  109. #define MMU_PAGE_PER_LINE 8
  110. #define MMU_WAY_NR 4
  111. #define MMU_PFH_TOTAL_LINE(mmu) (MMU_SET_NR(mmu)*MMU_WAY_NR)
  112. #define REG_MMU_CTRL_REG 0x110
  113. #define F_MMU_CTRL_PFH_DIS(dis) F_BIT_VAL(dis, 0)
  114. #define F_MMU_CTRL_TLB_WALK_DIS(dis) F_BIT_VAL(dis, 1)
  115. #define F_MMU_CTRL_MONITOR_EN(en) F_BIT_VAL(en, 2)
  116. #define F_MMU_CTRL_MONITOR_CLR(clr) F_BIT_VAL(clr, 3)
  117. #define F_MMU_CTRL_PFH_RT_RPL_MODE(mod) F_BIT_VAL(mod, 4)
  118. #define F_MMU_CTRL_TF_PROT_VAL(prot) F_VAL(prot, 6, 5)
  119. #define F_MMU_CTRL_TF_PROT_MSK F_MSK(6, 5)
  120. #define F_MMU_CTRL_INT_HANG_en(en) F_BIT_VAL(en, 7)
  121. #define F_MMU_CTRL_COHERE_EN(en) F_BIT_VAL(en, 8)
  122. #define F_MMU_CTRL_IN_ORDER_WR(en) F_BIT_VAL(en, 9)
  123. #define F_MMU_CTRL_MAIN_TLB_SHARE_ALL(en) F_BIT_VAL(en, 10)
  124. #define REG_MMU_IVRP_PADDR 0x114
  125. #define F_MMU_IVRP_PA_SET(PA) (PA>>1)
  126. #define F_MMU_IVRP_8G_PA_SET(PA) ((PA>>1)|(1<<31))
  127. #define REG_MMU_INT_L2_CONTROL 0x120
  128. #define F_INT_L2_CLR_BIT (1<<12)
  129. #define F_INT_L2_MULTI_HIT_FAULT F_BIT_SET(0)
  130. #define F_INT_L2_TABLE_WALK_FAULT F_BIT_SET(1)
  131. #define F_INT_L2_PFH_DMA_FIFO_OVERFLOW F_BIT_SET(2)
  132. #define F_INT_L2_MISS_DMA_FIFO_OVERFLOW F_BIT_SET(3)
  133. #define F_INT_L2_INVALD_DONE F_BIT_SET(4)
  134. #define F_INT_L2_PFH_IN_OUT_FIFO_ERROR F_BIT_SET(5)
  135. #define F_INT_L2_MISS_FIFO_ERR F_BIT_SET(6)
  136. #define REG_MMU_INT_MAIN_CONTROL 0x124
  137. #define F_INT_TRANSLATION_FAULT(MMU) F_BIT_SET(0+(((MMU)<<1)|((MMU)<<2)))
  138. #define F_INT_MAIN_MULTI_HIT_FAULT(MMU) F_BIT_SET(1+(((MMU)<<1)|((MMU)<<2)))
  139. #define F_INT_INVALID_PHYSICAL_ADDRESS_FAULT(MMU) F_BIT_SET(2+(((MMU)<<1)|((MMU)<<2)))
  140. #define F_INT_ENTRY_REPLACEMENT_FAULT(MMU) F_BIT_SET(3+(((MMU)<<1)|((MMU)<<2)))
  141. #define F_INT_TLB_MISS_FAULT(MMU) F_BIT_SET(5+(((MMU)<<1)|((MMU)<<2)))
  142. #define F_INT_PFH_FIFO_ERR(MMU) F_BIT_SET(6+(((MMU)<<1)|((MMU)<<2)))
  143. #define F_INT_MAU(mmu, set) F_BIT_SET(14+(set)+(mmu<<2)) /* (14+(set)+(mmu*4)) */
  144. #define F_INT_MMU0_MAIN_MSK F_MSK(6, 0)
  145. #define F_INT_MMU1_MAIN_MSK F_MSK(13, 7)
  146. #define F_INT_MMU0_MAU_MSK F_MSK(17, 14)
  147. #define F_INT_MMU1_MAU_MSK F_MSK(21, 18)
  148. #define REG_MMU_CPE_DONE_SEC 0x128
  149. #define REG_MMU_CPE_DONE 0x12C
  150. #define REG_MMU_L2_FAULT_ST 0x130
  151. #define F_INT_L2_MISS_OUT_FIFO_ERROR F_BIT_SET(7)
  152. #define F_INT_L2_MISS_IN_FIFO_ERR F_BIT_SET(8)
  153. #define REG_MMU_MAIN_FAULT_ST 0x134
  154. #define REG_MMU_TBWALK_FAULT_VA 0x138
  155. #define F_MMU_TBWALK_FAULT_VA_MSK F_MSK(31, 12)
  156. #define F_MMU_TBWALK_FAULT_LAYER(regval) F_MSK_SHIFT(regval, 0, 0)
  157. #define REG_MMU_FAULT_VA(mmu) (0x13c+((mmu)<<3))
  158. #define F_MMU_FAULT_VA_MSK F_MSK(31, 12)
  159. #define F_MMU_FAULT_VA_WRITE_BIT F_BIT_SET(1)
  160. #define F_MMU_FAULT_VA_LAYER_BIT F_BIT_SET(0)
  161. #define REG_MMU_INVLD_PA(mmu) (0x140+((mmu)<<3))
  162. #define REG_MMU_INT_ID(mmu) (0x150+((mmu)<<2))
  163. #define REG_MMU_PF_MSCNT 0x160
  164. #define REG_MMU_PF_CNT 0x164
  165. #define REG_MMU_ACC_CNT(mmu) (0x168+(((mmu)<<3)|((mmu)<<2))) /* (0x168+((mmu)*12) */
  166. #define REG_MMU_MAIN_MSCNT(mmu) (0x16c+(((mmu)<<3)|((mmu)<<2)))
  167. #define REG_MMU_RS_PERF_CNT(mmu) (0x170+(((mmu)<<3)|((mmu)<<2)))
  168. #define MMU01_SQ_OFFSET (0x600-0x300)
  169. #define REG_MMU_SQ_START(mmu, x) (0x300+((x)<<3)+((mmu)*MMU01_SQ_OFFSET))
  170. #define F_SQ_VA_MASK F_MSK(31, 18)
  171. #define F_SQ_EN_BIT (1<<17)
  172. /* #define F_SQ_MULTI_ENTRY_VAL(x) (((x)&0xf)<<13) */
  173. #define REG_MMU_SQ_END(mmu, x) (0x304+((x)<<3)+((mmu)*MMU01_SQ_OFFSET))
  174. #define MMU_TOTAL_RS_NR 8
  175. #define REG_MMU_RSx_VA(mmu, x) (0x380+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
  176. #define F_MMU_RSx_VA_GET(regval) ((regval)&F_MSK(31, 12))
  177. #define F_MMU_RSx_VA_VALID(regval) F_MSK_SHIFT(regval, 11, 11)
  178. #define F_MMU_RSx_VA_PID(regval) F_MSK_SHIFT(regval, 9, 0)
  179. #define REG_MMU_RSx_PA(mmu, x) (0x384+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
  180. #define F_MMU_RSx_PA_GET(regval) ((regval)&F_MSK(31, 12))
  181. #define F_MMU_RSx_PA_VALID(regval) F_MSK_SHIFT(regval, 1, 0)
  182. #define REG_MMU_RSx_2ND_BASE(mmu, x) (0x388+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
  183. #define REG_MMU_RSx_ST(mmu, x) (0x38c+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
  184. #define F_MMU_RSx_ST_LID(regval) F_MSK_SHIFT(regval, 21, 20)
  185. #define F_MMU_RSx_ST_WRT(regval) F_MSK_SHIFT(regval, 12, 12)
  186. #define F_MMU_RSx_ST_OTHER(regval) F_MSK_SHIFT(regval, 8, 0)
  187. #define REG_MMU_MAIN_TAG(mmu, x) (0x500+((x)<<2)+((mmu)*MMU01_SQ_OFFSET))
  188. #define F_MAIN_TLB_VA_MSK F_MSK(31, 12)
  189. #define F_MAIN_TLB_LOCK_BIT (1<<11)
  190. #define F_MAIN_TLB_VALID_BIT (1<<10)
  191. #define F_MAIN_TLB_LAYER_BIT F_BIT_SET(9)
  192. #define F_MAIN_TLB_16X_BIT F_BIT_SET(8)
  193. #define F_MAIN_TLB_SEC_BIT F_BIT_SET(7)
  194. #define F_MAIN_TLB_INV_DES_BIT (1<<6)
  195. #define F_MAIN_TLB_SQ_EN_BIT (1<<5)
  196. #define F_MAIN_TLB_SQ_INDEX_MSK F_MSK(4, 1)
  197. #define F_MAIN_TLB_SQ_INDEX_GET(regval) F_MSK_SHIFT(regval, 4, 1)
  198. #define REG_MMU_MAU_START(mmu, mau) (0x900+((mau)*0x20)+((mmu)*0xa0))
  199. #define REG_MMU_MAU_START_BIT32(mmu, mau) (0x904+((mau)*0x20)+((mmu)*0xa0))
  200. #define REG_MMU_MAU_END(mmu, mau) (0x908+((mau)*0x20)+((mmu)*0xa0))
  201. #define REG_MMU_MAU_END_BIT32(mmu, mau) (0x90C+((mau)*0x20)+((mmu)*0xa0))
  202. #define REG_MMU_MAU_PORT_EN(mmu, mau) (0x910+((mau)*0x20)+((mmu)*0xa0))
  203. #define REG_MMU_MAU_ASSERT_ID(mmu, mau) (0x914+((mau)*0x20)+((mmu)*0xa0))
  204. #define REG_MMU_MAU_ADDR(mmu, mau) (0x918+((mau)*0x20)+((mmu)*0xa0))
  205. #define REG_MMU_MAU_ADDR_BIT32(mmu, mau) (0x91C+((mau)*0x20)+((mmu)*0xa0))
  206. #define REG_MMU_MAU_LARB_EN(mmu) (0x980+((mmu)*0xa0))
  207. #define F_MAU_LARB_VAL(mau, larb) ((larb)<<(mau*8))
  208. #define F_MAU_LARB_MSK(mau) (0xff<<(mau*8))
  209. #define REG_MMU_MAU_CLR(mmu) (0x984+((mmu)*0xa0))
  210. #define REG_MMU_MAU_IO(mmu) (0x988+((mmu)*0xa0))
  211. #define F_MAU_BIT_VAL(val, mau) F_BIT_VAL(val, mau)
  212. #define REG_MMU_MAU_RW(mmu) (0x98c+((mmu)*0xa0))
  213. #define REG_MMU_MAU_VA(mmu) (0x990+((mmu)*0xa0))
  214. #define REG_MMU_MAU_ASSERT_ST(mmu) (0x994+((mmu)*0xa0))
  215. #define REG_MMU_PFH_VLD_0 (0x180)
  216. #define REG_MMU_PFH_VLD(set, way) (REG_MMU_PFH_VLD_0+(((set)>>5)<<2)+((way)<<4)) /* +((set/32)*4)+(way*16) */
  217. #define F_MMU_PFH_VLD_BIT(set, way) F_BIT_SET((set)&0x1f) /* set%32 */
  218. /* ================================================================ */
  219. /* SMI larb */
  220. /* ================================================================ */
  221. #define SMI_ERROR_ADDR 0
  222. #if defined(SMI_D2)
  223. #define SMI_LARB_NR 3
  224. #define SMI_LARB0_PORT_NUM 8
  225. #define SMI_LARB1_PORT_NUM 7
  226. #define SMI_LARB2_PORT_NUM 13
  227. #elif defined(SMI_D1)
  228. #define SMI_LARB_NR 4
  229. #define SMI_LARB0_PORT_NUM 7
  230. #define SMI_LARB1_PORT_NUM 7
  231. #define SMI_LARB2_PORT_NUM 21
  232. #define SMI_LARB3_PORT_NUM 13
  233. #elif defined(SMI_D3)
  234. #define SMI_LARB_NR 4
  235. #define SMI_LARB0_PORT_NUM 10
  236. #define SMI_LARB1_PORT_NUM 7
  237. #define SMI_LARB2_PORT_NUM 21
  238. #define SMI_LARB3_PORT_NUM 13
  239. #elif defined(SMI_R)
  240. #define SMI_LARB_NR 2
  241. #define SMI_LARB0_PORT_NUM 7
  242. #define SMI_LARB1_PORT_NUM 11
  243. #elif defined(SMI_J)
  244. #define SMI_LARB_NR 4
  245. #define SMI_LARB0_PORT_NUM 11
  246. #define SMI_LARB1_PORT_NUM 7
  247. #define SMI_LARB2_PORT_NUM 21
  248. #define SMI_LARB3_PORT_NUM 13
  249. #endif
  250. #define SMI_LARB_STAT (0x0)
  251. #define SMI_LARB_IRQ_EN (0x4)
  252. #define SMI_LARB_IRQ_STATUS (0x8)
  253. #define SMI_LARB_SLP_CON (0xc)
  254. #define SMI_LARB_CON (0x10)
  255. #define SMI_LARB_CON_SET (0x14)
  256. #define SMI_LARB_CON_CLR (0x18)
  257. #define SMI_LARB_VC_PRI_MODE (0x20)
  258. #define SMI_LARB_CMD_THRT_CON (0x24)
  259. #define SMI_LARB_STARV_CON (0x28)
  260. #define SMI_LARB_EMI_CON (0x2C)
  261. #define SMI_LARB_SHARE_EN (0x30)
  262. #define SMI_LARB_BWL_EN (0x50)
  263. #define SMI_LARB_BWL_SOFT_EN (0x54)
  264. #define SMI_LARB_BWL_CON (0x58)
  265. #define SMI_LARB_OSTDL_EN (0x60)
  266. #define SMI_LARB_OSTDL_SOFT_EN (0x64)
  267. #define SMI_LARB_ULTRA_DIS (0x70)
  268. #define SMI_LARB_PREULTRA_DIS (0x74)
  269. #define SMI_LARB_FORCE_ULTRA (0x78)
  270. #define SMI_LARB_FORCE_PREULTRA (0x7c)
  271. #define SMI_LARB_MST_GRP_SEL_L (0x80)
  272. #define SMI_LARB_MST_GRP_SEL_H (0x84)
  273. #define SMI_LARB_INT_PATH_SEL (0x90)
  274. #define SMI_LARB_EXT_GREQ_VIO (0xa0)
  275. #define SMI_LARB_INT_GREQ_VIO (0xa4)
  276. #define SMI_LARB_OSTD_UDF_VIO (0xa8)
  277. #define SMI_LARB_OSTD_CRS_VIO (0xac)
  278. #define SMI_LARB_FIFO_STAT (0xb0)
  279. #define SMI_LARB_BUS_STAT (0xb4)
  280. #define SMI_LARB_CMD_THRT_STAT (0xb8)
  281. #define SMI_LARB_MON_REQ (0xbc)
  282. #define SMI_LARB_REQ_MASK (0xc0)
  283. #define SMI_LARB_REQ_DET (0xc4)
  284. #define SMI_LARB_EXT_ONGOING (0xc8)
  285. #define SMI_LARB_INT_ONGOING (0xcc)
  286. #define SMI_LARB_MISC_MON0 (0xd0)
  287. #define SMI_LARB_DBG_CON (0xf0)
  288. #define SMI_LARB_TST_MODE (0xf4)
  289. #define SMI_LARB_WRR_PORT (0x100)
  290. #define SMI_LARB_BWL_PORT (0x180)
  291. #define SMI_LARB_OSTDL_PORT (0x200)
  292. #define SMI_LARB_OSTD_MON_PORT (0x280)
  293. #define SMI_LARB_PINFO (0x300)
  294. #define SMI_LARB_MON_EN (0x400)
  295. #define SMI_LARB_MON_CLR (0x404)
  296. #define SMI_LARB_MON_PORT (0x408)
  297. #define SMI_LARB_MON_CON (0x40c)
  298. #define SMI_LARB_MON_ACT_CNT (0x410)
  299. #define SMI_LARB_MON_REQ_CNT (0x414)
  300. #define SMI_LARB_MON_BEAT_CNT (0x418)
  301. #define SMI_LARB_MON_BYTE_CNT (0x41c)
  302. #define SMI_LARB_MON_CP_CNT (0x420)
  303. #define SMI_LARB_MON_DP_CNT (0x424)
  304. #define SMI_LARB_MON_OSTD_CNT (0x428)
  305. #define SMI_LARB_MON_CP_MAX (0x430)
  306. #define SMI_LARB_MON_COS_MAX (0x434)
  307. #define SMI_LARB_MMU_EN (0xf00)
  308. #define F_SMI_MMU_EN(port, en) ((en)<<((port)))
  309. #define F_SMI_SEC_EN(port, en) ((en)<<((port)))
  310. #define REG_SMI_LARB_DOMN_OF_PORT(port) (((port) > 15) ? 0xf0c : 0xf08)
  311. #define F_SMI_DOMN(port, domain) (((domain)&0x3)<<((((port) > 15) ? (port-16) : port)<<1))
  312. /* ===============================================================
  313. * SMI COMMON
  314. * =============================================================== */
  315. #if defined(SMI_R)
  316. #define REG_OFFSET_SMI_L1LEN (0x200)
  317. #define REG_OFFSET_SMI_L1ARB0 (0x204)
  318. #define REG_OFFSET_SMI_L1ARB1 (0x208)
  319. #define REG_OFFSET_SMI_L1ARB2 (0x20C)
  320. #define REG_OFFSET_SMI_L1ARB3 (0x210)
  321. #define REG_OFFSET_SMI_L1ARB4 (0x214)
  322. #else
  323. #define REG_OFFSET_SMI_L1LEN (0x100)
  324. #define REG_OFFSET_SMI_L1ARB0 (0x104)
  325. #define REG_OFFSET_SMI_L1ARB1 (0x108)
  326. #define REG_OFFSET_SMI_L1ARB2 (0x10C)
  327. #define REG_OFFSET_SMI_L1ARB3 (0x110)
  328. #define REG_OFFSET_SMI_L1ARB4 (0x114)
  329. #endif
  330. /* ========================================================================= */
  331. /* peripheral system */
  332. /* ========================================================================= */
  333. #define REG_PERIAXI_BUS_CTL3 (0x208+0xf0003000)
  334. #define F_PERI_MMU_EN(port, en) ((en)<<((port)))
  335. static inline unsigned int M4U_ReadReg32(unsigned long M4uBase, unsigned long Offset)
  336. {
  337. unsigned int val;
  338. val = ioread32((void *)(M4uBase + Offset));
  339. return val;
  340. }
  341. static inline void M4U_WriteReg32(unsigned long M4uBase, unsigned long Offset, unsigned int Val)
  342. {
  343. /* unsigned int read; */
  344. iowrite32(Val, (void *)(M4uBase + Offset));
  345. /* make sure memory manipulation sequence is OK */
  346. mb();
  347. }
  348. static inline unsigned int COM_ReadReg32(unsigned long addr)
  349. {
  350. return ioread32((void *)addr);
  351. }
  352. static inline void COM_WriteReg32(unsigned long addr, unsigned int Val)
  353. {
  354. iowrite32(Val, (void *)addr);
  355. /* make sure memory manipulation sequence is OK */
  356. mb();
  357. }
  358. extern unsigned long smi_reg_base_common_ext;
  359. extern unsigned long smi_reg_base_barb0;
  360. extern unsigned long smi_reg_base_barb1;
  361. #if defined(SMI_D2)
  362. extern unsigned long smi_reg_base_barb2;
  363. #elif defined(SMI_D1) || defined(SMI_D3) || defined(SMI_J)
  364. extern unsigned long smi_reg_base_barb2;
  365. extern unsigned long smi_reg_base_barb3;
  366. #endif
  367. #endif