1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001-2018
6 #include "ixgbe_common.h"
8 #define IXGBE_EMPTY_PARAM
10 static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
11 IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
14 static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
15 IXGBE_MVALS_INIT(_X540)
18 static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
19 IXGBE_MVALS_INIT(_X550)
22 static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
23 IXGBE_MVALS_INIT(_X550EM_x)
26 static const u32 ixgbe_mvals_X550EM_a[IXGBE_MVALS_IDX_LIMIT] = {
27 IXGBE_MVALS_INIT(_X550EM_a)
31 * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
32 * @hw: pointer to hardware structure
33 * @map: pointer to u8 arr for returning map
35 * Read the rtrup2tc HW register and resolve its content into map
37 void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
39 if (hw->mac.ops.get_rtrup2tc)
40 hw->mac.ops.get_rtrup2tc(hw, map);
44 * ixgbe_init_shared_code - Initialize the shared code
45 * @hw: pointer to hardware structure
47 * This will assign function pointers and assign the MAC type and PHY code.
48 * Does not touch the hardware. This function must be called prior to any
49 * other function in the shared code. The ixgbe_hw structure should be
50 * memset to 0 prior to calling this function. The following fields in
51 * hw structure should be filled in prior to calling this function:
52 * hw_addr, back, device_id, vendor_id, subsystem_device_id,
53 * subsystem_vendor_id, and revision_id
55 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
59 DEBUGFUNC("ixgbe_init_shared_code");
64 ixgbe_set_mac_type(hw);
66 switch (hw->mac.type) {
67 case ixgbe_mac_82598EB:
68 status = ixgbe_init_ops_82598(hw);
70 case ixgbe_mac_82599EB:
71 status = ixgbe_init_ops_82599(hw);
74 status = ixgbe_init_ops_X540(hw);
77 status = ixgbe_init_ops_X550(hw);
79 case ixgbe_mac_X550EM_x:
80 status = ixgbe_init_ops_X550EM_x(hw);
82 case ixgbe_mac_X550EM_a:
83 status = ixgbe_init_ops_X550EM_a(hw);
85 case ixgbe_mac_82599_vf:
86 case ixgbe_mac_X540_vf:
87 case ixgbe_mac_X550_vf:
88 case ixgbe_mac_X550EM_x_vf:
89 case ixgbe_mac_X550EM_a_vf:
90 status = ixgbe_init_ops_vf(hw);
93 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
96 hw->mac.max_link_up_time = IXGBE_LINK_UP_TIME;
102 * ixgbe_set_mac_type - Sets MAC type
103 * @hw: pointer to the HW structure
105 * This function sets the mac type of the adapter based on the
106 * vendor ID and device ID stored in the hw structure.
108 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
110 s32 ret_val = IXGBE_SUCCESS;
112 DEBUGFUNC("ixgbe_set_mac_type\n");
114 if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
115 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
116 "Unsupported vendor id: %x", hw->vendor_id);
117 return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
120 hw->mvals = ixgbe_mvals_base;
122 switch (hw->device_id) {
123 case IXGBE_DEV_ID_82598:
124 case IXGBE_DEV_ID_82598_BX:
125 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
126 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
127 case IXGBE_DEV_ID_82598AT:
128 case IXGBE_DEV_ID_82598AT2:
129 case IXGBE_DEV_ID_82598EB_CX4:
130 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
131 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
132 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
133 case IXGBE_DEV_ID_82598EB_XF_LR:
134 case IXGBE_DEV_ID_82598EB_SFP_LOM:
135 hw->mac.type = ixgbe_mac_82598EB;
137 case IXGBE_DEV_ID_82599_KX4:
138 case IXGBE_DEV_ID_82599_KX4_MEZZ:
139 case IXGBE_DEV_ID_82599_XAUI_LOM:
140 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
141 case IXGBE_DEV_ID_82599_KR:
142 case IXGBE_DEV_ID_82599_SFP:
143 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
144 case IXGBE_DEV_ID_82599_SFP_FCOE:
145 case IXGBE_DEV_ID_82599_SFP_EM:
146 case IXGBE_DEV_ID_82599_SFP_SF2:
147 case IXGBE_DEV_ID_82599_SFP_SF_QP:
148 case IXGBE_DEV_ID_82599_QSFP_SF_QP:
149 case IXGBE_DEV_ID_82599EN_SFP:
150 case IXGBE_DEV_ID_82599_CX4:
151 case IXGBE_DEV_ID_82599_T3_LOM:
152 hw->mac.type = ixgbe_mac_82599EB;
154 case IXGBE_DEV_ID_82599_VF:
155 case IXGBE_DEV_ID_82599_VF_HV:
156 hw->mac.type = ixgbe_mac_82599_vf;
158 case IXGBE_DEV_ID_X540_VF:
159 case IXGBE_DEV_ID_X540_VF_HV:
160 hw->mac.type = ixgbe_mac_X540_vf;
161 hw->mvals = ixgbe_mvals_X540;
163 case IXGBE_DEV_ID_X540T:
164 case IXGBE_DEV_ID_X540T1:
165 hw->mac.type = ixgbe_mac_X540;
166 hw->mvals = ixgbe_mvals_X540;
168 case IXGBE_DEV_ID_X550T:
169 case IXGBE_DEV_ID_X550T1:
170 hw->mac.type = ixgbe_mac_X550;
171 hw->mvals = ixgbe_mvals_X550;
173 case IXGBE_DEV_ID_X550EM_X_KX4:
174 case IXGBE_DEV_ID_X550EM_X_KR:
175 case IXGBE_DEV_ID_X550EM_X_10G_T:
176 case IXGBE_DEV_ID_X550EM_X_1G_T:
177 case IXGBE_DEV_ID_X550EM_X_SFP:
178 case IXGBE_DEV_ID_X550EM_X_XFI:
179 hw->mac.type = ixgbe_mac_X550EM_x;
180 hw->mvals = ixgbe_mvals_X550EM_x;
182 case IXGBE_DEV_ID_X550EM_A_KR:
183 case IXGBE_DEV_ID_X550EM_A_KR_L:
184 case IXGBE_DEV_ID_X550EM_A_SFP_N:
185 case IXGBE_DEV_ID_X550EM_A_SGMII:
186 case IXGBE_DEV_ID_X550EM_A_SGMII_L:
187 case IXGBE_DEV_ID_X550EM_A_1G_T:
188 case IXGBE_DEV_ID_X550EM_A_1G_T_L:
189 case IXGBE_DEV_ID_X550EM_A_10G_T:
190 case IXGBE_DEV_ID_X550EM_A_QSFP:
191 case IXGBE_DEV_ID_X550EM_A_QSFP_N:
192 case IXGBE_DEV_ID_X550EM_A_SFP:
193 hw->mac.type = ixgbe_mac_X550EM_a;
194 hw->mvals = ixgbe_mvals_X550EM_a;
196 case IXGBE_DEV_ID_X550_VF:
197 case IXGBE_DEV_ID_X550_VF_HV:
198 hw->mac.type = ixgbe_mac_X550_vf;
199 hw->mvals = ixgbe_mvals_X550;
201 case IXGBE_DEV_ID_X550EM_X_VF:
202 case IXGBE_DEV_ID_X550EM_X_VF_HV:
203 hw->mac.type = ixgbe_mac_X550EM_x_vf;
204 hw->mvals = ixgbe_mvals_X550EM_x;
206 case IXGBE_DEV_ID_X550EM_A_VF:
207 case IXGBE_DEV_ID_X550EM_A_VF_HV:
208 hw->mac.type = ixgbe_mac_X550EM_a_vf;
209 hw->mvals = ixgbe_mvals_X550EM_a;
212 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
213 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
214 "Unsupported device id: %x",
219 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
220 hw->mac.type, ret_val);
225 * ixgbe_init_hw - Initialize the hardware
226 * @hw: pointer to hardware structure
228 * Initialize the hardware by resetting and then starting the hardware
230 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
232 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
233 IXGBE_NOT_IMPLEMENTED);
237 * ixgbe_reset_hw - Performs a hardware reset
238 * @hw: pointer to hardware structure
240 * Resets the hardware by resetting the transmit and receive units, masks and
241 * clears all interrupts, performs a PHY reset, and performs a MAC reset
243 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
245 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
246 IXGBE_NOT_IMPLEMENTED);
250 * ixgbe_start_hw - Prepares hardware for Rx/Tx
251 * @hw: pointer to hardware structure
253 * Starts the hardware by filling the bus info structure and media type,
254 * clears all on chip counters, initializes receive address registers,
255 * multicast table, VLAN filter table, calls routine to setup link and
256 * flow control settings, and leaves transmit and receive units disabled
259 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
261 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
262 IXGBE_NOT_IMPLEMENTED);
266 * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
267 * which is disabled by default in ixgbe_start_hw();
269 * @hw: pointer to hardware structure
271 * Enable relaxed ordering;
273 void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
275 if (hw->mac.ops.enable_relaxed_ordering)
276 hw->mac.ops.enable_relaxed_ordering(hw);
280 * ixgbe_clear_hw_cntrs - Clear hardware counters
281 * @hw: pointer to hardware structure
283 * Clears all hardware statistics counters by reading them from the hardware
284 * Statistics counters are clear on read.
286 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
288 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
289 IXGBE_NOT_IMPLEMENTED);
293 * ixgbe_get_media_type - Get media type
294 * @hw: pointer to hardware structure
296 * Returns the media type (fiber, copper, backplane)
298 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
300 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
301 ixgbe_media_type_unknown);
305 * ixgbe_get_mac_addr - Get MAC address
306 * @hw: pointer to hardware structure
307 * @mac_addr: Adapter MAC address
309 * Reads the adapter's MAC address from the first Receive Address Register
310 * (RAR0) A reset of the adapter must have been performed prior to calling
311 * this function in order for the MAC address to have been loaded from the
314 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
316 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
317 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
321 * ixgbe_get_san_mac_addr - Get SAN MAC address
322 * @hw: pointer to hardware structure
323 * @san_mac_addr: SAN MAC address
325 * Reads the SAN MAC address from the EEPROM, if it's available. This is
326 * per-port, so set_lan_id() must be called before reading the addresses.
328 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
330 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
331 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
335 * ixgbe_set_san_mac_addr - Write a SAN MAC address
336 * @hw: pointer to hardware structure
337 * @san_mac_addr: SAN MAC address
339 * Writes A SAN MAC address to the EEPROM.
341 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
343 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
344 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
348 * ixgbe_get_device_caps - Get additional device capabilities
349 * @hw: pointer to hardware structure
350 * @device_caps: the EEPROM word for device capabilities
352 * Reads the extra device capabilities from the EEPROM
354 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
356 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
357 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
361 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
362 * @hw: pointer to hardware structure
363 * @wwnn_prefix: the alternative WWNN prefix
364 * @wwpn_prefix: the alternative WWPN prefix
366 * This function will read the EEPROM from the alternative SAN MAC address
367 * block to check the support for the alternative WWNN/WWPN prefix support.
369 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
372 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
373 (hw, wwnn_prefix, wwpn_prefix),
374 IXGBE_NOT_IMPLEMENTED);
378 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
379 * @hw: pointer to hardware structure
380 * @bs: the fcoe boot status
382 * This function will read the FCOE boot status from the iSCSI FCOE block
384 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
386 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
388 IXGBE_NOT_IMPLEMENTED);
392 * ixgbe_get_bus_info - Set PCI bus info
393 * @hw: pointer to hardware structure
395 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
397 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
399 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
400 IXGBE_NOT_IMPLEMENTED);
404 * ixgbe_get_num_of_tx_queues - Get Tx queues
405 * @hw: pointer to hardware structure
407 * Returns the number of transmit queues for the given adapter.
409 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
411 return hw->mac.max_tx_queues;
415 * ixgbe_get_num_of_rx_queues - Get Rx queues
416 * @hw: pointer to hardware structure
418 * Returns the number of receive queues for the given adapter.
420 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
422 return hw->mac.max_rx_queues;
426 * ixgbe_stop_adapter - Disable Rx/Tx units
427 * @hw: pointer to hardware structure
429 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
430 * disables transmit and receive units. The adapter_stopped flag is used by
431 * the shared code and drivers to determine if the adapter is in a stopped
432 * state and should not touch the hardware.
434 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
436 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
437 IXGBE_NOT_IMPLEMENTED);
441 * ixgbe_read_pba_string - Reads part number string from EEPROM
442 * @hw: pointer to hardware structure
443 * @pba_num: stores the part number string from the EEPROM
444 * @pba_num_size: part number string buffer length
446 * Reads the part number string from the EEPROM.
448 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
450 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
454 * ixgbe_read_pba_num - Reads part number from EEPROM
455 * @hw: pointer to hardware structure
456 * @pba_num: stores the part number from the EEPROM
458 * Reads the part number from the EEPROM.
460 s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
462 return ixgbe_read_pba_num_generic(hw, pba_num);
466 * ixgbe_identify_phy - Get PHY type
467 * @hw: pointer to hardware structure
469 * Determines the physical layer module found on the current adapter.
471 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
473 s32 status = IXGBE_SUCCESS;
475 if (hw->phy.type == ixgbe_phy_unknown) {
476 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
477 IXGBE_NOT_IMPLEMENTED);
484 * ixgbe_reset_phy - Perform a PHY reset
485 * @hw: pointer to hardware structure
487 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
489 s32 status = IXGBE_SUCCESS;
491 if (hw->phy.type == ixgbe_phy_unknown) {
492 if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
493 status = IXGBE_ERR_PHY;
496 if (status == IXGBE_SUCCESS) {
497 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
498 IXGBE_NOT_IMPLEMENTED);
504 * ixgbe_get_phy_firmware_version -
505 * @hw: pointer to hardware structure
506 * @firmware_version: pointer to firmware version
508 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
510 s32 status = IXGBE_SUCCESS;
512 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
513 (hw, firmware_version),
514 IXGBE_NOT_IMPLEMENTED);
519 * ixgbe_read_phy_reg - Read PHY register
520 * @hw: pointer to hardware structure
521 * @reg_addr: 32 bit address of PHY register to read
522 * @device_type: type of device you want to communicate with
523 * @phy_data: Pointer to read data from PHY register
525 * Reads a value from a specified PHY register
527 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
531 ixgbe_identify_phy(hw);
533 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
534 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
538 * ixgbe_write_phy_reg - Write PHY register
539 * @hw: pointer to hardware structure
540 * @reg_addr: 32 bit PHY register to write
541 * @device_type: type of device you want to communicate with
542 * @phy_data: Data to write to the PHY register
544 * Writes a value to specified PHY register
546 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
550 ixgbe_identify_phy(hw);
552 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
553 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
557 * ixgbe_setup_phy_link - Restart PHY autoneg
558 * @hw: pointer to hardware structure
560 * Restart autonegotiation and PHY and waits for completion.
562 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
564 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
565 IXGBE_NOT_IMPLEMENTED);
569 * ixgbe_setup_internal_phy - Configure integrated PHY
570 * @hw: pointer to hardware structure
572 * Reconfigure the integrated PHY in order to enable talk to the external PHY.
573 * Returns success if not implemented, since nothing needs to be done in this
576 s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw)
578 return ixgbe_call_func(hw, hw->phy.ops.setup_internal_link, (hw),
583 * ixgbe_check_phy_link - Determine link and speed status
584 * @hw: pointer to hardware structure
586 * @link_up: true when link is up
588 * Reads a PHY register to determine if link is up and the current speed for
591 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
594 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
595 link_up), IXGBE_NOT_IMPLEMENTED);
599 * ixgbe_setup_phy_link_speed - Set auto advertise
600 * @hw: pointer to hardware structure
601 * @speed: new link speed
602 * @autoneg_wait_to_complete: true when waiting for completion is needed
604 * Sets the auto advertised capabilities
606 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
607 bool autoneg_wait_to_complete)
609 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
610 autoneg_wait_to_complete),
611 IXGBE_NOT_IMPLEMENTED);
615 * ixgbe_set_phy_power - Control the phy power state
616 * @hw: pointer to hardware structure
617 * @on: true for on, false for off
619 s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on)
621 return ixgbe_call_func(hw, hw->phy.ops.set_phy_power, (hw, on),
622 IXGBE_NOT_IMPLEMENTED);
626 * ixgbe_check_link - Get link and speed status
627 * @hw: pointer to hardware structure
628 * @speed: pointer to link speed
629 * @link_up: true when link is up
630 * @link_up_wait_to_complete: bool used to wait for link up or not
632 * Reads the links register to determine if link is up and the current speed
634 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
635 bool *link_up, bool link_up_wait_to_complete)
637 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
638 link_up, link_up_wait_to_complete),
639 IXGBE_NOT_IMPLEMENTED);
643 * ixgbe_disable_tx_laser - Disable Tx laser
644 * @hw: pointer to hardware structure
646 * If the driver needs to disable the laser on SFI optics.
648 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
650 if (hw->mac.ops.disable_tx_laser)
651 hw->mac.ops.disable_tx_laser(hw);
655 * ixgbe_enable_tx_laser - Enable Tx laser
656 * @hw: pointer to hardware structure
658 * If the driver needs to enable the laser on SFI optics.
660 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
662 if (hw->mac.ops.enable_tx_laser)
663 hw->mac.ops.enable_tx_laser(hw);
667 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
668 * @hw: pointer to hardware structure
670 * When the driver changes the link speeds that it can support then
671 * flap the tx laser to alert the link partner to start autotry
672 * process on its end.
674 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
676 if (hw->mac.ops.flap_tx_laser)
677 hw->mac.ops.flap_tx_laser(hw);
681 * ixgbe_setup_link - Set link speed
682 * @hw: pointer to hardware structure
683 * @speed: new link speed
684 * @autoneg_wait_to_complete: true when waiting for completion is needed
686 * Configures link settings. Restarts the link.
687 * Performs autonegotiation if needed.
689 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
690 bool autoneg_wait_to_complete)
692 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
693 autoneg_wait_to_complete),
694 IXGBE_NOT_IMPLEMENTED);
698 * ixgbe_setup_mac_link - Set link speed
699 * @hw: pointer to hardware structure
700 * @speed: new link speed
701 * @autoneg_wait_to_complete: true when waiting for completion is needed
703 * Configures link settings. Restarts the link.
704 * Performs autonegotiation if needed.
706 s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
707 bool autoneg_wait_to_complete)
709 return ixgbe_call_func(hw, hw->mac.ops.setup_mac_link, (hw, speed,
710 autoneg_wait_to_complete),
711 IXGBE_NOT_IMPLEMENTED);
715 * ixgbe_get_link_capabilities - Returns link capabilities
716 * @hw: pointer to hardware structure
717 * @speed: link speed capabilities
718 * @autoneg: true when autoneg or autotry is enabled
720 * Determines the link capabilities of the current configuration.
722 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
725 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
726 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
730 * ixgbe_led_on - Turn on LEDs
731 * @hw: pointer to hardware structure
732 * @index: led number to turn on
734 * Turns on the software controllable LEDs.
736 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
738 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
739 IXGBE_NOT_IMPLEMENTED);
743 * ixgbe_led_off - Turn off LEDs
744 * @hw: pointer to hardware structure
745 * @index: led number to turn off
747 * Turns off the software controllable LEDs.
749 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
751 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
752 IXGBE_NOT_IMPLEMENTED);
756 * ixgbe_blink_led_start - Blink LEDs
757 * @hw: pointer to hardware structure
758 * @index: led number to blink
760 * Blink LED based on index.
762 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
764 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
765 IXGBE_NOT_IMPLEMENTED);
769 * ixgbe_blink_led_stop - Stop blinking LEDs
770 * @hw: pointer to hardware structure
771 * @index: led number to stop
773 * Stop blinking LED based on index.
775 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
777 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
778 IXGBE_NOT_IMPLEMENTED);
782 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
783 * @hw: pointer to hardware structure
785 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
786 * ixgbe_hw struct in order to set up EEPROM access.
788 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
790 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
791 IXGBE_NOT_IMPLEMENTED);
796 * ixgbe_write_eeprom - Write word to EEPROM
797 * @hw: pointer to hardware structure
798 * @offset: offset within the EEPROM to be written to
799 * @data: 16 bit word to be written to the EEPROM
801 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
802 * called after this function, the EEPROM will most likely contain an
805 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
807 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
808 IXGBE_NOT_IMPLEMENTED);
812 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
813 * @hw: pointer to hardware structure
814 * @offset: offset within the EEPROM to be written to
815 * @data: 16 bit word(s) to be written to the EEPROM
816 * @words: number of words
818 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
819 * called after this function, the EEPROM will most likely contain an
822 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
825 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
826 (hw, offset, words, data),
827 IXGBE_NOT_IMPLEMENTED);
831 * ixgbe_read_eeprom - Read word from EEPROM
832 * @hw: pointer to hardware structure
833 * @offset: offset within the EEPROM to be read
834 * @data: read 16 bit value from EEPROM
836 * Reads 16 bit value from EEPROM
838 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
840 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
841 IXGBE_NOT_IMPLEMENTED);
845 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
846 * @hw: pointer to hardware structure
847 * @offset: offset within the EEPROM to be read
848 * @data: read 16 bit word(s) from EEPROM
849 * @words: number of words
851 * Reads 16 bit word(s) from EEPROM
853 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
854 u16 words, u16 *data)
856 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
857 (hw, offset, words, data),
858 IXGBE_NOT_IMPLEMENTED);
862 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
863 * @hw: pointer to hardware structure
864 * @checksum_val: calculated checksum
866 * Performs checksum calculation and validates the EEPROM checksum
868 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
870 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
871 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
875 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
876 * @hw: pointer to hardware structure
878 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
880 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
881 IXGBE_NOT_IMPLEMENTED);
885 * ixgbe_insert_mac_addr - Find a RAR for this mac address
886 * @hw: pointer to hardware structure
887 * @addr: Address to put into receive address register
888 * @vmdq: VMDq pool to assign
890 * Puts an ethernet address into a receive address register, or
891 * finds the rar that it is aleady in; adds to the pool list
893 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
895 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
897 IXGBE_NOT_IMPLEMENTED);
901 * ixgbe_set_rar - Set Rx address register
902 * @hw: pointer to hardware structure
903 * @index: Receive address register to write
904 * @addr: Address to put into receive address register
906 * @enable_addr: set flag that address is active
908 * Puts an ethernet address into a receive address register.
910 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
913 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
914 enable_addr), IXGBE_NOT_IMPLEMENTED);
918 * ixgbe_clear_rar - Clear Rx address register
919 * @hw: pointer to hardware structure
920 * @index: Receive address register to write
922 * Puts an ethernet address into a receive address register.
924 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
926 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
927 IXGBE_NOT_IMPLEMENTED);
931 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
932 * @hw: pointer to hardware structure
933 * @rar: receive address register index to associate with VMDq index
934 * @vmdq: VMDq set or pool index
936 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
938 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
939 IXGBE_NOT_IMPLEMENTED);
944 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
945 * @hw: pointer to hardware structure
946 * @vmdq: VMDq default pool index
948 s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
950 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
951 (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
955 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
956 * @hw: pointer to hardware structure
957 * @rar: receive address register index to disassociate with VMDq index
958 * @vmdq: VMDq set or pool index
960 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
962 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
963 IXGBE_NOT_IMPLEMENTED);
967 * ixgbe_init_rx_addrs - Initializes receive address filters.
968 * @hw: pointer to hardware structure
970 * Places the MAC address in receive address register 0 and clears the rest
971 * of the receive address registers. Clears the multicast table. Assumes
972 * the receiver is in reset when the routine is called.
974 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
976 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
977 IXGBE_NOT_IMPLEMENTED);
981 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
982 * @hw: pointer to hardware structure
984 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
986 return hw->mac.num_rar_entries;
990 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
991 * @hw: pointer to hardware structure
992 * @addr_list: the list of new multicast addresses
993 * @addr_count: number of addresses
994 * @func: iterator function to walk the multicast address list
996 * The given list replaces any existing list. Clears the secondary addrs from
997 * receive address registers. Uses unused receive address registers for the
998 * first secondary addresses, and falls back to promiscuous mode as needed.
1000 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
1001 u32 addr_count, ixgbe_mc_addr_itr func)
1003 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
1004 addr_list, addr_count, func),
1005 IXGBE_NOT_IMPLEMENTED);
1009 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
1010 * @hw: pointer to hardware structure
1011 * @mc_addr_list: the list of new multicast addresses
1012 * @mc_addr_count: number of addresses
1013 * @func: iterator function to walk the multicast address list
1014 * @clear: flag, when set clears the table beforehand
1016 * The given list replaces any existing list. Clears the MC addrs from receive
1017 * address registers and the multicast table. Uses unused receive address
1018 * registers for the first multicast addresses, and hashes the rest into the
1021 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
1022 u32 mc_addr_count, ixgbe_mc_addr_itr func,
1025 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
1026 mc_addr_list, mc_addr_count, func, clear),
1027 IXGBE_NOT_IMPLEMENTED);
1031 * ixgbe_enable_mc - Enable multicast address in RAR
1032 * @hw: pointer to hardware structure
1034 * Enables multicast address in RAR and the use of the multicast hash table.
1036 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
1038 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
1039 IXGBE_NOT_IMPLEMENTED);
1043 * ixgbe_disable_mc - Disable multicast address in RAR
1044 * @hw: pointer to hardware structure
1046 * Disables multicast address in RAR and the use of the multicast hash table.
1048 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
1050 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
1051 IXGBE_NOT_IMPLEMENTED);
1055 * ixgbe_clear_vfta - Clear VLAN filter table
1056 * @hw: pointer to hardware structure
1058 * Clears the VLAN filer table, and the VMDq index associated with the filter
1060 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
1062 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
1063 IXGBE_NOT_IMPLEMENTED);
1067 * ixgbe_set_vfta - Set VLAN filter table
1068 * @hw: pointer to hardware structure
1069 * @vlan: VLAN id to write to VLAN filter
1070 * @vind: VMDq output index that maps queue to VLAN id in VLVFB
1071 * @vlan_on: boolean flag to turn on/off VLAN
1072 * @vlvf_bypass: boolean flag indicating updating the default pool is okay
1074 * Turn on/off specified VLAN in the VLAN filter table.
1076 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
1079 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
1080 vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
1084 * ixgbe_set_vlvf - Set VLAN Pool Filter
1085 * @hw: pointer to hardware structure
1086 * @vlan: VLAN id to write to VLAN filter
1087 * @vind: VMDq output index that maps queue to VLAN id in VLVFB
1088 * @vlan_on: boolean flag to turn on/off VLAN in VLVF
1089 * @vfta_delta: pointer to the difference between the current value of VFTA
1090 * and the desired value
1091 * @vfta: the desired value of the VFTA
1092 * @vlvf_bypass: boolean flag indicating updating the default pool is okay
1094 * Turn on/off specified bit in VLVF table.
1096 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
1097 u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
1099 return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
1100 vlan_on, vfta_delta, vfta, vlvf_bypass),
1101 IXGBE_NOT_IMPLEMENTED);
1105 * ixgbe_fc_enable - Enable flow control
1106 * @hw: pointer to hardware structure
1108 * Configures the flow control settings based on SW configuration.
1110 s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
1112 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
1113 IXGBE_NOT_IMPLEMENTED);
1117 * ixgbe_setup_fc - Set up flow control
1118 * @hw: pointer to hardware structure
1120 * Called at init time to set up flow control.
1122 s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
1124 return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw),
1125 IXGBE_NOT_IMPLEMENTED);
1129 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
1130 * @hw: pointer to hardware structure
1131 * @maj: driver major number to be sent to firmware
1132 * @min: driver minor number to be sent to firmware
1133 * @build: driver build number to be sent to firmware
1134 * @ver: driver version number to be sent to firmware
1135 * @len: length of driver_ver string
1136 * @driver_ver: driver string
1138 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
1139 u8 ver, u16 len, char *driver_ver)
1141 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
1142 build, ver, len, driver_ver),
1143 IXGBE_NOT_IMPLEMENTED);
1148 * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data
1149 * @hw: pointer to hardware structure
1151 * Updates the temperatures in mac.thermal_sensor_data
1153 s32 ixgbe_get_thermal_sensor_data(struct ixgbe_hw *hw)
1155 return ixgbe_call_func(hw, hw->mac.ops.get_thermal_sensor_data, (hw),
1156 IXGBE_NOT_IMPLEMENTED);
1160 * ixgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds
1161 * @hw: pointer to hardware structure
1163 * Inits the thermal sensor thresholds according to the NVM map
1165 s32 ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw *hw)
1167 return ixgbe_call_func(hw, hw->mac.ops.init_thermal_sensor_thresh, (hw),
1168 IXGBE_NOT_IMPLEMENTED);
1172 * ixgbe_dmac_config - Configure DMA Coalescing registers.
1173 * @hw: pointer to hardware structure
1175 * Configure DMA coalescing. If enabling dmac, dmac is activated.
1176 * When disabling dmac, dmac enable dmac bit is cleared.
1178 s32 ixgbe_dmac_config(struct ixgbe_hw *hw)
1180 return ixgbe_call_func(hw, hw->mac.ops.dmac_config, (hw),
1181 IXGBE_NOT_IMPLEMENTED);
1185 * ixgbe_dmac_update_tcs - Configure DMA Coalescing registers.
1186 * @hw: pointer to hardware structure
1188 * Disables dmac, updates per TC settings, and then enable dmac.
1190 s32 ixgbe_dmac_update_tcs(struct ixgbe_hw *hw)
1192 return ixgbe_call_func(hw, hw->mac.ops.dmac_update_tcs, (hw),
1193 IXGBE_NOT_IMPLEMENTED);
1197 * ixgbe_dmac_config_tcs - Configure DMA Coalescing registers.
1198 * @hw: pointer to hardware structure
1200 * Configure DMA coalescing threshold per TC and set high priority bit for
1201 * FCOE TC. The dmac enable bit must be cleared before configuring.
1203 s32 ixgbe_dmac_config_tcs(struct ixgbe_hw *hw)
1205 return ixgbe_call_func(hw, hw->mac.ops.dmac_config_tcs, (hw),
1206 IXGBE_NOT_IMPLEMENTED);
1210 * ixgbe_setup_eee - Enable/disable EEE support
1211 * @hw: pointer to the HW structure
1212 * @enable_eee: boolean flag to enable EEE
1214 * Enable/disable EEE based on enable_ee flag.
1215 * Auto-negotiation must be started after BASE-T EEE bits in PHY register 7.3C
1219 s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_eee)
1221 return ixgbe_call_func(hw, hw->mac.ops.setup_eee, (hw, enable_eee),
1222 IXGBE_NOT_IMPLEMENTED);
1226 * ixgbe_set_source_address_pruning - Enable/Disable source address pruning
1227 * @hw: pointer to hardware structure
1228 * @enable: enable or disable source address pruning
1229 * @pool: Rx pool - Rx pool to toggle source address pruning
1231 void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable,
1234 if (hw->mac.ops.set_source_address_pruning)
1235 hw->mac.ops.set_source_address_pruning(hw, enable, pool);
1239 * ixgbe_set_ethertype_anti_spoofing - Enable/Disable Ethertype anti-spoofing
1240 * @hw: pointer to hardware structure
1241 * @enable: enable or disable switch for Ethertype anti-spoofing
1242 * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
1245 void ixgbe_set_ethertype_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
1247 if (hw->mac.ops.set_ethertype_anti_spoofing)
1248 hw->mac.ops.set_ethertype_anti_spoofing(hw, enable, vf);
1252 * ixgbe_read_iosf_sb_reg - Read 32 bit PHY register
1253 * @hw: pointer to hardware structure
1254 * @reg_addr: 32 bit address of PHY register to read
1255 * @device_type: type of device you want to communicate with
1256 * @phy_data: Pointer to read data from PHY register
1258 * Reads a value from a specified PHY register
1260 s32 ixgbe_read_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1261 u32 device_type, u32 *phy_data)
1263 return ixgbe_call_func(hw, hw->mac.ops.read_iosf_sb_reg, (hw, reg_addr,
1264 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1268 * ixgbe_write_iosf_sb_reg - Write 32 bit register through IOSF Sideband
1269 * @hw: pointer to hardware structure
1270 * @reg_addr: 32 bit PHY register to write
1271 * @device_type: type of device you want to communicate with
1272 * @phy_data: Data to write to the PHY register
1274 * Writes a value to specified PHY register
1276 s32 ixgbe_write_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1277 u32 device_type, u32 phy_data)
1279 return ixgbe_call_func(hw, hw->mac.ops.write_iosf_sb_reg, (hw, reg_addr,
1280 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1284 * ixgbe_disable_mdd - Disable malicious driver detection
1285 * @hw: pointer to hardware structure
1288 void ixgbe_disable_mdd(struct ixgbe_hw *hw)
1290 if (hw->mac.ops.disable_mdd)
1291 hw->mac.ops.disable_mdd(hw);
1295 * ixgbe_enable_mdd - Enable malicious driver detection
1296 * @hw: pointer to hardware structure
1299 void ixgbe_enable_mdd(struct ixgbe_hw *hw)
1301 if (hw->mac.ops.enable_mdd)
1302 hw->mac.ops.enable_mdd(hw);
1306 * ixgbe_mdd_event - Handle malicious driver detection event
1307 * @hw: pointer to hardware structure
1308 * @vf_bitmap: vf bitmap of malicious vfs
1311 void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap)
1313 if (hw->mac.ops.mdd_event)
1314 hw->mac.ops.mdd_event(hw, vf_bitmap);
1318 * ixgbe_restore_mdd_vf - Restore VF that was disabled during malicious driver
1320 * @hw: pointer to hardware structure
1324 void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
1326 if (hw->mac.ops.restore_mdd_vf)
1327 hw->mac.ops.restore_mdd_vf(hw, vf);
1331 * ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode
1332 * @hw: pointer to hardware structure
1335 bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw)
1337 if (hw->mac.ops.fw_recovery_mode)
1338 return hw->mac.ops.fw_recovery_mode(hw);
1343 * ixgbe_enter_lplu - Transition to low power states
1344 * @hw: pointer to hardware structure
1346 * Configures Low Power Link Up on transition to low power states
1347 * (from D0 to non-D0).
1349 s32 ixgbe_enter_lplu(struct ixgbe_hw *hw)
1351 return ixgbe_call_func(hw, hw->phy.ops.enter_lplu, (hw),
1352 IXGBE_NOT_IMPLEMENTED);
1356 * ixgbe_handle_lasi - Handle external Base T PHY interrupt
1357 * @hw: pointer to hardware structure
1359 * Handle external Base T PHY interrupt. If high temperature
1360 * failure alarm then return error, else if link status change
1361 * then setup internal/external PHY link
1363 * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature
1364 * failure alarm, else return PHY access status.
1366 s32 ixgbe_handle_lasi(struct ixgbe_hw *hw)
1368 return ixgbe_call_func(hw, hw->phy.ops.handle_lasi, (hw),
1369 IXGBE_NOT_IMPLEMENTED);
1373 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
1374 * @hw: pointer to hardware structure
1375 * @reg: analog register to read
1378 * Performs write operation to analog register specified.
1380 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1382 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1383 val), IXGBE_NOT_IMPLEMENTED);
1387 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
1388 * @hw: pointer to hardware structure
1389 * @reg: analog register to write
1390 * @val: value to write
1392 * Performs write operation to Atlas analog register specified.
1394 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1396 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1397 val), IXGBE_NOT_IMPLEMENTED);
1401 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1402 * @hw: pointer to hardware structure
1404 * Initializes the Unicast Table Arrays to zero on device load. This
1405 * is part of the Rx init addr execution path.
1407 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1409 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1410 IXGBE_NOT_IMPLEMENTED);
1414 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1415 * @hw: pointer to hardware structure
1416 * @byte_offset: byte offset to read
1417 * @dev_addr: I2C bus address to read from
1420 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1422 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1425 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1426 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1430 * ixgbe_read_i2c_byte_unlocked - Reads 8 bit word via I2C from device address
1431 * @hw: pointer to hardware structure
1432 * @byte_offset: byte offset to read
1433 * @dev_addr: I2C bus address to read from
1436 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1438 s32 ixgbe_read_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
1439 u8 dev_addr, u8 *data)
1441 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte_unlocked,
1442 (hw, byte_offset, dev_addr, data),
1443 IXGBE_NOT_IMPLEMENTED);
1447 * ixgbe_read_link - Perform read operation on link device
1448 * @hw: pointer to the hardware structure
1449 * @addr: bus address to read from
1450 * @reg: device register to read from
1451 * @val: pointer to location to receive read value
1453 * Returns an error code on error.
1455 s32 ixgbe_read_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
1457 return ixgbe_call_func(hw, hw->link.ops.read_link, (hw, addr,
1458 reg, val), IXGBE_NOT_IMPLEMENTED);
1462 * ixgbe_read_link_unlocked - Perform read operation on link device
1463 * @hw: pointer to the hardware structure
1464 * @addr: bus address to read from
1465 * @reg: device register to read from
1466 * @val: pointer to location to receive read value
1468 * Returns an error code on error.
1470 s32 ixgbe_read_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
1472 return ixgbe_call_func(hw, hw->link.ops.read_link_unlocked,
1473 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1477 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1478 * @hw: pointer to hardware structure
1479 * @byte_offset: byte offset to write
1480 * @dev_addr: I2C bus address to write to
1481 * @data: value to write
1483 * Performs byte write operation to SFP module's EEPROM over I2C interface
1484 * at a specified device address.
1486 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1489 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1490 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1494 * ixgbe_write_i2c_byte_unlocked - Writes 8 bit word over I2C
1495 * @hw: pointer to hardware structure
1496 * @byte_offset: byte offset to write
1497 * @dev_addr: I2C bus address to write to
1498 * @data: value to write
1500 * Performs byte write operation to SFP module's EEPROM over I2C interface
1501 * at a specified device address.
1503 s32 ixgbe_write_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
1504 u8 dev_addr, u8 data)
1506 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte_unlocked,
1507 (hw, byte_offset, dev_addr, data),
1508 IXGBE_NOT_IMPLEMENTED);
1512 * ixgbe_write_link - Perform write operation on link device
1513 * @hw: pointer to the hardware structure
1514 * @addr: bus address to write to
1515 * @reg: device register to write to
1516 * @val: value to write
1518 * Returns an error code on error.
1520 s32 ixgbe_write_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
1522 return ixgbe_call_func(hw, hw->link.ops.write_link,
1523 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1527 * ixgbe_write_link_unlocked - Perform write operation on link device
1528 * @hw: pointer to the hardware structure
1529 * @addr: bus address to write to
1530 * @reg: device register to write to
1531 * @val: value to write
1533 * Returns an error code on error.
1535 s32 ixgbe_write_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
1537 return ixgbe_call_func(hw, hw->link.ops.write_link_unlocked,
1538 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1542 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1543 * @hw: pointer to hardware structure
1544 * @byte_offset: EEPROM byte offset to write
1545 * @eeprom_data: value to write
1547 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1549 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1550 u8 byte_offset, u8 eeprom_data)
1552 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1553 (hw, byte_offset, eeprom_data),
1554 IXGBE_NOT_IMPLEMENTED);
1558 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1559 * @hw: pointer to hardware structure
1560 * @byte_offset: EEPROM byte offset to read
1561 * @eeprom_data: value read
1563 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1565 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1567 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1568 (hw, byte_offset, eeprom_data),
1569 IXGBE_NOT_IMPLEMENTED);
1573 * ixgbe_get_supported_physical_layer - Returns physical layer type
1574 * @hw: pointer to hardware structure
1576 * Determines physical layer capabilities of the current configuration.
1578 u64 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1580 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1581 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1585 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1586 * @hw: pointer to hardware structure
1587 * @regval: bitfield to write to the Rx DMA register
1589 * Enables the Rx DMA unit of the device.
1591 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1593 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1594 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1598 * ixgbe_disable_sec_rx_path - Stops the receive data path
1599 * @hw: pointer to hardware structure
1601 * Stops the receive data path.
1603 s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1605 return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1606 (hw), IXGBE_NOT_IMPLEMENTED);
1610 * ixgbe_enable_sec_rx_path - Enables the receive data path
1611 * @hw: pointer to hardware structure
1613 * Enables the receive data path.
1615 s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1617 return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1618 (hw), IXGBE_NOT_IMPLEMENTED);
1622 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1623 * @hw: pointer to hardware structure
1624 * @mask: Mask to specify which semaphore to acquire
1626 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1627 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1629 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1631 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1632 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1636 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1637 * @hw: pointer to hardware structure
1638 * @mask: Mask to specify which semaphore to release
1640 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1641 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1643 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1645 if (hw->mac.ops.release_swfw_sync)
1646 hw->mac.ops.release_swfw_sync(hw, mask);
1650 * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore
1651 * @hw: pointer to hardware structure
1653 * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register.
1654 * Regardless of whether is succeeds or not it then release the semaphore.
1655 * This is function is called to recover from catastrophic failures that
1656 * may have left the semaphore locked.
1658 void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
1660 if (hw->mac.ops.init_swfw_sync)
1661 hw->mac.ops.init_swfw_sync(hw);
1665 void ixgbe_disable_rx(struct ixgbe_hw *hw)
1667 if (hw->mac.ops.disable_rx)
1668 hw->mac.ops.disable_rx(hw);
1671 void ixgbe_enable_rx(struct ixgbe_hw *hw)
1673 if (hw->mac.ops.enable_rx)
1674 hw->mac.ops.enable_rx(hw);
1678 * ixgbe_set_rate_select_speed - Set module link speed
1679 * @hw: pointer to hardware structure
1680 * @speed: link speed to set
1682 * Set module link speed via the rate select.
1684 void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
1686 if (hw->mac.ops.set_rate_select_speed)
1687 hw->mac.ops.set_rate_select_speed(hw, speed);