nic_reg.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Copyright (C) 2018 Marvell International Ltd.
  4. */
  5. #ifndef NIC_REG_H
  6. #define NIC_REG_H
  7. #define NIC_PF_REG_COUNT 29573
  8. #define NIC_VF_REG_COUNT 249
  9. /* Physical function register offsets */
  10. #define NIC_PF_CFG (0x0000)
  11. #define NIC_PF_STATUS (0x0010)
  12. #define NIC_PF_INTR_TIMER_CFG (0x0030)
  13. #define NIC_PF_BIST_STATUS (0x0040)
  14. #define NIC_PF_SOFT_RESET (0x0050)
  15. #define NIC_PF_TCP_TIMER (0x0060)
  16. #define NIC_PF_BP_CFG (0x0080)
  17. #define NIC_PF_RRM_CFG (0x0088)
  18. #define NIC_PF_CQM_CF (0x00A0)
  19. #define NIC_PF_CNM_CF (0x00A8)
  20. #define NIC_PF_CNM_STATUS (0x00B0)
  21. #define NIC_PF_CQ_AVG_CFG (0x00C0)
  22. #define NIC_PF_RRM_AVG_CFG (0x00C8)
  23. #define NIC_PF_INTF_0_1_SEND_CFG (0x0200)
  24. #define NIC_PF_INTF_0_1_BP_CFG (0x0208)
  25. #define NIC_PF_INTF_0_1_BP_DIS_0_1 (0x0210)
  26. #define NIC_PF_INTF_0_1_BP_SW_0_1 (0x0220)
  27. #define NIC_PF_RBDR_BP_STATE_0_3 (0x0240)
  28. #define NIC_PF_MAILBOX_INT (0x0410)
  29. #define NIC_PF_MAILBOX_INT_W1S (0x0430)
  30. #define NIC_PF_MAILBOX_ENA_W1C (0x0450)
  31. #define NIC_PF_MAILBOX_ENA_W1S (0x0470)
  32. #define NIC_PF_RX_ETYPE_0_7 (0x0500)
  33. #define NIC_PF_RX_CFG (0x05D0)
  34. #define NIC_PF_PKIND_0_15_CFG (0x0600)
  35. #define NIC_PF_ECC0_FLIP0 (0x1000)
  36. #define NIC_PF_ECC1_FLIP0 (0x1008)
  37. #define NIC_PF_ECC2_FLIP0 (0x1010)
  38. #define NIC_PF_ECC3_FLIP0 (0x1018)
  39. #define NIC_PF_ECC0_FLIP1 (0x1080)
  40. #define NIC_PF_ECC1_FLIP1 (0x1088)
  41. #define NIC_PF_ECC2_FLIP1 (0x1090)
  42. #define NIC_PF_ECC3_FLIP1 (0x1098)
  43. #define NIC_PF_ECC0_CDIS (0x1100)
  44. #define NIC_PF_ECC1_CDIS (0x1108)
  45. #define NIC_PF_ECC2_CDIS (0x1110)
  46. #define NIC_PF_ECC3_CDIS (0x1118)
  47. #define NIC_PF_BIST0_STATUS (0x1280)
  48. #define NIC_PF_BIST1_STATUS (0x1288)
  49. #define NIC_PF_BIST2_STATUS (0x1290)
  50. #define NIC_PF_BIST3_STATUS (0x1298)
  51. #define NIC_PF_ECC0_SBE_INT (0x2000)
  52. #define NIC_PF_ECC0_SBE_INT_W1S (0x2008)
  53. #define NIC_PF_ECC0_SBE_ENA_W1C (0x2010)
  54. #define NIC_PF_ECC0_SBE_ENA_W1S (0x2018)
  55. #define NIC_PF_ECC0_DBE_INT (0x2100)
  56. #define NIC_PF_ECC0_DBE_INT_W1S (0x2108)
  57. #define NIC_PF_ECC0_DBE_ENA_W1C (0x2110)
  58. #define NIC_PF_ECC0_DBE_ENA_W1S (0x2118)
  59. #define NIC_PF_ECC1_SBE_INT (0x2200)
  60. #define NIC_PF_ECC1_SBE_INT_W1S (0x2208)
  61. #define NIC_PF_ECC1_SBE_ENA_W1C (0x2210)
  62. #define NIC_PF_ECC1_SBE_ENA_W1S (0x2218)
  63. #define NIC_PF_ECC1_DBE_INT (0x2300)
  64. #define NIC_PF_ECC1_DBE_INT_W1S (0x2308)
  65. #define NIC_PF_ECC1_DBE_ENA_W1C (0x2310)
  66. #define NIC_PF_ECC1_DBE_ENA_W1S (0x2318)
  67. #define NIC_PF_ECC2_SBE_INT (0x2400)
  68. #define NIC_PF_ECC2_SBE_INT_W1S (0x2408)
  69. #define NIC_PF_ECC2_SBE_ENA_W1C (0x2410)
  70. #define NIC_PF_ECC2_SBE_ENA_W1S (0x2418)
  71. #define NIC_PF_ECC2_DBE_INT (0x2500)
  72. #define NIC_PF_ECC2_DBE_INT_W1S (0x2508)
  73. #define NIC_PF_ECC2_DBE_ENA_W1C (0x2510)
  74. #define NIC_PF_ECC2_DBE_ENA_W1S (0x2518)
  75. #define NIC_PF_ECC3_SBE_INT (0x2600)
  76. #define NIC_PF_ECC3_SBE_INT_W1S (0x2608)
  77. #define NIC_PF_ECC3_SBE_ENA_W1C (0x2610)
  78. #define NIC_PF_ECC3_SBE_ENA_W1S (0x2618)
  79. #define NIC_PF_ECC3_DBE_INT (0x2700)
  80. #define NIC_PF_ECC3_DBE_INT_W1S (0x2708)
  81. #define NIC_PF_ECC3_DBE_ENA_W1C (0x2710)
  82. #define NIC_PF_ECC3_DBE_ENA_W1S (0x2718)
  83. #define NIC_PF_CPI_0_2047_CFG (0x200000)
  84. #define NIC_PF_MPI_0_2047_CFG (0x210000)
  85. #define NIC_PF_RSSI_0_4097_RQ (0x220000)
  86. #define NIC_PF_LMAC_0_7_CFG (0x240000)
  87. #define NIC_PF_LMAC_0_7_SW_XOFF (0x242000)
  88. #define NIC_PF_LMAC_0_7_CREDIT (0x244000)
  89. #define NIC_PF_CHAN_0_255_TX_CFG (0x400000)
  90. #define NIC_PF_CHAN_0_255_RX_CFG (0x420000)
  91. #define NIC_PF_CHAN_0_255_SW_XOFF (0x440000)
  92. #define NIC_PF_CHAN_0_255_CREDIT (0x460000)
  93. #define NIC_PF_CHAN_0_255_RX_BP_CFG (0x480000)
  94. #define NIC_PF_SW_SYNC_RX (0x490000)
  95. #define NIC_PF_SW_SYNC_RX_DONE (0x490008)
  96. #define NIC_PF_TL2_0_63_CFG (0x500000)
  97. #define NIC_PF_TL2_0_63_PRI (0x520000)
  98. #define NIC_PF_TL2_LMAC (0x540000)
  99. #define NIC_PF_TL2_0_63_SH_STATUS (0x580000)
  100. #define NIC_PF_TL3A_0_63_CFG (0x5F0000)
  101. #define NIC_PF_TL3_0_255_CFG (0x600000)
  102. #define NIC_PF_TL3_0_255_CHAN (0x620000)
  103. #define NIC_PF_TL3_0_255_PIR (0x640000)
  104. #define NIC_PF_TL3_0_255_SW_XOFF (0x660000)
  105. #define NIC_PF_TL3_0_255_CNM_RATE (0x680000)
  106. #define NIC_PF_TL3_0_255_SH_STATUS (0x6A0000)
  107. #define NIC_PF_TL4A_0_255_CFG (0x6F0000)
  108. #define NIC_PF_TL4_0_1023_CFG (0x800000)
  109. #define NIC_PF_TL4_0_1023_SW_XOFF (0x820000)
  110. #define NIC_PF_TL4_0_1023_SH_STATUS (0x840000)
  111. #define NIC_PF_TL4A_0_1023_CNM_RATE (0x880000)
  112. #define NIC_PF_TL4A_0_1023_CNM_STATUS (0x8A0000)
  113. #define NIC_PF_VF_0_127_MAILBOX_0_1 (0x20002030)
  114. #define NIC_PF_VNIC_0_127_TX_STAT_0_4 (0x20004000)
  115. #define NIC_PF_VNIC_0_127_RX_STAT_0_13 (0x20004100)
  116. #define NIC_PF_QSET_0_127_LOCK_0_15 (0x20006000)
  117. #define NIC_PF_QSET_0_127_CFG (0x20010000)
  118. #define NIC_PF_QSET_0_127_RQ_0_7_CFG (0x20010400)
  119. #define NIC_PF_QSET_0_127_RQ_0_7_DROP_CFG (0x20010420)
  120. #define NIC_PF_QSET_0_127_RQ_0_7_BP_CFG (0x20010500)
  121. #define NIC_PF_QSET_0_127_RQ_0_7_STAT_0_1 (0x20010600)
  122. #define NIC_PF_QSET_0_127_SQ_0_7_CFG (0x20010C00)
  123. #define NIC_PF_QSET_0_127_SQ_0_7_CFG2 (0x20010C08)
  124. #define NIC_PF_QSET_0_127_SQ_0_7_STAT_0_1 (0x20010D00)
  125. #define NIC_PF_MSIX_VEC_0_18_ADDR (0x000000)
  126. #define NIC_PF_MSIX_VEC_0_CTL (0x000008)
  127. #define NIC_PF_MSIX_PBA_0 (0x0F0000)
  128. /* Virtual function register offsets */
  129. #define NIC_VNIC_CFG (0x000020)
  130. #define NIC_VF_PF_MAILBOX_0_1 (0x000130)
  131. #define NIC_VF_INT (0x000200)
  132. #define NIC_VF_INT_W1S (0x000220)
  133. #define NIC_VF_ENA_W1C (0x000240)
  134. #define NIC_VF_ENA_W1S (0x000260)
  135. #define NIC_VNIC_RSS_CFG (0x0020E0)
  136. #define NIC_VNIC_RSS_KEY_0_4 (0x002200)
  137. #define NIC_VNIC_TX_STAT_0_4 (0x004000)
  138. #define NIC_VNIC_RX_STAT_0_13 (0x004100)
  139. #define NIC_QSET_RQ_GEN_CFG (0x010010)
  140. #define NIC_QSET_CQ_0_7_CFG (0x010400)
  141. #define NIC_QSET_CQ_0_7_CFG2 (0x010408)
  142. #define NIC_QSET_CQ_0_7_THRESH (0x010410)
  143. #define NIC_QSET_CQ_0_7_BASE (0x010420)
  144. #define NIC_QSET_CQ_0_7_HEAD (0x010428)
  145. #define NIC_QSET_CQ_0_7_TAIL (0x010430)
  146. #define NIC_QSET_CQ_0_7_DOOR (0x010438)
  147. #define NIC_QSET_CQ_0_7_STATUS (0x010440)
  148. #define NIC_QSET_CQ_0_7_STATUS2 (0x010448)
  149. #define NIC_QSET_CQ_0_7_DEBUG (0x010450)
  150. #define NIC_QSET_RQ_0_7_CFG (0x010600)
  151. #define NIC_QSET_RQ_0_7_STAT_0_1 (0x010700)
  152. #define NIC_QSET_SQ_0_7_CFG (0x010800)
  153. #define NIC_QSET_SQ_0_7_THRESH (0x010810)
  154. #define NIC_QSET_SQ_0_7_BASE (0x010820)
  155. #define NIC_QSET_SQ_0_7_HEAD (0x010828)
  156. #define NIC_QSET_SQ_0_7_TAIL (0x010830)
  157. #define NIC_QSET_SQ_0_7_DOOR (0x010838)
  158. #define NIC_QSET_SQ_0_7_STATUS (0x010840)
  159. #define NIC_QSET_SQ_0_7_DEBUG (0x010848)
  160. #define NIC_QSET_SQ_0_7_CNM_CHG (0x010860)
  161. #define NIC_QSET_SQ_0_7_STAT_0_1 (0x010900)
  162. #define NIC_QSET_RBDR_0_1_CFG (0x010C00)
  163. #define NIC_QSET_RBDR_0_1_THRESH (0x010C10)
  164. #define NIC_QSET_RBDR_0_1_BASE (0x010C20)
  165. #define NIC_QSET_RBDR_0_1_HEAD (0x010C28)
  166. #define NIC_QSET_RBDR_0_1_TAIL (0x010C30)
  167. #define NIC_QSET_RBDR_0_1_DOOR (0x010C38)
  168. #define NIC_QSET_RBDR_0_1_STATUS0 (0x010C40)
  169. #define NIC_QSET_RBDR_0_1_STATUS1 (0x010C48)
  170. #define NIC_QSET_RBDR_0_1_PREFETCH_STATUS (0x010C50)
  171. #define NIC_VF_MSIX_VECTOR_0_19_ADDR (0x000000)
  172. #define NIC_VF_MSIX_VECTOR_0_19_CTL (0x000008)
  173. #define NIC_VF_MSIX_PBA (0x0F0000)
  174. /* Offsets within registers */
  175. #define NIC_MSIX_VEC_SHIFT 4
  176. #define NIC_Q_NUM_SHIFT 18
  177. #define NIC_QS_ID_SHIFT 21
  178. #define NIC_VF_NUM_SHIFT 21
  179. /* Port kind configuration register */
  180. struct pkind_cfg {
  181. #if defined(__BIG_ENDIAN_BITFIELD)
  182. uint64_t reserved_42_63:22;
  183. uint64_t hdr_sl:5; /* Header skip length */
  184. uint64_t rx_hdr:3; /* TNS Receive header present */
  185. uint64_t lenerr_en:1; /* L2 length error check enable */
  186. uint64_t reserved_32_32:1;
  187. uint64_t maxlen:16; /* Max frame size */
  188. uint64_t minlen:16; /* Min frame size */
  189. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  190. uint64_t minlen:16;
  191. uint64_t maxlen:16;
  192. uint64_t reserved_32_32:1;
  193. uint64_t lenerr_en:1;
  194. uint64_t rx_hdr:3;
  195. uint64_t hdr_sl:5;
  196. uint64_t reserved_42_63:22;
  197. #endif
  198. };
  199. static inline uint64_t BGXX_PF_BAR0(unsigned long param1)
  200. __attribute__ ((pure, always_inline));
  201. static inline uint64_t BGXX_PF_BAR0(unsigned long param1)
  202. {
  203. assert(param1 <= 1);
  204. return 0x87E0E0000000 + (param1 << 24);
  205. }
  206. #define BGXX_PF_BAR0_SIZE 0x400000
  207. #define NIC_PF_BAR0 0x843000000000
  208. #define NIC_PF_BAR0_SIZE 0x40000000
  209. static inline uint64_t NIC_VFX_BAR0(unsigned long param1)
  210. __attribute__ ((pure, always_inline));
  211. static inline uint64_t NIC_VFX_BAR0(unsigned long param1)
  212. {
  213. assert(param1 <= 127);
  214. return 0x8430A0000000 + (param1 << 21);
  215. }
  216. #define NIC_VFX_BAR0_SIZE 0x200000
  217. #endif /* NIC_REG_H */