Deleted Added
full compact
e1000_api.c (169589) e1000_api.c (173788)
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/* $FreeBSD: head/sys/dev/em/e1000_api.c 173788 2007-11-20 21:41:22Z jfv $ */
34
35
36#include "e1000_api.h"
37#include "e1000_mac.h"
38#include "e1000_nvm.h"
39#include "e1000_phy.h"
40
41#ifndef NO_82542_SUPPORT

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

51
52/**
53 * e1000_init_mac_params - Initialize MAC function pointers
54 * @hw: pointer to the HW structure
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 **/
34
35
36#include "e1000_api.h"
37#include "e1000_mac.h"
38#include "e1000_nvm.h"
39#include "e1000_phy.h"
40
41#ifndef NO_82542_SUPPORT

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

51
52/**
53 * e1000_init_mac_params - Initialize MAC function pointers
54 * @hw: pointer to the HW structure
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)
59s32 e1000_init_mac_params(struct e1000_hw *hw)
61{
62 s32 ret_val = E1000_SUCCESS;
63
60{
61 s32 ret_val = E1000_SUCCESS;
62
64 if (hw->func.init_mac_params != NULL) {
63 if (hw->func.init_mac_params) {
65 ret_val = hw->func.init_mac_params(hw);
66 if (ret_val) {
67 DEBUGOUT("MAC Initialization Error\n");
68 goto out;
69 }
70 } else {
71 DEBUGOUT("mac.init_mac_params was NULL\n");
72 ret_val = -E1000_ERR_CONFIG;

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

78
79/**
80 * e1000_init_nvm_params - Initialize NVM function pointers
81 * @hw: pointer to the HW structure
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 **/
64 ret_val = hw->func.init_mac_params(hw);
65 if (ret_val) {
66 DEBUGOUT("MAC Initialization Error\n");
67 goto out;
68 }
69 } else {
70 DEBUGOUT("mac.init_mac_params was NULL\n");
71 ret_val = -E1000_ERR_CONFIG;

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

77
78/**
79 * e1000_init_nvm_params - Initialize NVM function pointers
80 * @hw: pointer to the HW structure
81 *
82 * This function initializes the function pointers for the NVM
83 * set of functions. Called by drivers or by e1000_setup_init_funcs.
84 **/
86s32
87e1000_init_nvm_params(struct e1000_hw *hw)
85s32 e1000_init_nvm_params(struct e1000_hw *hw)
88{
89 s32 ret_val = E1000_SUCCESS;
90
86{
87 s32 ret_val = E1000_SUCCESS;
88
91 if (hw->func.init_nvm_params != NULL) {
89 if (hw->func.init_nvm_params) {
92 ret_val = hw->func.init_nvm_params(hw);
93 if (ret_val) {
94 DEBUGOUT("NVM Initialization Error\n");
95 goto out;
96 }
97 } else {
98 DEBUGOUT("nvm.init_nvm_params was NULL\n");
99 ret_val = -E1000_ERR_CONFIG;

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

105
106/**
107 * e1000_init_phy_params - Initialize PHY function pointers
108 * @hw: pointer to the HW structure
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 **/
90 ret_val = hw->func.init_nvm_params(hw);
91 if (ret_val) {
92 DEBUGOUT("NVM Initialization Error\n");
93 goto out;
94 }
95 } else {
96 DEBUGOUT("nvm.init_nvm_params was NULL\n");
97 ret_val = -E1000_ERR_CONFIG;

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

103
104/**
105 * e1000_init_phy_params - Initialize PHY function pointers
106 * @hw: pointer to the HW structure
107 *
108 * This function initializes the function pointers for the PHY
109 * set of functions. Called by drivers or by e1000_setup_init_funcs.
110 **/
113s32
114e1000_init_phy_params(struct e1000_hw *hw)
111s32 e1000_init_phy_params(struct e1000_hw *hw)
115{
116 s32 ret_val = E1000_SUCCESS;
117
112{
113 s32 ret_val = E1000_SUCCESS;
114
118 if (hw->func.init_phy_params != NULL) {
115 if (hw->func.init_phy_params) {
119 ret_val = hw->func.init_phy_params(hw);
120 if (ret_val) {
121 DEBUGOUT("PHY Initialization Error\n");
122 goto out;
123 }
124 } else {
125 DEBUGOUT("phy.init_phy_params was NULL\n");
126 ret_val = -E1000_ERR_CONFIG;

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

134 * e1000_set_mac_type - Sets MAC type
135 * @hw: pointer to the HW structure
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 **/
116 ret_val = hw->func.init_phy_params(hw);
117 if (ret_val) {
118 DEBUGOUT("PHY Initialization Error\n");
119 goto out;
120 }
121 } else {
122 DEBUGOUT("phy.init_phy_params was NULL\n");
123 ret_val = -E1000_ERR_CONFIG;

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

131 * e1000_set_mac_type - Sets MAC type
132 * @hw: pointer to the HW structure
133 *
134 * This function sets the mac type of the adapter based on the
135 * device ID stored in the hw structure.
136 * MUST BE FIRST FUNCTION CALLED (explicitly or through
137 * e1000_setup_init_funcs()).
138 **/
142s32
143e1000_set_mac_type(struct e1000_hw *hw)
139s32 e1000_set_mac_type(struct e1000_hw *hw)
144{
145 struct e1000_mac_info *mac = &hw->mac;
146 s32 ret_val = E1000_SUCCESS;
147
148 DEBUGFUNC("e1000_set_mac_type");
149
150 switch (hw->device_id) {
151#ifndef NO_82542_SUPPORT

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

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:
218 case E1000_DEV_ID_82571EB_QUAD_COPPER:
140{
141 struct e1000_mac_info *mac = &hw->mac;
142 s32 ret_val = E1000_SUCCESS;
143
144 DEBUGFUNC("e1000_set_mac_type");
145
146 switch (hw->device_id) {
147#ifndef NO_82542_SUPPORT

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

207 mac->type = e1000_82547_rev_2;
208 break;
209 case E1000_DEV_ID_82571EB_COPPER:
210 case E1000_DEV_ID_82571EB_FIBER:
211 case E1000_DEV_ID_82571EB_SERDES:
212 case E1000_DEV_ID_82571EB_SERDES_DUAL:
213 case E1000_DEV_ID_82571EB_SERDES_QUAD:
214 case E1000_DEV_ID_82571EB_QUAD_COPPER:
215 case E1000_DEV_ID_82571PT_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:
226 case E1000_DEV_ID_82572EI_SERDES:

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

250 case E1000_DEV_ID_ICH9_IFE_GT:
251 case E1000_DEV_ID_ICH9_IFE_G:
252 case E1000_DEV_ID_ICH9_IGP_AMT:
253 case E1000_DEV_ID_ICH9_IGP_C:
254 mac->type = e1000_ich9lan;
255 break;
256 case E1000_DEV_ID_82575EB_COPPER:
257 case E1000_DEV_ID_82575EB_FIBER_SERDES:
216 case E1000_DEV_ID_82571EB_QUAD_FIBER:
217 case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
218 mac->type = e1000_82571;
219 break;
220 case E1000_DEV_ID_82572EI:
221 case E1000_DEV_ID_82572EI_COPPER:
222 case E1000_DEV_ID_82572EI_FIBER:
223 case E1000_DEV_ID_82572EI_SERDES:

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

247 case E1000_DEV_ID_ICH9_IFE_GT:
248 case E1000_DEV_ID_ICH9_IFE_G:
249 case E1000_DEV_ID_ICH9_IGP_AMT:
250 case E1000_DEV_ID_ICH9_IGP_C:
251 mac->type = e1000_ich9lan;
252 break;
253 case E1000_DEV_ID_82575EB_COPPER:
254 case E1000_DEV_ID_82575EB_FIBER_SERDES:
258 case E1000_DEV_ID_82575EM_COPPER:
259 case E1000_DEV_ID_82575EM_FIBER_SERDES:
260 case E1000_DEV_ID_82575GB_QUAD_COPPER:
261 mac->type = e1000_82575;
262 break;
263 default:
264 /* Should never have loaded on this device */
265 ret_val = -E1000_ERR_MAC_INIT;
266 break;
267 }

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

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 **/
255 case E1000_DEV_ID_82575GB_QUAD_COPPER:
256 mac->type = e1000_82575;
257 break;
258 default:
259 /* Should never have loaded on this device */
260 ret_val = -E1000_ERR_MAC_INIT;
261 break;
262 }

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

271 * getting the device ready for use. FALSE will only set
272 * MAC type and the function pointers for the other init
273 * functions. Passing FALSE will not generate any hardware
274 * reads or writes.
275 *
276 * This function must be called by a driver in order to use the rest
277 * of the 'shared' code files. Called by drivers only.
278 **/
284s32
285e1000_setup_init_funcs(struct e1000_hw *hw, boolean_t init_device)
279s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
286{
287 s32 ret_val;
288
280{
281 s32 ret_val;
282
289 /* Can't do much good without knowing the MAC type.
290 */
283 /* Can't do much good without knowing the MAC type. */
291 ret_val = e1000_set_mac_type(hw);
292 if (ret_val) {
293 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
294 goto out;
295 }
296
297 if (!hw->hw_addr) {
298 DEBUGOUT("ERROR: Registers not mapped\n");
299 ret_val = -E1000_ERR_CONFIG;
300 goto out;
301 }
302
284 ret_val = e1000_set_mac_type(hw);
285 if (ret_val) {
286 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
287 goto out;
288 }
289
290 if (!hw->hw_addr) {
291 DEBUGOUT("ERROR: Registers not mapped\n");
292 ret_val = -E1000_ERR_CONFIG;
293 goto out;
294 }
295
303 /* Init some generic function pointers that are currently all pointing
296 /*
297 * Init some generic function pointers that are currently all pointing
304 * to generic implementations. We do this first allowing a driver
305 * module to override it afterwards.
306 */
307 hw->func.config_collision_dist = e1000_config_collision_dist_generic;
308 hw->func.rar_set = e1000_rar_set_generic;
309 hw->func.validate_mdi_setting = e1000_validate_mdi_setting_generic;
310 hw->func.mng_host_if_write = e1000_mng_host_if_write_generic;
311 hw->func.mng_write_cmd_header = e1000_mng_write_cmd_header_generic;
312 hw->func.mng_enable_host_if = e1000_mng_enable_host_if_generic;
313 hw->func.wait_autoneg = e1000_wait_autoneg_generic;
314 hw->func.reload_nvm = e1000_reload_nvm_generic;
315
298 * to generic implementations. We do this first allowing a driver
299 * module to override it afterwards.
300 */
301 hw->func.config_collision_dist = e1000_config_collision_dist_generic;
302 hw->func.rar_set = e1000_rar_set_generic;
303 hw->func.validate_mdi_setting = e1000_validate_mdi_setting_generic;
304 hw->func.mng_host_if_write = e1000_mng_host_if_write_generic;
305 hw->func.mng_write_cmd_header = e1000_mng_write_cmd_header_generic;
306 hw->func.mng_enable_host_if = e1000_mng_enable_host_if_generic;
307 hw->func.wait_autoneg = e1000_wait_autoneg_generic;
308 hw->func.reload_nvm = e1000_reload_nvm_generic;
309
316 /* Set up the init function pointers. These are functions within the
310 /*
311 * Set up the init function pointers. These are functions within the
317 * adapter family file that sets up function pointers for the rest of
318 * the functions in that family.
319 */
320 switch (hw->mac.type) {
321#ifndef NO_82542_SUPPORT
322 case e1000_82542:
323 e1000_init_function_pointers_82542(hw);
324 break;

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

356 e1000_init_function_pointers_82575(hw);
357 break;
358 default:
359 DEBUGOUT("Hardware not supported\n");
360 ret_val = -E1000_ERR_CONFIG;
361 break;
362 }
363
312 * adapter family file that sets up function pointers for the rest of
313 * the functions in that family.
314 */
315 switch (hw->mac.type) {
316#ifndef NO_82542_SUPPORT
317 case e1000_82542:
318 e1000_init_function_pointers_82542(hw);
319 break;

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

351 e1000_init_function_pointers_82575(hw);
352 break;
353 default:
354 DEBUGOUT("Hardware not supported\n");
355 ret_val = -E1000_ERR_CONFIG;
356 break;
357 }
358
364 /* Initialize the rest of the function pointers. These require some
359 /*
360 * Initialize the rest of the function pointers. These require some
365 * register reads/writes in some cases.
366 */
361 * register reads/writes in some cases.
362 */
367 if ((ret_val == E1000_SUCCESS) && (init_device == TRUE)) {
363 if (!(ret_val) && init_device) {
368 ret_val = e1000_init_mac_params(hw);
369 if (ret_val)
370 goto out;
371
372 ret_val = e1000_init_nvm_params(hw);
373 if (ret_val)
374 goto out;
375

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

385
386/**
387 * e1000_remove_device - Free device specific structure
388 * @hw: pointer to the HW structure
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 **/
364 ret_val = e1000_init_mac_params(hw);
365 if (ret_val)
366 goto out;
367
368 ret_val = e1000_init_nvm_params(hw);
369 if (ret_val)
370 goto out;
371

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

381
382/**
383 * e1000_remove_device - Free device specific structure
384 * @hw: pointer to the HW structure
385 *
386 * If a device specific structure was allocated, this function will
387 * free it. This is a function pointer entry point called by drivers.
388 **/
393void
394e1000_remove_device(struct e1000_hw *hw)
389void e1000_remove_device(struct e1000_hw *hw)
395{
390{
396 if (hw->func.remove_device != NULL)
391 if (hw->func.remove_device)
397 hw->func.remove_device(hw);
398}
399
400/**
401 * e1000_get_bus_info - Obtain bus information for adapter
402 * @hw: pointer to the HW structure
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 **/
392 hw->func.remove_device(hw);
393}
394
395/**
396 * e1000_get_bus_info - Obtain bus information for adapter
397 * @hw: pointer to the HW structure
398 *
399 * This will obtain information about the HW bus for which the
400 * adaper is attached and stores it in the hw structure. This is a
401 * function pointer entry point called by drivers.
402 **/
408s32
409e1000_get_bus_info(struct e1000_hw *hw)
403s32 e1000_get_bus_info(struct e1000_hw *hw)
410{
404{
411 if (hw->func.get_bus_info != NULL)
405 if (hw->func.get_bus_info)
412 return hw->func.get_bus_info(hw);
406 return hw->func.get_bus_info(hw);
413 else
414 return E1000_SUCCESS;
407
408 return E1000_SUCCESS;
415}
416
417/**
418 * e1000_clear_vfta - Clear VLAN filter table
419 * @hw: pointer to the HW structure
420 *
421 * This clears the VLAN filter table on the adapter. This is a function
422 * pointer entry point called by drivers.
423 **/
409}
410
411/**
412 * e1000_clear_vfta - Clear VLAN filter table
413 * @hw: pointer to the HW structure
414 *
415 * This clears the VLAN filter table on the adapter. This is a function
416 * pointer entry point called by drivers.
417 **/
424void
425e1000_clear_vfta(struct e1000_hw *hw)
418void e1000_clear_vfta(struct e1000_hw *hw)
426{
419{
427 if (hw->func.clear_vfta != NULL)
420 if (hw->func.clear_vfta)
428 hw->func.clear_vfta (hw);
429}
430
431/**
432 * e1000_write_vfta - Write value to VLAN filter table
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.
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 **/
421 hw->func.clear_vfta (hw);
422}
423
424/**
425 * e1000_write_vfta - Write value to VLAN filter table
426 * @hw: pointer to the HW structure
427 * @offset: the 32-bit offset in which to write the value to.
428 * @value: the 32-bit value to write at location offset.
429 *
430 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
431 * table. This is a function pointer entry point called by drivers.
432 **/
440void
441e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
433void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
442{
434{
443 if (hw->func.write_vfta != NULL)
435 if (hw->func.write_vfta)
444 hw->func.write_vfta(hw, offset, value);
445}
446
447/**
436 hw->func.write_vfta(hw, offset, value);
437}
438
439/**
448 * e1000_mc_addr_list_update - Update Multicast addresses
440 * e1000_update_mc_addr_list - Update Multicast addresses
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
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 **/
441 * @hw: pointer to the HW structure
442 * @mc_addr_list: array of multicast addresses to program
443 * @mc_addr_count: number of multicast addresses to program
444 * @rar_used_count: the first RAR register free to program
445 * @rar_count: total number of supported Receive Address Registers
446 *
447 * Updates the Receive Address Registers and Multicast Table Array.
448 * The caller must have a packed mc_addr_list of multicast addresses.
449 * The parameter rar_count will usually be hw->mac.rar_entry_count
450 * unless there are workarounds that change this. Currently no func pointer
451 * exists and all implementations are handled in the generic version of this
452 * function.
453 **/
462void
463e1000_mc_addr_list_update(struct e1000_hw *hw,
464 u8 *mc_addr_list,
465 u32 mc_addr_count,
466 u32 rar_used_count,
467 u32 rar_count)
454void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
455 u32 mc_addr_count, u32 rar_used_count,
456 u32 rar_count)
468{
457{
469 if (hw->func.mc_addr_list_update != NULL)
470 hw->func.mc_addr_list_update(hw,
458 if (hw->func.update_mc_addr_list)
459 hw->func.update_mc_addr_list(hw,
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
479 * @hw: pointer to the HW structure
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 **/
460 mc_addr_list,
461 mc_addr_count,
462 rar_used_count,
463 rar_count);
464}
465
466/**
467 * e1000_force_mac_fc - Force MAC flow control
468 * @hw: pointer to the HW structure
469 *
470 * Force the MAC's flow control settings. Currently no func pointer exists
471 * and all implementations are handled in the generic version of this
472 * function.
473 **/
485s32
486e1000_force_mac_fc(struct e1000_hw *hw)
474s32 e1000_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
493 * @hw: pointer to the HW structure
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 **/
475{
476 return e1000_force_mac_fc_generic(hw);
477}
478
479/**
480 * e1000_check_for_link - Check/Store link connection
481 * @hw: pointer to the HW structure
482 *
483 * This checks the link condition of the adapter and stores the
484 * results in the hw->mac structure. This is a function pointer entry
485 * point called by drivers.
486 **/
499s32
500e1000_check_for_link(struct e1000_hw *hw)
487s32 e1000_check_for_link(struct e1000_hw *hw)
501{
488{
502 if (hw->func.check_for_link != NULL)
489 if (hw->func.check_for_link)
503 return hw->func.check_for_link(hw);
490 return hw->func.check_for_link(hw);
504 else
505 return -E1000_ERR_CONFIG;
491
492 return -E1000_ERR_CONFIG;
506}
507
508/**
509 * e1000_check_mng_mode - Check management mode
510 * @hw: pointer to the HW structure
511 *
512 * This checks if the adapter has manageability enabled.
513 * This is a function pointer entry point called by drivers.
514 **/
493}
494
495/**
496 * e1000_check_mng_mode - Check management mode
497 * @hw: pointer to the HW structure
498 *
499 * This checks if the adapter has manageability enabled.
500 * This is a function pointer entry point called by drivers.
501 **/
515boolean_t
516e1000_check_mng_mode(struct e1000_hw *hw)
502bool e1000_check_mng_mode(struct e1000_hw *hw)
517{
503{
518 if (hw->func.check_mng_mode != NULL)
504 if (hw->func.check_mng_mode)
519 return hw->func.check_mng_mode(hw);
505 return hw->func.check_mng_mode(hw);
520 else
521 return FALSE;
506
507 return FALSE;
522}
523
524/**
525 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
526 * @hw: pointer to the HW structure
527 * @buffer: pointer to the host interface
528 * @length: size of the buffer
529 *
530 * Writes the DHCP information to the host interface.
531 **/
508}
509
510/**
511 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
512 * @hw: pointer to the HW structure
513 * @buffer: pointer to the host interface
514 * @length: size of the buffer
515 *
516 * Writes the DHCP information to the host interface.
517 **/
532s32
533e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
518s32 e1000_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
540 * @hw: pointer to the HW structure
541 *
542 * This resets the hardware into a known state. This is a function pointer
543 * entry point called by drivers.
544 **/
519{
520 return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
521}
522
523/**
524 * e1000_reset_hw - Reset hardware
525 * @hw: pointer to the HW structure
526 *
527 * This resets the hardware into a known state. This is a function pointer
528 * entry point called by drivers.
529 **/
545s32
546e1000_reset_hw(struct e1000_hw *hw)
530s32 e1000_reset_hw(struct e1000_hw *hw)
547{
531{
548 if (hw->func.reset_hw != NULL)
532 if (hw->func.reset_hw)
549 return hw->func.reset_hw(hw);
533 return hw->func.reset_hw(hw);
550 else
551 return -E1000_ERR_CONFIG;
534
535 return -E1000_ERR_CONFIG;
552}
553
554/**
555 * e1000_init_hw - Initialize hardware
556 * @hw: pointer to the HW structure
557 *
558 * This inits the hardware readying it for operation. This is a function
559 * pointer entry point called by drivers.
560 **/
536}
537
538/**
539 * e1000_init_hw - Initialize hardware
540 * @hw: pointer to the HW structure
541 *
542 * This inits the hardware readying it for operation. This is a function
543 * pointer entry point called by drivers.
544 **/
561s32
562e1000_init_hw(struct e1000_hw *hw)
545s32 e1000_init_hw(struct e1000_hw *hw)
563{
546{
564 if (hw->func.init_hw != NULL)
547 if (hw->func.init_hw)
565 return hw->func.init_hw(hw);
548 return hw->func.init_hw(hw);
566 else
567 return -E1000_ERR_CONFIG;
549
550 return -E1000_ERR_CONFIG;
568}
569
570/**
571 * e1000_setup_link - Configures link and flow control
572 * @hw: pointer to the HW structure
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 **/
551}
552
553/**
554 * e1000_setup_link - Configures link and flow control
555 * @hw: pointer to the HW structure
556 *
557 * This configures link and flow control settings for the adapter. This
558 * is a function pointer entry point called by drivers. While modules can
559 * also call this, they probably call their own version of this function.
560 **/
578s32
579e1000_setup_link(struct e1000_hw *hw)
561s32 e1000_setup_link(struct e1000_hw *hw)
580{
562{
581 if (hw->func.setup_link != NULL)
563 if (hw->func.setup_link)
582 return hw->func.setup_link(hw);
564 return hw->func.setup_link(hw);
583 else
584 return -E1000_ERR_CONFIG;
565
566 return -E1000_ERR_CONFIG;
585}
586
587/**
588 * e1000_get_speed_and_duplex - Returns current speed and 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.
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 **/
567}
568
569/**
570 * e1000_get_speed_and_duplex - Returns current speed and duplex
571 * @hw: pointer to the HW structure
572 * @speed: pointer to a 16-bit value to store the speed
573 * @duplex: pointer to a 16-bit value to store the duplex.
574 *
575 * This returns the speed and duplex of the adapter in the two 'out'
576 * variables passed in. This is a function pointer entry point called
577 * by drivers.
578 **/
597s32
598e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
579s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
599{
580{
600 if (hw->func.get_link_up_info != NULL)
581 if (hw->func.get_link_up_info)
601 return hw->func.get_link_up_info(hw, speed, duplex);
582 return hw->func.get_link_up_info(hw, speed, duplex);
602 else
603 return -E1000_ERR_CONFIG;
583
584 return -E1000_ERR_CONFIG;
604}
605
606/**
607 * e1000_setup_led - Configures SW controllable LED
608 * @hw: pointer to the HW structure
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 **/
585}
586
587/**
588 * e1000_setup_led - Configures SW controllable LED
589 * @hw: pointer to the HW structure
590 *
591 * This prepares the SW controllable LED for use and saves the current state
592 * of the LED so it can be later restored. This is a function pointer entry
593 * point called by drivers.
594 **/
614s32
615e1000_setup_led(struct e1000_hw *hw)
595s32 e1000_setup_led(struct e1000_hw *hw)
616{
596{
617 if (hw->func.setup_led != NULL)
597 if (hw->func.setup_led)
618 return hw->func.setup_led(hw);
598 return hw->func.setup_led(hw);
619 else
620 return E1000_SUCCESS;
599
600 return E1000_SUCCESS;
621}
622
623/**
624 * e1000_cleanup_led - Restores SW controllable LED
625 * @hw: pointer to the HW structure
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 **/
601}
602
603/**
604 * e1000_cleanup_led - Restores SW controllable LED
605 * @hw: pointer to the HW structure
606 *
607 * This restores the SW controllable LED to the value saved off by
608 * e1000_setup_led. This is a function pointer entry point called by drivers.
609 **/
630s32
631e1000_cleanup_led(struct e1000_hw *hw)
610s32 e1000_cleanup_led(struct e1000_hw *hw)
632{
611{
633 if (hw->func.cleanup_led != NULL)
612 if (hw->func.cleanup_led)
634 return hw->func.cleanup_led(hw);
613 return hw->func.cleanup_led(hw);
635 else
636 return E1000_SUCCESS;
614
615 return E1000_SUCCESS;
637}
638
639/**
640 * e1000_blink_led - Blink SW controllable LED
641 * @hw: pointer to the HW structure
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 **/
616}
617
618/**
619 * e1000_blink_led - Blink SW controllable LED
620 * @hw: pointer to the HW structure
621 *
622 * This starts the adapter LED blinking. Request the LED to be setup first
623 * and cleaned up after. This is a function pointer entry point called by
624 * drivers.
625 **/
647s32
648e1000_blink_led(struct e1000_hw *hw)
626s32 e1000_blink_led(struct e1000_hw *hw)
649{
627{
650 if (hw->func.blink_led != NULL)
628 if (hw->func.blink_led)
651 return hw->func.blink_led(hw);
629 return hw->func.blink_led(hw);
652 else
653 return E1000_SUCCESS;
630
631 return E1000_SUCCESS;
654}
655
656/**
657 * e1000_led_on - Turn on SW controllable LED
658 * @hw: pointer to the HW structure
659 *
660 * Turns the SW defined LED on. This is a function pointer entry point
661 * called by drivers.
662 **/
632}
633
634/**
635 * e1000_led_on - Turn on SW controllable LED
636 * @hw: pointer to the HW structure
637 *
638 * Turns the SW defined LED on. This is a function pointer entry point
639 * called by drivers.
640 **/
663s32
664e1000_led_on(struct e1000_hw *hw)
641s32 e1000_led_on(struct e1000_hw *hw)
665{
642{
666 if (hw->func.led_on != NULL)
643 if (hw->func.led_on)
667 return hw->func.led_on(hw);
644 return hw->func.led_on(hw);
668 else
669 return E1000_SUCCESS;
645
646 return E1000_SUCCESS;
670}
671
672/**
673 * e1000_led_off - Turn off SW controllable LED
674 * @hw: pointer to the HW structure
675 *
676 * Turns the SW defined LED off. This is a function pointer entry point
677 * called by drivers.
678 **/
647}
648
649/**
650 * e1000_led_off - Turn off SW controllable LED
651 * @hw: pointer to the HW structure
652 *
653 * Turns the SW defined LED off. This is a function pointer entry point
654 * called by drivers.
655 **/
679s32
680e1000_led_off(struct e1000_hw *hw)
656s32 e1000_led_off(struct e1000_hw *hw)
681{
657{
682 if (hw->func.led_off != NULL)
658 if (hw->func.led_off)
683 return hw->func.led_off(hw);
659 return hw->func.led_off(hw);
684 else
685 return E1000_SUCCESS;
660
661 return E1000_SUCCESS;
686}
687
688/**
689 * e1000_reset_adaptive - Reset adaptive IFS
690 * @hw: pointer to the HW structure
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 **/
662}
663
664/**
665 * e1000_reset_adaptive - Reset adaptive IFS
666 * @hw: pointer to the HW structure
667 *
668 * Resets the adaptive IFS. Currently no func pointer exists and all
669 * implementations are handled in the generic version of this function.
670 **/
695void
696e1000_reset_adaptive(struct e1000_hw *hw)
671void e1000_reset_adaptive(struct e1000_hw *hw)
697{
698 e1000_reset_adaptive_generic(hw);
699}
700
701/**
702 * e1000_update_adaptive - Update adaptive IFS
703 * @hw: pointer to the HW structure
704 *
705 * Updates adapter IFS. Currently no func pointer exists and all
706 * implementations are handled in the generic version of this function.
707 **/
672{
673 e1000_reset_adaptive_generic(hw);
674}
675
676/**
677 * e1000_update_adaptive - Update adaptive IFS
678 * @hw: pointer to the HW structure
679 *
680 * Updates adapter IFS. Currently no func pointer exists and all
681 * implementations are handled in the generic version of this function.
682 **/
708void
709e1000_update_adaptive(struct e1000_hw *hw)
683void e1000_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
716 * @hw: pointer to the HW structure
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 **/
684{
685 e1000_update_adaptive_generic(hw);
686}
687
688/**
689 * e1000_disable_pcie_master - Disable PCI-Express master access
690 * @hw: pointer to the HW structure
691 *
692 * Disables PCI-Express master access and verifies there are no pending
693 * requests. Currently no func pointer exists and all implementations are
694 * handled in the generic version of this function.
695 **/
722s32
723e1000_disable_pcie_master(struct e1000_hw *hw)
696s32 e1000_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
730 * @hw: pointer to the HW structure
731 *
732 * Configures the collision distance to the default value and is used
733 * during link setup.
734 **/
697{
698 return e1000_disable_pcie_master_generic(hw);
699}
700
701/**
702 * e1000_config_collision_dist - Configure collision distance
703 * @hw: pointer to the HW structure
704 *
705 * Configures the collision distance to the default value and is used
706 * during link setup.
707 **/
735void
736e1000_config_collision_dist(struct e1000_hw *hw)
708void e1000_config_collision_dist(struct e1000_hw *hw)
737{
709{
738 if (hw->func.config_collision_dist != NULL)
710 if (hw->func.config_collision_dist)
739 hw->func.config_collision_dist(hw);
740}
741
742/**
743 * e1000_rar_set - Sets a receive address register
744 * @hw: pointer to the HW structure
745 * @addr: address to set the RAR to
746 * @index: the RAR to set
747 *
748 * Sets a Receive Address Register (RAR) to the specified address.
749 **/
711 hw->func.config_collision_dist(hw);
712}
713
714/**
715 * e1000_rar_set - Sets a receive address register
716 * @hw: pointer to the HW structure
717 * @addr: address to set the RAR to
718 * @index: the RAR to set
719 *
720 * Sets a Receive Address Register (RAR) to the specified address.
721 **/
750void
751e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
722void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
752{
723{
753 if (hw->func.rar_set != NULL)
724 if (hw->func.rar_set)
754 hw->func.rar_set(hw, addr, index);
755}
756
757/**
758 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
759 * @hw: pointer to the HW structure
760 *
761 * Ensures that the MDI/MDIX SW state is valid.
762 **/
725 hw->func.rar_set(hw, addr, index);
726}
727
728/**
729 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
730 * @hw: pointer to the HW structure
731 *
732 * Ensures that the MDI/MDIX SW state is valid.
733 **/
763s32
764e1000_validate_mdi_setting(struct e1000_hw *hw)
734s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
765{
735{
766 if (hw->func.validate_mdi_setting != NULL)
736 if (hw->func.validate_mdi_setting)
767 return hw->func.validate_mdi_setting(hw);
737 return hw->func.validate_mdi_setting(hw);
768 else
769 return E1000_SUCCESS;
738
739 return E1000_SUCCESS;
770}
771
772/**
773 * e1000_mta_set - Sets multicast table bit
774 * @hw: pointer to the HW structure
775 * @hash_value: Multicast hash value.
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 **/
740}
741
742/**
743 * e1000_mta_set - Sets multicast table bit
744 * @hw: pointer to the HW structure
745 * @hash_value: Multicast hash value.
746 *
747 * This sets the bit in the multicast table corresponding to the
748 * hash value. This is a function pointer entry point called by drivers.
749 **/
780void
781e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
750void e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
782{
751{
783 if (hw->func.mta_set != NULL)
752 if (hw->func.mta_set)
784 hw->func.mta_set(hw, hash_value);
785}
786
787/**
788 * e1000_hash_mc_addr - Determines address location in multicast table
789 * @hw: pointer to the HW structure
790 * @mc_addr: Multicast address to hash.
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 **/
753 hw->func.mta_set(hw, hash_value);
754}
755
756/**
757 * e1000_hash_mc_addr - Determines address location in multicast table
758 * @hw: pointer to the HW structure
759 * @mc_addr: Multicast address to hash.
760 *
761 * This hashes an address to determine its location in the multicast
762 * table. Currently no func pointer exists and all implementations
763 * are handled in the generic version of this function.
764 **/
796u32
797e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
765u32 e1000_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
804 * @hw: pointer to the HW structure
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 **/
766{
767 return e1000_hash_mc_addr_generic(hw, mc_addr);
768}
769
770/**
771 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
772 * @hw: pointer to the HW structure
773 *
774 * Enables packet filtering on transmit packets if manageability is enabled
775 * and host interface is enabled.
776 * Currently no func pointer exists and all implementations are handled in the
777 * generic version of this function.
778 **/
811boolean_t
812e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
779bool e1000_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
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)
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 **/
780{
781 return e1000_enable_tx_pkt_filtering_generic(hw);
782}
783
784/**
785 * e1000_mng_host_if_write - Writes to the manageability host interface
786 * @hw: pointer to the HW structure
787 * @buffer: pointer to the host interface buffer
788 * @length: size of the buffer
789 * @offset: location in the buffer to write to
790 * @sum: sum of the data (not checksum)
791 *
792 * This function writes the buffer content at the offset given on the host if.
793 * It also does alignment considerations to do the writes in most efficient
794 * way. Also fills up the sum of the buffer in *buffer parameter.
795 **/
829s32
830e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
831 u16 offset, u8 *sum)
796s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
797 u16 offset, u8 *sum)
832{
798{
833 if (hw->func.mng_host_if_write != NULL)
799 if (hw->func.mng_host_if_write)
834 return hw->func.mng_host_if_write(hw, buffer, length, offset,
835 sum);
800 return hw->func.mng_host_if_write(hw, buffer, length, offset,
801 sum);
836 else
837 return E1000_NOT_IMPLEMENTED;
802
803 return E1000_NOT_IMPLEMENTED;
838}
839
840/**
841 * e1000_mng_write_cmd_header - Writes manageability command header
842 * @hw: pointer to the HW structure
843 * @hdr: pointer to the host interface command header
844 *
845 * Writes the command header after does the checksum calculation.
846 **/
804}
805
806/**
807 * e1000_mng_write_cmd_header - Writes manageability command header
808 * @hw: pointer to the HW structure
809 * @hdr: pointer to the host interface command header
810 *
811 * Writes the command header after does the checksum calculation.
812 **/
847s32
848e1000_mng_write_cmd_header(struct e1000_hw *hw,
849 struct e1000_host_mng_command_header *hdr)
813s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
814 struct e1000_host_mng_command_header *hdr)
850{
815{
851 if (hw->func.mng_write_cmd_header != NULL)
816 if (hw->func.mng_write_cmd_header)
852 return hw->func.mng_write_cmd_header(hw, hdr);
817 return hw->func.mng_write_cmd_header(hw, hdr);
853 else
854 return E1000_NOT_IMPLEMENTED;
818
819 return E1000_NOT_IMPLEMENTED;
855}
856
857/**
858 * e1000_mng_enable_host_if - Checks host interface is enabled
859 * @hw: pointer to the HW structure
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 **/
820}
821
822/**
823 * e1000_mng_enable_host_if - Checks host interface is enabled
824 * @hw: pointer to the HW structure
825 *
826 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
827 *
828 * This function checks whether the HOST IF is enabled for command operaton
829 * and also checks whether the previous command is completed. It busy waits
830 * in case of previous command is not completed.
831 **/
867s32
868e1000_mng_enable_host_if(struct e1000_hw * hw)
832s32 e1000_mng_enable_host_if(struct e1000_hw * hw)
869{
833{
870 if (hw->func.mng_enable_host_if != NULL)
834 if (hw->func.mng_enable_host_if)
871 return hw->func.mng_enable_host_if(hw);
835 return hw->func.mng_enable_host_if(hw);
872 else
873 return E1000_NOT_IMPLEMENTED;
836
837 return E1000_NOT_IMPLEMENTED;
874}
875
876/**
877 * e1000_wait_autoneg - Waits for autonegotiation completion
878 * @hw: pointer to the HW structure
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 **/
838}
839
840/**
841 * e1000_wait_autoneg - Waits for autonegotiation completion
842 * @hw: pointer to the HW structure
843 *
844 * Waits for autoneg to complete. Currently no func pointer exists and all
845 * implementations are handled in the generic version of this function.
846 **/
883s32
884e1000_wait_autoneg(struct e1000_hw *hw)
847s32 e1000_wait_autoneg(struct e1000_hw *hw)
885{
848{
886 if (hw->func.wait_autoneg != NULL)
849 if (hw->func.wait_autoneg)
887 return hw->func.wait_autoneg(hw);
850 return hw->func.wait_autoneg(hw);
888 else
889 return E1000_SUCCESS;
851
852 return E1000_SUCCESS;
890}
891
892/**
893 * e1000_check_reset_block - Verifies PHY can be reset
894 * @hw: pointer to the HW structure
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 **/
853}
854
855/**
856 * e1000_check_reset_block - Verifies PHY can be reset
857 * @hw: pointer to the HW structure
858 *
859 * Checks if the PHY is in a state that can be reset or if manageability
860 * has it tied up. This is a function pointer entry point called by drivers.
861 **/
899s32
900e1000_check_reset_block(struct e1000_hw *hw)
862s32 e1000_check_reset_block(struct e1000_hw *hw)
901{
863{
902 if (hw->func.check_reset_block != NULL)
864 if (hw->func.check_reset_block)
903 return hw->func.check_reset_block(hw);
865 return hw->func.check_reset_block(hw);
904 else
905 return E1000_SUCCESS;
866
867 return E1000_SUCCESS;
906}
907
908/**
909 * e1000_read_phy_reg - Reads PHY register
910 * @hw: pointer to the HW structure
911 * @offset: the register to read
912 * @data: the buffer to store the 16-bit read.
913 *
914 * Reads the PHY register and returns the value in data.
915 * This is a function pointer entry point called by drivers.
916 **/
868}
869
870/**
871 * e1000_read_phy_reg - Reads PHY register
872 * @hw: pointer to the HW structure
873 * @offset: the register to read
874 * @data: the buffer to store the 16-bit read.
875 *
876 * Reads the PHY register and returns the value in data.
877 * This is a function pointer entry point called by drivers.
878 **/
917s32
918e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
879s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
919{
880{
920 if (hw->func.read_phy_reg != NULL)
881 if (hw->func.read_phy_reg)
921 return hw->func.read_phy_reg(hw, offset, data);
882 return hw->func.read_phy_reg(hw, offset, data);
922 else
923 return E1000_SUCCESS;
883
884 return E1000_SUCCESS;
924}
925
926/**
927 * e1000_write_phy_reg - Writes PHY register
928 * @hw: pointer to the HW structure
929 * @offset: the register to write
930 * @data: the value to write.
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 **/
885}
886
887/**
888 * e1000_write_phy_reg - Writes PHY register
889 * @hw: pointer to the HW structure
890 * @offset: the register to write
891 * @data: the value to write.
892 *
893 * Writes the PHY register at offset with the value in data.
894 * This is a function pointer entry point called by drivers.
895 **/
935s32
936e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
896s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
937{
897{
938 if (hw->func.write_phy_reg != NULL)
898 if (hw->func.write_phy_reg)
939 return hw->func.write_phy_reg(hw, offset, data);
899 return hw->func.write_phy_reg(hw, offset, data);
940 else
941 return E1000_SUCCESS;
900
901 return E1000_SUCCESS;
942}
943
944/**
945 * e1000_read_kmrn_reg - Reads register using Kumeran interface
946 * @hw: pointer to the HW structure
947 * @offset: the register to read
948 * @data: the location to store the 16-bit value read.
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 **/
902}
903
904/**
905 * e1000_read_kmrn_reg - Reads register using Kumeran interface
906 * @hw: pointer to the HW structure
907 * @offset: the register to read
908 * @data: the location to store the 16-bit value read.
909 *
910 * Reads a register out of the Kumeran interface. Currently no func pointer
911 * exists and all implementations are handled in the generic version of
912 * this function.
913 **/
954s32
955e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
914s32 e1000_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
962 * @hw: pointer to the HW structure
963 * @offset: the register to write
964 * @data: the value to write.
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 **/
915{
916 return e1000_read_kmrn_reg_generic(hw, offset, data);
917}
918
919/**
920 * e1000_write_kmrn_reg - Writes register using Kumeran interface
921 * @hw: pointer to the HW structure
922 * @offset: the register to write
923 * @data: the value to write.
924 *
925 * Writes a register to the Kumeran interface. Currently no func pointer
926 * exists and all implementations are handled in the generic version of
927 * this function.
928 **/
970s32
971e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
929s32 e1000_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
978 * @hw: pointer to the HW structure
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 **/
930{
931 return e1000_write_kmrn_reg_generic(hw, offset, data);
932}
933
934/**
935 * e1000_get_cable_length - Retrieves cable length estimation
936 * @hw: pointer to the HW structure
937 *
938 * This function estimates the cable length and stores them in
939 * hw->phy.min_length and hw->phy.max_length. This is a function pointer
940 * entry point called by drivers.
941 **/
984s32
985e1000_get_cable_length(struct e1000_hw *hw)
942s32 e1000_get_cable_length(struct e1000_hw *hw)
986{
943{
987 if (hw->func.get_cable_length != NULL)
944 if (hw->func.get_cable_length)
988 return hw->func.get_cable_length(hw);
945 return hw->func.get_cable_length(hw);
989 else
990 return E1000_SUCCESS;
946
947 return E1000_SUCCESS;
991}
992
993/**
994 * e1000_get_phy_info - Retrieves PHY information from registers
995 * @hw: pointer to the HW structure
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 **/
948}
949
950/**
951 * e1000_get_phy_info - Retrieves PHY information from registers
952 * @hw: pointer to the HW structure
953 *
954 * This function gets some information from various PHY registers and
955 * populates hw->phy values with it. This is a function pointer entry
956 * point called by drivers.
957 **/
1001s32
1002e1000_get_phy_info(struct e1000_hw *hw)
958s32 e1000_get_phy_info(struct e1000_hw *hw)
1003{
959{
1004 if (hw->func.get_phy_info != NULL)
960 if (hw->func.get_phy_info)
1005 return hw->func.get_phy_info(hw);
961 return hw->func.get_phy_info(hw);
1006 else
1007 return E1000_SUCCESS;
962
963 return E1000_SUCCESS;
1008}
1009
1010/**
1011 * e1000_phy_hw_reset - Hard PHY reset
1012 * @hw: pointer to the HW structure
1013 *
1014 * Performs a hard PHY reset. This is a function pointer entry point called
1015 * by drivers.
1016 **/
964}
965
966/**
967 * e1000_phy_hw_reset - Hard PHY reset
968 * @hw: pointer to the HW structure
969 *
970 * Performs a hard PHY reset. This is a function pointer entry point called
971 * by drivers.
972 **/
1017s32
1018e1000_phy_hw_reset(struct e1000_hw *hw)
973s32 e1000_phy_hw_reset(struct e1000_hw *hw)
1019{
974{
1020 if (hw->func.reset_phy != NULL)
975 if (hw->func.reset_phy)
1021 return hw->func.reset_phy(hw);
976 return hw->func.reset_phy(hw);
1022 else
1023 return E1000_SUCCESS;
977
978 return E1000_SUCCESS;
1024}
1025
1026/**
1027 * e1000_phy_commit - Soft PHY reset
1028 * @hw: pointer to the HW structure
1029 *
1030 * Performs a soft PHY reset on those that apply. This is a function pointer
1031 * entry point called by drivers.
1032 **/
979}
980
981/**
982 * e1000_phy_commit - Soft PHY reset
983 * @hw: pointer to the HW structure
984 *
985 * Performs a soft PHY reset on those that apply. This is a function pointer
986 * entry point called by drivers.
987 **/
1033s32
1034e1000_phy_commit(struct e1000_hw *hw)
988s32 e1000_phy_commit(struct e1000_hw *hw)
1035{
989{
1036 if (hw->func.commit_phy != NULL)
990 if (hw->func.commit_phy)
1037 return hw->func.commit_phy(hw);
991 return hw->func.commit_phy(hw);
1038 else
1039 return E1000_SUCCESS;
992
993 return E1000_SUCCESS;
1040}
1041
1042/**
1043 * e1000_set_d3_lplu_state - Sets low power link up state for D0
1044 * @hw: pointer to the HW structure
1045 * @active: boolean used to enable/disable lplu
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
1054 * maintained. This is a function pointer entry point called by drivers.
1055 **/
994}
995
996/**
997 * e1000_set_d3_lplu_state - Sets low power link up state for D0
998 * @hw: pointer to the HW structure
999 * @active: boolean used to enable/disable lplu
1000 *
1001 * Success returns 0, Failure returns 1
1002 *
1003 * The low power link up (lplu) state is set to the power management level D0
1004 * and SmartSpeed is disabled when active is true, else clear lplu for D0
1005 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1006 * is used during Dx states where the power conservation is most important.
1007 * During driver activity, SmartSpeed should be enabled so performance is
1008 * maintained. This is a function pointer entry point called by drivers.
1009 **/
1056s32
1057e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active)
1010s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
1058{
1011{
1059 if (hw->func.set_d0_lplu_state != NULL)
1012 if (hw->func.set_d0_lplu_state)
1060 return hw->func.set_d0_lplu_state(hw, active);
1013 return hw->func.set_d0_lplu_state(hw, active);
1061 else
1062 return E1000_SUCCESS;
1014
1015 return E1000_SUCCESS;
1063}
1064
1065/**
1066 * e1000_set_d3_lplu_state - Sets low power link up state for D3
1067 * @hw: pointer to the HW structure
1068 * @active: boolean used to enable/disable lplu
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
1077 * maintained. This is a function pointer entry point called by drivers.
1078 **/
1016}
1017
1018/**
1019 * e1000_set_d3_lplu_state - Sets low power link up state for D3
1020 * @hw: pointer to the HW structure
1021 * @active: boolean used to enable/disable lplu
1022 *
1023 * Success returns 0, Failure returns 1
1024 *
1025 * The low power link up (lplu) state is set to the power management level D3
1026 * and SmartSpeed is disabled when active is true, else clear lplu for D3
1027 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1028 * is used during Dx states where the power conservation is most important.
1029 * During driver activity, SmartSpeed should be enabled so performance is
1030 * maintained. This is a function pointer entry point called by drivers.
1031 **/
1079s32
1080e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active)
1032s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
1081{
1033{
1082 if (hw->func.set_d3_lplu_state != NULL)
1034 if (hw->func.set_d3_lplu_state)
1083 return hw->func.set_d3_lplu_state(hw, active);
1035 return hw->func.set_d3_lplu_state(hw, active);
1084 else
1085 return E1000_SUCCESS;
1036
1037 return E1000_SUCCESS;
1086}
1087
1088/**
1089 * e1000_read_mac_addr - Reads MAC address
1090 * @hw: pointer to the HW structure
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 **/
1038}
1039
1040/**
1041 * e1000_read_mac_addr - Reads MAC address
1042 * @hw: pointer to the HW structure
1043 *
1044 * Reads the MAC address out of the adapter and stores it in the HW structure.
1045 * Currently no func pointer exists and all implementations are handled in the
1046 * generic version of this function.
1047 **/
1096s32
1097e1000_read_mac_addr(struct e1000_hw *hw)
1048s32 e1000_read_mac_addr(struct e1000_hw *hw)
1098{
1049{
1050 if (hw->func.read_mac_addr)
1051 return hw->func.read_mac_addr(hw);
1052
1099 return e1000_read_mac_addr_generic(hw);
1100}
1101
1102/**
1053 return e1000_read_mac_addr_generic(hw);
1054}
1055
1056/**
1103 * e1000_read_part_num - Read device part number
1057 * e1000_read_pba_num - Read device part number
1104 * @hw: pointer to the HW structure
1058 * @hw: pointer to the HW structure
1105 * @part_num: pointer to device part number
1059 * @pba_num: pointer to device part number
1106 *
1107 * Reads the product board assembly (PBA) number from the EEPROM and stores
1060 *
1061 * Reads the product board assembly (PBA) number from the EEPROM and stores
1108 * the value in part_num.
1062 * the value in pba_num.
1109 * Currently no func pointer exists and all implementations are handled in the
1110 * generic version of this function.
1111 **/
1063 * Currently no func pointer exists and all implementations are handled in the
1064 * generic version of this function.
1065 **/
1112s32
1113e1000_read_part_num(struct e1000_hw *hw, u32 *part_num)
1066s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
1114{
1067{
1115 return e1000_read_part_num_generic(hw, part_num);
1068 return e1000_read_pba_num_generic(hw, pba_num);
1116}
1117
1118/**
1119 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1120 * @hw: pointer to the HW structure
1121 *
1122 * Validates the NVM checksum is correct. This is a function pointer entry
1123 * point called by drivers.
1124 **/
1069}
1070
1071/**
1072 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1073 * @hw: pointer to the HW structure
1074 *
1075 * Validates the NVM checksum is correct. This is a function pointer entry
1076 * point called by drivers.
1077 **/
1125s32
1126e1000_validate_nvm_checksum(struct e1000_hw *hw)
1078s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
1127{
1079{
1128 if (hw->func.validate_nvm != NULL)
1080 if (hw->func.validate_nvm)
1129 return hw->func.validate_nvm(hw);
1081 return hw->func.validate_nvm(hw);
1130 else
1131 return -E1000_ERR_CONFIG;
1082
1083 return -E1000_ERR_CONFIG;
1132}
1133
1134/**
1135 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1136 * @hw: pointer to the HW structure
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 **/
1084}
1085
1086/**
1087 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1088 * @hw: pointer to the HW structure
1089 *
1090 * Updates the NVM checksum. Currently no func pointer exists and all
1091 * implementations are handled in the generic version of this function.
1092 **/
1141s32
1142e1000_update_nvm_checksum(struct e1000_hw *hw)
1093s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
1143{
1094{
1144 if (hw->func.update_nvm != NULL)
1095 if (hw->func.update_nvm)
1145 return hw->func.update_nvm(hw);
1096 return hw->func.update_nvm(hw);
1146 else
1147 return -E1000_ERR_CONFIG;
1097
1098 return -E1000_ERR_CONFIG;
1148}
1149
1150/**
1151 * e1000_reload_nvm - Reloads EEPROM
1152 * @hw: pointer to the HW structure
1153 *
1154 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1155 * extended control register.
1156 **/
1099}
1100
1101/**
1102 * e1000_reload_nvm - Reloads EEPROM
1103 * @hw: pointer to the HW structure
1104 *
1105 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1106 * extended control register.
1107 **/
1157void
1158e1000_reload_nvm(struct e1000_hw *hw)
1108void e1000_reload_nvm(struct e1000_hw *hw)
1159{
1109{
1160 if (hw->func.reload_nvm != NULL)
1110 if (hw->func.reload_nvm)
1161 hw->func.reload_nvm(hw);
1162}
1163
1164/**
1165 * e1000_read_nvm - Reads NVM (EEPROM)
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.
1170 *
1171 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1172 * pointer entry point called by drivers.
1173 **/
1111 hw->func.reload_nvm(hw);
1112}
1113
1114/**
1115 * e1000_read_nvm - Reads NVM (EEPROM)
1116 * @hw: pointer to the HW structure
1117 * @offset: the word offset to read
1118 * @words: number of 16-bit words to read
1119 * @data: pointer to the properly sized buffer for the data.
1120 *
1121 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1122 * pointer entry point called by drivers.
1123 **/
1174s32
1175e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1124s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1176{
1125{
1177 if (hw->func.read_nvm != NULL)
1126 if (hw->func.read_nvm)
1178 return hw->func.read_nvm(hw, offset, words, data);
1127 return hw->func.read_nvm(hw, offset, words, data);
1179 else
1180 return -E1000_ERR_CONFIG;
1128
1129 return -E1000_ERR_CONFIG;
1181}
1182
1183/**
1184 * e1000_write_nvm - Writes to NVM (EEPROM)
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.
1189 *
1190 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1191 * pointer entry point called by drivers.
1192 **/
1130}
1131
1132/**
1133 * e1000_write_nvm - Writes to NVM (EEPROM)
1134 * @hw: pointer to the HW structure
1135 * @offset: the word offset to read
1136 * @words: number of 16-bit words to write
1137 * @data: pointer to the properly sized buffer for the data.
1138 *
1139 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1140 * pointer entry point called by drivers.
1141 **/
1193s32
1194e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1142s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1195{
1143{
1196 if (hw->func.write_nvm != NULL)
1144 if (hw->func.write_nvm)
1197 return hw->func.write_nvm(hw, offset, words, data);
1145 return hw->func.write_nvm(hw, offset, words, data);
1198 else
1199 return E1000_SUCCESS;
1146
1147 return E1000_SUCCESS;
1200}
1201
1202/**
1203 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1204 * @hw: pointer to the HW structure
1205 * @reg: 32bit register offset
1206 * @offset: the register to write
1207 * @data: the value to write.
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 **/
1148}
1149
1150/**
1151 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1152 * @hw: pointer to the HW structure
1153 * @reg: 32bit register offset
1154 * @offset: the register to write
1155 * @data: the value to write.
1156 *
1157 * Writes the PHY register at offset with the value in data.
1158 * This is a function pointer entry point called by drivers.
1159 **/
1212s32
1213e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
1160s32 e1000_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}
1161{
1162 return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1163}
1164
1165/**
1166 * e1000_power_up_phy - Restores link in case of PHY power down
1167 * @hw: pointer to the HW structure
1168 *
1169 * The phy may be powered down to save power, to turn off link when the
1170 * driver is unloaded, or wake on lan is not enabled (among others).
1171 **/
1172void e1000_power_up_phy(struct e1000_hw *hw)
1173{
1174 if (hw->func.power_up_phy)
1175 hw->func.power_up_phy(hw);
1176
1177 e1000_setup_link(hw);
1178}
1179
1180/**
1181 * e1000_power_down_phy - Power down PHY
1182 * @hw: pointer to the HW structure
1183 *
1184 * The phy may be powered down to save power, to turn off link when the
1185 * driver is unloaded, or wake on lan is not enabled (among others).
1186 **/
1187void e1000_power_down_phy(struct e1000_hw *hw)
1188{
1189 if (hw->func.power_down_phy)
1190 hw->func.power_down_phy(hw);
1191}
1192