1179055Sjfv/******************************************************************************
2171384Sjfv
3247822Sjfv  Copyright (c) 2001-2013, Intel Corporation
4171384Sjfv  All rights reserved.
5171384Sjfv
6171384Sjfv  Redistribution and use in source and binary forms, with or without
7171384Sjfv  modification, are permitted provided that the following conditions are met:
8171384Sjfv
9171384Sjfv   1. Redistributions of source code must retain the above copyright notice,
10171384Sjfv      this list of conditions and the following disclaimer.
11171384Sjfv
12171384Sjfv   2. Redistributions in binary form must reproduce the above copyright
13171384Sjfv      notice, this list of conditions and the following disclaimer in the
14171384Sjfv      documentation and/or other materials provided with the distribution.
15171384Sjfv
16171384Sjfv   3. Neither the name of the Intel Corporation nor the names of its
17171384Sjfv      contributors may be used to endorse or promote products derived from
18171384Sjfv      this software without specific prior written permission.
19171384Sjfv
20171384Sjfv  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21171384Sjfv  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22171384Sjfv  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23171384Sjfv  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24171384Sjfv  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25171384Sjfv  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26171384Sjfv  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27171384Sjfv  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28171384Sjfv  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29171384Sjfv  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30171384Sjfv  POSSIBILITY OF SUCH DAMAGE.
31171384Sjfv
32179055Sjfv******************************************************************************/
33179055Sjfv/*$FreeBSD$*/
34171384Sjfv
35171384Sjfv#include "ixgbe_api.h"
36171384Sjfv#include "ixgbe_common.h"
37171384Sjfv
38171384Sjfv/**
39251964Sjfv * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
40251964Sjfv * @hw: pointer to hardware structure
41251964Sjfv * @map: pointer to u8 arr for returning map
42251964Sjfv *
43251964Sjfv * Read the rtrup2tc HW register and resolve its content into map
44251964Sjfv **/
45251964Sjfvvoid ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
46251964Sjfv{
47251964Sjfv	if (hw->mac.ops.get_rtrup2tc)
48251964Sjfv		hw->mac.ops.get_rtrup2tc(hw, map);
49251964Sjfv}
50251964Sjfv
51251964Sjfv/**
52171384Sjfv *  ixgbe_init_shared_code - Initialize the shared code
53171384Sjfv *  @hw: pointer to hardware structure
54171384Sjfv *
55171384Sjfv *  This will assign function pointers and assign the MAC type and PHY code.
56171384Sjfv *  Does not touch the hardware. This function must be called prior to any
57171384Sjfv *  other function in the shared code. The ixgbe_hw structure should be
58171384Sjfv *  memset to 0 prior to calling this function.  The following fields in
59171384Sjfv *  hw structure should be filled in prior to calling this function:
60171384Sjfv *  hw_addr, back, device_id, vendor_id, subsystem_device_id,
61185352Sjfv *  subsystem_vendor_id, and revision_id
62171384Sjfv **/
63171384Sjfvs32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
64171384Sjfv{
65172043Sjfv	s32 status;
66171384Sjfv
67200239Sjfv	DEBUGFUNC("ixgbe_init_shared_code");
68200239Sjfv
69171384Sjfv	/*
70172043Sjfv	 * Set the mac type
71172043Sjfv	 */
72172043Sjfv	ixgbe_set_mac_type(hw);
73172043Sjfv
74172043Sjfv	switch (hw->mac.type) {
75172043Sjfv	case ixgbe_mac_82598EB:
76179055Sjfv		status = ixgbe_init_ops_82598(hw);
77172043Sjfv		break;
78190873Sjfv	case ixgbe_mac_82599EB:
79190873Sjfv		status = ixgbe_init_ops_82599(hw);
80190873Sjfv		break;
81215911Sjfv	case ixgbe_mac_82599_vf:
82230775Sjfv	case ixgbe_mac_X540_vf:
83215911Sjfv		status = ixgbe_init_ops_vf(hw);
84215911Sjfv		break;
85230775Sjfv	case ixgbe_mac_X540:
86230775Sjfv		status = ixgbe_init_ops_X540(hw);
87230775Sjfv		break;
88172043Sjfv	default:
89172043Sjfv		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
90172043Sjfv		break;
91172043Sjfv	}
92172043Sjfv
93172043Sjfv	return status;
94172043Sjfv}
95172043Sjfv
96172043Sjfv/**
97172043Sjfv *  ixgbe_set_mac_type - Sets MAC type
98172043Sjfv *  @hw: pointer to the HW structure
99172043Sjfv *
100172043Sjfv *  This function sets the mac type of the adapter based on the
101172043Sjfv *  vendor ID and device ID stored in the hw structure.
102172043Sjfv **/
103172043Sjfvs32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
104172043Sjfv{
105172043Sjfv	s32 ret_val = IXGBE_SUCCESS;
106172043Sjfv
107179055Sjfv	DEBUGFUNC("ixgbe_set_mac_type\n");
108172043Sjfv
109251964Sjfv	if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
110251964Sjfv		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
111251964Sjfv			     "Unsupported vendor id: %x", hw->vendor_id);
112251964Sjfv		return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
113251964Sjfv	}
114251964Sjfv
115247822Sjfv	switch (hw->device_id) {
116247822Sjfv	case IXGBE_DEV_ID_82598:
117247822Sjfv	case IXGBE_DEV_ID_82598_BX:
118247822Sjfv	case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
119247822Sjfv	case IXGBE_DEV_ID_82598AF_DUAL_PORT:
120247822Sjfv	case IXGBE_DEV_ID_82598AT:
121247822Sjfv	case IXGBE_DEV_ID_82598AT2:
122247822Sjfv	case IXGBE_DEV_ID_82598EB_CX4:
123247822Sjfv	case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
124247822Sjfv	case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
125247822Sjfv	case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
126247822Sjfv	case IXGBE_DEV_ID_82598EB_XF_LR:
127247822Sjfv	case IXGBE_DEV_ID_82598EB_SFP_LOM:
128247822Sjfv		hw->mac.type = ixgbe_mac_82598EB;
129247822Sjfv		break;
130247822Sjfv	case IXGBE_DEV_ID_82599_KX4:
131247822Sjfv	case IXGBE_DEV_ID_82599_KX4_MEZZ:
132247822Sjfv	case IXGBE_DEV_ID_82599_XAUI_LOM:
133247822Sjfv	case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
134247822Sjfv	case IXGBE_DEV_ID_82599_KR:
135247822Sjfv	case IXGBE_DEV_ID_82599_SFP:
136247822Sjfv	case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
137247822Sjfv	case IXGBE_DEV_ID_82599_SFP_FCOE:
138247822Sjfv	case IXGBE_DEV_ID_82599_SFP_EM:
139247822Sjfv	case IXGBE_DEV_ID_82599_SFP_SF2:
140247822Sjfv	case IXGBE_DEV_ID_82599_SFP_SF_QP:
141247822Sjfv	case IXGBE_DEV_ID_82599EN_SFP:
142247822Sjfv	case IXGBE_DEV_ID_82599_CX4:
143247822Sjfv	case IXGBE_DEV_ID_82599_BYPASS:
144247822Sjfv	case IXGBE_DEV_ID_82599_T3_LOM:
145247822Sjfv		hw->mac.type = ixgbe_mac_82599EB;
146247822Sjfv		break;
147247822Sjfv	case IXGBE_DEV_ID_82599_VF:
148247822Sjfv	case IXGBE_DEV_ID_82599_VF_HV:
149247822Sjfv		hw->mac.type = ixgbe_mac_82599_vf;
150247822Sjfv		break;
151247822Sjfv	case IXGBE_DEV_ID_X540_VF:
152247822Sjfv	case IXGBE_DEV_ID_X540_VF_HV:
153247822Sjfv		hw->mac.type = ixgbe_mac_X540_vf;
154247822Sjfv		break;
155247822Sjfv	case IXGBE_DEV_ID_X540T:
156247822Sjfv	case IXGBE_DEV_ID_X540_BYPASS:
157247822Sjfv		hw->mac.type = ixgbe_mac_X540;
158247822Sjfv		break;
159247822Sjfv	default:
160172043Sjfv		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
161251964Sjfv		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
162251964Sjfv			     "Unsupported device id: %x",
163251964Sjfv			     hw->device_id);
164247822Sjfv		break;
165171384Sjfv	}
166171384Sjfv
167179055Sjfv	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
168230775Sjfv		  hw->mac.type, ret_val);
169172043Sjfv	return ret_val;
170171384Sjfv}
171171384Sjfv
172171384Sjfv/**
173171384Sjfv *  ixgbe_init_hw - Initialize the hardware
174171384Sjfv *  @hw: pointer to hardware structure
175171384Sjfv *
176171384Sjfv *  Initialize the hardware by resetting and then starting the hardware
177171384Sjfv **/
178171384Sjfvs32 ixgbe_init_hw(struct ixgbe_hw *hw)
179171384Sjfv{
180179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
181230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
182171384Sjfv}
183171384Sjfv
184171384Sjfv/**
185171384Sjfv *  ixgbe_reset_hw - Performs a hardware reset
186171384Sjfv *  @hw: pointer to hardware structure
187171384Sjfv *
188171384Sjfv *  Resets the hardware by resetting the transmit and receive units, masks and
189171384Sjfv *  clears all interrupts, performs a PHY reset, and performs a MAC reset
190171384Sjfv **/
191171384Sjfvs32 ixgbe_reset_hw(struct ixgbe_hw *hw)
192171384Sjfv{
193179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
194230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
195171384Sjfv}
196171384Sjfv
197171384Sjfv/**
198179055Sjfv *  ixgbe_start_hw - Prepares hardware for Rx/Tx
199171384Sjfv *  @hw: pointer to hardware structure
200171384Sjfv *
201171384Sjfv *  Starts the hardware by filling the bus info structure and media type,
202171384Sjfv *  clears all on chip counters, initializes receive address registers,
203171384Sjfv *  multicast table, VLAN filter table, calls routine to setup link and
204171384Sjfv *  flow control settings, and leaves transmit and receive units disabled
205171384Sjfv *  and uninitialized.
206171384Sjfv **/
207171384Sjfvs32 ixgbe_start_hw(struct ixgbe_hw *hw)
208171384Sjfv{
209179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
210230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
211171384Sjfv}
212171384Sjfv
213171384Sjfv/**
214205720Sjfv *  ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
215205720Sjfv *  which is disabled by default in ixgbe_start_hw();
216205720Sjfv *
217205720Sjfv *  @hw: pointer to hardware structure
218205720Sjfv *
219205720Sjfv *   Enable relaxed ordering;
220205720Sjfv **/
221205720Sjfvvoid ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
222205720Sjfv{
223205720Sjfv	if (hw->mac.ops.enable_relaxed_ordering)
224205720Sjfv		hw->mac.ops.enable_relaxed_ordering(hw);
225205720Sjfv}
226205720Sjfv
227205720Sjfv/**
228171384Sjfv *  ixgbe_clear_hw_cntrs - Clear hardware counters
229171384Sjfv *  @hw: pointer to hardware structure
230171384Sjfv *
231171384Sjfv *  Clears all hardware statistics counters by reading them from the hardware
232171384Sjfv *  Statistics counters are clear on read.
233171384Sjfv **/
234171384Sjfvs32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
235171384Sjfv{
236179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
237230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
238171384Sjfv}
239171384Sjfv
240171384Sjfv/**
241171384Sjfv *  ixgbe_get_media_type - Get media type
242171384Sjfv *  @hw: pointer to hardware structure
243171384Sjfv *
244171384Sjfv *  Returns the media type (fiber, copper, backplane)
245171384Sjfv **/
246171384Sjfvenum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
247171384Sjfv{
248179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
249230775Sjfv			       ixgbe_media_type_unknown);
250171384Sjfv}
251171384Sjfv
252171384Sjfv/**
253171384Sjfv *  ixgbe_get_mac_addr - Get MAC address
254171384Sjfv *  @hw: pointer to hardware structure
255171384Sjfv *  @mac_addr: Adapter MAC address
256171384Sjfv *
257171384Sjfv *  Reads the adapter's MAC address from the first Receive Address Register
258179055Sjfv *  (RAR0) A reset of the adapter must have been performed prior to calling
259179055Sjfv *  this function in order for the MAC address to have been loaded from the
260179055Sjfv *  EEPROM into RAR0
261171384Sjfv **/
262171384Sjfvs32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
263171384Sjfv{
264179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
265230775Sjfv			       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
266171384Sjfv}
267171384Sjfv
268171384Sjfv/**
269190873Sjfv *  ixgbe_get_san_mac_addr - Get SAN MAC address
270190873Sjfv *  @hw: pointer to hardware structure
271190873Sjfv *  @san_mac_addr: SAN MAC address
272190873Sjfv *
273190873Sjfv *  Reads the SAN MAC address from the EEPROM, if it's available.  This is
274190873Sjfv *  per-port, so set_lan_id() must be called before reading the addresses.
275190873Sjfv **/
276190873Sjfvs32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
277190873Sjfv{
278190873Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
279230775Sjfv			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
280190873Sjfv}
281190873Sjfv
282190873Sjfv/**
283190873Sjfv *  ixgbe_set_san_mac_addr - Write a SAN MAC address
284190873Sjfv *  @hw: pointer to hardware structure
285190873Sjfv *  @san_mac_addr: SAN MAC address
286190873Sjfv *
287190873Sjfv *  Writes A SAN MAC address to the EEPROM.
288190873Sjfv **/
289190873Sjfvs32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
290190873Sjfv{
291190873Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
292230775Sjfv			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
293190873Sjfv}
294190873Sjfv
295190873Sjfv/**
296190873Sjfv *  ixgbe_get_device_caps - Get additional device capabilities
297190873Sjfv *  @hw: pointer to hardware structure
298190873Sjfv *  @device_caps: the EEPROM word for device capabilities
299190873Sjfv *
300190873Sjfv *  Reads the extra device capabilities from the EEPROM
301190873Sjfv **/
302190873Sjfvs32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
303190873Sjfv{
304190873Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
305230775Sjfv			       (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
306190873Sjfv}
307190873Sjfv
308190873Sjfv/**
309200239Sjfv *  ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
310200239Sjfv *  @hw: pointer to hardware structure
311200239Sjfv *  @wwnn_prefix: the alternative WWNN prefix
312200239Sjfv *  @wwpn_prefix: the alternative WWPN prefix
313200239Sjfv *
314200239Sjfv *  This function will read the EEPROM from the alternative SAN MAC address
315200239Sjfv *  block to check the support for the alternative WWNN/WWPN prefix support.
316200239Sjfv **/
317200239Sjfvs32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
318230775Sjfv			 u16 *wwpn_prefix)
319200239Sjfv{
320200239Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
321230775Sjfv			       (hw, wwnn_prefix, wwpn_prefix),
322230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
323200239Sjfv}
324200239Sjfv
325200239Sjfv/**
326215911Sjfv *  ixgbe_get_fcoe_boot_status -  Get FCOE boot status from EEPROM
327215911Sjfv *  @hw: pointer to hardware structure
328215911Sjfv *  @bs: the fcoe boot status
329215911Sjfv *
330215911Sjfv *  This function will read the FCOE boot status from the iSCSI FCOE block
331215911Sjfv **/
332215911Sjfvs32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
333215911Sjfv{
334215911Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
335230775Sjfv			       (hw, bs),
336230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
337215911Sjfv}
338215911Sjfv
339215911Sjfv/**
340171384Sjfv *  ixgbe_get_bus_info - Set PCI bus info
341171384Sjfv *  @hw: pointer to hardware structure
342171384Sjfv *
343171384Sjfv *  Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
344171384Sjfv **/
345171384Sjfvs32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
346171384Sjfv{
347179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
348230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
349171384Sjfv}
350171384Sjfv
351171384Sjfv/**
352179055Sjfv *  ixgbe_get_num_of_tx_queues - Get Tx queues
353171384Sjfv *  @hw: pointer to hardware structure
354171384Sjfv *
355171384Sjfv *  Returns the number of transmit queues for the given adapter.
356171384Sjfv **/
357171384Sjfvu32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
358171384Sjfv{
359179055Sjfv	return hw->mac.max_tx_queues;
360171384Sjfv}
361171384Sjfv
362171384Sjfv/**
363179055Sjfv *  ixgbe_get_num_of_rx_queues - Get Rx queues
364171384Sjfv *  @hw: pointer to hardware structure
365171384Sjfv *
366171384Sjfv *  Returns the number of receive queues for the given adapter.
367171384Sjfv **/
368171384Sjfvu32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
369171384Sjfv{
370179055Sjfv	return hw->mac.max_rx_queues;
371171384Sjfv}
372171384Sjfv
373171384Sjfv/**
374179055Sjfv *  ixgbe_stop_adapter - Disable Rx/Tx units
375171384Sjfv *  @hw: pointer to hardware structure
376171384Sjfv *
377171384Sjfv *  Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
378171384Sjfv *  disables transmit and receive units. The adapter_stopped flag is used by
379171384Sjfv *  the shared code and drivers to determine if the adapter is in a stopped
380171384Sjfv *  state and should not touch the hardware.
381171384Sjfv **/
382171384Sjfvs32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
383171384Sjfv{
384179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
385230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
386171384Sjfv}
387171384Sjfv
388171384Sjfv/**
389215911Sjfv *  ixgbe_read_pba_string - Reads part number string from EEPROM
390215911Sjfv *  @hw: pointer to hardware structure
391215911Sjfv *  @pba_num: stores the part number string from the EEPROM
392215911Sjfv *  @pba_num_size: part number string buffer length
393215911Sjfv *
394215911Sjfv *  Reads the part number string from the EEPROM.
395215911Sjfv **/
396215911Sjfvs32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
397215911Sjfv{
398215911Sjfv	return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
399215911Sjfv}
400215911Sjfv
401215911Sjfv/**
402179055Sjfv *  ixgbe_read_pba_num - Reads part number from EEPROM
403179055Sjfv *  @hw: pointer to hardware structure
404179055Sjfv *  @pba_num: stores the part number from the EEPROM
405179055Sjfv *
406179055Sjfv *  Reads the part number from the EEPROM.
407179055Sjfv **/
408179055Sjfvs32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
409179055Sjfv{
410179055Sjfv	return ixgbe_read_pba_num_generic(hw, pba_num);
411179055Sjfv}
412179055Sjfv
413179055Sjfv/**
414171384Sjfv *  ixgbe_identify_phy - Get PHY type
415171384Sjfv *  @hw: pointer to hardware structure
416171384Sjfv *
417171384Sjfv *  Determines the physical layer module found on the current adapter.
418171384Sjfv **/
419171384Sjfvs32 ixgbe_identify_phy(struct ixgbe_hw *hw)
420171384Sjfv{
421171384Sjfv	s32 status = IXGBE_SUCCESS;
422171384Sjfv
423171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
424215911Sjfv		status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
425230775Sjfv					 IXGBE_NOT_IMPLEMENTED);
426171384Sjfv	}
427171384Sjfv
428171384Sjfv	return status;
429171384Sjfv}
430171384Sjfv
431171384Sjfv/**
432171384Sjfv *  ixgbe_reset_phy - Perform a PHY reset
433171384Sjfv *  @hw: pointer to hardware structure
434171384Sjfv **/
435171384Sjfvs32 ixgbe_reset_phy(struct ixgbe_hw *hw)
436171384Sjfv{
437171384Sjfv	s32 status = IXGBE_SUCCESS;
438171384Sjfv
439171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
440185352Sjfv		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
441185352Sjfv			status = IXGBE_ERR_PHY;
442171384Sjfv	}
443171384Sjfv
444171384Sjfv	if (status == IXGBE_SUCCESS) {
445179055Sjfv		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
446230775Sjfv					 IXGBE_NOT_IMPLEMENTED);
447171384Sjfv	}
448171384Sjfv	return status;
449171384Sjfv}
450171384Sjfv
451171384Sjfv/**
452179055Sjfv *  ixgbe_get_phy_firmware_version -
453179055Sjfv *  @hw: pointer to hardware structure
454179055Sjfv *  @firmware_version: pointer to firmware version
455179055Sjfv **/
456179055Sjfvs32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
457179055Sjfv{
458179055Sjfv	s32 status = IXGBE_SUCCESS;
459179055Sjfv
460179055Sjfv	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
461230775Sjfv				 (hw, firmware_version),
462230775Sjfv				 IXGBE_NOT_IMPLEMENTED);
463179055Sjfv	return status;
464179055Sjfv}
465179055Sjfv
466179055Sjfv/**
467171384Sjfv *  ixgbe_read_phy_reg - Read PHY register
468171384Sjfv *  @hw: pointer to hardware structure
469171384Sjfv *  @reg_addr: 32 bit address of PHY register to read
470171384Sjfv *  @phy_data: Pointer to read data from PHY register
471171384Sjfv *
472171384Sjfv *  Reads a value from a specified PHY register
473171384Sjfv **/
474171384Sjfvs32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
475230775Sjfv		       u16 *phy_data)
476171384Sjfv{
477190873Sjfv	if (hw->phy.id == 0)
478190873Sjfv		ixgbe_identify_phy(hw);
479190873Sjfv
480179055Sjfv	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
481230775Sjfv			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
482171384Sjfv}
483171384Sjfv
484171384Sjfv/**
485171384Sjfv *  ixgbe_write_phy_reg - Write PHY register
486171384Sjfv *  @hw: pointer to hardware structure
487171384Sjfv *  @reg_addr: 32 bit PHY register to write
488171384Sjfv *  @phy_data: Data to write to the PHY register
489171384Sjfv *
490171384Sjfv *  Writes a value to specified PHY register
491171384Sjfv **/
492171384Sjfvs32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
493230775Sjfv			u16 phy_data)
494171384Sjfv{
495190873Sjfv	if (hw->phy.id == 0)
496190873Sjfv		ixgbe_identify_phy(hw);
497190873Sjfv
498179055Sjfv	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
499230775Sjfv			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
500179055Sjfv}
501171384Sjfv
502179055Sjfv/**
503179055Sjfv *  ixgbe_setup_phy_link - Restart PHY autoneg
504179055Sjfv *  @hw: pointer to hardware structure
505179055Sjfv *
506179055Sjfv *  Restart autonegotiation and PHY and waits for completion.
507179055Sjfv **/
508179055Sjfvs32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
509179055Sjfv{
510179055Sjfv	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
511230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
512179055Sjfv}
513171384Sjfv
514179055Sjfv/**
515179055Sjfv *  ixgbe_check_phy_link - Determine link and speed status
516179055Sjfv *  @hw: pointer to hardware structure
517179055Sjfv *
518179055Sjfv *  Reads a PHY register to determine if link is up and the current speed for
519179055Sjfv *  the PHY.
520179055Sjfv **/
521179055Sjfvs32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
522230775Sjfv			 bool *link_up)
523179055Sjfv{
524179055Sjfv	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
525230775Sjfv			       link_up), IXGBE_NOT_IMPLEMENTED);
526171384Sjfv}
527171384Sjfv
528171384Sjfv/**
529179055Sjfv *  ixgbe_setup_phy_link_speed - Set auto advertise
530179055Sjfv *  @hw: pointer to hardware structure
531179055Sjfv *  @speed: new link speed
532179055Sjfv *
533179055Sjfv *  Sets the auto advertised capabilities
534179055Sjfv **/
535179055Sjfvs32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
536230775Sjfv			       bool autoneg_wait_to_complete)
537179055Sjfv{
538179055Sjfv	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
539247822Sjfv			       autoneg_wait_to_complete),
540230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
541179055Sjfv}
542179055Sjfv
543179055Sjfv/**
544171384Sjfv *  ixgbe_check_link - Get link and speed status
545171384Sjfv *  @hw: pointer to hardware structure
546171384Sjfv *
547171384Sjfv *  Reads the links register to determine if link is up and the current speed
548171384Sjfv **/
549171384Sjfvs32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
550230775Sjfv		     bool *link_up, bool link_up_wait_to_complete)
551171384Sjfv{
552179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
553230775Sjfv			       link_up, link_up_wait_to_complete),
554230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
555171384Sjfv}
556171384Sjfv
557171384Sjfv/**
558215911Sjfv *  ixgbe_disable_tx_laser - Disable Tx laser
559215911Sjfv *  @hw: pointer to hardware structure
560215911Sjfv *
561215911Sjfv *  If the driver needs to disable the laser on SFI optics.
562215911Sjfv **/
563215911Sjfvvoid ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
564215911Sjfv{
565215911Sjfv	if (hw->mac.ops.disable_tx_laser)
566215911Sjfv		hw->mac.ops.disable_tx_laser(hw);
567215911Sjfv}
568215911Sjfv
569215911Sjfv/**
570215911Sjfv *  ixgbe_enable_tx_laser - Enable Tx laser
571215911Sjfv *  @hw: pointer to hardware structure
572215911Sjfv *
573215911Sjfv *  If the driver needs to enable the laser on SFI optics.
574215911Sjfv **/
575215911Sjfvvoid ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
576215911Sjfv{
577215911Sjfv	if (hw->mac.ops.enable_tx_laser)
578215911Sjfv		hw->mac.ops.enable_tx_laser(hw);
579215911Sjfv}
580215911Sjfv
581215911Sjfv/**
582215911Sjfv *  ixgbe_flap_tx_laser - flap Tx laser to start autotry process
583215911Sjfv *  @hw: pointer to hardware structure
584215911Sjfv *
585215911Sjfv *  When the driver changes the link speeds that it can support then
586215911Sjfv *  flap the tx laser to alert the link partner to start autotry
587215911Sjfv *  process on its end.
588215911Sjfv **/
589215911Sjfvvoid ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
590215911Sjfv{
591215911Sjfv	if (hw->mac.ops.flap_tx_laser)
592215911Sjfv		hw->mac.ops.flap_tx_laser(hw);
593215911Sjfv}
594215911Sjfv
595215911Sjfv/**
596200239Sjfv *  ixgbe_setup_link - Set link speed
597171384Sjfv *  @hw: pointer to hardware structure
598171384Sjfv *  @speed: new link speed
599171384Sjfv *
600200239Sjfv *  Configures link settings.  Restarts the link.
601200239Sjfv *  Performs autonegotiation if needed.
602171384Sjfv **/
603200239Sjfvs32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
604230775Sjfv		     bool autoneg_wait_to_complete)
605171384Sjfv{
606200239Sjfv	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
607247822Sjfv			       autoneg_wait_to_complete),
608230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
609171384Sjfv}
610171384Sjfv
611171384Sjfv/**
612179055Sjfv *  ixgbe_get_link_capabilities - Returns link capabilities
613171384Sjfv *  @hw: pointer to hardware structure
614171384Sjfv *
615179055Sjfv *  Determines the link capabilities of the current configuration.
616171384Sjfv **/
617179055Sjfvs32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
618230775Sjfv				bool *autoneg)
619171384Sjfv{
620179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
621230775Sjfv			       speed, autoneg), IXGBE_NOT_IMPLEMENTED);
622171384Sjfv}
623171384Sjfv
624171384Sjfv/**
625179055Sjfv *  ixgbe_led_on - Turn on LEDs
626171384Sjfv *  @hw: pointer to hardware structure
627171384Sjfv *  @index: led number to turn on
628171384Sjfv *
629171384Sjfv *  Turns on the software controllable LEDs.
630171384Sjfv **/
631171384Sjfvs32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
632171384Sjfv{
633179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
634230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
635171384Sjfv}
636171384Sjfv
637171384Sjfv/**
638179055Sjfv *  ixgbe_led_off - Turn off LEDs
639171384Sjfv *  @hw: pointer to hardware structure
640171384Sjfv *  @index: led number to turn off
641171384Sjfv *
642171384Sjfv *  Turns off the software controllable LEDs.
643171384Sjfv **/
644171384Sjfvs32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
645171384Sjfv{
646179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
647230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
648171384Sjfv}
649171384Sjfv
650171384Sjfv/**
651179055Sjfv *  ixgbe_blink_led_start - Blink LEDs
652171384Sjfv *  @hw: pointer to hardware structure
653171384Sjfv *  @index: led number to blink
654171384Sjfv *
655171384Sjfv *  Blink LED based on index.
656171384Sjfv **/
657171384Sjfvs32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
658171384Sjfv{
659179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
660230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
661171384Sjfv}
662171384Sjfv
663171384Sjfv/**
664179055Sjfv *  ixgbe_blink_led_stop - Stop blinking LEDs
665171384Sjfv *  @hw: pointer to hardware structure
666171384Sjfv *
667171384Sjfv *  Stop blinking LED based on index.
668171384Sjfv **/
669171384Sjfvs32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
670171384Sjfv{
671179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
672230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
673171384Sjfv}
674171384Sjfv
675171384Sjfv/**
676179055Sjfv *  ixgbe_init_eeprom_params - Initialize EEPROM parameters
677171384Sjfv *  @hw: pointer to hardware structure
678171384Sjfv *
679171384Sjfv *  Initializes the EEPROM parameters ixgbe_eeprom_info within the
680171384Sjfv *  ixgbe_hw struct in order to set up EEPROM access.
681171384Sjfv **/
682171384Sjfvs32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
683171384Sjfv{
684179055Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
685230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
686171384Sjfv}
687171384Sjfv
688171384Sjfv
689171384Sjfv/**
690171384Sjfv *  ixgbe_write_eeprom - Write word to EEPROM
691171384Sjfv *  @hw: pointer to hardware structure
692171384Sjfv *  @offset: offset within the EEPROM to be written to
693171384Sjfv *  @data: 16 bit word to be written to the EEPROM
694171384Sjfv *
695171384Sjfv *  Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
696171384Sjfv *  called after this function, the EEPROM will most likely contain an
697171384Sjfv *  invalid checksum.
698171384Sjfv **/
699171384Sjfvs32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
700171384Sjfv{
701179055Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
702230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
703171384Sjfv}
704171384Sjfv
705171384Sjfv/**
706230775Sjfv *  ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
707230775Sjfv *  @hw: pointer to hardware structure
708230775Sjfv *  @offset: offset within the EEPROM to be written to
709230775Sjfv *  @data: 16 bit word(s) to be written to the EEPROM
710230775Sjfv *  @words: number of words
711230775Sjfv *
712230775Sjfv *  Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
713230775Sjfv *  called after this function, the EEPROM will most likely contain an
714230775Sjfv *  invalid checksum.
715230775Sjfv **/
716230775Sjfvs32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
717230775Sjfv			      u16 *data)
718230775Sjfv{
719230775Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
720230775Sjfv			       (hw, offset, words, data),
721230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
722230775Sjfv}
723230775Sjfv
724230775Sjfv/**
725171384Sjfv *  ixgbe_read_eeprom - Read word from EEPROM
726171384Sjfv *  @hw: pointer to hardware structure
727171384Sjfv *  @offset: offset within the EEPROM to be read
728171384Sjfv *  @data: read 16 bit value from EEPROM
729171384Sjfv *
730171384Sjfv *  Reads 16 bit value from EEPROM
731171384Sjfv **/
732171384Sjfvs32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
733171384Sjfv{
734179055Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
735230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
736171384Sjfv}
737171384Sjfv
738171384Sjfv/**
739230775Sjfv *  ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
740230775Sjfv *  @hw: pointer to hardware structure
741230775Sjfv *  @offset: offset within the EEPROM to be read
742230775Sjfv *  @data: read 16 bit word(s) from EEPROM
743230775Sjfv *  @words: number of words
744230775Sjfv *
745230775Sjfv *  Reads 16 bit word(s) from EEPROM
746230775Sjfv **/
747230775Sjfvs32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
748230775Sjfv			     u16 words, u16 *data)
749230775Sjfv{
750230775Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
751230775Sjfv			       (hw, offset, words, data),
752230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
753230775Sjfv}
754230775Sjfv
755230775Sjfv/**
756171384Sjfv *  ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
757171384Sjfv *  @hw: pointer to hardware structure
758171384Sjfv *  @checksum_val: calculated checksum
759171384Sjfv *
760171384Sjfv *  Performs checksum calculation and validates the EEPROM checksum
761171384Sjfv **/
762171384Sjfvs32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
763171384Sjfv{
764179055Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
765230775Sjfv			       (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
766171384Sjfv}
767171384Sjfv
768171384Sjfv/**
769171384Sjfv *  ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
770171384Sjfv *  @hw: pointer to hardware structure
771171384Sjfv **/
772171384Sjfvs32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
773171384Sjfv{
774179055Sjfv	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
775230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
776171384Sjfv}
777171384Sjfv
778171384Sjfv/**
779190873Sjfv *  ixgbe_insert_mac_addr - Find a RAR for this mac address
780190873Sjfv *  @hw: pointer to hardware structure
781190873Sjfv *  @addr: Address to put into receive address register
782190873Sjfv *  @vmdq: VMDq pool to assign
783190873Sjfv *
784190873Sjfv *  Puts an ethernet address into a receive address register, or
785190873Sjfv *  finds the rar that it is aleady in; adds to the pool list
786190873Sjfv **/
787190873Sjfvs32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
788190873Sjfv{
789190873Sjfv	return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
790230775Sjfv			       (hw, addr, vmdq),
791190873Sjfv			       IXGBE_NOT_IMPLEMENTED);
792190873Sjfv}
793190873Sjfv
794190873Sjfv/**
795179055Sjfv *  ixgbe_set_rar - Set Rx address register
796171384Sjfv *  @hw: pointer to hardware structure
797179055Sjfv *  @index: Receive address register to write
798171384Sjfv *  @addr: Address to put into receive address register
799179055Sjfv *  @vmdq: VMDq "set"
800171384Sjfv *  @enable_addr: set flag that address is active
801171384Sjfv *
802171384Sjfv *  Puts an ethernet address into a receive address register.
803171384Sjfv **/
804179055Sjfvs32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
805230775Sjfv		  u32 enable_addr)
806171384Sjfv{
807179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
808230775Sjfv			       enable_addr), IXGBE_NOT_IMPLEMENTED);
809171384Sjfv}
810171384Sjfv
811171384Sjfv/**
812181003Sjfv *  ixgbe_clear_rar - Clear Rx address register
813181003Sjfv *  @hw: pointer to hardware structure
814181003Sjfv *  @index: Receive address register to write
815181003Sjfv *
816181003Sjfv *  Puts an ethernet address into a receive address register.
817181003Sjfv **/
818181003Sjfvs32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
819181003Sjfv{
820181003Sjfv	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
821230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
822181003Sjfv}
823181003Sjfv
824181003Sjfv/**
825179055Sjfv *  ixgbe_set_vmdq - Associate a VMDq index with a receive address
826179055Sjfv *  @hw: pointer to hardware structure
827179055Sjfv *  @rar: receive address register index to associate with VMDq index
828179055Sjfv *  @vmdq: VMDq set or pool index
829179055Sjfv **/
830179055Sjfvs32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
831179055Sjfv{
832179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
833230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
834238149Sjfv
835179055Sjfv}
836179055Sjfv
837179055Sjfv/**
838238149Sjfv *  ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
839238149Sjfv *  @hw: pointer to hardware structure
840238149Sjfv *  @vmdq: VMDq default pool index
841238149Sjfv **/
842238149Sjfvs32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
843238149Sjfv{
844238149Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
845238149Sjfv			       (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
846238149Sjfv}
847238149Sjfv
848238149Sjfv/**
849181003Sjfv *  ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
850181003Sjfv *  @hw: pointer to hardware structure
851181003Sjfv *  @rar: receive address register index to disassociate with VMDq index
852181003Sjfv *  @vmdq: VMDq set or pool index
853181003Sjfv **/
854181003Sjfvs32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
855181003Sjfv{
856181003Sjfv	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
857230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
858181003Sjfv}
859181003Sjfv
860181003Sjfv/**
861171384Sjfv *  ixgbe_init_rx_addrs - Initializes receive address filters.
862171384Sjfv *  @hw: pointer to hardware structure
863171384Sjfv *
864171384Sjfv *  Places the MAC address in receive address register 0 and clears the rest
865179055Sjfv *  of the receive address registers. Clears the multicast table. Assumes
866171384Sjfv *  the receiver is in reset when the routine is called.
867171384Sjfv **/
868171384Sjfvs32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
869171384Sjfv{
870179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
871230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
872171384Sjfv}
873171384Sjfv
874171384Sjfv/**
875171384Sjfv *  ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
876171384Sjfv *  @hw: pointer to hardware structure
877171384Sjfv **/
878171384Sjfvu32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
879171384Sjfv{
880179055Sjfv	return hw->mac.num_rar_entries;
881171384Sjfv}
882171384Sjfv
883171384Sjfv/**
884179055Sjfv *  ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
885179055Sjfv *  @hw: pointer to hardware structure
886179055Sjfv *  @addr_list: the list of new multicast addresses
887179055Sjfv *  @addr_count: number of addresses
888179055Sjfv *  @func: iterator function to walk the multicast address list
889179055Sjfv *
890179055Sjfv *  The given list replaces any existing list. Clears the secondary addrs from
891179055Sjfv *  receive address registers. Uses unused receive address registers for the
892179055Sjfv *  first secondary addresses, and falls back to promiscuous mode as needed.
893179055Sjfv **/
894179055Sjfvs32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
895230775Sjfv			      u32 addr_count, ixgbe_mc_addr_itr func)
896179055Sjfv{
897179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
898230775Sjfv			       addr_list, addr_count, func),
899230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
900179055Sjfv}
901179055Sjfv
902179055Sjfv/**
903171384Sjfv *  ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
904171384Sjfv *  @hw: pointer to hardware structure
905171384Sjfv *  @mc_addr_list: the list of new multicast addresses
906171384Sjfv *  @mc_addr_count: number of addresses
907179055Sjfv *  @func: iterator function to walk the multicast address list
908171384Sjfv *
909171384Sjfv *  The given list replaces any existing list. Clears the MC addrs from receive
910179055Sjfv *  address registers and the multicast table. Uses unused receive address
911171384Sjfv *  registers for the first multicast addresses, and hashes the rest into the
912171384Sjfv *  multicast table.
913171384Sjfv **/
914171384Sjfvs32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
915230775Sjfv			      u32 mc_addr_count, ixgbe_mc_addr_itr func,
916230775Sjfv			      bool clear)
917171384Sjfv{
918179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
919230775Sjfv			       mc_addr_list, mc_addr_count, func, clear),
920230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
921171384Sjfv}
922171384Sjfv
923171384Sjfv/**
924171384Sjfv *  ixgbe_enable_mc - Enable multicast address in RAR
925171384Sjfv *  @hw: pointer to hardware structure
926171384Sjfv *
927171384Sjfv *  Enables multicast address in RAR and the use of the multicast hash table.
928171384Sjfv **/
929171384Sjfvs32 ixgbe_enable_mc(struct ixgbe_hw *hw)
930171384Sjfv{
931179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
932230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
933171384Sjfv}
934171384Sjfv
935171384Sjfv/**
936171384Sjfv *  ixgbe_disable_mc - Disable multicast address in RAR
937171384Sjfv *  @hw: pointer to hardware structure
938171384Sjfv *
939171384Sjfv *  Disables multicast address in RAR and the use of the multicast hash table.
940171384Sjfv **/
941171384Sjfvs32 ixgbe_disable_mc(struct ixgbe_hw *hw)
942171384Sjfv{
943179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
944230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
945171384Sjfv}
946171384Sjfv
947171384Sjfv/**
948171384Sjfv *  ixgbe_clear_vfta - Clear VLAN filter table
949171384Sjfv *  @hw: pointer to hardware structure
950171384Sjfv *
951171384Sjfv *  Clears the VLAN filer table, and the VMDq index associated with the filter
952171384Sjfv **/
953171384Sjfvs32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
954171384Sjfv{
955179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
956230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
957171384Sjfv}
958171384Sjfv
959171384Sjfv/**
960171384Sjfv *  ixgbe_set_vfta - Set VLAN filter table
961171384Sjfv *  @hw: pointer to hardware structure
962171384Sjfv *  @vlan: VLAN id to write to VLAN filter
963171384Sjfv *  @vind: VMDq output index that maps queue to VLAN id in VFTA
964171384Sjfv *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
965171384Sjfv *
966171384Sjfv *  Turn on/off specified VLAN in the VLAN filter table.
967171384Sjfv **/
968171384Sjfvs32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
969171384Sjfv{
970179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
971230775Sjfv			       vlan_on), IXGBE_NOT_IMPLEMENTED);
972171384Sjfv}
973171384Sjfv
974171384Sjfv/**
975230775Sjfv *  ixgbe_set_vlvf - Set VLAN Pool Filter
976230775Sjfv *  @hw: pointer to hardware structure
977230775Sjfv *  @vlan: VLAN id to write to VLAN filter
978230775Sjfv *  @vind: VMDq output index that maps queue to VLAN id in VFVFB
979230775Sjfv *  @vlan_on: boolean flag to turn on/off VLAN in VFVF
980230775Sjfv *  @vfta_changed: pointer to boolean flag which indicates whether VFTA
981230775Sjfv *                 should be changed
982230775Sjfv *
983230775Sjfv *  Turn on/off specified bit in VLVF table.
984230775Sjfv **/
985230775Sjfvs32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
986230775Sjfv		    bool *vfta_changed)
987230775Sjfv{
988230775Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
989230775Sjfv			       vlan_on, vfta_changed), IXGBE_NOT_IMPLEMENTED);
990230775Sjfv}
991230775Sjfv
992230775Sjfv/**
993190873Sjfv *  ixgbe_fc_enable - Enable flow control
994171384Sjfv *  @hw: pointer to hardware structure
995171384Sjfv *
996171384Sjfv *  Configures the flow control settings based on SW configuration.
997171384Sjfv **/
998238149Sjfvs32 ixgbe_fc_enable(struct ixgbe_hw *hw)
999171384Sjfv{
1000238149Sjfv	return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
1001230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
1002171384Sjfv}
1003171384Sjfv
1004172043Sjfv/**
1005230775Sjfv * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
1006230775Sjfv * @hw: pointer to hardware structure
1007230775Sjfv * @maj: driver major number to be sent to firmware
1008230775Sjfv * @min: driver minor number to be sent to firmware
1009230775Sjfv * @build: driver build number to be sent to firmware
1010230775Sjfv * @ver: driver version number to be sent to firmware
1011230775Sjfv **/
1012230775Sjfvs32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
1013230775Sjfv			 u8 ver)
1014230775Sjfv{
1015230775Sjfv	return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
1016230775Sjfv			       build, ver), IXGBE_NOT_IMPLEMENTED);
1017230775Sjfv}
1018230775Sjfv
1019230775Sjfv
1020251964Sjfv
1021251964Sjfv
1022230775Sjfv/**
1023172043Sjfv *  ixgbe_read_analog_reg8 - Reads 8 bit analog register
1024172043Sjfv *  @hw: pointer to hardware structure
1025172043Sjfv *  @reg: analog register to read
1026172043Sjfv *  @val: read value
1027172043Sjfv *
1028172043Sjfv *  Performs write operation to analog register specified.
1029172043Sjfv **/
1030172043Sjfvs32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1031172043Sjfv{
1032179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1033230775Sjfv			       val), IXGBE_NOT_IMPLEMENTED);
1034172043Sjfv}
1035172043Sjfv
1036172043Sjfv/**
1037172043Sjfv *  ixgbe_write_analog_reg8 - Writes 8 bit analog register
1038172043Sjfv *  @hw: pointer to hardware structure
1039172043Sjfv *  @reg: analog register to write
1040172043Sjfv *  @val: value to write
1041172043Sjfv *
1042172043Sjfv *  Performs write operation to Atlas analog register specified.
1043172043Sjfv **/
1044172043Sjfvs32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1045172043Sjfv{
1046179055Sjfv	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1047230775Sjfv			       val), IXGBE_NOT_IMPLEMENTED);
1048172043Sjfv}
1049172043Sjfv
1050181003Sjfv/**
1051181003Sjfv *  ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1052181003Sjfv *  @hw: pointer to hardware structure
1053181003Sjfv *
1054185352Sjfv *  Initializes the Unicast Table Arrays to zero on device load.  This
1055185352Sjfv *  is part of the Rx init addr execution path.
1056181003Sjfv **/
1057181003Sjfvs32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1058181003Sjfv{
1059181003Sjfv	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1060230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
1061181003Sjfv}
1062185352Sjfv
1063185352Sjfv/**
1064190873Sjfv *  ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1065190873Sjfv *  @hw: pointer to hardware structure
1066190873Sjfv *  @byte_offset: byte offset to read
1067190873Sjfv *  @data: value read
1068190873Sjfv *
1069190873Sjfv *  Performs byte read operation to SFP module's EEPROM over I2C interface.
1070190873Sjfv **/
1071190873Sjfvs32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1072230775Sjfv			u8 *data)
1073190873Sjfv{
1074190873Sjfv	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1075230775Sjfv			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1076190873Sjfv}
1077190873Sjfv
1078190873Sjfv/**
1079190873Sjfv *  ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1080190873Sjfv *  @hw: pointer to hardware structure
1081190873Sjfv *  @byte_offset: byte offset to write
1082190873Sjfv *  @data: value to write
1083190873Sjfv *
1084190873Sjfv *  Performs byte write operation to SFP module's EEPROM over I2C interface
1085190873Sjfv *  at a specified device address.
1086190873Sjfv **/
1087190873Sjfvs32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1088230775Sjfv			 u8 data)
1089190873Sjfv{
1090190873Sjfv	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1091230775Sjfv			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1092190873Sjfv}
1093190873Sjfv
1094190873Sjfv/**
1095190873Sjfv *  ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1096190873Sjfv *  @hw: pointer to hardware structure
1097190873Sjfv *  @byte_offset: EEPROM byte offset to write
1098190873Sjfv *  @eeprom_data: value to write
1099190873Sjfv *
1100190873Sjfv *  Performs byte write operation to SFP module's EEPROM over I2C interface.
1101190873Sjfv **/
1102190873Sjfvs32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1103230775Sjfv			   u8 byte_offset, u8 eeprom_data)
1104190873Sjfv{
1105190873Sjfv	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1106230775Sjfv			       (hw, byte_offset, eeprom_data),
1107230775Sjfv			       IXGBE_NOT_IMPLEMENTED);
1108190873Sjfv}
1109190873Sjfv
1110190873Sjfv/**
1111185352Sjfv *  ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1112185352Sjfv *  @hw: pointer to hardware structure
1113185352Sjfv *  @byte_offset: EEPROM byte offset to read
1114185352Sjfv *  @eeprom_data: value read
1115185352Sjfv *
1116185352Sjfv *  Performs byte read operation to SFP module's EEPROM over I2C interface.
1117185352Sjfv **/
1118185352Sjfvs32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1119185352Sjfv{
1120185352Sjfv	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1121230775Sjfv			      (hw, byte_offset, eeprom_data),
1122230775Sjfv			      IXGBE_NOT_IMPLEMENTED);
1123185352Sjfv}
1124185352Sjfv
1125185352Sjfv/**
1126185352Sjfv *  ixgbe_get_supported_physical_layer - Returns physical layer type
1127185352Sjfv *  @hw: pointer to hardware structure
1128185352Sjfv *
1129185352Sjfv *  Determines physical layer capabilities of the current configuration.
1130185352Sjfv **/
1131185352Sjfvu32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1132185352Sjfv{
1133185352Sjfv	return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1134230775Sjfv			       (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1135185352Sjfv}
1136190873Sjfv
1137190873Sjfv/**
1138238149Sjfv *  ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1139190873Sjfv *  @hw: pointer to hardware structure
1140190873Sjfv *  @regval: bitfield to write to the Rx DMA register
1141190873Sjfv *
1142190873Sjfv *  Enables the Rx DMA unit of the device.
1143190873Sjfv **/
1144190873Sjfvs32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1145190873Sjfv{
1146190873Sjfv	return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1147230775Sjfv			       (hw, regval), IXGBE_NOT_IMPLEMENTED);
1148190873Sjfv}
1149194875Sjfv
1150194875Sjfv/**
1151230775Sjfv *  ixgbe_disable_sec_rx_path - Stops the receive data path
1152230775Sjfv *  @hw: pointer to hardware structure
1153230775Sjfv *
1154230775Sjfv *  Stops the receive data path.
1155230775Sjfv **/
1156230775Sjfvs32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1157230775Sjfv{
1158230775Sjfv	return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1159230775Sjfv				(hw), IXGBE_NOT_IMPLEMENTED);
1160230775Sjfv}
1161230775Sjfv
1162230775Sjfv/**
1163230775Sjfv *  ixgbe_enable_sec_rx_path - Enables the receive data path
1164230775Sjfv *  @hw: pointer to hardware structure
1165230775Sjfv *
1166230775Sjfv *  Enables the receive data path.
1167230775Sjfv **/
1168230775Sjfvs32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1169230775Sjfv{
1170230775Sjfv	return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1171230775Sjfv				(hw), IXGBE_NOT_IMPLEMENTED);
1172230775Sjfv}
1173230775Sjfv
1174230775Sjfv/**
1175194875Sjfv *  ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1176194875Sjfv *  @hw: pointer to hardware structure
1177194875Sjfv *  @mask: Mask to specify which semaphore to acquire
1178194875Sjfv *
1179194875Sjfv *  Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1180194875Sjfv *  function (CSR, PHY0, PHY1, EEPROM, Flash)
1181194875Sjfv **/
1182194875Sjfvs32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1183194875Sjfv{
1184194875Sjfv	return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1185230775Sjfv			       (hw, mask), IXGBE_NOT_IMPLEMENTED);
1186194875Sjfv}
1187194875Sjfv
1188194875Sjfv/**
1189194875Sjfv *  ixgbe_release_swfw_semaphore - Release SWFW semaphore
1190194875Sjfv *  @hw: pointer to hardware structure
1191194875Sjfv *  @mask: Mask to specify which semaphore to release
1192194875Sjfv *
1193194875Sjfv *  Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1194194875Sjfv *  function (CSR, PHY0, PHY1, EEPROM, Flash)
1195194875Sjfv **/
1196194875Sjfvvoid ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1197194875Sjfv{
1198194875Sjfv	if (hw->mac.ops.release_swfw_sync)
1199194875Sjfv		hw->mac.ops.release_swfw_sync(hw, mask);
1200194875Sjfv}
1201194875Sjfv
1202