ixgbe_api.c revision 1.17 1 /* $NetBSD: ixgbe_api.c,v 1.17 2017/08/30 08:49:18 msaitoh Exp $ */
2
3 /******************************************************************************
4
5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer.
13
14 2. Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
17
18 3. Neither the name of the Intel Corporation nor the names of its
19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33
34 ******************************************************************************/
35 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 320688 2017-07-05 17:27:03Z erj $*/
36
37 #include "ixgbe_api.h"
38 #include "ixgbe_common.h"
39
40 #define IXGBE_EMPTY_PARAM
41
42 static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
43 IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
44 };
45
46 static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
47 IXGBE_MVALS_INIT(_X540)
48 };
49
50 static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
51 IXGBE_MVALS_INIT(_X550)
52 };
53
54 static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
55 IXGBE_MVALS_INIT(_X550EM_x)
56 };
57
58 static const u32 ixgbe_mvals_X550EM_a[IXGBE_MVALS_IDX_LIMIT] = {
59 IXGBE_MVALS_INIT(_X550EM_a)
60 };
61
62 /**
63 * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
64 * @hw: pointer to hardware structure
65 * @map: pointer to u8 arr for returning map
66 *
67 * Read the rtrup2tc HW register and resolve its content into map
68 **/
69 void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
70 {
71 if (hw->mac.ops.get_rtrup2tc)
72 hw->mac.ops.get_rtrup2tc(hw, map);
73 }
74
75 /**
76 * ixgbe_init_shared_code - Initialize the shared code
77 * @hw: pointer to hardware structure
78 *
79 * This will assign function pointers and assign the MAC type and PHY code.
80 * Does not touch the hardware. This function must be called prior to any
81 * other function in the shared code. The ixgbe_hw structure should be
82 * memset to 0 prior to calling this function. The following fields in
83 * hw structure should be filled in prior to calling this function:
84 * back, device_id, vendor_id, subsystem_device_id,
85 * subsystem_vendor_id, and revision_id
86 **/
87 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
88 {
89 s32 status;
90
91 DEBUGFUNC("ixgbe_init_shared_code");
92
93 /*
94 * Set the mac type
95 */
96 ixgbe_set_mac_type(hw);
97
98 switch (hw->mac.type) {
99 case ixgbe_mac_82598EB:
100 status = ixgbe_init_ops_82598(hw);
101 break;
102 case ixgbe_mac_82599EB:
103 status = ixgbe_init_ops_82599(hw);
104 break;
105 case ixgbe_mac_X540:
106 status = ixgbe_init_ops_X540(hw);
107 break;
108 case ixgbe_mac_X550:
109 status = ixgbe_init_ops_X550(hw);
110 break;
111 case ixgbe_mac_X550EM_x:
112 status = ixgbe_init_ops_X550EM_x(hw);
113 break;
114 case ixgbe_mac_X550EM_a:
115 status = ixgbe_init_ops_X550EM_a(hw);
116 break;
117 default:
118 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
119 break;
120 }
121 hw->mac.max_link_up_time = IXGBE_LINK_UP_TIME;
122
123 return status;
124 }
125
126 /**
127 * ixgbe_set_mac_type - Sets MAC type
128 * @hw: pointer to the HW structure
129 *
130 * This function sets the mac type of the adapter based on the
131 * vendor ID and device ID stored in the hw structure.
132 **/
133 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
134 {
135 s32 ret_val = IXGBE_SUCCESS;
136
137 DEBUGFUNC("ixgbe_set_mac_type\n");
138
139 if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
140 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
141 "Unsupported vendor id: %x", hw->vendor_id);
142 return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
143 }
144
145 hw->mvals = ixgbe_mvals_base;
146
147 switch (hw->device_id) {
148 case IXGBE_DEV_ID_82598:
149 case IXGBE_DEV_ID_82598_BX:
150 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
151 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
152 case IXGBE_DEV_ID_82598AT:
153 case IXGBE_DEV_ID_82598AT2:
154 case IXGBE_DEV_ID_82598EB_CX4:
155 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
156 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
157 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
158 case IXGBE_DEV_ID_82598EB_XF_LR:
159 case IXGBE_DEV_ID_82598EB_SFP_LOM:
160 hw->mac.type = ixgbe_mac_82598EB;
161 break;
162 case IXGBE_DEV_ID_82599_KX4:
163 case IXGBE_DEV_ID_82599_KX4_MEZZ:
164 case IXGBE_DEV_ID_82599_XAUI_LOM:
165 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
166 case IXGBE_DEV_ID_82599_KR:
167 case IXGBE_DEV_ID_82599_SFP:
168 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
169 case IXGBE_DEV_ID_82599_SFP_FCOE:
170 case IXGBE_DEV_ID_82599_SFP_EM:
171 case IXGBE_DEV_ID_82599_SFP_SF2:
172 case IXGBE_DEV_ID_82599_SFP_SF_QP:
173 case IXGBE_DEV_ID_82599_QSFP_SF_QP:
174 case IXGBE_DEV_ID_82599EN_SFP:
175 case IXGBE_DEV_ID_82599_CX4:
176 case IXGBE_DEV_ID_82599_BYPASS:
177 case IXGBE_DEV_ID_82599_T3_LOM:
178 hw->mac.type = ixgbe_mac_82599EB;
179 break;
180 case IXGBE_DEV_ID_X540T:
181 case IXGBE_DEV_ID_X540T1:
182 case IXGBE_DEV_ID_X540_BYPASS:
183 hw->mac.type = ixgbe_mac_X540;
184 hw->mvals = ixgbe_mvals_X540;
185 break;
186 case IXGBE_DEV_ID_X550T:
187 case IXGBE_DEV_ID_X550T1:
188 hw->mac.type = ixgbe_mac_X550;
189 hw->mvals = ixgbe_mvals_X550;
190 break;
191 case IXGBE_DEV_ID_X550EM_X_KX4:
192 case IXGBE_DEV_ID_X550EM_X_KR:
193 case IXGBE_DEV_ID_X550EM_X_10G_T:
194 case IXGBE_DEV_ID_X550EM_X_1G_T:
195 case IXGBE_DEV_ID_X550EM_X_SFP:
196 case IXGBE_DEV_ID_X550EM_X_XFI:
197 hw->mac.type = ixgbe_mac_X550EM_x;
198 hw->mvals = ixgbe_mvals_X550EM_x;
199 break;
200 case IXGBE_DEV_ID_X550EM_A_KR:
201 case IXGBE_DEV_ID_X550EM_A_KR_L:
202 case IXGBE_DEV_ID_X550EM_A_SFP_N:
203 case IXGBE_DEV_ID_X550EM_A_SGMII:
204 case IXGBE_DEV_ID_X550EM_A_SGMII_L:
205 case IXGBE_DEV_ID_X550EM_A_1G_T:
206 case IXGBE_DEV_ID_X550EM_A_1G_T_L:
207 case IXGBE_DEV_ID_X550EM_A_10G_T:
208 case IXGBE_DEV_ID_X550EM_A_QSFP:
209 case IXGBE_DEV_ID_X550EM_A_QSFP_N:
210 case IXGBE_DEV_ID_X550EM_A_SFP:
211 hw->mac.type = ixgbe_mac_X550EM_a;
212 hw->mvals = ixgbe_mvals_X550EM_a;
213 break;
214 default:
215 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
216 ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
217 "Unsupported device id: %x",
218 hw->device_id);
219 break;
220 }
221
222 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
223 hw->mac.type, ret_val);
224 return ret_val;
225 }
226
227 /**
228 * ixgbe_init_hw - Initialize the hardware
229 * @hw: pointer to hardware structure
230 *
231 * Initialize the hardware by resetting and then starting the hardware
232 **/
233 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
234 {
235 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
236 IXGBE_NOT_IMPLEMENTED);
237 }
238
239 /**
240 * ixgbe_reset_hw - Performs a hardware reset
241 * @hw: pointer to hardware structure
242 *
243 * Resets the hardware by resetting the transmit and receive units, masks and
244 * clears all interrupts, performs a PHY reset, and performs a MAC reset
245 **/
246 s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
247 {
248 return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
249 IXGBE_NOT_IMPLEMENTED);
250 }
251
252 /**
253 * ixgbe_start_hw - Prepares hardware for Rx/Tx
254 * @hw: pointer to hardware structure
255 *
256 * Starts the hardware by filling the bus info structure and media type,
257 * clears all on chip counters, initializes receive address registers,
258 * multicast table, VLAN filter table, calls routine to setup link and
259 * flow control settings, and leaves transmit and receive units disabled
260 * and uninitialized.
261 **/
262 s32 ixgbe_start_hw(struct ixgbe_hw *hw)
263 {
264 return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
265 IXGBE_NOT_IMPLEMENTED);
266 }
267
268 /**
269 * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
270 * which is disabled by default in ixgbe_start_hw();
271 *
272 * @hw: pointer to hardware structure
273 *
274 * Enable relaxed ordering;
275 **/
276 void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
277 {
278 if (hw->mac.ops.enable_relaxed_ordering)
279 hw->mac.ops.enable_relaxed_ordering(hw);
280 }
281
282 /**
283 * ixgbe_clear_hw_cntrs - Clear hardware counters
284 * @hw: pointer to hardware structure
285 *
286 * Clears all hardware statistics counters by reading them from the hardware
287 * Statistics counters are clear on read.
288 **/
289 s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
290 {
291 return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
292 IXGBE_NOT_IMPLEMENTED);
293 }
294
295 /**
296 * ixgbe_get_media_type - Get media type
297 * @hw: pointer to hardware structure
298 *
299 * Returns the media type (fiber, copper, backplane)
300 **/
301 enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
302 {
303 return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
304 ixgbe_media_type_unknown);
305 }
306
307 /**
308 * ixgbe_get_mac_addr - Get MAC address
309 * @hw: pointer to hardware structure
310 * @mac_addr: Adapter MAC address
311 *
312 * Reads the adapter's MAC address from the first Receive Address Register
313 * (RAR0) A reset of the adapter must have been performed prior to calling
314 * this function in order for the MAC address to have been loaded from the
315 * EEPROM into RAR0
316 **/
317 s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
318 {
319 return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
320 (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
321 }
322
323 /**
324 * ixgbe_get_san_mac_addr - Get SAN MAC address
325 * @hw: pointer to hardware structure
326 * @san_mac_addr: SAN MAC address
327 *
328 * Reads the SAN MAC address from the EEPROM, if it's available. This is
329 * per-port, so set_lan_id() must be called before reading the addresses.
330 **/
331 s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
332 {
333 return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
334 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
335 }
336
337 /**
338 * ixgbe_set_san_mac_addr - Write a SAN MAC address
339 * @hw: pointer to hardware structure
340 * @san_mac_addr: SAN MAC address
341 *
342 * Writes A SAN MAC address to the EEPROM.
343 **/
344 s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
345 {
346 return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
347 (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
348 }
349
350 /**
351 * ixgbe_get_device_caps - Get additional device capabilities
352 * @hw: pointer to hardware structure
353 * @device_caps: the EEPROM word for device capabilities
354 *
355 * Reads the extra device capabilities from the EEPROM
356 **/
357 s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
358 {
359 return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
360 (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
361 }
362
363 /**
364 * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
365 * @hw: pointer to hardware structure
366 * @wwnn_prefix: the alternative WWNN prefix
367 * @wwpn_prefix: the alternative WWPN prefix
368 *
369 * This function will read the EEPROM from the alternative SAN MAC address
370 * block to check the support for the alternative WWNN/WWPN prefix support.
371 **/
372 s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
373 u16 *wwpn_prefix)
374 {
375 return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
376 (hw, wwnn_prefix, wwpn_prefix),
377 IXGBE_NOT_IMPLEMENTED);
378 }
379
380 /**
381 * ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
382 * @hw: pointer to hardware structure
383 * @bs: the fcoe boot status
384 *
385 * This function will read the FCOE boot status from the iSCSI FCOE block
386 **/
387 s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
388 {
389 return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
390 (hw, bs),
391 IXGBE_NOT_IMPLEMENTED);
392 }
393
394 /**
395 * ixgbe_get_bus_info - Set PCI bus info
396 * @hw: pointer to hardware structure
397 *
398 * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
399 **/
400 s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
401 {
402 return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
403 IXGBE_NOT_IMPLEMENTED);
404 }
405
406 /**
407 * ixgbe_get_num_of_tx_queues - Get Tx queues
408 * @hw: pointer to hardware structure
409 *
410 * Returns the number of transmit queues for the given adapter.
411 **/
412 u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
413 {
414 return hw->mac.max_tx_queues;
415 }
416
417 /**
418 * ixgbe_get_num_of_rx_queues - Get Rx queues
419 * @hw: pointer to hardware structure
420 *
421 * Returns the number of receive queues for the given adapter.
422 **/
423 u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
424 {
425 return hw->mac.max_rx_queues;
426 }
427
428 /**
429 * ixgbe_stop_adapter - Disable Rx/Tx units
430 * @hw: pointer to hardware structure
431 *
432 * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
433 * disables transmit and receive units. The adapter_stopped flag is used by
434 * the shared code and drivers to determine if the adapter is in a stopped
435 * state and should not touch the hardware.
436 **/
437 s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
438 {
439 return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
440 IXGBE_NOT_IMPLEMENTED);
441 }
442
443 /**
444 * ixgbe_read_pba_string - Reads part number string from EEPROM
445 * @hw: pointer to hardware structure
446 * @pba_num: stores the part number string from the EEPROM
447 * @pba_num_size: part number string buffer length
448 *
449 * Reads the part number string from the EEPROM.
450 **/
451 s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
452 {
453 return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
454 }
455
456 /**
457 * ixgbe_read_pba_num - Reads part number from EEPROM
458 * @hw: pointer to hardware structure
459 * @pba_num: stores the part number from the EEPROM
460 *
461 * Reads the part number from the EEPROM.
462 **/
463 s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
464 {
465 return ixgbe_read_pba_num_generic(hw, pba_num);
466 }
467
468 /**
469 * ixgbe_identify_phy - Get PHY type
470 * @hw: pointer to hardware structure
471 *
472 * Determines the physical layer module found on the current adapter.
473 **/
474 s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
475 {
476 s32 status = IXGBE_SUCCESS;
477
478 if (hw->phy.type == ixgbe_phy_unknown) {
479 status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
480 IXGBE_NOT_IMPLEMENTED);
481 }
482
483 return status;
484 }
485
486 /**
487 * ixgbe_reset_phy - Perform a PHY reset
488 * @hw: pointer to hardware structure
489 **/
490 s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
491 {
492 s32 status = IXGBE_SUCCESS;
493
494 if (hw->phy.type == ixgbe_phy_unknown) {
495 if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
496 status = IXGBE_ERR_PHY;
497 }
498
499 if (status == IXGBE_SUCCESS) {
500 status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
501 IXGBE_NOT_IMPLEMENTED);
502 }
503 return status;
504 }
505
506 /**
507 * ixgbe_get_phy_firmware_version -
508 * @hw: pointer to hardware structure
509 * @firmware_version: pointer to firmware version
510 **/
511 s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
512 {
513 s32 status = IXGBE_SUCCESS;
514
515 status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
516 (hw, firmware_version),
517 IXGBE_NOT_IMPLEMENTED);
518 return status;
519 }
520
521 /**
522 * ixgbe_read_phy_reg - Read PHY register
523 * @hw: pointer to hardware structure
524 * @reg_addr: 32 bit address of PHY register to read
525 * @phy_data: Pointer to read data from PHY register
526 *
527 * Reads a value from a specified PHY register
528 **/
529 s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
530 u16 *phy_data)
531 {
532 if (hw->phy.id == 0)
533 ixgbe_identify_phy(hw);
534
535 return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
536 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
537 }
538
539 /**
540 * ixgbe_write_phy_reg - Write PHY register
541 * @hw: pointer to hardware structure
542 * @reg_addr: 32 bit PHY register to write
543 * @phy_data: Data to write to the PHY register
544 *
545 * Writes a value to specified PHY register
546 **/
547 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
548 u16 phy_data)
549 {
550 if (hw->phy.id == 0)
551 ixgbe_identify_phy(hw);
552
553 return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
554 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
555 }
556
557 /**
558 * ixgbe_setup_phy_link - Restart PHY autoneg
559 * @hw: pointer to hardware structure
560 *
561 * Restart autonegotiation and PHY and waits for completion.
562 **/
563 s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
564 {
565 return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
566 IXGBE_NOT_IMPLEMENTED);
567 }
568
569 /**
570 * ixgbe_setup_internal_phy - Configure integrated PHY
571 * @hw: pointer to hardware structure
572 *
573 * Reconfigure the integrated PHY in order to enable talk to the external PHY.
574 * Returns success if not implemented, since nothing needs to be done in this
575 * case.
576 */
577 s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw)
578 {
579 return ixgbe_call_func(hw, hw->phy.ops.setup_internal_link, (hw),
580 IXGBE_SUCCESS);
581 }
582
583 /**
584 * ixgbe_check_phy_link - Determine link and speed status
585 * @hw: pointer to hardware structure
586 *
587 * Reads a PHY register to determine if link is up and the current speed for
588 * the PHY.
589 **/
590 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
591 bool *link_up)
592 {
593 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
594 link_up), IXGBE_NOT_IMPLEMENTED);
595 }
596
597 /**
598 * ixgbe_setup_phy_link_speed - Set auto advertise
599 * @hw: pointer to hardware structure
600 * @speed: new link speed
601 *
602 * Sets the auto advertised capabilities
603 **/
604 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
605 bool autoneg_wait_to_complete)
606 {
607 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
608 autoneg_wait_to_complete),
609 IXGBE_NOT_IMPLEMENTED);
610 }
611
612 /**
613 * ixgbe_set_phy_power - Control the phy power state
614 * @hw: pointer to hardware structure
615 * @on: TRUE for on, FALSE for off
616 */
617 s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on)
618 {
619 return ixgbe_call_func(hw, hw->phy.ops.set_phy_power, (hw, on),
620 IXGBE_NOT_IMPLEMENTED);
621 }
622
623 /**
624 * ixgbe_check_link - Get link and speed status
625 * @hw: pointer to hardware structure
626 *
627 * Reads the links register to determine if link is up and the current speed
628 **/
629 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
630 bool *link_up, bool link_up_wait_to_complete)
631 {
632 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
633 link_up, link_up_wait_to_complete),
634 IXGBE_NOT_IMPLEMENTED);
635 }
636
637 /**
638 * ixgbe_disable_tx_laser - Disable Tx laser
639 * @hw: pointer to hardware structure
640 *
641 * If the driver needs to disable the laser on SFI optics.
642 **/
643 void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
644 {
645 if (hw->mac.ops.disable_tx_laser)
646 hw->mac.ops.disable_tx_laser(hw);
647 }
648
649 /**
650 * ixgbe_enable_tx_laser - Enable Tx laser
651 * @hw: pointer to hardware structure
652 *
653 * If the driver needs to enable the laser on SFI optics.
654 **/
655 void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
656 {
657 if (hw->mac.ops.enable_tx_laser)
658 hw->mac.ops.enable_tx_laser(hw);
659 }
660
661 /**
662 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
663 * @hw: pointer to hardware structure
664 *
665 * When the driver changes the link speeds that it can support then
666 * flap the tx laser to alert the link partner to start autotry
667 * process on its end.
668 **/
669 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
670 {
671 if (hw->mac.ops.flap_tx_laser)
672 hw->mac.ops.flap_tx_laser(hw);
673 }
674
675 /**
676 * ixgbe_setup_link - Set link speed
677 * @hw: pointer to hardware structure
678 * @speed: new link speed
679 *
680 * Configures link settings. Restarts the link.
681 * Performs autonegotiation if needed.
682 **/
683 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
684 bool autoneg_wait_to_complete)
685 {
686 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
687 autoneg_wait_to_complete),
688 IXGBE_NOT_IMPLEMENTED);
689 }
690
691 /**
692 * ixgbe_setup_mac_link - Set link speed
693 * @hw: pointer to hardware structure
694 * @speed: new link speed
695 *
696 * Configures link settings. Restarts the link.
697 * Performs autonegotiation if needed.
698 **/
699 s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
700 bool autoneg_wait_to_complete)
701 {
702 return ixgbe_call_func(hw, hw->mac.ops.setup_mac_link, (hw, speed,
703 autoneg_wait_to_complete),
704 IXGBE_NOT_IMPLEMENTED);
705 }
706
707 /**
708 * ixgbe_get_link_capabilities - Returns link capabilities
709 * @hw: pointer to hardware structure
710 *
711 * Determines the link capabilities of the current configuration.
712 **/
713 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
714 bool *autoneg)
715 {
716 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
717 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
718 }
719
720 /**
721 * ixgbe_led_on - Turn on LEDs
722 * @hw: pointer to hardware structure
723 * @index: led number to turn on
724 *
725 * Turns on the software controllable LEDs.
726 **/
727 s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
728 {
729 return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
730 IXGBE_NOT_IMPLEMENTED);
731 }
732
733 /**
734 * ixgbe_led_off - Turn off LEDs
735 * @hw: pointer to hardware structure
736 * @index: led number to turn off
737 *
738 * Turns off the software controllable LEDs.
739 **/
740 s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
741 {
742 return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
743 IXGBE_NOT_IMPLEMENTED);
744 }
745
746 /**
747 * ixgbe_blink_led_start - Blink LEDs
748 * @hw: pointer to hardware structure
749 * @index: led number to blink
750 *
751 * Blink LED based on index.
752 **/
753 s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
754 {
755 return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
756 IXGBE_NOT_IMPLEMENTED);
757 }
758
759 /**
760 * ixgbe_blink_led_stop - Stop blinking LEDs
761 * @hw: pointer to hardware structure
762 *
763 * Stop blinking LED based on index.
764 **/
765 s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
766 {
767 return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
768 IXGBE_NOT_IMPLEMENTED);
769 }
770
771 /**
772 * ixgbe_init_eeprom_params - Initialize EEPROM parameters
773 * @hw: pointer to hardware structure
774 *
775 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
776 * ixgbe_hw struct in order to set up EEPROM access.
777 **/
778 s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
779 {
780 return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
781 IXGBE_NOT_IMPLEMENTED);
782 }
783
784
785 /**
786 * ixgbe_write_eeprom - Write word to EEPROM
787 * @hw: pointer to hardware structure
788 * @offset: offset within the EEPROM to be written to
789 * @data: 16 bit word to be written to the EEPROM
790 *
791 * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
792 * called after this function, the EEPROM will most likely contain an
793 * invalid checksum.
794 **/
795 s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
796 {
797 return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
798 IXGBE_NOT_IMPLEMENTED);
799 }
800
801 /**
802 * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
803 * @hw: pointer to hardware structure
804 * @offset: offset within the EEPROM to be written to
805 * @data: 16 bit word(s) to be written to the EEPROM
806 * @words: number of words
807 *
808 * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
809 * called after this function, the EEPROM will most likely contain an
810 * invalid checksum.
811 **/
812 s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
813 u16 *data)
814 {
815 return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
816 (hw, offset, words, data),
817 IXGBE_NOT_IMPLEMENTED);
818 }
819
820 /**
821 * ixgbe_read_eeprom - Read word from EEPROM
822 * @hw: pointer to hardware structure
823 * @offset: offset within the EEPROM to be read
824 * @data: read 16 bit value from EEPROM
825 *
826 * Reads 16 bit value from EEPROM
827 **/
828 s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
829 {
830 return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
831 IXGBE_NOT_IMPLEMENTED);
832 }
833
834 /**
835 * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
836 * @hw: pointer to hardware structure
837 * @offset: offset within the EEPROM to be read
838 * @data: read 16 bit word(s) from EEPROM
839 * @words: number of words
840 *
841 * Reads 16 bit word(s) from EEPROM
842 **/
843 s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
844 u16 words, u16 *data)
845 {
846 return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
847 (hw, offset, words, data),
848 IXGBE_NOT_IMPLEMENTED);
849 }
850
851 /**
852 * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
853 * @hw: pointer to hardware structure
854 * @checksum_val: calculated checksum
855 *
856 * Performs checksum calculation and validates the EEPROM checksum
857 **/
858 s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
859 {
860 return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
861 (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
862 }
863
864 /**
865 * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
866 * @hw: pointer to hardware structure
867 **/
868 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
869 {
870 return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
871 IXGBE_NOT_IMPLEMENTED);
872 }
873
874 /**
875 * ixgbe_insert_mac_addr - Find a RAR for this mac address
876 * @hw: pointer to hardware structure
877 * @addr: Address to put into receive address register
878 * @vmdq: VMDq pool to assign
879 *
880 * Puts an ethernet address into a receive address register, or
881 * finds the rar that it is already in; adds to the pool list
882 **/
883 s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
884 {
885 return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
886 (hw, addr, vmdq),
887 IXGBE_NOT_IMPLEMENTED);
888 }
889
890 /**
891 * ixgbe_set_rar - Set Rx address register
892 * @hw: pointer to hardware structure
893 * @index: Receive address register to write
894 * @addr: Address to put into receive address register
895 * @vmdq: VMDq "set"
896 * @enable_addr: set flag that address is active
897 *
898 * Puts an ethernet address into a receive address register.
899 **/
900 s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
901 u32 enable_addr)
902 {
903 return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
904 enable_addr), IXGBE_NOT_IMPLEMENTED);
905 }
906
907 /**
908 * ixgbe_clear_rar - Clear Rx address register
909 * @hw: pointer to hardware structure
910 * @index: Receive address register to write
911 *
912 * Puts an ethernet address into a receive address register.
913 **/
914 s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
915 {
916 return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
917 IXGBE_NOT_IMPLEMENTED);
918 }
919
920 /**
921 * ixgbe_set_vmdq - Associate a VMDq index with a receive address
922 * @hw: pointer to hardware structure
923 * @rar: receive address register index to associate with VMDq index
924 * @vmdq: VMDq set or pool index
925 **/
926 s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
927 {
928 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
929 IXGBE_NOT_IMPLEMENTED);
930
931 }
932
933 /**
934 * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
935 * @hw: pointer to hardware structure
936 * @vmdq: VMDq default pool index
937 **/
938 s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
939 {
940 return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
941 (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
942 }
943
944 /**
945 * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
946 * @hw: pointer to hardware structure
947 * @rar: receive address register index to disassociate with VMDq index
948 * @vmdq: VMDq set or pool index
949 **/
950 s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
951 {
952 return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
953 IXGBE_NOT_IMPLEMENTED);
954 }
955
956 /**
957 * ixgbe_init_rx_addrs - Initializes receive address filters.
958 * @hw: pointer to hardware structure
959 *
960 * Places the MAC address in receive address register 0 and clears the rest
961 * of the receive address registers. Clears the multicast table. Assumes
962 * the receiver is in reset when the routine is called.
963 **/
964 s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
965 {
966 return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
967 IXGBE_NOT_IMPLEMENTED);
968 }
969
970 /**
971 * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
972 * @hw: pointer to hardware structure
973 **/
974 u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
975 {
976 return hw->mac.num_rar_entries;
977 }
978
979 /**
980 * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
981 * @hw: pointer to hardware structure
982 * @addr_list: the list of new multicast addresses
983 * @addr_count: number of addresses
984 * @func: iterator function to walk the multicast address list
985 *
986 * The given list replaces any existing list. Clears the secondary addrs from
987 * receive address registers. Uses unused receive address registers for the
988 * first secondary addresses, and falls back to promiscuous mode as needed.
989 **/
990 s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
991 u32 addr_count, ixgbe_mc_addr_itr func)
992 {
993 return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
994 addr_list, addr_count, func),
995 IXGBE_NOT_IMPLEMENTED);
996 }
997
998 /**
999 * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
1000 * @hw: pointer to hardware structure
1001 * @mc_addr_list: the list of new multicast addresses
1002 * @mc_addr_count: number of addresses
1003 * @func: iterator function to walk the multicast address list
1004 *
1005 * The given list replaces any existing list. Clears the MC addrs from receive
1006 * address registers and the multicast table. Uses unused receive address
1007 * registers for the first multicast addresses, and hashes the rest into the
1008 * multicast table.
1009 **/
1010 s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
1011 u32 mc_addr_count, ixgbe_mc_addr_itr func,
1012 bool clear)
1013 {
1014 return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
1015 mc_addr_list, mc_addr_count, func, clear),
1016 IXGBE_NOT_IMPLEMENTED);
1017 }
1018
1019 /**
1020 * ixgbe_enable_mc - Enable multicast address in RAR
1021 * @hw: pointer to hardware structure
1022 *
1023 * Enables multicast address in RAR and the use of the multicast hash table.
1024 **/
1025 s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
1026 {
1027 return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
1028 IXGBE_NOT_IMPLEMENTED);
1029 }
1030
1031 /**
1032 * ixgbe_disable_mc - Disable multicast address in RAR
1033 * @hw: pointer to hardware structure
1034 *
1035 * Disables multicast address in RAR and the use of the multicast hash table.
1036 **/
1037 s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
1038 {
1039 return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
1040 IXGBE_NOT_IMPLEMENTED);
1041 }
1042
1043 /**
1044 * ixgbe_clear_vfta - Clear VLAN filter table
1045 * @hw: pointer to hardware structure
1046 *
1047 * Clears the VLAN filer table, and the VMDq index associated with the filter
1048 **/
1049 s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
1050 {
1051 return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
1052 IXGBE_NOT_IMPLEMENTED);
1053 }
1054
1055 /**
1056 * ixgbe_set_vfta - Set VLAN filter table
1057 * @hw: pointer to hardware structure
1058 * @vlan: VLAN id to write to VLAN filter
1059 * @vind: VMDq output index that maps queue to VLAN id in VLVFB
1060 * @vlan_on: boolean flag to turn on/off VLAN
1061 * @vlvf_bypass: boolean flag indicating updating the default pool is okay
1062 *
1063 * Turn on/off specified VLAN in the VLAN filter table.
1064 **/
1065 s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
1066 bool vlvf_bypass)
1067 {
1068 return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
1069 vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
1070 }
1071
1072 /**
1073 * ixgbe_set_vlvf - Set VLAN Pool Filter
1074 * @hw: pointer to hardware structure
1075 * @vlan: VLAN id to write to VLAN filter
1076 * @vind: VMDq output index that maps queue to VLAN id in VLVFB
1077 * @vlan_on: boolean flag to turn on/off VLAN in VLVF
1078 * @vfta_delta: pointer to the difference between the current value of VFTA
1079 * and the desired value
1080 * @vfta: the desired value of the VFTA
1081 * @vlvf_bypass: boolean flag indicating updating the default pool is okay
1082 *
1083 * Turn on/off specified bit in VLVF table.
1084 **/
1085 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
1086 u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
1087 {
1088 return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
1089 vlan_on, vfta_delta, vfta, vlvf_bypass),
1090 IXGBE_NOT_IMPLEMENTED);
1091 }
1092
1093 /**
1094 * ixgbe_fc_enable - Enable flow control
1095 * @hw: pointer to hardware structure
1096 *
1097 * Configures the flow control settings based on SW configuration.
1098 **/
1099 s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
1100 {
1101 return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
1102 IXGBE_NOT_IMPLEMENTED);
1103 }
1104
1105 /**
1106 * ixgbe_setup_fc - Set up flow control
1107 * @hw: pointer to hardware structure
1108 *
1109 * Called at init time to set up flow control.
1110 **/
1111 s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
1112 {
1113 return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw),
1114 IXGBE_NOT_IMPLEMENTED);
1115 }
1116
1117 /**
1118 * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
1119 * @hw: pointer to hardware structure
1120 * @maj: driver major number to be sent to firmware
1121 * @minr: driver minor number to be sent to firmware
1122 * @build: driver build number to be sent to firmware
1123 * @ver: driver version number to be sent to firmware
1124 * @len: length of driver_ver string
1125 * @driver_ver: driver string
1126 **/
1127 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 minr, u8 build,
1128 u8 ver, u16 len, char *driver_ver)
1129 {
1130 return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, minr,
1131 build, ver, len, driver_ver),
1132 IXGBE_NOT_IMPLEMENTED);
1133 }
1134
1135
1136
1137 /**
1138 * ixgbe_dmac_config - Configure DMA Coalescing registers.
1139 * @hw: pointer to hardware structure
1140 *
1141 * Configure DMA coalescing. If enabling dmac, dmac is activated.
1142 * When disabling dmac, dmac enable dmac bit is cleared.
1143 **/
1144 s32 ixgbe_dmac_config(struct ixgbe_hw *hw)
1145 {
1146 return ixgbe_call_func(hw, hw->mac.ops.dmac_config, (hw),
1147 IXGBE_NOT_IMPLEMENTED);
1148 }
1149
1150 /**
1151 * ixgbe_dmac_update_tcs - Configure DMA Coalescing registers.
1152 * @hw: pointer to hardware structure
1153 *
1154 * Disables dmac, updates per TC settings, and then enable dmac.
1155 **/
1156 s32 ixgbe_dmac_update_tcs(struct ixgbe_hw *hw)
1157 {
1158 return ixgbe_call_func(hw, hw->mac.ops.dmac_update_tcs, (hw),
1159 IXGBE_NOT_IMPLEMENTED);
1160 }
1161
1162 /**
1163 * ixgbe_dmac_config_tcs - Configure DMA Coalescing registers.
1164 * @hw: pointer to hardware structure
1165 *
1166 * Configure DMA coalescing threshold per TC and set high priority bit for
1167 * FCOE TC. The dmac enable bit must be cleared before configuring.
1168 **/
1169 s32 ixgbe_dmac_config_tcs(struct ixgbe_hw *hw)
1170 {
1171 return ixgbe_call_func(hw, hw->mac.ops.dmac_config_tcs, (hw),
1172 IXGBE_NOT_IMPLEMENTED);
1173 }
1174
1175 /**
1176 * ixgbe_setup_eee - Enable/disable EEE support
1177 * @hw: pointer to the HW structure
1178 * @enable_eee: boolean flag to enable EEE
1179 *
1180 * Enable/disable EEE based on enable_ee flag.
1181 * Auto-negotiation must be started after BASE-T EEE bits in PHY register 7.3C
1182 * are modified.
1183 *
1184 **/
1185 s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_eee)
1186 {
1187 return ixgbe_call_func(hw, hw->mac.ops.setup_eee, (hw, enable_eee),
1188 IXGBE_NOT_IMPLEMENTED);
1189 }
1190
1191 /**
1192 * ixgbe_set_source_address_pruning - Enable/Disable source address pruning
1193 * @hw: pointer to hardware structure
1194 * @enbale: enable or disable source address pruning
1195 * @pool: Rx pool - Rx pool to toggle source address pruning
1196 **/
1197 void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable,
1198 unsigned int pool)
1199 {
1200 if (hw->mac.ops.set_source_address_pruning)
1201 hw->mac.ops.set_source_address_pruning(hw, enable, pool);
1202 }
1203
1204 /**
1205 * ixgbe_set_ethertype_anti_spoofing - Enable/Disable Ethertype anti-spoofing
1206 * @hw: pointer to hardware structure
1207 * @enable: enable or disable switch for Ethertype anti-spoofing
1208 * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
1209 *
1210 **/
1211 void ixgbe_set_ethertype_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
1212 {
1213 if (hw->mac.ops.set_ethertype_anti_spoofing)
1214 hw->mac.ops.set_ethertype_anti_spoofing(hw, enable, vf);
1215 }
1216
1217 /**
1218 * ixgbe_read_iosf_sb_reg - Read 32 bit PHY register
1219 * @hw: pointer to hardware structure
1220 * @reg_addr: 32 bit address of PHY register to read
1221 * @device_type: type of device you want to communicate with
1222 * @phy_data: Pointer to read data from PHY register
1223 *
1224 * Reads a value from a specified PHY register
1225 **/
1226 s32 ixgbe_read_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1227 u32 device_type, u32 *phy_data)
1228 {
1229 return ixgbe_call_func(hw, hw->mac.ops.read_iosf_sb_reg, (hw, reg_addr,
1230 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1231 }
1232
1233 /**
1234 * ixgbe_write_iosf_sb_reg - Write 32 bit register through IOSF Sideband
1235 * @hw: pointer to hardware structure
1236 * @reg_addr: 32 bit PHY register to write
1237 * @device_type: type of device you want to communicate with
1238 * @phy_data: Data to write to the PHY register
1239 *
1240 * Writes a value to specified PHY register
1241 **/
1242 s32 ixgbe_write_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1243 u32 device_type, u32 phy_data)
1244 {
1245 return ixgbe_call_func(hw, hw->mac.ops.write_iosf_sb_reg, (hw, reg_addr,
1246 device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1247 }
1248
1249 /**
1250 * ixgbe_disable_mdd - Disable malicious driver detection
1251 * @hw: pointer to hardware structure
1252 *
1253 **/
1254 void ixgbe_disable_mdd(struct ixgbe_hw *hw)
1255 {
1256 if (hw->mac.ops.disable_mdd)
1257 hw->mac.ops.disable_mdd(hw);
1258 }
1259
1260 /**
1261 * ixgbe_enable_mdd - Enable malicious driver detection
1262 * @hw: pointer to hardware structure
1263 *
1264 **/
1265 void ixgbe_enable_mdd(struct ixgbe_hw *hw)
1266 {
1267 if (hw->mac.ops.enable_mdd)
1268 hw->mac.ops.enable_mdd(hw);
1269 }
1270
1271 /**
1272 * ixgbe_mdd_event - Handle malicious driver detection event
1273 * @hw: pointer to hardware structure
1274 * @vf_bitmap: vf bitmap of malicious vfs
1275 *
1276 **/
1277 void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap)
1278 {
1279 if (hw->mac.ops.mdd_event)
1280 hw->mac.ops.mdd_event(hw, vf_bitmap);
1281 }
1282
1283 /**
1284 * ixgbe_restore_mdd_vf - Restore VF that was disabled during malicious driver
1285 * detection event
1286 * @hw: pointer to hardware structure
1287 * @vf: vf index
1288 *
1289 **/
1290 void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
1291 {
1292 if (hw->mac.ops.restore_mdd_vf)
1293 hw->mac.ops.restore_mdd_vf(hw, vf);
1294 }
1295
1296 /**
1297 * ixgbe_enter_lplu - Transition to low power states
1298 * @hw: pointer to hardware structure
1299 *
1300 * Configures Low Power Link Up on transition to low power states
1301 * (from D0 to non-D0).
1302 **/
1303 s32 ixgbe_enter_lplu(struct ixgbe_hw *hw)
1304 {
1305 return ixgbe_call_func(hw, hw->phy.ops.enter_lplu, (hw),
1306 IXGBE_NOT_IMPLEMENTED);
1307 }
1308
1309 /**
1310 * ixgbe_handle_lasi - Handle external Base T PHY interrupt
1311 * @hw: pointer to hardware structure
1312 *
1313 * Handle external Base T PHY interrupt. If high temperature
1314 * failure alarm then return error, else if link status change
1315 * then setup internal/external PHY link
1316 *
1317 * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature
1318 * failure alarm, else return PHY access status.
1319 */
1320 s32 ixgbe_handle_lasi(struct ixgbe_hw *hw)
1321 {
1322 return ixgbe_call_func(hw, hw->phy.ops.handle_lasi, (hw),
1323 IXGBE_NOT_IMPLEMENTED);
1324 }
1325
1326 /**
1327 * ixgbe_bypass_rw - Bit bang data into by_pass FW
1328 * @hw: pointer to hardware structure
1329 * @cmd: Command we send to the FW
1330 * @status: The reply from the FW
1331 *
1332 * Bit-bangs the cmd to the by_pass FW status points to what is returned.
1333 **/
1334 s32 ixgbe_bypass_rw(struct ixgbe_hw *hw, u32 cmd, u32 *status)
1335 {
1336 return ixgbe_call_func(hw, hw->mac.ops.bypass_rw, (hw, cmd, status),
1337 IXGBE_NOT_IMPLEMENTED);
1338 }
1339
1340 /**
1341 * ixgbe_bypass_valid_rd - Verify valid return from bit-bang.
1342 *
1343 * If we send a write we can't be sure it took until we can read back
1344 * that same register. It can be a problem as some of the feilds may
1345 * for valid reasons change inbetween the time wrote the register and
1346 * we read it again to verify. So this function check everything we
1347 * can check and then assumes it worked.
1348 *
1349 * @u32 in_reg - The register cmd for the bit-bang read.
1350 * @u32 out_reg - The register returned from a bit-bang read.
1351 **/
1352 bool ixgbe_bypass_valid_rd(struct ixgbe_hw *hw, u32 in_reg, u32 out_reg)
1353 {
1354 return ixgbe_call_func(hw, hw->mac.ops.bypass_valid_rd,
1355 (in_reg, out_reg), IXGBE_NOT_IMPLEMENTED);
1356 }
1357
1358 /**
1359 * ixgbe_bypass_set - Set a bypass field in the FW CTRL Regiter.
1360 * @hw: pointer to hardware structure
1361 * @cmd: The control word we are setting.
1362 * @event: The event we are setting in the FW. This also happens to
1363 * be the mask for the event we are setting (handy)
1364 * @action: The action we set the event to in the FW. This is in a
1365 * bit field that happens to be what we want to put in
1366 * the event spot (also handy)
1367 *
1368 * Writes to the cmd control the bits in actions.
1369 **/
1370 s32 ixgbe_bypass_set(struct ixgbe_hw *hw, u32 cmd, u32 event, u32 action)
1371 {
1372 return ixgbe_call_func(hw, hw->mac.ops.bypass_set,
1373 (hw, cmd, event, action),
1374 IXGBE_NOT_IMPLEMENTED);
1375 }
1376
1377 /**
1378 * ixgbe_bypass_rd_eep - Read the bypass FW eeprom address
1379 * @hw: pointer to hardware structure
1380 * @addr: The bypass eeprom address to read.
1381 * @value: The 8b of data at the address above.
1382 **/
1383 s32 ixgbe_bypass_rd_eep(struct ixgbe_hw *hw, u32 addr, u8 *value)
1384 {
1385 return ixgbe_call_func(hw, hw->mac.ops.bypass_rd_eep,
1386 (hw, addr, value), IXGBE_NOT_IMPLEMENTED);
1387 }
1388
1389 /**
1390 * ixgbe_read_analog_reg8 - Reads 8 bit analog register
1391 * @hw: pointer to hardware structure
1392 * @reg: analog register to read
1393 * @val: read value
1394 *
1395 * Performs write operation to analog register specified.
1396 **/
1397 s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
1398 {
1399 return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
1400 val), IXGBE_NOT_IMPLEMENTED);
1401 }
1402
1403 /**
1404 * ixgbe_write_analog_reg8 - Writes 8 bit analog register
1405 * @hw: pointer to hardware structure
1406 * @reg: analog register to write
1407 * @val: value to write
1408 *
1409 * Performs write operation to Atlas analog register specified.
1410 **/
1411 s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
1412 {
1413 return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
1414 val), IXGBE_NOT_IMPLEMENTED);
1415 }
1416
1417 /**
1418 * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
1419 * @hw: pointer to hardware structure
1420 *
1421 * Initializes the Unicast Table Arrays to zero on device load. This
1422 * is part of the Rx init addr execution path.
1423 **/
1424 s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
1425 {
1426 return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
1427 IXGBE_NOT_IMPLEMENTED);
1428 }
1429
1430 /**
1431 * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
1432 * @hw: pointer to hardware structure
1433 * @byte_offset: byte offset to read
1434 * @dev_addr: I2C bus address to read from
1435 * @data: value read
1436 *
1437 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1438 **/
1439 s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1440 u8 *data)
1441 {
1442 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
1443 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1444 }
1445
1446 /**
1447 * ixgbe_read_i2c_byte_unlocked - Reads 8 bit word via I2C from device address
1448 * @hw: pointer to hardware structure
1449 * @byte_offset: byte offset to read
1450 * @dev_addr: I2C bus address to read from
1451 * @data: value read
1452 *
1453 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1454 **/
1455 s32 ixgbe_read_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
1456 u8 dev_addr, u8 *data)
1457 {
1458 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte_unlocked,
1459 (hw, byte_offset, dev_addr, data),
1460 IXGBE_NOT_IMPLEMENTED);
1461 }
1462
1463 /**
1464 * ixgbe_read_link - Perform read operation on link device
1465 * @hw: pointer to the hardware structure
1466 * @addr: bus address to read from
1467 * @reg: device register to read from
1468 * @val: pointer to location to receive read value
1469 *
1470 * Returns an error code on error.
1471 */
1472 s32 ixgbe_read_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
1473 {
1474 return ixgbe_call_func(hw, hw->link.ops.read_link, (hw, addr,
1475 reg, val), IXGBE_NOT_IMPLEMENTED);
1476 }
1477
1478 /**
1479 * ixgbe_read_link_unlocked - Perform read operation on link device
1480 * @hw: pointer to the hardware structure
1481 * @addr: bus address to read from
1482 * @reg: device register to read from
1483 * @val: pointer to location to receive read value
1484 *
1485 * Returns an error code on error.
1486 **/
1487 s32 ixgbe_read_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
1488 {
1489 return ixgbe_call_func(hw, hw->link.ops.read_link_unlocked,
1490 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1491 }
1492
1493 /**
1494 * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
1495 * @hw: pointer to hardware structure
1496 * @byte_offset: byte offset to write
1497 * @dev_addr: I2C bus address to write to
1498 * @data: value to write
1499 *
1500 * Performs byte write operation to SFP module's EEPROM over I2C interface
1501 * at a specified device address.
1502 **/
1503 s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
1504 u8 data)
1505 {
1506 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
1507 dev_addr, data), IXGBE_NOT_IMPLEMENTED);
1508 }
1509
1510 /**
1511 * ixgbe_write_i2c_byte_unlocked - Writes 8 bit word over I2C
1512 * @hw: pointer to hardware structure
1513 * @byte_offset: byte offset to write
1514 * @dev_addr: I2C bus address to write to
1515 * @data: value to write
1516 *
1517 * Performs byte write operation to SFP module's EEPROM over I2C interface
1518 * at a specified device address.
1519 **/
1520 s32 ixgbe_write_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
1521 u8 dev_addr, u8 data)
1522 {
1523 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte_unlocked,
1524 (hw, byte_offset, dev_addr, data),
1525 IXGBE_NOT_IMPLEMENTED);
1526 }
1527
1528 /**
1529 * ixgbe_write_link - Perform write operation on link device
1530 * @hw: pointer to the hardware structure
1531 * @addr: bus address to write to
1532 * @reg: device register to write to
1533 * @val: value to write
1534 *
1535 * Returns an error code on error.
1536 */
1537 s32 ixgbe_write_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
1538 {
1539 return ixgbe_call_func(hw, hw->link.ops.write_link,
1540 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1541 }
1542
1543 /**
1544 * ixgbe_write_link_unlocked - Perform write operation on link device
1545 * @hw: pointer to the hardware structure
1546 * @addr: bus address to write to
1547 * @reg: device register to write to
1548 * @val: value to write
1549 *
1550 * Returns an error code on error.
1551 **/
1552 s32 ixgbe_write_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
1553 {
1554 return ixgbe_call_func(hw, hw->link.ops.write_link_unlocked,
1555 (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1556 }
1557
1558 /**
1559 * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
1560 * @hw: pointer to hardware structure
1561 * @byte_offset: EEPROM byte offset to write
1562 * @eeprom_data: value to write
1563 *
1564 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1565 **/
1566 s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
1567 u8 byte_offset, u8 eeprom_data)
1568 {
1569 return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
1570 (hw, byte_offset, eeprom_data),
1571 IXGBE_NOT_IMPLEMENTED);
1572 }
1573
1574 /**
1575 * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
1576 * @hw: pointer to hardware structure
1577 * @byte_offset: EEPROM byte offset to read
1578 * @eeprom_data: value read
1579 *
1580 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1581 **/
1582 s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
1583 {
1584 return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
1585 (hw, byte_offset, eeprom_data),
1586 IXGBE_NOT_IMPLEMENTED);
1587 }
1588
1589 /**
1590 * ixgbe_get_supported_physical_layer - Returns physical layer type
1591 * @hw: pointer to hardware structure
1592 *
1593 * Determines physical layer capabilities of the current configuration.
1594 **/
1595 u64 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
1596 {
1597 return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
1598 (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
1599 }
1600
1601 /**
1602 * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
1603 * @hw: pointer to hardware structure
1604 * @regval: bitfield to write to the Rx DMA register
1605 *
1606 * Enables the Rx DMA unit of the device.
1607 **/
1608 s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
1609 {
1610 return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
1611 (hw, regval), IXGBE_NOT_IMPLEMENTED);
1612 }
1613
1614 /**
1615 * ixgbe_disable_sec_rx_path - Stops the receive data path
1616 * @hw: pointer to hardware structure
1617 *
1618 * Stops the receive data path.
1619 **/
1620 s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
1621 {
1622 return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
1623 (hw), IXGBE_NOT_IMPLEMENTED);
1624 }
1625
1626 /**
1627 * ixgbe_enable_sec_rx_path - Enables the receive data path
1628 * @hw: pointer to hardware structure
1629 *
1630 * Enables the receive data path.
1631 **/
1632 s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
1633 {
1634 return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
1635 (hw), IXGBE_NOT_IMPLEMENTED);
1636 }
1637
1638 /**
1639 * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1640 * @hw: pointer to hardware structure
1641 * @mask: Mask to specify which semaphore to acquire
1642 *
1643 * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1644 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1645 **/
1646 s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1647 {
1648 return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1649 (hw, mask), IXGBE_NOT_IMPLEMENTED);
1650 }
1651
1652 /**
1653 * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1654 * @hw: pointer to hardware structure
1655 * @mask: Mask to specify which semaphore to release
1656 *
1657 * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1658 * function (CSR, PHY0, PHY1, EEPROM, Flash)
1659 **/
1660 void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1661 {
1662 if (hw->mac.ops.release_swfw_sync)
1663 hw->mac.ops.release_swfw_sync(hw, mask);
1664 }
1665
1666 /**
1667 * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore
1668 * @hw: pointer to hardware structure
1669 *
1670 * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register.
1671 * Regardless of whether is succeeds or not it then release the semaphore.
1672 * This is function is called to recover from catastrophic failures that
1673 * may have left the semaphore locked.
1674 **/
1675 void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
1676 {
1677 if (hw->mac.ops.init_swfw_sync)
1678 hw->mac.ops.init_swfw_sync(hw);
1679 }
1680
1681
1682 void ixgbe_disable_rx(struct ixgbe_hw *hw)
1683 {
1684 if (hw->mac.ops.disable_rx)
1685 hw->mac.ops.disable_rx(hw);
1686 }
1687
1688 void ixgbe_enable_rx(struct ixgbe_hw *hw)
1689 {
1690 if (hw->mac.ops.enable_rx)
1691 hw->mac.ops.enable_rx(hw);
1692 }
1693
1694 /**
1695 * ixgbe_set_rate_select_speed - Set module link speed
1696 * @hw: pointer to hardware structure
1697 * @speed: link speed to set
1698 *
1699 * Set module link speed via the rate select.
1700 */
1701 void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
1702 {
1703 if (hw->mac.ops.set_rate_select_speed)
1704 hw->mac.ops.set_rate_select_speed(hw, speed);
1705 }
1706