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 ******************************************************************************/
33 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_api.c,v 1.13 2012/07/05 20:51:44 jfv Exp $*/
35 #include "ixgbe_api.h"
36 #include "ixgbe_common.h"
39 * ixgbe_init_shared_code - Initialize the shared code
40 * @hw: pointer to hardware structure
42 * This will assign function pointers and assign the MAC type and PHY code.
43 * Does not touch the hardware. This function must be called prior to any
44 * other function in the shared code. The ixgbe_hw structure should be
45 * memset to 0 prior to calling this function. The following fields in
46 * hw structure should be filled in prior to calling this function:
47 * hw_addr, back, device_id, vendor_id, subsystem_device_id,
48 * subsystem_vendor_id, and revision_id
50 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
54 DEBUGFUNC("ixgbe_init_shared_code");
59 ixgbe_set_mac_type(hw);
61 switch (hw->mac.type) {
62 case ixgbe_mac_82598EB:
63 status = ixgbe_init_ops_82598(hw);
65 case ixgbe_mac_82599EB:
66 status = ixgbe_init_ops_82599(hw);
68 case ixgbe_mac_82599_vf:
69 case ixgbe_mac_X540_vf:
70 status = ixgbe_init_ops_vf(hw);
73 status = ixgbe_init_ops_X540(hw);
76 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
84 * ixgbe_set_mac_type - Sets MAC type
85 * @hw: pointer to the HW structure
87 * This function sets the mac type of the adapter based on the
88 * vendor ID and device ID stored in the hw structure.
90 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
92 s32 ret_val = IXGBE_SUCCESS;
94 DEBUGFUNC("ixgbe_set_mac_type\n");
96 if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
97 switch (hw->device_id) {
98 case IXGBE_DEV_ID_82598:
99 case IXGBE_DEV_ID_82598_BX:
100 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
101 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
102 case IXGBE_DEV_ID_82598AT:
103 case IXGBE_DEV_ID_82598AT2:
104 case IXGBE_DEV_ID_82598EB_CX4:
105 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
106 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
107 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
108 case IXGBE_DEV_ID_82598EB_XF_LR:
109 case IXGBE_DEV_ID_82598EB_SFP_LOM:
110 hw->mac.type = ixgbe_mac_82598EB;
112 case IXGBE_DEV_ID_82599_KX4:
113 case IXGBE_DEV_ID_82599_KX4_MEZZ:
114 case IXGBE_DEV_ID_82599_XAUI_LOM:
115 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
116 case IXGBE_DEV_ID_82599_KR:
117 case IXGBE_DEV_ID_82599_SFP:
118 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
119 case IXGBE_DEV_ID_82599_SFP_FCOE:
120 case IXGBE_DEV_ID_82599_SFP_EM:
121 case IXGBE_DEV_ID_82599_SFP_SF2:
122 case IXGBE_DEV_ID_82599EN_SFP:
123 case IXGBE_DEV_ID_82599_CX4:
124 case IXGBE_DEV_ID_82599_T3_LOM:
125 hw->mac.type = ixgbe_mac_82599EB;
127 case IXGBE_DEV_ID_82599_VF:
128 hw->mac.type = ixgbe_mac_82599_vf;
130 case IXGBE_DEV_ID_X540_VF:
131 hw->mac.type = ixgbe_mac_X540_vf;
133 case IXGBE_DEV_ID_X540T:
134 case IXGBE_DEV_ID_X540T1:
135 hw->mac.type = ixgbe_mac_X540;
138 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
142 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
145 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
146 hw->mac.type, ret_val);
151 * ixgbe_init_hw - Initialize the hardware
152 * @hw: pointer to hardware structure
154 * Initialize the hardware by resetting and then starting the hardware
156 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
158 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
159 IXGBE_NOT_IMPLEMENTED);
163 * ixgbe_reset_hw - Performs a hardware reset
164 * @hw: pointer to hardware structure
166 * Resets the hardware by resetting the transmit and receive units, masks and
167 * clears all interrupts, performs a PHY reset, and performs a MAC reset
169 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
171 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
172 IXGBE_NOT_IMPLEMENTED);
176 * ixgbe_start_hw - Prepares hardware for Rx/Tx
177 * @hw: pointer to hardware structure
179 * Starts the hardware by filling the bus info structure and media type,
180 * clears all on chip counters, initializes receive address registers,
181 * multicast table, VLAN filter table, calls routine to setup link and
182 * flow control settings, and leaves transmit and receive units disabled
185 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
187 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
188 IXGBE_NOT_IMPLEMENTED);
192 * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
193 * which is disabled by default in ixgbe_start_hw();
195 * @hw: pointer to hardware structure
197 * Enable relaxed ordering;
199 void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
201 if (hw->mac.ops.enable_relaxed_ordering)
202 hw->mac.ops.enable_relaxed_ordering(hw);
206 * ixgbe_clear_hw_cntrs - Clear hardware counters
207 * @hw: pointer to hardware structure
209 * Clears all hardware statistics counters by reading them from the hardware
210 * Statistics counters are clear on read.
212 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
214 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
215 IXGBE_NOT_IMPLEMENTED);
219 * ixgbe_get_media_type - Get media type
220 * @hw: pointer to hardware structure
222 * Returns the media type (fiber, copper, backplane)
224 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
226 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
227 ixgbe_media_type_unknown);
231 * ixgbe_get_mac_addr - Get MAC address
232 * @hw: pointer to hardware structure
233 * @mac_addr: Adapter MAC address
235 * Reads the adapter's MAC address from the first Receive Address Register
236 * (RAR0) A reset of the adapter must have been performed prior to calling
237 * this function in order for the MAC address to have been loaded from the
240 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
242 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
243 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
247 * ixgbe_get_san_mac_addr - Get SAN MAC address
248 * @hw: pointer to hardware structure
249 * @san_mac_addr: SAN MAC address
251 * Reads the SAN MAC address from the EEPROM, if it's available. This is
252 * per-port, so set_lan_id() must be called before reading the addresses.
254 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
256 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
257 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
261 * ixgbe_set_san_mac_addr - Write a SAN MAC address
262 * @hw: pointer to hardware structure
263 * @san_mac_addr: SAN MAC address
265 * Writes A SAN MAC address to the EEPROM.
267 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
269 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
270 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
274 * ixgbe_get_device_caps - Get additional device capabilities
275 * @hw: pointer to hardware structure
276 * @device_caps: the EEPROM word for device capabilities
278 * Reads the extra device capabilities from the EEPROM
280 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
282 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
283 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
287 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
288 * @hw: pointer to hardware structure
289 * @wwnn_prefix: the alternative WWNN prefix
290 * @wwpn_prefix: the alternative WWPN prefix
292 * This function will read the EEPROM from the alternative SAN MAC address
293 * block to check the support for the alternative WWNN/WWPN prefix support.
295 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
298 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
299 (hw, wwnn_prefix, wwpn_prefix),
300 IXGBE_NOT_IMPLEMENTED);
304 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
305 * @hw: pointer to hardware structure
306 * @bs: the fcoe boot status
308 * This function will read the FCOE boot status from the iSCSI FCOE block
310 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
312 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
314 IXGBE_NOT_IMPLEMENTED);
318 * ixgbe_get_bus_info - Set PCI bus info
319 * @hw: pointer to hardware structure
321 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
323 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
325 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
326 IXGBE_NOT_IMPLEMENTED);
330 * ixgbe_get_num_of_tx_queues - Get Tx queues
331 * @hw: pointer to hardware structure
333 * Returns the number of transmit queues for the given adapter.
335 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
337 return hw->mac.max_tx_queues;
341 * ixgbe_get_num_of_rx_queues - Get Rx queues
342 * @hw: pointer to hardware structure
344 * Returns the number of receive queues for the given adapter.
346 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
348 return hw->mac.max_rx_queues;
352 * ixgbe_stop_adapter - Disable Rx/Tx units
353 * @hw: pointer to hardware structure
355 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
356 * disables transmit and receive units. The adapter_stopped flag is used by
357 * the shared code and drivers to determine if the adapter is in a stopped
358 * state and should not touch the hardware.
360 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
362 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
363 IXGBE_NOT_IMPLEMENTED);
367 * ixgbe_read_pba_string - Reads part number string from EEPROM
368 * @hw: pointer to hardware structure
369 * @pba_num: stores the part number string from the EEPROM
370 * @pba_num_size: part number string buffer length
372 * Reads the part number string from the EEPROM.
374 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
376 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
380 * ixgbe_read_pba_num - Reads part number from EEPROM
381 * @hw: pointer to hardware structure
382 * @pba_num: stores the part number from the EEPROM
384 * Reads the part number from the EEPROM.
386 s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
388 return ixgbe_read_pba_num_generic(hw, pba_num);
392 * ixgbe_identify_phy - Get PHY type
393 * @hw: pointer to hardware structure
395 * Determines the physical layer module found on the current adapter.
397 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
399 s32 status = IXGBE_SUCCESS;
401 if (hw->phy.type == ixgbe_phy_unknown) {
402 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
403 IXGBE_NOT_IMPLEMENTED);
410 * ixgbe_reset_phy - Perform a PHY reset
411 * @hw: pointer to hardware structure
413 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
415 s32 status = IXGBE_SUCCESS;
417 if (hw->phy.type == ixgbe_phy_unknown) {
418 if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
419 status = IXGBE_ERR_PHY;
422 if (status == IXGBE_SUCCESS) {
423 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
424 IXGBE_NOT_IMPLEMENTED);
430 * ixgbe_get_phy_firmware_version -
431 * @hw: pointer to hardware structure
432 * @firmware_version: pointer to firmware version
434 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
436 s32 status = IXGBE_SUCCESS;
438 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
439 (hw, firmware_version),
440 IXGBE_NOT_IMPLEMENTED);
445 * ixgbe_read_phy_reg - Read PHY register
446 * @hw: pointer to hardware structure
447 * @reg_addr: 32 bit address of PHY register to read
448 * @phy_data: Pointer to read data from PHY register
450 * Reads a value from a specified PHY register
452 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
456 ixgbe_identify_phy(hw);
458 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
459 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
463 * ixgbe_write_phy_reg - Write PHY register
464 * @hw: pointer to hardware structure
465 * @reg_addr: 32 bit PHY register to write
466 * @phy_data: Data to write to the PHY register
468 * Writes a value to specified PHY register
470 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
474 ixgbe_identify_phy(hw);
476 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
477 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
481 * ixgbe_setup_phy_link - Restart PHY autoneg
482 * @hw: pointer to hardware structure
484 * Restart autonegotiation and PHY and waits for completion.
486 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
488 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
489 IXGBE_NOT_IMPLEMENTED);
493 * ixgbe_check_phy_link - Determine link and speed status
494 * @hw: pointer to hardware structure
496 * Reads a PHY register to determine if link is up and the current speed for
499 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
502 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
503 link_up), IXGBE_NOT_IMPLEMENTED);
507 * ixgbe_setup_phy_link_speed - Set auto advertise
508 * @hw: pointer to hardware structure
509 * @speed: new link speed
510 * @autoneg: TRUE if autonegotiation enabled
512 * Sets the auto advertised capabilities
514 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
516 bool autoneg_wait_to_complete)
518 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
519 autoneg, autoneg_wait_to_complete),
520 IXGBE_NOT_IMPLEMENTED);
524 * ixgbe_check_link - Get link and speed status
525 * @hw: pointer to hardware structure
527 * Reads the links register to determine if link is up and the current speed
529 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
530 bool *link_up, bool link_up_wait_to_complete)
532 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
533 link_up, link_up_wait_to_complete),
534 IXGBE_NOT_IMPLEMENTED);
538 * ixgbe_disable_tx_laser - Disable Tx laser
539 * @hw: pointer to hardware structure
541 * If the driver needs to disable the laser on SFI optics.
543 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
545 if (hw->mac.ops.disable_tx_laser)
546 hw->mac.ops.disable_tx_laser(hw);
550 * ixgbe_enable_tx_laser - Enable Tx laser
551 * @hw: pointer to hardware structure
553 * If the driver needs to enable the laser on SFI optics.
555 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
557 if (hw->mac.ops.enable_tx_laser)
558 hw->mac.ops.enable_tx_laser(hw);
562 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
563 * @hw: pointer to hardware structure
565 * When the driver changes the link speeds that it can support then
566 * flap the tx laser to alert the link partner to start autotry
567 * process on its end.
569 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
571 if (hw->mac.ops.flap_tx_laser)
572 hw->mac.ops.flap_tx_laser(hw);
576 * ixgbe_setup_link - Set link speed
577 * @hw: pointer to hardware structure
578 * @speed: new link speed
579 * @autoneg: TRUE if autonegotiation enabled
581 * Configures link settings. Restarts the link.
582 * Performs autonegotiation if needed.
584 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
586 bool autoneg_wait_to_complete)
588 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
589 autoneg, autoneg_wait_to_complete),
590 IXGBE_NOT_IMPLEMENTED);
594 * ixgbe_get_link_capabilities - Returns link capabilities
595 * @hw: pointer to hardware structure
597 * Determines the link capabilities of the current configuration.
599 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
602 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
603 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
607 * ixgbe_led_on - Turn on LEDs
608 * @hw: pointer to hardware structure
609 * @index: led number to turn on
611 * Turns on the software controllable LEDs.
613 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
615 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
616 IXGBE_NOT_IMPLEMENTED);
620 * ixgbe_led_off - Turn off LEDs
621 * @hw: pointer to hardware structure
622 * @index: led number to turn off
624 * Turns off the software controllable LEDs.
626 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
628 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
629 IXGBE_NOT_IMPLEMENTED);
633 * ixgbe_blink_led_start - Blink LEDs
634 * @hw: pointer to hardware structure
635 * @index: led number to blink
637 * Blink LED based on index.
639 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
641 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
642 IXGBE_NOT_IMPLEMENTED);
646 * ixgbe_blink_led_stop - Stop blinking LEDs
647 * @hw: pointer to hardware structure
649 * Stop blinking LED based on index.
651 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
653 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
654 IXGBE_NOT_IMPLEMENTED);
658 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
659 * @hw: pointer to hardware structure
661 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
662 * ixgbe_hw struct in order to set up EEPROM access.
664 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
666 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
667 IXGBE_NOT_IMPLEMENTED);
672 * ixgbe_write_eeprom - Write word to EEPROM
673 * @hw: pointer to hardware structure
674 * @offset: offset within the EEPROM to be written to
675 * @data: 16 bit word to be written to the EEPROM
677 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
678 * called after this function, the EEPROM will most likely contain an
681 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
683 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
684 IXGBE_NOT_IMPLEMENTED);
688 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
689 * @hw: pointer to hardware structure
690 * @offset: offset within the EEPROM to be written to
691 * @data: 16 bit word(s) to be written to the EEPROM
692 * @words: number of words
694 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
695 * called after this function, the EEPROM will most likely contain an
698 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
701 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
702 (hw, offset, words, data),
703 IXGBE_NOT_IMPLEMENTED);
707 * ixgbe_read_eeprom - Read word from EEPROM
708 * @hw: pointer to hardware structure
709 * @offset: offset within the EEPROM to be read
710 * @data: read 16 bit value from EEPROM
712 * Reads 16 bit value from EEPROM
714 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
716 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
717 IXGBE_NOT_IMPLEMENTED);
721 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
722 * @hw: pointer to hardware structure
723 * @offset: offset within the EEPROM to be read
724 * @data: read 16 bit word(s) from EEPROM
725 * @words: number of words
727 * Reads 16 bit word(s) from EEPROM
729 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
730 u16 words, u16 *data)
732 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
733 (hw, offset, words, data),
734 IXGBE_NOT_IMPLEMENTED);
738 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
739 * @hw: pointer to hardware structure
740 * @checksum_val: calculated checksum
742 * Performs checksum calculation and validates the EEPROM checksum
744 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
746 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
747 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
751 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
752 * @hw: pointer to hardware structure
754 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
756 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
757 IXGBE_NOT_IMPLEMENTED);
761 * ixgbe_insert_mac_addr - Find a RAR for this mac address
762 * @hw: pointer to hardware structure
763 * @addr: Address to put into receive address register
764 * @vmdq: VMDq pool to assign
766 * Puts an ethernet address into a receive address register, or
767 * finds the rar that it is aleady in; adds to the pool list
769 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
771 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
773 IXGBE_NOT_IMPLEMENTED);
777 * ixgbe_set_rar - Set Rx address register
778 * @hw: pointer to hardware structure
779 * @index: Receive address register to write
780 * @addr: Address to put into receive address register
782 * @enable_addr: set flag that address is active
784 * Puts an ethernet address into a receive address register.
786 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
789 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
790 enable_addr), IXGBE_NOT_IMPLEMENTED);
794 * ixgbe_clear_rar - Clear Rx address register
795 * @hw: pointer to hardware structure
796 * @index: Receive address register to write
798 * Puts an ethernet address into a receive address register.
800 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
802 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
803 IXGBE_NOT_IMPLEMENTED);
807 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
808 * @hw: pointer to hardware structure
809 * @rar: receive address register index to associate with VMDq index
810 * @vmdq: VMDq set or pool index
812 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
814 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
815 IXGBE_NOT_IMPLEMENTED);
820 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
821 * @hw: pointer to hardware structure
822 * @vmdq: VMDq default pool index
824 s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
826 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
827 (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
831 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
832 * @hw: pointer to hardware structure
833 * @rar: receive address register index to disassociate with VMDq index
834 * @vmdq: VMDq set or pool index
836 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
838 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
839 IXGBE_NOT_IMPLEMENTED);
843 * ixgbe_init_rx_addrs - Initializes receive address filters.
844 * @hw: pointer to hardware structure
846 * Places the MAC address in receive address register 0 and clears the rest
847 * of the receive address registers. Clears the multicast table. Assumes
848 * the receiver is in reset when the routine is called.
850 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
852 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
853 IXGBE_NOT_IMPLEMENTED);
857 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
858 * @hw: pointer to hardware structure
860 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
862 return hw->mac.num_rar_entries;
866 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
867 * @hw: pointer to hardware structure
868 * @addr_list: the list of new multicast addresses
869 * @addr_count: number of addresses
870 * @func: iterator function to walk the multicast address list
872 * The given list replaces any existing list. Clears the secondary addrs from
873 * receive address registers. Uses unused receive address registers for the
874 * first secondary addresses, and falls back to promiscuous mode as needed.
876 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
877 u32 addr_count, ixgbe_mc_addr_itr func)
879 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
880 addr_list, addr_count, func),
881 IXGBE_NOT_IMPLEMENTED);
885 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
886 * @hw: pointer to hardware structure
887 * @mc_addr_list: the list of new multicast addresses
888 * @mc_addr_count: number of addresses
889 * @func: iterator function to walk the multicast address list
891 * The given list replaces any existing list. Clears the MC addrs from receive
892 * address registers and the multicast table. Uses unused receive address
893 * registers for the first multicast addresses, and hashes the rest into the
896 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
897 u32 mc_addr_count, ixgbe_mc_addr_itr func,
900 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
901 mc_addr_list, mc_addr_count, func, clear),
902 IXGBE_NOT_IMPLEMENTED);
906 * ixgbe_enable_mc - Enable multicast address in RAR
907 * @hw: pointer to hardware structure
909 * Enables multicast address in RAR and the use of the multicast hash table.
911 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
913 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
914 IXGBE_NOT_IMPLEMENTED);
918 * ixgbe_disable_mc - Disable multicast address in RAR
919 * @hw: pointer to hardware structure
921 * Disables multicast address in RAR and the use of the multicast hash table.
923 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
925 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
926 IXGBE_NOT_IMPLEMENTED);
930 * ixgbe_clear_vfta - Clear VLAN filter table
931 * @hw: pointer to hardware structure
933 * Clears the VLAN filer table, and the VMDq index associated with the filter
935 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
937 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
938 IXGBE_NOT_IMPLEMENTED);
942 * ixgbe_set_vfta - Set VLAN filter table
943 * @hw: pointer to hardware structure
944 * @vlan: VLAN id to write to VLAN filter
945 * @vind: VMDq output index that maps queue to VLAN id in VFTA
946 * @vlan_on: boolean flag to turn on/off VLAN in VFTA
948 * Turn on/off specified VLAN in the VLAN filter table.
950 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
952 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
953 vlan_on), IXGBE_NOT_IMPLEMENTED);
957 * ixgbe_set_vlvf - Set VLAN Pool Filter
958 * @hw: pointer to hardware structure
959 * @vlan: VLAN id to write to VLAN filter
960 * @vind: VMDq output index that maps queue to VLAN id in VFVFB
961 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
962 * @vfta_changed: pointer to boolean flag which indicates whether VFTA
965 * Turn on/off specified bit in VLVF table.
967 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
970 return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
971 vlan_on, vfta_changed), IXGBE_NOT_IMPLEMENTED);
975 * ixgbe_fc_enable - Enable flow control
976 * @hw: pointer to hardware structure
978 * Configures the flow control settings based on SW configuration.
980 s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
982 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
983 IXGBE_NOT_IMPLEMENTED);
987 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
988 * @hw: pointer to hardware structure
989 * @maj: driver major number to be sent to firmware
990 * @min: driver minor number to be sent to firmware
991 * @build: driver build number to be sent to firmware
992 * @ver: driver version number to be sent to firmware
994 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
997 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
998 build, ver), IXGBE_NOT_IMPLEMENTED);
1003 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
1004 * @hw: pointer to hardware structure
1005 * @reg: analog register to read
1008 * Performs write operation to analog register specified.
1010 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1012 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1013 val), IXGBE_NOT_IMPLEMENTED);
1017 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
1018 * @hw: pointer to hardware structure
1019 * @reg: analog register to write
1020 * @val: value to write
1022 * Performs write operation to Atlas analog register specified.
1024 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1026 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1027 val), IXGBE_NOT_IMPLEMENTED);
1031 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1032 * @hw: pointer to hardware structure
1034 * Initializes the Unicast Table Arrays to zero on device load. This
1035 * is part of the Rx init addr execution path.
1037 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1039 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1040 IXGBE_NOT_IMPLEMENTED);
1044 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1045 * @hw: pointer to hardware structure
1046 * @byte_offset: byte offset to read
1049 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1051 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1054 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1055 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1059 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1060 * @hw: pointer to hardware structure
1061 * @byte_offset: byte offset to write
1062 * @data: value to write
1064 * Performs byte write operation to SFP module's EEPROM over I2C interface
1065 * at a specified device address.
1067 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1070 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1071 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1075 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1076 * @hw: pointer to hardware structure
1077 * @byte_offset: EEPROM byte offset to write
1078 * @eeprom_data: value to write
1080 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1082 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1083 u8 byte_offset, u8 eeprom_data)
1085 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1086 (hw, byte_offset, eeprom_data),
1087 IXGBE_NOT_IMPLEMENTED);
1091 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1092 * @hw: pointer to hardware structure
1093 * @byte_offset: EEPROM byte offset to read
1094 * @eeprom_data: value read
1096 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1098 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1100 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1101 (hw, byte_offset, eeprom_data),
1102 IXGBE_NOT_IMPLEMENTED);
1106 * ixgbe_get_supported_physical_layer - Returns physical layer type
1107 * @hw: pointer to hardware structure
1109 * Determines physical layer capabilities of the current configuration.
1111 u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1113 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1114 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1118 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1119 * @hw: pointer to hardware structure
1120 * @regval: bitfield to write to the Rx DMA register
1122 * Enables the Rx DMA unit of the device.
1124 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1126 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1127 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1131 * ixgbe_disable_sec_rx_path - Stops the receive data path
1132 * @hw: pointer to hardware structure
1134 * Stops the receive data path.
1136 s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1138 return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1139 (hw), IXGBE_NOT_IMPLEMENTED);
1143 * ixgbe_enable_sec_rx_path - Enables the receive data path
1144 * @hw: pointer to hardware structure
1146 * Enables the receive data path.
1148 s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1150 return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1151 (hw), IXGBE_NOT_IMPLEMENTED);
1155 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1156 * @hw: pointer to hardware structure
1157 * @mask: Mask to specify which semaphore to acquire
1159 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1160 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1162 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1164 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1165 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1169 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1170 * @hw: pointer to hardware structure
1171 * @mask: Mask to specify which semaphore to release
1173 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1174 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1176 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1178 if (hw->mac.ops.release_swfw_sync)
1179 hw->mac.ops.release_swfw_sync(hw, mask);