igc_defines.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018 Intel Corporation */
  3. #ifndef _IGC_DEFINES_H_
  4. #define _IGC_DEFINES_H_
  5. #define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */
  6. /* PCI Bus Info */
  7. #define PCIE_DEVICE_CONTROL2 0x28
  8. #define PCIE_DEVICE_CONTROL2_16ms 0x0005
  9. /* Physical Func Reset Done Indication */
  10. #define IGC_CTRL_EXT_LINK_MODE_MASK 0x00C00000
  11. /* Number of 100 microseconds we wait for PCI Express master disable */
  12. #define MASTER_DISABLE_TIMEOUT 800
  13. /*Blocks new Master requests */
  14. #define IGC_CTRL_GIO_MASTER_DISABLE 0x00000004
  15. /* Status of Master requests. */
  16. #define IGC_STATUS_GIO_MASTER_ENABLE 0x00080000
  17. /* PCI Express Control */
  18. #define IGC_GCR_CMPL_TMOUT_MASK 0x0000F000
  19. #define IGC_GCR_CMPL_TMOUT_10ms 0x00001000
  20. #define IGC_GCR_CMPL_TMOUT_RESEND 0x00010000
  21. #define IGC_GCR_CAP_VER2 0x00040000
  22. /* Receive Address
  23. * Number of high/low register pairs in the RAR. The RAR (Receive Address
  24. * Registers) holds the directed and multicast addresses that we monitor.
  25. * Technically, we have 16 spots. However, we reserve one of these spots
  26. * (RAR[15]) for our directed address used by controllers with
  27. * manageability enabled, allowing us room for 15 multicast addresses.
  28. */
  29. #define IGC_RAH_AV 0x80000000 /* Receive descriptor valid */
  30. #define IGC_RAH_POOL_1 0x00040000
  31. /* Error Codes */
  32. #define IGC_SUCCESS 0
  33. #define IGC_ERR_NVM 1
  34. #define IGC_ERR_PHY 2
  35. #define IGC_ERR_CONFIG 3
  36. #define IGC_ERR_PARAM 4
  37. #define IGC_ERR_MAC_INIT 5
  38. #define IGC_ERR_RESET 9
  39. #define IGC_ERR_MASTER_REQUESTS_PENDING 10
  40. #define IGC_ERR_SWFW_SYNC 13
  41. /* Device Control */
  42. #define IGC_CTRL_RST 0x04000000 /* Global reset */
  43. /* PBA constants */
  44. #define IGC_PBA_34K 0x0022
  45. /* SW Semaphore Register */
  46. #define IGC_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
  47. #define IGC_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
  48. /* Number of milliseconds for NVM auto read done after MAC reset. */
  49. #define AUTO_READ_DONE_TIMEOUT 10
  50. #define IGC_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */
  51. /* Device Status */
  52. #define IGC_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
  53. #define IGC_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
  54. #define IGC_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */
  55. #define IGC_STATUS_FUNC_SHIFT 2
  56. #define IGC_STATUS_FUNC_1 0x00000004 /* Function 1 */
  57. #define IGC_STATUS_TXOFF 0x00000010 /* transmission paused */
  58. #define IGC_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
  59. #define IGC_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
  60. /* Interrupt Cause Read */
  61. #define IGC_ICR_TXDW BIT(0) /* Transmit desc written back */
  62. #define IGC_ICR_TXQE BIT(1) /* Transmit Queue empty */
  63. #define IGC_ICR_LSC BIT(2) /* Link Status Change */
  64. #define IGC_ICR_RXSEQ BIT(3) /* Rx sequence error */
  65. #define IGC_ICR_RXDMT0 BIT(4) /* Rx desc min. threshold (0) */
  66. #define IGC_ICR_RXO BIT(6) /* Rx overrun */
  67. #define IGC_ICR_RXT0 BIT(7) /* Rx timer intr (ring 0) */
  68. #define IGC_ICR_DRSTA BIT(30) /* Device Reset Asserted */
  69. /* If this bit asserted, the driver should claim the interrupt */
  70. #define IGC_ICR_INT_ASSERTED BIT(31)
  71. #define IGC_ICS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */
  72. #define IMS_ENABLE_MASK ( \
  73. IGC_IMS_RXT0 | \
  74. IGC_IMS_TXDW | \
  75. IGC_IMS_RXDMT0 | \
  76. IGC_IMS_RXSEQ | \
  77. IGC_IMS_LSC)
  78. /* Interrupt Mask Set */
  79. #define IGC_IMS_TXDW IGC_ICR_TXDW /* Tx desc written back */
  80. #define IGC_IMS_RXSEQ IGC_ICR_RXSEQ /* Rx sequence error */
  81. #define IGC_IMS_LSC IGC_ICR_LSC /* Link Status Change */
  82. #define IGC_IMS_DOUTSYNC IGC_ICR_DOUTSYNC /* NIC DMA out of sync */
  83. #define IGC_IMS_DRSTA IGC_ICR_DRSTA /* Device Reset Asserted */
  84. #define IGC_IMS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */
  85. #define IGC_IMS_RXDMT0 IGC_ICR_RXDMT0 /* Rx desc min. threshold */
  86. #define IGC_QVECTOR_MASK 0x7FFC /* Q-vector mask */
  87. #define IGC_ITR_VAL_MASK 0x04 /* ITR value mask */
  88. #define IGC_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */
  89. #define IGC_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */
  90. #define IGC_IVAR_VALID 0x80
  91. #define IGC_GPIE_NSICR 0x00000001
  92. #define IGC_GPIE_MSIX_MODE 0x00000010
  93. #define IGC_GPIE_EIAME 0x40000000
  94. #define IGC_GPIE_PBA 0x80000000
  95. /* Transmit Descriptor bit definitions */
  96. #define IGC_TXD_DTYP_D 0x00100000 /* Data Descriptor */
  97. #define IGC_TXD_DTYP_C 0x00000000 /* Context Descriptor */
  98. #define IGC_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */
  99. #define IGC_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */
  100. #define IGC_TXD_CMD_EOP 0x01000000 /* End of Packet */
  101. #define IGC_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
  102. #define IGC_TXD_CMD_IC 0x04000000 /* Insert Checksum */
  103. #define IGC_TXD_CMD_RS 0x08000000 /* Report Status */
  104. #define IGC_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */
  105. #define IGC_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */
  106. #define IGC_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */
  107. #define IGC_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */
  108. #define IGC_TXD_STAT_DD 0x00000001 /* Descriptor Done */
  109. #define IGC_TXD_STAT_EC 0x00000002 /* Excess Collisions */
  110. #define IGC_TXD_STAT_LC 0x00000004 /* Late Collisions */
  111. #define IGC_TXD_STAT_TU 0x00000008 /* Transmit underrun */
  112. #define IGC_TXD_CMD_TCP 0x01000000 /* TCP packet */
  113. #define IGC_TXD_CMD_IP 0x02000000 /* IP packet */
  114. #define IGC_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */
  115. #define IGC_TXD_STAT_TC 0x00000004 /* Tx Underrun */
  116. #define IGC_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */
  117. /* Transmit Control */
  118. #define IGC_TCTL_EN 0x00000002 /* enable Tx */
  119. #define IGC_TCTL_PSP 0x00000008 /* pad short packets */
  120. #define IGC_TCTL_CT 0x00000ff0 /* collision threshold */
  121. #define IGC_TCTL_COLD 0x003ff000 /* collision distance */
  122. #define IGC_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
  123. #define IGC_TCTL_MULR 0x10000000 /* Multiple request support */
  124. #define IGC_CT_SHIFT 4
  125. #define IGC_COLLISION_THRESHOLD 15
  126. /* Flow Control Constants */
  127. #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
  128. #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
  129. #define FLOW_CONTROL_TYPE 0x8808
  130. /* Enable XON frame transmission */
  131. #define IGC_FCRTL_XONE 0x80000000
  132. /* Management Control */
  133. #define IGC_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
  134. /* Receive Control */
  135. #define IGC_RCTL_RST 0x00000001 /* Software reset */
  136. #define IGC_RCTL_EN 0x00000002 /* enable */
  137. #define IGC_RCTL_SBP 0x00000004 /* store bad packet */
  138. #define IGC_RCTL_UPE 0x00000008 /* unicast promisc enable */
  139. #define IGC_RCTL_MPE 0x00000010 /* multicast promisc enable */
  140. #define IGC_RCTL_LPE 0x00000020 /* long packet enable */
  141. #define IGC_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
  142. #define IGC_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
  143. #define IGC_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */
  144. #define IGC_RCTL_BAM 0x00008000 /* broadcast enable */
  145. /* Receive Descriptor bit definitions */
  146. #define IGC_RXD_STAT_EOP 0x02 /* End of Packet */
  147. #define IGC_RXDEXT_STATERR_CE 0x01000000
  148. #define IGC_RXDEXT_STATERR_SE 0x02000000
  149. #define IGC_RXDEXT_STATERR_SEQ 0x04000000
  150. #define IGC_RXDEXT_STATERR_CXE 0x10000000
  151. #define IGC_RXDEXT_STATERR_TCPE 0x20000000
  152. #define IGC_RXDEXT_STATERR_IPE 0x40000000
  153. #define IGC_RXDEXT_STATERR_RXE 0x80000000
  154. /* Same mask, but for extended and packet split descriptors */
  155. #define IGC_RXDEXT_ERR_FRAME_ERR_MASK ( \
  156. IGC_RXDEXT_STATERR_CE | \
  157. IGC_RXDEXT_STATERR_SE | \
  158. IGC_RXDEXT_STATERR_SEQ | \
  159. IGC_RXDEXT_STATERR_CXE | \
  160. IGC_RXDEXT_STATERR_RXE)
  161. /* Header split receive */
  162. #define IGC_RFCTL_IPV6_EX_DIS 0x00010000
  163. #define IGC_RFCTL_LEF 0x00040000
  164. #define IGC_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */
  165. #define IGC_RCTL_MO_SHIFT 12 /* multicast offset shift */
  166. #define IGC_RCTL_CFIEN 0x00080000 /* canonical form enable */
  167. #define IGC_RCTL_DPF 0x00400000 /* discard pause frames */
  168. #define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */
  169. #define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
  170. #define I225_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */
  171. #define I225_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */
  172. #define IGC_N0_QUEUE -1
  173. #endif /* _IGC_DEFINES_H_ */