ixgb_hw.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. /*******************************************************************************
  2. Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc., 59
  13. Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. The full GNU General Public License is included in this distribution in the
  15. file called LICENSE.
  16. Contact Information:
  17. Linux NICS <linux.nics@intel.com>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #ifndef _IXGB_HW_H_
  21. #define _IXGB_HW_H_
  22. #include "ixgb_osdep.h"
  23. /* Enums */
  24. typedef enum {
  25. ixgb_mac_unknown = 0,
  26. ixgb_82597,
  27. ixgb_num_macs
  28. } ixgb_mac_type;
  29. /* Types of physical layer modules */
  30. typedef enum {
  31. ixgb_phy_type_unknown = 0,
  32. ixgb_phy_type_g6005, /* 850nm, MM fiber, XPAK transceiver */
  33. ixgb_phy_type_g6104, /* 1310nm, SM fiber, XPAK transceiver */
  34. ixgb_phy_type_txn17201, /* 850nm, MM fiber, XPAK transceiver */
  35. ixgb_phy_type_txn17401 /* 1310nm, SM fiber, XENPAK transceiver */
  36. } ixgb_phy_type;
  37. /* XPAK transceiver vendors, for the SR adapters */
  38. typedef enum {
  39. ixgb_xpak_vendor_intel,
  40. ixgb_xpak_vendor_infineon
  41. } ixgb_xpak_vendor;
  42. /* Media Types */
  43. typedef enum {
  44. ixgb_media_type_unknown = 0,
  45. ixgb_media_type_fiber = 1,
  46. ixgb_num_media_types
  47. } ixgb_media_type;
  48. /* Flow Control Settings */
  49. typedef enum {
  50. ixgb_fc_none = 0,
  51. ixgb_fc_rx_pause = 1,
  52. ixgb_fc_tx_pause = 2,
  53. ixgb_fc_full = 3,
  54. ixgb_fc_default = 0xFF
  55. } ixgb_fc_type;
  56. /* PCI bus types */
  57. typedef enum {
  58. ixgb_bus_type_unknown = 0,
  59. ixgb_bus_type_pci,
  60. ixgb_bus_type_pcix
  61. } ixgb_bus_type;
  62. /* PCI bus speeds */
  63. typedef enum {
  64. ixgb_bus_speed_unknown = 0,
  65. ixgb_bus_speed_33,
  66. ixgb_bus_speed_66,
  67. ixgb_bus_speed_100,
  68. ixgb_bus_speed_133,
  69. ixgb_bus_speed_reserved
  70. } ixgb_bus_speed;
  71. /* PCI bus widths */
  72. typedef enum {
  73. ixgb_bus_width_unknown = 0,
  74. ixgb_bus_width_32,
  75. ixgb_bus_width_64
  76. } ixgb_bus_width;
  77. #define IXGB_ETH_LENGTH_OF_ADDRESS 6
  78. #define IXGB_EEPROM_SIZE 64 /* Size in words */
  79. #define SPEED_10000 10000
  80. #define FULL_DUPLEX 2
  81. #define MIN_NUMBER_OF_DESCRIPTORS 8
  82. #define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8 /* 13 bits in RDLEN/TDLEN, 128B aligned */
  83. #define IXGB_DELAY_BEFORE_RESET 10 /* allow 10ms after idling rx/tx units */
  84. #define IXGB_DELAY_AFTER_RESET 1 /* allow 1ms after the reset */
  85. #define IXGB_DELAY_AFTER_EE_RESET 10 /* allow 10ms after the EEPROM reset */
  86. #define IXGB_DELAY_USECS_AFTER_LINK_RESET 13 /* allow 13 microseconds after the reset */
  87. /* NOTE: this is MICROSECONDS */
  88. #define MAX_RESET_ITERATIONS 8 /* number of iterations to get things right */
  89. /* General Registers */
  90. #define IXGB_CTRL0 0x00000 /* Device Control Register 0 - RW */
  91. #define IXGB_CTRL1 0x00008 /* Device Control Register 1 - RW */
  92. #define IXGB_STATUS 0x00010 /* Device Status Register - RO */
  93. #define IXGB_EECD 0x00018 /* EEPROM/Flash Control/Data Register - RW */
  94. #define IXGB_MFS 0x00020 /* Maximum Frame Size - RW */
  95. /* Interrupt */
  96. #define IXGB_ICR 0x00080 /* Interrupt Cause Read - R/clr */
  97. #define IXGB_ICS 0x00088 /* Interrupt Cause Set - RW */
  98. #define IXGB_IMS 0x00090 /* Interrupt Mask Set/Read - RW */
  99. #define IXGB_IMC 0x00098 /* Interrupt Mask Clear - WO */
  100. /* Receive */
  101. #define IXGB_RCTL 0x00100 /* RX Control - RW */
  102. #define IXGB_FCRTL 0x00108 /* Flow Control Receive Threshold Low - RW */
  103. #define IXGB_FCRTH 0x00110 /* Flow Control Receive Threshold High - RW */
  104. #define IXGB_RDBAL 0x00118 /* RX Descriptor Base Low - RW */
  105. #define IXGB_RDBAH 0x0011C /* RX Descriptor Base High - RW */
  106. #define IXGB_RDLEN 0x00120 /* RX Descriptor Length - RW */
  107. #define IXGB_RDH 0x00128 /* RX Descriptor Head - RW */
  108. #define IXGB_RDT 0x00130 /* RX Descriptor Tail - RW */
  109. #define IXGB_RDTR 0x00138 /* RX Delay Timer Ring - RW */
  110. #define IXGB_RXDCTL 0x00140 /* Receive Descriptor Control - RW */
  111. #define IXGB_RAIDC 0x00148 /* Receive Adaptive Interrupt Delay Control - RW */
  112. #define IXGB_RXCSUM 0x00158 /* Receive Checksum Control - RW */
  113. #define IXGB_RA 0x00180 /* Receive Address Array Base - RW */
  114. #define IXGB_RAL 0x00180 /* Receive Address Low [0:15] - RW */
  115. #define IXGB_RAH 0x00184 /* Receive Address High [0:15] - RW */
  116. #define IXGB_MTA 0x00200 /* Multicast Table Array [0:127] - RW */
  117. #define IXGB_VFTA 0x00400 /* VLAN Filter Table Array [0:127] - RW */
  118. #define IXGB_REQ_RX_DESCRIPTOR_MULTIPLE 8
  119. /* Transmit */
  120. #define IXGB_TCTL 0x00600 /* TX Control - RW */
  121. #define IXGB_TDBAL 0x00608 /* TX Descriptor Base Low - RW */
  122. #define IXGB_TDBAH 0x0060C /* TX Descriptor Base High - RW */
  123. #define IXGB_TDLEN 0x00610 /* TX Descriptor Length - RW */
  124. #define IXGB_TDH 0x00618 /* TX Descriptor Head - RW */
  125. #define IXGB_TDT 0x00620 /* TX Descriptor Tail - RW */
  126. #define IXGB_TIDV 0x00628 /* TX Interrupt Delay Value - RW */
  127. #define IXGB_TXDCTL 0x00630 /* Transmit Descriptor Control - RW */
  128. #define IXGB_TSPMT 0x00638 /* TCP Segmentation PAD & Min Threshold - RW */
  129. #define IXGB_PAP 0x00640 /* Pause and Pace - RW */
  130. #define IXGB_REQ_TX_DESCRIPTOR_MULTIPLE 8
  131. /* Physical */
  132. #define IXGB_PCSC1 0x00700 /* PCS Control 1 - RW */
  133. #define IXGB_PCSC2 0x00708 /* PCS Control 2 - RW */
  134. #define IXGB_PCSS1 0x00710 /* PCS Status 1 - RO */
  135. #define IXGB_PCSS2 0x00718 /* PCS Status 2 - RO */
  136. #define IXGB_XPCSS 0x00720 /* 10GBASE-X PCS Status (or XGXS Lane Status) - RO */
  137. #define IXGB_UCCR 0x00728 /* Unilink Circuit Control Register */
  138. #define IXGB_XPCSTC 0x00730 /* 10GBASE-X PCS Test Control */
  139. #define IXGB_MACA 0x00738 /* MDI Autoscan Command and Address - RW */
  140. #define IXGB_APAE 0x00740 /* Autoscan PHY Address Enable - RW */
  141. #define IXGB_ARD 0x00748 /* Autoscan Read Data - RO */
  142. #define IXGB_AIS 0x00750 /* Autoscan Interrupt Status - RO */
  143. #define IXGB_MSCA 0x00758 /* MDI Single Command and Address - RW */
  144. #define IXGB_MSRWD 0x00760 /* MDI Single Read and Write Data - RW, RO */
  145. /* Wake-up */
  146. #define IXGB_WUFC 0x00808 /* Wake Up Filter Control - RW */
  147. #define IXGB_WUS 0x00810 /* Wake Up Status - RO */
  148. #define IXGB_FFLT 0x01000 /* Flexible Filter Length Table - RW */
  149. #define IXGB_FFMT 0x01020 /* Flexible Filter Mask Table - RW */
  150. #define IXGB_FTVT 0x01420 /* Flexible Filter Value Table - RW */
  151. /* Statistics */
  152. #define IXGB_TPRL 0x02000 /* Total Packets Received (Low) */
  153. #define IXGB_TPRH 0x02004 /* Total Packets Received (High) */
  154. #define IXGB_GPRCL 0x02008 /* Good Packets Received Count (Low) */
  155. #define IXGB_GPRCH 0x0200C /* Good Packets Received Count (High) */
  156. #define IXGB_BPRCL 0x02010 /* Broadcast Packets Received Count (Low) */
  157. #define IXGB_BPRCH 0x02014 /* Broadcast Packets Received Count (High) */
  158. #define IXGB_MPRCL 0x02018 /* Multicast Packets Received Count (Low) */
  159. #define IXGB_MPRCH 0x0201C /* Multicast Packets Received Count (High) */
  160. #define IXGB_UPRCL 0x02020 /* Unicast Packets Received Count (Low) */
  161. #define IXGB_UPRCH 0x02024 /* Unicast Packets Received Count (High) */
  162. #define IXGB_VPRCL 0x02028 /* VLAN Packets Received Count (Low) */
  163. #define IXGB_VPRCH 0x0202C /* VLAN Packets Received Count (High) */
  164. #define IXGB_JPRCL 0x02030 /* Jumbo Packets Received Count (Low) */
  165. #define IXGB_JPRCH 0x02034 /* Jumbo Packets Received Count (High) */
  166. #define IXGB_GORCL 0x02038 /* Good Octets Received Count (Low) */
  167. #define IXGB_GORCH 0x0203C /* Good Octets Received Count (High) */
  168. #define IXGB_TORL 0x02040 /* Total Octets Received (Low) */
  169. #define IXGB_TORH 0x02044 /* Total Octets Received (High) */
  170. #define IXGB_RNBC 0x02048 /* Receive No Buffers Count */
  171. #define IXGB_RUC 0x02050 /* Receive Undersize Count */
  172. #define IXGB_ROC 0x02058 /* Receive Oversize Count */
  173. #define IXGB_RLEC 0x02060 /* Receive Length Error Count */
  174. #define IXGB_CRCERRS 0x02068 /* CRC Error Count */
  175. #define IXGB_ICBC 0x02070 /* Illegal control byte in mid-packet Count */
  176. #define IXGB_ECBC 0x02078 /* Error Control byte in mid-packet Count */
  177. #define IXGB_MPC 0x02080 /* Missed Packets Count */
  178. #define IXGB_TPTL 0x02100 /* Total Packets Transmitted (Low) */
  179. #define IXGB_TPTH 0x02104 /* Total Packets Transmitted (High) */
  180. #define IXGB_GPTCL 0x02108 /* Good Packets Transmitted Count (Low) */
  181. #define IXGB_GPTCH 0x0210C /* Good Packets Transmitted Count (High) */
  182. #define IXGB_BPTCL 0x02110 /* Broadcast Packets Transmitted Count (Low) */
  183. #define IXGB_BPTCH 0x02114 /* Broadcast Packets Transmitted Count (High) */
  184. #define IXGB_MPTCL 0x02118 /* Multicast Packets Transmitted Count (Low) */
  185. #define IXGB_MPTCH 0x0211C /* Multicast Packets Transmitted Count (High) */
  186. #define IXGB_UPTCL 0x02120 /* Unicast Packets Transmitted Count (Low) */
  187. #define IXGB_UPTCH 0x02124 /* Unicast Packets Transmitted Count (High) */
  188. #define IXGB_VPTCL 0x02128 /* VLAN Packets Transmitted Count (Low) */
  189. #define IXGB_VPTCH 0x0212C /* VLAN Packets Transmitted Count (High) */
  190. #define IXGB_JPTCL 0x02130 /* Jumbo Packets Transmitted Count (Low) */
  191. #define IXGB_JPTCH 0x02134 /* Jumbo Packets Transmitted Count (High) */
  192. #define IXGB_GOTCL 0x02138 /* Good Octets Transmitted Count (Low) */
  193. #define IXGB_GOTCH 0x0213C /* Good Octets Transmitted Count (High) */
  194. #define IXGB_TOTL 0x02140 /* Total Octets Transmitted Count (Low) */
  195. #define IXGB_TOTH 0x02144 /* Total Octets Transmitted Count (High) */
  196. #define IXGB_DC 0x02148 /* Defer Count */
  197. #define IXGB_PLT64C 0x02150 /* Packet Transmitted was less than 64 bytes Count */
  198. #define IXGB_TSCTC 0x02170 /* TCP Segmentation Context Transmitted Count */
  199. #define IXGB_TSCTFC 0x02178 /* TCP Segmentation Context Tx Fail Count */
  200. #define IXGB_IBIC 0x02180 /* Illegal byte during Idle stream count */
  201. #define IXGB_RFC 0x02188 /* Remote Fault Count */
  202. #define IXGB_LFC 0x02190 /* Local Fault Count */
  203. #define IXGB_PFRC 0x02198 /* Pause Frame Receive Count */
  204. #define IXGB_PFTC 0x021A0 /* Pause Frame Transmit Count */
  205. #define IXGB_MCFRC 0x021A8 /* MAC Control Frames (non-Pause) Received Count */
  206. #define IXGB_MCFTC 0x021B0 /* MAC Control Frames (non-Pause) Transmitted Count */
  207. #define IXGB_XONRXC 0x021B8 /* XON Received Count */
  208. #define IXGB_XONTXC 0x021C0 /* XON Transmitted Count */
  209. #define IXGB_XOFFRXC 0x021C8 /* XOFF Received Count */
  210. #define IXGB_XOFFTXC 0x021D0 /* XOFF Transmitted Count */
  211. #define IXGB_RJC 0x021D8 /* Receive Jabber Count */
  212. /* CTRL0 Bit Masks */
  213. #define IXGB_CTRL0_LRST 0x00000008
  214. #define IXGB_CTRL0_JFE 0x00000010
  215. #define IXGB_CTRL0_XLE 0x00000020
  216. #define IXGB_CTRL0_MDCS 0x00000040
  217. #define IXGB_CTRL0_CMDC 0x00000080
  218. #define IXGB_CTRL0_SDP0 0x00040000
  219. #define IXGB_CTRL0_SDP1 0x00080000
  220. #define IXGB_CTRL0_SDP2 0x00100000
  221. #define IXGB_CTRL0_SDP3 0x00200000
  222. #define IXGB_CTRL0_SDP0_DIR 0x00400000
  223. #define IXGB_CTRL0_SDP1_DIR 0x00800000
  224. #define IXGB_CTRL0_SDP2_DIR 0x01000000
  225. #define IXGB_CTRL0_SDP3_DIR 0x02000000
  226. #define IXGB_CTRL0_RST 0x04000000
  227. #define IXGB_CTRL0_RPE 0x08000000
  228. #define IXGB_CTRL0_TPE 0x10000000
  229. #define IXGB_CTRL0_VME 0x40000000
  230. /* CTRL1 Bit Masks */
  231. #define IXGB_CTRL1_GPI0_EN 0x00000001
  232. #define IXGB_CTRL1_GPI1_EN 0x00000002
  233. #define IXGB_CTRL1_GPI2_EN 0x00000004
  234. #define IXGB_CTRL1_GPI3_EN 0x00000008
  235. #define IXGB_CTRL1_SDP4 0x00000010
  236. #define IXGB_CTRL1_SDP5 0x00000020
  237. #define IXGB_CTRL1_SDP6 0x00000040
  238. #define IXGB_CTRL1_SDP7 0x00000080
  239. #define IXGB_CTRL1_SDP4_DIR 0x00000100
  240. #define IXGB_CTRL1_SDP5_DIR 0x00000200
  241. #define IXGB_CTRL1_SDP6_DIR 0x00000400
  242. #define IXGB_CTRL1_SDP7_DIR 0x00000800
  243. #define IXGB_CTRL1_EE_RST 0x00002000
  244. #define IXGB_CTRL1_RO_DIS 0x00020000
  245. #define IXGB_CTRL1_PCIXHM_MASK 0x00C00000
  246. #define IXGB_CTRL1_PCIXHM_1_2 0x00000000
  247. #define IXGB_CTRL1_PCIXHM_5_8 0x00400000
  248. #define IXGB_CTRL1_PCIXHM_3_4 0x00800000
  249. #define IXGB_CTRL1_PCIXHM_7_8 0x00C00000
  250. /* STATUS Bit Masks */
  251. #define IXGB_STATUS_LU 0x00000002
  252. #define IXGB_STATUS_AIP 0x00000004
  253. #define IXGB_STATUS_TXOFF 0x00000010
  254. #define IXGB_STATUS_XAUIME 0x00000020
  255. #define IXGB_STATUS_RES 0x00000040
  256. #define IXGB_STATUS_RIS 0x00000080
  257. #define IXGB_STATUS_RIE 0x00000100
  258. #define IXGB_STATUS_RLF 0x00000200
  259. #define IXGB_STATUS_RRF 0x00000400
  260. #define IXGB_STATUS_PCI_SPD 0x00000800
  261. #define IXGB_STATUS_BUS64 0x00001000
  262. #define IXGB_STATUS_PCIX_MODE 0x00002000
  263. #define IXGB_STATUS_PCIX_SPD_MASK 0x0000C000
  264. #define IXGB_STATUS_PCIX_SPD_66 0x00000000
  265. #define IXGB_STATUS_PCIX_SPD_100 0x00004000
  266. #define IXGB_STATUS_PCIX_SPD_133 0x00008000
  267. #define IXGB_STATUS_REV_ID_MASK 0x000F0000
  268. #define IXGB_STATUS_REV_ID_SHIFT 16
  269. /* EECD Bit Masks */
  270. #define IXGB_EECD_SK 0x00000001
  271. #define IXGB_EECD_CS 0x00000002
  272. #define IXGB_EECD_DI 0x00000004
  273. #define IXGB_EECD_DO 0x00000008
  274. #define IXGB_EECD_FWE_MASK 0x00000030
  275. #define IXGB_EECD_FWE_DIS 0x00000010
  276. #define IXGB_EECD_FWE_EN 0x00000020
  277. /* MFS */
  278. #define IXGB_MFS_SHIFT 16
  279. /* Interrupt Register Bit Masks (used for ICR, ICS, IMS, and IMC) */
  280. #define IXGB_INT_TXDW 0x00000001
  281. #define IXGB_INT_TXQE 0x00000002
  282. #define IXGB_INT_LSC 0x00000004
  283. #define IXGB_INT_RXSEQ 0x00000008
  284. #define IXGB_INT_RXDMT0 0x00000010
  285. #define IXGB_INT_RXO 0x00000040
  286. #define IXGB_INT_RXT0 0x00000080
  287. #define IXGB_INT_AUTOSCAN 0x00000200
  288. #define IXGB_INT_GPI0 0x00000800
  289. #define IXGB_INT_GPI1 0x00001000
  290. #define IXGB_INT_GPI2 0x00002000
  291. #define IXGB_INT_GPI3 0x00004000
  292. /* RCTL Bit Masks */
  293. #define IXGB_RCTL_RXEN 0x00000002
  294. #define IXGB_RCTL_SBP 0x00000004
  295. #define IXGB_RCTL_UPE 0x00000008
  296. #define IXGB_RCTL_MPE 0x00000010
  297. #define IXGB_RCTL_RDMTS_MASK 0x00000300
  298. #define IXGB_RCTL_RDMTS_1_2 0x00000000
  299. #define IXGB_RCTL_RDMTS_1_4 0x00000100
  300. #define IXGB_RCTL_RDMTS_1_8 0x00000200
  301. #define IXGB_RCTL_MO_MASK 0x00003000
  302. #define IXGB_RCTL_MO_47_36 0x00000000
  303. #define IXGB_RCTL_MO_46_35 0x00001000
  304. #define IXGB_RCTL_MO_45_34 0x00002000
  305. #define IXGB_RCTL_MO_43_32 0x00003000
  306. #define IXGB_RCTL_MO_SHIFT 12
  307. #define IXGB_RCTL_BAM 0x00008000
  308. #define IXGB_RCTL_BSIZE_MASK 0x00030000
  309. #define IXGB_RCTL_BSIZE_2048 0x00000000
  310. #define IXGB_RCTL_BSIZE_4096 0x00010000
  311. #define IXGB_RCTL_BSIZE_8192 0x00020000
  312. #define IXGB_RCTL_BSIZE_16384 0x00030000
  313. #define IXGB_RCTL_VFE 0x00040000
  314. #define IXGB_RCTL_CFIEN 0x00080000
  315. #define IXGB_RCTL_CFI 0x00100000
  316. #define IXGB_RCTL_RPDA_MASK 0x00600000
  317. #define IXGB_RCTL_RPDA_MC_MAC 0x00000000
  318. #define IXGB_RCTL_MC_ONLY 0x00400000
  319. #define IXGB_RCTL_CFF 0x00800000
  320. #define IXGB_RCTL_SECRC 0x04000000
  321. #define IXGB_RDT_FPDB 0x80000000
  322. #define IXGB_RCTL_IDLE_RX_UNIT 0
  323. /* FCRTL Bit Masks */
  324. #define IXGB_FCRTL_XONE 0x80000000
  325. /* RXDCTL Bit Masks */
  326. #define IXGB_RXDCTL_PTHRESH_MASK 0x000001FF
  327. #define IXGB_RXDCTL_PTHRESH_SHIFT 0
  328. #define IXGB_RXDCTL_HTHRESH_MASK 0x0003FE00
  329. #define IXGB_RXDCTL_HTHRESH_SHIFT 9
  330. #define IXGB_RXDCTL_WTHRESH_MASK 0x07FC0000
  331. #define IXGB_RXDCTL_WTHRESH_SHIFT 18
  332. /* RAIDC Bit Masks */
  333. #define IXGB_RAIDC_HIGHTHRS_MASK 0x0000003F
  334. #define IXGB_RAIDC_DELAY_MASK 0x000FF800
  335. #define IXGB_RAIDC_DELAY_SHIFT 11
  336. #define IXGB_RAIDC_POLL_MASK 0x1FF00000
  337. #define IXGB_RAIDC_POLL_SHIFT 20
  338. #define IXGB_RAIDC_RXT_GATE 0x40000000
  339. #define IXGB_RAIDC_EN 0x80000000
  340. #define IXGB_RAIDC_POLL_1000_INTERRUPTS_PER_SECOND 1220
  341. #define IXGB_RAIDC_POLL_5000_INTERRUPTS_PER_SECOND 244
  342. #define IXGB_RAIDC_POLL_10000_INTERRUPTS_PER_SECOND 122
  343. #define IXGB_RAIDC_POLL_20000_INTERRUPTS_PER_SECOND 61
  344. /* RXCSUM Bit Masks */
  345. #define IXGB_RXCSUM_IPOFL 0x00000100
  346. #define IXGB_RXCSUM_TUOFL 0x00000200
  347. /* RAH Bit Masks */
  348. #define IXGB_RAH_ASEL_MASK 0x00030000
  349. #define IXGB_RAH_ASEL_DEST 0x00000000
  350. #define IXGB_RAH_ASEL_SRC 0x00010000
  351. #define IXGB_RAH_AV 0x80000000
  352. /* TCTL Bit Masks */
  353. #define IXGB_TCTL_TCE 0x00000001
  354. #define IXGB_TCTL_TXEN 0x00000002
  355. #define IXGB_TCTL_TPDE 0x00000004
  356. #define IXGB_TCTL_IDLE_TX_UNIT 0
  357. /* TXDCTL Bit Masks */
  358. #define IXGB_TXDCTL_PTHRESH_MASK 0x0000007F
  359. #define IXGB_TXDCTL_HTHRESH_MASK 0x00007F00
  360. #define IXGB_TXDCTL_HTHRESH_SHIFT 8
  361. #define IXGB_TXDCTL_WTHRESH_MASK 0x007F0000
  362. #define IXGB_TXDCTL_WTHRESH_SHIFT 16
  363. /* TSPMT Bit Masks */
  364. #define IXGB_TSPMT_TSMT_MASK 0x0000FFFF
  365. #define IXGB_TSPMT_TSPBP_MASK 0xFFFF0000
  366. #define IXGB_TSPMT_TSPBP_SHIFT 16
  367. /* PAP Bit Masks */
  368. #define IXGB_PAP_TXPC_MASK 0x0000FFFF
  369. #define IXGB_PAP_TXPV_MASK 0x000F0000
  370. #define IXGB_PAP_TXPV_10G 0x00000000
  371. #define IXGB_PAP_TXPV_1G 0x00010000
  372. #define IXGB_PAP_TXPV_2G 0x00020000
  373. #define IXGB_PAP_TXPV_3G 0x00030000
  374. #define IXGB_PAP_TXPV_4G 0x00040000
  375. #define IXGB_PAP_TXPV_5G 0x00050000
  376. #define IXGB_PAP_TXPV_6G 0x00060000
  377. #define IXGB_PAP_TXPV_7G 0x00070000
  378. #define IXGB_PAP_TXPV_8G 0x00080000
  379. #define IXGB_PAP_TXPV_9G 0x00090000
  380. #define IXGB_PAP_TXPV_WAN 0x000F0000
  381. /* PCSC1 Bit Masks */
  382. #define IXGB_PCSC1_LOOPBACK 0x00004000
  383. /* PCSC2 Bit Masks */
  384. #define IXGB_PCSC2_PCS_TYPE_MASK 0x00000003
  385. #define IXGB_PCSC2_PCS_TYPE_10GBX 0x00000001
  386. /* PCSS1 Bit Masks */
  387. #define IXGB_PCSS1_LOCAL_FAULT 0x00000080
  388. #define IXGB_PCSS1_RX_LINK_STATUS 0x00000004
  389. /* PCSS2 Bit Masks */
  390. #define IXGB_PCSS2_DEV_PRES_MASK 0x0000C000
  391. #define IXGB_PCSS2_DEV_PRES 0x00004000
  392. #define IXGB_PCSS2_TX_LF 0x00000800
  393. #define IXGB_PCSS2_RX_LF 0x00000400
  394. #define IXGB_PCSS2_10GBW 0x00000004
  395. #define IXGB_PCSS2_10GBX 0x00000002
  396. #define IXGB_PCSS2_10GBR 0x00000001
  397. /* XPCSS Bit Masks */
  398. #define IXGB_XPCSS_ALIGN_STATUS 0x00001000
  399. #define IXGB_XPCSS_PATTERN_TEST 0x00000800
  400. #define IXGB_XPCSS_LANE_3_SYNC 0x00000008
  401. #define IXGB_XPCSS_LANE_2_SYNC 0x00000004
  402. #define IXGB_XPCSS_LANE_1_SYNC 0x00000002
  403. #define IXGB_XPCSS_LANE_0_SYNC 0x00000001
  404. /* XPCSTC Bit Masks */
  405. #define IXGB_XPCSTC_BERT_TRIG 0x00200000
  406. #define IXGB_XPCSTC_BERT_SST 0x00100000
  407. #define IXGB_XPCSTC_BERT_PSZ_MASK 0x000C0000
  408. #define IXGB_XPCSTC_BERT_PSZ_SHIFT 17
  409. #define IXGB_XPCSTC_BERT_PSZ_INF 0x00000003
  410. #define IXGB_XPCSTC_BERT_PSZ_68 0x00000001
  411. #define IXGB_XPCSTC_BERT_PSZ_1028 0x00000000
  412. /* MSCA bit Masks */
  413. /* New Protocol Address */
  414. #define IXGB_MSCA_NP_ADDR_MASK 0x0000FFFF
  415. #define IXGB_MSCA_NP_ADDR_SHIFT 0
  416. /* Either Device Type or Register Address,depending on ST_CODE */
  417. #define IXGB_MSCA_DEV_TYPE_MASK 0x001F0000
  418. #define IXGB_MSCA_DEV_TYPE_SHIFT 16
  419. #define IXGB_MSCA_PHY_ADDR_MASK 0x03E00000
  420. #define IXGB_MSCA_PHY_ADDR_SHIFT 21
  421. #define IXGB_MSCA_OP_CODE_MASK 0x0C000000
  422. /* OP_CODE == 00, Address cycle, New Protocol */
  423. /* OP_CODE == 01, Write operation */
  424. /* OP_CODE == 10, Read operation */
  425. /* OP_CODE == 11, Read, auto increment, New Protocol */
  426. #define IXGB_MSCA_ADDR_CYCLE 0x00000000
  427. #define IXGB_MSCA_WRITE 0x04000000
  428. #define IXGB_MSCA_READ 0x08000000
  429. #define IXGB_MSCA_READ_AUTOINC 0x0C000000
  430. #define IXGB_MSCA_OP_CODE_SHIFT 26
  431. #define IXGB_MSCA_ST_CODE_MASK 0x30000000
  432. /* ST_CODE == 00, New Protocol */
  433. /* ST_CODE == 01, Old Protocol */
  434. #define IXGB_MSCA_NEW_PROTOCOL 0x00000000
  435. #define IXGB_MSCA_OLD_PROTOCOL 0x10000000
  436. #define IXGB_MSCA_ST_CODE_SHIFT 28
  437. /* Initiate command, self-clearing when command completes */
  438. #define IXGB_MSCA_MDI_COMMAND 0x40000000
  439. /*MDI In Progress Enable. */
  440. #define IXGB_MSCA_MDI_IN_PROG_EN 0x80000000
  441. /* MSRWD bit masks */
  442. #define IXGB_MSRWD_WRITE_DATA_MASK 0x0000FFFF
  443. #define IXGB_MSRWD_WRITE_DATA_SHIFT 0
  444. #define IXGB_MSRWD_READ_DATA_MASK 0xFFFF0000
  445. #define IXGB_MSRWD_READ_DATA_SHIFT 16
  446. /* Definitions for the optics devices on the MDIO bus. */
  447. #define IXGB_PHY_ADDRESS 0x0 /* Single PHY, multiple "Devices" */
  448. /* Standard five-bit Device IDs. See IEEE 802.3ae, clause 45 */
  449. #define MDIO_PMA_PMD_DID 0x01
  450. #define MDIO_WIS_DID 0x02
  451. #define MDIO_PCS_DID 0x03
  452. #define MDIO_XGXS_DID 0x04
  453. /* Standard PMA/PMD registers and bit definitions. */
  454. /* Note: This is a very limited set of definitions, */
  455. /* only implemented features are defined. */
  456. #define MDIO_PMA_PMD_CR1 0x0000
  457. #define MDIO_PMA_PMD_CR1_RESET 0x8000
  458. #define MDIO_PMA_PMD_XPAK_VENDOR_NAME 0x803A /* XPAK/XENPAK devices only */
  459. /* Vendor-specific MDIO registers */
  460. #define G6XXX_PMA_PMD_VS1 0xC001 /* Vendor-specific register */
  461. #define G6XXX_XGXS_XAUI_VS2 0x18 /* Vendor-specific register */
  462. #define G6XXX_PMA_PMD_VS1_PLL_RESET 0x80
  463. #define G6XXX_PMA_PMD_VS1_REMOVE_PLL_RESET 0x00
  464. #define G6XXX_XGXS_XAUI_VS2_INPUT_MASK 0x0F /* XAUI lanes synchronized */
  465. /* Layout of a single receive descriptor. The controller assumes that this
  466. * structure is packed into 16 bytes, which is a safe assumption with most
  467. * compilers. However, some compilers may insert padding between the fields,
  468. * in which case the structure must be packed in some compiler-specific
  469. * manner. */
  470. struct ixgb_rx_desc {
  471. uint64_t buff_addr;
  472. uint16_t length;
  473. uint16_t reserved;
  474. uint8_t status;
  475. uint8_t errors;
  476. uint16_t special;
  477. };
  478. #define IXGB_RX_DESC_STATUS_DD 0x01
  479. #define IXGB_RX_DESC_STATUS_EOP 0x02
  480. #define IXGB_RX_DESC_STATUS_IXSM 0x04
  481. #define IXGB_RX_DESC_STATUS_VP 0x08
  482. #define IXGB_RX_DESC_STATUS_TCPCS 0x20
  483. #define IXGB_RX_DESC_STATUS_IPCS 0x40
  484. #define IXGB_RX_DESC_STATUS_PIF 0x80
  485. #define IXGB_RX_DESC_ERRORS_CE 0x01
  486. #define IXGB_RX_DESC_ERRORS_SE 0x02
  487. #define IXGB_RX_DESC_ERRORS_P 0x08
  488. #define IXGB_RX_DESC_ERRORS_TCPE 0x20
  489. #define IXGB_RX_DESC_ERRORS_IPE 0x40
  490. #define IXGB_RX_DESC_ERRORS_RXE 0x80
  491. #define IXGB_RX_DESC_SPECIAL_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
  492. #define IXGB_RX_DESC_SPECIAL_PRI_MASK 0xE000 /* Priority is in upper 3 bits */
  493. #define IXGB_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority is in upper 3 of 16 */
  494. /* Layout of a single transmit descriptor. The controller assumes that this
  495. * structure is packed into 16 bytes, which is a safe assumption with most
  496. * compilers. However, some compilers may insert padding between the fields,
  497. * in which case the structure must be packed in some compiler-specific
  498. * manner. */
  499. struct ixgb_tx_desc {
  500. uint64_t buff_addr;
  501. uint32_t cmd_type_len;
  502. uint8_t status;
  503. uint8_t popts;
  504. uint16_t vlan;
  505. };
  506. #define IXGB_TX_DESC_LENGTH_MASK 0x000FFFFF
  507. #define IXGB_TX_DESC_TYPE_MASK 0x00F00000
  508. #define IXGB_TX_DESC_TYPE_SHIFT 20
  509. #define IXGB_TX_DESC_CMD_MASK 0xFF000000
  510. #define IXGB_TX_DESC_CMD_SHIFT 24
  511. #define IXGB_TX_DESC_CMD_EOP 0x01000000
  512. #define IXGB_TX_DESC_CMD_TSE 0x04000000
  513. #define IXGB_TX_DESC_CMD_RS 0x08000000
  514. #define IXGB_TX_DESC_CMD_VLE 0x40000000
  515. #define IXGB_TX_DESC_CMD_IDE 0x80000000
  516. #define IXGB_TX_DESC_TYPE 0x00100000
  517. #define IXGB_TX_DESC_STATUS_DD 0x01
  518. #define IXGB_TX_DESC_POPTS_IXSM 0x01
  519. #define IXGB_TX_DESC_POPTS_TXSM 0x02
  520. #define IXGB_TX_DESC_SPECIAL_PRI_SHIFT IXGB_RX_DESC_SPECIAL_PRI_SHIFT /* Priority is in upper 3 of 16 */
  521. struct ixgb_context_desc {
  522. uint8_t ipcss;
  523. uint8_t ipcso;
  524. uint16_t ipcse;
  525. uint8_t tucss;
  526. uint8_t tucso;
  527. uint16_t tucse;
  528. uint32_t cmd_type_len;
  529. uint8_t status;
  530. uint8_t hdr_len;
  531. uint16_t mss;
  532. };
  533. #define IXGB_CONTEXT_DESC_CMD_TCP 0x01000000
  534. #define IXGB_CONTEXT_DESC_CMD_IP 0x02000000
  535. #define IXGB_CONTEXT_DESC_CMD_TSE 0x04000000
  536. #define IXGB_CONTEXT_DESC_CMD_RS 0x08000000
  537. #define IXGB_CONTEXT_DESC_CMD_IDE 0x80000000
  538. #define IXGB_CONTEXT_DESC_TYPE 0x00000000
  539. #define IXGB_CONTEXT_DESC_STATUS_DD 0x01
  540. /* Filters */
  541. #define IXGB_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */
  542. #define IXGB_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */
  543. #define IXGB_RAR_ENTRIES 3 /* Number of entries in Rx Address array */
  544. #define IXGB_MEMORY_REGISTER_BASE_ADDRESS 0
  545. #define ENET_HEADER_SIZE 14
  546. #define ENET_FCS_LENGTH 4
  547. #define IXGB_MAX_NUM_MULTICAST_ADDRESSES 128
  548. #define IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS 60
  549. #define IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS 1514
  550. #define IXGB_MAX_JUMBO_FRAME_SIZE 0x3F00
  551. /* Phy Addresses */
  552. #define IXGB_OPTICAL_PHY_ADDR 0x0 /* Optical Module phy address */
  553. #define IXGB_XAUII_PHY_ADDR 0x1 /* Xauii transceiver phy address */
  554. #define IXGB_DIAG_PHY_ADDR 0x1F /* Diagnostic Device phy address */
  555. /* This structure takes a 64k flash and maps it for identification commands */
  556. struct ixgb_flash_buffer {
  557. uint8_t manufacturer_id;
  558. uint8_t device_id;
  559. uint8_t filler1[0x2AA8];
  560. uint8_t cmd2;
  561. uint8_t filler2[0x2AAA];
  562. uint8_t cmd1;
  563. uint8_t filler3[0xAAAA];
  564. };
  565. /*
  566. * This is a little-endian specific check.
  567. */
  568. #define IS_MULTICAST(Address) \
  569. (boolean_t)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))
  570. /*
  571. * Check whether an address is broadcast.
  572. */
  573. #define IS_BROADCAST(Address) \
  574. ((((uint8_t *)(Address))[0] == ((uint8_t)0xff)) && (((uint8_t *)(Address))[1] == ((uint8_t)0xff)))
  575. /* Flow control parameters */
  576. struct ixgb_fc {
  577. uint32_t high_water; /* Flow Control High-water */
  578. uint32_t low_water; /* Flow Control Low-water */
  579. uint16_t pause_time; /* Flow Control Pause timer */
  580. boolean_t send_xon; /* Flow control send XON */
  581. ixgb_fc_type type; /* Type of flow control */
  582. };
  583. /* The historical defaults for the flow control values are given below. */
  584. #define FC_DEFAULT_HI_THRESH (0x8000) /* 32KB */
  585. #define FC_DEFAULT_LO_THRESH (0x4000) /* 16KB */
  586. #define FC_DEFAULT_TX_TIMER (0x100) /* ~130 us */
  587. /* Phy definitions */
  588. #define IXGB_MAX_PHY_REG_ADDRESS 0xFFFF
  589. #define IXGB_MAX_PHY_ADDRESS 31
  590. #define IXGB_MAX_PHY_DEV_TYPE 31
  591. /* Bus parameters */
  592. struct ixgb_bus {
  593. ixgb_bus_speed speed;
  594. ixgb_bus_width width;
  595. ixgb_bus_type type;
  596. };
  597. struct ixgb_hw {
  598. uint8_t __iomem *hw_addr;/* Base Address of the hardware */
  599. void *back; /* Pointer to OS-dependent struct */
  600. struct ixgb_fc fc; /* Flow control parameters */
  601. struct ixgb_bus bus; /* Bus parameters */
  602. uint32_t phy_id; /* Phy Identifier */
  603. uint32_t phy_addr; /* XGMII address of Phy */
  604. ixgb_mac_type mac_type; /* Identifier for MAC controller */
  605. ixgb_phy_type phy_type; /* Transceiver/phy identifier */
  606. uint32_t max_frame_size; /* Maximum frame size supported */
  607. uint32_t mc_filter_type; /* Multicast filter hash type */
  608. uint32_t num_mc_addrs; /* Number of current Multicast addrs */
  609. uint8_t curr_mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS]; /* Individual address currently programmed in MAC */
  610. uint32_t num_tx_desc; /* Number of Transmit descriptors */
  611. uint32_t num_rx_desc; /* Number of Receive descriptors */
  612. uint32_t rx_buffer_size; /* Size of Receive buffer */
  613. boolean_t link_up; /* TRUE if link is valid */
  614. boolean_t adapter_stopped; /* State of adapter */
  615. uint16_t device_id; /* device id from PCI configuration space */
  616. uint16_t vendor_id; /* vendor id from PCI configuration space */
  617. uint8_t revision_id; /* revision id from PCI configuration space */
  618. uint16_t subsystem_vendor_id; /* subsystem vendor id from PCI configuration space */
  619. uint16_t subsystem_id; /* subsystem id from PCI configuration space */
  620. uint32_t bar0; /* Base Address registers */
  621. uint32_t bar1;
  622. uint32_t bar2;
  623. uint32_t bar3;
  624. uint16_t pci_cmd_word; /* PCI command register id from PCI configuration space */
  625. uint16_t eeprom[IXGB_EEPROM_SIZE]; /* EEPROM contents read at init time */
  626. unsigned long io_base; /* Our I/O mapped location */
  627. uint32_t lastLFC;
  628. uint32_t lastRFC;
  629. };
  630. /* Statistics reported by the hardware */
  631. struct ixgb_hw_stats {
  632. uint64_t tprl;
  633. uint64_t tprh;
  634. uint64_t gprcl;
  635. uint64_t gprch;
  636. uint64_t bprcl;
  637. uint64_t bprch;
  638. uint64_t mprcl;
  639. uint64_t mprch;
  640. uint64_t uprcl;
  641. uint64_t uprch;
  642. uint64_t vprcl;
  643. uint64_t vprch;
  644. uint64_t jprcl;
  645. uint64_t jprch;
  646. uint64_t gorcl;
  647. uint64_t gorch;
  648. uint64_t torl;
  649. uint64_t torh;
  650. uint64_t rnbc;
  651. uint64_t ruc;
  652. uint64_t roc;
  653. uint64_t rlec;
  654. uint64_t crcerrs;
  655. uint64_t icbc;
  656. uint64_t ecbc;
  657. uint64_t mpc;
  658. uint64_t tptl;
  659. uint64_t tpth;
  660. uint64_t gptcl;
  661. uint64_t gptch;
  662. uint64_t bptcl;
  663. uint64_t bptch;
  664. uint64_t mptcl;
  665. uint64_t mptch;
  666. uint64_t uptcl;
  667. uint64_t uptch;
  668. uint64_t vptcl;
  669. uint64_t vptch;
  670. uint64_t jptcl;
  671. uint64_t jptch;
  672. uint64_t gotcl;
  673. uint64_t gotch;
  674. uint64_t totl;
  675. uint64_t toth;
  676. uint64_t dc;
  677. uint64_t plt64c;
  678. uint64_t tsctc;
  679. uint64_t tsctfc;
  680. uint64_t ibic;
  681. uint64_t rfc;
  682. uint64_t lfc;
  683. uint64_t pfrc;
  684. uint64_t pftc;
  685. uint64_t mcfrc;
  686. uint64_t mcftc;
  687. uint64_t xonrxc;
  688. uint64_t xontxc;
  689. uint64_t xoffrxc;
  690. uint64_t xofftxc;
  691. uint64_t rjc;
  692. };
  693. /* Function Prototypes */
  694. extern boolean_t ixgb_adapter_stop(struct ixgb_hw *hw);
  695. extern boolean_t ixgb_init_hw(struct ixgb_hw *hw);
  696. extern boolean_t ixgb_adapter_start(struct ixgb_hw *hw);
  697. extern void ixgb_check_for_link(struct ixgb_hw *hw);
  698. extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw);
  699. extern void ixgb_rar_set(struct ixgb_hw *hw,
  700. uint8_t *addr,
  701. uint32_t index);
  702. /* Filters (multicast, vlan, receive) */
  703. extern void ixgb_mc_addr_list_update(struct ixgb_hw *hw,
  704. uint8_t *mc_addr_list,
  705. uint32_t mc_addr_count,
  706. uint32_t pad);
  707. /* Vfta functions */
  708. extern void ixgb_write_vfta(struct ixgb_hw *hw,
  709. uint32_t offset,
  710. uint32_t value);
  711. /* Access functions to eeprom data */
  712. void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t *mac_addr);
  713. uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw);
  714. uint16_t ixgb_get_ee_device_id(struct ixgb_hw *hw);
  715. boolean_t ixgb_get_eeprom_data(struct ixgb_hw *hw);
  716. uint16_t ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index);
  717. /* Everything else */
  718. void ixgb_led_on(struct ixgb_hw *hw);
  719. void ixgb_led_off(struct ixgb_hw *hw);
  720. void ixgb_write_pci_cfg(struct ixgb_hw *hw,
  721. uint32_t reg,
  722. uint16_t * value);
  723. #endif /* _IXGB_HW_H_ */