1 // SPDX-License-Identifier: GPL-2.0
2 /*******************************************************************************
4 Intel 10 Gigabit PCI Express Linux driver
5 Copyright(c) 1999 - 2012 Intel Corporation.
8 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
9 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
11 *******************************************************************************/
13 #include "ixgbe_api.h"
14 #include "ixgbe_common.h"
17 * ixgbe_init_shared_code - Initialize the shared code
18 * @hw: pointer to hardware structure
20 * This will assign function pointers and assign the MAC type and PHY code.
21 * Does not touch the hardware. This function must be called prior to any
22 * other function in the shared code. The ixgbe_hw structure should be
23 * memset to 0 prior to calling this function. The following fields in
24 * hw structure should be filled in prior to calling this function:
25 * hw_addr, back, device_id, vendor_id, subsystem_device_id,
26 * subsystem_vendor_id, and revision_id
28 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
35 ixgbe_set_mac_type(hw);
37 switch (hw->mac.type) {
38 case ixgbe_mac_82598EB:
39 status = ixgbe_init_ops_82598(hw);
41 case ixgbe_mac_82599EB:
42 status = ixgbe_init_ops_82599(hw);
45 status = ixgbe_init_ops_X540(hw);
48 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
56 * ixgbe_set_mac_type - Sets MAC type
57 * @hw: pointer to the HW structure
59 * This function sets the mac type of the adapter based on the
60 * vendor ID and device ID stored in the hw structure.
62 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
66 if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
67 switch (hw->device_id) {
68 case IXGBE_DEV_ID_82598:
69 case IXGBE_DEV_ID_82598_BX:
70 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
71 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
72 case IXGBE_DEV_ID_82598AT:
73 case IXGBE_DEV_ID_82598AT2:
74 case IXGBE_DEV_ID_82598EB_CX4:
75 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
76 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
77 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
78 case IXGBE_DEV_ID_82598EB_XF_LR:
79 case IXGBE_DEV_ID_82598EB_SFP_LOM:
80 hw->mac.type = ixgbe_mac_82598EB;
82 case IXGBE_DEV_ID_82599_KX4:
83 case IXGBE_DEV_ID_82599_KX4_MEZZ:
84 case IXGBE_DEV_ID_82599_XAUI_LOM:
85 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
86 case IXGBE_DEV_ID_82599_KR:
87 case IXGBE_DEV_ID_82599_SFP:
88 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
89 case IXGBE_DEV_ID_82599_SFP_FCOE:
90 case IXGBE_DEV_ID_82599_SFP_EM:
91 case IXGBE_DEV_ID_82599_SFP_SF2:
92 case IXGBE_DEV_ID_82599_QSFP_SF_QP:
93 case IXGBE_DEV_ID_82599EN_SFP:
94 case IXGBE_DEV_ID_82599_CX4:
95 case IXGBE_DEV_ID_82599_LS:
96 case IXGBE_DEV_ID_82599_T3_LOM:
97 hw->mac.type = ixgbe_mac_82599EB;
99 case IXGBE_DEV_ID_X540T:
100 hw->mac.type = ixgbe_mac_X540;
103 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
107 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
110 hw_dbg(hw, "ixgbe_set_mac_type found mac: %d, returns: %d\n",
111 hw->mac.type, ret_val);
116 * ixgbe_init_hw - Initialize the hardware
117 * @hw: pointer to hardware structure
119 * Initialize the hardware by resetting and then starting the hardware
121 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
123 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
124 IXGBE_NOT_IMPLEMENTED);
128 * ixgbe_reset_hw - Performs a hardware reset
129 * @hw: pointer to hardware structure
131 * Resets the hardware by resetting the transmit and receive units, masks and
132 * clears all interrupts, performs a PHY reset, and performs a MAC reset
134 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
136 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
137 IXGBE_NOT_IMPLEMENTED);
141 * ixgbe_start_hw - Prepares hardware for Rx/Tx
142 * @hw: pointer to hardware structure
144 * Starts the hardware by filling the bus info structure and media type,
145 * clears all on chip counters, initializes receive address registers,
146 * multicast table, VLAN filter table, calls routine to setup link and
147 * flow control settings, and leaves transmit and receive units disabled
150 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
152 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
153 IXGBE_NOT_IMPLEMENTED);
157 * ixgbe_clear_hw_cntrs - Clear hardware counters
158 * @hw: pointer to hardware structure
160 * Clears all hardware statistics counters by reading them from the hardware
161 * Statistics counters are clear on read.
163 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
165 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
166 IXGBE_NOT_IMPLEMENTED);
170 * ixgbe_get_media_type - Get media type
171 * @hw: pointer to hardware structure
173 * Returns the media type (fiber, copper, backplane)
175 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
177 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
178 ixgbe_media_type_unknown);
182 * ixgbe_get_mac_addr - Get MAC address
183 * @hw: pointer to hardware structure
184 * @mac_addr: Adapter MAC address
186 * Reads the adapter's MAC address from the first Receive Address Register
187 * (RAR0) A reset of the adapter must have been performed prior to calling
188 * this function in order for the MAC address to have been loaded from the
191 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
193 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
194 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
198 * ixgbe_get_san_mac_addr - Get SAN MAC address
199 * @hw: pointer to hardware structure
200 * @san_mac_addr: SAN MAC address
202 * Reads the SAN MAC address from the EEPROM, if it's available. This is
203 * per-port, so set_lan_id() must be called before reading the addresses.
205 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
207 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
208 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
212 * ixgbe_set_san_mac_addr - Write a SAN MAC address
213 * @hw: pointer to hardware structure
214 * @san_mac_addr: SAN MAC address
216 * Writes A SAN MAC address to the EEPROM.
218 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
220 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
221 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
225 * ixgbe_get_device_caps - Get additional device capabilities
226 * @hw: pointer to hardware structure
227 * @device_caps: the EEPROM word for device capabilities
229 * Reads the extra device capabilities from the EEPROM
231 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
233 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
234 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
238 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
239 * @hw: pointer to hardware structure
240 * @wwnn_prefix: the alternative WWNN prefix
241 * @wwpn_prefix: the alternative WWPN prefix
243 * This function will read the EEPROM from the alternative SAN MAC address
244 * block to check the support for the alternative WWNN/WWPN prefix support.
246 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
249 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
250 (hw, wwnn_prefix, wwpn_prefix),
251 IXGBE_NOT_IMPLEMENTED);
255 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
256 * @hw: pointer to hardware structure
257 * @bs: the fcoe boot status
259 * This function will read the FCOE boot status from the iSCSI FCOE block
261 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
263 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
265 IXGBE_NOT_IMPLEMENTED);
269 * ixgbe_get_bus_info - Set PCI bus info
270 * @hw: pointer to hardware structure
272 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
274 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
276 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
277 IXGBE_NOT_IMPLEMENTED);
281 * ixgbe_get_num_of_tx_queues - Get Tx queues
282 * @hw: pointer to hardware structure
284 * Returns the number of transmit queues for the given adapter.
286 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
288 return hw->mac.max_tx_queues;
292 * ixgbe_get_num_of_rx_queues - Get Rx queues
293 * @hw: pointer to hardware structure
295 * Returns the number of receive queues for the given adapter.
297 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
299 return hw->mac.max_rx_queues;
303 * ixgbe_stop_adapter - Disable Rx/Tx units
304 * @hw: pointer to hardware structure
306 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
307 * disables transmit and receive units. The adapter_stopped flag is used by
308 * the shared code and drivers to determine if the adapter is in a stopped
309 * state and should not touch the hardware.
311 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
313 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
314 IXGBE_NOT_IMPLEMENTED);
318 * ixgbe_read_pba_string - Reads part number string from EEPROM
319 * @hw: pointer to hardware structure
320 * @pba_num: stores the part number string from the EEPROM
321 * @pba_num_size: part number string buffer length
323 * Reads the part number string from the EEPROM.
325 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
327 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
331 * ixgbe_identify_phy - Get PHY type
332 * @hw: pointer to hardware structure
334 * Determines the physical layer module found on the current adapter.
336 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
340 if (hw->phy.type == ixgbe_phy_unknown) {
341 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
342 IXGBE_NOT_IMPLEMENTED);
349 * ixgbe_reset_phy - Perform a PHY reset
350 * @hw: pointer to hardware structure
352 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
356 if (hw->phy.type == ixgbe_phy_unknown) {
357 if (ixgbe_identify_phy(hw) != 0)
358 status = IXGBE_ERR_PHY;
362 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
363 IXGBE_NOT_IMPLEMENTED);
369 * ixgbe_get_phy_firmware_version -
370 * @hw: pointer to hardware structure
371 * @firmware_version: pointer to firmware version
373 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
377 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
378 (hw, firmware_version),
379 IXGBE_NOT_IMPLEMENTED);
384 * ixgbe_read_phy_reg - Read PHY register
385 * @hw: pointer to hardware structure
386 * @reg_addr: 32 bit address of PHY register to read
387 * @phy_data: Pointer to read data from PHY register
389 * Reads a value from a specified PHY register
391 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
395 ixgbe_identify_phy(hw);
397 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
398 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
402 * ixgbe_write_phy_reg - Write PHY register
403 * @hw: pointer to hardware structure
404 * @reg_addr: 32 bit PHY register to write
405 * @phy_data: Data to write to the PHY register
407 * Writes a value to specified PHY register
409 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
413 ixgbe_identify_phy(hw);
415 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
416 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
420 * ixgbe_setup_phy_link - Restart PHY autoneg
421 * @hw: pointer to hardware structure
423 * Restart autonegotiation and PHY and waits for completion.
425 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
427 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
428 IXGBE_NOT_IMPLEMENTED);
432 * ixgbe_check_phy_link - Determine link and speed status
433 * @hw: pointer to hardware structure
435 * Reads a PHY register to determine if link is up and the current speed for
438 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
441 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
442 link_up), IXGBE_NOT_IMPLEMENTED);
446 * ixgbe_setup_phy_link_speed - Set auto advertise
447 * @hw: pointer to hardware structure
448 * @speed: new link speed
449 * @autoneg: true if autonegotiation enabled
451 * Sets the auto advertised capabilities
453 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
455 bool autoneg_wait_to_complete)
457 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
458 autoneg, autoneg_wait_to_complete),
459 IXGBE_NOT_IMPLEMENTED);
463 * ixgbe_check_link - Get link and speed status
464 * @hw: pointer to hardware structure
466 * Reads the links register to determine if link is up and the current speed
468 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
469 bool *link_up, bool link_up_wait_to_complete)
471 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
472 link_up, link_up_wait_to_complete),
473 IXGBE_NOT_IMPLEMENTED);
477 * ixgbe_disable_tx_laser - Disable Tx laser
478 * @hw: pointer to hardware structure
480 * If the driver needs to disable the laser on SFI optics.
482 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
484 if (hw->mac.ops.disable_tx_laser)
485 hw->mac.ops.disable_tx_laser(hw);
489 * ixgbe_enable_tx_laser - Enable Tx laser
490 * @hw: pointer to hardware structure
492 * If the driver needs to enable the laser on SFI optics.
494 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
496 if (hw->mac.ops.enable_tx_laser)
497 hw->mac.ops.enable_tx_laser(hw);
501 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
502 * @hw: pointer to hardware structure
504 * When the driver changes the link speeds that it can support then
505 * flap the tx laser to alert the link partner to start autotry
506 * process on its end.
508 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
510 if (hw->mac.ops.flap_tx_laser)
511 hw->mac.ops.flap_tx_laser(hw);
515 * ixgbe_setup_link - Set link speed
516 * @hw: pointer to hardware structure
517 * @speed: new link speed
518 * @autoneg: true if autonegotiation enabled
520 * Configures link settings. Restarts the link.
521 * Performs autonegotiation if needed.
523 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
525 bool autoneg_wait_to_complete)
527 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
528 autoneg, autoneg_wait_to_complete),
529 IXGBE_NOT_IMPLEMENTED);
533 * ixgbe_get_link_capabilities - Returns link capabilities
534 * @hw: pointer to hardware structure
536 * Determines the link capabilities of the current configuration.
538 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
541 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
542 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
546 * ixgbe_led_on - Turn on LEDs
547 * @hw: pointer to hardware structure
548 * @index: led number to turn on
550 * Turns on the software controllable LEDs.
552 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
554 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
555 IXGBE_NOT_IMPLEMENTED);
559 * ixgbe_led_off - Turn off LEDs
560 * @hw: pointer to hardware structure
561 * @index: led number to turn off
563 * Turns off the software controllable LEDs.
565 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
567 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
568 IXGBE_NOT_IMPLEMENTED);
572 * ixgbe_blink_led_start - Blink LEDs
573 * @hw: pointer to hardware structure
574 * @index: led number to blink
576 * Blink LED based on index.
578 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
580 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
581 IXGBE_NOT_IMPLEMENTED);
585 * ixgbe_blink_led_stop - Stop blinking LEDs
586 * @hw: pointer to hardware structure
588 * Stop blinking LED based on index.
590 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
592 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
593 IXGBE_NOT_IMPLEMENTED);
597 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
598 * @hw: pointer to hardware structure
600 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
601 * ixgbe_hw struct in order to set up EEPROM access.
603 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
605 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
606 IXGBE_NOT_IMPLEMENTED);
611 * ixgbe_write_eeprom - Write word to EEPROM
612 * @hw: pointer to hardware structure
613 * @offset: offset within the EEPROM to be written to
614 * @data: 16 bit word to be written to the EEPROM
616 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
617 * called after this function, the EEPROM will most likely contain an
620 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
622 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
623 IXGBE_NOT_IMPLEMENTED);
627 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
628 * @hw: pointer to hardware structure
629 * @offset: offset within the EEPROM to be written to
630 * @data: 16 bit word(s) to be written to the EEPROM
631 * @words: number of words
633 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
634 * called after this function, the EEPROM will most likely contain an
637 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
640 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
641 (hw, offset, words, data),
642 IXGBE_NOT_IMPLEMENTED);
646 * ixgbe_read_eeprom - Read word from EEPROM
647 * @hw: pointer to hardware structure
648 * @offset: offset within the EEPROM to be read
649 * @data: read 16 bit value from EEPROM
651 * Reads 16 bit value from EEPROM
653 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
655 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
656 IXGBE_NOT_IMPLEMENTED);
660 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
661 * @hw: pointer to hardware structure
662 * @offset: offset within the EEPROM to be read
663 * @data: read 16 bit word(s) from EEPROM
664 * @words: number of words
666 * Reads 16 bit word(s) from EEPROM
668 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
669 u16 words, u16 *data)
671 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
672 (hw, offset, words, data),
673 IXGBE_NOT_IMPLEMENTED);
677 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
678 * @hw: pointer to hardware structure
679 * @checksum_val: calculated checksum
681 * Performs checksum calculation and validates the EEPROM checksum
683 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
685 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
686 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
690 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
691 * @hw: pointer to hardware structure
693 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
695 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
696 IXGBE_NOT_IMPLEMENTED);
700 * ixgbe_insert_mac_addr - Find a RAR for this mac address
701 * @hw: pointer to hardware structure
702 * @addr: Address to put into receive address register
703 * @vmdq: VMDq pool to assign
705 * Puts an ethernet address into a receive address register, or
706 * finds the rar that it is already in; adds to the pool list
708 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
710 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
712 IXGBE_NOT_IMPLEMENTED);
716 * ixgbe_set_rar - Set Rx address register
717 * @hw: pointer to hardware structure
718 * @index: Receive address register to write
719 * @addr: Address to put into receive address register
721 * @enable_addr: set flag that address is active
723 * Puts an ethernet address into a receive address register.
725 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
728 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
729 enable_addr), IXGBE_NOT_IMPLEMENTED);
733 * ixgbe_clear_rar - Clear Rx address register
734 * @hw: pointer to hardware structure
735 * @index: Receive address register to write
737 * Puts an ethernet address into a receive address register.
739 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
741 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
742 IXGBE_NOT_IMPLEMENTED);
746 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
747 * @hw: pointer to hardware structure
748 * @rar: receive address register index to associate with VMDq index
749 * @vmdq: VMDq set or pool index
751 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
753 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
754 IXGBE_NOT_IMPLEMENTED);
759 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
760 * @hw: pointer to hardware structure
761 * @vmdq: VMDq default pool index
763 s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
765 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
766 (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
770 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
771 * @hw: pointer to hardware structure
772 * @rar: receive address register index to disassociate with VMDq index
773 * @vmdq: VMDq set or pool index
775 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
777 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
778 IXGBE_NOT_IMPLEMENTED);
782 * ixgbe_init_rx_addrs - Initializes receive address filters.
783 * @hw: pointer to hardware structure
785 * Places the MAC address in receive address register 0 and clears the rest
786 * of the receive address registers. Clears the multicast table. Assumes
787 * the receiver is in reset when the routine is called.
789 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
791 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
792 IXGBE_NOT_IMPLEMENTED);
796 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
797 * @hw: pointer to hardware structure
799 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
801 return hw->mac.num_rar_entries;
805 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
806 * @hw: pointer to hardware structure
807 * @addr_list: the list of new multicast addresses
808 * @addr_count: number of addresses
809 * @func: iterator function to walk the multicast address list
811 * The given list replaces any existing list. Clears the secondary addrs from
812 * receive address registers. Uses unused receive address registers for the
813 * first secondary addresses, and falls back to promiscuous mode as needed.
815 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
816 u32 addr_count, ixgbe_mc_addr_itr func)
818 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
819 addr_list, addr_count, func),
820 IXGBE_NOT_IMPLEMENTED);
824 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
825 * @hw: pointer to hardware structure
826 * @mc_addr_list: the list of new multicast addresses
827 * @mc_addr_count: number of addresses
828 * @func: iterator function to walk the multicast address list
830 * The given list replaces any existing list. Clears the MC addrs from receive
831 * address registers and the multicast table. Uses unused receive address
832 * registers for the first multicast addresses, and hashes the rest into the
835 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
836 u32 mc_addr_count, ixgbe_mc_addr_itr func,
839 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
840 mc_addr_list, mc_addr_count, func, clear),
841 IXGBE_NOT_IMPLEMENTED);
845 * ixgbe_enable_mc - Enable multicast address in RAR
846 * @hw: pointer to hardware structure
848 * Enables multicast address in RAR and the use of the multicast hash table.
850 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
852 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
853 IXGBE_NOT_IMPLEMENTED);
857 * ixgbe_disable_mc - Disable multicast address in RAR
858 * @hw: pointer to hardware structure
860 * Disables multicast address in RAR and the use of the multicast hash table.
862 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
864 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
865 IXGBE_NOT_IMPLEMENTED);
869 * ixgbe_clear_vfta - Clear VLAN filter table
870 * @hw: pointer to hardware structure
872 * Clears the VLAN filer table, and the VMDq index associated with the filter
874 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
876 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
877 IXGBE_NOT_IMPLEMENTED);
881 * ixgbe_set_vfta - Set VLAN filter table
882 * @hw: pointer to hardware structure
883 * @vlan: VLAN id to write to VLAN filter
884 * @vind: VMDq output index that maps queue to VLAN id in VFTA
885 * @vlan_on: boolean flag to turn on/off VLAN in VFTA
887 * Turn on/off specified VLAN in the VLAN filter table.
889 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
891 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
892 vlan_on), IXGBE_NOT_IMPLEMENTED);
896 * ixgbe_set_vlvf - Set VLAN Pool Filter
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 VFVFB
900 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
901 * @vfta_changed: pointer to boolean flag which indicates whether VFTA
904 * Turn on/off specified bit in VLVF table.
906 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
909 return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
910 vlan_on, vfta_changed), IXGBE_NOT_IMPLEMENTED);
914 * ixgbe_fc_enable - Enable flow control
915 * @hw: pointer to hardware structure
917 * Configures the flow control settings based on SW configuration.
919 s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
921 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
922 IXGBE_NOT_IMPLEMENTED);
926 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
927 * @hw: pointer to hardware structure
928 * @maj: driver major number to be sent to firmware
929 * @min: driver minor number to be sent to firmware
930 * @build: driver build number to be sent to firmware
931 * @ver: driver version number to be sent to firmware
933 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
936 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
937 build, ver), IXGBE_NOT_IMPLEMENTED);
942 * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data
943 * @hw: pointer to hardware structure
945 * Updates the temperatures in mac.thermal_sensor_data
947 s32 ixgbe_get_thermal_sensor_data(struct ixgbe_hw *hw)
949 return ixgbe_call_func(hw, hw->mac.ops.get_thermal_sensor_data, (hw),
950 IXGBE_NOT_IMPLEMENTED);
954 * ixgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds
955 * @hw: pointer to hardware structure
957 * Inits the thermal sensor thresholds according to the NVM map
959 s32 ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw *hw)
961 return ixgbe_call_func(hw, hw->mac.ops.init_thermal_sensor_thresh, (hw),
962 IXGBE_NOT_IMPLEMENTED);
965 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
966 * @hw: pointer to hardware structure
967 * @reg: analog register to read
970 * Performs write operation to analog register specified.
972 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
974 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
975 val), IXGBE_NOT_IMPLEMENTED);
979 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
980 * @hw: pointer to hardware structure
981 * @reg: analog register to write
982 * @val: value to write
984 * Performs write operation to Atlas analog register specified.
986 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
988 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
989 val), IXGBE_NOT_IMPLEMENTED);
993 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
994 * @hw: pointer to hardware structure
996 * Initializes the Unicast Table Arrays to zero on device load. This
997 * is part of the Rx init addr execution path.
999 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1001 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1002 IXGBE_NOT_IMPLEMENTED);
1006 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1007 * @hw: pointer to hardware structure
1008 * @byte_offset: byte offset to read
1011 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1013 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1016 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1017 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1021 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1022 * @hw: pointer to hardware structure
1023 * @byte_offset: byte offset to write
1024 * @data: value to write
1026 * Performs byte write operation to SFP module's EEPROM over I2C interface
1027 * at a specified device address.
1029 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1032 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1033 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1037 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1038 * @hw: pointer to hardware structure
1039 * @byte_offset: EEPROM byte offset to write
1040 * @eeprom_data: value to write
1042 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1044 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1045 u8 byte_offset, u8 eeprom_data)
1047 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1048 (hw, byte_offset, eeprom_data),
1049 IXGBE_NOT_IMPLEMENTED);
1053 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1054 * @hw: pointer to hardware structure
1055 * @byte_offset: EEPROM byte offset to read
1056 * @eeprom_data: value read
1058 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1060 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1062 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1063 (hw, byte_offset, eeprom_data),
1064 IXGBE_NOT_IMPLEMENTED);
1068 * ixgbe_get_supported_physical_layer - Returns physical layer type
1069 * @hw: pointer to hardware structure
1071 * Determines physical layer capabilities of the current configuration.
1073 u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1075 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1076 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1080 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1081 * @hw: pointer to hardware structure
1082 * @regval: bitfield to write to the Rx DMA register
1084 * Enables the Rx DMA unit of the device.
1086 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1088 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1089 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1093 * ixgbe_disable_sec_rx_path - Stops the receive data path
1094 * @hw: pointer to hardware structure
1096 * Stops the receive data path.
1098 s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1100 return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1101 (hw), IXGBE_NOT_IMPLEMENTED);
1105 * ixgbe_enable_sec_rx_path - Enables the receive data path
1106 * @hw: pointer to hardware structure
1108 * Enables the receive data path.
1110 s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1112 return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1113 (hw), IXGBE_NOT_IMPLEMENTED);
1117 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1118 * @hw: pointer to hardware structure
1119 * @mask: Mask to specify which semaphore to acquire
1121 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1122 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1124 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1126 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1127 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1131 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1132 * @hw: pointer to hardware structure
1133 * @mask: Mask to specify which semaphore to release
1135 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1136 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1138 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1140 if (hw->mac.ops.release_swfw_sync)
1141 hw->mac.ops.release_swfw_sync(hw, mask);