1 /*******************************************************************************
3 Copyright (c) 2001-2012, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ***************************************************************************/
34 #include "ixgbe_api.h"
35 #include "ixgbe_common.h"
37 extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
38 extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
39 extern s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw);
40 extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
43 * ixgbe_init_shared_code - Initialize the shared code
44 * @hw: pointer to hardware structure
46 * This will assign function pointers and assign the MAC type and PHY code.
47 * Does not touch the hardware. This function must be called prior to any
48 * other function in the shared code. The ixgbe_hw structure should be
49 * memset to 0 prior to calling this function. The following fields in
50 * hw structure should be filled in prior to calling this function:
51 * hw_addr, back, device_id, vendor_id, subsystem_device_id,
52 * subsystem_vendor_id, and revision_id
54 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
58 DEBUGFUNC("ixgbe_init_shared_code");
63 ixgbe_set_mac_type(hw);
65 switch (hw->mac.type) {
66 case ixgbe_mac_82598EB:
67 status = ixgbe_init_ops_82598(hw);
69 case ixgbe_mac_82599EB:
70 status = ixgbe_init_ops_82599(hw);
72 case ixgbe_mac_82599_vf:
73 case ixgbe_mac_X540_vf:
74 status = ixgbe_init_ops_vf(hw);
77 status = ixgbe_init_ops_X540(hw);
80 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
88 * ixgbe_set_mac_type - Sets MAC type
89 * @hw: pointer to the HW structure
91 * This function sets the mac type of the adapter based on the
92 * vendor ID and device ID stored in the hw structure.
94 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
96 s32 ret_val = IXGBE_SUCCESS;
98 DEBUGFUNC("ixgbe_set_mac_type\n");
100 if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
101 switch (hw->device_id) {
102 case IXGBE_DEV_ID_82598:
103 case IXGBE_DEV_ID_82598_BX:
104 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
105 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
106 case IXGBE_DEV_ID_82598AT:
107 case IXGBE_DEV_ID_82598AT2:
108 case IXGBE_DEV_ID_82598EB_CX4:
109 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
110 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
111 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
112 case IXGBE_DEV_ID_82598EB_XF_LR:
113 case IXGBE_DEV_ID_82598EB_SFP_LOM:
114 hw->mac.type = ixgbe_mac_82598EB;
116 case IXGBE_DEV_ID_82599_KX4:
117 case IXGBE_DEV_ID_82599_KX4_MEZZ:
118 case IXGBE_DEV_ID_82599_XAUI_LOM:
119 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
120 case IXGBE_DEV_ID_82599_KR:
121 case IXGBE_DEV_ID_82599_SFP:
122 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
123 case IXGBE_DEV_ID_82599_SFP_FCOE:
124 case IXGBE_DEV_ID_82599_SFP_EM:
125 case IXGBE_DEV_ID_82599EN_SFP:
126 case IXGBE_DEV_ID_82599_CX4:
127 case IXGBE_DEV_ID_82599_T3_LOM:
128 hw->mac.type = ixgbe_mac_82599EB;
130 case IXGBE_DEV_ID_82599_VF:
131 hw->mac.type = ixgbe_mac_82599_vf;
133 case IXGBE_DEV_ID_X540_VF:
134 hw->mac.type = ixgbe_mac_X540_vf;
136 case IXGBE_DEV_ID_X540T:
137 hw->mac.type = ixgbe_mac_X540;
140 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
144 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
147 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
148 hw->mac.type, ret_val);
153 * ixgbe_init_hw - Initialize the hardware
154 * @hw: pointer to hardware structure
156 * Initialize the hardware by resetting and then starting the hardware
158 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
160 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
161 IXGBE_NOT_IMPLEMENTED);
165 * ixgbe_reset_hw - Performs a hardware reset
166 * @hw: pointer to hardware structure
168 * Resets the hardware by resetting the transmit and receive units, masks and
169 * clears all interrupts, performs a PHY reset, and performs a MAC reset
171 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
173 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
174 IXGBE_NOT_IMPLEMENTED);
178 * ixgbe_start_hw - Prepares hardware for Rx/Tx
179 * @hw: pointer to hardware structure
181 * Starts the hardware by filling the bus info structure and media type,
182 * clears all on chip counters, initializes receive address registers,
183 * multicast table, VLAN filter table, calls routine to setup link and
184 * flow control settings, and leaves transmit and receive units disabled
187 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
189 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
190 IXGBE_NOT_IMPLEMENTED);
194 * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
195 * which is disabled by default in ixgbe_start_hw();
197 * @hw: pointer to hardware structure
199 * Enable relaxed ordering;
201 void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
203 if (hw->mac.ops.enable_relaxed_ordering)
204 hw->mac.ops.enable_relaxed_ordering(hw);
208 * ixgbe_clear_hw_cntrs - Clear hardware counters
209 * @hw: pointer to hardware structure
211 * Clears all hardware statistics counters by reading them from the hardware
212 * Statistics counters are clear on read.
214 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
216 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
217 IXGBE_NOT_IMPLEMENTED);
221 * ixgbe_get_media_type - Get media type
222 * @hw: pointer to hardware structure
224 * Returns the media type (fiber, copper, backplane)
226 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
228 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
229 ixgbe_media_type_unknown);
233 * ixgbe_get_mac_addr - Get MAC address
234 * @hw: pointer to hardware structure
235 * @mac_addr: Adapter MAC address
237 * Reads the adapter's MAC address from the first Receive Address Register
238 * (RAR0) A reset of the adapter must have been performed prior to calling
239 * this function in order for the MAC address to have been loaded from the
242 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
244 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
245 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
249 * ixgbe_get_san_mac_addr - Get SAN MAC address
250 * @hw: pointer to hardware structure
251 * @san_mac_addr: SAN MAC address
253 * Reads the SAN MAC address from the EEPROM, if it's available. This is
254 * per-port, so set_lan_id() must be called before reading the addresses.
256 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
258 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
259 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
263 * ixgbe_set_san_mac_addr - Write a SAN MAC address
264 * @hw: pointer to hardware structure
265 * @san_mac_addr: SAN MAC address
267 * Writes A SAN MAC address to the EEPROM.
269 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
271 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
272 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
276 * ixgbe_get_device_caps - Get additional device capabilities
277 * @hw: pointer to hardware structure
278 * @device_caps: the EEPROM word for device capabilities
280 * Reads the extra device capabilities from the EEPROM
282 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
284 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
285 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
289 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
290 * @hw: pointer to hardware structure
291 * @wwnn_prefix: the alternative WWNN prefix
292 * @wwpn_prefix: the alternative WWPN prefix
294 * This function will read the EEPROM from the alternative SAN MAC address
295 * block to check the support for the alternative WWNN/WWPN prefix support.
297 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
300 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
301 (hw, wwnn_prefix, wwpn_prefix),
302 IXGBE_NOT_IMPLEMENTED);
306 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
307 * @hw: pointer to hardware structure
308 * @bs: the fcoe boot status
310 * This function will read the FCOE boot status from the iSCSI FCOE block
312 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
314 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
316 IXGBE_NOT_IMPLEMENTED);
320 * ixgbe_get_bus_info - Set PCI bus info
321 * @hw: pointer to hardware structure
323 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
325 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
327 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
328 IXGBE_NOT_IMPLEMENTED);
332 * ixgbe_get_num_of_tx_queues - Get Tx queues
333 * @hw: pointer to hardware structure
335 * Returns the number of transmit queues for the given adapter.
337 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
339 return hw->mac.max_tx_queues;
343 * ixgbe_get_num_of_rx_queues - Get Rx queues
344 * @hw: pointer to hardware structure
346 * Returns the number of receive queues for the given adapter.
348 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
350 return hw->mac.max_rx_queues;
354 * ixgbe_stop_adapter - Disable Rx/Tx units
355 * @hw: pointer to hardware structure
357 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
358 * disables transmit and receive units. The adapter_stopped flag is used by
359 * the shared code and drivers to determine if the adapter is in a stopped
360 * state and should not touch the hardware.
362 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
364 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
365 IXGBE_NOT_IMPLEMENTED);
369 * ixgbe_read_pba_string - Reads part number string from EEPROM
370 * @hw: pointer to hardware structure
371 * @pba_num: stores the part number string from the EEPROM
372 * @pba_num_size: part number string buffer length
374 * Reads the part number string from the EEPROM.
376 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
378 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
382 * ixgbe_read_pba_num - Reads part number from EEPROM
383 * @hw: pointer to hardware structure
384 * @pba_num: stores the part number from the EEPROM
386 * Reads the part number from the EEPROM.
388 s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
390 return ixgbe_read_pba_num_generic(hw, pba_num);
394 * ixgbe_identify_phy - Get PHY type
395 * @hw: pointer to hardware structure
397 * Determines the physical layer module found on the current adapter.
399 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
401 s32 status = IXGBE_SUCCESS;
403 if (hw->phy.type == ixgbe_phy_unknown) {
404 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
405 IXGBE_NOT_IMPLEMENTED);
412 * ixgbe_reset_phy - Perform a PHY reset
413 * @hw: pointer to hardware structure
415 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
417 s32 status = IXGBE_SUCCESS;
419 if (hw->phy.type == ixgbe_phy_unknown) {
420 if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
421 status = IXGBE_ERR_PHY;
424 if (status == IXGBE_SUCCESS) {
425 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
426 IXGBE_NOT_IMPLEMENTED);
432 * ixgbe_get_phy_firmware_version -
433 * @hw: pointer to hardware structure
434 * @firmware_version: pointer to firmware version
436 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
438 s32 status = IXGBE_SUCCESS;
440 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
441 (hw, firmware_version),
442 IXGBE_NOT_IMPLEMENTED);
447 * ixgbe_read_phy_reg - Read PHY register
448 * @hw: pointer to hardware structure
449 * @reg_addr: 32 bit address of PHY register to read
450 * @phy_data: Pointer to read data from PHY register
452 * Reads a value from a specified PHY register
454 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
458 ixgbe_identify_phy(hw);
460 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
461 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
465 * ixgbe_write_phy_reg - Write PHY register
466 * @hw: pointer to hardware structure
467 * @reg_addr: 32 bit PHY register to write
468 * @phy_data: Data to write to the PHY register
470 * Writes a value to specified PHY register
472 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
476 ixgbe_identify_phy(hw);
478 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
479 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
483 * ixgbe_setup_phy_link - Restart PHY autoneg
484 * @hw: pointer to hardware structure
486 * Restart autonegotiation and PHY and waits for completion.
488 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
490 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
491 IXGBE_NOT_IMPLEMENTED);
495 * ixgbe_check_phy_link - Determine link and speed status
496 * @hw: pointer to hardware structure
498 * Reads a PHY register to determine if link is up and the current speed for
501 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
504 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
505 link_up), IXGBE_NOT_IMPLEMENTED);
509 * ixgbe_setup_phy_link_speed - Set auto advertise
510 * @hw: pointer to hardware structure
511 * @speed: new link speed
512 * @autoneg: true if autonegotiation enabled
514 * Sets the auto advertised capabilities
516 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
518 bool autoneg_wait_to_complete)
520 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
521 autoneg, autoneg_wait_to_complete),
522 IXGBE_NOT_IMPLEMENTED);
526 * ixgbe_check_link - Get link and speed status
527 * @hw: pointer to hardware structure
529 * Reads the links register to determine if link is up and the current speed
531 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
532 bool *link_up, bool link_up_wait_to_complete)
534 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
535 link_up, link_up_wait_to_complete),
536 IXGBE_NOT_IMPLEMENTED);
540 * ixgbe_disable_tx_laser - Disable Tx laser
541 * @hw: pointer to hardware structure
543 * If the driver needs to disable the laser on SFI optics.
545 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
547 if (hw->mac.ops.disable_tx_laser)
548 hw->mac.ops.disable_tx_laser(hw);
552 * ixgbe_enable_tx_laser - Enable Tx laser
553 * @hw: pointer to hardware structure
555 * If the driver needs to enable the laser on SFI optics.
557 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
559 if (hw->mac.ops.enable_tx_laser)
560 hw->mac.ops.enable_tx_laser(hw);
564 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
565 * @hw: pointer to hardware structure
567 * When the driver changes the link speeds that it can support then
568 * flap the tx laser to alert the link partner to start autotry
569 * process on its end.
571 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
573 if (hw->mac.ops.flap_tx_laser)
574 hw->mac.ops.flap_tx_laser(hw);
578 * ixgbe_setup_link - Set link speed
579 * @hw: pointer to hardware structure
580 * @speed: new link speed
581 * @autoneg: true if autonegotiation enabled
583 * Configures link settings. Restarts the link.
584 * Performs autonegotiation if needed.
586 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
588 bool autoneg_wait_to_complete)
590 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
591 autoneg, autoneg_wait_to_complete),
592 IXGBE_NOT_IMPLEMENTED);
596 * ixgbe_get_link_capabilities - Returns link capabilities
597 * @hw: pointer to hardware structure
599 * Determines the link capabilities of the current configuration.
601 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
604 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
605 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
609 * ixgbe_led_on - Turn on LEDs
610 * @hw: pointer to hardware structure
611 * @index: led number to turn on
613 * Turns on the software controllable LEDs.
615 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
617 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
618 IXGBE_NOT_IMPLEMENTED);
622 * ixgbe_led_off - Turn off LEDs
623 * @hw: pointer to hardware structure
624 * @index: led number to turn off
626 * Turns off the software controllable LEDs.
628 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
630 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
631 IXGBE_NOT_IMPLEMENTED);
635 * ixgbe_blink_led_start - Blink LEDs
636 * @hw: pointer to hardware structure
637 * @index: led number to blink
639 * Blink LED based on index.
641 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
643 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
644 IXGBE_NOT_IMPLEMENTED);
648 * ixgbe_blink_led_stop - Stop blinking LEDs
649 * @hw: pointer to hardware structure
651 * Stop blinking LED based on index.
653 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
655 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
656 IXGBE_NOT_IMPLEMENTED);
660 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
661 * @hw: pointer to hardware structure
663 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
664 * ixgbe_hw struct in order to set up EEPROM access.
666 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
668 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
669 IXGBE_NOT_IMPLEMENTED);
674 * ixgbe_write_eeprom - Write word to EEPROM
675 * @hw: pointer to hardware structure
676 * @offset: offset within the EEPROM to be written to
677 * @data: 16 bit word to be written to the EEPROM
679 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
680 * called after this function, the EEPROM will most likely contain an
683 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
685 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
686 IXGBE_NOT_IMPLEMENTED);
690 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
691 * @hw: pointer to hardware structure
692 * @offset: offset within the EEPROM to be written to
693 * @data: 16 bit word(s) to be written to the EEPROM
694 * @words: number of words
696 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
697 * called after this function, the EEPROM will most likely contain an
700 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
703 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
704 (hw, offset, words, data),
705 IXGBE_NOT_IMPLEMENTED);
709 * ixgbe_read_eeprom - Read word from EEPROM
710 * @hw: pointer to hardware structure
711 * @offset: offset within the EEPROM to be read
712 * @data: read 16 bit value from EEPROM
714 * Reads 16 bit value from EEPROM
716 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
718 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
719 IXGBE_NOT_IMPLEMENTED);
723 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
724 * @hw: pointer to hardware structure
725 * @offset: offset within the EEPROM to be read
726 * @data: read 16 bit word(s) from EEPROM
727 * @words: number of words
729 * Reads 16 bit word(s) from EEPROM
731 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
732 u16 words, u16 *data)
734 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
735 (hw, offset, words, data),
736 IXGBE_NOT_IMPLEMENTED);
740 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
741 * @hw: pointer to hardware structure
742 * @checksum_val: calculated checksum
744 * Performs checksum calculation and validates the EEPROM checksum
746 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
748 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
749 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
753 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
754 * @hw: pointer to hardware structure
756 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
758 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
759 IXGBE_NOT_IMPLEMENTED);
763 * ixgbe_insert_mac_addr - Find a RAR for this mac address
764 * @hw: pointer to hardware structure
765 * @addr: Address to put into receive address register
766 * @vmdq: VMDq pool to assign
768 * Puts an ethernet address into a receive address register, or
769 * finds the rar that it is aleady in; adds to the pool list
771 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
773 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
775 IXGBE_NOT_IMPLEMENTED);
779 * ixgbe_set_rar - Set Rx address register
780 * @hw: pointer to hardware structure
781 * @index: Receive address register to write
782 * @addr: Address to put into receive address register
784 * @enable_addr: set flag that address is active
786 * Puts an ethernet address into a receive address register.
788 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
791 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
792 enable_addr), IXGBE_NOT_IMPLEMENTED);
796 * ixgbe_clear_rar - Clear Rx address register
797 * @hw: pointer to hardware structure
798 * @index: Receive address register to write
800 * Puts an ethernet address into a receive address register.
802 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
804 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
805 IXGBE_NOT_IMPLEMENTED);
809 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
810 * @hw: pointer to hardware structure
811 * @rar: receive address register index to associate with VMDq index
812 * @vmdq: VMDq set or pool index
814 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
816 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
817 IXGBE_NOT_IMPLEMENTED);
821 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
822 * @hw: pointer to hardware structure
823 * @rar: receive address register index to disassociate with VMDq index
824 * @vmdq: VMDq set or pool index
826 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
828 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
829 IXGBE_NOT_IMPLEMENTED);
833 * ixgbe_init_rx_addrs - Initializes receive address filters.
834 * @hw: pointer to hardware structure
836 * Places the MAC address in receive address register 0 and clears the rest
837 * of the receive address registers. Clears the multicast table. Assumes
838 * the receiver is in reset when the routine is called.
840 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
842 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
843 IXGBE_NOT_IMPLEMENTED);
847 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
848 * @hw: pointer to hardware structure
850 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
852 return hw->mac.num_rar_entries;
856 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
857 * @hw: pointer to hardware structure
858 * @addr_list: the list of new multicast addresses
859 * @addr_count: number of addresses
860 * @func: iterator function to walk the multicast address list
862 * The given list replaces any existing list. Clears the secondary addrs from
863 * receive address registers. Uses unused receive address registers for the
864 * first secondary addresses, and falls back to promiscuous mode as needed.
866 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
867 u32 addr_count, ixgbe_mc_addr_itr func)
869 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
870 addr_list, addr_count, func),
871 IXGBE_NOT_IMPLEMENTED);
875 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
876 * @hw: pointer to hardware structure
877 * @mc_addr_list: the list of new multicast addresses
878 * @mc_addr_count: number of addresses
879 * @func: iterator function to walk the multicast address list
881 * The given list replaces any existing list. Clears the MC addrs from receive
882 * address registers and the multicast table. Uses unused receive address
883 * registers for the first multicast addresses, and hashes the rest into the
886 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
887 u32 mc_addr_count, ixgbe_mc_addr_itr func,
890 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
891 mc_addr_list, mc_addr_count, func, clear),
892 IXGBE_NOT_IMPLEMENTED);
896 * ixgbe_enable_mc - Enable multicast address in RAR
897 * @hw: pointer to hardware structure
899 * Enables multicast address in RAR and the use of the multicast hash table.
901 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
903 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
904 IXGBE_NOT_IMPLEMENTED);
908 * ixgbe_disable_mc - Disable multicast address in RAR
909 * @hw: pointer to hardware structure
911 * Disables multicast address in RAR and the use of the multicast hash table.
913 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
915 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
916 IXGBE_NOT_IMPLEMENTED);
920 * ixgbe_clear_vfta - Clear VLAN filter table
921 * @hw: pointer to hardware structure
923 * Clears the VLAN filer table, and the VMDq index associated with the filter
925 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
927 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
928 IXGBE_NOT_IMPLEMENTED);
932 * ixgbe_set_vfta - Set VLAN filter table
933 * @hw: pointer to hardware structure
934 * @vlan: VLAN id to write to VLAN filter
935 * @vind: VMDq output index that maps queue to VLAN id in VFTA
936 * @vlan_on: boolean flag to turn on/off VLAN in VFTA
938 * Turn on/off specified VLAN in the VLAN filter table.
940 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
942 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
943 vlan_on), IXGBE_NOT_IMPLEMENTED);
947 * ixgbe_fc_enable - Enable flow control
948 * @hw: pointer to hardware structure
949 * @packetbuf_num: packet buffer number (0-7)
951 * Configures the flow control settings based on SW configuration.
953 s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
955 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw, packetbuf_num),
956 IXGBE_NOT_IMPLEMENTED);
960 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
961 * @hw: pointer to hardware structure
962 * @maj: driver major number to be sent to firmware
963 * @min: driver minor number to be sent to firmware
964 * @build: driver build number to be sent to firmware
965 * @ver: driver version number to be sent to firmware
967 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
970 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
971 build, ver), IXGBE_NOT_IMPLEMENTED);
976 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
977 * @hw: pointer to hardware structure
978 * @reg: analog register to read
981 * Performs write operation to analog register specified.
983 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
985 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
986 val), IXGBE_NOT_IMPLEMENTED);
990 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
991 * @hw: pointer to hardware structure
992 * @reg: analog register to write
993 * @val: value to write
995 * Performs write operation to Atlas analog register specified.
997 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
999 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1000 val), IXGBE_NOT_IMPLEMENTED);
1004 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1005 * @hw: pointer to hardware structure
1007 * Initializes the Unicast Table Arrays to zero on device load. This
1008 * is part of the Rx init addr execution path.
1010 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1012 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1013 IXGBE_NOT_IMPLEMENTED);
1017 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1018 * @hw: pointer to hardware structure
1019 * @byte_offset: byte offset to read
1022 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1024 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1027 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1028 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1032 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1033 * @hw: pointer to hardware structure
1034 * @byte_offset: byte offset to write
1035 * @data: value to write
1037 * Performs byte write operation to SFP module's EEPROM over I2C interface
1038 * at a specified device address.
1040 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1043 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1044 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1048 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1049 * @hw: pointer to hardware structure
1050 * @byte_offset: EEPROM byte offset to write
1051 * @eeprom_data: value to write
1053 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1055 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1056 u8 byte_offset, u8 eeprom_data)
1058 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1059 (hw, byte_offset, eeprom_data),
1060 IXGBE_NOT_IMPLEMENTED);
1064 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1065 * @hw: pointer to hardware structure
1066 * @byte_offset: EEPROM byte offset to read
1067 * @eeprom_data: value read
1069 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1071 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1073 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1074 (hw, byte_offset, eeprom_data),
1075 IXGBE_NOT_IMPLEMENTED);
1079 * ixgbe_get_supported_physical_layer - Returns physical layer type
1080 * @hw: pointer to hardware structure
1082 * Determines physical layer capabilities of the current configuration.
1084 u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1086 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1087 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1091 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1092 * @hw: pointer to hardware structure
1093 * @regval: bitfield to write to the Rx DMA register
1095 * Enables the Rx DMA unit of the device.
1097 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1099 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1100 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1104 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1105 * @hw: pointer to hardware structure
1106 * @mask: Mask to specify which semaphore to acquire
1108 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1109 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1111 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1113 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1114 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1118 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1119 * @hw: pointer to hardware structure
1120 * @mask: Mask to specify which semaphore to release
1122 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1123 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1125 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1127 if (hw->mac.ops.release_swfw_sync)
1128 hw->mac.ops.release_swfw_sync(hw, mask);