sbconfig.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /*
  2. * Broadcom SiliconBackplane hardware register definitions.
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: sbconfig.h 654158 2016-08-11 09:30:01Z $
  30. */
  31. #ifndef _SBCONFIG_H
  32. #define _SBCONFIG_H
  33. /* cpp contortions to concatenate w/arg prescan */
  34. #ifndef PAD
  35. #define _PADLINE(line) pad ## line
  36. #define _XSTR(line) _PADLINE(line)
  37. #define PAD _XSTR(__LINE__)
  38. #endif // endif
  39. /* enumeration in SB is based on the premise that cores are contiguous in the
  40. * enumeration space.
  41. */
  42. #define SB_BUS_SIZE 0x10000 /**< Each bus gets 64Kbytes for cores */
  43. #define SB_BUS_BASE(sih, b) (SI_ENUM_BASE(sih) + (b) * SB_BUS_SIZE)
  44. #define SB_BUS_MAXCORES (SB_BUS_SIZE / SI_CORE_SIZE) /**< Max cores per bus */
  45. /*
  46. * Sonics Configuration Space Registers.
  47. */
  48. #define SBCONFIGOFF 0xf00 /**< core sbconfig regs are top 256bytes of regs */
  49. #define SBCONFIGSIZE 256 /**< sizeof (sbconfig_t) */
  50. #define SBIPSFLAG 0x08
  51. #define SBTPSFLAG 0x18
  52. #define SBTMERRLOGA 0x48 /**< sonics >= 2.3 */
  53. #define SBTMERRLOG 0x50 /**< sonics >= 2.3 */
  54. #define SBADMATCH3 0x60
  55. #define SBADMATCH2 0x68
  56. #define SBADMATCH1 0x70
  57. #define SBIMSTATE 0x90
  58. #define SBINTVEC 0x94
  59. #define SBTMSTATELOW 0x98
  60. #define SBTMSTATEHIGH 0x9c
  61. #define SBBWA0 0xa0
  62. #define SBIMCONFIGLOW 0xa8
  63. #define SBIMCONFIGHIGH 0xac
  64. #define SBADMATCH0 0xb0
  65. #define SBTMCONFIGLOW 0xb8
  66. #define SBTMCONFIGHIGH 0xbc
  67. #define SBBCONFIG 0xc0
  68. #define SBBSTATE 0xc8
  69. #define SBACTCNFG 0xd8
  70. #define SBFLAGST 0xe8
  71. #define SBIDLOW 0xf8
  72. #define SBIDHIGH 0xfc
  73. /* All the previous registers are above SBCONFIGOFF, but with Sonics 2.3, we have
  74. * a few registers *below* that line. I think it would be very confusing to try
  75. * and change the value of SBCONFIGOFF, so I'm definig them as absolute offsets here,
  76. */
  77. #define SBIMERRLOGA 0xea8
  78. #define SBIMERRLOG 0xeb0
  79. #define SBTMPORTCONNID0 0xed8
  80. #define SBTMPORTLOCK0 0xef8
  81. #if !defined(_LANGUAGE_ASSEMBLY) && !defined(__ASSEMBLY__)
  82. typedef volatile struct _sbconfig {
  83. uint32 PAD[2];
  84. uint32 sbipsflag; /**< initiator port ocp slave flag */
  85. uint32 PAD[3];
  86. uint32 sbtpsflag; /**< target port ocp slave flag */
  87. uint32 PAD[11];
  88. uint32 sbtmerrloga; /**< (sonics >= 2.3) */
  89. uint32 PAD;
  90. uint32 sbtmerrlog; /**< (sonics >= 2.3) */
  91. uint32 PAD[3];
  92. uint32 sbadmatch3; /**< address match3 */
  93. uint32 PAD;
  94. uint32 sbadmatch2; /**< address match2 */
  95. uint32 PAD;
  96. uint32 sbadmatch1; /**< address match1 */
  97. uint32 PAD[7];
  98. uint32 sbimstate; /**< initiator agent state */
  99. uint32 sbintvec; /**< interrupt mask */
  100. uint32 sbtmstatelow; /**< target state */
  101. uint32 sbtmstatehigh; /**< target state */
  102. uint32 sbbwa0; /**< bandwidth allocation table0 */
  103. uint32 PAD;
  104. uint32 sbimconfiglow; /**< initiator configuration */
  105. uint32 sbimconfighigh; /**< initiator configuration */
  106. uint32 sbadmatch0; /**< address match0 */
  107. uint32 PAD;
  108. uint32 sbtmconfiglow; /**< target configuration */
  109. uint32 sbtmconfighigh; /**< target configuration */
  110. uint32 sbbconfig; /**< broadcast configuration */
  111. uint32 PAD;
  112. uint32 sbbstate; /**< broadcast state */
  113. uint32 PAD[3];
  114. uint32 sbactcnfg; /**< activate configuration */
  115. uint32 PAD[3];
  116. uint32 sbflagst; /**< current sbflags */
  117. uint32 PAD[3];
  118. uint32 sbidlow; /**< identification */
  119. uint32 sbidhigh; /**< identification */
  120. } sbconfig_t;
  121. #endif /* !_LANGUAGE_ASSEMBLY && !__ASSEMBLY__ */
  122. /* sbipsflag */
  123. #define SBIPS_INT1_MASK 0x3f /**< which sbflags get routed to mips interrupt 1 */
  124. #define SBIPS_INT1_SHIFT 0
  125. #define SBIPS_INT2_MASK 0x3f00 /**< which sbflags get routed to mips interrupt 2 */
  126. #define SBIPS_INT2_SHIFT 8
  127. #define SBIPS_INT3_MASK 0x3f0000 /**< which sbflags get routed to mips interrupt 3 */
  128. #define SBIPS_INT3_SHIFT 16
  129. #define SBIPS_INT4_MASK 0x3f000000 /**< which sbflags get routed to mips interrupt 4 */
  130. #define SBIPS_INT4_SHIFT 24
  131. /* sbtpsflag */
  132. #define SBTPS_NUM0_MASK 0x3f /**< interrupt sbFlag # generated by this core */
  133. #define SBTPS_F0EN0 0x40 /**< interrupt is always sent on the backplane */
  134. /* sbtmerrlog */
  135. #define SBTMEL_CM 0x00000007 /**< command */
  136. #define SBTMEL_CI 0x0000ff00 /**< connection id */
  137. #define SBTMEL_EC 0x0f000000 /**< error code */
  138. #define SBTMEL_ME 0x80000000 /**< multiple error */
  139. /* sbimstate */
  140. #define SBIM_PC 0xf /**< pipecount */
  141. #define SBIM_AP_MASK 0x30 /**< arbitration policy */
  142. #define SBIM_AP_BOTH 0x00 /**< use both timeslaces and token */
  143. #define SBIM_AP_TS 0x10 /**< use timesliaces only */
  144. #define SBIM_AP_TK 0x20 /**< use token only */
  145. #define SBIM_AP_RSV 0x30 /**< reserved */
  146. #define SBIM_IBE 0x20000 /**< inbanderror */
  147. #define SBIM_TO 0x40000 /**< timeout */
  148. #define SBIM_BY 0x01800000 /**< busy (sonics >= 2.3) */
  149. #define SBIM_RJ 0x02000000 /**< reject (sonics >= 2.3) */
  150. /* sbtmstatelow */
  151. #define SBTML_RESET 0x0001 /**< reset */
  152. #define SBTML_REJ_MASK 0x0006 /**< reject field */
  153. #define SBTML_REJ 0x0002 /**< reject */
  154. #define SBTML_TMPREJ 0x0004 /**< temporary reject, for error recovery */
  155. #define SBTML_SICF_SHIFT 16 /**< Shift to locate the SI control flags in sbtml */
  156. /* sbtmstatehigh */
  157. #define SBTMH_SERR 0x0001 /**< serror */
  158. #define SBTMH_INT 0x0002 /**< interrupt */
  159. #define SBTMH_BUSY 0x0004 /**< busy */
  160. #define SBTMH_TO 0x0020 /**< timeout (sonics >= 2.3) */
  161. #define SBTMH_SISF_SHIFT 16 /**< Shift to locate the SI status flags in sbtmh */
  162. /* sbbwa0 */
  163. #define SBBWA_TAB0_MASK 0xffff /**< lookup table 0 */
  164. #define SBBWA_TAB1_MASK 0xffff /**< lookup table 1 */
  165. #define SBBWA_TAB1_SHIFT 16
  166. /* sbimconfiglow */
  167. #define SBIMCL_STO_MASK 0x7 /**< service timeout */
  168. #define SBIMCL_RTO_MASK 0x70 /**< request timeout */
  169. #define SBIMCL_RTO_SHIFT 4
  170. #define SBIMCL_CID_MASK 0xff0000 /**< connection id */
  171. #define SBIMCL_CID_SHIFT 16
  172. /* sbimconfighigh */
  173. #define SBIMCH_IEM_MASK 0xc /**< inband error mode */
  174. #define SBIMCH_TEM_MASK 0x30 /**< timeout error mode */
  175. #define SBIMCH_TEM_SHIFT 4
  176. #define SBIMCH_BEM_MASK 0xc0 /**< bus error mode */
  177. #define SBIMCH_BEM_SHIFT 6
  178. /* sbadmatch0 */
  179. #define SBAM_TYPE_MASK 0x3 /**< address type */
  180. #define SBAM_AD64 0x4 /**< reserved */
  181. #define SBAM_ADINT0_MASK 0xf8 /**< type0 size */
  182. #define SBAM_ADINT0_SHIFT 3
  183. #define SBAM_ADINT1_MASK 0x1f8 /**< type1 size */
  184. #define SBAM_ADINT1_SHIFT 3
  185. #define SBAM_ADINT2_MASK 0x1f8 /**< type2 size */
  186. #define SBAM_ADINT2_SHIFT 3
  187. #define SBAM_ADEN 0x400 /**< enable */
  188. #define SBAM_ADNEG 0x800 /**< negative decode */
  189. #define SBAM_BASE0_MASK 0xffffff00 /**< type0 base address */
  190. #define SBAM_BASE0_SHIFT 8
  191. #define SBAM_BASE1_MASK 0xfffff000 /**< type1 base address for the core */
  192. #define SBAM_BASE1_SHIFT 12
  193. #define SBAM_BASE2_MASK 0xffff0000 /**< type2 base address for the core */
  194. #define SBAM_BASE2_SHIFT 16
  195. /* sbtmconfiglow */
  196. #define SBTMCL_CD_MASK 0xff /**< clock divide */
  197. #define SBTMCL_CO_MASK 0xf800 /**< clock offset */
  198. #define SBTMCL_CO_SHIFT 11
  199. #define SBTMCL_IF_MASK 0xfc0000 /**< interrupt flags */
  200. #define SBTMCL_IF_SHIFT 18
  201. #define SBTMCL_IM_MASK 0x3000000 /**< interrupt mode */
  202. #define SBTMCL_IM_SHIFT 24
  203. /* sbtmconfighigh */
  204. #define SBTMCH_BM_MASK 0x3 /**< busy mode */
  205. #define SBTMCH_RM_MASK 0x3 /**< retry mode */
  206. #define SBTMCH_RM_SHIFT 2
  207. #define SBTMCH_SM_MASK 0x30 /**< stop mode */
  208. #define SBTMCH_SM_SHIFT 4
  209. #define SBTMCH_EM_MASK 0x300 /**< sb error mode */
  210. #define SBTMCH_EM_SHIFT 8
  211. #define SBTMCH_IM_MASK 0xc00 /**< int mode */
  212. #define SBTMCH_IM_SHIFT 10
  213. /* sbbconfig */
  214. #define SBBC_LAT_MASK 0x3 /**< sb latency */
  215. #define SBBC_MAX0_MASK 0xf0000 /**< maxccntr0 */
  216. #define SBBC_MAX0_SHIFT 16
  217. #define SBBC_MAX1_MASK 0xf00000 /**< maxccntr1 */
  218. #define SBBC_MAX1_SHIFT 20
  219. /* sbbstate */
  220. #define SBBS_SRD 0x1 /**< st reg disable */
  221. #define SBBS_HRD 0x2 /**< hold reg disable */
  222. /* sbidlow */
  223. #define SBIDL_CS_MASK 0x3 /**< config space */
  224. #define SBIDL_AR_MASK 0x38 /**< # address ranges supported */
  225. #define SBIDL_AR_SHIFT 3
  226. #define SBIDL_SYNCH 0x40 /**< sync */
  227. #define SBIDL_INIT 0x80 /**< initiator */
  228. #define SBIDL_MINLAT_MASK 0xf00 /**< minimum backplane latency */
  229. #define SBIDL_MINLAT_SHIFT 8
  230. #define SBIDL_MAXLAT 0xf000 /**< maximum backplane latency */
  231. #define SBIDL_MAXLAT_SHIFT 12
  232. #define SBIDL_FIRST 0x10000 /**< this initiator is first */
  233. #define SBIDL_CW_MASK 0xc0000 /**< cycle counter width */
  234. #define SBIDL_CW_SHIFT 18
  235. #define SBIDL_TP_MASK 0xf00000 /**< target ports */
  236. #define SBIDL_TP_SHIFT 20
  237. #define SBIDL_IP_MASK 0xf000000 /**< initiator ports */
  238. #define SBIDL_IP_SHIFT 24
  239. #define SBIDL_RV_MASK 0xf0000000 /**< sonics backplane revision code */
  240. #define SBIDL_RV_SHIFT 28
  241. #define SBIDL_RV_2_2 0x00000000 /**< version 2.2 or earlier */
  242. #define SBIDL_RV_2_3 0x10000000 /**< version 2.3 */
  243. /* sbidhigh */
  244. #define SBIDH_RC_MASK 0x000f /**< revision code */
  245. #define SBIDH_RCE_MASK 0x7000 /**< revision code extension field */
  246. #define SBIDH_RCE_SHIFT 8
  247. #define SBCOREREV(sbidh) \
  248. ((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK))
  249. #define SBIDH_CC_MASK 0x8ff0 /**< core code */
  250. #define SBIDH_CC_SHIFT 4
  251. #define SBIDH_VC_MASK 0xffff0000 /**< vendor code */
  252. #define SBIDH_VC_SHIFT 16
  253. #define SB_COMMIT 0xfd8 /**< update buffered registers value */
  254. /* vendor codes */
  255. #define SB_VEND_BCM 0x4243 /**< Broadcom's SB vendor code */
  256. #endif /* _SBCONFIG_H */