igc_defines.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018 Intel Corporation */
  3. #ifndef _IGC_DEFINES_H_
  4. #define _IGC_DEFINES_H_
  5. #include <linux/bitfield.h>
  6. /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
  7. #define REQ_TX_DESCRIPTOR_MULTIPLE 8
  8. #define REQ_RX_DESCRIPTOR_MULTIPLE 8
  9. #define IGC_CTRL_EXT_SDP2_DIR 0x00000400 /* SDP2 Data direction */
  10. #define IGC_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */
  11. #define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */
  12. /* Definitions for power management and wakeup registers */
  13. /* Wake Up Control */
  14. #define IGC_WUC_PME_EN 0x00000002 /* PME Enable */
  15. /* Wake Up Filter Control */
  16. #define IGC_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
  17. #define IGC_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
  18. #define IGC_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
  19. #define IGC_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */
  20. #define IGC_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
  21. #define IGC_WUFC_FLEX_HQ BIT(14) /* Flex Filters Host Queuing */
  22. #define IGC_WUFC_FLX0 BIT(16) /* Flexible Filter 0 Enable */
  23. #define IGC_WUFC_FLX1 BIT(17) /* Flexible Filter 1 Enable */
  24. #define IGC_WUFC_FLX2 BIT(18) /* Flexible Filter 2 Enable */
  25. #define IGC_WUFC_FLX3 BIT(19) /* Flexible Filter 3 Enable */
  26. #define IGC_WUFC_FLX4 BIT(20) /* Flexible Filter 4 Enable */
  27. #define IGC_WUFC_FLX5 BIT(21) /* Flexible Filter 5 Enable */
  28. #define IGC_WUFC_FLX6 BIT(22) /* Flexible Filter 6 Enable */
  29. #define IGC_WUFC_FLX7 BIT(23) /* Flexible Filter 7 Enable */
  30. #define IGC_WUFC_FILTER_MASK GENMASK(23, 14)
  31. #define IGC_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */
  32. /* Wake Up Status */
  33. #define IGC_WUS_EX 0x00000004 /* Directed Exact */
  34. #define IGC_WUS_ARPD 0x00000020 /* Directed ARP Request */
  35. #define IGC_WUS_IPV4 0x00000040 /* Directed IPv4 */
  36. #define IGC_WUS_IPV6 0x00000080 /* Directed IPv6 */
  37. #define IGC_WUS_NSD 0x00000400 /* Directed IPv6 Neighbor Solicitation */
  38. /* Packet types that are enabled for wake packet delivery */
  39. #define WAKE_PKT_WUS ( \
  40. IGC_WUS_EX | \
  41. IGC_WUS_ARPD | \
  42. IGC_WUS_IPV4 | \
  43. IGC_WUS_IPV6 | \
  44. IGC_WUS_NSD)
  45. /* Wake Up Packet Length */
  46. #define IGC_WUPL_MASK 0x00000FFF
  47. /* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */
  48. #define IGC_WUPM_BYTES 128
  49. /* Wakeup Filter Control Extended */
  50. #define IGC_WUFC_EXT_FLX8 BIT(8) /* Flexible Filter 8 Enable */
  51. #define IGC_WUFC_EXT_FLX9 BIT(9) /* Flexible Filter 9 Enable */
  52. #define IGC_WUFC_EXT_FLX10 BIT(10) /* Flexible Filter 10 Enable */
  53. #define IGC_WUFC_EXT_FLX11 BIT(11) /* Flexible Filter 11 Enable */
  54. #define IGC_WUFC_EXT_FLX12 BIT(12) /* Flexible Filter 12 Enable */
  55. #define IGC_WUFC_EXT_FLX13 BIT(13) /* Flexible Filter 13 Enable */
  56. #define IGC_WUFC_EXT_FLX14 BIT(14) /* Flexible Filter 14 Enable */
  57. #define IGC_WUFC_EXT_FLX15 BIT(15) /* Flexible Filter 15 Enable */
  58. #define IGC_WUFC_EXT_FLX16 BIT(16) /* Flexible Filter 16 Enable */
  59. #define IGC_WUFC_EXT_FLX17 BIT(17) /* Flexible Filter 17 Enable */
  60. #define IGC_WUFC_EXT_FLX18 BIT(18) /* Flexible Filter 18 Enable */
  61. #define IGC_WUFC_EXT_FLX19 BIT(19) /* Flexible Filter 19 Enable */
  62. #define IGC_WUFC_EXT_FLX20 BIT(20) /* Flexible Filter 20 Enable */
  63. #define IGC_WUFC_EXT_FLX21 BIT(21) /* Flexible Filter 21 Enable */
  64. #define IGC_WUFC_EXT_FLX22 BIT(22) /* Flexible Filter 22 Enable */
  65. #define IGC_WUFC_EXT_FLX23 BIT(23) /* Flexible Filter 23 Enable */
  66. #define IGC_WUFC_EXT_FLX24 BIT(24) /* Flexible Filter 24 Enable */
  67. #define IGC_WUFC_EXT_FLX25 BIT(25) /* Flexible Filter 25 Enable */
  68. #define IGC_WUFC_EXT_FLX26 BIT(26) /* Flexible Filter 26 Enable */
  69. #define IGC_WUFC_EXT_FLX27 BIT(27) /* Flexible Filter 27 Enable */
  70. #define IGC_WUFC_EXT_FLX28 BIT(28) /* Flexible Filter 28 Enable */
  71. #define IGC_WUFC_EXT_FLX29 BIT(29) /* Flexible Filter 29 Enable */
  72. #define IGC_WUFC_EXT_FLX30 BIT(30) /* Flexible Filter 30 Enable */
  73. #define IGC_WUFC_EXT_FLX31 BIT(31) /* Flexible Filter 31 Enable */
  74. #define IGC_WUFC_EXT_FILTER_MASK GENMASK(31, 8)
  75. /* Loop limit on how long we wait for auto-negotiation to complete */
  76. #define COPPER_LINK_UP_LIMIT 10
  77. #define PHY_AUTO_NEG_LIMIT 45
  78. /* Number of 100 microseconds we wait for PCI Express master disable */
  79. #define MASTER_DISABLE_TIMEOUT 800
  80. /*Blocks new Master requests */
  81. #define IGC_CTRL_GIO_MASTER_DISABLE 0x00000004
  82. /* Status of Master requests. */
  83. #define IGC_STATUS_GIO_MASTER_ENABLE 0x00080000
  84. /* Receive Address
  85. * Number of high/low register pairs in the RAR. The RAR (Receive Address
  86. * Registers) holds the directed and multicast addresses that we monitor.
  87. * Technically, we have 16 spots. However, we reserve one of these spots
  88. * (RAR[15]) for our directed address used by controllers with
  89. * manageability enabled, allowing us room for 15 multicast addresses.
  90. */
  91. #define IGC_RAH_RAH_MASK 0x0000FFFF
  92. #define IGC_RAH_ASEL_MASK 0x00030000
  93. #define IGC_RAH_ASEL_SRC_ADDR BIT(16)
  94. #define IGC_RAH_QSEL_MASK 0x000C0000
  95. #define IGC_RAH_QSEL_SHIFT 18
  96. #define IGC_RAH_QSEL_ENABLE BIT(28)
  97. #define IGC_RAH_AV 0x80000000 /* Receive descriptor valid */
  98. #define IGC_RAL_MAC_ADDR_LEN 4
  99. #define IGC_RAH_MAC_ADDR_LEN 2
  100. /* Error Codes */
  101. #define IGC_SUCCESS 0
  102. #define IGC_ERR_NVM 1
  103. #define IGC_ERR_PHY 2
  104. #define IGC_ERR_CONFIG 3
  105. #define IGC_ERR_PARAM 4
  106. #define IGC_ERR_MAC_INIT 5
  107. #define IGC_ERR_RESET 9
  108. #define IGC_ERR_MASTER_REQUESTS_PENDING 10
  109. #define IGC_ERR_BLK_PHY_RESET 12
  110. #define IGC_ERR_SWFW_SYNC 13
  111. /* Device Control */
  112. #define IGC_CTRL_RST 0x04000000 /* Global reset */
  113. #define IGC_CTRL_PHY_RST 0x80000000 /* PHY Reset */
  114. #define IGC_CTRL_SLU 0x00000040 /* Set link up (Force Link) */
  115. #define IGC_CTRL_FRCSPD 0x00000800 /* Force Speed */
  116. #define IGC_CTRL_FRCDPX 0x00001000 /* Force Duplex */
  117. #define IGC_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
  118. #define IGC_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */
  119. #define IGC_CTRL_TFCE 0x10000000 /* Transmit flow control enable */
  120. #define IGC_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */
  121. #define IGC_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */
  122. /* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */
  123. #define MAX_JUMBO_FRAME_SIZE 0x2600
  124. /* PBA constants */
  125. #define IGC_PBA_34K 0x0022
  126. /* SW Semaphore Register */
  127. #define IGC_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
  128. #define IGC_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
  129. /* SWFW_SYNC Definitions */
  130. #define IGC_SWFW_EEP_SM 0x1
  131. #define IGC_SWFW_PHY0_SM 0x2
  132. /* Autoneg Advertisement Register */
  133. #define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */
  134. #define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */
  135. #define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */
  136. #define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */
  137. #define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */
  138. #define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */
  139. /* Link Partner Ability Register (Base Page) */
  140. #define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */
  141. #define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */
  142. /* 1000BASE-T Control Register */
  143. #define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */
  144. #define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */
  145. /* 1000BASE-T Status Register */
  146. #define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */
  147. /* PHY GPY 211 registers */
  148. #define STANDARD_AN_REG_MASK 0x0007 /* MMD */
  149. #define MMD_DEVADDR_SHIFT 16 /* Shift MMD to higher bits */
  150. #define CR_2500T_FD_CAPS 0x0080 /* Advertise 2500T FD capability */
  151. /* NVM Control */
  152. /* Number of milliseconds for NVM auto read done after MAC reset. */
  153. #define AUTO_READ_DONE_TIMEOUT 10
  154. #define IGC_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */
  155. #define IGC_EECD_REQ 0x00000040 /* NVM Access Request */
  156. #define IGC_EECD_GNT 0x00000080 /* NVM Access Grant */
  157. /* NVM Addressing bits based on type 0=small, 1=large */
  158. #define IGC_EECD_ADDR_BITS 0x00000400
  159. #define IGC_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */
  160. #define IGC_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */
  161. #define IGC_EECD_SIZE_EX_SHIFT 11
  162. #define IGC_EECD_FLUPD_I225 0x00800000 /* Update FLASH */
  163. #define IGC_EECD_FLUDONE_I225 0x04000000 /* Update FLASH done*/
  164. #define IGC_EECD_FLASH_DETECTED_I225 0x00080000 /* FLASH detected */
  165. #define IGC_FLUDONE_ATTEMPTS 20000
  166. #define IGC_EERD_EEWR_MAX_COUNT 512 /* buffered EEPROM words rw */
  167. /* Offset to data in NVM read/write registers */
  168. #define IGC_NVM_RW_REG_DATA 16
  169. #define IGC_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */
  170. #define IGC_NVM_RW_REG_START 1 /* Start operation */
  171. #define IGC_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */
  172. #define IGC_NVM_POLL_READ 0 /* Flag for polling for read complete */
  173. #define IGC_NVM_DEV_STARTER 5 /* Dev_starter Version */
  174. /* NVM Word Offsets */
  175. #define NVM_CHECKSUM_REG 0x003F
  176. /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
  177. #define NVM_SUM 0xBABA
  178. #define NVM_WORD_SIZE_BASE_SHIFT 6
  179. /* Collision related configuration parameters */
  180. #define IGC_COLLISION_THRESHOLD 15
  181. #define IGC_CT_SHIFT 4
  182. #define IGC_COLLISION_DISTANCE 63
  183. #define IGC_COLD_SHIFT 12
  184. /* Device Status */
  185. #define IGC_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
  186. #define IGC_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
  187. #define IGC_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */
  188. #define IGC_STATUS_FUNC_SHIFT 2
  189. #define IGC_STATUS_TXOFF 0x00000010 /* transmission paused */
  190. #define IGC_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
  191. #define IGC_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
  192. #define IGC_STATUS_SPEED_2500 0x00400000 /* Speed 2.5Gb/s */
  193. #define SPEED_10 10
  194. #define SPEED_100 100
  195. #define SPEED_1000 1000
  196. #define SPEED_2500 2500
  197. #define HALF_DUPLEX 1
  198. #define FULL_DUPLEX 2
  199. /* 1Gbps and 2.5Gbps half duplex is not supported, nor spec-compliant. */
  200. #define ADVERTISE_10_HALF 0x0001
  201. #define ADVERTISE_10_FULL 0x0002
  202. #define ADVERTISE_100_HALF 0x0004
  203. #define ADVERTISE_100_FULL 0x0008
  204. #define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */
  205. #define ADVERTISE_1000_FULL 0x0020
  206. #define ADVERTISE_2500_HALF 0x0040 /* Not used, just FYI */
  207. #define ADVERTISE_2500_FULL 0x0080
  208. #define IGC_ALL_SPEED_DUPLEX_2500 ( \
  209. ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \
  210. ADVERTISE_100_FULL | ADVERTISE_1000_FULL | ADVERTISE_2500_FULL)
  211. #define AUTONEG_ADVERTISE_SPEED_DEFAULT_2500 IGC_ALL_SPEED_DUPLEX_2500
  212. /* Interrupt Cause Read */
  213. #define IGC_ICR_TXDW BIT(0) /* Transmit desc written back */
  214. #define IGC_ICR_TXQE BIT(1) /* Transmit Queue empty */
  215. #define IGC_ICR_LSC BIT(2) /* Link Status Change */
  216. #define IGC_ICR_RXSEQ BIT(3) /* Rx sequence error */
  217. #define IGC_ICR_RXDMT0 BIT(4) /* Rx desc min. threshold (0) */
  218. #define IGC_ICR_RXO BIT(6) /* Rx overrun */
  219. #define IGC_ICR_RXT0 BIT(7) /* Rx timer intr (ring 0) */
  220. #define IGC_ICR_TS BIT(19) /* Time Sync Interrupt */
  221. #define IGC_ICR_DRSTA BIT(30) /* Device Reset Asserted */
  222. /* If this bit asserted, the driver should claim the interrupt */
  223. #define IGC_ICR_INT_ASSERTED BIT(31)
  224. #define IGC_ICS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */
  225. #define IMS_ENABLE_MASK ( \
  226. IGC_IMS_RXT0 | \
  227. IGC_IMS_TXDW | \
  228. IGC_IMS_RXDMT0 | \
  229. IGC_IMS_RXSEQ | \
  230. IGC_IMS_LSC)
  231. /* Interrupt Mask Set */
  232. #define IGC_IMS_TXDW IGC_ICR_TXDW /* Tx desc written back */
  233. #define IGC_IMS_RXSEQ IGC_ICR_RXSEQ /* Rx sequence error */
  234. #define IGC_IMS_LSC IGC_ICR_LSC /* Link Status Change */
  235. #define IGC_IMS_DOUTSYNC IGC_ICR_DOUTSYNC /* NIC DMA out of sync */
  236. #define IGC_IMS_DRSTA IGC_ICR_DRSTA /* Device Reset Asserted */
  237. #define IGC_IMS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */
  238. #define IGC_IMS_RXDMT0 IGC_ICR_RXDMT0 /* Rx desc min. threshold */
  239. #define IGC_IMS_TS IGC_ICR_TS /* Time Sync Interrupt */
  240. #define IGC_QVECTOR_MASK 0x7FFC /* Q-vector mask */
  241. #define IGC_ITR_VAL_MASK 0x04 /* ITR value mask */
  242. /* Interrupt Cause Set */
  243. #define IGC_ICS_LSC IGC_ICR_LSC /* Link Status Change */
  244. #define IGC_ICS_RXDMT0 IGC_ICR_RXDMT0 /* rx desc min. threshold */
  245. #define IGC_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */
  246. #define IGC_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */
  247. #define IGC_IVAR_VALID 0x80
  248. #define IGC_GPIE_NSICR 0x00000001
  249. #define IGC_GPIE_MSIX_MODE 0x00000010
  250. #define IGC_GPIE_EIAME 0x40000000
  251. #define IGC_GPIE_PBA 0x80000000
  252. /* Receive Descriptor bit definitions */
  253. #define IGC_RXD_STAT_DD 0x01 /* Descriptor Done */
  254. /* Transmit Descriptor bit definitions */
  255. #define IGC_TXD_DTYP_D 0x00100000 /* Data Descriptor */
  256. #define IGC_TXD_DTYP_C 0x00000000 /* Context Descriptor */
  257. #define IGC_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */
  258. #define IGC_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */
  259. #define IGC_TXD_POPTS_SMD_MASK 0x3000 /* Indicates whether it's SMD-V or SMD-R */
  260. #define IGC_TXD_CMD_EOP 0x01000000 /* End of Packet */
  261. #define IGC_TXD_CMD_IC 0x04000000 /* Insert Checksum */
  262. #define IGC_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */
  263. #define IGC_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */
  264. #define IGC_TXD_STAT_DD 0x00000001 /* Descriptor Done */
  265. #define IGC_TXD_CMD_TCP 0x01000000 /* TCP packet */
  266. #define IGC_TXD_CMD_IP 0x02000000 /* IP packet */
  267. #define IGC_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */
  268. #define IGC_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */
  269. #define IGC_TXD_PTP2_TIMER_1 0x00000020
  270. /* IPSec Encrypt Enable */
  271. #define IGC_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */
  272. #define IGC_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */
  273. #define IGC_ADVTXD_TSN_CNTX_FIRST 0x00000080
  274. /* Transmit Control */
  275. #define IGC_TCTL_EN 0x00000002 /* enable Tx */
  276. #define IGC_TCTL_PSP 0x00000008 /* pad short packets */
  277. #define IGC_TCTL_CT 0x00000ff0 /* collision threshold */
  278. #define IGC_TCTL_COLD 0x003ff000 /* collision distance */
  279. #define IGC_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
  280. /* Flow Control Constants */
  281. #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
  282. #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
  283. #define FLOW_CONTROL_TYPE 0x8808
  284. /* Enable XON frame transmission */
  285. #define IGC_FCRTL_XONE 0x80000000
  286. /* Management Control */
  287. #define IGC_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
  288. #define IGC_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */
  289. /* Receive Control */
  290. #define IGC_RCTL_RST 0x00000001 /* Software reset */
  291. #define IGC_RCTL_EN 0x00000002 /* enable */
  292. #define IGC_RCTL_SBP 0x00000004 /* store bad packet */
  293. #define IGC_RCTL_UPE 0x00000008 /* unicast promisc enable */
  294. #define IGC_RCTL_MPE 0x00000010 /* multicast promisc enable */
  295. #define IGC_RCTL_LPE 0x00000020 /* long packet enable */
  296. #define IGC_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
  297. #define IGC_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
  298. #define IGC_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */
  299. #define IGC_RCTL_BAM 0x00008000 /* broadcast enable */
  300. /* Split Replication Receive Control */
  301. #define IGC_SRRCTL_TIMESTAMP 0x40000000
  302. #define IGC_SRRCTL_TIMER1SEL(timer) (((timer) & 0x3) << 14)
  303. #define IGC_SRRCTL_TIMER0SEL(timer) (((timer) & 0x3) << 17)
  304. /* Receive Descriptor bit definitions */
  305. #define IGC_RXD_STAT_SMD_TYPE_V 0x01 /* SMD-V Packet */
  306. #define IGC_RXD_STAT_SMD_TYPE_R 0x02 /* SMD-R Packet */
  307. #define IGC_RXD_STAT_EOP 0x02 /* End of Packet */
  308. #define IGC_RXD_STAT_IXSM 0x04 /* Ignore checksum */
  309. #define IGC_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */
  310. #define IGC_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */
  311. #define IGC_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */
  312. #define IGC_RXDEXT_STATERR_LB 0x00040000
  313. /* Advanced Receive Descriptor bit definitions */
  314. #define IGC_RXDADV_STAT_SMD_TYPE_MASK 0x06000
  315. #define IGC_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */
  316. #define IGC_RXDEXT_STATERR_L4E 0x20000000
  317. #define IGC_RXDEXT_STATERR_IPE 0x40000000
  318. #define IGC_RXDEXT_STATERR_RXE 0x80000000
  319. #define IGC_MRQC_ENABLE_RSS_MQ 0x00000002
  320. #define IGC_MRQC_RSS_FIELD_IPV4_TCP 0x00010000
  321. #define IGC_MRQC_RSS_FIELD_IPV4 0x00020000
  322. #define IGC_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000
  323. #define IGC_MRQC_RSS_FIELD_IPV6 0x00100000
  324. #define IGC_MRQC_RSS_FIELD_IPV6_TCP 0x00200000
  325. #define IGC_MRQC_RSS_FIELD_IPV4_UDP 0x00400000
  326. #define IGC_MRQC_RSS_FIELD_IPV6_UDP 0x00800000
  327. #define IGC_MRQC_DEFAULT_QUEUE_MASK GENMASK(5, 3)
  328. /* Header split receive */
  329. #define IGC_RFCTL_IPV6_EX_DIS 0x00010000
  330. #define IGC_RFCTL_LEF 0x00040000
  331. #define IGC_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */
  332. #define IGC_RCTL_MO_SHIFT 12 /* multicast offset shift */
  333. #define IGC_RCTL_CFIEN 0x00080000 /* canonical form enable */
  334. #define IGC_RCTL_DPF 0x00400000 /* discard pause frames */
  335. #define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */
  336. #define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
  337. /* Mask for RX packet buffer size */
  338. #define IGC_RXPBSIZE_EXP_MASK GENMASK(5, 0)
  339. #define IGC_BMC2OSPBSIZE_MASK GENMASK(11, 6)
  340. #define IGC_RXPBSIZE_BE_MASK GENMASK(17, 12)
  341. /* Mask for timestamp in RX buffer */
  342. #define IGC_RXPBS_CFG_TS_EN_MASK GENMASK(31, 31)
  343. /* High-priority RX packet buffer size (KB). Used for Express traffic when preemption is enabled */
  344. #define IGC_RXPBSIZE_EXP(x) FIELD_PREP(IGC_RXPBSIZE_EXP_MASK, (x))
  345. /* BMC to OS packet buffer size in KB */
  346. #define IGC_BMC2OSPBSIZE(x) FIELD_PREP(IGC_BMC2OSPBSIZE_MASK, (x))
  347. /* Low-priority RX packet buffer size (KB). Used for BE traffic when preemption is enabled */
  348. #define IGC_RXPBSIZE_BE(x) FIELD_PREP(IGC_RXPBSIZE_BE_MASK, (x))
  349. /* Enable RX packet buffer for timestamp descriptor, saving 16 bytes per packet if set */
  350. #define IGC_RXPBS_CFG_TS_EN FIELD_PREP(IGC_RXPBS_CFG_TS_EN_MASK, 1)
  351. /* Default value following I225/I226 SW User Manual Section 8.3.1 */
  352. #define IGC_RXPBSIZE_EXP_BMC_DEFAULT ( \
  353. IGC_RXPBSIZE_EXP(34) | IGC_BMC2OSPBSIZE(2))
  354. #define IGC_RXPBSIZE_EXP_BMC_BE_TSN ( \
  355. IGC_RXPBSIZE_EXP(15) | IGC_BMC2OSPBSIZE(2) | IGC_RXPBSIZE_BE(15))
  356. /* Mask for TX packet buffer size */
  357. #define IGC_TXPB0SIZE_MASK GENMASK(5, 0)
  358. #define IGC_TXPB1SIZE_MASK GENMASK(11, 6)
  359. #define IGC_TXPB2SIZE_MASK GENMASK(17, 12)
  360. #define IGC_TXPB3SIZE_MASK GENMASK(23, 18)
  361. /* Mask for OS to BMC packet buffer size */
  362. #define IGC_OS2BMCPBSIZE_MASK GENMASK(29, 24)
  363. /* TX Packet buffer size in KB */
  364. #define IGC_TXPB0SIZE(x) FIELD_PREP(IGC_TXPB0SIZE_MASK, (x))
  365. #define IGC_TXPB1SIZE(x) FIELD_PREP(IGC_TXPB1SIZE_MASK, (x))
  366. #define IGC_TXPB2SIZE(x) FIELD_PREP(IGC_TXPB2SIZE_MASK, (x))
  367. #define IGC_TXPB3SIZE(x) FIELD_PREP(IGC_TXPB3SIZE_MASK, (x))
  368. /* OS to BMC packet buffer size in KB */
  369. #define IGC_OS2BMCPBSIZE(x) FIELD_PREP(IGC_OS2BMCPBSIZE_MASK, (x))
  370. /* Default value following I225/I226 SW User Manual Section 8.3.2 */
  371. #define IGC_TXPBSIZE_DEFAULT ( \
  372. IGC_TXPB0SIZE(20) | IGC_TXPB1SIZE(0) | IGC_TXPB2SIZE(0) | \
  373. IGC_TXPB3SIZE(0) | IGC_OS2BMCPBSIZE(4))
  374. /* TSN value following I225/I226 SW User Manual Section 7.5.4 */
  375. #define IGC_TXPBSIZE_TSN ( \
  376. IGC_TXPB0SIZE(5) | IGC_TXPB1SIZE(5) | IGC_TXPB2SIZE(5) | \
  377. IGC_TXPB3SIZE(5) | IGC_OS2BMCPBSIZE(4))
  378. #define IGC_DTXMXPKTSZ_TSN 0x19 /* 1600 bytes of max TX DMA packet size */
  379. #define IGC_DTXMXPKTSZ_DEFAULT 0x98 /* 9728-byte Jumbo frames */
  380. /* Retry Buffer Control */
  381. #define IGC_RETX_CTL 0x041C
  382. #define IGC_RETX_CTL_WATERMARK_MASK 0xF
  383. #define IGC_RETX_CTL_QBVFULLTH_SHIFT 8 /* QBV Retry Buffer Full Threshold */
  384. #define IGC_RETX_CTL_QBVFULLEN 0x1000 /* Enable QBV Retry Buffer Full Threshold */
  385. /* Transmit Scheduling Latency */
  386. /* Latency between transmission scheduling (LaunchTime) and the time
  387. * the packet is transmitted to the network in nanosecond.
  388. */
  389. #define IGC_TXOFFSET_SPEED_10 0x000034BC
  390. #define IGC_TXOFFSET_SPEED_100 0x00000578
  391. #define IGC_TXOFFSET_SPEED_1000 0x0000012C
  392. #define IGC_TXOFFSET_SPEED_2500 0x00000578
  393. /* Time Sync Interrupt Causes */
  394. #define IGC_TSICR_SYS_WRAP BIT(0) /* SYSTIM Wrap around. */
  395. #define IGC_TSICR_TXTS BIT(1) /* Transmit Timestamp. */
  396. #define IGC_TSICR_TT0 BIT(3) /* Target Time 0 Trigger. */
  397. #define IGC_TSICR_TT1 BIT(4) /* Target Time 1 Trigger. */
  398. #define IGC_TSICR_AUTT0 BIT(5) /* Auxiliary Timestamp 0 Taken. */
  399. #define IGC_TSICR_AUTT1 BIT(6) /* Auxiliary Timestamp 1 Taken. */
  400. #define IGC_TSICR_INTERRUPTS IGC_TSICR_TXTS
  401. #define IGC_FTQF_VF_BP 0x00008000
  402. #define IGC_FTQF_1588_TIME_STAMP 0x08000000
  403. #define IGC_FTQF_MASK 0xF0000000
  404. #define IGC_FTQF_MASK_PROTO_BP 0x10000000
  405. /* Time Sync Receive Control bit definitions */
  406. #define IGC_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */
  407. #define IGC_TSYNCRXCTL_TYPE_L2_V2 0x00
  408. #define IGC_TSYNCRXCTL_TYPE_L4_V1 0x02
  409. #define IGC_TSYNCRXCTL_TYPE_L2_L4_V2 0x04
  410. #define IGC_TSYNCRXCTL_TYPE_ALL 0x08
  411. #define IGC_TSYNCRXCTL_TYPE_EVENT_V2 0x0A
  412. #define IGC_TSYNCRXCTL_ENABLED 0x00000010 /* enable Rx timestamping */
  413. #define IGC_TSYNCRXCTL_SYSCFI 0x00000020 /* Sys clock frequency */
  414. #define IGC_TSYNCRXCTL_RXSYNSIG 0x00000400 /* Sample RX tstamp in PHY sop */
  415. /* Time Sync Receive Configuration */
  416. #define IGC_TSYNCRXCFG_PTP_V1_CTRLT_MASK 0x000000FF
  417. #define IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE 0x00
  418. #define IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01
  419. /* Immediate Interrupt Receive */
  420. #define IGC_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */
  421. #define IGC_IMIR_PORT_BYPASS 0x20000 /* IMIR Port Bypass Bit */
  422. #define IGC_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */
  423. #define IGC_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */
  424. /* Immediate Interrupt Receive Extended */
  425. #define IGC_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */
  426. #define IGC_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */
  427. /* Time Sync Transmit Control bit definitions */
  428. #define IGC_TSYNCTXCTL_TXTT_0 0x00000001 /* Tx timestamp reg 0 valid */
  429. #define IGC_TSYNCTXCTL_TXTT_1 0x00000002 /* Tx timestamp reg 1 valid */
  430. #define IGC_TSYNCTXCTL_TXTT_2 0x00000004 /* Tx timestamp reg 2 valid */
  431. #define IGC_TSYNCTXCTL_TXTT_3 0x00000008 /* Tx timestamp reg 3 valid */
  432. #define IGC_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */
  433. #define IGC_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */
  434. #define IGC_TSYNCTXCTL_SYNC_COMP_ERR 0x20000000 /* sync err */
  435. #define IGC_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */
  436. #define IGC_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */
  437. #define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020 /* Sample TX tstamp in PHY sop */
  438. #define IGC_TSYNCTXCTL_TXTT_ANY ( \
  439. IGC_TSYNCTXCTL_TXTT_0 | IGC_TSYNCTXCTL_TXTT_1 | \
  440. IGC_TSYNCTXCTL_TXTT_2 | IGC_TSYNCTXCTL_TXTT_3)
  441. /* Timer selection bits */
  442. #define IGC_AUX_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for auxiliary time stamp */
  443. #define IGC_AUX_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for auxiliary time stamp */
  444. #define IGC_AUX_IO_TIMER_SEL_SYSTIM2 (2u << 30) /* Select SYSTIM2 for auxiliary time stamp */
  445. #define IGC_AUX_IO_TIMER_SEL_SYSTIM3 (3u << 30) /* Select SYSTIM3 for auxiliary time stamp */
  446. #define IGC_TT_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for target time stamp */
  447. #define IGC_TT_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for target time stamp */
  448. #define IGC_TT_IO_TIMER_SEL_SYSTIM2 (2u << 30) /* Select SYSTIM2 for target time stamp */
  449. #define IGC_TT_IO_TIMER_SEL_SYSTIM3 (3u << 30) /* Select SYSTIM3 for target time stamp */
  450. /* TSAUXC Configuration Bits */
  451. #define IGC_TSAUXC_EN_TT0 BIT(0) /* Enable target time 0. */
  452. #define IGC_TSAUXC_EN_TT1 BIT(1) /* Enable target time 1. */
  453. #define IGC_TSAUXC_EN_CLK0 BIT(2) /* Enable Configurable Frequency Clock 0. */
  454. #define IGC_TSAUXC_ST0 BIT(4) /* Start Clock 0 Toggle on Target Time 0. */
  455. #define IGC_TSAUXC_EN_CLK1 BIT(5) /* Enable Configurable Frequency Clock 1. */
  456. #define IGC_TSAUXC_ST1 BIT(7) /* Start Clock 1 Toggle on Target Time 1. */
  457. #define IGC_TSAUXC_EN_TS0 BIT(8) /* Enable hardware timestamp 0. */
  458. #define IGC_TSAUXC_AUTT0 BIT(9) /* Auxiliary Timestamp Taken. */
  459. #define IGC_TSAUXC_EN_TS1 BIT(10) /* Enable hardware timestamp 0. */
  460. #define IGC_TSAUXC_AUTT1 BIT(11) /* Auxiliary Timestamp Taken. */
  461. #define IGC_TSAUXC_PLSG BIT(17) /* Generate a pulse. */
  462. #define IGC_TSAUXC_DISABLE1 BIT(27) /* Disable SYSTIM0 Count Operation. */
  463. #define IGC_TSAUXC_DISABLE2 BIT(28) /* Disable SYSTIM1 Count Operation. */
  464. #define IGC_TSAUXC_DISABLE3 BIT(29) /* Disable SYSTIM2 Count Operation. */
  465. #define IGC_TSAUXC_DIS_TS_CLEAR BIT(30) /* Disable EN_TT0/1 auto clear. */
  466. #define IGC_TSAUXC_DISABLE0 BIT(31) /* Disable SYSTIM0 Count Operation. */
  467. /* SDP Configuration Bits */
  468. #define IGC_AUX0_SEL_SDP0 (0u << 0) /* Assign SDP0 to auxiliary time stamp 0. */
  469. #define IGC_AUX0_SEL_SDP1 (1u << 0) /* Assign SDP1 to auxiliary time stamp 0. */
  470. #define IGC_AUX0_SEL_SDP2 (2u << 0) /* Assign SDP2 to auxiliary time stamp 0. */
  471. #define IGC_AUX0_SEL_SDP3 (3u << 0) /* Assign SDP3 to auxiliary time stamp 0. */
  472. #define IGC_AUX0_TS_SDP_EN (1u << 2) /* Enable auxiliary time stamp trigger 0. */
  473. #define IGC_AUX1_SEL_SDP0 (0u << 3) /* Assign SDP0 to auxiliary time stamp 1. */
  474. #define IGC_AUX1_SEL_SDP1 (1u << 3) /* Assign SDP1 to auxiliary time stamp 1. */
  475. #define IGC_AUX1_SEL_SDP2 (2u << 3) /* Assign SDP2 to auxiliary time stamp 1. */
  476. #define IGC_AUX1_SEL_SDP3 (3u << 3) /* Assign SDP3 to auxiliary time stamp 1. */
  477. #define IGC_AUX1_TS_SDP_EN (1u << 5) /* Enable auxiliary time stamp trigger 1. */
  478. #define IGC_TS_SDP0_SEL_TT0 (0u << 6) /* Target time 0 is output on SDP0. */
  479. #define IGC_TS_SDP0_SEL_TT1 (1u << 6) /* Target time 1 is output on SDP0. */
  480. #define IGC_TS_SDP0_SEL_FC0 (2u << 6) /* Freq clock 0 is output on SDP0. */
  481. #define IGC_TS_SDP0_SEL_FC1 (3u << 6) /* Freq clock 1 is output on SDP0. */
  482. #define IGC_TS_SDP0_EN (1u << 8) /* SDP0 is assigned to Tsync. */
  483. #define IGC_TS_SDP1_SEL_TT0 (0u << 9) /* Target time 0 is output on SDP1. */
  484. #define IGC_TS_SDP1_SEL_TT1 (1u << 9) /* Target time 1 is output on SDP1. */
  485. #define IGC_TS_SDP1_SEL_FC0 (2u << 9) /* Freq clock 0 is output on SDP1. */
  486. #define IGC_TS_SDP1_SEL_FC1 (3u << 9) /* Freq clock 1 is output on SDP1. */
  487. #define IGC_TS_SDP1_EN (1u << 11) /* SDP1 is assigned to Tsync. */
  488. #define IGC_TS_SDP2_SEL_TT0 (0u << 12) /* Target time 0 is output on SDP2. */
  489. #define IGC_TS_SDP2_SEL_TT1 (1u << 12) /* Target time 1 is output on SDP2. */
  490. #define IGC_TS_SDP2_SEL_FC0 (2u << 12) /* Freq clock 0 is output on SDP2. */
  491. #define IGC_TS_SDP2_SEL_FC1 (3u << 12) /* Freq clock 1 is output on SDP2. */
  492. #define IGC_TS_SDP2_EN (1u << 14) /* SDP2 is assigned to Tsync. */
  493. #define IGC_TS_SDP3_SEL_TT0 (0u << 15) /* Target time 0 is output on SDP3. */
  494. #define IGC_TS_SDP3_SEL_TT1 (1u << 15) /* Target time 1 is output on SDP3. */
  495. #define IGC_TS_SDP3_SEL_FC0 (2u << 15) /* Freq clock 0 is output on SDP3. */
  496. #define IGC_TS_SDP3_SEL_FC1 (3u << 15) /* Freq clock 1 is output on SDP3. */
  497. #define IGC_TS_SDP3_EN (1u << 17) /* SDP3 is assigned to Tsync. */
  498. /* Transmit Scheduling */
  499. #define IGC_TQAVCTRL_TRANSMIT_MODE_TSN 0x00000001
  500. #define IGC_TQAVCTRL_PREEMPT_ENA 0x00000002
  501. #define IGC_TQAVCTRL_ENHANCED_QAV 0x00000008
  502. #define IGC_TQAVCTRL_FUTSCDDIS 0x00000080
  503. #define IGC_TQAVCTRL_MIN_FRAG_MASK 0x0000C000
  504. #define IGC_TXQCTL_QUEUE_MODE_LAUNCHT 0x00000001
  505. #define IGC_TXQCTL_STRICT_CYCLE 0x00000002
  506. #define IGC_TXQCTL_STRICT_END 0x00000004
  507. #define IGC_TXQCTL_PREEMPTIBLE 0x00000008
  508. #define IGC_TXQCTL_QAV_SEL_MASK 0x000000C0
  509. #define IGC_TXQCTL_QAV_SEL_CBS0 0x00000080
  510. #define IGC_TXQCTL_QAV_SEL_CBS1 0x000000C0
  511. #define IGC_TQAVCC_IDLESLOPE_MASK 0xFFFF
  512. #define IGC_TQAVCC_KEEP_CREDITS BIT(30)
  513. #define IGC_MAX_SR_QUEUES 2
  514. #define IGC_TXARB_TXQ_PRIO_0_MASK GENMASK(1, 0)
  515. #define IGC_TXARB_TXQ_PRIO_1_MASK GENMASK(3, 2)
  516. #define IGC_TXARB_TXQ_PRIO_2_MASK GENMASK(5, 4)
  517. #define IGC_TXARB_TXQ_PRIO_3_MASK GENMASK(7, 6)
  518. #define IGC_TXARB_TXQ_PRIO_0(x) FIELD_PREP(IGC_TXARB_TXQ_PRIO_0_MASK, (x))
  519. #define IGC_TXARB_TXQ_PRIO_1(x) FIELD_PREP(IGC_TXARB_TXQ_PRIO_1_MASK, (x))
  520. #define IGC_TXARB_TXQ_PRIO_2(x) FIELD_PREP(IGC_TXARB_TXQ_PRIO_2_MASK, (x))
  521. #define IGC_TXARB_TXQ_PRIO_3(x) FIELD_PREP(IGC_TXARB_TXQ_PRIO_3_MASK, (x))
  522. /* Receive Checksum Control */
  523. #define IGC_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */
  524. #define IGC_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
  525. /* PCIe PTM Control */
  526. #define IGC_PTM_CTRL_START_NOW BIT(29) /* Start PTM Now */
  527. #define IGC_PTM_CTRL_EN BIT(30) /* Enable PTM */
  528. #define IGC_PTM_CTRL_TRIG BIT(31) /* PTM Cycle trigger */
  529. #define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x3f) << 2)
  530. #define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8)
  531. /* A short cycle time of 1us theoretically should work, but appears to be too
  532. * short in practice.
  533. */
  534. #define IGC_PTM_SHORT_CYC_DEFAULT 4 /* Default short cycle interval */
  535. #define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */
  536. #define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */
  537. /* PCIe Digital Delay */
  538. #define IGC_PCIE_DIG_DELAY_DEFAULT 0x01440000
  539. /* PCIe PHY Delay */
  540. #define IGC_PCIE_PHY_DELAY_DEFAULT 0x40900000
  541. #define IGC_TIMADJ_ADJUST_METH 0x40000000
  542. /* PCIe PTM Status */
  543. #define IGC_PTM_STAT_VALID BIT(0) /* PTM Status */
  544. #define IGC_PTM_STAT_RET_ERR BIT(1) /* Root port timeout */
  545. #define IGC_PTM_STAT_BAD_PTM_RES BIT(2) /* PTM Response msg instead of PTM Response Data */
  546. #define IGC_PTM_STAT_T4M1_OVFL BIT(3) /* T4 minus T1 overflow */
  547. #define IGC_PTM_STAT_ADJUST_1ST BIT(4) /* 1588 timer adjusted during 1st PTM cycle */
  548. #define IGC_PTM_STAT_ADJUST_CYC BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */
  549. #define IGC_PTM_STAT_ALL GENMASK(5, 0) /* Used to clear all status */
  550. /* PCIe PTM Cycle Control */
  551. #define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec) ((msec) & 0x3ff) /* PTM Cycle Time (msec) */
  552. #define IGC_PTM_CYCLE_CTRL_AUTO_CYC_EN BIT(31) /* PTM Cycle Control */
  553. /* GPY211 - I225 defines */
  554. #define GPY_MMD_MASK 0xFFFF0000
  555. #define GPY_MMD_SHIFT 16
  556. #define GPY_REG_MASK 0x0000FFFF
  557. #define IGC_MMDAC_FUNC_DATA 0x4000 /* Data, no post increment */
  558. /* MAC definitions */
  559. #define IGC_FACTPS_MNGCG 0x20000000
  560. #define IGC_FWSM_MODE_MASK 0xE
  561. #define IGC_FWSM_MODE_SHIFT 1
  562. /* Management Control */
  563. #define IGC_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */
  564. #define IGC_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */
  565. /* PHY */
  566. #define PHY_REVISION_MASK 0xFFFFFFF0
  567. #define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */
  568. #define IGC_GEN_POLL_TIMEOUT 1920
  569. /* PHY Control Register */
  570. #define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */
  571. #define MII_CR_POWER_DOWN 0x0800 /* Power down */
  572. #define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */
  573. /* PHY Status Register */
  574. #define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */
  575. #define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */
  576. #define IGC_PHY_RST_COMP 0x0100 /* Internal PHY reset completion */
  577. /* PHY 1000 MII Register/Bit Definitions */
  578. /* PHY Registers defined by IEEE */
  579. #define PHY_CONTROL 0x00 /* Control Register */
  580. #define PHY_STATUS 0x01 /* Status Register */
  581. #define PHY_ID1 0x02 /* Phy Id Reg (word 1) */
  582. #define PHY_ID2 0x03 /* Phy Id Reg (word 2) */
  583. #define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */
  584. #define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */
  585. #define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */
  586. #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
  587. /* MDI Control */
  588. #define IGC_MDIC_DATA_MASK 0x0000FFFF
  589. #define IGC_MDIC_REG_MASK 0x001F0000
  590. #define IGC_MDIC_REG_SHIFT 16
  591. #define IGC_MDIC_PHY_MASK 0x03E00000
  592. #define IGC_MDIC_PHY_SHIFT 21
  593. #define IGC_MDIC_OP_WRITE 0x04000000
  594. #define IGC_MDIC_OP_READ 0x08000000
  595. #define IGC_MDIC_READY 0x10000000
  596. #define IGC_MDIC_ERROR 0x40000000
  597. /* EEE Link Ability */
  598. #define IGC_EEE_2500BT_MASK BIT(0)
  599. #define IGC_EEE_1000BT_MASK BIT(2)
  600. #define IGC_EEE_100BT_MASK BIT(1)
  601. /* EEE Link-Partner Ability */
  602. #define IGC_LP_EEE_2500BT_MASK BIT(0)
  603. #define IGC_LP_EEE_1000BT_MASK BIT(2)
  604. #define IGC_LP_EEE_100BT_MASK BIT(1)
  605. #define IGC_N0_QUEUE -1
  606. #define IGC_MAX_MAC_HDR_LEN 127
  607. #define IGC_MAX_NETWORK_HDR_LEN 511
  608. #define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4))
  609. #define IGC_VLANPQF_VALID(_n) (0x1 << (3 + (_n) * 4))
  610. #define IGC_VLANPQF_QUEUE_MASK 0x03
  611. #define IGC_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
  612. #define IGC_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type:1=IPv4 */
  613. #define IGC_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet Type of TCP */
  614. #define IGC_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */
  615. /* Maximum size of the MTA register table in all supported adapters */
  616. #define MAX_MTA_REG 128
  617. /* EEE defines */
  618. #define IGC_IPCNFG_EEE_2_5G_AN 0x00000010 /* IPCNFG EEE Ena 2.5G AN */
  619. #define IGC_IPCNFG_EEE_1G_AN 0x00000008 /* IPCNFG EEE Ena 1G AN */
  620. #define IGC_IPCNFG_EEE_100M_AN 0x00000004 /* IPCNFG EEE Ena 100M AN */
  621. #define IGC_EEER_EEE_NEG 0x20000000 /* EEE capability nego */
  622. #define IGC_EEER_TX_LPI_EN 0x00010000 /* EEER Tx LPI Enable */
  623. #define IGC_EEER_RX_LPI_EN 0x00020000 /* EEER Rx LPI Enable */
  624. #define IGC_EEER_LPI_FC 0x00040000 /* EEER Ena on Flow Cntrl */
  625. #define IGC_EEE_SU_LPI_CLK_STP 0x00800000 /* EEE LPI Clock Stop */
  626. /* LTR defines */
  627. #define IGC_LTRC_EEEMS_EN 0x00000020 /* Enable EEE LTR max send */
  628. #define IGC_RXPBS_SIZE_I225_MASK 0x0000003F /* Rx packet buffer size */
  629. #define IGC_TW_SYSTEM_1000_MASK 0x000000FF
  630. /* Minimum time for 100BASE-T where no data will be transmit following move out
  631. * of EEE LPI Tx state
  632. */
  633. #define IGC_TW_SYSTEM_100_MASK 0x0000FF00
  634. #define IGC_TW_SYSTEM_100_SHIFT 8
  635. /* Reg val to set scale to 1024 nsec */
  636. #define IGC_LTRMINV_SCALE_1024 2
  637. /* Reg val to set scale to 32768 nsec */
  638. #define IGC_LTRMINV_SCALE_32768 3
  639. /* Reg val to set scale to 1024 nsec */
  640. #define IGC_LTRMAXV_SCALE_1024 2
  641. /* Reg val to set scale to 32768 nsec */
  642. #define IGC_LTRMAXV_SCALE_32768 3
  643. #define IGC_LTRMINV_LTRV_MASK 0x000003FF /* LTR minimum value */
  644. #define IGC_LTRMAXV_LTRV_MASK 0x000003FF /* LTR maximum value */
  645. #define IGC_LTRMINV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */
  646. #define IGC_LTRMINV_SCALE_SHIFT 10
  647. #define IGC_LTRMAXV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */
  648. #define IGC_LTRMAXV_SCALE_SHIFT 10
  649. #endif /* _IGC_DEFINES_H_ */