Deleted Added
full compact
e1000_api.c (169248) e1000_api.c (169589)
1/*******************************************************************************
2
3 Copyright (c) 2001-2007, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32*******************************************************************************/
1/*******************************************************************************
2
3 Copyright (c) 2001-2007, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32*******************************************************************************/
33/*$FreeBSD: head/sys/dev/em/e1000_api.c 169589 2007-05-16 00:14:23Z jfv $*/
33
34
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_api.c 169248 2007-05-04 13:30:44Z rwatson $");
36
35
37
36#include "e1000_api.h"
38#include "e1000_mac.h"
39#include "e1000_nvm.h"
40#include "e1000_phy.h"
41
42#ifndef NO_82542_SUPPORT
43extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
44#endif
45extern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
46extern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
47extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
48extern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
49extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
50extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
51extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
52
53/**
54 * e1000_init_mac_params - Initialize MAC function pointers
37#include "e1000_mac.h"
38#include "e1000_nvm.h"
39#include "e1000_phy.h"
40
41#ifndef NO_82542_SUPPORT
42extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
43#endif
44extern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
45extern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
46extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
47extern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
48extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
49extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
50extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
51
52/**
53 * e1000_init_mac_params - Initialize MAC function pointers
55 * @hw - pointer to the HW structure
54 * @hw: pointer to the HW structure
56 *
57 * This function initializes the function pointers for the MAC
58 * set of functions. Called by drivers or by e1000_setup_init_funcs.
59 **/
60s32
61e1000_init_mac_params(struct e1000_hw *hw)
62{
63 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

74 }
75
76out:
77 return ret_val;
78}
79
80/**
81 * e1000_init_nvm_params - Initialize NVM function pointers
55 *
56 * This function initializes the function pointers for the MAC
57 * set of functions. Called by drivers or by e1000_setup_init_funcs.
58 **/
59s32
60e1000_init_mac_params(struct e1000_hw *hw)
61{
62 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

73 }
74
75out:
76 return ret_val;
77}
78
79/**
80 * e1000_init_nvm_params - Initialize NVM function pointers
82 * @hw - pointer to the HW structure
81 * @hw: pointer to the HW structure
83 *
84 * This function initializes the function pointers for the NVM
85 * set of functions. Called by drivers or by e1000_setup_init_funcs.
86 **/
87s32
88e1000_init_nvm_params(struct e1000_hw *hw)
89{
90 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

101 }
102
103out:
104 return ret_val;
105}
106
107/**
108 * e1000_init_phy_params - Initialize PHY function pointers
82 *
83 * This function initializes the function pointers for the NVM
84 * set of functions. Called by drivers or by e1000_setup_init_funcs.
85 **/
86s32
87e1000_init_nvm_params(struct e1000_hw *hw)
88{
89 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

100 }
101
102out:
103 return ret_val;
104}
105
106/**
107 * e1000_init_phy_params - Initialize PHY function pointers
109 * @hw - pointer to the HW structure
108 * @hw: pointer to the HW structure
110 *
111 * This function initializes the function pointers for the PHY
112 * set of functions. Called by drivers or by e1000_setup_init_funcs.
113 **/
114s32
115e1000_init_phy_params(struct e1000_hw *hw)
116{
117 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

128 }
129
130out:
131 return ret_val;
132}
133
134/**
135 * e1000_set_mac_type - Sets MAC type
109 *
110 * This function initializes the function pointers for the PHY
111 * set of functions. Called by drivers or by e1000_setup_init_funcs.
112 **/
113s32
114e1000_init_phy_params(struct e1000_hw *hw)
115{
116 s32 ret_val = E1000_SUCCESS;

--- 10 unchanged lines hidden (view full) ---

127 }
128
129out:
130 return ret_val;
131}
132
133/**
134 * e1000_set_mac_type - Sets MAC type
136 * @hw - pointer to the HW structure
135 * @hw: pointer to the HW structure
137 *
138 * This function sets the mac type of the adapter based on the
139 * device ID stored in the hw structure.
140 * MUST BE FIRST FUNCTION CALLED (explicitly or through
141 * e1000_setup_init_funcs()).
142 **/
143s32
144e1000_set_mac_type(struct e1000_hw *hw)

--- 64 unchanged lines hidden (view full) ---

209 mac->type = e1000_82547;
210 break;
211 case E1000_DEV_ID_82547GI:
212 mac->type = e1000_82547_rev_2;
213 break;
214 case E1000_DEV_ID_82571EB_COPPER:
215 case E1000_DEV_ID_82571EB_FIBER:
216 case E1000_DEV_ID_82571EB_SERDES:
136 *
137 * This function sets the mac type of the adapter based on the
138 * device ID stored in the hw structure.
139 * MUST BE FIRST FUNCTION CALLED (explicitly or through
140 * e1000_setup_init_funcs()).
141 **/
142s32
143e1000_set_mac_type(struct e1000_hw *hw)

--- 64 unchanged lines hidden (view full) ---

208 mac->type = e1000_82547;
209 break;
210 case E1000_DEV_ID_82547GI:
211 mac->type = e1000_82547_rev_2;
212 break;
213 case E1000_DEV_ID_82571EB_COPPER:
214 case E1000_DEV_ID_82571EB_FIBER:
215 case E1000_DEV_ID_82571EB_SERDES:
216 case E1000_DEV_ID_82571EB_SERDES_DUAL:
217 case E1000_DEV_ID_82571EB_SERDES_QUAD:
217 case E1000_DEV_ID_82571EB_QUAD_COPPER:
218 case E1000_DEV_ID_82571EB_QUAD_FIBER:
219 case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
220 mac->type = e1000_82571;
221 break;
222 case E1000_DEV_ID_82572EI:
223 case E1000_DEV_ID_82572EI_COPPER:
224 case E1000_DEV_ID_82572EI_FIBER:

--- 40 unchanged lines hidden (view full) ---

265 break;
266 }
267
268 return ret_val;
269}
270
271/**
272 * e1000_setup_init_funcs - Initializes function pointers
218 case E1000_DEV_ID_82571EB_QUAD_COPPER:
219 case E1000_DEV_ID_82571EB_QUAD_FIBER:
220 case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
221 mac->type = e1000_82571;
222 break;
223 case E1000_DEV_ID_82572EI:
224 case E1000_DEV_ID_82572EI_COPPER:
225 case E1000_DEV_ID_82572EI_FIBER:

--- 40 unchanged lines hidden (view full) ---

266 break;
267 }
268
269 return ret_val;
270}
271
272/**
273 * e1000_setup_init_funcs - Initializes function pointers
273 * @hw - pointer to the HW structure
274 * @init_device - TRUE will initialize the rest of the function pointers
274 * @hw: pointer to the HW structure
275 * @init_device: TRUE will initialize the rest of the function pointers
275 * getting the device ready for use. FALSE will only set
276 * MAC type and the function pointers for the other init
277 * functions. Passing FALSE will not generate any hardware
278 * reads or writes.
279 *
280 * This function must be called by a driver in order to use the rest
281 * of the 'shared' code files. Called by drivers only.
282 **/

--- 96 unchanged lines hidden (view full) ---

