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"
36 #ident "$Id: ixgbe_api.c,v 1.187 2012/11/08 10:11:52 jtkirshe Exp $"
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);
69 status = ixgbe_init_ops_X540(hw);
71 case ixgbe_mac_82599_vf:
72 case ixgbe_mac_X540_vf:
73 status = ixgbe_init_ops_vf(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 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
98 "Unsupported vendor id: %x", hw->vendor_id);
99 return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
102 switch (hw->device_id) {
103 case IXGBE_DEV_ID_82598:
104 case IXGBE_DEV_ID_82598_BX:
105 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
106 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
107 case IXGBE_DEV_ID_82598AT:
108 case IXGBE_DEV_ID_82598AT2:
109 case IXGBE_DEV_ID_82598EB_CX4:
110 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
111 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
112 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
113 case IXGBE_DEV_ID_82598EB_XF_LR:
114 case IXGBE_DEV_ID_82598EB_SFP_LOM:
115 hw->mac.type = ixgbe_mac_82598EB;
117 case IXGBE_DEV_ID_82599_KX4:
118 case IXGBE_DEV_ID_82599_KX4_MEZZ:
119 case IXGBE_DEV_ID_82599_XAUI_LOM:
120 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
121 case IXGBE_DEV_ID_82599_KR:
122 case IXGBE_DEV_ID_82599_SFP:
123 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
124 case IXGBE_DEV_ID_82599_SFP_FCOE:
125 case IXGBE_DEV_ID_82599_SFP_EM:
126 case IXGBE_DEV_ID_82599_SFP_SF2:
127 case IXGBE_DEV_ID_82599_SFP_SF_QP:
128 case IXGBE_DEV_ID_82599EN_SFP:
129 case IXGBE_DEV_ID_82599_CX4:
130 case IXGBE_DEV_ID_82599_T3_LOM:
131 hw->mac.type = ixgbe_mac_82599EB;
133 case IXGBE_DEV_ID_82599_VF:
134 case IXGBE_DEV_ID_82599_VF_HV:
135 hw->mac.type = ixgbe_mac_82599_vf;
137 case IXGBE_DEV_ID_X540_VF:
138 case IXGBE_DEV_ID_X540_VF_HV:
139 hw->mac.type = ixgbe_mac_X540_vf;
141 case IXGBE_DEV_ID_X540T:
142 case IXGBE_DEV_ID_X540T1:
143 hw->mac.type = ixgbe_mac_X540;
146 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
147 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
148 "Unsupported device id: %x",
153 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
154 hw->mac.type, ret_val);
159 * ixgbe_init_hw - Initialize the hardware
160 * @hw: pointer to hardware structure
162 * Initialize the hardware by resetting and then starting the hardware
164 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
166 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
167 IXGBE_NOT_IMPLEMENTED);
171 * ixgbe_reset_hw - Performs a hardware reset
172 * @hw: pointer to hardware structure
174 * Resets the hardware by resetting the transmit and receive units, masks and
175 * clears all interrupts, performs a PHY reset, and performs a MAC reset
177 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
179 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
180 IXGBE_NOT_IMPLEMENTED);
184 * ixgbe_start_hw - Prepares hardware for Rx/Tx
185 * @hw: pointer to hardware structure
187 * Starts the hardware by filling the bus info structure and media type,
188 * clears all on chip counters, initializes receive address registers,
189 * multicast table, VLAN filter table, calls routine to setup link and
190 * flow control settings, and leaves transmit and receive units disabled
193 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
195 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
196 IXGBE_NOT_IMPLEMENTED);
200 * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
201 * which is disabled by default in ixgbe_start_hw();
203 * @hw: pointer to hardware structure
205 * Enable relaxed ordering;
207 void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
209 if (hw->mac.ops.enable_relaxed_ordering)
210 hw->mac.ops.enable_relaxed_ordering(hw);
214 * ixgbe_clear_hw_cntrs - Clear hardware counters
215 * @hw: pointer to hardware structure
217 * Clears all hardware statistics counters by reading them from the hardware
218 * Statistics counters are clear on read.
220 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
222 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
223 IXGBE_NOT_IMPLEMENTED);
227 * ixgbe_get_media_type - Get media type
228 * @hw: pointer to hardware structure
230 * Returns the media type (fiber, copper, backplane)
232 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
234 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
235 ixgbe_media_type_unknown);
239 * ixgbe_get_mac_addr - Get MAC address
240 * @hw: pointer to hardware structure
241 * @mac_addr: Adapter MAC address
243 * Reads the adapter's MAC address from the first Receive Address Register
244 * (RAR0) A reset of the adapter must have been performed prior to calling
245 * this function in order for the MAC address to have been loaded from the
248 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
250 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
251 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
255 * ixgbe_get_san_mac_addr - Get SAN MAC address
256 * @hw: pointer to hardware structure
257 * @san_mac_addr: SAN MAC address
259 * Reads the SAN MAC address from the EEPROM, if it's available. This is
260 * per-port, so set_lan_id() must be called before reading the addresses.
262 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
264 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
265 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
269 * ixgbe_set_san_mac_addr - Write a SAN MAC address
270 * @hw: pointer to hardware structure
271 * @san_mac_addr: SAN MAC address
273 * Writes A SAN MAC address to the EEPROM.
275 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
277 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
278 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
282 * ixgbe_get_device_caps - Get additional device capabilities
283 * @hw: pointer to hardware structure
284 * @device_caps: the EEPROM word for device capabilities
286 * Reads the extra device capabilities from the EEPROM
288 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
290 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
291 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
295 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
296 * @hw: pointer to hardware structure
297 * @wwnn_prefix: the alternative WWNN prefix
298 * @wwpn_prefix: the alternative WWPN prefix
300 * This function will read the EEPROM from the alternative SAN MAC address
301 * block to check the support for the alternative WWNN/WWPN prefix support.
303 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
306 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
307 (hw, wwnn_prefix, wwpn_prefix),
308 IXGBE_NOT_IMPLEMENTED);
312 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
313 * @hw: pointer to hardware structure
314 * @bs: the fcoe boot status
316 * This function will read the FCOE boot status from the iSCSI FCOE block
318 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
320 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
322 IXGBE_NOT_IMPLEMENTED);
326 * ixgbe_get_bus_info - Set PCI bus info
327 * @hw: pointer to hardware structure
329 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
331 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
333 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
334 IXGBE_NOT_IMPLEMENTED);
338 * ixgbe_get_num_of_tx_queues - Get Tx queues
339 * @hw: pointer to hardware structure
341 * Returns the number of transmit queues for the given adapter.
343 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
345 return hw->mac.max_tx_queues;
349 * ixgbe_get_num_of_rx_queues - Get Rx queues
350 * @hw: pointer to hardware structure
352 * Returns the number of receive queues for the given adapter.
354 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
356 return hw->mac.max_rx_queues;
360 * ixgbe_stop_adapter - Disable Rx/Tx units
361 * @hw: pointer to hardware structure
363 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
364 * disables transmit and receive units. The adapter_stopped flag is used by
365 * the shared code and drivers to determine if the adapter is in a stopped
366 * state and should not touch the hardware.
368 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
370 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
371 IXGBE_NOT_IMPLEMENTED);
375 * ixgbe_read_pba_string - Reads part number string from EEPROM
376 * @hw: pointer to hardware structure
377 * @pba_num: stores the part number string from the EEPROM
378 * @pba_num_size: part number string buffer length
380 * Reads the part number string from the EEPROM.
382 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
384 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
388 * ixgbe_read_pba_num - Reads part number from EEPROM
389 * @hw: pointer to hardware structure
390 * @pba_num: stores the part number from the EEPROM
392 * Reads the part number from the EEPROM.
394 s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
396 return ixgbe_read_pba_num_generic(hw, pba_num);
400 * ixgbe_identify_phy - Get PHY type
401 * @hw: pointer to hardware structure
403 * Determines the physical layer module found on the current adapter.
405 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
407 s32 status = IXGBE_SUCCESS;
409 if (hw->phy.type == ixgbe_phy_unknown) {
410 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
411 IXGBE_NOT_IMPLEMENTED);
418 * ixgbe_reset_phy - Perform a PHY reset
419 * @hw: pointer to hardware structure
421 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
423 s32 status = IXGBE_SUCCESS;
425 if (hw->phy.type == ixgbe_phy_unknown) {
426 if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
427 status = IXGBE_ERR_PHY;
430 if (status == IXGBE_SUCCESS) {
431 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
432 IXGBE_NOT_IMPLEMENTED);
438 * ixgbe_get_phy_firmware_version -
439 * @hw: pointer to hardware structure
440 * @firmware_version: pointer to firmware version
442 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
444 s32 status = IXGBE_SUCCESS;
446 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
447 (hw, firmware_version),
448 IXGBE_NOT_IMPLEMENTED);
453 * ixgbe_read_phy_reg - Read PHY register
454 * @hw: pointer to hardware structure
455 * @reg_addr: 32 bit address of PHY register to read
456 * @phy_data: Pointer to read data from PHY register
458 * Reads a value from a specified PHY register
460 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
464 ixgbe_identify_phy(hw);
466 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
467 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
471 * ixgbe_write_phy_reg - Write PHY register
472 * @hw: pointer to hardware structure
473 * @reg_addr: 32 bit PHY register to write
474 * @phy_data: Data to write to the PHY register
476 * Writes a value to specified PHY register
478 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
482 ixgbe_identify_phy(hw);
484 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
485 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
489 * ixgbe_setup_phy_link - Restart PHY autoneg
490 * @hw: pointer to hardware structure
492 * Restart autonegotiation and PHY and waits for completion.
494 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
496 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
497 IXGBE_NOT_IMPLEMENTED);
501 * ixgbe_check_phy_link - Determine link and speed status
502 * @hw: pointer to hardware structure
504 * Reads a PHY register to determine if link is up and the current speed for
507 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
510 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
511 link_up), IXGBE_NOT_IMPLEMENTED);
515 * ixgbe_setup_phy_link_speed - Set auto advertise
516 * @hw: pointer to hardware structure
517 * @speed: new link speed
518 * @autoneg: true if autonegotiation enabled
520 * Sets the auto advertised capabilities
522 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
524 bool autoneg_wait_to_complete)
526 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
527 autoneg, autoneg_wait_to_complete),
528 IXGBE_NOT_IMPLEMENTED);
532 * ixgbe_check_link - Get link and speed status
533 * @hw: pointer to hardware structure
535 * Reads the links register to determine if link is up and the current speed
537 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
538 bool *link_up, bool link_up_wait_to_complete)
540 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
541 link_up, link_up_wait_to_complete),
542 IXGBE_NOT_IMPLEMENTED);
546 * ixgbe_disable_tx_laser - Disable Tx laser
547 * @hw: pointer to hardware structure
549 * If the driver needs to disable the laser on SFI optics.
551 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
553 if (hw->mac.ops.disable_tx_laser)
554 hw->mac.ops.disable_tx_laser(hw);
558 * ixgbe_enable_tx_laser - Enable Tx laser
559 * @hw: pointer to hardware structure
561 * If the driver needs to enable the laser on SFI optics.
563 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
565 if (hw->mac.ops.enable_tx_laser)
566 hw->mac.ops.enable_tx_laser(hw);
570 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
571 * @hw: pointer to hardware structure
573 * When the driver changes the link speeds that it can support then
574 * flap the tx laser to alert the link partner to start autotry
575 * process on its end.
577 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
579 if (hw->mac.ops.flap_tx_laser)
580 hw->mac.ops.flap_tx_laser(hw);
584 * ixgbe_setup_link - Set link speed
585 * @hw: pointer to hardware structure
586 * @speed: new link speed
587 * @autoneg: true if autonegotiation enabled
589 * Configures link settings. Restarts the link.
590 * Performs autonegotiation if needed.
592 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
594 bool autoneg_wait_to_complete)
596 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
597 autoneg, autoneg_wait_to_complete),
598 IXGBE_NOT_IMPLEMENTED);
602 * ixgbe_get_link_capabilities - Returns link capabilities
603 * @hw: pointer to hardware structure
605 * Determines the link capabilities of the current configuration.
607 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
610 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
611 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
615 * ixgbe_led_on - Turn on LEDs
616 * @hw: pointer to hardware structure
617 * @index: led number to turn on
619 * Turns on the software controllable LEDs.
621 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
623 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
624 IXGBE_NOT_IMPLEMENTED);
628 * ixgbe_led_off - Turn off LEDs
629 * @hw: pointer to hardware structure
630 * @index: led number to turn off
632 * Turns off the software controllable LEDs.
634 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
636 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
637 IXGBE_NOT_IMPLEMENTED);
641 * ixgbe_blink_led_start - Blink LEDs
642 * @hw: pointer to hardware structure
643 * @index: led number to blink
645 * Blink LED based on index.
647 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
649 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
650 IXGBE_NOT_IMPLEMENTED);
654 * ixgbe_blink_led_stop - Stop blinking LEDs
655 * @hw: pointer to hardware structure
657 * Stop blinking LED based on index.
659 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
661 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
662 IXGBE_NOT_IMPLEMENTED);
666 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
667 * @hw: pointer to hardware structure
669 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
670 * ixgbe_hw struct in order to set up EEPROM access.
672 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
674 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
675 IXGBE_NOT_IMPLEMENTED);
680 * ixgbe_write_eeprom - Write word to EEPROM
681 * @hw: pointer to hardware structure
682 * @offset: offset within the EEPROM to be written to
683 * @data: 16 bit word to be written to the EEPROM
685 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
686 * called after this function, the EEPROM will most likely contain an
689 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
691 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
692 IXGBE_NOT_IMPLEMENTED);
696 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
697 * @hw: pointer to hardware structure
698 * @offset: offset within the EEPROM to be written to
699 * @data: 16 bit word(s) to be written to the EEPROM
700 * @words: number of words
702 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
703 * called after this function, the EEPROM will most likely contain an
706 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
709 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
710 (hw, offset, words, data),
711 IXGBE_NOT_IMPLEMENTED);
715 * ixgbe_read_eeprom - Read word from EEPROM
716 * @hw: pointer to hardware structure
717 * @offset: offset within the EEPROM to be read
718 * @data: read 16 bit value from EEPROM
720 * Reads 16 bit value from EEPROM
722 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
724 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
725 IXGBE_NOT_IMPLEMENTED);
729 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
730 * @hw: pointer to hardware structure
731 * @offset: offset within the EEPROM to be read
732 * @data: read 16 bit word(s) from EEPROM
733 * @words: number of words
735 * Reads 16 bit word(s) from EEPROM
737 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
738 u16 words, u16 *data)
740 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
741 (hw, offset, words, data),
742 IXGBE_NOT_IMPLEMENTED);
746 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
747 * @hw: pointer to hardware structure
748 * @checksum_val: calculated checksum
750 * Performs checksum calculation and validates the EEPROM checksum
752 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
754 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
755 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
759 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
760 * @hw: pointer to hardware structure
762 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
764 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
765 IXGBE_NOT_IMPLEMENTED);
769 * ixgbe_insert_mac_addr - Find a RAR for this mac address
770 * @hw: pointer to hardware structure
771 * @addr: Address to put into receive address register
772 * @vmdq: VMDq pool to assign
774 * Puts an ethernet address into a receive address register, or
775 * finds the rar that it is aleady in; adds to the pool list
777 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
779 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
781 IXGBE_NOT_IMPLEMENTED);
785 * ixgbe_set_rar - Set Rx address register
786 * @hw: pointer to hardware structure
787 * @index: Receive address register to write
788 * @addr: Address to put into receive address register
790 * @enable_addr: set flag that address is active
792 * Puts an ethernet address into a receive address register.
794 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
797 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
798 enable_addr), IXGBE_NOT_IMPLEMENTED);
802 * ixgbe_clear_rar - Clear Rx address register
803 * @hw: pointer to hardware structure
804 * @index: Receive address register to write
806 * Puts an ethernet address into a receive address register.
808 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
810 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
811 IXGBE_NOT_IMPLEMENTED);
815 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
816 * @hw: pointer to hardware structure
817 * @rar: receive address register index to associate with VMDq index
818 * @vmdq: VMDq set or pool index
820 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
822 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
823 IXGBE_NOT_IMPLEMENTED);
828 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
829 * @hw: pointer to hardware structure
830 * @vmdq: VMDq default pool index
832 s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
834 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
835 (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
839 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
840 * @hw: pointer to hardware structure
841 * @rar: receive address register index to disassociate with VMDq index
842 * @vmdq: VMDq set or pool index
844 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
846 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
847 IXGBE_NOT_IMPLEMENTED);
851 * ixgbe_init_rx_addrs - Initializes receive address filters.
852 * @hw: pointer to hardware structure
854 * Places the MAC address in receive address register 0 and clears the rest
855 * of the receive address registers. Clears the multicast table. Assumes
856 * the receiver is in reset when the routine is called.
858 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
860 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
861 IXGBE_NOT_IMPLEMENTED);
865 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
866 * @hw: pointer to hardware structure
868 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
870 return hw->mac.num_rar_entries;
874 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
875 * @hw: pointer to hardware structure
876 * @addr_list: the list of new multicast addresses
877 * @addr_count: number of addresses
878 * @func: iterator function to walk the multicast address list
880 * The given list replaces any existing list. Clears the secondary addrs from
881 * receive address registers. Uses unused receive address registers for the
882 * first secondary addresses, and falls back to promiscuous mode as needed.
884 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
885 u32 addr_count, ixgbe_mc_addr_itr func)
887 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
888 addr_list, addr_count, func),
889 IXGBE_NOT_IMPLEMENTED);
893 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
894 * @hw: pointer to hardware structure
895 * @mc_addr_list: the list of new multicast addresses
896 * @mc_addr_count: number of addresses
897 * @func: iterator function to walk the multicast address list
899 * The given list replaces any existing list. Clears the MC addrs from receive
900 * address registers and the multicast table. Uses unused receive address
901 * registers for the first multicast addresses, and hashes the rest into the
904 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
905 u32 mc_addr_count, ixgbe_mc_addr_itr func,
908 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
909 mc_addr_list, mc_addr_count, func, clear),
910 IXGBE_NOT_IMPLEMENTED);
914 * ixgbe_enable_mc - Enable multicast address in RAR
915 * @hw: pointer to hardware structure
917 * Enables multicast address in RAR and the use of the multicast hash table.
919 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
921 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
922 IXGBE_NOT_IMPLEMENTED);
926 * ixgbe_disable_mc - Disable multicast address in RAR
927 * @hw: pointer to hardware structure
929 * Disables multicast address in RAR and the use of the multicast hash table.
931 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
933 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
934 IXGBE_NOT_IMPLEMENTED);
938 * ixgbe_clear_vfta - Clear VLAN filter table
939 * @hw: pointer to hardware structure
941 * Clears the VLAN filer table, and the VMDq index associated with the filter
943 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
945 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
946 IXGBE_NOT_IMPLEMENTED);
950 * ixgbe_set_vfta - Set VLAN filter table
951 * @hw: pointer to hardware structure
952 * @vlan: VLAN id to write to VLAN filter
953 * @vind: VMDq output index that maps queue to VLAN id in VFTA
954 * @vlan_on: boolean flag to turn on/off VLAN in VFTA
956 * Turn on/off specified VLAN in the VLAN filter table.
958 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
960 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
961 vlan_on), IXGBE_NOT_IMPLEMENTED);
965 * ixgbe_set_vlvf - Set VLAN Pool Filter
966 * @hw: pointer to hardware structure
967 * @vlan: VLAN id to write to VLAN filter
968 * @vind: VMDq output index that maps queue to VLAN id in VFVFB
969 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
970 * @vfta_changed: pointer to boolean flag which indicates whether VFTA
973 * Turn on/off specified bit in VLVF table.
975 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
978 return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
979 vlan_on, vfta_changed), IXGBE_NOT_IMPLEMENTED);
983 * ixgbe_fc_enable - Enable flow control
984 * @hw: pointer to hardware structure
986 * Configures the flow control settings based on SW configuration.
988 s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
990 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
991 IXGBE_NOT_IMPLEMENTED);
995 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
996 * @hw: pointer to hardware structure
997 * @maj: driver major number to be sent to firmware
998 * @min: driver minor number to be sent to firmware
999 * @build: driver build number to be sent to firmware
1000 * @ver: driver version number to be sent to firmware
1002 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
1005 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
1006 build, ver), IXGBE_NOT_IMPLEMENTED);
1013 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
1014 * @hw: pointer to hardware structure
1015 * @reg: analog register to read
1018 * Performs write operation to analog register specified.
1020 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1022 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1023 val), IXGBE_NOT_IMPLEMENTED);
1027 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
1028 * @hw: pointer to hardware structure
1029 * @reg: analog register to write
1030 * @val: value to write
1032 * Performs write operation to Atlas analog register specified.
1034 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1036 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1037 val), IXGBE_NOT_IMPLEMENTED);
1041 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1042 * @hw: pointer to hardware structure
1044 * Initializes the Unicast Table Arrays to zero on device load. This
1045 * is part of the Rx init addr execution path.
1047 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1049 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1050 IXGBE_NOT_IMPLEMENTED);
1054 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1055 * @hw: pointer to hardware structure
1056 * @byte_offset: byte offset to read
1059 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1061 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1064 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1065 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1069 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1070 * @hw: pointer to hardware structure
1071 * @byte_offset: byte offset to write
1072 * @data: value to write
1074 * Performs byte write operation to SFP module's EEPROM over I2C interface
1075 * at a specified device address.
1077 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1080 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1081 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1085 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1086 * @hw: pointer to hardware structure
1087 * @byte_offset: EEPROM byte offset to write
1088 * @eeprom_data: value to write
1090 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1092 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1093 u8 byte_offset, u8 eeprom_data)
1095 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1096 (hw, byte_offset, eeprom_data),
1097 IXGBE_NOT_IMPLEMENTED);
1101 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1102 * @hw: pointer to hardware structure
1103 * @byte_offset: EEPROM byte offset to read
1104 * @eeprom_data: value read
1106 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1108 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1110 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1111 (hw, byte_offset, eeprom_data),
1112 IXGBE_NOT_IMPLEMENTED);
1116 * ixgbe_get_supported_physical_layer - Returns physical layer type
1117 * @hw: pointer to hardware structure
1119 * Determines physical layer capabilities of the current configuration.
1121 u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1123 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1124 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1128 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1129 * @hw: pointer to hardware structure
1130 * @regval: bitfield to write to the Rx DMA register
1132 * Enables the Rx DMA unit of the device.
1134 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1136 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1137 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1141 * ixgbe_disable_sec_rx_path - Stops the receive data path
1142 * @hw: pointer to hardware structure
1144 * Stops the receive data path.
1146 s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1148 return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1149 (hw), IXGBE_NOT_IMPLEMENTED);
1153 * ixgbe_enable_sec_rx_path - Enables the receive data path
1154 * @hw: pointer to hardware structure
1156 * Enables the receive data path.
1158 s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1160 return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1161 (hw), IXGBE_NOT_IMPLEMENTED);
1165 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1166 * @hw: pointer to hardware structure
1167 * @mask: Mask to specify which semaphore to acquire
1169 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1170 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1172 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1174 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1175 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1179 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1180 * @hw: pointer to hardware structure
1181 * @mask: Mask to specify which semaphore to release
1183 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1184 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1186 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1188 if (hw->mac.ops.release_swfw_sync)
1189 hw->mac.ops.release_swfw_sync(hw, mask);