ixgbe_api.c revision 1.5 1 1.1 dyoung /******************************************************************************
2 1.1 dyoung
3 1.5 msaitoh Copyright (c) 2001-2012, Intel Corporation
4 1.1 dyoung All rights reserved.
5 1.1 dyoung
6 1.1 dyoung Redistribution and use in source and binary forms, with or without
7 1.1 dyoung modification, are permitted provided that the following conditions are met:
8 1.1 dyoung
9 1.1 dyoung 1. Redistributions of source code must retain the above copyright notice,
10 1.1 dyoung this list of conditions and the following disclaimer.
11 1.1 dyoung
12 1.1 dyoung 2. Redistributions in binary form must reproduce the above copyright
13 1.1 dyoung notice, this list of conditions and the following disclaimer in the
14 1.1 dyoung documentation and/or other materials provided with the distribution.
15 1.1 dyoung
16 1.1 dyoung 3. Neither the name of the Intel Corporation nor the names of its
17 1.1 dyoung contributors may be used to endorse or promote products derived from
18 1.1 dyoung this software without specific prior written permission.
19 1.1 dyoung
20 1.1 dyoung THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 1.1 dyoung AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.1 dyoung IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.1 dyoung ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 1.1 dyoung LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 dyoung CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 dyoung SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 dyoung INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 dyoung CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 dyoung ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 dyoung POSSIBILITY OF SUCH DAMAGE.
31 1.1 dyoung
32 1.1 dyoung ******************************************************************************/
33 1.1 dyoung /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_api.c,v 1.11 2010/11/26 22:46:32 jfv Exp $*/
34 1.5 msaitoh /*$NetBSD: ixgbe_api.c,v 1.5 2015/03/27 05:57:28 msaitoh Exp $*/
35 1.1 dyoung
36 1.1 dyoung #include "ixgbe_api.h"
37 1.1 dyoung #include "ixgbe_common.h"
38 1.1 dyoung
39 1.1 dyoung /**
40 1.1 dyoung * ixgbe_init_shared_code - Initialize the shared code
41 1.1 dyoung * @hw: pointer to hardware structure
42 1.1 dyoung *
43 1.1 dyoung * This will assign function pointers and assign the MAC type and PHY code.
44 1.1 dyoung * Does not touch the hardware. This function must be called prior to any
45 1.1 dyoung * other function in the shared code. The ixgbe_hw structure should be
46 1.1 dyoung * memset to 0 prior to calling this function. The following fields in
47 1.1 dyoung * hw structure should be filled in prior to calling this function:
48 1.1 dyoung * back, device_id, vendor_id, subsystem_device_id,
49 1.1 dyoung * subsystem_vendor_id, and revision_id
50 1.1 dyoung **/
51 1.1 dyoung s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
52 1.1 dyoung {
53 1.1 dyoung s32 status;
54 1.1 dyoung
55 1.1 dyoung DEBUGFUNC("ixgbe_init_shared_code");
56 1.1 dyoung
57 1.1 dyoung /*
58 1.1 dyoung * Set the mac type
59 1.1 dyoung */
60 1.1 dyoung ixgbe_set_mac_type(hw);
61 1.1 dyoung
62 1.1 dyoung switch (hw->mac.type) {
63 1.1 dyoung case ixgbe_mac_82598EB:
64 1.1 dyoung status = ixgbe_init_ops_82598(hw);
65 1.1 dyoung break;
66 1.1 dyoung case ixgbe_mac_82599EB:
67 1.1 dyoung status = ixgbe_init_ops_82599(hw);
68 1.1 dyoung break;
69 1.1 dyoung case ixgbe_mac_82599_vf:
70 1.5 msaitoh case ixgbe_mac_X540_vf:
71 1.1 dyoung status = ixgbe_init_ops_vf(hw);
72 1.1 dyoung break;
73 1.5 msaitoh case ixgbe_mac_X540:
74 1.5 msaitoh status = ixgbe_init_ops_X540(hw);
75 1.5 msaitoh break;
76 1.1 dyoung default:
77 1.1 dyoung status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
78 1.1 dyoung break;
79 1.1 dyoung }
80 1.1 dyoung
81 1.1 dyoung return status;
82 1.1 dyoung }
83 1.1 dyoung
84 1.1 dyoung /**
85 1.1 dyoung * ixgbe_set_mac_type - Sets MAC type
86 1.1 dyoung * @hw: pointer to the HW structure
87 1.1 dyoung *
88 1.1 dyoung * This function sets the mac type of the adapter based on the
89 1.1 dyoung * vendor ID and device ID stored in the hw structure.
90 1.1 dyoung **/
91 1.1 dyoung s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
92 1.1 dyoung {
93 1.1 dyoung s32 ret_val = IXGBE_SUCCESS;
94 1.1 dyoung
95 1.1 dyoung DEBUGFUNC("ixgbe_set_mac_type\n");
96 1.1 dyoung
97 1.1 dyoung if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
98 1.1 dyoung switch (hw->device_id) {
99 1.1 dyoung case IXGBE_DEV_ID_82598:
100 1.1 dyoung case IXGBE_DEV_ID_82598_BX:
101 1.1 dyoung case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
102 1.1 dyoung case IXGBE_DEV_ID_82598AF_DUAL_PORT:
103 1.1 dyoung case IXGBE_DEV_ID_82598AT:
104 1.1 dyoung case IXGBE_DEV_ID_82598AT2:
105 1.1 dyoung case IXGBE_DEV_ID_82598EB_CX4:
106 1.1 dyoung case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
107 1.1 dyoung case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
108 1.1 dyoung case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
109 1.1 dyoung case IXGBE_DEV_ID_82598EB_XF_LR:
110 1.1 dyoung case IXGBE_DEV_ID_82598EB_SFP_LOM:
111 1.1 dyoung hw->mac.type = ixgbe_mac_82598EB;
112 1.1 dyoung break;
113 1.1 dyoung case IXGBE_DEV_ID_82599_KX4:
114 1.1 dyoung case IXGBE_DEV_ID_82599_KX4_MEZZ:
115 1.1 dyoung case IXGBE_DEV_ID_82599_XAUI_LOM:
116 1.1 dyoung case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
117 1.5 msaitoh case IXGBE_DEV_ID_82599_KR:
118 1.1 dyoung case IXGBE_DEV_ID_82599_SFP:
119 1.1 dyoung case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
120 1.1 dyoung case IXGBE_DEV_ID_82599_SFP_FCOE:
121 1.4 msaitoh case IXGBE_DEV_ID_82599_SFP_SF2:
122 1.4 msaitoh case IXGBE_DEV_ID_82599_SFP_SF_QP:
123 1.5 msaitoh case IXGBE_DEV_ID_82599_SFP_EM:
124 1.4 msaitoh case IXGBE_DEV_ID_82599EN_SFP:
125 1.1 dyoung case IXGBE_DEV_ID_82599_CX4:
126 1.1 dyoung case IXGBE_DEV_ID_82599_T3_LOM:
127 1.1 dyoung hw->mac.type = ixgbe_mac_82599EB;
128 1.1 dyoung break;
129 1.1 dyoung case IXGBE_DEV_ID_82599_VF:
130 1.1 dyoung hw->mac.type = ixgbe_mac_82599_vf;
131 1.1 dyoung break;
132 1.5 msaitoh case IXGBE_DEV_ID_X540_VF:
133 1.5 msaitoh hw->mac.type = ixgbe_mac_X540_vf;
134 1.5 msaitoh break;
135 1.5 msaitoh case IXGBE_DEV_ID_X540T:
136 1.5 msaitoh hw->mac.type = ixgbe_mac_X540;
137 1.5 msaitoh break;
138 1.1 dyoung default:
139 1.1 dyoung ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
140 1.1 dyoung break;
141 1.1 dyoung }
142 1.1 dyoung } else {
143 1.1 dyoung ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
144 1.1 dyoung }
145 1.1 dyoung
146 1.1 dyoung DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
147 1.5 msaitoh hw->mac.type, ret_val);
148 1.1 dyoung return ret_val;
149 1.1 dyoung }
150 1.1 dyoung
151 1.1 dyoung /**
152 1.1 dyoung * ixgbe_init_hw - Initialize the hardware
153 1.1 dyoung * @hw: pointer to hardware structure
154 1.1 dyoung *
155 1.1 dyoung * Initialize the hardware by resetting and then starting the hardware
156 1.1 dyoung **/
157 1.1 dyoung s32 ixgbe_init_hw(struct ixgbe_hw *hw)
158 1.1 dyoung {
159 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
160 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
161 1.1 dyoung }
162 1.1 dyoung
163 1.1 dyoung /**
164 1.1 dyoung * ixgbe_reset_hw - Performs a hardware reset
165 1.1 dyoung * @hw: pointer to hardware structure
166 1.1 dyoung *
167 1.1 dyoung * Resets the hardware by resetting the transmit and receive units, masks and
168 1.1 dyoung * clears all interrupts, performs a PHY reset, and performs a MAC reset
169 1.1 dyoung **/
170 1.1 dyoung s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
171 1.1 dyoung {
172 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
173 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
174 1.1 dyoung }
175 1.1 dyoung
176 1.1 dyoung /**
177 1.1 dyoung * ixgbe_start_hw - Prepares hardware for Rx/Tx
178 1.1 dyoung * @hw: pointer to hardware structure
179 1.1 dyoung *
180 1.1 dyoung * Starts the hardware by filling the bus info structure and media type,
181 1.1 dyoung * clears all on chip counters, initializes receive address registers,
182 1.1 dyoung * multicast table, VLAN filter table, calls routine to setup link and
183 1.1 dyoung * flow control settings, and leaves transmit and receive units disabled
184 1.1 dyoung * and uninitialized.
185 1.1 dyoung **/
186 1.1 dyoung s32 ixgbe_start_hw(struct ixgbe_hw *hw)
187 1.1 dyoung {
188 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
189 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
190 1.1 dyoung }
191 1.1 dyoung
192 1.1 dyoung /**
193 1.1 dyoung * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
194 1.1 dyoung * which is disabled by default in ixgbe_start_hw();
195 1.1 dyoung *
196 1.1 dyoung * @hw: pointer to hardware structure
197 1.1 dyoung *
198 1.1 dyoung * Enable relaxed ordering;
199 1.1 dyoung **/
200 1.1 dyoung void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
201 1.1 dyoung {
202 1.1 dyoung if (hw->mac.ops.enable_relaxed_ordering)
203 1.1 dyoung hw->mac.ops.enable_relaxed_ordering(hw);
204 1.1 dyoung }
205 1.1 dyoung
206 1.1 dyoung /**
207 1.1 dyoung * ixgbe_clear_hw_cntrs - Clear hardware counters
208 1.1 dyoung * @hw: pointer to hardware structure
209 1.1 dyoung *
210 1.1 dyoung * Clears all hardware statistics counters by reading them from the hardware
211 1.1 dyoung * Statistics counters are clear on read.
212 1.1 dyoung **/
213 1.1 dyoung s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
214 1.1 dyoung {
215 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
216 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
217 1.1 dyoung }
218 1.1 dyoung
219 1.1 dyoung /**
220 1.1 dyoung * ixgbe_get_media_type - Get media type
221 1.1 dyoung * @hw: pointer to hardware structure
222 1.1 dyoung *
223 1.1 dyoung * Returns the media type (fiber, copper, backplane)
224 1.1 dyoung **/
225 1.1 dyoung enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
226 1.1 dyoung {
227 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
228 1.5 msaitoh ixgbe_media_type_unknown);
229 1.1 dyoung }
230 1.1 dyoung
231 1.1 dyoung /**
232 1.1 dyoung * ixgbe_get_mac_addr - Get MAC address
233 1.1 dyoung * @hw: pointer to hardware structure
234 1.1 dyoung * @mac_addr: Adapter MAC address
235 1.1 dyoung *
236 1.1 dyoung * Reads the adapter's MAC address from the first Receive Address Register
237 1.1 dyoung * (RAR0) A reset of the adapter must have been performed prior to calling
238 1.1 dyoung * this function in order for the MAC address to have been loaded from the
239 1.1 dyoung * EEPROM into RAR0
240 1.1 dyoung **/
241 1.1 dyoung s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
242 1.1 dyoung {
243 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
244 1.5 msaitoh (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
245 1.1 dyoung }
246 1.1 dyoung
247 1.1 dyoung /**
248 1.1 dyoung * ixgbe_get_san_mac_addr - Get SAN MAC address
249 1.1 dyoung * @hw: pointer to hardware structure
250 1.1 dyoung * @san_mac_addr: SAN MAC address
251 1.1 dyoung *
252 1.1 dyoung * Reads the SAN MAC address from the EEPROM, if it's available. This is
253 1.1 dyoung * per-port, so set_lan_id() must be called before reading the addresses.
254 1.1 dyoung **/
255 1.1 dyoung s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
256 1.1 dyoung {
257 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
258 1.5 msaitoh (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
259 1.1 dyoung }
260 1.1 dyoung
261 1.1 dyoung /**
262 1.1 dyoung * ixgbe_set_san_mac_addr - Write a SAN MAC address
263 1.1 dyoung * @hw: pointer to hardware structure
264 1.1 dyoung * @san_mac_addr: SAN MAC address
265 1.1 dyoung *
266 1.1 dyoung * Writes A SAN MAC address to the EEPROM.
267 1.1 dyoung **/
268 1.1 dyoung s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
269 1.1 dyoung {
270 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
271 1.5 msaitoh (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
272 1.1 dyoung }
273 1.1 dyoung
274 1.1 dyoung /**
275 1.1 dyoung * ixgbe_get_device_caps - Get additional device capabilities
276 1.1 dyoung * @hw: pointer to hardware structure
277 1.1 dyoung * @device_caps: the EEPROM word for device capabilities
278 1.1 dyoung *
279 1.1 dyoung * Reads the extra device capabilities from the EEPROM
280 1.1 dyoung **/
281 1.1 dyoung s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
282 1.1 dyoung {
283 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
284 1.5 msaitoh (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
285 1.1 dyoung }
286 1.1 dyoung
287 1.1 dyoung /**
288 1.1 dyoung * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
289 1.1 dyoung * @hw: pointer to hardware structure
290 1.1 dyoung * @wwnn_prefix: the alternative WWNN prefix
291 1.1 dyoung * @wwpn_prefix: the alternative WWPN prefix
292 1.1 dyoung *
293 1.1 dyoung * This function will read the EEPROM from the alternative SAN MAC address
294 1.1 dyoung * block to check the support for the alternative WWNN/WWPN prefix support.
295 1.1 dyoung **/
296 1.1 dyoung s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
297 1.5 msaitoh u16 *wwpn_prefix)
298 1.1 dyoung {
299 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
300 1.5 msaitoh (hw, wwnn_prefix, wwpn_prefix),
301 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
302 1.1 dyoung }
303 1.1 dyoung
304 1.1 dyoung /**
305 1.1 dyoung * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
306 1.1 dyoung * @hw: pointer to hardware structure
307 1.1 dyoung * @bs: the fcoe boot status
308 1.1 dyoung *
309 1.1 dyoung * This function will read the FCOE boot status from the iSCSI FCOE block
310 1.1 dyoung **/
311 1.1 dyoung s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
312 1.1 dyoung {
313 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
314 1.5 msaitoh (hw, bs),
315 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
316 1.1 dyoung }
317 1.1 dyoung
318 1.1 dyoung /**
319 1.1 dyoung * ixgbe_get_bus_info - Set PCI bus info
320 1.1 dyoung * @hw: pointer to hardware structure
321 1.1 dyoung *
322 1.1 dyoung * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
323 1.1 dyoung **/
324 1.1 dyoung s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
325 1.1 dyoung {
326 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
327 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
328 1.1 dyoung }
329 1.1 dyoung
330 1.1 dyoung /**
331 1.1 dyoung * ixgbe_get_num_of_tx_queues - Get Tx queues
332 1.1 dyoung * @hw: pointer to hardware structure
333 1.1 dyoung *
334 1.1 dyoung * Returns the number of transmit queues for the given adapter.
335 1.1 dyoung **/
336 1.1 dyoung u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
337 1.1 dyoung {
338 1.1 dyoung return hw->mac.max_tx_queues;
339 1.1 dyoung }
340 1.1 dyoung
341 1.1 dyoung /**
342 1.1 dyoung * ixgbe_get_num_of_rx_queues - Get Rx queues
343 1.1 dyoung * @hw: pointer to hardware structure
344 1.1 dyoung *
345 1.1 dyoung * Returns the number of receive queues for the given adapter.
346 1.1 dyoung **/
347 1.1 dyoung u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
348 1.1 dyoung {
349 1.1 dyoung return hw->mac.max_rx_queues;
350 1.1 dyoung }
351 1.1 dyoung
352 1.1 dyoung /**
353 1.1 dyoung * ixgbe_stop_adapter - Disable Rx/Tx units
354 1.1 dyoung * @hw: pointer to hardware structure
355 1.1 dyoung *
356 1.1 dyoung * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
357 1.1 dyoung * disables transmit and receive units. The adapter_stopped flag is used by
358 1.1 dyoung * the shared code and drivers to determine if the adapter is in a stopped
359 1.1 dyoung * state and should not touch the hardware.
360 1.1 dyoung **/
361 1.1 dyoung s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
362 1.1 dyoung {
363 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
364 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
365 1.1 dyoung }
366 1.1 dyoung
367 1.1 dyoung /**
368 1.1 dyoung * ixgbe_read_pba_string - Reads part number string from EEPROM
369 1.1 dyoung * @hw: pointer to hardware structure
370 1.1 dyoung * @pba_num: stores the part number string from the EEPROM
371 1.1 dyoung * @pba_num_size: part number string buffer length
372 1.1 dyoung *
373 1.1 dyoung * Reads the part number string from the EEPROM.
374 1.1 dyoung **/
375 1.1 dyoung s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
376 1.1 dyoung {
377 1.1 dyoung return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
378 1.1 dyoung }
379 1.1 dyoung
380 1.1 dyoung /**
381 1.1 dyoung * ixgbe_read_pba_num - Reads part number from EEPROM
382 1.1 dyoung * @hw: pointer to hardware structure
383 1.1 dyoung * @pba_num: stores the part number from the EEPROM
384 1.1 dyoung *
385 1.1 dyoung * Reads the part number from the EEPROM.
386 1.1 dyoung **/
387 1.1 dyoung s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
388 1.1 dyoung {
389 1.1 dyoung return ixgbe_read_pba_num_generic(hw, pba_num);
390 1.1 dyoung }
391 1.1 dyoung
392 1.1 dyoung /**
393 1.1 dyoung * ixgbe_identify_phy - Get PHY type
394 1.1 dyoung * @hw: pointer to hardware structure
395 1.1 dyoung *
396 1.1 dyoung * Determines the physical layer module found on the current adapter.
397 1.1 dyoung **/
398 1.1 dyoung s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
399 1.1 dyoung {
400 1.1 dyoung s32 status = IXGBE_SUCCESS;
401 1.1 dyoung
402 1.1 dyoung if (hw->phy.type == ixgbe_phy_unknown) {
403 1.1 dyoung status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
404 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
405 1.1 dyoung }
406 1.1 dyoung
407 1.1 dyoung return status;
408 1.1 dyoung }
409 1.1 dyoung
410 1.1 dyoung /**
411 1.1 dyoung * ixgbe_reset_phy - Perform a PHY reset
412 1.1 dyoung * @hw: pointer to hardware structure
413 1.1 dyoung **/
414 1.1 dyoung s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
415 1.1 dyoung {
416 1.1 dyoung s32 status = IXGBE_SUCCESS;
417 1.1 dyoung
418 1.1 dyoung if (hw->phy.type == ixgbe_phy_unknown) {
419 1.1 dyoung if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
420 1.1 dyoung status = IXGBE_ERR_PHY;
421 1.1 dyoung }
422 1.1 dyoung
423 1.1 dyoung if (status == IXGBE_SUCCESS) {
424 1.1 dyoung status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
425 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
426 1.1 dyoung }
427 1.1 dyoung return status;
428 1.1 dyoung }
429 1.1 dyoung
430 1.1 dyoung /**
431 1.1 dyoung * ixgbe_get_phy_firmware_version -
432 1.1 dyoung * @hw: pointer to hardware structure
433 1.1 dyoung * @firmware_version: pointer to firmware version
434 1.1 dyoung **/
435 1.1 dyoung s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
436 1.1 dyoung {
437 1.1 dyoung s32 status = IXGBE_SUCCESS;
438 1.1 dyoung
439 1.1 dyoung status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
440 1.5 msaitoh (hw, firmware_version),
441 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
442 1.1 dyoung return status;
443 1.1 dyoung }
444 1.1 dyoung
445 1.1 dyoung /**
446 1.1 dyoung * ixgbe_read_phy_reg - Read PHY register
447 1.1 dyoung * @hw: pointer to hardware structure
448 1.1 dyoung * @reg_addr: 32 bit address of PHY register to read
449 1.1 dyoung * @phy_data: Pointer to read data from PHY register
450 1.1 dyoung *
451 1.1 dyoung * Reads a value from a specified PHY register
452 1.1 dyoung **/
453 1.1 dyoung s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
454 1.5 msaitoh u16 *phy_data)
455 1.1 dyoung {
456 1.1 dyoung if (hw->phy.id == 0)
457 1.1 dyoung ixgbe_identify_phy(hw);
458 1.1 dyoung
459 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
460 1.5 msaitoh device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
461 1.1 dyoung }
462 1.1 dyoung
463 1.1 dyoung /**
464 1.1 dyoung * ixgbe_write_phy_reg - Write PHY register
465 1.1 dyoung * @hw: pointer to hardware structure
466 1.1 dyoung * @reg_addr: 32 bit PHY register to write
467 1.1 dyoung * @phy_data: Data to write to the PHY register
468 1.1 dyoung *
469 1.1 dyoung * Writes a value to specified PHY register
470 1.1 dyoung **/
471 1.1 dyoung s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
472 1.5 msaitoh u16 phy_data)
473 1.1 dyoung {
474 1.1 dyoung if (hw->phy.id == 0)
475 1.1 dyoung ixgbe_identify_phy(hw);
476 1.1 dyoung
477 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
478 1.5 msaitoh device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
479 1.1 dyoung }
480 1.1 dyoung
481 1.1 dyoung /**
482 1.1 dyoung * ixgbe_setup_phy_link - Restart PHY autoneg
483 1.1 dyoung * @hw: pointer to hardware structure
484 1.1 dyoung *
485 1.1 dyoung * Restart autonegotiation and PHY and waits for completion.
486 1.1 dyoung **/
487 1.1 dyoung s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
488 1.1 dyoung {
489 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
490 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
491 1.1 dyoung }
492 1.1 dyoung
493 1.1 dyoung /**
494 1.1 dyoung * ixgbe_check_phy_link - Determine link and speed status
495 1.1 dyoung * @hw: pointer to hardware structure
496 1.1 dyoung *
497 1.1 dyoung * Reads a PHY register to determine if link is up and the current speed for
498 1.1 dyoung * the PHY.
499 1.1 dyoung **/
500 1.1 dyoung s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
501 1.5 msaitoh bool *link_up)
502 1.1 dyoung {
503 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
504 1.5 msaitoh link_up), IXGBE_NOT_IMPLEMENTED);
505 1.1 dyoung }
506 1.1 dyoung
507 1.1 dyoung /**
508 1.1 dyoung * ixgbe_setup_phy_link_speed - Set auto advertise
509 1.1 dyoung * @hw: pointer to hardware structure
510 1.1 dyoung * @speed: new link speed
511 1.1 dyoung * @autoneg: TRUE if autonegotiation enabled
512 1.1 dyoung *
513 1.1 dyoung * Sets the auto advertised capabilities
514 1.1 dyoung **/
515 1.1 dyoung s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
516 1.5 msaitoh bool autoneg,
517 1.5 msaitoh bool autoneg_wait_to_complete)
518 1.1 dyoung {
519 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
520 1.5 msaitoh autoneg, autoneg_wait_to_complete),
521 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
522 1.1 dyoung }
523 1.1 dyoung
524 1.1 dyoung /**
525 1.1 dyoung * ixgbe_check_link - Get link and speed status
526 1.1 dyoung * @hw: pointer to hardware structure
527 1.1 dyoung *
528 1.1 dyoung * Reads the links register to determine if link is up and the current speed
529 1.1 dyoung **/
530 1.1 dyoung s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
531 1.5 msaitoh bool *link_up, bool link_up_wait_to_complete)
532 1.1 dyoung {
533 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
534 1.5 msaitoh link_up, link_up_wait_to_complete),
535 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
536 1.1 dyoung }
537 1.1 dyoung
538 1.1 dyoung /**
539 1.1 dyoung * ixgbe_disable_tx_laser - Disable Tx laser
540 1.1 dyoung * @hw: pointer to hardware structure
541 1.1 dyoung *
542 1.1 dyoung * If the driver needs to disable the laser on SFI optics.
543 1.1 dyoung **/
544 1.1 dyoung void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
545 1.1 dyoung {
546 1.1 dyoung if (hw->mac.ops.disable_tx_laser)
547 1.1 dyoung hw->mac.ops.disable_tx_laser(hw);
548 1.1 dyoung }
549 1.1 dyoung
550 1.1 dyoung /**
551 1.1 dyoung * ixgbe_enable_tx_laser - Enable Tx laser
552 1.1 dyoung * @hw: pointer to hardware structure
553 1.1 dyoung *
554 1.1 dyoung * If the driver needs to enable the laser on SFI optics.
555 1.1 dyoung **/
556 1.1 dyoung void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
557 1.1 dyoung {
558 1.1 dyoung if (hw->mac.ops.enable_tx_laser)
559 1.1 dyoung hw->mac.ops.enable_tx_laser(hw);
560 1.1 dyoung }
561 1.1 dyoung
562 1.1 dyoung /**
563 1.1 dyoung * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
564 1.1 dyoung * @hw: pointer to hardware structure
565 1.1 dyoung *
566 1.1 dyoung * When the driver changes the link speeds that it can support then
567 1.1 dyoung * flap the tx laser to alert the link partner to start autotry
568 1.1 dyoung * process on its end.
569 1.1 dyoung **/
570 1.1 dyoung void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
571 1.1 dyoung {
572 1.1 dyoung if (hw->mac.ops.flap_tx_laser)
573 1.1 dyoung hw->mac.ops.flap_tx_laser(hw);
574 1.1 dyoung }
575 1.1 dyoung
576 1.1 dyoung /**
577 1.1 dyoung * ixgbe_setup_link - Set link speed
578 1.1 dyoung * @hw: pointer to hardware structure
579 1.1 dyoung * @speed: new link speed
580 1.1 dyoung * @autoneg: TRUE if autonegotiation enabled
581 1.1 dyoung *
582 1.1 dyoung * Configures link settings. Restarts the link.
583 1.1 dyoung * Performs autonegotiation if needed.
584 1.1 dyoung **/
585 1.1 dyoung s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
586 1.5 msaitoh bool autoneg,
587 1.5 msaitoh bool autoneg_wait_to_complete)
588 1.1 dyoung {
589 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
590 1.5 msaitoh autoneg, autoneg_wait_to_complete),
591 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
592 1.1 dyoung }
593 1.1 dyoung
594 1.1 dyoung /**
595 1.1 dyoung * ixgbe_get_link_capabilities - Returns link capabilities
596 1.1 dyoung * @hw: pointer to hardware structure
597 1.1 dyoung *
598 1.1 dyoung * Determines the link capabilities of the current configuration.
599 1.1 dyoung **/
600 1.1 dyoung s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
601 1.5 msaitoh bool *autoneg)
602 1.1 dyoung {
603 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
604 1.5 msaitoh speed, autoneg), IXGBE_NOT_IMPLEMENTED);
605 1.1 dyoung }
606 1.1 dyoung
607 1.1 dyoung /**
608 1.1 dyoung * ixgbe_led_on - Turn on LEDs
609 1.1 dyoung * @hw: pointer to hardware structure
610 1.1 dyoung * @index: led number to turn on
611 1.1 dyoung *
612 1.1 dyoung * Turns on the software controllable LEDs.
613 1.1 dyoung **/
614 1.1 dyoung s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
615 1.1 dyoung {
616 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
617 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
618 1.1 dyoung }
619 1.1 dyoung
620 1.1 dyoung /**
621 1.1 dyoung * ixgbe_led_off - Turn off LEDs
622 1.1 dyoung * @hw: pointer to hardware structure
623 1.1 dyoung * @index: led number to turn off
624 1.1 dyoung *
625 1.1 dyoung * Turns off the software controllable LEDs.
626 1.1 dyoung **/
627 1.1 dyoung s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
628 1.1 dyoung {
629 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
630 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
631 1.1 dyoung }
632 1.1 dyoung
633 1.1 dyoung /**
634 1.1 dyoung * ixgbe_blink_led_start - Blink LEDs
635 1.1 dyoung * @hw: pointer to hardware structure
636 1.1 dyoung * @index: led number to blink
637 1.1 dyoung *
638 1.1 dyoung * Blink LED based on index.
639 1.1 dyoung **/
640 1.1 dyoung s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
641 1.1 dyoung {
642 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
643 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
644 1.1 dyoung }
645 1.1 dyoung
646 1.1 dyoung /**
647 1.1 dyoung * ixgbe_blink_led_stop - Stop blinking LEDs
648 1.1 dyoung * @hw: pointer to hardware structure
649 1.1 dyoung *
650 1.1 dyoung * Stop blinking LED based on index.
651 1.1 dyoung **/
652 1.1 dyoung s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
653 1.1 dyoung {
654 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
655 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
656 1.1 dyoung }
657 1.1 dyoung
658 1.1 dyoung /**
659 1.1 dyoung * ixgbe_init_eeprom_params - Initialize EEPROM parameters
660 1.1 dyoung * @hw: pointer to hardware structure
661 1.1 dyoung *
662 1.1 dyoung * Initializes the EEPROM parameters ixgbe_eeprom_info within the
663 1.1 dyoung * ixgbe_hw struct in order to set up EEPROM access.
664 1.1 dyoung **/
665 1.1 dyoung s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
666 1.1 dyoung {
667 1.1 dyoung return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
668 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
669 1.1 dyoung }
670 1.1 dyoung
671 1.1 dyoung
672 1.1 dyoung /**
673 1.1 dyoung * ixgbe_write_eeprom - Write word to EEPROM
674 1.1 dyoung * @hw: pointer to hardware structure
675 1.1 dyoung * @offset: offset within the EEPROM to be written to
676 1.1 dyoung * @data: 16 bit word to be written to the EEPROM
677 1.1 dyoung *
678 1.1 dyoung * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
679 1.1 dyoung * called after this function, the EEPROM will most likely contain an
680 1.1 dyoung * invalid checksum.
681 1.1 dyoung **/
682 1.1 dyoung s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
683 1.1 dyoung {
684 1.1 dyoung return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
685 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
686 1.5 msaitoh }
687 1.5 msaitoh
688 1.5 msaitoh /**
689 1.5 msaitoh * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
690 1.5 msaitoh * @hw: pointer to hardware structure
691 1.5 msaitoh * @offset: offset within the EEPROM to be written to
692 1.5 msaitoh * @data: 16 bit word(s) to be written to the EEPROM
693 1.5 msaitoh * @words: number of words
694 1.5 msaitoh *
695 1.5 msaitoh * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
696 1.5 msaitoh * called after this function, the EEPROM will most likely contain an
697 1.5 msaitoh * invalid checksum.
698 1.5 msaitoh **/
699 1.5 msaitoh s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
700 1.5 msaitoh u16 *data)
701 1.5 msaitoh {
702 1.5 msaitoh return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
703 1.5 msaitoh (hw, offset, words, data),
704 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
705 1.1 dyoung }
706 1.1 dyoung
707 1.1 dyoung /**
708 1.1 dyoung * ixgbe_read_eeprom - Read word from EEPROM
709 1.1 dyoung * @hw: pointer to hardware structure
710 1.1 dyoung * @offset: offset within the EEPROM to be read
711 1.1 dyoung * @data: read 16 bit value from EEPROM
712 1.1 dyoung *
713 1.1 dyoung * Reads 16 bit value from EEPROM
714 1.1 dyoung **/
715 1.1 dyoung s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
716 1.1 dyoung {
717 1.1 dyoung return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
718 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
719 1.5 msaitoh }
720 1.5 msaitoh
721 1.5 msaitoh /**
722 1.5 msaitoh * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
723 1.5 msaitoh * @hw: pointer to hardware structure
724 1.5 msaitoh * @offset: offset within the EEPROM to be read
725 1.5 msaitoh * @data: read 16 bit word(s) from EEPROM
726 1.5 msaitoh * @words: number of words
727 1.5 msaitoh *
728 1.5 msaitoh * Reads 16 bit word(s) from EEPROM
729 1.5 msaitoh **/
730 1.5 msaitoh s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
731 1.5 msaitoh u16 words, u16 *data)
732 1.5 msaitoh {
733 1.5 msaitoh return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
734 1.5 msaitoh (hw, offset, words, data),
735 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
736 1.1 dyoung }
737 1.1 dyoung
738 1.1 dyoung /**
739 1.1 dyoung * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
740 1.1 dyoung * @hw: pointer to hardware structure
741 1.1 dyoung * @checksum_val: calculated checksum
742 1.1 dyoung *
743 1.1 dyoung * Performs checksum calculation and validates the EEPROM checksum
744 1.1 dyoung **/
745 1.1 dyoung s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
746 1.1 dyoung {
747 1.1 dyoung return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
748 1.5 msaitoh (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
749 1.1 dyoung }
750 1.1 dyoung
751 1.1 dyoung /**
752 1.1 dyoung * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
753 1.1 dyoung * @hw: pointer to hardware structure
754 1.1 dyoung **/
755 1.1 dyoung s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
756 1.1 dyoung {
757 1.1 dyoung return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
758 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
759 1.1 dyoung }
760 1.1 dyoung
761 1.1 dyoung /**
762 1.1 dyoung * ixgbe_insert_mac_addr - Find a RAR for this mac address
763 1.1 dyoung * @hw: pointer to hardware structure
764 1.1 dyoung * @addr: Address to put into receive address register
765 1.1 dyoung * @vmdq: VMDq pool to assign
766 1.1 dyoung *
767 1.1 dyoung * Puts an ethernet address into a receive address register, or
768 1.1 dyoung * finds the rar that it is aleady in; adds to the pool list
769 1.1 dyoung **/
770 1.1 dyoung s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
771 1.1 dyoung {
772 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
773 1.5 msaitoh (hw, addr, vmdq),
774 1.1 dyoung IXGBE_NOT_IMPLEMENTED);
775 1.1 dyoung }
776 1.1 dyoung
777 1.1 dyoung /**
778 1.1 dyoung * ixgbe_set_rar - Set Rx address register
779 1.1 dyoung * @hw: pointer to hardware structure
780 1.1 dyoung * @index: Receive address register to write
781 1.1 dyoung * @addr: Address to put into receive address register
782 1.1 dyoung * @vmdq: VMDq "set"
783 1.1 dyoung * @enable_addr: set flag that address is active
784 1.1 dyoung *
785 1.1 dyoung * Puts an ethernet address into a receive address register.
786 1.1 dyoung **/
787 1.1 dyoung s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
788 1.5 msaitoh u32 enable_addr)
789 1.1 dyoung {
790 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
791 1.5 msaitoh enable_addr), IXGBE_NOT_IMPLEMENTED);
792 1.1 dyoung }
793 1.1 dyoung
794 1.1 dyoung /**
795 1.1 dyoung * ixgbe_clear_rar - Clear Rx address register
796 1.1 dyoung * @hw: pointer to hardware structure
797 1.1 dyoung * @index: Receive address register to write
798 1.1 dyoung *
799 1.1 dyoung * Puts an ethernet address into a receive address register.
800 1.1 dyoung **/
801 1.1 dyoung s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
802 1.1 dyoung {
803 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
804 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
805 1.1 dyoung }
806 1.1 dyoung
807 1.1 dyoung /**
808 1.1 dyoung * ixgbe_set_vmdq - Associate a VMDq index with a receive address
809 1.1 dyoung * @hw: pointer to hardware structure
810 1.1 dyoung * @rar: receive address register index to associate with VMDq index
811 1.1 dyoung * @vmdq: VMDq set or pool index
812 1.1 dyoung **/
813 1.1 dyoung s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
814 1.1 dyoung {
815 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
816 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
817 1.1 dyoung }
818 1.1 dyoung
819 1.1 dyoung /**
820 1.1 dyoung * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
821 1.1 dyoung * @hw: pointer to hardware structure
822 1.1 dyoung * @rar: receive address register index to disassociate with VMDq index
823 1.1 dyoung * @vmdq: VMDq set or pool index
824 1.1 dyoung **/
825 1.1 dyoung s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
826 1.1 dyoung {
827 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
828 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
829 1.1 dyoung }
830 1.1 dyoung
831 1.1 dyoung /**
832 1.1 dyoung * ixgbe_init_rx_addrs - Initializes receive address filters.
833 1.1 dyoung * @hw: pointer to hardware structure
834 1.1 dyoung *
835 1.1 dyoung * Places the MAC address in receive address register 0 and clears the rest
836 1.1 dyoung * of the receive address registers. Clears the multicast table. Assumes
837 1.1 dyoung * the receiver is in reset when the routine is called.
838 1.1 dyoung **/
839 1.1 dyoung s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
840 1.1 dyoung {
841 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
842 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
843 1.1 dyoung }
844 1.1 dyoung
845 1.1 dyoung /**
846 1.1 dyoung * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
847 1.1 dyoung * @hw: pointer to hardware structure
848 1.1 dyoung **/
849 1.1 dyoung u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
850 1.1 dyoung {
851 1.1 dyoung return hw->mac.num_rar_entries;
852 1.1 dyoung }
853 1.1 dyoung
854 1.1 dyoung /**
855 1.1 dyoung * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
856 1.1 dyoung * @hw: pointer to hardware structure
857 1.1 dyoung * @addr_list: the list of new multicast addresses
858 1.1 dyoung * @addr_count: number of addresses
859 1.1 dyoung * @func: iterator function to walk the multicast address list
860 1.1 dyoung *
861 1.1 dyoung * The given list replaces any existing list. Clears the secondary addrs from
862 1.1 dyoung * receive address registers. Uses unused receive address registers for the
863 1.1 dyoung * first secondary addresses, and falls back to promiscuous mode as needed.
864 1.1 dyoung **/
865 1.1 dyoung s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
866 1.5 msaitoh u32 addr_count, ixgbe_mc_addr_itr func)
867 1.1 dyoung {
868 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
869 1.5 msaitoh addr_list, addr_count, func),
870 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
871 1.1 dyoung }
872 1.1 dyoung
873 1.1 dyoung /**
874 1.1 dyoung * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
875 1.1 dyoung * @hw: pointer to hardware structure
876 1.1 dyoung * @mc_addr_list: the list of new multicast addresses
877 1.1 dyoung * @mc_addr_count: number of addresses
878 1.1 dyoung * @func: iterator function to walk the multicast address list
879 1.1 dyoung *
880 1.1 dyoung * The given list replaces any existing list. Clears the MC addrs from receive
881 1.1 dyoung * address registers and the multicast table. Uses unused receive address
882 1.1 dyoung * registers for the first multicast addresses, and hashes the rest into the
883 1.1 dyoung * multicast table.
884 1.1 dyoung **/
885 1.1 dyoung s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
886 1.5 msaitoh u32 mc_addr_count, ixgbe_mc_addr_itr func,
887 1.5 msaitoh bool clear)
888 1.1 dyoung {
889 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
890 1.5 msaitoh mc_addr_list, mc_addr_count, func, clear),
891 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
892 1.1 dyoung }
893 1.1 dyoung
894 1.1 dyoung /**
895 1.1 dyoung * ixgbe_enable_mc - Enable multicast address in RAR
896 1.1 dyoung * @hw: pointer to hardware structure
897 1.1 dyoung *
898 1.1 dyoung * Enables multicast address in RAR and the use of the multicast hash table.
899 1.1 dyoung **/
900 1.1 dyoung s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
901 1.1 dyoung {
902 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
903 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
904 1.1 dyoung }
905 1.1 dyoung
906 1.1 dyoung /**
907 1.1 dyoung * ixgbe_disable_mc - Disable multicast address in RAR
908 1.1 dyoung * @hw: pointer to hardware structure
909 1.1 dyoung *
910 1.1 dyoung * Disables multicast address in RAR and the use of the multicast hash table.
911 1.1 dyoung **/
912 1.1 dyoung s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
913 1.1 dyoung {
914 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
915 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
916 1.1 dyoung }
917 1.1 dyoung
918 1.1 dyoung /**
919 1.1 dyoung * ixgbe_clear_vfta - Clear VLAN filter table
920 1.1 dyoung * @hw: pointer to hardware structure
921 1.1 dyoung *
922 1.1 dyoung * Clears the VLAN filer table, and the VMDq index associated with the filter
923 1.1 dyoung **/
924 1.1 dyoung s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
925 1.1 dyoung {
926 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
927 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
928 1.1 dyoung }
929 1.1 dyoung
930 1.1 dyoung /**
931 1.1 dyoung * ixgbe_set_vfta - Set VLAN filter table
932 1.1 dyoung * @hw: pointer to hardware structure
933 1.1 dyoung * @vlan: VLAN id to write to VLAN filter
934 1.1 dyoung * @vind: VMDq output index that maps queue to VLAN id in VFTA
935 1.1 dyoung * @vlan_on: boolean flag to turn on/off VLAN in VFTA
936 1.1 dyoung *
937 1.1 dyoung * Turn on/off specified VLAN in the VLAN filter table.
938 1.1 dyoung **/
939 1.1 dyoung s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
940 1.1 dyoung {
941 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
942 1.5 msaitoh vlan_on), IXGBE_NOT_IMPLEMENTED);
943 1.5 msaitoh }
944 1.5 msaitoh
945 1.5 msaitoh /**
946 1.5 msaitoh * ixgbe_set_vlvf - Set VLAN Pool Filter
947 1.5 msaitoh * @hw: pointer to hardware structure
948 1.5 msaitoh * @vlan: VLAN id to write to VLAN filter
949 1.5 msaitoh * @vind: VMDq output index that maps queue to VLAN id in VFVFB
950 1.5 msaitoh * @vlan_on: boolean flag to turn on/off VLAN in VFVF
951 1.5 msaitoh * @vfta_changed: pointer to boolean flag which indicates whether VFTA
952 1.5 msaitoh * should be changed
953 1.5 msaitoh *
954 1.5 msaitoh * Turn on/off specified bit in VLVF table.
955 1.5 msaitoh **/
956 1.5 msaitoh s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
957 1.5 msaitoh bool *vfta_changed)
958 1.5 msaitoh {
959 1.5 msaitoh return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
960 1.5 msaitoh vlan_on, vfta_changed), IXGBE_NOT_IMPLEMENTED);
961 1.1 dyoung }
962 1.1 dyoung
963 1.1 dyoung /**
964 1.1 dyoung * ixgbe_fc_enable - Enable flow control
965 1.1 dyoung * @hw: pointer to hardware structure
966 1.1 dyoung * @packetbuf_num: packet buffer number (0-7)
967 1.1 dyoung *
968 1.1 dyoung * Configures the flow control settings based on SW configuration.
969 1.1 dyoung **/
970 1.1 dyoung s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
971 1.1 dyoung {
972 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw, packetbuf_num),
973 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
974 1.5 msaitoh }
975 1.5 msaitoh
976 1.5 msaitoh /**
977 1.5 msaitoh * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
978 1.5 msaitoh * @hw: pointer to hardware structure
979 1.5 msaitoh * @maj: driver major number to be sent to firmware
980 1.5 msaitoh * @min: driver minor number to be sent to firmware
981 1.5 msaitoh * @build: driver build number to be sent to firmware
982 1.5 msaitoh * @ver: driver version number to be sent to firmware
983 1.5 msaitoh **/
984 1.5 msaitoh s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
985 1.5 msaitoh u8 ver)
986 1.5 msaitoh {
987 1.5 msaitoh return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
988 1.5 msaitoh build, ver), IXGBE_NOT_IMPLEMENTED);
989 1.1 dyoung }
990 1.1 dyoung
991 1.5 msaitoh
992 1.1 dyoung /**
993 1.1 dyoung * ixgbe_read_analog_reg8 - Reads 8 bit analog register
994 1.1 dyoung * @hw: pointer to hardware structure
995 1.1 dyoung * @reg: analog register to read
996 1.1 dyoung * @val: read value
997 1.1 dyoung *
998 1.1 dyoung * Performs write operation to analog register specified.
999 1.1 dyoung **/
1000 1.1 dyoung s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1001 1.1 dyoung {
1002 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1003 1.5 msaitoh val), IXGBE_NOT_IMPLEMENTED);
1004 1.1 dyoung }
1005 1.1 dyoung
1006 1.1 dyoung /**
1007 1.1 dyoung * ixgbe_write_analog_reg8 - Writes 8 bit analog register
1008 1.1 dyoung * @hw: pointer to hardware structure
1009 1.1 dyoung * @reg: analog register to write
1010 1.1 dyoung * @val: value to write
1011 1.1 dyoung *
1012 1.1 dyoung * Performs write operation to Atlas analog register specified.
1013 1.1 dyoung **/
1014 1.1 dyoung s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1015 1.1 dyoung {
1016 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1017 1.5 msaitoh val), IXGBE_NOT_IMPLEMENTED);
1018 1.1 dyoung }
1019 1.1 dyoung
1020 1.1 dyoung /**
1021 1.1 dyoung * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1022 1.1 dyoung * @hw: pointer to hardware structure
1023 1.1 dyoung *
1024 1.1 dyoung * Initializes the Unicast Table Arrays to zero on device load. This
1025 1.1 dyoung * is part of the Rx init addr execution path.
1026 1.1 dyoung **/
1027 1.1 dyoung s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1028 1.1 dyoung {
1029 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1030 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
1031 1.1 dyoung }
1032 1.1 dyoung
1033 1.1 dyoung /**
1034 1.1 dyoung * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1035 1.1 dyoung * @hw: pointer to hardware structure
1036 1.1 dyoung * @byte_offset: byte offset to read
1037 1.1 dyoung * @data: value read
1038 1.1 dyoung *
1039 1.1 dyoung * Performs byte read operation to SFP module's EEPROM over I2C interface.
1040 1.1 dyoung **/
1041 1.1 dyoung s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1042 1.5 msaitoh u8 *data)
1043 1.1 dyoung {
1044 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1045 1.5 msaitoh dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1046 1.1 dyoung }
1047 1.1 dyoung
1048 1.1 dyoung /**
1049 1.1 dyoung * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1050 1.1 dyoung * @hw: pointer to hardware structure
1051 1.1 dyoung * @byte_offset: byte offset to write
1052 1.1 dyoung * @data: value to write
1053 1.1 dyoung *
1054 1.1 dyoung * Performs byte write operation to SFP module's EEPROM over I2C interface
1055 1.1 dyoung * at a specified device address.
1056 1.1 dyoung **/
1057 1.1 dyoung s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1058 1.5 msaitoh u8 data)
1059 1.1 dyoung {
1060 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1061 1.5 msaitoh dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1062 1.1 dyoung }
1063 1.1 dyoung
1064 1.1 dyoung /**
1065 1.1 dyoung * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1066 1.1 dyoung * @hw: pointer to hardware structure
1067 1.1 dyoung * @byte_offset: EEPROM byte offset to write
1068 1.1 dyoung * @eeprom_data: value to write
1069 1.1 dyoung *
1070 1.1 dyoung * Performs byte write operation to SFP module's EEPROM over I2C interface.
1071 1.1 dyoung **/
1072 1.1 dyoung s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1073 1.5 msaitoh u8 byte_offset, u8 eeprom_data)
1074 1.1 dyoung {
1075 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1076 1.5 msaitoh (hw, byte_offset, eeprom_data),
1077 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
1078 1.1 dyoung }
1079 1.1 dyoung
1080 1.1 dyoung /**
1081 1.1 dyoung * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1082 1.1 dyoung * @hw: pointer to hardware structure
1083 1.1 dyoung * @byte_offset: EEPROM byte offset to read
1084 1.1 dyoung * @eeprom_data: value read
1085 1.1 dyoung *
1086 1.1 dyoung * Performs byte read operation to SFP module's EEPROM over I2C interface.
1087 1.1 dyoung **/
1088 1.1 dyoung s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1089 1.1 dyoung {
1090 1.1 dyoung return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1091 1.5 msaitoh (hw, byte_offset, eeprom_data),
1092 1.5 msaitoh IXGBE_NOT_IMPLEMENTED);
1093 1.1 dyoung }
1094 1.1 dyoung
1095 1.1 dyoung /**
1096 1.1 dyoung * ixgbe_get_supported_physical_layer - Returns physical layer type
1097 1.1 dyoung * @hw: pointer to hardware structure
1098 1.1 dyoung *
1099 1.1 dyoung * Determines physical layer capabilities of the current configuration.
1100 1.1 dyoung **/
1101 1.1 dyoung u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1102 1.1 dyoung {
1103 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1104 1.5 msaitoh (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1105 1.1 dyoung }
1106 1.1 dyoung
1107 1.1 dyoung /**
1108 1.1 dyoung * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependant on device specifics
1109 1.1 dyoung * @hw: pointer to hardware structure
1110 1.1 dyoung * @regval: bitfield to write to the Rx DMA register
1111 1.1 dyoung *
1112 1.1 dyoung * Enables the Rx DMA unit of the device.
1113 1.1 dyoung **/
1114 1.1 dyoung s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1115 1.1 dyoung {
1116 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1117 1.5 msaitoh (hw, regval), IXGBE_NOT_IMPLEMENTED);
1118 1.5 msaitoh }
1119 1.5 msaitoh
1120 1.5 msaitoh /**
1121 1.5 msaitoh * ixgbe_disable_sec_rx_path - Stops the receive data path
1122 1.5 msaitoh * @hw: pointer to hardware structure
1123 1.5 msaitoh *
1124 1.5 msaitoh * Stops the receive data path.
1125 1.5 msaitoh **/
1126 1.5 msaitoh s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1127 1.5 msaitoh {
1128 1.5 msaitoh return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1129 1.5 msaitoh (hw), IXGBE_NOT_IMPLEMENTED);
1130 1.5 msaitoh }
1131 1.5 msaitoh
1132 1.5 msaitoh /**
1133 1.5 msaitoh * ixgbe_enable_sec_rx_path - Enables the receive data path
1134 1.5 msaitoh * @hw: pointer to hardware structure
1135 1.5 msaitoh *
1136 1.5 msaitoh * Enables the receive data path.
1137 1.5 msaitoh **/
1138 1.5 msaitoh s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1139 1.5 msaitoh {
1140 1.5 msaitoh return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1141 1.5 msaitoh (hw), IXGBE_NOT_IMPLEMENTED);
1142 1.1 dyoung }
1143 1.1 dyoung
1144 1.1 dyoung /**
1145 1.1 dyoung * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1146 1.1 dyoung * @hw: pointer to hardware structure
1147 1.1 dyoung * @mask: Mask to specify which semaphore to acquire
1148 1.1 dyoung *
1149 1.1 dyoung * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1150 1.1 dyoung * function (CSR, PHY0, PHY1, EEPROM, Flash)
1151 1.1 dyoung **/
1152 1.1 dyoung s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1153 1.1 dyoung {
1154 1.1 dyoung return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1155 1.5 msaitoh (hw, mask), IXGBE_NOT_IMPLEMENTED);
1156 1.1 dyoung }
1157 1.1 dyoung
1158 1.1 dyoung /**
1159 1.1 dyoung * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1160 1.1 dyoung * @hw: pointer to hardware structure
1161 1.1 dyoung * @mask: Mask to specify which semaphore to release
1162 1.1 dyoung *
1163 1.1 dyoung * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1164 1.1 dyoung * function (CSR, PHY0, PHY1, EEPROM, Flash)
1165 1.1 dyoung **/
1166 1.1 dyoung void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1167 1.1 dyoung {
1168 1.1 dyoung if (hw->mac.ops.release_swfw_sync)
1169 1.1 dyoung hw->mac.ops.release_swfw_sync(hw, mask);
1170 1.1 dyoung }
1171 1.1 dyoung
1172