379 }
380
381out:
382 return ret_val;
383}
384
385/**
386 * e1000_remove_device - Free device specific structure
276 * getting the device ready for use. FALSE will only set
277 * MAC type and the function pointers for the other init
278 * functions. Passing FALSE will not generate any hardware
279 * reads or writes.
280 *
281 * This function must be called by a driver in order to use the rest
282 * of the 'shared' code files. Called by drivers only.
283 **/

--- 96 unchanged lines hidden (view full) ---

380 }
381
382out:
383 return ret_val;
384}
385
386/**
387 * e1000_remove_device - Free device specific structure
387 * @hw - pointer to the HW structure
388 * @hw: pointer to the HW structure
388 *
389 * If a device specific structure was allocated, this function will
390 * free it. This is a function pointer entry point called by drivers.
391 **/
392void
393e1000_remove_device(struct e1000_hw *hw)
394{
395 if (hw->func.remove_device != NULL)
396 hw->func.remove_device(hw);
397}
398
399/**
400 * e1000_get_bus_info - Obtain bus information for adapter
389 *
390 * If a device specific structure was allocated, this function will
391 * free it. This is a function pointer entry point called by drivers.
392 **/
393void
394e1000_remove_device(struct e1000_hw *hw)
395{
396 if (hw->func.remove_device != NULL)
397 hw->func.remove_device(hw);
398}
399
400/**
401 * e1000_get_bus_info - Obtain bus information for adapter
401 * @hw - pointer to the HW structure
402 * @hw: pointer to the HW structure
402 *
403 * This will obtain information about the HW bus for which the
404 * adaper is attached and stores it in the hw structure. This is a
405 * function pointer entry point called by drivers.
406 **/
407s32
408e1000_get_bus_info(struct e1000_hw *hw)
409{
410 if (hw->func.get_bus_info != NULL)
411 return hw->func.get_bus_info(hw);
412 else
413 return E1000_SUCCESS;
414}
415
416/**
417 * e1000_clear_vfta - Clear VLAN filter table
403 *
404 * This will obtain information about the HW bus for which the
405 * adaper is attached and stores it in the hw structure. This is a
406 * function pointer entry point called by drivers.
407 **/
408s32
409e1000_get_bus_info(struct e1000_hw *hw)
410{
411 if (hw->func.get_bus_info != NULL)
412 return hw->func.get_bus_info(hw);
413 else
414 return E1000_SUCCESS;
415}
416
417/**
418 * e1000_clear_vfta - Clear VLAN filter table
418 * @hw - pointer to the HW structure
419 * @hw: pointer to the HW structure
419 *
420 * This clears the VLAN filter table on the adapter. This is a function
421 * pointer entry point called by drivers.
422 **/
423void
424e1000_clear_vfta(struct e1000_hw *hw)
425{
426 if (hw->func.clear_vfta != NULL)
427 hw->func.clear_vfta (hw);
428}
429
430/**
431 * e1000_write_vfta - Write value to VLAN filter table
420 *
421 * This clears the VLAN filter table on the adapter. This is a function
422 * pointer entry point called by drivers.
423 **/
424void
425e1000_clear_vfta(struct e1000_hw *hw)
426{
427 if (hw->func.clear_vfta != NULL)
428 hw->func.clear_vfta (hw);
429}
430
431/**
432 * e1000_write_vfta - Write value to VLAN filter table
432 * @hw - pointer to the HW structure
433 * @offset - the 32-bit offset in which to write the value to.
434 * @value - the 32-bit value to write at location offset.
433 * @hw: pointer to the HW structure
434 * @offset: the 32-bit offset in which to write the value to.
435 * @value: the 32-bit value to write at location offset.
435 *
436 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
437 * table. This is a function pointer entry point called by drivers.
438 **/
439void
440e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
441{
442 if (hw->func.write_vfta != NULL)
443 hw->func.write_vfta(hw, offset, value);
444}
445
446/**
447 * e1000_mc_addr_list_update - Update Multicast addresses
436 *
437 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
438 * table. This is a function pointer entry point called by drivers.
439 **/
440void
441e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
442{
443 if (hw->func.write_vfta != NULL)
444 hw->func.write_vfta(hw, offset, value);
445}
446
447/**
448 * e1000_mc_addr_list_update - Update Multicast addresses
448 * @hw - pointer to the HW structure
449 * @mc_addr_list - array of multicast addresses to program
450 * @mc_addr_count - number of multicast addresses to program
451 * @rar_used_count - the first RAR register free to program
452 * @rar_count - total number of supported Receive Address Registers
449 * @hw: pointer to the HW structure
450 * @mc_addr_list: array of multicast addresses to program
451 * @mc_addr_count: number of multicast addresses to program
452 * @rar_used_count: the first RAR register free to program
453 * @rar_count: total number of supported Receive Address Registers
453 *
454 * Updates the Receive Address Registers and Multicast Table Array.
455 * The caller must have a packed mc_addr_list of multicast addresses.
456 * The parameter rar_count will usually be hw->mac.rar_entry_count
457 * unless there are workarounds that change this. Currently no func pointer
458 * exists and all implementations are handled in the generic version of this
459 * function.
460 **/

--- 9 unchanged lines hidden (view full) ---

470 mc_addr_list,
471 mc_addr_count,
472 rar_used_count,
473 rar_count);
474}
475
476/**
477 * e1000_force_mac_fc - Force MAC flow control
454 *
455 * Updates the Receive Address Registers and Multicast Table Array.
456 * The caller must have a packed mc_addr_list of multicast addresses.
457 * The parameter rar_count will usually be hw->mac.rar_entry_count
458 * unless there are workarounds that change this. Currently no func pointer
459 * exists and all implementations are handled in the generic version of this
460 * function.
461 **/

--- 9 unchanged lines hidden (view full) ---

