Deleted Added
full compact
e1000_api.c (225736) e1000_api.c (235527)
1/******************************************************************************
2
1/******************************************************************************
2
3 Copyright (c) 2001-2010, Intel Corporation
3 Copyright (c) 2001-2011, 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
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11

--- 13 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******************************************************************************/
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
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11

--- 13 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: stable/9/sys/dev/e1000/e1000_api.c 218530 2011-02-11 01:00:26Z jfv $*/
33/*$FreeBSD: stable/9/sys/dev/e1000/e1000_api.c 235527 2012-05-16 22:22:52Z jfv $*/
34
35#include "e1000_api.h"
36
37/**
38 * e1000_init_mac_params - Initialize MAC function pointers
39 * @hw: pointer to the HW structure
40 *
41 * This function initializes the function pointers for the MAC

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

272 case E1000_DEV_ID_ICH10_R_BM_LM:
273 case E1000_DEV_ID_ICH10_R_BM_LF:
274 case E1000_DEV_ID_ICH10_R_BM_V:
275 mac->type = e1000_ich9lan;
276 break;
277 case E1000_DEV_ID_ICH10_D_BM_LM:
278 case E1000_DEV_ID_ICH10_D_BM_LF:
279 case E1000_DEV_ID_ICH10_D_BM_V:
34
35#include "e1000_api.h"
36
37/**
38 * e1000_init_mac_params - Initialize MAC function pointers
39 * @hw: pointer to the HW structure
40 *
41 * This function initializes the function pointers for the MAC

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

272 case E1000_DEV_ID_ICH10_R_BM_LM:
273 case E1000_DEV_ID_ICH10_R_BM_LF:
274 case E1000_DEV_ID_ICH10_R_BM_V:
275 mac->type = e1000_ich9lan;
276 break;
277 case E1000_DEV_ID_ICH10_D_BM_LM:
278 case E1000_DEV_ID_ICH10_D_BM_LF:
279 case E1000_DEV_ID_ICH10_D_BM_V:
280 case E1000_DEV_ID_ICH10_HANKSVILLE:
281 mac->type = e1000_ich10lan;
282 break;
283 case E1000_DEV_ID_PCH_D_HV_DM:
284 case E1000_DEV_ID_PCH_D_HV_DC:
285 case E1000_DEV_ID_PCH_M_HV_LM:
286 case E1000_DEV_ID_PCH_M_HV_LC:
287 mac->type = e1000_pchlan;
288 break;
289 case E1000_DEV_ID_PCH2_LV_LM:
290 case E1000_DEV_ID_PCH2_LV_V:
291 mac->type = e1000_pch2lan;
292 break;
293 case E1000_DEV_ID_82575EB_COPPER:
294 case E1000_DEV_ID_82575EB_FIBER_SERDES:
295 case E1000_DEV_ID_82575GB_QUAD_COPPER:
280 mac->type = e1000_ich10lan;
281 break;
282 case E1000_DEV_ID_PCH_D_HV_DM:
283 case E1000_DEV_ID_PCH_D_HV_DC:
284 case E1000_DEV_ID_PCH_M_HV_LM:
285 case E1000_DEV_ID_PCH_M_HV_LC:
286 mac->type = e1000_pchlan;
287 break;
288 case E1000_DEV_ID_PCH2_LV_LM:
289 case E1000_DEV_ID_PCH2_LV_V:
290 mac->type = e1000_pch2lan;
291 break;
292 case E1000_DEV_ID_82575EB_COPPER:
293 case E1000_DEV_ID_82575EB_FIBER_SERDES:
294 case E1000_DEV_ID_82575GB_QUAD_COPPER:
296 case E1000_DEV_ID_82575GB_QUAD_COPPER_PM:
297 mac->type = e1000_82575;
298 break;
299 case E1000_DEV_ID_82576:
300 case E1000_DEV_ID_82576_FIBER:
301 case E1000_DEV_ID_82576_SERDES:
302 case E1000_DEV_ID_82576_QUAD_COPPER:
303 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
304 case E1000_DEV_ID_82576_NS:

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

317 case E1000_DEV_ID_DH89XXCC_BACKPLANE:
318 case E1000_DEV_ID_DH89XXCC_SFP:
319 mac->type = e1000_82580;
320 break;
321 case E1000_DEV_ID_I350_COPPER:
322 case E1000_DEV_ID_I350_FIBER:
323 case E1000_DEV_ID_I350_SERDES:
324 case E1000_DEV_ID_I350_SGMII:
295 mac->type = e1000_82575;
296 break;
297 case E1000_DEV_ID_82576:
298 case E1000_DEV_ID_82576_FIBER:
299 case E1000_DEV_ID_82576_SERDES:
300 case E1000_DEV_ID_82576_QUAD_COPPER:
301 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
302 case E1000_DEV_ID_82576_NS:

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

315 case E1000_DEV_ID_DH89XXCC_BACKPLANE:
316 case E1000_DEV_ID_DH89XXCC_SFP:
317 mac->type = e1000_82580;
318 break;
319 case E1000_DEV_ID_I350_COPPER:
320 case E1000_DEV_ID_I350_FIBER:
321 case E1000_DEV_ID_I350_SERDES:
322 case E1000_DEV_ID_I350_SGMII:
323 case E1000_DEV_ID_I350_DA4:
325 mac->type = e1000_i350;
326 break;
327 case E1000_DEV_ID_82576_VF:
328 mac->type = e1000_vfadapt;
329 break;
330 case E1000_DEV_ID_I350_VF:
331 mac->type = e1000_vfadapt_i350;
332 break;

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

338
339 return ret_val;
340}
341
342/**
343 * e1000_setup_init_funcs - Initializes function pointers
344 * @hw: pointer to the HW structure
345 * @init_device: TRUE will initialize the rest of the function pointers
324 mac->type = e1000_i350;
325 break;
326 case E1000_DEV_ID_82576_VF:
327 mac->type = e1000_vfadapt;
328 break;
329 case E1000_DEV_ID_I350_VF:
330 mac->type = e1000_vfadapt_i350;
331 break;

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

337
338 return ret_val;
339}
340
341/**
342 * e1000_setup_init_funcs - Initializes function pointers
343 * @hw: pointer to the HW structure
344 * @init_device: TRUE will initialize the rest of the function pointers
346 * getting the device ready for use. FALSE will only set
347 * MAC type and the function pointers for the other init
348 * functions. Passing FALSE will not generate any hardware
349 * reads or writes.
345 * getting the device ready for use. FALSE will only set
346 * MAC type and the function pointers for the other init
347 * functions. Passing FALSE will not generate any hardware
348 * reads or writes.
350 *
351 * This function must be called by a driver in order to use the rest
352 * of the 'shared' code files. Called by drivers only.
353 **/
354s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
355{
356 s32 ret_val;
357

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

513 * @hw: pointer to the HW structure
514 * @mc_addr_list: array of multicast addresses to program
515 * @mc_addr_count: number of multicast addresses to program
516 *
517 * Updates the Multicast Table Array.
518 * The caller must have a packed mc_addr_list of multicast addresses.
519 **/
520void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
349 *
350 * This function must be called by a driver in order to use the rest
351 * of the 'shared' code files. Called by drivers only.
352 **/
353s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
354{
355 s32 ret_val;
356

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

512 * @hw: pointer to the HW structure
513 * @mc_addr_list: array of multicast addresses to program
514 * @mc_addr_count: number of multicast addresses to program
515 *
516 * Updates the Multicast Table Array.
517 * The caller must have a packed mc_addr_list of multicast addresses.
518 **/
519void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
521 u32 mc_addr_count)
520 u32 mc_addr_count)
522{
523 if (hw->mac.ops.update_mc_addr_list)
524 hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
521{
522 if (hw->mac.ops.update_mc_addr_list)
523 hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
525 mc_addr_count);
524 mc_addr_count);
526}
527
528/**
529 * e1000_force_mac_fc - Force MAC flow control
530 * @hw: pointer to the HW structure
531 *
532 * Force the MAC's flow control settings. Currently no func pointer exists
533 * and all implementations are handled in the generic version of this

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

851 * @length: size of the buffer
852 * @offset: location in the buffer to write to
853 * @sum: sum of the data (not checksum)
854 *
855 * This function writes the buffer content at the offset given on the host if.
856 * It also does alignment considerations to do the writes in most efficient
857 * way. Also fills up the sum of the buffer in *buffer parameter.
858 **/
525}
526
527/**
528 * e1000_force_mac_fc - Force MAC flow control
529 * @hw: pointer to the HW structure
530 *
531 * Force the MAC's flow control settings. Currently no func pointer exists
532 * and all implementations are handled in the generic version of this

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

850 * @length: size of the buffer
851 * @offset: location in the buffer to write to
852 * @sum: sum of the data (not checksum)
853 *
854 * This function writes the buffer content at the offset given on the host if.
855 * It also does alignment considerations to do the writes in most efficient
856 * way. Also fills up the sum of the buffer in *buffer parameter.
857 **/
859s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
860 u16 offset, u8 *sum)
858s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
859 u16 offset, u8 *sum)
861{
862 if (hw->mac.ops.mng_host_if_write)
863 return hw->mac.ops.mng_host_if_write(hw, buffer, length,
860{
861 if (hw->mac.ops.mng_host_if_write)
862 return hw->mac.ops.mng_host_if_write(hw, buffer, length,
864 offset, sum);
863 offset, sum);
865
866 return E1000_NOT_IMPLEMENTED;
867}
868
869/**
870 * e1000_mng_write_cmd_header - Writes manageability command header
871 * @hw: pointer to the HW structure
872 * @hdr: pointer to the host interface command header
873 *
874 * Writes the command header after does the checksum calculation.
875 **/
876s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
864
865 return E1000_NOT_IMPLEMENTED;
866}
867
868/**
869 * e1000_mng_write_cmd_header - Writes manageability command header
870 * @hw: pointer to the HW structure
871 * @hdr: pointer to the host interface command header
872 *
873 * Writes the command header after does the checksum calculation.
874 **/
875s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
877 struct e1000_host_mng_command_header *hdr)
876 struct e1000_host_mng_command_header *hdr)
878{
879 if (hw->mac.ops.mng_write_cmd_header)
880 return hw->mac.ops.mng_write_cmd_header(hw, hdr);
881
882 return E1000_NOT_IMPLEMENTED;
883}
884
885/**
886 * e1000_mng_enable_host_if - Checks host interface is enabled
887 * @hw: pointer to the HW structure
888 *
889 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
890 *
891 * This function checks whether the HOST IF is enabled for command operation
892 * and also checks whether the previous command is completed. It busy waits
893 * in case of previous command is not completed.
894 **/
877{
878 if (hw->mac.ops.mng_write_cmd_header)
879 return hw->mac.ops.mng_write_cmd_header(hw, hdr);
880
881 return E1000_NOT_IMPLEMENTED;
882}
883
884/**
885 * e1000_mng_enable_host_if - Checks host interface is enabled
886 * @hw: pointer to the HW structure
887 *
888 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
889 *
890 * This function checks whether the HOST IF is enabled for command operation
891 * and also checks whether the previous command is completed. It busy waits
892 * in case of previous command is not completed.
893 **/
895s32 e1000_mng_enable_host_if(struct e1000_hw * hw)
894s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
896{
897 if (hw->mac.ops.mng_enable_host_if)
898 return hw->mac.ops.mng_enable_host_if(hw);
899
900 return E1000_NOT_IMPLEMENTED;
901}
902
903/**

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

1272 * @reg: 32bit register offset
1273 * @offset: the register to write
1274 * @data: the value to write.
1275 *
1276 * Writes the PHY register at offset with the value in data.
1277 * This is a function pointer entry point called by drivers.
1278 **/
1279s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
895{
896 if (hw->mac.ops.mng_enable_host_if)
897 return hw->mac.ops.mng_enable_host_if(hw);
898
899 return E1000_NOT_IMPLEMENTED;
900}
901
902/**

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

1271 * @reg: 32bit register offset
1272 * @offset: the register to write
1273 * @data: the value to write.
1274 *
1275 * Writes the PHY register at offset with the value in data.
1276 * This is a function pointer entry point called by drivers.
1277 **/
1278s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
1280 u8 data)
1279 u8 data)
1281{
1282 return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1283}
1284
1285/**
1286 * e1000_power_up_phy - Restores link in case of PHY power down
1287 * @hw: pointer to the HW structure
1288 *

--- 48 unchanged lines hidden ---
1280{
1281 return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1282}
1283
1284/**
1285 * e1000_power_up_phy - Restores link in case of PHY power down
1286 * @hw: pointer to the HW structure
1287 *

--- 48 unchanged lines hidden ---