ixgbe_82598.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. /*******************************************************************************
  2. Intel 10 Gigabit PCI Express Linux driver
  3. Copyright(c) 1999 - 2009 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope 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.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #include <linux/pci.h>
  21. #include <linux/delay.h>
  22. #include <linux/sched.h>
  23. #include "ixgbe.h"
  24. #include "ixgbe_phy.h"
  25. #define IXGBE_82598_MAX_TX_QUEUES 32
  26. #define IXGBE_82598_MAX_RX_QUEUES 64
  27. #define IXGBE_82598_RAR_ENTRIES 16
  28. #define IXGBE_82598_MC_TBL_SIZE 128
  29. #define IXGBE_82598_VFT_TBL_SIZE 128
  30. static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
  31. ixgbe_link_speed *speed,
  32. bool *autoneg);
  33. static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw);
  34. static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
  35. ixgbe_link_speed speed,
  36. bool autoneg,
  37. bool autoneg_wait_to_complete);
  38. static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
  39. u8 *eeprom_data);
  40. /**
  41. * ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count
  42. * @hw: pointer to hardware structure
  43. *
  44. * Read PCIe configuration space, and get the MSI-X vector count from
  45. * the capabilities table.
  46. **/
  47. static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
  48. {
  49. struct ixgbe_adapter *adapter = hw->back;
  50. u16 msix_count;
  51. pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82598_CAPS,
  52. &msix_count);
  53. msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
  54. /* MSI-X count is zero-based in HW, so increment to give proper value */
  55. msix_count++;
  56. return msix_count;
  57. }
  58. /**
  59. */
  60. static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
  61. {
  62. struct ixgbe_mac_info *mac = &hw->mac;
  63. /* Call PHY identify routine to get the phy type */
  64. ixgbe_identify_phy_generic(hw);
  65. mac->mcft_size = IXGBE_82598_MC_TBL_SIZE;
  66. mac->vft_size = IXGBE_82598_VFT_TBL_SIZE;
  67. mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
  68. mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
  69. mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
  70. mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
  71. return 0;
  72. }
  73. /**
  74. * ixgbe_init_phy_ops_82598 - PHY/SFP specific init
  75. * @hw: pointer to hardware structure
  76. *
  77. * Initialize any function pointers that were not able to be
  78. * set during get_invariants because the PHY/SFP type was
  79. * not known. Perform the SFP init if necessary.
  80. *
  81. **/
  82. s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
  83. {
  84. struct ixgbe_mac_info *mac = &hw->mac;
  85. struct ixgbe_phy_info *phy = &hw->phy;
  86. s32 ret_val = 0;
  87. u16 list_offset, data_offset;
  88. /* Identify the PHY */
  89. phy->ops.identify(hw);
  90. /* Overwrite the link function pointers if copper PHY */
  91. if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
  92. mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
  93. mac->ops.setup_link_speed =
  94. &ixgbe_setup_copper_link_speed_82598;
  95. mac->ops.get_link_capabilities =
  96. &ixgbe_get_copper_link_capabilities_82598;
  97. }
  98. switch (hw->phy.type) {
  99. case ixgbe_phy_tn:
  100. phy->ops.check_link = &ixgbe_check_phy_link_tnx;
  101. phy->ops.get_firmware_version =
  102. &ixgbe_get_phy_firmware_version_tnx;
  103. break;
  104. case ixgbe_phy_nl:
  105. phy->ops.reset = &ixgbe_reset_phy_nl;
  106. /* Call SFP+ identify routine to get the SFP+ module type */
  107. ret_val = phy->ops.identify_sfp(hw);
  108. if (ret_val != 0)
  109. goto out;
  110. else if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) {
  111. ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
  112. goto out;
  113. }
  114. /* Check to see if SFP+ module is supported */
  115. ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
  116. &list_offset,
  117. &data_offset);
  118. if (ret_val != 0) {
  119. ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
  120. goto out;
  121. }
  122. break;
  123. default:
  124. break;
  125. }
  126. out:
  127. return ret_val;
  128. }
  129. /**
  130. * ixgbe_get_link_capabilities_82598 - Determines link capabilities
  131. * @hw: pointer to hardware structure
  132. * @speed: pointer to link speed
  133. * @autoneg: boolean auto-negotiation value
  134. *
  135. * Determines the link capabilities by reading the AUTOC register.
  136. **/
  137. static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
  138. ixgbe_link_speed *speed,
  139. bool *autoneg)
  140. {
  141. s32 status = 0;
  142. u32 autoc = 0;
  143. /*
  144. * Determine link capabilities based on the stored value of AUTOC,
  145. * which represents EEPROM defaults. If AUTOC value has not been
  146. * stored, use the current register value.
  147. */
  148. if (hw->mac.orig_link_settings_stored)
  149. autoc = hw->mac.orig_autoc;
  150. else
  151. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  152. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  153. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  154. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  155. *autoneg = false;
  156. break;
  157. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  158. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  159. *autoneg = false;
  160. break;
  161. case IXGBE_AUTOC_LMS_1G_AN:
  162. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  163. *autoneg = true;
  164. break;
  165. case IXGBE_AUTOC_LMS_KX4_AN:
  166. case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
  167. *speed = IXGBE_LINK_SPEED_UNKNOWN;
  168. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  169. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  170. if (autoc & IXGBE_AUTOC_KX_SUPP)
  171. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  172. *autoneg = true;
  173. break;
  174. default:
  175. status = IXGBE_ERR_LINK_SETUP;
  176. break;
  177. }
  178. return status;
  179. }
  180. /**
  181. * ixgbe_get_copper_link_capabilities_82598 - Determines link capabilities
  182. * @hw: pointer to hardware structure
  183. * @speed: pointer to link speed
  184. * @autoneg: boolean auto-negotiation value
  185. *
  186. * Determines the link capabilities by reading the AUTOC register.
  187. **/
  188. static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
  189. ixgbe_link_speed *speed,
  190. bool *autoneg)
  191. {
  192. s32 status = IXGBE_ERR_LINK_SETUP;
  193. u16 speed_ability;
  194. *speed = 0;
  195. *autoneg = true;
  196. status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD,
  197. &speed_ability);
  198. if (status == 0) {
  199. if (speed_ability & MDIO_SPEED_10G)
  200. *speed |= IXGBE_LINK_SPEED_10GB_FULL;
  201. if (speed_ability & MDIO_PMA_SPEED_1000)
  202. *speed |= IXGBE_LINK_SPEED_1GB_FULL;
  203. }
  204. return status;
  205. }
  206. /**
  207. * ixgbe_get_media_type_82598 - Determines media type
  208. * @hw: pointer to hardware structure
  209. *
  210. * Returns the media type (fiber, copper, backplane)
  211. **/
  212. static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
  213. {
  214. enum ixgbe_media_type media_type;
  215. /* Media type for I82598 is based on device ID */
  216. switch (hw->device_id) {
  217. case IXGBE_DEV_ID_82598:
  218. case IXGBE_DEV_ID_82598_BX:
  219. media_type = ixgbe_media_type_backplane;
  220. break;
  221. case IXGBE_DEV_ID_82598AF_DUAL_PORT:
  222. case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
  223. case IXGBE_DEV_ID_82598EB_CX4:
  224. case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
  225. case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
  226. case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
  227. case IXGBE_DEV_ID_82598EB_XF_LR:
  228. case IXGBE_DEV_ID_82598EB_SFP_LOM:
  229. media_type = ixgbe_media_type_fiber;
  230. break;
  231. case IXGBE_DEV_ID_82598AT:
  232. case IXGBE_DEV_ID_82598AT2:
  233. media_type = ixgbe_media_type_copper;
  234. break;
  235. default:
  236. media_type = ixgbe_media_type_unknown;
  237. break;
  238. }
  239. return media_type;
  240. }
  241. /**
  242. * ixgbe_fc_enable_82598 - Enable flow control
  243. * @hw: pointer to hardware structure
  244. * @packetbuf_num: packet buffer number (0-7)
  245. *
  246. * Enable flow control according to the current settings.
  247. **/
  248. static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
  249. {
  250. s32 ret_val = 0;
  251. u32 fctrl_reg;
  252. u32 rmcs_reg;
  253. u32 reg;
  254. #ifdef CONFIG_DCB
  255. if (hw->fc.requested_mode == ixgbe_fc_pfc)
  256. goto out;
  257. #endif /* CONFIG_DCB */
  258. /* Negotiate the fc mode to use */
  259. ret_val = ixgbe_fc_autoneg(hw);
  260. if (ret_val)
  261. goto out;
  262. /* Disable any previous flow control settings */
  263. fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
  264. fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
  265. rmcs_reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
  266. rmcs_reg &= ~(IXGBE_RMCS_TFCE_PRIORITY | IXGBE_RMCS_TFCE_802_3X);
  267. /*
  268. * The possible values of fc.current_mode are:
  269. * 0: Flow control is completely disabled
  270. * 1: Rx flow control is enabled (we can receive pause frames,
  271. * but not send pause frames).
  272. * 2: Tx flow control is enabled (we can send pause frames but
  273. * we do not support receiving pause frames).
  274. * 3: Both Rx and Tx flow control (symmetric) are enabled.
  275. * other: Invalid.
  276. #ifdef CONFIG_DCB
  277. * 4: Priority Flow Control is enabled.
  278. #endif
  279. */
  280. switch (hw->fc.current_mode) {
  281. case ixgbe_fc_none:
  282. /*
  283. * Flow control is disabled by software override or autoneg.
  284. * The code below will actually disable it in the HW.
  285. */
  286. break;
  287. case ixgbe_fc_rx_pause:
  288. /*
  289. * Rx Flow control is enabled and Tx Flow control is
  290. * disabled by software override. Since there really
  291. * isn't a way to advertise that we are capable of RX
  292. * Pause ONLY, we will advertise that we support both
  293. * symmetric and asymmetric Rx PAUSE. Later, we will
  294. * disable the adapter's ability to send PAUSE frames.
  295. */
  296. fctrl_reg |= IXGBE_FCTRL_RFCE;
  297. break;
  298. case ixgbe_fc_tx_pause:
  299. /*
  300. * Tx Flow control is enabled, and Rx Flow control is
  301. * disabled by software override.
  302. */
  303. rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
  304. break;
  305. case ixgbe_fc_full:
  306. /* Flow control (both Rx and Tx) is enabled by SW override. */
  307. fctrl_reg |= IXGBE_FCTRL_RFCE;
  308. rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
  309. break;
  310. #ifdef CONFIG_DCB
  311. case ixgbe_fc_pfc:
  312. goto out;
  313. break;
  314. #endif /* CONFIG_DCB */
  315. default:
  316. hw_dbg(hw, "Flow control param set incorrectly\n");
  317. ret_val = -IXGBE_ERR_CONFIG;
  318. goto out;
  319. break;
  320. }
  321. /* Set 802.3x based flow control settings. */
  322. fctrl_reg |= IXGBE_FCTRL_DPF;
  323. IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg);
  324. IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg);
  325. /* Set up and enable Rx high/low water mark thresholds, enable XON. */
  326. if (hw->fc.current_mode & ixgbe_fc_tx_pause) {
  327. if (hw->fc.send_xon) {
  328. IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
  329. (hw->fc.low_water | IXGBE_FCRTL_XONE));
  330. } else {
  331. IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
  332. hw->fc.low_water);
  333. }
  334. IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num),
  335. (hw->fc.high_water | IXGBE_FCRTH_FCEN));
  336. }
  337. /* Configure pause time (2 TCs per register) */
  338. reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num / 2));
  339. if ((packetbuf_num & 1) == 0)
  340. reg = (reg & 0xFFFF0000) | hw->fc.pause_time;
  341. else
  342. reg = (reg & 0x0000FFFF) | (hw->fc.pause_time << 16);
  343. IXGBE_WRITE_REG(hw, IXGBE_FCTTV(packetbuf_num / 2), reg);
  344. IXGBE_WRITE_REG(hw, IXGBE_FCRTV, (hw->fc.pause_time >> 1));
  345. out:
  346. return ret_val;
  347. }
  348. /**
  349. * ixgbe_setup_mac_link_82598 - Configures MAC link settings
  350. * @hw: pointer to hardware structure
  351. *
  352. * Configures link settings based on values in the ixgbe_hw struct.
  353. * Restarts the link. Performs autonegotiation if needed.
  354. **/
  355. static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
  356. {
  357. u32 autoc_reg;
  358. u32 links_reg;
  359. u32 i;
  360. s32 status = 0;
  361. /* Restart link */
  362. autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  363. autoc_reg |= IXGBE_AUTOC_AN_RESTART;
  364. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
  365. /* Only poll for autoneg to complete if specified to do so */
  366. if (hw->phy.autoneg_wait_to_complete) {
  367. if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  368. IXGBE_AUTOC_LMS_KX4_AN ||
  369. (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
  370. IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
  371. links_reg = 0; /* Just in case Autoneg time = 0 */
  372. for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
  373. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  374. if (links_reg & IXGBE_LINKS_KX_AN_COMP)
  375. break;
  376. msleep(100);
  377. }
  378. if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
  379. status = IXGBE_ERR_AUTONEG_NOT_COMPLETE;
  380. hw_dbg(hw, "Autonegotiation did not complete.\n");
  381. }
  382. }
  383. }
  384. /* Add delay to filter out noises during initial link setup */
  385. msleep(50);
  386. return status;
  387. }
  388. /**
  389. * ixgbe_check_mac_link_82598 - Get link/speed status
  390. * @hw: pointer to hardware structure
  391. * @speed: pointer to link speed
  392. * @link_up: true is link is up, false otherwise
  393. * @link_up_wait_to_complete: bool used to wait for link up or not
  394. *
  395. * Reads the links register to determine if link is up and the current speed
  396. **/
  397. static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
  398. ixgbe_link_speed *speed, bool *link_up,
  399. bool link_up_wait_to_complete)
  400. {
  401. u32 links_reg;
  402. u32 i;
  403. u16 link_reg, adapt_comp_reg;
  404. /*
  405. * SERDES PHY requires us to read link status from register 0xC79F.
  406. * Bit 0 set indicates link is up/ready; clear indicates link down.
  407. * 0xC00C is read to check that the XAUI lanes are active. Bit 0
  408. * clear indicates active; set indicates inactive.
  409. */
  410. if (hw->phy.type == ixgbe_phy_nl) {
  411. hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
  412. hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
  413. hw->phy.ops.read_reg(hw, 0xC00C, MDIO_MMD_PMAPMD,
  414. &adapt_comp_reg);
  415. if (link_up_wait_to_complete) {
  416. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  417. if ((link_reg & 1) &&
  418. ((adapt_comp_reg & 1) == 0)) {
  419. *link_up = true;
  420. break;
  421. } else {
  422. *link_up = false;
  423. }
  424. msleep(100);
  425. hw->phy.ops.read_reg(hw, 0xC79F,
  426. MDIO_MMD_PMAPMD,
  427. &link_reg);
  428. hw->phy.ops.read_reg(hw, 0xC00C,
  429. MDIO_MMD_PMAPMD,
  430. &adapt_comp_reg);
  431. }
  432. } else {
  433. if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0))
  434. *link_up = true;
  435. else
  436. *link_up = false;
  437. }
  438. if (*link_up == false)
  439. goto out;
  440. }
  441. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  442. if (link_up_wait_to_complete) {
  443. for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
  444. if (links_reg & IXGBE_LINKS_UP) {
  445. *link_up = true;
  446. break;
  447. } else {
  448. *link_up = false;
  449. }
  450. msleep(100);
  451. links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
  452. }
  453. } else {
  454. if (links_reg & IXGBE_LINKS_UP)
  455. *link_up = true;
  456. else
  457. *link_up = false;
  458. }
  459. if (links_reg & IXGBE_LINKS_SPEED)
  460. *speed = IXGBE_LINK_SPEED_10GB_FULL;
  461. else
  462. *speed = IXGBE_LINK_SPEED_1GB_FULL;
  463. /* if link is down, zero out the current_mode */
  464. if (*link_up == false) {
  465. hw->fc.current_mode = ixgbe_fc_none;
  466. hw->fc.fc_was_autonegged = false;
  467. }
  468. out:
  469. return 0;
  470. }
  471. /**
  472. * ixgbe_setup_mac_link_speed_82598 - Set MAC link speed
  473. * @hw: pointer to hardware structure
  474. * @speed: new link speed
  475. * @autoneg: true if auto-negotiation enabled
  476. * @autoneg_wait_to_complete: true if waiting is needed to complete
  477. *
  478. * Set the link speed in the AUTOC register and restarts link.
  479. **/
  480. static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
  481. ixgbe_link_speed speed, bool autoneg,
  482. bool autoneg_wait_to_complete)
  483. {
  484. s32 status = 0;
  485. ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
  486. u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  487. u32 autoc = curr_autoc;
  488. u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
  489. /* Check to see if speed passed in is supported. */
  490. ixgbe_get_link_capabilities_82598(hw, &link_capabilities, &autoneg);
  491. speed &= link_capabilities;
  492. if (speed == IXGBE_LINK_SPEED_UNKNOWN)
  493. status = IXGBE_ERR_LINK_SETUP;
  494. /* Set KX4/KX support according to speed requested */
  495. else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
  496. link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
  497. autoc &= ~IXGBE_AUTOC_KX4_KX_SUPP_MASK;
  498. if (speed & IXGBE_LINK_SPEED_10GB_FULL)
  499. autoc |= IXGBE_AUTOC_KX4_SUPP;
  500. if (speed & IXGBE_LINK_SPEED_1GB_FULL)
  501. autoc |= IXGBE_AUTOC_KX_SUPP;
  502. if (autoc != curr_autoc)
  503. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
  504. }
  505. if (status == 0) {
  506. hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete;
  507. /*
  508. * Setup and restart the link based on the new values in
  509. * ixgbe_hw This will write the AUTOC register based on the new
  510. * stored values
  511. */
  512. status = ixgbe_setup_mac_link_82598(hw);
  513. }
  514. return status;
  515. }
  516. /**
  517. * ixgbe_setup_copper_link_82598 - Setup copper link settings
  518. * @hw: pointer to hardware structure
  519. *
  520. * Configures link settings based on values in the ixgbe_hw struct.
  521. * Restarts the link. Performs autonegotiation if needed. Restart
  522. * phy and wait for autonegotiate to finish. Then synchronize the
  523. * MAC and PHY.
  524. **/
  525. static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
  526. {
  527. s32 status;
  528. /* Restart autonegotiation on PHY */
  529. status = hw->phy.ops.setup_link(hw);
  530. /* Set up MAC */
  531. ixgbe_setup_mac_link_82598(hw);
  532. return status;
  533. }
  534. /**
  535. * ixgbe_setup_copper_link_speed_82598 - Set the PHY autoneg advertised field
  536. * @hw: pointer to hardware structure
  537. * @speed: new link speed
  538. * @autoneg: true if autonegotiation enabled
  539. * @autoneg_wait_to_complete: true if waiting is needed to complete
  540. *
  541. * Sets the link speed in the AUTOC register in the MAC and restarts link.
  542. **/
  543. static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
  544. ixgbe_link_speed speed,
  545. bool autoneg,
  546. bool autoneg_wait_to_complete)
  547. {
  548. s32 status;
  549. /* Setup the PHY according to input speed */
  550. status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
  551. autoneg_wait_to_complete);
  552. /* Set up MAC */
  553. ixgbe_setup_mac_link_82598(hw);
  554. return status;
  555. }
  556. /**
  557. * ixgbe_reset_hw_82598 - Performs hardware reset
  558. * @hw: pointer to hardware structure
  559. *
  560. * Resets the hardware by resetting the transmit and receive units, masks and
  561. * clears all interrupts, performing a PHY reset, and performing a link (MAC)
  562. * reset.
  563. **/
  564. static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
  565. {
  566. s32 status = 0;
  567. s32 phy_status = 0;
  568. u32 ctrl;
  569. u32 gheccr;
  570. u32 i;
  571. u32 autoc;
  572. u8 analog_val;
  573. /* Call adapter stop to disable tx/rx and clear interrupts */
  574. hw->mac.ops.stop_adapter(hw);
  575. /*
  576. * Power up the Atlas Tx lanes if they are currently powered down.
  577. * Atlas Tx lanes are powered down for MAC loopback tests, but
  578. * they are not automatically restored on reset.
  579. */
  580. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &analog_val);
  581. if (analog_val & IXGBE_ATLAS_PDN_TX_REG_EN) {
  582. /* Enable Tx Atlas so packets can be transmitted again */
  583. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
  584. &analog_val);
  585. analog_val &= ~IXGBE_ATLAS_PDN_TX_REG_EN;
  586. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
  587. analog_val);
  588. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
  589. &analog_val);
  590. analog_val &= ~IXGBE_ATLAS_PDN_TX_10G_QL_ALL;
  591. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
  592. analog_val);
  593. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
  594. &analog_val);
  595. analog_val &= ~IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
  596. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
  597. analog_val);
  598. hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
  599. &analog_val);
  600. analog_val &= ~IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
  601. hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
  602. analog_val);
  603. }
  604. /* Reset PHY */
  605. if (hw->phy.reset_disable == false) {
  606. /* PHY ops must be identified and initialized prior to reset */
  607. /* Init PHY and function pointers, perform SFP setup */
  608. phy_status = hw->phy.ops.init(hw);
  609. if (phy_status == IXGBE_ERR_SFP_NOT_SUPPORTED)
  610. goto reset_hw_out;
  611. else if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT)
  612. goto no_phy_reset;
  613. hw->phy.ops.reset(hw);
  614. }
  615. no_phy_reset:
  616. /*
  617. * Prevent the PCI-E bus from from hanging by disabling PCI-E master
  618. * access and verify no pending requests before reset
  619. */
  620. status = ixgbe_disable_pcie_master(hw);
  621. if (status != 0) {
  622. status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
  623. hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
  624. }
  625. /*
  626. * Issue global reset to the MAC. This needs to be a SW reset.
  627. * If link reset is used, it might reset the MAC when mng is using it
  628. */
  629. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  630. IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST));
  631. IXGBE_WRITE_FLUSH(hw);
  632. /* Poll for reset bit to self-clear indicating reset is complete */
  633. for (i = 0; i < 10; i++) {
  634. udelay(1);
  635. ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
  636. if (!(ctrl & IXGBE_CTRL_RST))
  637. break;
  638. }
  639. if (ctrl & IXGBE_CTRL_RST) {
  640. status = IXGBE_ERR_RESET_FAILED;
  641. hw_dbg(hw, "Reset polling failed to complete.\n");
  642. }
  643. msleep(50);
  644. gheccr = IXGBE_READ_REG(hw, IXGBE_GHECCR);
  645. gheccr &= ~((1 << 21) | (1 << 18) | (1 << 9) | (1 << 6));
  646. IXGBE_WRITE_REG(hw, IXGBE_GHECCR, gheccr);
  647. /*
  648. * Store the original AUTOC value if it has not been
  649. * stored off yet. Otherwise restore the stored original
  650. * AUTOC value since the reset operation sets back to deaults.
  651. */
  652. autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  653. if (hw->mac.orig_link_settings_stored == false) {
  654. hw->mac.orig_autoc = autoc;
  655. hw->mac.orig_link_settings_stored = true;
  656. } else if (autoc != hw->mac.orig_autoc) {
  657. IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
  658. }
  659. /*
  660. * Store MAC address from RAR0, clear receive address registers, and
  661. * clear the multicast table
  662. */
  663. hw->mac.ops.init_rx_addrs(hw);
  664. /* Store the permanent mac address */
  665. hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
  666. reset_hw_out:
  667. if (phy_status)
  668. status = phy_status;
  669. return status;
  670. }
  671. /**
  672. * ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address
  673. * @hw: pointer to hardware struct
  674. * @rar: receive address register index to associate with a VMDq index
  675. * @vmdq: VMDq set index
  676. **/
  677. static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  678. {
  679. u32 rar_high;
  680. rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
  681. rar_high &= ~IXGBE_RAH_VIND_MASK;
  682. rar_high |= ((vmdq << IXGBE_RAH_VIND_SHIFT) & IXGBE_RAH_VIND_MASK);
  683. IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
  684. return 0;
  685. }
  686. /**
  687. * ixgbe_clear_vmdq_82598 - Disassociate a VMDq set index from an rx address
  688. * @hw: pointer to hardware struct
  689. * @rar: receive address register index to associate with a VMDq index
  690. * @vmdq: VMDq clear index (not used in 82598, but elsewhere)
  691. **/
  692. static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  693. {
  694. u32 rar_high;
  695. u32 rar_entries = hw->mac.num_rar_entries;
  696. if (rar < rar_entries) {
  697. rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
  698. if (rar_high & IXGBE_RAH_VIND_MASK) {
  699. rar_high &= ~IXGBE_RAH_VIND_MASK;
  700. IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
  701. }
  702. } else {
  703. hw_dbg(hw, "RAR index %d is out of range.\n", rar);
  704. }
  705. return 0;
  706. }
  707. /**
  708. * ixgbe_set_vfta_82598 - Set VLAN filter table
  709. * @hw: pointer to hardware structure
  710. * @vlan: VLAN id to write to VLAN filter
  711. * @vind: VMDq output index that maps queue to VLAN id in VFTA
  712. * @vlan_on: boolean flag to turn on/off VLAN in VFTA
  713. *
  714. * Turn on/off specified VLAN in the VLAN filter table.
  715. **/
  716. static s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
  717. bool vlan_on)
  718. {
  719. u32 regindex;
  720. u32 bitindex;
  721. u32 bits;
  722. u32 vftabyte;
  723. if (vlan > 4095)
  724. return IXGBE_ERR_PARAM;
  725. /* Determine 32-bit word position in array */
  726. regindex = (vlan >> 5) & 0x7F; /* upper seven bits */
  727. /* Determine the location of the (VMD) queue index */
  728. vftabyte = ((vlan >> 3) & 0x03); /* bits (4:3) indicating byte array */
  729. bitindex = (vlan & 0x7) << 2; /* lower 3 bits indicate nibble */
  730. /* Set the nibble for VMD queue index */
  731. bits = IXGBE_READ_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex));
  732. bits &= (~(0x0F << bitindex));
  733. bits |= (vind << bitindex);
  734. IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex), bits);
  735. /* Determine the location of the bit for this VLAN id */
  736. bitindex = vlan & 0x1F; /* lower five bits */
  737. bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
  738. if (vlan_on)
  739. /* Turn on this VLAN id */
  740. bits |= (1 << bitindex);
  741. else
  742. /* Turn off this VLAN id */
  743. bits &= ~(1 << bitindex);
  744. IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
  745. return 0;
  746. }
  747. /**
  748. * ixgbe_clear_vfta_82598 - Clear VLAN filter table
  749. * @hw: pointer to hardware structure
  750. *
  751. * Clears the VLAN filer table, and the VMDq index associated with the filter
  752. **/
  753. static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
  754. {
  755. u32 offset;
  756. u32 vlanbyte;
  757. for (offset = 0; offset < hw->mac.vft_size; offset++)
  758. IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
  759. for (vlanbyte = 0; vlanbyte < 4; vlanbyte++)
  760. for (offset = 0; offset < hw->mac.vft_size; offset++)
  761. IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vlanbyte, offset),
  762. 0);
  763. return 0;
  764. }
  765. /**
  766. * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
  767. * @hw: pointer to hardware structure
  768. * @reg: analog register to read
  769. * @val: read value
  770. *
  771. * Performs read operation to Atlas analog register specified.
  772. **/
  773. static s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val)
  774. {
  775. u32 atlas_ctl;
  776. IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL,
  777. IXGBE_ATLASCTL_WRITE_CMD | (reg << 8));
  778. IXGBE_WRITE_FLUSH(hw);
  779. udelay(10);
  780. atlas_ctl = IXGBE_READ_REG(hw, IXGBE_ATLASCTL);
  781. *val = (u8)atlas_ctl;
  782. return 0;
  783. }
  784. /**
  785. * ixgbe_write_analog_reg8_82598 - Writes 8 bit Atlas analog register
  786. * @hw: pointer to hardware structure
  787. * @reg: atlas register to write
  788. * @val: value to write
  789. *
  790. * Performs write operation to Atlas analog register specified.
  791. **/
  792. static s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val)
  793. {
  794. u32 atlas_ctl;
  795. atlas_ctl = (reg << 8) | val;
  796. IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL, atlas_ctl);
  797. IXGBE_WRITE_FLUSH(hw);
  798. udelay(10);
  799. return 0;
  800. }
  801. /**
  802. * ixgbe_read_i2c_eeprom_82598 - Read 8 bit EEPROM word of an SFP+ module
  803. * over I2C interface through an intermediate phy.
  804. * @hw: pointer to hardware structure
  805. * @byte_offset: EEPROM byte offset to read
  806. * @eeprom_data: value read
  807. *
  808. * Performs byte read operation to SFP module's EEPROM over I2C interface.
  809. **/
  810. static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
  811. u8 *eeprom_data)
  812. {
  813. s32 status = 0;
  814. u16 sfp_addr = 0;
  815. u16 sfp_data = 0;
  816. u16 sfp_stat = 0;
  817. u32 i;
  818. if (hw->phy.type == ixgbe_phy_nl) {
  819. /*
  820. * phy SDA/SCL registers are at addresses 0xC30A to
  821. * 0xC30D. These registers are used to talk to the SFP+
  822. * module's EEPROM through the SDA/SCL (I2C) interface.
  823. */
  824. sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset;
  825. sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
  826. hw->phy.ops.write_reg(hw,
  827. IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
  828. MDIO_MMD_PMAPMD,
  829. sfp_addr);
  830. /* Poll status */
  831. for (i = 0; i < 100; i++) {
  832. hw->phy.ops.read_reg(hw,
  833. IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
  834. MDIO_MMD_PMAPMD,
  835. &sfp_stat);
  836. sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK;
  837. if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS)
  838. break;
  839. msleep(10);
  840. }
  841. if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) {
  842. hw_dbg(hw, "EEPROM read did not pass.\n");
  843. status = IXGBE_ERR_SFP_NOT_PRESENT;
  844. goto out;
  845. }
  846. /* Read data */
  847. hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
  848. MDIO_MMD_PMAPMD, &sfp_data);
  849. *eeprom_data = (u8)(sfp_data >> 8);
  850. } else {
  851. status = IXGBE_ERR_PHY;
  852. goto out;
  853. }
  854. out:
  855. return status;
  856. }
  857. /**
  858. * ixgbe_get_supported_physical_layer_82598 - Returns physical layer type
  859. * @hw: pointer to hardware structure
  860. *
  861. * Determines physical layer capabilities of the current configuration.
  862. **/
  863. static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
  864. {
  865. u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  866. u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
  867. u32 pma_pmd_10g = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK;
  868. u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
  869. u16 ext_ability = 0;
  870. hw->phy.ops.identify(hw);
  871. /* Copper PHY must be checked before AUTOC LMS to determine correct
  872. * physical layer because 10GBase-T PHYs use LMS = KX4/KX */
  873. if (hw->phy.type == ixgbe_phy_tn ||
  874. hw->phy.type == ixgbe_phy_cu_unknown) {
  875. hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD,
  876. &ext_ability);
  877. if (ext_ability & MDIO_PMA_EXTABLE_10GBT)
  878. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
  879. if (ext_ability & MDIO_PMA_EXTABLE_1000BT)
  880. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
  881. if (ext_ability & MDIO_PMA_EXTABLE_100BTX)
  882. physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
  883. goto out;
  884. }
  885. switch (autoc & IXGBE_AUTOC_LMS_MASK) {
  886. case IXGBE_AUTOC_LMS_1G_AN:
  887. case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
  888. if (pma_pmd_1g == IXGBE_AUTOC_1G_KX)
  889. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  890. else
  891. physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_BX;
  892. break;
  893. case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
  894. if (pma_pmd_10g == IXGBE_AUTOC_10G_CX4)
  895. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
  896. else if (pma_pmd_10g == IXGBE_AUTOC_10G_KX4)
  897. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  898. else /* XAUI */
  899. physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  900. break;
  901. case IXGBE_AUTOC_LMS_KX4_AN:
  902. case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
  903. if (autoc & IXGBE_AUTOC_KX_SUPP)
  904. physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX;
  905. if (autoc & IXGBE_AUTOC_KX4_SUPP)
  906. physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
  907. break;
  908. default:
  909. break;
  910. }
  911. if (hw->phy.type == ixgbe_phy_nl) {
  912. hw->phy.ops.identify_sfp(hw);
  913. switch (hw->phy.sfp_type) {
  914. case ixgbe_sfp_type_da_cu:
  915. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  916. break;
  917. case ixgbe_sfp_type_sr:
  918. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  919. break;
  920. case ixgbe_sfp_type_lr:
  921. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  922. break;
  923. default:
  924. physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
  925. break;
  926. }
  927. }
  928. switch (hw->device_id) {
  929. case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
  930. physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
  931. break;
  932. case IXGBE_DEV_ID_82598AF_DUAL_PORT:
  933. case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
  934. case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
  935. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
  936. break;
  937. case IXGBE_DEV_ID_82598EB_XF_LR:
  938. physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
  939. break;
  940. default:
  941. break;
  942. }
  943. out:
  944. return physical_layer;
  945. }
  946. static struct ixgbe_mac_operations mac_ops_82598 = {
  947. .init_hw = &ixgbe_init_hw_generic,
  948. .reset_hw = &ixgbe_reset_hw_82598,
  949. .start_hw = &ixgbe_start_hw_generic,
  950. .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
  951. .get_media_type = &ixgbe_get_media_type_82598,
  952. .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82598,
  953. .enable_rx_dma = &ixgbe_enable_rx_dma_generic,
  954. .get_mac_addr = &ixgbe_get_mac_addr_generic,
  955. .stop_adapter = &ixgbe_stop_adapter_generic,
  956. .get_bus_info = &ixgbe_get_bus_info_generic,
  957. .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
  958. .read_analog_reg8 = &ixgbe_read_analog_reg8_82598,
  959. .write_analog_reg8 = &ixgbe_write_analog_reg8_82598,
  960. .setup_link = &ixgbe_setup_mac_link_82598,
  961. .setup_link_speed = &ixgbe_setup_mac_link_speed_82598,
  962. .check_link = &ixgbe_check_mac_link_82598,
  963. .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
  964. .led_on = &ixgbe_led_on_generic,
  965. .led_off = &ixgbe_led_off_generic,
  966. .blink_led_start = &ixgbe_blink_led_start_generic,
  967. .blink_led_stop = &ixgbe_blink_led_stop_generic,
  968. .set_rar = &ixgbe_set_rar_generic,
  969. .clear_rar = &ixgbe_clear_rar_generic,
  970. .set_vmdq = &ixgbe_set_vmdq_82598,
  971. .clear_vmdq = &ixgbe_clear_vmdq_82598,
  972. .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
  973. .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic,
  974. .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
  975. .enable_mc = &ixgbe_enable_mc_generic,
  976. .disable_mc = &ixgbe_disable_mc_generic,
  977. .clear_vfta = &ixgbe_clear_vfta_82598,
  978. .set_vfta = &ixgbe_set_vfta_82598,
  979. .fc_enable = &ixgbe_fc_enable_82598,
  980. };
  981. static struct ixgbe_eeprom_operations eeprom_ops_82598 = {
  982. .init_params = &ixgbe_init_eeprom_params_generic,
  983. .read = &ixgbe_read_eeprom_generic,
  984. .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
  985. .update_checksum = &ixgbe_update_eeprom_checksum_generic,
  986. };
  987. static struct ixgbe_phy_operations phy_ops_82598 = {
  988. .identify = &ixgbe_identify_phy_generic,
  989. .identify_sfp = &ixgbe_identify_sfp_module_generic,
  990. .init = &ixgbe_init_phy_ops_82598,
  991. .reset = &ixgbe_reset_phy_generic,
  992. .read_reg = &ixgbe_read_phy_reg_generic,
  993. .write_reg = &ixgbe_write_phy_reg_generic,
  994. .setup_link = &ixgbe_setup_phy_link_generic,
  995. .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
  996. .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598,
  997. };
  998. struct ixgbe_info ixgbe_82598_info = {
  999. .mac = ixgbe_mac_82598EB,
  1000. .get_invariants = &ixgbe_get_invariants_82598,
  1001. .mac_ops = &mac_ops_82598,
  1002. .eeprom_ops = &eeprom_ops_82598,
  1003. .phy_ops = &phy_ops_82598,
  1004. };