471 mc_addr_list,
472 mc_addr_count,
473 rar_used_count,
474 rar_count);
475}
476
477/**
478 * e1000_force_mac_fc - Force MAC flow control
478 * @hw - pointer to the HW structure
479 * @hw: pointer to the HW structure
479 *
480 * Force the MAC's flow control settings. Currently no func pointer exists
481 * and all implementations are handled in the generic version of this
482 * function.
483 **/
484s32
485e1000_force_mac_fc(struct e1000_hw *hw)
486{
487 return e1000_force_mac_fc_generic(hw);
488}
489
490/**
491 * e1000_check_for_link - Check/Store link connection
480 *
481 * Force the MAC's flow control settings. Currently no func pointer exists
482 * and all implementations are handled in the generic version of this
483 * function.
484 **/
485s32
486e1000_force_mac_fc(struct e1000_hw *hw)
487{
488 return e1000_force_mac_fc_generic(hw);
489}
490
491/**
492 * e1000_check_for_link - Check/Store link connection
492 * @hw - pointer to the HW structure
493 * @hw: pointer to the HW structure
493 *
494 * This checks the link condition of the adapter and stores the
495 * results in the hw->mac structure. This is a function pointer entry
496 * point called by drivers.
497 **/
498s32
499e1000_check_for_link(struct e1000_hw *hw)
500{
501 if (hw->func.check_for_link != NULL)
502 return hw->func.check_for_link(hw);
503 else
504 return -E1000_ERR_CONFIG;
505}
506
507/**
508 * e1000_check_mng_mode - Check management mode
494 *
495 * This checks the link condition of the adapter and stores the
496 * results in the hw->mac structure. This is a function pointer entry
497 * point called by drivers.
498 **/
499s32
500e1000_check_for_link(struct e1000_hw *hw)
501{
502 if (hw->func.check_for_link != NULL)
503 return hw->func.check_for_link(hw);
504 else
505 return -E1000_ERR_CONFIG;
506}
507
508/**
509 * e1000_check_mng_mode - Check management mode
509 * @hw - pointer to the HW structure
510 * @hw: pointer to the HW structure
510 *
511 * This checks if the adapter has manageability enabled.
512 * This is a function pointer entry point called by drivers.
513 **/
514boolean_t
515e1000_check_mng_mode(struct e1000_hw *hw)
516{
517 if (hw->func.check_mng_mode != NULL)
518 return hw->func.check_mng_mode(hw);
519 else
520 return FALSE;
521}
522
523/**
524 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
511 *
512 * This checks if the adapter has manageability enabled.
513 * This is a function pointer entry point called by drivers.
514 **/
515boolean_t
516e1000_check_mng_mode(struct e1000_hw *hw)
517{
518 if (hw->func.check_mng_mode != NULL)
519 return hw->func.check_mng_mode(hw);
520 else
521 return FALSE;
522}
523
524/**
525 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
525 * @hw - pointer to the HW structure
526 * @buffer - pointer to the host interface
527 * @length - size of the buffer
526 * @hw: pointer to the HW structure
527 * @buffer: pointer to the host interface
528 * @length: size of the buffer
528 *
529 * Writes the DHCP information to the host interface.
530 **/
531s32
532e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
533{
534 return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
535}
536
537/**
538 * e1000_reset_hw - Reset hardware
529 *
530 * Writes the DHCP information to the host interface.
531 **/
532s32
533e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
534{
535 return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
536}
537
538/**
539 * e1000_reset_hw - Reset hardware
539 * @hw - pointer to the HW structure
540 * @hw: pointer to the HW structure
540 *
541 * This resets the hardware into a known state. This is a function pointer
542 * entry point called by drivers.
543 **/
544s32
545e1000_reset_hw(struct e1000_hw *hw)
546{
547 if (hw->func.reset_hw != NULL)
548 return hw->func.reset_hw(hw);
549 else
550 return -E1000_ERR_CONFIG;
551}
552
553/**
554 * e1000_init_hw - Initialize hardware
541 *
542 * This resets the hardware into a known state. This is a function pointer
543 * entry point called by drivers.
544 **/
545s32
546e1000_reset_hw(struct e1000_hw *hw)
547{
548 if (hw->func.reset_hw != NULL)
549 return hw->func.reset_hw(hw);
550 else
551 return -E1000_ERR_CONFIG;
552}
553
554/**
555 * e1000_init_hw - Initialize hardware
555 * @hw - pointer to the HW structure
556 * @hw: pointer to the HW structure
556 *
557 * This inits the hardware readying it for operation. This is a function
558 * pointer entry point called by drivers.
559 **/
560s32
561e1000_init_hw(struct e1000_hw *hw)
562{
563 if (hw->func.init_hw != NULL)
564 return hw->func.init_hw(hw);
565 else
566 return -E1000_ERR_CONFIG;
567}
568
569/**
570 * e1000_setup_link - Configures link and flow control
557 *
558 * This inits the hardware readying it for operation. This is a function
559 * pointer entry point called by drivers.
560 **/
561s32
562e1000_init_hw(struct e1000_hw *hw)
563{
564 if (hw->func.init_hw != NULL)
565 return hw->func.init_hw(hw);
566 else
567 return -E1000_ERR_CONFIG;
568}
569
570/**
571 * e1000_setup_link - Configures link and flow control
571 * @hw - pointer to the HW structure
572 * @hw: pointer to the HW structure
572 *
573 * This configures link and flow control settings for the adapter. This
574 * is a function pointer entry point called by drivers. While modules can
575 * also call this, they probably call their own version of this function.
576 **/
577s32
578e1000_setup_link(struct e1000_hw *hw)
579{
580 if (hw->func.setup_link != NULL)
581 return hw->func.setup_link(hw);
582 else
583 return -E1000_ERR_CONFIG;
584}
585
586/**
587 * e1000_get_speed_and_duplex - Returns current speed and duplex
573 *
574 * This configures link and flow control settings for the adapter. This
575 * is a function pointer entry point called by drivers. While modules can
576 * also call this, they probably call their own version of this function.
577 **/
578s32
579e1000_setup_link(struct e1000_hw *hw)
580{
581 if (hw->func.setup_link != NULL)
582 return hw->func.setup_link(hw);
583 else
584 return -E1000_ERR_CONFIG;
585}
586
587/**
588 * e1000_get_speed_and_duplex - Returns current speed and duplex
588 * @hw - pointer to the HW structure
589 * @speed - pointer to a 16-bit value to store the speed
590 * @duplex - pointer to a 16-bit value to store the duplex.
589 * @hw: pointer to the HW structure
590 * @speed: pointer to a 16-bit value to store the speed
591 * @duplex: pointer to a 16-bit value to store the duplex.
591 *
592 * This returns the speed and duplex of the adapter in the two 'out'
593 * variables passed in. This is a function pointer entry point called
594 * by drivers.
595 **/
596s32
597e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
598{
599 if (hw->func.get_link_up_info != NULL)
600 return hw->func.get_link_up_info(hw, speed, duplex);
601 else
602 return -E1000_ERR_CONFIG;
603}
604
605/**
606 * e1000_setup_led - Configures SW controllable LED
592 *
593 * This returns the speed and duplex of the adapter in the two 'out'
594 * variables passed in. This is a function pointer entry point called
595 * by drivers.
596 **/
597s32
598e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
599{
600 if (hw->func.get_link_up_info != NULL)
601 return hw->func.get_link_up_info(hw, speed, duplex);
602 else
603 return -E1000_ERR_CONFIG;
604}
605
606/**
607 * e1000_setup_led - Configures SW controllable LED
607 * @hw - pointer to the HW structure
608 * @hw: pointer to the HW structure
608 *
609 * This prepares the SW controllable LED for use and saves the current state
610 * of the LED so it can be later restored. This is a function pointer entry
611 * point called by drivers.
612 **/
613s32
614e1000_setup_led(struct e1000_hw *hw)
615{
616 if (hw->func.setup_led != NULL)
617 return hw->func.setup_led(hw);
618 else
619 return E1000_SUCCESS;
620}
621
622/**
623 * e1000_cleanup_led - Restores SW controllable LED
609 *
610 * This prepares the SW controllable LED for use and saves the current state
611 * of the LED so it can be later restored. This is a function pointer entry
612 * point called by drivers.
613 **/
614s32
615e1000_setup_led(struct e1000_hw *hw)
616{
617 if (hw->func.setup_led != NULL)
618 return hw->func.setup_led(hw);
619 else
620 return E1000_SUCCESS;
621}
622
623/**
624 * e1000_cleanup_led - Restores SW controllable LED
624 * @hw - pointer to the HW structure
625 * @hw: pointer to the HW structure
625 *
626 * This restores the SW controllable LED to the value saved off by
627 * e1000_setup_led. This is a function pointer entry point called by drivers.
628 **/
629s32
630e1000_cleanup_led(struct e1000_hw *hw)
631{
632 if (hw->func.cleanup_led != NULL)
633 return hw->func.cleanup_led(hw);
634 else
635 return E1000_SUCCESS;
636}
637
638/**
639 * e1000_blink_led - Blink SW controllable LED
626 *
627 * This restores the SW controllable LED to the value saved off by
628 * e1000_setup_led. This is a function pointer entry point called by drivers.
629 **/
630s32
631e1000_cleanup_led(struct e1000_hw *hw)
632{
633 if (hw->func.cleanup_led != NULL)
634 return hw->func.cleanup_led(hw);
635 else
636 return E1000_SUCCESS;
637}
638
639/**
640 * e1000_blink_led - Blink SW controllable LED
640 * @hw - pointer to the HW structure
641 * @hw: pointer to the HW structure
641 *
642 * This starts the adapter LED blinking. Request the LED to be setup first
643 * and cleaned up after. This is a function pointer entry point called by
644 * drivers.
645 **/
646s32
647e1000_blink_led(struct e1000_hw *hw)
648{
649 if (hw->func.blink_led != NULL)
650 return hw->func.blink_led(hw);
651 else
652 return E1000_SUCCESS;
653}
654
655/**
656 * e1000_led_on - Turn on SW controllable LED
642 *
643 * This starts the adapter LED blinking. Request the LED to be setup first
644 * and cleaned up after. This is a function pointer entry point called by
645 * drivers.
646 **/
647s32
648e1000_blink_led(struct e1000_hw *hw)
649{
650 if (hw->func.blink_led != NULL)
651 return hw->func.blink_led(hw);
652 else
653 return E1000_SUCCESS;
654}
655
656/**
657 * e1000_led_on - Turn on SW controllable LED
657 * @hw - pointer to the HW structure
658 * @hw: pointer to the HW structure
658 *
659 * Turns the SW defined LED on. This is a function pointer entry point
660 * called by drivers.
661 **/
662s32
663e1000_led_on(struct e1000_hw *hw)
664{
665 if (hw->func.led_on != NULL)
666 return hw->func.led_on(hw);
667 else
668 return E1000_SUCCESS;
669}
670
671/**
672 * e1000_led_off - Turn off SW controllable LED
659 *
660 * Turns the SW defined LED on. This is a function pointer entry point
661 * called by drivers.
662 **/
663s32
664e1000_led_on(struct e1000_hw *hw)
665{
666 if (hw->func.led_on != NULL)
667 return hw->func.led_on(hw);
668 else
669 return E1000_SUCCESS;
670}
671
672/**
673 * e1000_led_off - Turn off SW controllable LED
673 * @hw - pointer to the HW structure
674 * @hw: pointer to the HW structure
674 *
675 * Turns the SW defined LED off. This is a function pointer entry point
676 * called by drivers.
677 **/
678s32
679e1000_led_off(struct e1000_hw *hw)
680{
681 if (hw->func.led_off != NULL)
682 return hw->func.led_off(hw);
683 else
684 return E1000_SUCCESS;
685}
686
687/**
688 * e1000_reset_adaptive - Reset adaptive IFS
675 *
676 * Turns the SW defined LED off. This is a function pointer entry point
677 * called by drivers.
678 **/
679s32
680e1000_led_off(struct e1000_hw *hw)
681{
682 if (hw->func.led_off != NULL)
683 return hw->func.led_off(hw);
684 else
685 return E1000_SUCCESS;
686}
687
688/**
689 * e1000_reset_adaptive - Reset adaptive IFS
689 * @hw - pointer to the HW structure
690 * @hw: pointer to the HW structure
690 *
691 * Resets the adaptive IFS. Currently no func pointer exists and all
692 * implementations are handled in the generic version of this function.
693 **/
694void
695e1000_reset_adaptive(struct e1000_hw *hw)
696{
697 e1000_reset_adaptive_generic(hw);
698}
699
700/**
701 * e1000_update_adaptive - Update adaptive IFS
691 *
692 * Resets the adaptive IFS. Currently no func pointer exists and all
693 * implementations are handled in the generic version of this function.
694 **/
695void
696e1000_reset_adaptive(struct e1000_hw *hw)
697{
698 e1000_reset_adaptive_generic(hw);
699}
700
701/**
702 * e1000_update_adaptive - Update adaptive IFS
702 * @hw - pointer to the HW structure
703 * @hw: pointer to the HW structure
703 *
704 * Updates adapter IFS. Currently no func pointer exists and all
705 * implementations are handled in the generic version of this function.
706 **/
707void
708e1000_update_adaptive(struct e1000_hw *hw)
709{
710 e1000_update_adaptive_generic(hw);
711}
712
713/**
714 * e1000_disable_pcie_master - Disable PCI-Express master access
704 *
705 * Updates adapter IFS. Currently no func pointer exists and all
706 * implementations are handled in the generic version of this function.
707 **/
708void
709e1000_update_adaptive(struct e1000_hw *hw)
710{
711 e1000_update_adaptive_generic(hw);
712}
713
714/**
715 * e1000_disable_pcie_master - Disable PCI-Express master access
715 * @hw - pointer to the HW structure
716 * @hw: pointer to the HW structure
716 *
717 * Disables PCI-Express master access and verifies there are no pending
718 * requests. Currently no func pointer exists and all implementations are
719 * handled in the generic version of this function.
720 **/
721s32
722e1000_disable_pcie_master(struct e1000_hw *hw)
723{
724 return e1000_disable_pcie_master_generic(hw);
725}
726
727/**
728 * e1000_config_collision_dist - Configure collision distance
717 *
718 * Disables PCI-Express master access and verifies there are no pending
719 * requests. Currently no func pointer exists and all implementations are
720 * handled in the generic version of this function.
721 **/
722s32
723e1000_disable_pcie_master(struct e1000_hw *hw)
724{
725 return e1000_disable_pcie_master_generic(hw);
726}
727
728/**
729 * e1000_config_collision_dist - Configure collision distance
729 * @hw - pointer to the HW structure
730 * @hw: pointer to the HW structure
730 *
731 * Configures the collision distance to the default value and is used
732 * during link setup.
733 **/
734void
735e1000_config_collision_dist(struct e1000_hw *hw)
736{
737 if (hw->func.config_collision_dist != NULL)
738 hw->func.config_collision_dist(hw);
739}
740
741/**
742 * e1000_rar_set - Sets a receive address register
731 *
732 * Configures the collision distance to the default value and is used
733 * during link setup.
734 **/
735void
736e1000_config_collision_dist(struct e1000_hw *hw)
737{
738 if (hw->func.config_collision_dist != NULL)
739 hw->func.config_collision_dist(hw);
740}
741
742/**
743 * e1000_rar_set - Sets a receive address register
743 * @hw - pointer to the HW structure
744 * @addr - address to set the RAR to
745 * @index - the RAR to set
744 * @hw: pointer to the HW structure
745 * @addr: address to set the RAR to
746 * @index: the RAR to set
746 *
747 * Sets a Receive Address Register (RAR) to the specified address.
748 **/
749void
750e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
751{
752 if (hw->func.rar_set != NULL)
753 hw->func.rar_set(hw, addr, index);
754}
755
756/**
757 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
747 *
748 * Sets a Receive Address Register (RAR) to the specified address.
749 **/
750void
751e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
752{
753 if (hw->func.rar_set != NULL)
754 hw->func.rar_set(hw, addr, index);
755}
756
757/**
758 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
758 * @hw - pointer to the HW structure
759 * @hw: pointer to the HW structure
759 *
760 * Ensures that the MDI/MDIX SW state is valid.
761 **/
762s32
763e1000_validate_mdi_setting(struct e1000_hw *hw)
764{
765 if (hw->func.validate_mdi_setting != NULL)
766 return hw->func.validate_mdi_setting(hw);
767 else
768 return E1000_SUCCESS;
769}
770
771/**
772 * e1000_mta_set - Sets multicast table bit
760 *
761 * Ensures that the MDI/MDIX SW state is valid.
762 **/
763s32
764e1000_validate_mdi_setting(struct e1000_hw *hw)
765{
766 if (hw->func.validate_mdi_setting != NULL)
767 return hw->func.validate_mdi_setting(hw);
768 else
769 return E1000_SUCCESS;
770}
771
772/**
773 * e1000_mta_set - Sets multicast table bit
773 * @hw - pointer to the HW structure
774 * @hash_value - Multicast hash value.
774 * @hw: pointer to the HW structure
775 * @hash_value: Multicast hash value.
775 *
776 * This sets the bit in the multicast table corresponding to the
777 * hash value. This is a function pointer entry point called by drivers.
778 **/
779void
780e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
781{
782 if (hw->func.mta_set != NULL)
783 hw->func.mta_set(hw, hash_value);
784}
785
786/**
787 * e1000_hash_mc_addr - Determines address location in multicast table
776 *
777 * This sets the bit in the multicast table corresponding to the
778 * hash value. This is a function pointer entry point called by drivers.
779 **/
780void
781e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
782{
783 if (hw->func.mta_set != NULL)
784 hw->func.mta_set(hw, hash_value);
785}
786
787/**
788 * e1000_hash_mc_addr - Determines address location in multicast table
788 * @hw - pointer to the HW structure
789 * @mc_addr - Multicast address to hash.
789 * @hw: pointer to the HW structure
790 * @mc_addr: Multicast address to hash.
790 *
791 * This hashes an address to determine its location in the multicast
792 * table. Currently no func pointer exists and all implementations
793 * are handled in the generic version of this function.
794 **/
795u32
796e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
797{
798 return e1000_hash_mc_addr_generic(hw, mc_addr);
799}
800
801/**
802 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
791 *
792 * This hashes an address to determine its location in the multicast
793 * table. Currently no func pointer exists and all implementations
794 * are handled in the generic version of this function.
795 **/
796u32
797e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
798{
799 return e1000_hash_mc_addr_generic(hw, mc_addr);
800}
801
802/**
803 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
803 * @hw - pointer to the HW structure
804 * @hw: pointer to the HW structure
804 *
805 * Enables packet filtering on transmit packets if manageability is enabled
806 * and host interface is enabled.
807 * Currently no func pointer exists and all implementations are handled in the
808 * generic version of this function.
809 **/
810boolean_t
811e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
812{
813 return e1000_enable_tx_pkt_filtering_generic(hw);
814}
815
816/**
817 * e1000_mng_host_if_write - Writes to the manageability host interface
805 *
806 * Enables packet filtering on transmit packets if manageability is enabled
807 * and host interface is enabled.
808 * Currently no func pointer exists and all implementations are handled in the
809 * generic version of this function.
810 **/
811boolean_t
812e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
813{
814 return e1000_enable_tx_pkt_filtering_generic(hw);
815}
816
817/**
818 * e1000_mng_host_if_write - Writes to the manageability host interface
818 * @hw - pointer to the HW structure
819 * @buffer - pointer to the host interface buffer
820 * @length - size of the buffer
821 * @offset - location in the buffer to write to
822 * @sum - sum of the data (not checksum)
819 * @hw: pointer to the HW structure
820 * @buffer: pointer to the host interface buffer
821 * @length: size of the buffer
822 * @offset: location in the buffer to write to
823 * @sum: sum of the data (not checksum)
823 *
824 * This function writes the buffer content at the offset given on the host if.
825 * It also does alignment considerations to do the writes in most efficient
826 * way. Also fills up the sum of the buffer in *buffer parameter.
827 **/
828s32
829e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
830 u16 offset, u8 *sum)
831{
832 if (hw->func.mng_host_if_write != NULL)
833 return hw->func.mng_host_if_write(hw, buffer, length, offset,
834 sum);
835 else
836 return E1000_NOT_IMPLEMENTED;
837}
838
839/**
840 * e1000_mng_write_cmd_header - Writes manageability command header
824 *
825 * This function writes the buffer content at the offset given on the host if.
826 * It also does alignment considerations to do the writes in most efficient
827 * way. Also fills up the sum of the buffer in *buffer parameter.
828 **/
829s32
830e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
831 u16 offset, u8 *sum)
832{
833 if (hw->func.mng_host_if_write != NULL)
834 return hw->func.mng_host_if_write(hw, buffer, length, offset,
835 sum);
836 else
837 return E1000_NOT_IMPLEMENTED;
838}
839
840/**
841 * e1000_mng_write_cmd_header - Writes manageability command header
841 * @hw - pointer to the HW structure
842 * @hdr - pointer to the host interface command header
842 * @hw: pointer to the HW structure
843 * @hdr: pointer to the host interface command header
843 *
844 * Writes the command header after does the checksum calculation.
845 **/
846s32
847e1000_mng_write_cmd_header(struct e1000_hw *hw,
848 struct e1000_host_mng_command_header *hdr)
849{
850 if (hw->func.mng_write_cmd_header != NULL)
851 return hw->func.mng_write_cmd_header(hw, hdr);
852 else
853 return E1000_NOT_IMPLEMENTED;
854}
855
856/**
857 * e1000_mng_enable_host_if - Checks host interface is enabled
844 *
845 * Writes the command header after does the checksum calculation.
846 **/
847s32
848e1000_mng_write_cmd_header(struct e1000_hw *hw,
849 struct e1000_host_mng_command_header *hdr)
850{
851 if (hw->func.mng_write_cmd_header != NULL)
852 return hw->func.mng_write_cmd_header(hw, hdr);
853 else
854 return E1000_NOT_IMPLEMENTED;
855}
856
857/**
858 * e1000_mng_enable_host_if - Checks host interface is enabled
858 * @hw - pointer to the HW structure
859 * @hw: pointer to the HW structure
859 *
860 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
861 *
862 * This function checks whether the HOST IF is enabled for command operaton
863 * and also checks whether the previous command is completed. It busy waits
864 * in case of previous command is not completed.
865 **/
866s32
867e1000_mng_enable_host_if(struct e1000_hw * hw)
868{
869 if (hw->func.mng_enable_host_if != NULL)
870 return hw->func.mng_enable_host_if(hw);
871 else
872 return E1000_NOT_IMPLEMENTED;
873}
874
875/**
876 * e1000_wait_autoneg - Waits for autonegotiation completion
860 *
861 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
862 *
863 * This function checks whether the HOST IF is enabled for command operaton
864 * and also checks whether the previous command is completed. It busy waits
865 * in case of previous command is not completed.
866 **/
867s32
868e1000_mng_enable_host_if(struct e1000_hw * hw)
869{
870 if (hw->func.mng_enable_host_if != NULL)
871 return hw->func.mng_enable_host_if(hw);
872 else
873 return E1000_NOT_IMPLEMENTED;
874}
875
876/**
877 * e1000_wait_autoneg - Waits for autonegotiation completion
877 * @hw - pointer to the HW structure
878 * @hw: pointer to the HW structure
878 *
879 * Waits for autoneg to complete. Currently no func pointer exists and all
880 * implementations are handled in the generic version of this function.
881 **/
882s32
883e1000_wait_autoneg(struct e1000_hw *hw)
884{
885 if (hw->func.wait_autoneg != NULL)
886 return hw->func.wait_autoneg(hw);
887 else
888 return E1000_SUCCESS;
889}
890
891/**
892 * e1000_check_reset_block - Verifies PHY can be reset
879 *
880 * Waits for autoneg to complete. Currently no func pointer exists and all
881 * implementations are handled in the generic version of this function.
882 **/
883s32
884e1000_wait_autoneg(struct e1000_hw *hw)
885{
886 if (hw->func.wait_autoneg != NULL)
887 return hw->func.wait_autoneg(hw);
888 else
889 return E1000_SUCCESS;
890}
891
892/**
893 * e1000_check_reset_block - Verifies PHY can be reset
893 * @hw - pointer to the HW structure
894 * @hw: pointer to the HW structure
894 *
895 * Checks if the PHY is in a state that can be reset or if manageability
896 * has it tied up. This is a function pointer entry point called by drivers.
897 **/
898s32
899e1000_check_reset_block(struct e1000_hw *hw)
900{
901 if (hw->func.check_reset_block != NULL)
902 return hw->func.check_reset_block(hw);
903 else
904 return E1000_SUCCESS;
905}
906
907/**
908 * e1000_read_phy_reg - Reads PHY register
895 *
896 * Checks if the PHY is in a state that can be reset or if manageability
897 * has it tied up. This is a function pointer entry point called by drivers.
898 **/
899s32
900e1000_check_reset_block(struct e1000_hw *hw)
901{
902 if (hw->func.check_reset_block != NULL)
903 return hw->func.check_reset_block(hw);
904 else
905 return E1000_SUCCESS;
906}
907
908/**
909 * e1000_read_phy_reg - Reads PHY register
909 * @hw - pointer to the HW structure
910 * @offset - the register to read
911 * @data - the buffer to store the 16-bit read.
910 * @hw: pointer to the HW structure
911 * @offset: the register to read
912 * @data: the buffer to store the 16-bit read.
912 *
913 * Reads the PHY register and returns the value in data.
914 * This is a function pointer entry point called by drivers.
915 **/
916s32
917e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
918{
919 if (hw->func.read_phy_reg != NULL)
920 return hw->func.read_phy_reg(hw, offset, data);
921 else
922 return E1000_SUCCESS;
923}
924
925/**
926 * e1000_write_phy_reg - Writes PHY register
913 *
914 * Reads the PHY register and returns the value in data.
915 * This is a function pointer entry point called by drivers.
916 **/
917s32
918e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
919{
920 if (hw->func.read_phy_reg != NULL)
921 return hw->func.read_phy_reg(hw, offset, data);
922 else
923 return E1000_SUCCESS;
924}
925
926/**
927 * e1000_write_phy_reg - Writes PHY register
927 * @hw - pointer to the HW structure
928 * @offset - the register to write
929 * @data - the value to write.
928 * @hw: pointer to the HW structure
929 * @offset: the register to write
930 * @data: the value to write.
930 *
931 * Writes the PHY register at offset with the value in data.
932 * This is a function pointer entry point called by drivers.
933 **/
934s32
935e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
936{
937 if (hw->func.write_phy_reg != NULL)
938 return hw->func.write_phy_reg(hw, offset, data);
939 else
940 return E1000_SUCCESS;
941}
942
943/**
944 * e1000_read_kmrn_reg - Reads register using Kumeran interface
931 *
932 * Writes the PHY register at offset with the value in data.
933 * This is a function pointer entry point called by drivers.
934 **/
935s32
936e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
937{
938 if (hw->func.write_phy_reg != NULL)
939 return hw->func.write_phy_reg(hw, offset, data);
940 else
941 return E1000_SUCCESS;
942}
943
944/**
945 * e1000_read_kmrn_reg - Reads register using Kumeran interface
945 * @hw - pointer to the HW structure
946 * @offset - the register to read
947 * @data - the location to store the 16-bit value read.
946 * @hw: pointer to the HW structure
947 * @offset: the register to read
948 * @data: the location to store the 16-bit value read.
948 *
949 * Reads a register out of the Kumeran interface. Currently no func pointer
950 * exists and all implementations are handled in the generic version of
951 * this function.
952 **/
953s32
954e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
955{
956 return e1000_read_kmrn_reg_generic(hw, offset, data);
957}
958
959/**
960 * e1000_write_kmrn_reg - Writes register using Kumeran interface
949 *
950 * Reads a register out of the Kumeran interface. Currently no func pointer
951 * exists and all implementations are handled in the generic version of
952 * this function.
953 **/
954s32
955e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
956{
957 return e1000_read_kmrn_reg_generic(hw, offset, data);
958}
959
960/**
961 * e1000_write_kmrn_reg - Writes register using Kumeran interface
961 * @hw - pointer to the HW structure
962 * @offset - the register to write
963 * @data - the value to write.
962 * @hw: pointer to the HW structure
963 * @offset: the register to write
964 * @data: the value to write.
964 *
965 * Writes a register to the Kumeran interface. Currently no func pointer
966 * exists and all implementations are handled in the generic version of
967 * this function.
968 **/
969s32
970e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
971{
972 return e1000_write_kmrn_reg_generic(hw, offset, data);
973}
974
975/**
976 * e1000_get_cable_length - Retrieves cable length estimation
965 *
966 * Writes a register to the Kumeran interface. Currently no func pointer
967 * exists and all implementations are handled in the generic version of
968 * this function.
969 **/
970s32
971e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
972{
973 return e1000_write_kmrn_reg_generic(hw, offset, data);
974}
975
976/**
977 * e1000_get_cable_length - Retrieves cable length estimation
977 * @hw - pointer to the HW structure
978 * @hw: pointer to the HW structure
978 *
979 * This function estimates the cable length and stores them in
980 * hw->phy.min_length and hw->phy.max_length. This is a function pointer
981 * entry point called by drivers.
982 **/
983s32
984e1000_get_cable_length(struct e1000_hw *hw)
985{
986 if (hw->func.get_cable_length != NULL)
987 return hw->func.get_cable_length(hw);
988 else
989 return E1000_SUCCESS;
990}
991
992/**
993 * e1000_get_phy_info - Retrieves PHY information from registers
979 *
980 * This function estimates the cable length and stores them in
981 * hw->phy.min_length and hw->phy.max_length. This is a function pointer
982 * entry point called by drivers.
983 **/
984s32
985e1000_get_cable_length(struct e1000_hw *hw)
986{
987 if (hw->func.get_cable_length != NULL)
988 return hw->func.get_cable_length(hw);
989 else
990 return E1000_SUCCESS;
991}
992
993/**
994 * e1000_get_phy_info - Retrieves PHY information from registers
994 * @hw - pointer to the HW structure
995 * @hw: pointer to the HW structure
995 *
996 * This function gets some information from various PHY registers and
997 * populates hw->phy values with it. This is a function pointer entry
998 * point called by drivers.
999 **/
1000s32
1001e1000_get_phy_info(struct e1000_hw *hw)
1002{
1003 if (hw->func.get_phy_info != NULL)
1004 return hw->func.get_phy_info(hw);
1005 else
1006 return E1000_SUCCESS;
1007}
1008
1009/**
1010 * e1000_phy_hw_reset - Hard PHY reset
996 *
997 * This function gets some information from various PHY registers and
998 * populates hw->phy values with it. This is a function pointer entry
999 * point called by drivers.
1000 **/
1001s32
1002e1000_get_phy_info(struct e1000_hw *hw)
1003{
1004 if (hw->func.get_phy_info != NULL)
1005 return hw->func.get_phy_info(hw);
1006 else
1007 return E1000_SUCCESS;
1008}
1009
1010/**
1011 * e1000_phy_hw_reset - Hard PHY reset
1011 * @hw - pointer to the HW structure
1012 * @hw: pointer to the HW structure
1012 *
1013 * Performs a hard PHY reset. This is a function pointer entry point called
1014 * by drivers.
1015 **/
1016s32
1017e1000_phy_hw_reset(struct e1000_hw *hw)
1018{
1019 if (hw->func.reset_phy != NULL)
1020 return hw->func.reset_phy(hw);
1021 else
1022 return E1000_SUCCESS;
1023}
1024
1025/**
1026 * e1000_phy_commit - Soft PHY reset
1013 *
1014 * Performs a hard PHY reset. This is a function pointer entry point called
1015 * by drivers.
1016 **/
1017s32
1018e1000_phy_hw_reset(struct e1000_hw *hw)
1019{
1020 if (hw->func.reset_phy != NULL)
1021 return hw->func.reset_phy(hw);
1022 else
1023 return E1000_SUCCESS;
1024}
1025
1026/**
1027 * e1000_phy_commit - Soft PHY reset
1027 * @hw - pointer to the HW structure
1028 * @hw: pointer to the HW structure
1028 *
1029 * Performs a soft PHY reset on those that apply. This is a function pointer
1030 * entry point called by drivers.
1031 **/
1032s32
1033e1000_phy_commit(struct e1000_hw *hw)
1034{
1035 if (hw->func.commit_phy != NULL)
1036 return hw->func.commit_phy(hw);
1037 else
1038 return E1000_SUCCESS;
1039}
1040
1041/**
1042 * e1000_set_d3_lplu_state - Sets low power link up state for D0
1029 *
1030 * Performs a soft PHY reset on those that apply. This is a function pointer
1031 * entry point called by drivers.
1032 **/
1033s32
1034e1000_phy_commit(struct e1000_hw *hw)
1035{
1036 if (hw->func.commit_phy != NULL)
1037 return hw->func.commit_phy(hw);
1038 else
1039 return E1000_SUCCESS;
1040}
1041
1042/**
1043 * e1000_set_d3_lplu_state - Sets low power link up state for D0
1043 * @hw - pointer to the HW structure
1044 * @active boolean used to enable/disable lplu
1044 * @hw: pointer to the HW structure
1045 * @active: boolean used to enable/disable lplu
1045 *
1046 * Success returns 0, Failure returns 1
1047 *
1048 * The low power link up (lplu) state is set to the power management level D0
1049 * and SmartSpeed is disabled when active is true, else clear lplu for D0
1050 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1051 * is used during Dx states where the power conservation is most important.
1052 * During driver activity, SmartSpeed should be enabled so performance is

--- 5 unchanged lines hidden (view full) ---

1058 if (hw->func.set_d0_lplu_state != NULL)
1059 return hw->func.set_d0_lplu_state(hw, active);
1060 else
1061 return E1000_SUCCESS;
1062}
1063
1064/**
1065 * e1000_set_d3_lplu_state - Sets low power link up state for D3
1046 *
1047 * Success returns 0, Failure returns 1
1048 *
1049 * The low power link up (lplu) state is set to the power management level D0
1050 * and SmartSpeed is disabled when active is true, else clear lplu for D0
1051 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1052 * is used during Dx states where the power conservation is most important.
1053 * During driver activity, SmartSpeed should be enabled so performance is

--- 5 unchanged lines hidden (view full) ---

1059 if (hw->func.set_d0_lplu_state != NULL)
1060 return hw->func.set_d0_lplu_state(hw, active);
1061 else
1062 return E1000_SUCCESS;
1063}
1064
1065/**
1066 * e1000_set_d3_lplu_state - Sets low power link up state for D3
1066 * @hw - pointer to the HW structure
1067 * @active boolean used to enable/disable lplu
1067 * @hw: pointer to the HW structure
1068 * @active: boolean used to enable/disable lplu
1068 *
1069 * Success returns 0, Failure returns 1
1070 *
1071 * The low power link up (lplu) state is set to the power management level D3
1072 * and SmartSpeed is disabled when active is true, else clear lplu for D3
1073 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1074 * is used during Dx states where the power conservation is most important.
1075 * During driver activity, SmartSpeed should be enabled so performance is

--- 5 unchanged lines hidden (view full) ---

1081 if (hw->func.set_d3_lplu_state != NULL)
1082 return hw->func.set_d3_lplu_state(hw, active);
1083 else
1084 return E1000_SUCCESS;
1085}
1086
1087/**
1088 * e1000_read_mac_addr - Reads MAC address
1069 *
1070 * Success returns 0, Failure returns 1
1071 *
1072 * The low power link up (lplu) state is set to the power management level D3
1073 * and SmartSpeed is disabled when active is true, else clear lplu for D3
1074 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1075 * is used during Dx states where the power conservation is most important.
1076 * During driver activity, SmartSpeed should be enabled so performance is

--- 5 unchanged lines hidden (view full) ---

1082 if (hw->func.set_d3_lplu_state != NULL)
1083 return hw->func.set_d3_lplu_state(hw, active);
1084 else
1085 return E1000_SUCCESS;
1086}
1087
1088/**
1089 * e1000_read_mac_addr - Reads MAC address
1089 * @hw - pointer to the HW structure
1090 * @hw: pointer to the HW structure
1090 *
1091 * Reads the MAC address out of the adapter and stores it in the HW structure.
1092 * Currently no func pointer exists and all implementations are handled in the
1093 * generic version of this function.
1094 **/
1095s32
1096e1000_read_mac_addr(struct e1000_hw *hw)
1097{
1098 return e1000_read_mac_addr_generic(hw);
1099}
1100
1101/**
1102 * e1000_read_part_num - Read device part number
1091 *
1092 * Reads the MAC address out of the adapter and stores it in the HW structure.
1093 * Currently no func pointer exists and all implementations are handled in the
1094 * generic version of this function.
1095 **/
1096s32
1097e1000_read_mac_addr(struct e1000_hw *hw)
1098{
1099 return e1000_read_mac_addr_generic(hw);
1100}
1101
1102/**
1103 * e1000_read_part_num - Read device part number
1103 * @hw - pointer to the HW structure
1104 * @part_num - pointer to device part number
1104 * @hw: pointer to the HW structure
1105 * @part_num: pointer to device part number
1105 *
1106 * Reads the product board assembly (PBA) number from the EEPROM and stores
1107 * the value in part_num.
1108 * Currently no func pointer exists and all implementations are handled in the
1109 * generic version of this function.
1110 **/
1111s32
1112e1000_read_part_num(struct e1000_hw *hw, u32 *part_num)
1113{
1114 return e1000_read_part_num_generic(hw, part_num);
1115}
1116
1117/**
1118 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1106 *
1107 * Reads the product board assembly (PBA) number from the EEPROM and stores
1108 * the value in part_num.
1109 * Currently no func pointer exists and all implementations are handled in the
1110 * generic version of this function.
1111 **/
1112s32
1113e1000_read_part_num(struct e1000_hw *hw, u32 *part_num)
1114{
1115 return e1000_read_part_num_generic(hw, part_num);
1116}
1117
1118/**
1119 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1119 * @hw - pointer to the HW structure
1120 * @hw: pointer to the HW structure
1120 *
1121 * Validates the NVM checksum is correct. This is a function pointer entry
1122 * point called by drivers.
1123 **/
1124s32
1125e1000_validate_nvm_checksum(struct e1000_hw *hw)
1126{
1127 if (hw->func.validate_nvm != NULL)
1128 return hw->func.validate_nvm(hw);
1129 else
1130 return -E1000_ERR_CONFIG;
1131}
1132
1133/**
1134 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1121 *
1122 * Validates the NVM checksum is correct. This is a function pointer entry
1123 * point called by drivers.
1124 **/
1125s32
1126e1000_validate_nvm_checksum(struct e1000_hw *hw)
1127{
1128 if (hw->func.validate_nvm != NULL)
1129 return hw->func.validate_nvm(hw);
1130 else
1131 return -E1000_ERR_CONFIG;
1132}
1133
1134/**
1135 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1135 * @hw - pointer to the HW structure
1136 * @hw: pointer to the HW structure
1136 *
1137 * Updates the NVM checksum. Currently no func pointer exists and all
1138 * implementations are handled in the generic version of this function.
1139 **/
1140s32
1141e1000_update_nvm_checksum(struct e1000_hw *hw)
1142{
1143 if (hw->func.update_nvm != NULL)
1144 return hw->func.update_nvm(hw);
1145 else
1146 return -E1000_ERR_CONFIG;
1147}
1148
1149/**
1150 * e1000_reload_nvm - Reloads EEPROM
1137 *
1138 * Updates the NVM checksum. Currently no func pointer exists and all
1139 * implementations are handled in the generic version of this function.
1140 **/
1141s32
1142e1000_update_nvm_checksum(struct e1000_hw *hw)
1143{
1144 if (hw->func.update_nvm != NULL)
1145 return hw->func.update_nvm(hw);
1146 else
1147 return -E1000_ERR_CONFIG;
1148}
1149
1150/**
1151 * e1000_reload_nvm - Reloads EEPROM
1151 * @hw - pointer to the HW structure
1152 * @hw: pointer to the HW structure
1152 *
1153 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1154 * extended control register.
1155 **/
1156void
1157e1000_reload_nvm(struct e1000_hw *hw)
1158{
1159 if (hw->func.reload_nvm != NULL)
1160 hw->func.reload_nvm(hw);
1161}
1162
1163/**
1164 * e1000_read_nvm - Reads NVM (EEPROM)
1153 *
1154 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1155 * extended control register.
1156 **/
1157void
1158e1000_reload_nvm(struct e1000_hw *hw)
1159{
1160 if (hw->func.reload_nvm != NULL)
1161 hw->func.reload_nvm(hw);
1162}
1163
1164/**
1165 * e1000_read_nvm - Reads NVM (EEPROM)
1165 * @hw - pointer to the HW structure
1166 * @offset - the word offset to read
1167 * @words - number of 16-bit words to read
1168 * @data - pointer to the properly sized buffer for the data.
1166 * @hw: pointer to the HW structure
1167 * @offset: the word offset to read
1168 * @words: number of 16-bit words to read
1169 * @data: pointer to the properly sized buffer for the data.
1169 *
1170 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1171 * pointer entry point called by drivers.
1172 **/
1173s32
1174e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1175{
1176 if (hw->func.read_nvm != NULL)
1177 return hw->func.read_nvm(hw, offset, words, data);
1178 else
1179 return -E1000_ERR_CONFIG;
1180}
1181
1182/**
1183 * e1000_write_nvm - Writes to NVM (EEPROM)
1170 *
1171 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1172 * pointer entry point called by drivers.
1173 **/
1174s32
1175e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1176{
1177 if (hw->func.read_nvm != NULL)
1178 return hw->func.read_nvm(hw, offset, words, data);
1179 else
1180 return -E1000_ERR_CONFIG;
1181}
1182
1183/**
1184 * e1000_write_nvm - Writes to NVM (EEPROM)
1184 * @hw - pointer to the HW structure
1185 * @offset - the word offset to read
1186 * @words - number of 16-bit words to write
1187 * @data - pointer to the properly sized buffer for the data.
1185 * @hw: pointer to the HW structure
1186 * @offset: the word offset to read
1187 * @words: number of 16-bit words to write
1188 * @data: pointer to the properly sized buffer for the data.
1188 *
1189 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1190 * pointer entry point called by drivers.
1191 **/
1192s32
1193e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1194{
1195 if (hw->func.write_nvm != NULL)
1196 return hw->func.write_nvm(hw, offset, words, data);
1197 else
1198 return E1000_SUCCESS;
1199}
1200
1201/**
1202 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1189 *
1190 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1191 * pointer entry point called by drivers.
1192 **/
1193s32
1194e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1195{
1196 if (hw->func.write_nvm != NULL)
1197 return hw->func.write_nvm(hw, offset, words, data);
1198 else
1199 return E1000_SUCCESS;
1200}
1201
1202/**
1203 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1203 * @hw - pointer to the HW structure
1204 * @reg - 32bit register offset
1205 * @offset - the register to write
1206 * @data - the value to write.
1204 * @hw: pointer to the HW structure
1205 * @reg: 32bit register offset
1206 * @offset: the register to write
1207 * @data: the value to write.
1207 *
1208 * Writes the PHY register at offset with the value in data.
1209 * This is a function pointer entry point called by drivers.
1210 **/
1211s32
1212e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
1213{
1214 return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1215}
1208 *
1209 * Writes the PHY register at offset with the value in data.
1210 * This is a function pointer entry point called by drivers.
1211 **/
1212s32
1213e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
1214{
1215 return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1216}