1 /*******************************************************************************
3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2012 Intel Corporation.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 The full GNU General Public License is included in this distribution in
20 the file called "LICENSE.GPL".
23 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *******************************************************************************/
28 #include "ixgbe_api.h"
29 #include "ixgbe_common.h"
32 * ixgbe_init_shared_code - Initialize the shared code
33 * @hw: pointer to hardware structure
35 * This will assign function pointers and assign the MAC type and PHY code.
36 * Does not touch the hardware. This function must be called prior to any
37 * other function in the shared code. The ixgbe_hw structure should be
38 * memset to 0 prior to calling this function. The following fields in
39 * hw structure should be filled in prior to calling this function:
40 * hw_addr, back, device_id, vendor_id, subsystem_device_id,
41 * subsystem_vendor_id, and revision_id
43 s32
ixgbe_init_shared_code(struct ixgbe_hw
*hw
)
50 ixgbe_set_mac_type(hw
);
52 switch (hw
->mac
.type
) {
53 case ixgbe_mac_82598EB
:
54 status
= ixgbe_init_ops_82598(hw
);
56 case ixgbe_mac_82599EB
:
57 status
= ixgbe_init_ops_82599(hw
);
60 status
= ixgbe_init_ops_X540(hw
);
63 status
= IXGBE_ERR_DEVICE_NOT_SUPPORTED
;
71 * ixgbe_set_mac_type - Sets MAC type
72 * @hw: pointer to the HW structure
74 * This function sets the mac type of the adapter based on the
75 * vendor ID and device ID stored in the hw structure.
77 s32
ixgbe_set_mac_type(struct ixgbe_hw
*hw
)
81 if (hw
->vendor_id
== IXGBE_INTEL_VENDOR_ID
) {
82 switch (hw
->device_id
) {
83 case IXGBE_DEV_ID_82598
:
84 case IXGBE_DEV_ID_82598_BX
:
85 case IXGBE_DEV_ID_82598AF_SINGLE_PORT
:
86 case IXGBE_DEV_ID_82598AF_DUAL_PORT
:
87 case IXGBE_DEV_ID_82598AT
:
88 case IXGBE_DEV_ID_82598AT2
:
89 case IXGBE_DEV_ID_82598EB_CX4
:
90 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT
:
91 case IXGBE_DEV_ID_82598_DA_DUAL_PORT
:
92 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM
:
93 case IXGBE_DEV_ID_82598EB_XF_LR
:
94 case IXGBE_DEV_ID_82598EB_SFP_LOM
:
95 hw
->mac
.type
= ixgbe_mac_82598EB
;
97 case IXGBE_DEV_ID_82599_KX4
:
98 case IXGBE_DEV_ID_82599_KX4_MEZZ
:
99 case IXGBE_DEV_ID_82599_XAUI_LOM
:
100 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE
:
101 case IXGBE_DEV_ID_82599_KR
:
102 case IXGBE_DEV_ID_82599_SFP
:
103 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE
:
104 case IXGBE_DEV_ID_82599_SFP_FCOE
:
105 case IXGBE_DEV_ID_82599_SFP_EM
:
106 case IXGBE_DEV_ID_82599_SFP_SF2
:
107 case IXGBE_DEV_ID_82599_QSFP_SF_QP
:
108 case IXGBE_DEV_ID_82599EN_SFP
:
109 case IXGBE_DEV_ID_82599_CX4
:
110 case IXGBE_DEV_ID_82599_LS
:
111 case IXGBE_DEV_ID_82599_T3_LOM
:
112 hw
->mac
.type
= ixgbe_mac_82599EB
;
114 case IXGBE_DEV_ID_X540T
:
115 hw
->mac
.type
= ixgbe_mac_X540
;
118 ret_val
= IXGBE_ERR_DEVICE_NOT_SUPPORTED
;
122 ret_val
= IXGBE_ERR_DEVICE_NOT_SUPPORTED
;
125 hw_dbg(hw
, "ixgbe_set_mac_type found mac: %d, returns: %d\n",
126 hw
->mac
.type
, ret_val
);
131 * ixgbe_init_hw - Initialize the hardware
132 * @hw: pointer to hardware structure
134 * Initialize the hardware by resetting and then starting the hardware
136 s32
ixgbe_init_hw(struct ixgbe_hw
*hw
)
138 return ixgbe_call_func(hw
, hw
->mac
.ops
.init_hw
, (hw
),
139 IXGBE_NOT_IMPLEMENTED
);
143 * ixgbe_reset_hw - Performs a hardware reset
144 * @hw: pointer to hardware structure
146 * Resets the hardware by resetting the transmit and receive units, masks and
147 * clears all interrupts, performs a PHY reset, and performs a MAC reset
149 s32
ixgbe_reset_hw(struct ixgbe_hw
*hw
)
151 return ixgbe_call_func(hw
, hw
->mac
.ops
.reset_hw
, (hw
),
152 IXGBE_NOT_IMPLEMENTED
);
156 * ixgbe_start_hw - Prepares hardware for Rx/Tx
157 * @hw: pointer to hardware structure
159 * Starts the hardware by filling the bus info structure and media type,
160 * clears all on chip counters, initializes receive address registers,
161 * multicast table, VLAN filter table, calls routine to setup link and
162 * flow control settings, and leaves transmit and receive units disabled
165 s32
ixgbe_start_hw(struct ixgbe_hw
*hw
)
167 return ixgbe_call_func(hw
, hw
->mac
.ops
.start_hw
, (hw
),
168 IXGBE_NOT_IMPLEMENTED
);
172 * ixgbe_clear_hw_cntrs - Clear hardware counters
173 * @hw: pointer to hardware structure
175 * Clears all hardware statistics counters by reading them from the hardware
176 * Statistics counters are clear on read.
178 s32
ixgbe_clear_hw_cntrs(struct ixgbe_hw
*hw
)
180 return ixgbe_call_func(hw
, hw
->mac
.ops
.clear_hw_cntrs
, (hw
),
181 IXGBE_NOT_IMPLEMENTED
);
185 * ixgbe_get_media_type - Get media type
186 * @hw: pointer to hardware structure
188 * Returns the media type (fiber, copper, backplane)
190 enum ixgbe_media_type
ixgbe_get_media_type(struct ixgbe_hw
*hw
)
192 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_media_type
, (hw
),
193 ixgbe_media_type_unknown
);
197 * ixgbe_get_mac_addr - Get MAC address
198 * @hw: pointer to hardware structure
199 * @mac_addr: Adapter MAC address
201 * Reads the adapter's MAC address from the first Receive Address Register
202 * (RAR0) A reset of the adapter must have been performed prior to calling
203 * this function in order for the MAC address to have been loaded from the
206 s32
ixgbe_get_mac_addr(struct ixgbe_hw
*hw
, u8
*mac_addr
)
208 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_mac_addr
,
209 (hw
, mac_addr
), IXGBE_NOT_IMPLEMENTED
);
213 * ixgbe_get_san_mac_addr - Get SAN MAC address
214 * @hw: pointer to hardware structure
215 * @san_mac_addr: SAN MAC address
217 * Reads the SAN MAC address from the EEPROM, if it's available. This is
218 * per-port, so set_lan_id() must be called before reading the addresses.
220 s32
ixgbe_get_san_mac_addr(struct ixgbe_hw
*hw
, u8
*san_mac_addr
)
222 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_san_mac_addr
,
223 (hw
, san_mac_addr
), IXGBE_NOT_IMPLEMENTED
);
227 * ixgbe_set_san_mac_addr - Write a SAN MAC address
228 * @hw: pointer to hardware structure
229 * @san_mac_addr: SAN MAC address
231 * Writes A SAN MAC address to the EEPROM.
233 s32
ixgbe_set_san_mac_addr(struct ixgbe_hw
*hw
, u8
*san_mac_addr
)
235 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_san_mac_addr
,
236 (hw
, san_mac_addr
), IXGBE_NOT_IMPLEMENTED
);
240 * ixgbe_get_device_caps - Get additional device capabilities
241 * @hw: pointer to hardware structure
242 * @device_caps: the EEPROM word for device capabilities
244 * Reads the extra device capabilities from the EEPROM
246 s32
ixgbe_get_device_caps(struct ixgbe_hw
*hw
, u16
*device_caps
)
248 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_device_caps
,
249 (hw
, device_caps
), IXGBE_NOT_IMPLEMENTED
);
253 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
254 * @hw: pointer to hardware structure
255 * @wwnn_prefix: the alternative WWNN prefix
256 * @wwpn_prefix: the alternative WWPN prefix
258 * This function will read the EEPROM from the alternative SAN MAC address
259 * block to check the support for the alternative WWNN/WWPN prefix support.
261 s32
ixgbe_get_wwn_prefix(struct ixgbe_hw
*hw
, u16
*wwnn_prefix
,
264 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_wwn_prefix
,
265 (hw
, wwnn_prefix
, wwpn_prefix
),
266 IXGBE_NOT_IMPLEMENTED
);
270 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
271 * @hw: pointer to hardware structure
272 * @bs: the fcoe boot status
274 * This function will read the FCOE boot status from the iSCSI FCOE block
276 s32
ixgbe_get_fcoe_boot_status(struct ixgbe_hw
*hw
, u16
*bs
)
278 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_fcoe_boot_status
,
280 IXGBE_NOT_IMPLEMENTED
);
284 * ixgbe_get_bus_info - Set PCI bus info
285 * @hw: pointer to hardware structure
287 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
289 s32
ixgbe_get_bus_info(struct ixgbe_hw
*hw
)
291 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_bus_info
, (hw
),
292 IXGBE_NOT_IMPLEMENTED
);
296 * ixgbe_get_num_of_tx_queues - Get Tx queues
297 * @hw: pointer to hardware structure
299 * Returns the number of transmit queues for the given adapter.
301 u32
ixgbe_get_num_of_tx_queues(struct ixgbe_hw
*hw
)
303 return hw
->mac
.max_tx_queues
;
307 * ixgbe_get_num_of_rx_queues - Get Rx queues
308 * @hw: pointer to hardware structure
310 * Returns the number of receive queues for the given adapter.
312 u32
ixgbe_get_num_of_rx_queues(struct ixgbe_hw
*hw
)
314 return hw
->mac
.max_rx_queues
;
318 * ixgbe_stop_adapter - Disable Rx/Tx units
319 * @hw: pointer to hardware structure
321 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
322 * disables transmit and receive units. The adapter_stopped flag is used by
323 * the shared code and drivers to determine if the adapter is in a stopped
324 * state and should not touch the hardware.
326 s32
ixgbe_stop_adapter(struct ixgbe_hw
*hw
)
328 return ixgbe_call_func(hw
, hw
->mac
.ops
.stop_adapter
, (hw
),
329 IXGBE_NOT_IMPLEMENTED
);
333 * ixgbe_read_pba_string - Reads part number string from EEPROM
334 * @hw: pointer to hardware structure
335 * @pba_num: stores the part number string from the EEPROM
336 * @pba_num_size: part number string buffer length
338 * Reads the part number string from the EEPROM.
340 s32
ixgbe_read_pba_string(struct ixgbe_hw
*hw
, u8
*pba_num
, u32 pba_num_size
)
342 return ixgbe_read_pba_string_generic(hw
, pba_num
, pba_num_size
);
346 * ixgbe_identify_phy - Get PHY type
347 * @hw: pointer to hardware structure
349 * Determines the physical layer module found on the current adapter.
351 s32
ixgbe_identify_phy(struct ixgbe_hw
*hw
)
355 if (hw
->phy
.type
== ixgbe_phy_unknown
) {
356 status
= ixgbe_call_func(hw
, hw
->phy
.ops
.identify
, (hw
),
357 IXGBE_NOT_IMPLEMENTED
);
364 * ixgbe_reset_phy - Perform a PHY reset
365 * @hw: pointer to hardware structure
367 s32
ixgbe_reset_phy(struct ixgbe_hw
*hw
)
371 if (hw
->phy
.type
== ixgbe_phy_unknown
) {
372 if (ixgbe_identify_phy(hw
) != 0)
373 status
= IXGBE_ERR_PHY
;
377 status
= ixgbe_call_func(hw
, hw
->phy
.ops
.reset
, (hw
),
378 IXGBE_NOT_IMPLEMENTED
);
384 * ixgbe_get_phy_firmware_version -
385 * @hw: pointer to hardware structure
386 * @firmware_version: pointer to firmware version
388 s32
ixgbe_get_phy_firmware_version(struct ixgbe_hw
*hw
, u16
*firmware_version
)
392 status
= ixgbe_call_func(hw
, hw
->phy
.ops
.get_firmware_version
,
393 (hw
, firmware_version
),
394 IXGBE_NOT_IMPLEMENTED
);
399 * ixgbe_read_phy_reg - Read PHY register
400 * @hw: pointer to hardware structure
401 * @reg_addr: 32 bit address of PHY register to read
402 * @phy_data: Pointer to read data from PHY register
404 * Reads a value from a specified PHY register
406 s32
ixgbe_read_phy_reg(struct ixgbe_hw
*hw
, u32 reg_addr
, u32 device_type
,
410 ixgbe_identify_phy(hw
);
412 return ixgbe_call_func(hw
, hw
->phy
.ops
.read_reg
, (hw
, reg_addr
,
413 device_type
, phy_data
), IXGBE_NOT_IMPLEMENTED
);
417 * ixgbe_write_phy_reg - Write PHY register
418 * @hw: pointer to hardware structure
419 * @reg_addr: 32 bit PHY register to write
420 * @phy_data: Data to write to the PHY register
422 * Writes a value to specified PHY register
424 s32
ixgbe_write_phy_reg(struct ixgbe_hw
*hw
, u32 reg_addr
, u32 device_type
,
428 ixgbe_identify_phy(hw
);
430 return ixgbe_call_func(hw
, hw
->phy
.ops
.write_reg
, (hw
, reg_addr
,
431 device_type
, phy_data
), IXGBE_NOT_IMPLEMENTED
);
435 * ixgbe_setup_phy_link - Restart PHY autoneg
436 * @hw: pointer to hardware structure
438 * Restart autonegotiation and PHY and waits for completion.
440 s32
ixgbe_setup_phy_link(struct ixgbe_hw
*hw
)
442 return ixgbe_call_func(hw
, hw
->phy
.ops
.setup_link
, (hw
),
443 IXGBE_NOT_IMPLEMENTED
);
447 * ixgbe_check_phy_link - Determine link and speed status
448 * @hw: pointer to hardware structure
450 * Reads a PHY register to determine if link is up and the current speed for
453 s32
ixgbe_check_phy_link(struct ixgbe_hw
*hw
, ixgbe_link_speed
*speed
,
456 return ixgbe_call_func(hw
, hw
->phy
.ops
.check_link
, (hw
, speed
,
457 link_up
), IXGBE_NOT_IMPLEMENTED
);
461 * ixgbe_setup_phy_link_speed - Set auto advertise
462 * @hw: pointer to hardware structure
463 * @speed: new link speed
464 * @autoneg: true if autonegotiation enabled
466 * Sets the auto advertised capabilities
468 s32
ixgbe_setup_phy_link_speed(struct ixgbe_hw
*hw
, ixgbe_link_speed speed
,
470 bool autoneg_wait_to_complete
)
472 return ixgbe_call_func(hw
, hw
->phy
.ops
.setup_link_speed
, (hw
, speed
,
473 autoneg
, autoneg_wait_to_complete
),
474 IXGBE_NOT_IMPLEMENTED
);
478 * ixgbe_check_link - Get link and speed status
479 * @hw: pointer to hardware structure
481 * Reads the links register to determine if link is up and the current speed
483 s32
ixgbe_check_link(struct ixgbe_hw
*hw
, ixgbe_link_speed
*speed
,
484 bool *link_up
, bool link_up_wait_to_complete
)
486 return ixgbe_call_func(hw
, hw
->mac
.ops
.check_link
, (hw
, speed
,
487 link_up
, link_up_wait_to_complete
),
488 IXGBE_NOT_IMPLEMENTED
);
492 * ixgbe_disable_tx_laser - Disable Tx laser
493 * @hw: pointer to hardware structure
495 * If the driver needs to disable the laser on SFI optics.
497 void ixgbe_disable_tx_laser(struct ixgbe_hw
*hw
)
499 if (hw
->mac
.ops
.disable_tx_laser
)
500 hw
->mac
.ops
.disable_tx_laser(hw
);
504 * ixgbe_enable_tx_laser - Enable Tx laser
505 * @hw: pointer to hardware structure
507 * If the driver needs to enable the laser on SFI optics.
509 void ixgbe_enable_tx_laser(struct ixgbe_hw
*hw
)
511 if (hw
->mac
.ops
.enable_tx_laser
)
512 hw
->mac
.ops
.enable_tx_laser(hw
);
516 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
517 * @hw: pointer to hardware structure
519 * When the driver changes the link speeds that it can support then
520 * flap the tx laser to alert the link partner to start autotry
521 * process on its end.
523 void ixgbe_flap_tx_laser(struct ixgbe_hw
*hw
)
525 if (hw
->mac
.ops
.flap_tx_laser
)
526 hw
->mac
.ops
.flap_tx_laser(hw
);
530 * ixgbe_setup_link - Set link speed
531 * @hw: pointer to hardware structure
532 * @speed: new link speed
533 * @autoneg: true if autonegotiation enabled
535 * Configures link settings. Restarts the link.
536 * Performs autonegotiation if needed.
538 s32
ixgbe_setup_link(struct ixgbe_hw
*hw
, ixgbe_link_speed speed
,
540 bool autoneg_wait_to_complete
)
542 return ixgbe_call_func(hw
, hw
->mac
.ops
.setup_link
, (hw
, speed
,
543 autoneg
, autoneg_wait_to_complete
),
544 IXGBE_NOT_IMPLEMENTED
);
548 * ixgbe_get_link_capabilities - Returns link capabilities
549 * @hw: pointer to hardware structure
551 * Determines the link capabilities of the current configuration.
553 s32
ixgbe_get_link_capabilities(struct ixgbe_hw
*hw
, ixgbe_link_speed
*speed
,
556 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_link_capabilities
, (hw
,
557 speed
, autoneg
), IXGBE_NOT_IMPLEMENTED
);
561 * ixgbe_led_on - Turn on LEDs
562 * @hw: pointer to hardware structure
563 * @index: led number to turn on
565 * Turns on the software controllable LEDs.
567 s32
ixgbe_led_on(struct ixgbe_hw
*hw
, u32 index
)
569 return ixgbe_call_func(hw
, hw
->mac
.ops
.led_on
, (hw
, index
),
570 IXGBE_NOT_IMPLEMENTED
);
574 * ixgbe_led_off - Turn off LEDs
575 * @hw: pointer to hardware structure
576 * @index: led number to turn off
578 * Turns off the software controllable LEDs.
580 s32
ixgbe_led_off(struct ixgbe_hw
*hw
, u32 index
)
582 return ixgbe_call_func(hw
, hw
->mac
.ops
.led_off
, (hw
, index
),
583 IXGBE_NOT_IMPLEMENTED
);
587 * ixgbe_blink_led_start - Blink LEDs
588 * @hw: pointer to hardware structure
589 * @index: led number to blink
591 * Blink LED based on index.
593 s32
ixgbe_blink_led_start(struct ixgbe_hw
*hw
, u32 index
)
595 return ixgbe_call_func(hw
, hw
->mac
.ops
.blink_led_start
, (hw
, index
),
596 IXGBE_NOT_IMPLEMENTED
);
600 * ixgbe_blink_led_stop - Stop blinking LEDs
601 * @hw: pointer to hardware structure
603 * Stop blinking LED based on index.
605 s32
ixgbe_blink_led_stop(struct ixgbe_hw
*hw
, u32 index
)
607 return ixgbe_call_func(hw
, hw
->mac
.ops
.blink_led_stop
, (hw
, index
),
608 IXGBE_NOT_IMPLEMENTED
);
612 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
613 * @hw: pointer to hardware structure
615 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
616 * ixgbe_hw struct in order to set up EEPROM access.
618 s32
ixgbe_init_eeprom_params(struct ixgbe_hw
*hw
)
620 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.init_params
, (hw
),
621 IXGBE_NOT_IMPLEMENTED
);
626 * ixgbe_write_eeprom - Write word to EEPROM
627 * @hw: pointer to hardware structure
628 * @offset: offset within the EEPROM to be written to
629 * @data: 16 bit word to be written to the EEPROM
631 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
632 * called after this function, the EEPROM will most likely contain an
635 s32
ixgbe_write_eeprom(struct ixgbe_hw
*hw
, u16 offset
, u16 data
)
637 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.write
, (hw
, offset
, data
),
638 IXGBE_NOT_IMPLEMENTED
);
642 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
643 * @hw: pointer to hardware structure
644 * @offset: offset within the EEPROM to be written to
645 * @data: 16 bit word(s) to be written to the EEPROM
646 * @words: number of words
648 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
649 * called after this function, the EEPROM will most likely contain an
652 s32
ixgbe_write_eeprom_buffer(struct ixgbe_hw
*hw
, u16 offset
, u16 words
,
655 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.write_buffer
,
656 (hw
, offset
, words
, data
),
657 IXGBE_NOT_IMPLEMENTED
);
661 * ixgbe_read_eeprom - Read word from EEPROM
662 * @hw: pointer to hardware structure
663 * @offset: offset within the EEPROM to be read
664 * @data: read 16 bit value from EEPROM
666 * Reads 16 bit value from EEPROM
668 s32
ixgbe_read_eeprom(struct ixgbe_hw
*hw
, u16 offset
, u16
*data
)
670 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.read
, (hw
, offset
, data
),
671 IXGBE_NOT_IMPLEMENTED
);
675 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
676 * @hw: pointer to hardware structure
677 * @offset: offset within the EEPROM to be read
678 * @data: read 16 bit word(s) from EEPROM
679 * @words: number of words
681 * Reads 16 bit word(s) from EEPROM
683 s32
ixgbe_read_eeprom_buffer(struct ixgbe_hw
*hw
, u16 offset
,
684 u16 words
, u16
*data
)
686 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.read_buffer
,
687 (hw
, offset
, words
, data
),
688 IXGBE_NOT_IMPLEMENTED
);
692 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
693 * @hw: pointer to hardware structure
694 * @checksum_val: calculated checksum
696 * Performs checksum calculation and validates the EEPROM checksum
698 s32
ixgbe_validate_eeprom_checksum(struct ixgbe_hw
*hw
, u16
*checksum_val
)
700 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.validate_checksum
,
701 (hw
, checksum_val
), IXGBE_NOT_IMPLEMENTED
);
705 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
706 * @hw: pointer to hardware structure
708 s32
ixgbe_update_eeprom_checksum(struct ixgbe_hw
*hw
)
710 return ixgbe_call_func(hw
, hw
->eeprom
.ops
.update_checksum
, (hw
),
711 IXGBE_NOT_IMPLEMENTED
);
715 * ixgbe_insert_mac_addr - Find a RAR for this mac address
716 * @hw: pointer to hardware structure
717 * @addr: Address to put into receive address register
718 * @vmdq: VMDq pool to assign
720 * Puts an ethernet address into a receive address register, or
721 * finds the rar that it is aleady in; adds to the pool list
723 s32
ixgbe_insert_mac_addr(struct ixgbe_hw
*hw
, u8
*addr
, u32 vmdq
)
725 return ixgbe_call_func(hw
, hw
->mac
.ops
.insert_mac_addr
,
727 IXGBE_NOT_IMPLEMENTED
);
731 * ixgbe_set_rar - Set Rx address register
732 * @hw: pointer to hardware structure
733 * @index: Receive address register to write
734 * @addr: Address to put into receive address register
736 * @enable_addr: set flag that address is active
738 * Puts an ethernet address into a receive address register.
740 s32
ixgbe_set_rar(struct ixgbe_hw
*hw
, u32 index
, u8
*addr
, u32 vmdq
,
743 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_rar
, (hw
, index
, addr
, vmdq
,
744 enable_addr
), IXGBE_NOT_IMPLEMENTED
);
748 * ixgbe_clear_rar - Clear Rx address register
749 * @hw: pointer to hardware structure
750 * @index: Receive address register to write
752 * Puts an ethernet address into a receive address register.
754 s32
ixgbe_clear_rar(struct ixgbe_hw
*hw
, u32 index
)
756 return ixgbe_call_func(hw
, hw
->mac
.ops
.clear_rar
, (hw
, index
),
757 IXGBE_NOT_IMPLEMENTED
);
761 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
762 * @hw: pointer to hardware structure
763 * @rar: receive address register index to associate with VMDq index
764 * @vmdq: VMDq set or pool index
766 s32
ixgbe_set_vmdq(struct ixgbe_hw
*hw
, u32 rar
, u32 vmdq
)
768 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_vmdq
, (hw
, rar
, vmdq
),
769 IXGBE_NOT_IMPLEMENTED
);
774 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
775 * @hw: pointer to hardware structure
776 * @vmdq: VMDq default pool index
778 s32
ixgbe_set_vmdq_san_mac(struct ixgbe_hw
*hw
, u32 vmdq
)
780 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_vmdq_san_mac
,
781 (hw
, vmdq
), IXGBE_NOT_IMPLEMENTED
);
785 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
786 * @hw: pointer to hardware structure
787 * @rar: receive address register index to disassociate with VMDq index
788 * @vmdq: VMDq set or pool index
790 s32
ixgbe_clear_vmdq(struct ixgbe_hw
*hw
, u32 rar
, u32 vmdq
)
792 return ixgbe_call_func(hw
, hw
->mac
.ops
.clear_vmdq
, (hw
, rar
, vmdq
),
793 IXGBE_NOT_IMPLEMENTED
);
797 * ixgbe_init_rx_addrs - Initializes receive address filters.
798 * @hw: pointer to hardware structure
800 * Places the MAC address in receive address register 0 and clears the rest
801 * of the receive address registers. Clears the multicast table. Assumes
802 * the receiver is in reset when the routine is called.
804 s32
ixgbe_init_rx_addrs(struct ixgbe_hw
*hw
)
806 return ixgbe_call_func(hw
, hw
->mac
.ops
.init_rx_addrs
, (hw
),
807 IXGBE_NOT_IMPLEMENTED
);
811 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
812 * @hw: pointer to hardware structure
814 u32
ixgbe_get_num_rx_addrs(struct ixgbe_hw
*hw
)
816 return hw
->mac
.num_rar_entries
;
820 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
821 * @hw: pointer to hardware structure
822 * @addr_list: the list of new multicast addresses
823 * @addr_count: number of addresses
824 * @func: iterator function to walk the multicast address list
826 * The given list replaces any existing list. Clears the secondary addrs from
827 * receive address registers. Uses unused receive address registers for the
828 * first secondary addresses, and falls back to promiscuous mode as needed.
830 s32
ixgbe_update_uc_addr_list(struct ixgbe_hw
*hw
, u8
*addr_list
,
831 u32 addr_count
, ixgbe_mc_addr_itr func
)
833 return ixgbe_call_func(hw
, hw
->mac
.ops
.update_uc_addr_list
, (hw
,
834 addr_list
, addr_count
, func
),
835 IXGBE_NOT_IMPLEMENTED
);
839 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
840 * @hw: pointer to hardware structure
841 * @mc_addr_list: the list of new multicast addresses
842 * @mc_addr_count: number of addresses
843 * @func: iterator function to walk the multicast address list
845 * The given list replaces any existing list. Clears the MC addrs from receive
846 * address registers and the multicast table. Uses unused receive address
847 * registers for the first multicast addresses, and hashes the rest into the
850 s32
ixgbe_update_mc_addr_list(struct ixgbe_hw
*hw
, u8
*mc_addr_list
,
851 u32 mc_addr_count
, ixgbe_mc_addr_itr func
,
854 return ixgbe_call_func(hw
, hw
->mac
.ops
.update_mc_addr_list
, (hw
,
855 mc_addr_list
, mc_addr_count
, func
, clear
),
856 IXGBE_NOT_IMPLEMENTED
);
860 * ixgbe_enable_mc - Enable multicast address in RAR
861 * @hw: pointer to hardware structure
863 * Enables multicast address in RAR and the use of the multicast hash table.
865 s32
ixgbe_enable_mc(struct ixgbe_hw
*hw
)
867 return ixgbe_call_func(hw
, hw
->mac
.ops
.enable_mc
, (hw
),
868 IXGBE_NOT_IMPLEMENTED
);
872 * ixgbe_disable_mc - Disable multicast address in RAR
873 * @hw: pointer to hardware structure
875 * Disables multicast address in RAR and the use of the multicast hash table.
877 s32
ixgbe_disable_mc(struct ixgbe_hw
*hw
)
879 return ixgbe_call_func(hw
, hw
->mac
.ops
.disable_mc
, (hw
),
880 IXGBE_NOT_IMPLEMENTED
);
884 * ixgbe_clear_vfta - Clear VLAN filter table
885 * @hw: pointer to hardware structure
887 * Clears the VLAN filer table, and the VMDq index associated with the filter
889 s32
ixgbe_clear_vfta(struct ixgbe_hw
*hw
)
891 return ixgbe_call_func(hw
, hw
->mac
.ops
.clear_vfta
, (hw
),
892 IXGBE_NOT_IMPLEMENTED
);
896 * ixgbe_set_vfta - Set VLAN filter table
897 * @hw: pointer to hardware structure
898 * @vlan: VLAN id to write to VLAN filter
899 * @vind: VMDq output index that maps queue to VLAN id in VFTA
900 * @vlan_on: boolean flag to turn on/off VLAN in VFTA
902 * Turn on/off specified VLAN in the VLAN filter table.
904 s32
ixgbe_set_vfta(struct ixgbe_hw
*hw
, u32 vlan
, u32 vind
, bool vlan_on
)
906 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_vfta
, (hw
, vlan
, vind
,
907 vlan_on
), IXGBE_NOT_IMPLEMENTED
);
911 * ixgbe_set_vlvf - Set VLAN Pool Filter
912 * @hw: pointer to hardware structure
913 * @vlan: VLAN id to write to VLAN filter
914 * @vind: VMDq output index that maps queue to VLAN id in VFVFB
915 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
916 * @vfta_changed: pointer to boolean flag which indicates whether VFTA
919 * Turn on/off specified bit in VLVF table.
921 s32
ixgbe_set_vlvf(struct ixgbe_hw
*hw
, u32 vlan
, u32 vind
, bool vlan_on
,
924 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_vlvf
, (hw
, vlan
, vind
,
925 vlan_on
, vfta_changed
), IXGBE_NOT_IMPLEMENTED
);
929 * ixgbe_fc_enable - Enable flow control
930 * @hw: pointer to hardware structure
932 * Configures the flow control settings based on SW configuration.
934 s32
ixgbe_fc_enable(struct ixgbe_hw
*hw
)
936 return ixgbe_call_func(hw
, hw
->mac
.ops
.fc_enable
, (hw
),
937 IXGBE_NOT_IMPLEMENTED
);
941 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
942 * @hw: pointer to hardware structure
943 * @maj: driver major number to be sent to firmware
944 * @min: driver minor number to be sent to firmware
945 * @build: driver build number to be sent to firmware
946 * @ver: driver version number to be sent to firmware
948 s32
ixgbe_set_fw_drv_ver(struct ixgbe_hw
*hw
, u8 maj
, u8 min
, u8 build
,
951 return ixgbe_call_func(hw
, hw
->mac
.ops
.set_fw_drv_ver
, (hw
, maj
, min
,
952 build
, ver
), IXGBE_NOT_IMPLEMENTED
);
957 * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data
958 * @hw: pointer to hardware structure
960 * Updates the temperatures in mac.thermal_sensor_data
962 s32
ixgbe_get_thermal_sensor_data(struct ixgbe_hw
*hw
)
964 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_thermal_sensor_data
, (hw
),
965 IXGBE_NOT_IMPLEMENTED
);
969 * ixgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds
970 * @hw: pointer to hardware structure
972 * Inits the thermal sensor thresholds according to the NVM map
974 s32
ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw
*hw
)
976 return ixgbe_call_func(hw
, hw
->mac
.ops
.init_thermal_sensor_thresh
, (hw
),
977 IXGBE_NOT_IMPLEMENTED
);
980 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
981 * @hw: pointer to hardware structure
982 * @reg: analog register to read
985 * Performs write operation to analog register specified.
987 s32
ixgbe_read_analog_reg8(struct ixgbe_hw
*hw
, u32 reg
, u8
*val
)
989 return ixgbe_call_func(hw
, hw
->mac
.ops
.read_analog_reg8
, (hw
, reg
,
990 val
), IXGBE_NOT_IMPLEMENTED
);
994 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
995 * @hw: pointer to hardware structure
996 * @reg: analog register to write
997 * @val: value to write
999 * Performs write operation to Atlas analog register specified.
1001 s32
ixgbe_write_analog_reg8(struct ixgbe_hw
*hw
, u32 reg
, u8 val
)
1003 return ixgbe_call_func(hw
, hw
->mac
.ops
.write_analog_reg8
, (hw
, reg
,
1004 val
), IXGBE_NOT_IMPLEMENTED
);
1008 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1009 * @hw: pointer to hardware structure
1011 * Initializes the Unicast Table Arrays to zero on device load. This
1012 * is part of the Rx init addr execution path.
1014 s32
ixgbe_init_uta_tables(struct ixgbe_hw
*hw
)
1016 return ixgbe_call_func(hw
, hw
->mac
.ops
.init_uta_tables
, (hw
),
1017 IXGBE_NOT_IMPLEMENTED
);
1021 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1022 * @hw: pointer to hardware structure
1023 * @byte_offset: byte offset to read
1026 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1028 s32
ixgbe_read_i2c_byte(struct ixgbe_hw
*hw
, u8 byte_offset
, u8 dev_addr
,
1031 return ixgbe_call_func(hw
, hw
->phy
.ops
.read_i2c_byte
, (hw
, byte_offset
,
1032 dev_addr
, data
), IXGBE_NOT_IMPLEMENTED
);
1036 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1037 * @hw: pointer to hardware structure
1038 * @byte_offset: byte offset to write
1039 * @data: value to write
1041 * Performs byte write operation to SFP module's EEPROM over I2C interface
1042 * at a specified device address.
1044 s32
ixgbe_write_i2c_byte(struct ixgbe_hw
*hw
, u8 byte_offset
, u8 dev_addr
,
1047 return ixgbe_call_func(hw
, hw
->phy
.ops
.write_i2c_byte
, (hw
, byte_offset
,
1048 dev_addr
, data
), IXGBE_NOT_IMPLEMENTED
);
1052 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1053 * @hw: pointer to hardware structure
1054 * @byte_offset: EEPROM byte offset to write
1055 * @eeprom_data: value to write
1057 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1059 s32
ixgbe_write_i2c_eeprom(struct ixgbe_hw
*hw
,
1060 u8 byte_offset
, u8 eeprom_data
)
1062 return ixgbe_call_func(hw
, hw
->phy
.ops
.write_i2c_eeprom
,
1063 (hw
, byte_offset
, eeprom_data
),
1064 IXGBE_NOT_IMPLEMENTED
);
1068 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1069 * @hw: pointer to hardware structure
1070 * @byte_offset: EEPROM byte offset to read
1071 * @eeprom_data: value read
1073 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1075 s32
ixgbe_read_i2c_eeprom(struct ixgbe_hw
*hw
, u8 byte_offset
, u8
*eeprom_data
)
1077 return ixgbe_call_func(hw
, hw
->phy
.ops
.read_i2c_eeprom
,
1078 (hw
, byte_offset
, eeprom_data
),
1079 IXGBE_NOT_IMPLEMENTED
);
1083 * ixgbe_get_supported_physical_layer - Returns physical layer type
1084 * @hw: pointer to hardware structure
1086 * Determines physical layer capabilities of the current configuration.
1088 u32
ixgbe_get_supported_physical_layer(struct ixgbe_hw
*hw
)
1090 return ixgbe_call_func(hw
, hw
->mac
.ops
.get_supported_physical_layer
,
1091 (hw
), IXGBE_PHYSICAL_LAYER_UNKNOWN
);
1095 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1096 * @hw: pointer to hardware structure
1097 * @regval: bitfield to write to the Rx DMA register
1099 * Enables the Rx DMA unit of the device.
1101 s32
ixgbe_enable_rx_dma(struct ixgbe_hw
*hw
, u32 regval
)
1103 return ixgbe_call_func(hw
, hw
->mac
.ops
.enable_rx_dma
,
1104 (hw
, regval
), IXGBE_NOT_IMPLEMENTED
);
1108 * ixgbe_disable_sec_rx_path - Stops the receive data path
1109 * @hw: pointer to hardware structure
1111 * Stops the receive data path.
1113 s32
ixgbe_disable_sec_rx_path(struct ixgbe_hw
*hw
)
1115 return ixgbe_call_func(hw
, hw
->mac
.ops
.disable_sec_rx_path
,
1116 (hw
), IXGBE_NOT_IMPLEMENTED
);
1120 * ixgbe_enable_sec_rx_path - Enables the receive data path
1121 * @hw: pointer to hardware structure
1123 * Enables the receive data path.
1125 s32
ixgbe_enable_sec_rx_path(struct ixgbe_hw
*hw
)
1127 return ixgbe_call_func(hw
, hw
->mac
.ops
.enable_sec_rx_path
,
1128 (hw
), IXGBE_NOT_IMPLEMENTED
);
1132 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1133 * @hw: pointer to hardware structure
1134 * @mask: Mask to specify which semaphore to acquire
1136 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1137 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1139 s32
ixgbe_acquire_swfw_semaphore(struct ixgbe_hw
*hw
, u16 mask
)
1141 return ixgbe_call_func(hw
, hw
->mac
.ops
.acquire_swfw_sync
,
1142 (hw
, mask
), IXGBE_NOT_IMPLEMENTED
);
1146 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1147 * @hw: pointer to hardware structure
1148 * @mask: Mask to specify which semaphore to release
1150 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1151 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1153 void ixgbe_release_swfw_semaphore(struct ixgbe_hw
*hw
, u16 mask
)
1155 if (hw
->mac
.ops
.release_swfw_sync
)
1156 hw
->mac
.ops
.release_swfw_sync(hw
, mask
);