ixgbe_api.c revision 171384
1171384Sjfv/*******************************************************************************
2171384Sjfv
3171384Sjfv  Copyright (c) 2001-2007, 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
32171384Sjfv*******************************************************************************/
33171384Sjfv/* $FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 171384 2007-07-11 23:03:16Z jfv $ */
34171384Sjfv
35171384Sjfv#include "ixgbe_api.h"
36171384Sjfv#include "ixgbe_common.h"
37171384Sjfv
38171384Sjfvextern s32 ixgbe_init_shared_code_82598(struct ixgbe_hw *hw);
39171384Sjfvextern s32 ixgbe_init_shared_code_phy(struct ixgbe_hw *hw);
40171384Sjfv
41171384Sjfv/**
42171384Sjfv *  ixgbe_init_shared_code - Initialize the shared code
43171384Sjfv *  @hw: pointer to hardware structure
44171384Sjfv *
45171384Sjfv *  This will assign function pointers and assign the MAC type and PHY code.
46171384Sjfv *  Does not touch the hardware. This function must be called prior to any
47171384Sjfv *  other function in the shared code. The ixgbe_hw structure should be
48171384Sjfv *  memset to 0 prior to calling this function.  The following fields in
49171384Sjfv *  hw structure should be filled in prior to calling this function:
50171384Sjfv *  hw_addr, back, device_id, vendor_id, subsystem_device_id,
51171384Sjfv *   subsystem_vendor_id, and revision_id
52171384Sjfv **/
53171384Sjfvs32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
54171384Sjfv{
55171384Sjfv	s32 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
56171384Sjfv
57171384Sjfv	/*
58171384Sjfv	 * Assign generic function pointers before entering adapter-specific
59171384Sjfv	 * init
60171384Sjfv	 */
61171384Sjfv	ixgbe_assign_func_pointers_generic(hw);
62171384Sjfv
63171384Sjfv	if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
64171384Sjfv		switch (hw->device_id) {
65171384Sjfv		case IXGBE_DEV_ID_82598:
66171384Sjfv		case IXGBE_DEV_ID_82598_FPGA:
67171384Sjfv		case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
68171384Sjfv		case IXGBE_DEV_ID_82598AF_DUAL_PORT:
69171384Sjfv		case IXGBE_DEV_ID_82598AT_DUAL_PORT:
70171384Sjfv			status = ixgbe_init_shared_code_82598(hw);
71171384Sjfv			status = ixgbe_init_shared_code_phy(hw);
72171384Sjfv			break;
73171384Sjfv		default:
74171384Sjfv			status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
75171384Sjfv			break;
76171384Sjfv		}
77171384Sjfv	}
78171384Sjfv
79171384Sjfv	return status;
80171384Sjfv}
81171384Sjfv
82171384Sjfv/**
83171384Sjfv *  ixgbe_init_hw - Initialize the hardware
84171384Sjfv *  @hw: pointer to hardware structure
85171384Sjfv *
86171384Sjfv *  Initialize the hardware by resetting and then starting the hardware
87171384Sjfv **/
88171384Sjfvs32 ixgbe_init_hw(struct ixgbe_hw *hw)
89171384Sjfv{
90171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_init_hw, (hw),
91171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
92171384Sjfv}
93171384Sjfv
94171384Sjfv/**
95171384Sjfv *  ixgbe_reset_hw - Performs a hardware reset
96171384Sjfv *  @hw: pointer to hardware structure
97171384Sjfv *
98171384Sjfv *  Resets the hardware by resetting the transmit and receive units, masks and
99171384Sjfv *  clears all interrupts, performs a PHY reset, and performs a MAC reset
100171384Sjfv **/
101171384Sjfvs32 ixgbe_reset_hw(struct ixgbe_hw *hw)
102171384Sjfv{
103171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_reset_hw, (hw),
104171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
105171384Sjfv}
106171384Sjfv
107171384Sjfv/**
108171384Sjfv *  ixgbe_start_hw - Prepares hardware for TX/TX
109171384Sjfv *  @hw: pointer to hardware structure
110171384Sjfv *
111171384Sjfv *  Starts the hardware by filling the bus info structure and media type,
112171384Sjfv *  clears all on chip counters, initializes receive address registers,
113171384Sjfv *  multicast table, VLAN filter table, calls routine to setup link and
114171384Sjfv *  flow control settings, and leaves transmit and receive units disabled
115171384Sjfv *  and uninitialized.
116171384Sjfv **/
117171384Sjfvs32 ixgbe_start_hw(struct ixgbe_hw *hw)
118171384Sjfv{
119171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_start_hw, (hw),
120171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
121171384Sjfv}
122171384Sjfv
123171384Sjfv/**
124171384Sjfv *  ixgbe_clear_hw_cntrs - Clear hardware counters
125171384Sjfv *  @hw: pointer to hardware structure
126171384Sjfv *
127171384Sjfv *  Clears all hardware statistics counters by reading them from the hardware
128171384Sjfv *  Statistics counters are clear on read.
129171384Sjfv **/
130171384Sjfvs32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
131171384Sjfv{
132171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_clear_hw_cntrs, (hw),
133171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
134171384Sjfv}
135171384Sjfv
136171384Sjfv/**
137171384Sjfv *  ixgbe_get_media_type - Get media type
138171384Sjfv *  @hw: pointer to hardware structure
139171384Sjfv *
140171384Sjfv *  Returns the media type (fiber, copper, backplane)
141171384Sjfv **/
142171384Sjfvenum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
143171384Sjfv{
144171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_media_type, (hw),
145171384Sjfv			       ixgbe_media_type_unknown);
146171384Sjfv}
147171384Sjfv
148171384Sjfv/**
149171384Sjfv *  ixgbe_get_mac_addr - Get MAC address
150171384Sjfv *  @hw: pointer to hardware structure
151171384Sjfv *  @mac_addr: Adapter MAC address
152171384Sjfv *
153171384Sjfv *  Reads the adapter's MAC address from the first Receive Address Register
154171384Sjfv *  (RAR0) A reset of the adapter must have been performed prior to calling this
155171384Sjfv *  function in order for the MAC address to have been loaded from the EEPROM
156171384Sjfv *  into RAR0
157171384Sjfv **/
158171384Sjfvs32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
159171384Sjfv{
160171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_mac_addr,
161171384Sjfv			       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
162171384Sjfv}
163171384Sjfv
164171384Sjfv/**
165171384Sjfv *  ixgbe_get_bus_info - Set PCI bus info
166171384Sjfv *  @hw: pointer to hardware structure
167171384Sjfv *
168171384Sjfv *  Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
169171384Sjfv **/
170171384Sjfvs32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
171171384Sjfv{
172171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_bus_info, (hw),
173171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
174171384Sjfv}
175171384Sjfv
176171384Sjfv/**
177171384Sjfv *  ixgbe_get_num_of_tx_queues - Get TX queues
178171384Sjfv *  @hw: pointer to hardware structure
179171384Sjfv *
180171384Sjfv *  Returns the number of transmit queues for the given adapter.
181171384Sjfv **/
182171384Sjfvu32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
183171384Sjfv{
184171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_num_of_tx_queues,
185171384Sjfv			       (hw), 0);
186171384Sjfv}
187171384Sjfv
188171384Sjfv/**
189171384Sjfv *  ixgbe_get_num_of_rx_queues - Get RX queues
190171384Sjfv *  @hw: pointer to hardware structure
191171384Sjfv *
192171384Sjfv *  Returns the number of receive queues for the given adapter.
193171384Sjfv **/
194171384Sjfvu32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
195171384Sjfv{
196171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_num_of_rx_queues,
197171384Sjfv			       (hw), 0);
198171384Sjfv}
199171384Sjfv
200171384Sjfv/**
201171384Sjfv *  ixgbe_stop_adapter - Disable TX/TX units
202171384Sjfv *  @hw: pointer to hardware structure
203171384Sjfv *
204171384Sjfv *  Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
205171384Sjfv *  disables transmit and receive units. The adapter_stopped flag is used by
206171384Sjfv *  the shared code and drivers to determine if the adapter is in a stopped
207171384Sjfv *  state and should not touch the hardware.
208171384Sjfv **/
209171384Sjfvs32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
210171384Sjfv{
211171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_stop_adapter, (hw),
212171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
213171384Sjfv}
214171384Sjfv
215171384Sjfv/**
216171384Sjfv *  ixgbe_identify_phy - Get PHY type
217171384Sjfv *  @hw: pointer to hardware structure
218171384Sjfv *
219171384Sjfv *  Determines the physical layer module found on the current adapter.
220171384Sjfv **/
221171384Sjfvs32 ixgbe_identify_phy(struct ixgbe_hw *hw)
222171384Sjfv{
223171384Sjfv	s32 status = IXGBE_SUCCESS;
224171384Sjfv
225171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
226171384Sjfv		status = ixgbe_call_func(hw,
227171384Sjfv					 ixgbe_func_identify_phy,
228171384Sjfv					 (hw),
229171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
230171384Sjfv	}
231171384Sjfv
232171384Sjfv	return status;
233171384Sjfv}
234171384Sjfv
235171384Sjfv/**
236171384Sjfv *  ixgbe_reset_phy - Perform a PHY reset
237171384Sjfv *  @hw: pointer to hardware structure
238171384Sjfv **/
239171384Sjfvs32 ixgbe_reset_phy(struct ixgbe_hw *hw)
240171384Sjfv{
241171384Sjfv	s32 status = IXGBE_SUCCESS;
242171384Sjfv
243171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
244171384Sjfv		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
245171384Sjfv		    status = IXGBE_ERR_PHY;
246171384Sjfv		}
247171384Sjfv	}
248171384Sjfv
249171384Sjfv	if (status == IXGBE_SUCCESS) {
250171384Sjfv		status = ixgbe_call_func(hw,
251171384Sjfv					 ixgbe_func_reset_phy,
252171384Sjfv					 (hw),
253171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
254171384Sjfv	}
255171384Sjfv	return status;
256171384Sjfv}
257171384Sjfv
258171384Sjfv/**
259171384Sjfv *  ixgbe_read_phy_reg - Read PHY register
260171384Sjfv *  @hw: pointer to hardware structure
261171384Sjfv *  @reg_addr: 32 bit address of PHY register to read
262171384Sjfv *  @phy_data: Pointer to read data from PHY register
263171384Sjfv *
264171384Sjfv *  Reads a value from a specified PHY register
265171384Sjfv **/
266171384Sjfvs32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
267171384Sjfv		       u16 *phy_data)
268171384Sjfv{
269171384Sjfv	s32 status = IXGBE_SUCCESS;
270171384Sjfv
271171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
272171384Sjfv		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
273171384Sjfv		    status = IXGBE_ERR_PHY;
274171384Sjfv		}
275171384Sjfv	}
276171384Sjfv
277171384Sjfv	if (status == IXGBE_SUCCESS) {
278171384Sjfv		status = ixgbe_call_func(hw,
279171384Sjfv					 ixgbe_func_read_phy_reg,
280171384Sjfv					 (hw, reg_addr, device_type, phy_data),
281171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
282171384Sjfv	}
283171384Sjfv	return status;
284171384Sjfv}
285171384Sjfv
286171384Sjfv/**
287171384Sjfv *  ixgbe_write_phy_reg - Write PHY register
288171384Sjfv *  @hw: pointer to hardware structure
289171384Sjfv *  @reg_addr: 32 bit PHY register to write
290171384Sjfv *  @phy_data: Data to write to the PHY register
291171384Sjfv *
292171384Sjfv *  Writes a value to specified PHY register
293171384Sjfv **/
294171384Sjfvs32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
295171384Sjfv			u16 phy_data)
296171384Sjfv{
297171384Sjfv	s32 status = IXGBE_SUCCESS;
298171384Sjfv
299171384Sjfv	if (hw->phy.type == ixgbe_phy_unknown) {
300171384Sjfv		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
301171384Sjfv		    status = IXGBE_ERR_PHY;
302171384Sjfv		}
303171384Sjfv	}
304171384Sjfv
305171384Sjfv	if (status == IXGBE_SUCCESS) {
306171384Sjfv		status = ixgbe_call_func(hw,
307171384Sjfv					 ixgbe_func_write_phy_reg,
308171384Sjfv					 (hw, reg_addr, device_type, phy_data),
309171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
310171384Sjfv	}
311171384Sjfv	return status;
312171384Sjfv}
313171384Sjfv
314171384Sjfv/**
315171384Sjfv *  ixgbe_setup_link - Configure link settings
316171384Sjfv *  @hw: pointer to hardware structure
317171384Sjfv *
318171384Sjfv *  Configures link settings based on values in the ixgbe_hw struct.
319171384Sjfv *  Restarts the link.  Performs autonegotiation if needed.
320171384Sjfv **/
321171384Sjfvs32 ixgbe_setup_link(struct ixgbe_hw *hw)
322171384Sjfv{
323171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_setup_link, (hw),
324171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
325171384Sjfv}
326171384Sjfv
327171384Sjfv/**
328171384Sjfv *  ixgbe_check_link - Get link and speed status
329171384Sjfv *  @hw: pointer to hardware structure
330171384Sjfv *
331171384Sjfv *  Reads the links register to determine if link is up and the current speed
332171384Sjfv **/
333171384Sjfvs32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
334171384Sjfv		     bool *link_up)
335171384Sjfv{
336171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_check_link, (hw, speed, link_up),
337171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
338171384Sjfv}
339171384Sjfv
340171384Sjfv/**
341171384Sjfv *  ixgbe_setup_link_speed - Set link speed
342171384Sjfv *  @hw: pointer to hardware structure
343171384Sjfv *  @speed: new link speed
344171384Sjfv *  @autoneg: TRUE if autonegotiation enabled
345171384Sjfv *
346171384Sjfv *  Set the link speed and restarts the link.
347171384Sjfv **/
348171384Sjfvs32 ixgbe_setup_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
349171384Sjfv			   bool autoneg,
350171384Sjfv			   bool autoneg_wait_to_complete)
351171384Sjfv{
352171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_setup_link_speed, (hw, speed,
353171384Sjfv			       autoneg, autoneg_wait_to_complete),
354171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
355171384Sjfv}
356171384Sjfv
357171384Sjfv/**
358171384Sjfv *  ixgbe_get_link_settings - Set link settings to default
359171384Sjfv *  @hw: pointer to hardware structure
360171384Sjfv *
361171384Sjfv *  Sets the default link settings based on attach type in the hw struct.
362171384Sjfv **/
363171384Sjfvs32 ixgbe_get_link_settings(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
364171384Sjfv			    bool *autoneg)
365171384Sjfv{
366171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_link_settings, (hw, speed,
367171384Sjfv			       autoneg), IXGBE_NOT_IMPLEMENTED);
368171384Sjfv}
369171384Sjfv
370171384Sjfv/**
371171384Sjfv *  ixgbe_led_on - Turn on LED's
372171384Sjfv *  @hw: pointer to hardware structure
373171384Sjfv *  @index: led number to turn on
374171384Sjfv *
375171384Sjfv *  Turns on the software controllable LEDs.
376171384Sjfv **/
377171384Sjfvs32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
378171384Sjfv{
379171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_led_on, (hw, index),
380171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
381171384Sjfv}
382171384Sjfv
383171384Sjfv/**
384171384Sjfv *  ixgbe_led_off - Turn off LED's
385171384Sjfv *  @hw: pointer to hardware structure
386171384Sjfv *  @index: led number to turn off
387171384Sjfv *
388171384Sjfv *  Turns off the software controllable LEDs.
389171384Sjfv **/
390171384Sjfvs32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
391171384Sjfv{
392171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_led_off, (hw, index),
393171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
394171384Sjfv}
395171384Sjfv
396171384Sjfv/**
397171384Sjfv *  ixgbe_blink_led_start - Blink LED's
398171384Sjfv *  @hw: pointer to hardware structure
399171384Sjfv *  @index: led number to blink
400171384Sjfv *
401171384Sjfv *  Blink LED based on index.
402171384Sjfv **/
403171384Sjfvs32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
404171384Sjfv{
405171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_blink_led_start, (hw, index),
406171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
407171384Sjfv}
408171384Sjfv
409171384Sjfv/**
410171384Sjfv *  ixgbe_blink_led_stop - Stop blinking LED's
411171384Sjfv *  @hw: pointer to hardware structure
412171384Sjfv *
413171384Sjfv *  Stop blinking LED based on index.
414171384Sjfv **/
415171384Sjfvs32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
416171384Sjfv{
417171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_blink_led_stop, (hw, index),
418171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
419171384Sjfv}
420171384Sjfv
421171384Sjfv/**
422171384Sjfv *  ixgbe_init_eeprom_params - Initialiaze EEPROM parameters
423171384Sjfv *  @hw: pointer to hardware structure
424171384Sjfv *
425171384Sjfv *  Initializes the EEPROM parameters ixgbe_eeprom_info within the
426171384Sjfv *  ixgbe_hw struct in order to set up EEPROM access.
427171384Sjfv **/
428171384Sjfvs32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
429171384Sjfv{
430171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_init_eeprom_params, (hw),
431171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
432171384Sjfv}
433171384Sjfv
434171384Sjfv
435171384Sjfv/**
436171384Sjfv *  ixgbe_write_eeprom - Write word to EEPROM
437171384Sjfv *  @hw: pointer to hardware structure
438171384Sjfv *  @offset: offset within the EEPROM to be written to
439171384Sjfv *  @data: 16 bit word to be written to the EEPROM
440171384Sjfv *
441171384Sjfv *  Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
442171384Sjfv *  called after this function, the EEPROM will most likely contain an
443171384Sjfv *  invalid checksum.
444171384Sjfv **/
445171384Sjfvs32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
446171384Sjfv{
447171384Sjfv	s32 status;
448171384Sjfv
449171384Sjfv	/*
450171384Sjfv	 * Initialize EEPROM parameters.  This will not do anything if the
451171384Sjfv	 * EEPROM structure has already been initialized
452171384Sjfv	 */
453171384Sjfv	ixgbe_init_eeprom_params(hw);
454171384Sjfv
455171384Sjfv	/* Check for invalid offset */
456171384Sjfv	if (offset >= hw->eeprom.word_size) {
457171384Sjfv		status = IXGBE_ERR_EEPROM;
458171384Sjfv	} else {
459171384Sjfv		status = ixgbe_call_func(hw,
460171384Sjfv					 ixgbe_func_write_eeprom,
461171384Sjfv					 (hw, offset, data),
462171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
463171384Sjfv	}
464171384Sjfv
465171384Sjfv	return status;
466171384Sjfv}
467171384Sjfv
468171384Sjfv/**
469171384Sjfv *  ixgbe_read_eeprom - Read word from EEPROM
470171384Sjfv *  @hw: pointer to hardware structure
471171384Sjfv *  @offset: offset within the EEPROM to be read
472171384Sjfv *  @data: read 16 bit value from EEPROM
473171384Sjfv *
474171384Sjfv *  Reads 16 bit value from EEPROM
475171384Sjfv **/
476171384Sjfvs32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
477171384Sjfv{
478171384Sjfv	s32 status;
479171384Sjfv
480171384Sjfv	/*
481171384Sjfv	 * Initialize EEPROM parameters.  This will not do anything if the
482171384Sjfv	 * EEPROM structure has already been initialized
483171384Sjfv	 */
484171384Sjfv	ixgbe_init_eeprom_params(hw);
485171384Sjfv
486171384Sjfv	/* Check for invalid offset */
487171384Sjfv	if (offset >= hw->eeprom.word_size) {
488171384Sjfv		status = IXGBE_ERR_EEPROM;
489171384Sjfv	} else {
490171384Sjfv		status = ixgbe_call_func(hw,
491171384Sjfv					 ixgbe_func_read_eeprom,
492171384Sjfv					 (hw, offset, data),
493171384Sjfv					 IXGBE_NOT_IMPLEMENTED);
494171384Sjfv	}
495171384Sjfv
496171384Sjfv	return status;
497171384Sjfv}
498171384Sjfv
499171384Sjfv/**
500171384Sjfv *  ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
501171384Sjfv *  @hw: pointer to hardware structure
502171384Sjfv *  @checksum_val: calculated checksum
503171384Sjfv *
504171384Sjfv *  Performs checksum calculation and validates the EEPROM checksum
505171384Sjfv **/
506171384Sjfvs32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
507171384Sjfv{
508171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_validate_eeprom_checksum,
509171384Sjfv			       (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
510171384Sjfv}
511171384Sjfv
512171384Sjfv/**
513171384Sjfv *  ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
514171384Sjfv *  @hw: pointer to hardware structure
515171384Sjfv **/
516171384Sjfvs32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
517171384Sjfv{
518171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_update_eeprom_checksum, (hw),
519171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
520171384Sjfv}
521171384Sjfv
522171384Sjfv/**
523171384Sjfv *  ixgbe_set_rar - Set RX address register
524171384Sjfv *  @hw: pointer to hardware structure
525171384Sjfv *  @addr: Address to put into receive address register
526171384Sjfv *  @index: Receive address register to write
527171384Sjfv *  @vind: Vind to set RAR to
528171384Sjfv *  @enable_addr: set flag that address is active
529171384Sjfv *
530171384Sjfv *  Puts an ethernet address into a receive address register.
531171384Sjfv **/
532171384Sjfvs32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vind,
533171384Sjfv		  u32 enable_addr)
534171384Sjfv{
535171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_set_rar, (hw, index, addr, vind,
536171384Sjfv			       enable_addr), IXGBE_NOT_IMPLEMENTED);
537171384Sjfv}
538171384Sjfv
539171384Sjfv/**
540171384Sjfv *  ixgbe_init_rx_addrs - Initializes receive address filters.
541171384Sjfv *  @hw: pointer to hardware structure
542171384Sjfv *
543171384Sjfv *  Places the MAC address in receive address register 0 and clears the rest
544171384Sjfv *  of the receive addresss registers. Clears the multicast table. Assumes
545171384Sjfv *  the receiver is in reset when the routine is called.
546171384Sjfv **/
547171384Sjfvs32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
548171384Sjfv{
549171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_init_rx_addrs, (hw),
550171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
551171384Sjfv}
552171384Sjfv
553171384Sjfv/**
554171384Sjfv *  ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
555171384Sjfv *  @hw: pointer to hardware structure
556171384Sjfv **/
557171384Sjfvu32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
558171384Sjfv{
559171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_get_num_rx_addrs, (hw), 0);
560171384Sjfv}
561171384Sjfv
562171384Sjfv/**
563171384Sjfv *  ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
564171384Sjfv *  @hw: pointer to hardware structure
565171384Sjfv *  @mc_addr_list: the list of new multicast addresses
566171384Sjfv *  @mc_addr_count: number of addresses
567171384Sjfv *  @pad: number of bytes between addresses in the list
568171384Sjfv *
569171384Sjfv *  The given list replaces any existing list. Clears the MC addrs from receive
570171384Sjfv *  address registers and the multicast table. Uses unsed receive address
571171384Sjfv *  registers for the first multicast addresses, and hashes the rest into the
572171384Sjfv *  multicast table.
573171384Sjfv **/
574171384Sjfvs32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
575171384Sjfv			      u32 mc_addr_count, u32 pad)
576171384Sjfv{
577171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_update_mc_addr_list, (hw,
578171384Sjfv			       mc_addr_list, mc_addr_count,  pad),
579171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
580171384Sjfv}
581171384Sjfv
582171384Sjfv/**
583171384Sjfv *  ixgbe_enable_mc - Enable multicast address in RAR
584171384Sjfv *  @hw: pointer to hardware structure
585171384Sjfv *
586171384Sjfv *  Enables multicast address in RAR and the use of the multicast hash table.
587171384Sjfv **/
588171384Sjfvs32 ixgbe_enable_mc(struct ixgbe_hw *hw)
589171384Sjfv{
590171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_enable_mc, (hw),
591171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
592171384Sjfv}
593171384Sjfv
594171384Sjfv/**
595171384Sjfv *  ixgbe_disable_mc - Disable multicast address in RAR
596171384Sjfv *  @hw: pointer to hardware structure
597171384Sjfv *
598171384Sjfv *  Disables multicast address in RAR and the use of the multicast hash table.
599171384Sjfv **/
600171384Sjfvs32 ixgbe_disable_mc(struct ixgbe_hw *hw)
601171384Sjfv{
602171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_disable_mc, (hw),
603171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
604171384Sjfv}
605171384Sjfv
606171384Sjfv/**
607171384Sjfv *  ixgbe_clear_vfta - Clear VLAN filter table
608171384Sjfv *  @hw: pointer to hardware structure
609171384Sjfv *
610171384Sjfv *  Clears the VLAN filer table, and the VMDq index associated with the filter
611171384Sjfv **/
612171384Sjfvs32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
613171384Sjfv{
614171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_clear_vfta, (hw),
615171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
616171384Sjfv}
617171384Sjfv
618171384Sjfv/**
619171384Sjfv *  ixgbe_set_vfta - Set VLAN filter table
620171384Sjfv *  @hw: pointer to hardware structure
621171384Sjfv *  @vlan: VLAN id to write to VLAN filter
622171384Sjfv *  @vind: VMDq output index that maps queue to VLAN id in VFTA
623171384Sjfv *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
624171384Sjfv *
625171384Sjfv *  Turn on/off specified VLAN in the VLAN filter table.
626171384Sjfv **/
627171384Sjfvs32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
628171384Sjfv{
629171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_set_vfta, (hw, vlan, vind,
630171384Sjfv			       vlan_on), IXGBE_NOT_IMPLEMENTED);
631171384Sjfv}
632171384Sjfv
633171384Sjfv/**
634171384Sjfv *  ixgbe_setup_fc - Set flow control
635171384Sjfv *  @hw: pointer to hardware structure
636171384Sjfv *  @packetbuf_num: packet buffer number (0-7)
637171384Sjfv *
638171384Sjfv *  Configures the flow control settings based on SW configuration.
639171384Sjfv **/
640171384Sjfvs32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
641171384Sjfv{
642171384Sjfv	return ixgbe_call_func(hw, ixgbe_func_setup_fc, (hw, packetbuf_num),
643171384Sjfv			       IXGBE_NOT_IMPLEMENTED);
644171384Sjfv}
645171384Sjfv
646