cn23xx_vf_regs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /**********************************************************************
  2. * Author: Cavium, Inc.
  3. *
  4. * Contact: support@cavium.com
  5. * Please include "LiquidIO" in the subject.
  6. *
  7. * Copyright (c) 2003-2016 Cavium, Inc.
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more details.
  17. ***********************************************************************/
  18. /*! \file cn23xx_vf_regs.h
  19. * \brief Host Driver: Register Address and Register Mask values for
  20. * Octeon CN23XX vf functions.
  21. */
  22. #ifndef __CN23XX_VF_REGS_H__
  23. #define __CN23XX_VF_REGS_H__
  24. #define CN23XX_CONFIG_XPANSION_BAR 0x38
  25. #define CN23XX_CONFIG_PCIE_CAP 0x70
  26. #define CN23XX_CONFIG_PCIE_DEVCAP 0x74
  27. #define CN23XX_CONFIG_PCIE_DEVCTL 0x78
  28. #define CN23XX_CONFIG_PCIE_LINKCAP 0x7C
  29. #define CN23XX_CONFIG_PCIE_LINKCTL 0x80
  30. #define CN23XX_CONFIG_PCIE_SLOTCAP 0x84
  31. #define CN23XX_CONFIG_PCIE_SLOTCTL 0x88
  32. #define CN23XX_CONFIG_PCIE_FLTMSK 0x720
  33. /* The input jabber is used to determine the TSO max size.
  34. * Due to H/W limitation, this need to be reduced to 60000
  35. * in order to to H/W TSO and avoid the WQE malfarmation
  36. * PKO_BUG_24989_WQE_LEN
  37. */
  38. #define CN23XX_DEFAULT_INPUT_JABBER 0xEA60 /*60000*/
  39. /* ############## BAR0 Registers ################ */
  40. /* Each Input Queue register is at a 16-byte Offset in BAR0 */
  41. #define CN23XX_VF_IQ_OFFSET 0x20000
  42. /*###################### REQUEST QUEUE #########################*/
  43. /* 64 registers for Input Queue Instr Count - SLI_PKT_IN_DONE0_CNTS */
  44. #define CN23XX_VF_SLI_IQ_INSTR_COUNT_START64 0x10040
  45. /* 64 registers for Input Queues Start Addr - SLI_PKT0_INSTR_BADDR */
  46. #define CN23XX_VF_SLI_IQ_BASE_ADDR_START64 0x10010
  47. /* 64 registers for Input Doorbell - SLI_PKT0_INSTR_BAOFF_DBELL */
  48. #define CN23XX_VF_SLI_IQ_DOORBELL_START 0x10020
  49. /* 64 registers for Input Queue size - SLI_PKT0_INSTR_FIFO_RSIZE */
  50. #define CN23XX_VF_SLI_IQ_SIZE_START 0x10030
  51. /* 64 registers (64-bit) - ES, RO, NS, Arbitration for Input Queue Data &
  52. * gather list fetches. SLI_PKT(0..63)_INPUT_CONTROL.
  53. */
  54. #define CN23XX_VF_SLI_IQ_PKT_CONTROL_START64 0x10000
  55. /*------- Request Queue Macros ---------*/
  56. #define CN23XX_VF_SLI_IQ_PKT_CONTROL64(iq) \
  57. (CN23XX_VF_SLI_IQ_PKT_CONTROL_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
  58. #define CN23XX_VF_SLI_IQ_BASE_ADDR64(iq) \
  59. (CN23XX_VF_SLI_IQ_BASE_ADDR_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
  60. #define CN23XX_VF_SLI_IQ_SIZE(iq) \
  61. (CN23XX_VF_SLI_IQ_SIZE_START + ((iq) * CN23XX_VF_IQ_OFFSET))
  62. #define CN23XX_VF_SLI_IQ_DOORBELL(iq) \
  63. (CN23XX_VF_SLI_IQ_DOORBELL_START + ((iq) * CN23XX_VF_IQ_OFFSET))
  64. #define CN23XX_VF_SLI_IQ_INSTR_COUNT64(iq) \
  65. (CN23XX_VF_SLI_IQ_INSTR_COUNT_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
  66. /*------------------ Masks ----------------*/
  67. #define CN23XX_PKT_INPUT_CTL_VF_NUM BIT_ULL(32)
  68. #define CN23XX_PKT_INPUT_CTL_MAC_NUM BIT(29)
  69. /* Number of instructions to be read in one MAC read request.
  70. * setting to Max value(4)
  71. */
  72. #define CN23XX_PKT_INPUT_CTL_RDSIZE (3 << 25)
  73. #define CN23XX_PKT_INPUT_CTL_IS_64B BIT(24)
  74. #define CN23XX_PKT_INPUT_CTL_RST BIT(23)
  75. #define CN23XX_PKT_INPUT_CTL_QUIET BIT(28)
  76. #define CN23XX_PKT_INPUT_CTL_RING_ENB BIT(22)
  77. #define CN23XX_PKT_INPUT_CTL_DATA_NS BIT(8)
  78. #define CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP BIT(6)
  79. #define CN23XX_PKT_INPUT_CTL_DATA_RO BIT(5)
  80. #define CN23XX_PKT_INPUT_CTL_USE_CSR BIT(4)
  81. #define CN23XX_PKT_INPUT_CTL_GATHER_NS BIT(3)
  82. #define CN23XX_PKT_INPUT_CTL_GATHER_ES_64B_SWAP (2)
  83. #define CN23XX_PKT_INPUT_CTL_GATHER_RO (1)
  84. /** Rings per Virtual Function [RO] **/
  85. #define CN23XX_PKT_INPUT_CTL_RPVF_MASK (0x3F)
  86. #define CN23XX_PKT_INPUT_CTL_RPVF_POS (48)
  87. /* These bits[47:44][RO] give the Physical function number info within the MAC*/
  88. #define CN23XX_PKT_INPUT_CTL_PF_NUM_MASK (0x7)
  89. #define CN23XX_PKT_INPUT_CTL_PF_NUM_POS (45)
  90. /** These bits[43:32][RO] give the virtual function number info within the PF*/
  91. #define CN23XX_PKT_INPUT_CTL_VF_NUM_MASK (0x1FFF)
  92. #define CN23XX_PKT_INPUT_CTL_VF_NUM_POS (32)
  93. #define CN23XX_PKT_INPUT_CTL_MAC_NUM_MASK (0x3)
  94. #define CN23XX_PKT_INPUT_CTL_MAC_NUM_POS (29)
  95. #define CN23XX_PKT_IN_DONE_WMARK_MASK (0xFFFFULL)
  96. #define CN23XX_PKT_IN_DONE_WMARK_BIT_POS (32)
  97. #define CN23XX_PKT_IN_DONE_CNT_MASK (0x00000000FFFFFFFFULL)
  98. #ifdef __LITTLE_ENDIAN_BITFIELD
  99. #define CN23XX_PKT_INPUT_CTL_MASK \
  100. (CN23XX_PKT_INPUT_CTL_RDSIZE \
  101. | CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP \
  102. | CN23XX_PKT_INPUT_CTL_USE_CSR)
  103. #else
  104. #define CN23XX_PKT_INPUT_CTL_MASK \
  105. (CN23XX_PKT_INPUT_CTL_RDSIZE \
  106. | CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP \
  107. | CN23XX_PKT_INPUT_CTL_USE_CSR \
  108. | CN23XX_PKT_INPUT_CTL_GATHER_ES_64B_SWAP)
  109. #endif
  110. /** Masks for SLI_PKT_IN_DONE(0..63)_CNTS Register */
  111. #define CN23XX_IN_DONE_CNTS_PI_INT BIT_ULL(62)
  112. #define CN23XX_IN_DONE_CNTS_CINT_ENB BIT_ULL(48)
  113. /*############################ OUTPUT QUEUE #########################*/
  114. /* 64 registers for Output queue control - SLI_PKT(0..63)_OUTPUT_CONTROL */
  115. #define CN23XX_VF_SLI_OQ_PKT_CONTROL_START 0x10050
  116. /* 64 registers for Output queue buffer and info size - SLI_PKT0_OUT_SIZE */
  117. #define CN23XX_VF_SLI_OQ0_BUFF_INFO_SIZE 0x10060
  118. /* 64 registers for Output Queue Start Addr - SLI_PKT0_SLIST_BADDR */
  119. #define CN23XX_VF_SLI_OQ_BASE_ADDR_START64 0x10070
  120. /* 64 registers for Output Queue Packet Credits - SLI_PKT0_SLIST_BAOFF_DBELL */
  121. #define CN23XX_VF_SLI_OQ_PKT_CREDITS_START 0x10080
  122. /* 64 registers for Output Queue size - SLI_PKT0_SLIST_FIFO_RSIZE */
  123. #define CN23XX_VF_SLI_OQ_SIZE_START 0x10090
  124. /* 64 registers for Output Queue Packet Count - SLI_PKT0_CNTS */
  125. #define CN23XX_VF_SLI_OQ_PKT_SENT_START 0x100B0
  126. /* 64 registers for Output Queue INT Levels - SLI_PKT0_INT_LEVELS */
  127. #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 0x100A0
  128. /* Each Output Queue register is at a 16-byte Offset in BAR0 */
  129. #define CN23XX_VF_OQ_OFFSET 0x20000
  130. /*------- Output Queue Macros ---------*/
  131. #define CN23XX_VF_SLI_OQ_PKT_CONTROL(oq) \
  132. (CN23XX_VF_SLI_OQ_PKT_CONTROL_START + ((oq) * CN23XX_VF_OQ_OFFSET))
  133. #define CN23XX_VF_SLI_OQ_BASE_ADDR64(oq) \
  134. (CN23XX_VF_SLI_OQ_BASE_ADDR_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
  135. #define CN23XX_VF_SLI_OQ_SIZE(oq) \
  136. (CN23XX_VF_SLI_OQ_SIZE_START + ((oq) * CN23XX_VF_OQ_OFFSET))
  137. #define CN23XX_VF_SLI_OQ_BUFF_INFO_SIZE(oq) \
  138. (CN23XX_VF_SLI_OQ0_BUFF_INFO_SIZE + ((oq) * CN23XX_VF_OQ_OFFSET))
  139. #define CN23XX_VF_SLI_OQ_PKTS_SENT(oq) \
  140. (CN23XX_VF_SLI_OQ_PKT_SENT_START + ((oq) * CN23XX_VF_OQ_OFFSET))
  141. #define CN23XX_VF_SLI_OQ_PKTS_CREDIT(oq) \
  142. (CN23XX_VF_SLI_OQ_PKT_CREDITS_START + ((oq) * CN23XX_VF_OQ_OFFSET))
  143. #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS(oq) \
  144. (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
  145. /* Macro's for accessing CNT and TIME separately from INT_LEVELS */
  146. #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_CNT(oq) \
  147. (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
  148. #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_TIME(oq) \
  149. (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 + \
  150. ((oq) * CN23XX_VF_OQ_OFFSET) + 4)
  151. /*------------------ Masks ----------------*/
  152. #define CN23XX_PKT_OUTPUT_CTL_TENB BIT(13)
  153. #define CN23XX_PKT_OUTPUT_CTL_CENB BIT(12)
  154. #define CN23XX_PKT_OUTPUT_CTL_IPTR BIT(11)
  155. #define CN23XX_PKT_OUTPUT_CTL_ES BIT(9)
  156. #define CN23XX_PKT_OUTPUT_CTL_NSR BIT(8)
  157. #define CN23XX_PKT_OUTPUT_CTL_ROR BIT(7)
  158. #define CN23XX_PKT_OUTPUT_CTL_DPTR BIT(6)
  159. #define CN23XX_PKT_OUTPUT_CTL_BMODE BIT(5)
  160. #define CN23XX_PKT_OUTPUT_CTL_ES_P BIT(3)
  161. #define CN23XX_PKT_OUTPUT_CTL_NSR_P BIT(2)
  162. #define CN23XX_PKT_OUTPUT_CTL_ROR_P BIT(1)
  163. #define CN23XX_PKT_OUTPUT_CTL_RING_ENB BIT(0)
  164. /*######################### Mailbox Reg Macros ########################*/
  165. #define CN23XX_VF_SLI_PKT_MBOX_INT_START 0x10210
  166. #define CN23XX_SLI_PKT_PF_VF_MBOX_SIG_START 0x10200
  167. #define CN23XX_SLI_MBOX_OFFSET 0x20000
  168. #define CN23XX_SLI_MBOX_SIG_IDX_OFFSET 0x8
  169. #define CN23XX_VF_SLI_PKT_MBOX_INT(q) \
  170. (CN23XX_VF_SLI_PKT_MBOX_INT_START + ((q) * CN23XX_SLI_MBOX_OFFSET))
  171. #define CN23XX_SLI_PKT_PF_VF_MBOX_SIG(q, idx) \
  172. (CN23XX_SLI_PKT_PF_VF_MBOX_SIG_START + \
  173. ((q) * CN23XX_SLI_MBOX_OFFSET + \
  174. (idx) * CN23XX_SLI_MBOX_SIG_IDX_OFFSET))
  175. /*######################## INTERRUPTS #########################*/
  176. #define CN23XX_VF_SLI_INT_SUM_START 0x100D0
  177. #define CN23XX_VF_SLI_INT_SUM(q) \
  178. (CN23XX_VF_SLI_INT_SUM_START + ((q) * CN23XX_VF_IQ_OFFSET))
  179. /*------------------ Interrupt Masks ----------------*/
  180. #define CN23XX_INTR_PO_INT BIT_ULL(63)
  181. #define CN23XX_INTR_PI_INT BIT_ULL(62)
  182. #define CN23XX_INTR_MBOX_INT BIT_ULL(61)
  183. #define CN23XX_INTR_RESEND BIT_ULL(60)
  184. #define CN23XX_INTR_CINT_ENB BIT_ULL(48)
  185. #define CN23XX_INTR_MBOX_ENB BIT(0)
  186. /*############################ MIO #########################*/
  187. #define CN23XX_MIO_PTP_CLOCK_CFG 0x0001070000000f00ULL
  188. #define CN23XX_MIO_PTP_CLOCK_LO 0x0001070000000f08ULL
  189. #define CN23XX_MIO_PTP_CLOCK_HI 0x0001070000000f10ULL
  190. #define CN23XX_MIO_PTP_CLOCK_COMP 0x0001070000000f18ULL
  191. #define CN23XX_MIO_PTP_TIMESTAMP 0x0001070000000f20ULL
  192. #define CN23XX_MIO_PTP_EVT_CNT 0x0001070000000f28ULL
  193. #define CN23XX_MIO_PTP_CKOUT_THRESH_LO 0x0001070000000f30ULL
  194. #define CN23XX_MIO_PTP_CKOUT_THRESH_HI 0x0001070000000f38ULL
  195. #define CN23XX_MIO_PTP_CKOUT_HI_INCR 0x0001070000000f40ULL
  196. #define CN23XX_MIO_PTP_CKOUT_LO_INCR 0x0001070000000f48ULL
  197. #define CN23XX_MIO_PTP_PPS_THRESH_LO 0x0001070000000f50ULL
  198. #define CN23XX_MIO_PTP_PPS_THRESH_HI 0x0001070000000f58ULL
  199. #define CN23XX_MIO_PTP_PPS_HI_INCR 0x0001070000000f60ULL
  200. #define CN23XX_MIO_PTP_PPS_LO_INCR 0x0001070000000f68ULL
  201. /*############################ RST #########################*/
  202. #define CN23XX_RST_BOOT 0x0001180006001600ULL
  203. /*######################## MSIX TABLE #########################*/
  204. #define CN23XX_MSIX_TABLE_ADDR_START 0x0
  205. #define CN23XX_MSIX_TABLE_DATA_START 0x8
  206. #define CN23XX_MSIX_TABLE_SIZE 0x10
  207. #define CN23XX_MSIX_TABLE_ENTRIES 0x41
  208. #define CN23XX_MSIX_ENTRY_VECTOR_CTL BIT_ULL(32)
  209. #define CN23XX_MSIX_TABLE_ADDR(idx) \
  210. (CN23XX_MSIX_TABLE_ADDR_START + ((idx) * CN23XX_MSIX_TABLE_SIZE))
  211. #define CN23XX_MSIX_TABLE_DATA(idx) \
  212. (CN23XX_MSIX_TABLE_DATA_START + ((idx) * CN23XX_MSIX_TABLE_SIZE))
  213. #endif