e1000_api.c revision 247064
1177867Sjfv/******************************************************************************
2169240Sjfv
3247064Sjfv  Copyright (c) 2001-2013, Intel Corporation
4169240Sjfv  All rights reserved.
5169240Sjfv
6169240Sjfv  Redistribution and use in source and binary forms, with or without
7169240Sjfv  modification, are permitted provided that the following conditions are met:
8169240Sjfv
9169240Sjfv   1. Redistributions of source code must retain the above copyright notice,
10169240Sjfv      this list of conditions and the following disclaimer.
11169240Sjfv
12169240Sjfv   2. Redistributions in binary form must reproduce the above copyright
13169240Sjfv      notice, this list of conditions and the following disclaimer in the
14169240Sjfv      documentation and/or other materials provided with the distribution.
15169240Sjfv
16169240Sjfv   3. Neither the name of the Intel Corporation nor the names of its
17169240Sjfv      contributors may be used to endorse or promote products derived from
18169240Sjfv      this software without specific prior written permission.
19169240Sjfv
20169240Sjfv  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21169240Sjfv  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22169240Sjfv  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23169240Sjfv  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24169240Sjfv  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25169240Sjfv  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26169240Sjfv  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27169240Sjfv  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28169240Sjfv  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29169240Sjfv  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30169240Sjfv  POSSIBILITY OF SUCH DAMAGE.
31169240Sjfv
32177867Sjfv******************************************************************************/
33177867Sjfv/*$FreeBSD: head/sys/dev/e1000/e1000_api.c 247064 2013-02-21 00:25:45Z jfv $*/
34169240Sjfv
35169589Sjfv#include "e1000_api.h"
36169240Sjfv
37169240Sjfv/**
38169240Sjfv *  e1000_init_mac_params - Initialize MAC function pointers
39169589Sjfv *  @hw: pointer to the HW structure
40169240Sjfv *
41169240Sjfv *  This function initializes the function pointers for the MAC
42169240Sjfv *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
43169240Sjfv **/
44173788Sjfvs32 e1000_init_mac_params(struct e1000_hw *hw)
45169240Sjfv{
46169240Sjfv	s32 ret_val = E1000_SUCCESS;
47169240Sjfv
48177867Sjfv	if (hw->mac.ops.init_params) {
49177867Sjfv		ret_val = hw->mac.ops.init_params(hw);
50169240Sjfv		if (ret_val) {
51169240Sjfv			DEBUGOUT("MAC Initialization Error\n");
52169240Sjfv			goto out;
53169240Sjfv		}
54169240Sjfv	} else {
55169240Sjfv		DEBUGOUT("mac.init_mac_params was NULL\n");
56169240Sjfv		ret_val = -E1000_ERR_CONFIG;
57169240Sjfv	}
58169240Sjfv
59169240Sjfvout:
60169240Sjfv	return ret_val;
61169240Sjfv}
62169240Sjfv
63169240Sjfv/**
64169240Sjfv *  e1000_init_nvm_params - Initialize NVM function pointers
65169589Sjfv *  @hw: pointer to the HW structure
66169240Sjfv *
67169240Sjfv *  This function initializes the function pointers for the NVM
68169240Sjfv *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
69169240Sjfv **/
70173788Sjfvs32 e1000_init_nvm_params(struct e1000_hw *hw)
71169240Sjfv{
72169240Sjfv	s32 ret_val = E1000_SUCCESS;
73169240Sjfv
74177867Sjfv	if (hw->nvm.ops.init_params) {
75177867Sjfv		ret_val = hw->nvm.ops.init_params(hw);
76169240Sjfv		if (ret_val) {
77169240Sjfv			DEBUGOUT("NVM Initialization Error\n");
78169240Sjfv			goto out;
79169240Sjfv		}
80169240Sjfv	} else {
81169240Sjfv		DEBUGOUT("nvm.init_nvm_params was NULL\n");
82169240Sjfv		ret_val = -E1000_ERR_CONFIG;
83169240Sjfv	}
84169240Sjfv
85169240Sjfvout:
86169240Sjfv	return ret_val;
87169240Sjfv}
88169240Sjfv
89169240Sjfv/**
90169240Sjfv *  e1000_init_phy_params - Initialize PHY function pointers
91169589Sjfv *  @hw: pointer to the HW structure
92169240Sjfv *
93169240Sjfv *  This function initializes the function pointers for the PHY
94169240Sjfv *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
95169240Sjfv **/
96173788Sjfvs32 e1000_init_phy_params(struct e1000_hw *hw)
97169240Sjfv{
98169240Sjfv	s32 ret_val = E1000_SUCCESS;
99169240Sjfv
100177867Sjfv	if (hw->phy.ops.init_params) {
101177867Sjfv		ret_val = hw->phy.ops.init_params(hw);
102169240Sjfv		if (ret_val) {
103169240Sjfv			DEBUGOUT("PHY Initialization Error\n");
104169240Sjfv			goto out;
105169240Sjfv		}
106169240Sjfv	} else {
107169240Sjfv		DEBUGOUT("phy.init_phy_params was NULL\n");
108169240Sjfv		ret_val =  -E1000_ERR_CONFIG;
109169240Sjfv	}
110169240Sjfv
111169240Sjfvout:
112169240Sjfv	return ret_val;
113169240Sjfv}
114169240Sjfv
115209616Sjfv/**
116209616Sjfv *  e1000_init_mbx_params - Initialize mailbox function pointers
117209616Sjfv *  @hw: pointer to the HW structure
118209616Sjfv *
119209616Sjfv *  This function initializes the function pointers for the PHY
120209616Sjfv *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
121209616Sjfv **/
122209616Sjfvs32 e1000_init_mbx_params(struct e1000_hw *hw)
123209616Sjfv{
124209616Sjfv	s32 ret_val = E1000_SUCCESS;
125190872Sjfv
126209616Sjfv	if (hw->mbx.ops.init_params) {
127209616Sjfv		ret_val = hw->mbx.ops.init_params(hw);
128209616Sjfv		if (ret_val) {
129209616Sjfv			DEBUGOUT("Mailbox Initialization Error\n");
130209616Sjfv			goto out;
131209616Sjfv		}
132209616Sjfv	} else {
133209616Sjfv		DEBUGOUT("mbx.init_mbx_params was NULL\n");
134209616Sjfv		ret_val =  -E1000_ERR_CONFIG;
135209616Sjfv	}
136209616Sjfv
137209616Sjfvout:
138209616Sjfv	return ret_val;
139209616Sjfv}
140209616Sjfv
141169240Sjfv/**
142169240Sjfv *  e1000_set_mac_type - Sets MAC type
143169589Sjfv *  @hw: pointer to the HW structure
144169240Sjfv *
145169240Sjfv *  This function sets the mac type of the adapter based on the
146169240Sjfv *  device ID stored in the hw structure.
147169240Sjfv *  MUST BE FIRST FUNCTION CALLED (explicitly or through
148169240Sjfv *  e1000_setup_init_funcs()).
149169240Sjfv **/
150173788Sjfvs32 e1000_set_mac_type(struct e1000_hw *hw)
151169240Sjfv{
152169240Sjfv	struct e1000_mac_info *mac = &hw->mac;
153169240Sjfv	s32 ret_val = E1000_SUCCESS;
154169240Sjfv
155169240Sjfv	DEBUGFUNC("e1000_set_mac_type");
156169240Sjfv
157169240Sjfv	switch (hw->device_id) {
158169240Sjfv	case E1000_DEV_ID_82542:
159169240Sjfv		mac->type = e1000_82542;
160169240Sjfv		break;
161169240Sjfv	case E1000_DEV_ID_82543GC_FIBER:
162169240Sjfv	case E1000_DEV_ID_82543GC_COPPER:
163169240Sjfv		mac->type = e1000_82543;
164169240Sjfv		break;
165169240Sjfv	case E1000_DEV_ID_82544EI_COPPER:
166169240Sjfv	case E1000_DEV_ID_82544EI_FIBER:
167169240Sjfv	case E1000_DEV_ID_82544GC_COPPER:
168169240Sjfv	case E1000_DEV_ID_82544GC_LOM:
169169240Sjfv		mac->type = e1000_82544;
170169240Sjfv		break;
171169240Sjfv	case E1000_DEV_ID_82540EM:
172169240Sjfv	case E1000_DEV_ID_82540EM_LOM:
173169240Sjfv	case E1000_DEV_ID_82540EP:
174169240Sjfv	case E1000_DEV_ID_82540EP_LOM:
175169240Sjfv	case E1000_DEV_ID_82540EP_LP:
176169240Sjfv		mac->type = e1000_82540;
177169240Sjfv		break;
178169240Sjfv	case E1000_DEV_ID_82545EM_COPPER:
179169240Sjfv	case E1000_DEV_ID_82545EM_FIBER:
180169240Sjfv		mac->type = e1000_82545;
181169240Sjfv		break;
182169240Sjfv	case E1000_DEV_ID_82545GM_COPPER:
183169240Sjfv	case E1000_DEV_ID_82545GM_FIBER:
184169240Sjfv	case E1000_DEV_ID_82545GM_SERDES:
185169240Sjfv		mac->type = e1000_82545_rev_3;
186169240Sjfv		break;
187169240Sjfv	case E1000_DEV_ID_82546EB_COPPER:
188169240Sjfv	case E1000_DEV_ID_82546EB_FIBER:
189169240Sjfv	case E1000_DEV_ID_82546EB_QUAD_COPPER:
190169240Sjfv		mac->type = e1000_82546;
191169240Sjfv		break;
192169240Sjfv	case E1000_DEV_ID_82546GB_COPPER:
193169240Sjfv	case E1000_DEV_ID_82546GB_FIBER:
194169240Sjfv	case E1000_DEV_ID_82546GB_SERDES:
195169240Sjfv	case E1000_DEV_ID_82546GB_PCIE:
196169240Sjfv	case E1000_DEV_ID_82546GB_QUAD_COPPER:
197169240Sjfv	case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
198169240Sjfv		mac->type = e1000_82546_rev_3;
199169240Sjfv		break;
200169240Sjfv	case E1000_DEV_ID_82541EI:
201169240Sjfv	case E1000_DEV_ID_82541EI_MOBILE:
202169240Sjfv	case E1000_DEV_ID_82541ER_LOM:
203169240Sjfv		mac->type = e1000_82541;
204169240Sjfv		break;
205169240Sjfv	case E1000_DEV_ID_82541ER:
206169240Sjfv	case E1000_DEV_ID_82541GI:
207169240Sjfv	case E1000_DEV_ID_82541GI_LF:
208169240Sjfv	case E1000_DEV_ID_82541GI_MOBILE:
209169240Sjfv		mac->type = e1000_82541_rev_2;
210169240Sjfv		break;
211169240Sjfv	case E1000_DEV_ID_82547EI:
212169240Sjfv	case E1000_DEV_ID_82547EI_MOBILE:
213169240Sjfv		mac->type = e1000_82547;
214169240Sjfv		break;
215169240Sjfv	case E1000_DEV_ID_82547GI:
216169240Sjfv		mac->type = e1000_82547_rev_2;
217169240Sjfv		break;
218169240Sjfv	case E1000_DEV_ID_82571EB_COPPER:
219169240Sjfv	case E1000_DEV_ID_82571EB_FIBER:
220169240Sjfv	case E1000_DEV_ID_82571EB_SERDES:
221169589Sjfv	case E1000_DEV_ID_82571EB_SERDES_DUAL:
222169589Sjfv	case E1000_DEV_ID_82571EB_SERDES_QUAD:
223169240Sjfv	case E1000_DEV_ID_82571EB_QUAD_COPPER:
224173788Sjfv	case E1000_DEV_ID_82571PT_QUAD_COPPER:
225169240Sjfv	case E1000_DEV_ID_82571EB_QUAD_FIBER:
226169240Sjfv	case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
227169240Sjfv		mac->type = e1000_82571;
228169240Sjfv		break;
229169240Sjfv	case E1000_DEV_ID_82572EI:
230169240Sjfv	case E1000_DEV_ID_82572EI_COPPER:
231169240Sjfv	case E1000_DEV_ID_82572EI_FIBER:
232169240Sjfv	case E1000_DEV_ID_82572EI_SERDES:
233169240Sjfv		mac->type = e1000_82572;
234169240Sjfv		break;
235169240Sjfv	case E1000_DEV_ID_82573E:
236169240Sjfv	case E1000_DEV_ID_82573E_IAMT:
237169240Sjfv	case E1000_DEV_ID_82573L:
238169240Sjfv		mac->type = e1000_82573;
239169240Sjfv		break;
240178523Sjfv	case E1000_DEV_ID_82574L:
241194865Sjfv	case E1000_DEV_ID_82574LA:
242178523Sjfv		mac->type = e1000_82574;
243178523Sjfv		break;
244194865Sjfv	case E1000_DEV_ID_82583V:
245194865Sjfv		mac->type = e1000_82583;
246194865Sjfv		break;
247169240Sjfv	case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
248169240Sjfv	case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
249169240Sjfv	case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
250169240Sjfv	case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
251169240Sjfv		mac->type = e1000_80003es2lan;
252169240Sjfv		break;
253169240Sjfv	case E1000_DEV_ID_ICH8_IFE:
254169240Sjfv	case E1000_DEV_ID_ICH8_IFE_GT:
255169240Sjfv	case E1000_DEV_ID_ICH8_IFE_G:
256169240Sjfv	case E1000_DEV_ID_ICH8_IGP_M:
257169240Sjfv	case E1000_DEV_ID_ICH8_IGP_M_AMT:
258169240Sjfv	case E1000_DEV_ID_ICH8_IGP_AMT:
259169240Sjfv	case E1000_DEV_ID_ICH8_IGP_C:
260200243Sjfv	case E1000_DEV_ID_ICH8_82567V_3:
261169240Sjfv		mac->type = e1000_ich8lan;
262169240Sjfv		break;
263169240Sjfv	case E1000_DEV_ID_ICH9_IFE:
264169240Sjfv	case E1000_DEV_ID_ICH9_IFE_GT:
265169240Sjfv	case E1000_DEV_ID_ICH9_IFE_G:
266176667Sjfv	case E1000_DEV_ID_ICH9_IGP_M:
267176667Sjfv	case E1000_DEV_ID_ICH9_IGP_M_AMT:
268177867Sjfv	case E1000_DEV_ID_ICH9_IGP_M_V:
269169240Sjfv	case E1000_DEV_ID_ICH9_IGP_AMT:
270178523Sjfv	case E1000_DEV_ID_ICH9_BM:
271169240Sjfv	case E1000_DEV_ID_ICH9_IGP_C:
272178523Sjfv	case E1000_DEV_ID_ICH10_R_BM_LM:
273178523Sjfv	case E1000_DEV_ID_ICH10_R_BM_LF:
274178523Sjfv	case E1000_DEV_ID_ICH10_R_BM_V:
275169240Sjfv		mac->type = e1000_ich9lan;
276169240Sjfv		break;
277178523Sjfv	case E1000_DEV_ID_ICH10_D_BM_LM:
278178523Sjfv	case E1000_DEV_ID_ICH10_D_BM_LF:
279213234Sjfv	case E1000_DEV_ID_ICH10_D_BM_V:
280178523Sjfv		mac->type = e1000_ich10lan;
281178523Sjfv		break;
282194865Sjfv	case E1000_DEV_ID_PCH_D_HV_DM:
283194865Sjfv	case E1000_DEV_ID_PCH_D_HV_DC:
284194865Sjfv	case E1000_DEV_ID_PCH_M_HV_LM:
285194865Sjfv	case E1000_DEV_ID_PCH_M_HV_LC:
286194865Sjfv		mac->type = e1000_pchlan;
287194865Sjfv		break;
288213234Sjfv	case E1000_DEV_ID_PCH2_LV_LM:
289213234Sjfv	case E1000_DEV_ID_PCH2_LV_V:
290213234Sjfv		mac->type = e1000_pch2lan;
291213234Sjfv		break;
292247064Sjfv	case E1000_DEV_ID_PCH_LPT_I217_LM:
293247064Sjfv	case E1000_DEV_ID_PCH_LPT_I217_V:
294247064Sjfv	case E1000_DEV_ID_PCH_LPTLP_I218_LM:
295247064Sjfv	case E1000_DEV_ID_PCH_LPTLP_I218_V:
296247064Sjfv		mac->type = e1000_pch_lpt;
297247064Sjfv		break;
298177867Sjfv	case E1000_DEV_ID_82575EB_COPPER:
299177867Sjfv	case E1000_DEV_ID_82575EB_FIBER_SERDES:
300177867Sjfv	case E1000_DEV_ID_82575GB_QUAD_COPPER:
301177867Sjfv		mac->type = e1000_82575;
302169240Sjfv		break;
303181027Sjfv	case E1000_DEV_ID_82576:
304181027Sjfv	case E1000_DEV_ID_82576_FIBER:
305181027Sjfv	case E1000_DEV_ID_82576_SERDES:
306181027Sjfv	case E1000_DEV_ID_82576_QUAD_COPPER:
307213234Sjfv	case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
308190872Sjfv	case E1000_DEV_ID_82576_NS:
309200243Sjfv	case E1000_DEV_ID_82576_NS_SERDES:
310194865Sjfv	case E1000_DEV_ID_82576_SERDES_QUAD:
311181027Sjfv		mac->type = e1000_82576;
312181027Sjfv		break;
313200243Sjfv	case E1000_DEV_ID_82580_COPPER:
314200243Sjfv	case E1000_DEV_ID_82580_FIBER:
315200243Sjfv	case E1000_DEV_ID_82580_SERDES:
316200243Sjfv	case E1000_DEV_ID_82580_SGMII:
317200243Sjfv	case E1000_DEV_ID_82580_COPPER_DUAL:
318213234Sjfv	case E1000_DEV_ID_82580_QUAD_FIBER:
319215789Sjfv	case E1000_DEV_ID_DH89XXCC_SGMII:
320215789Sjfv	case E1000_DEV_ID_DH89XXCC_SERDES:
321218530Sjfv	case E1000_DEV_ID_DH89XXCC_BACKPLANE:
322218530Sjfv	case E1000_DEV_ID_DH89XXCC_SFP:
323200243Sjfv		mac->type = e1000_82580;
324200243Sjfv		break;
325218530Sjfv	case E1000_DEV_ID_I350_COPPER:
326218530Sjfv	case E1000_DEV_ID_I350_FIBER:
327218530Sjfv	case E1000_DEV_ID_I350_SERDES:
328218530Sjfv	case E1000_DEV_ID_I350_SGMII:
329228386Sjfv	case E1000_DEV_ID_I350_DA4:
330218530Sjfv		mac->type = e1000_i350;
331218530Sjfv		break;
332247064Sjfv#if defined(QV_RELEASE) && defined(SPRINGVILLE_FLASHLESS_HW)
333247064Sjfv	case E1000_DEV_ID_I210_NVMLESS:
334247064Sjfv#endif /* QV_RELEASE && SPRINGVILLE_FLASHLESS_HW */
335238148Sjfv	case E1000_DEV_ID_I210_COPPER:
336238148Sjfv	case E1000_DEV_ID_I210_COPPER_OEM1:
337238148Sjfv	case E1000_DEV_ID_I210_COPPER_IT:
338238148Sjfv	case E1000_DEV_ID_I210_FIBER:
339238148Sjfv	case E1000_DEV_ID_I210_SERDES:
340238148Sjfv	case E1000_DEV_ID_I210_SGMII:
341238148Sjfv		mac->type = e1000_i210;
342238148Sjfv		break;
343238148Sjfv	case E1000_DEV_ID_I211_COPPER:
344247064Sjfv		mac->type = e1000_i211;
345247064Sjfv		break;
346209616Sjfv	case E1000_DEV_ID_82576_VF:
347247064Sjfv	case E1000_DEV_ID_82576_VF_HV:
348209616Sjfv		mac->type = e1000_vfadapt;
349209616Sjfv		break;
350218530Sjfv	case E1000_DEV_ID_I350_VF:
351247064Sjfv	case E1000_DEV_ID_I350_VF_HV:
352218530Sjfv		mac->type = e1000_vfadapt_i350;
353218530Sjfv		break;
354247064Sjfv
355169240Sjfv	default:
356169240Sjfv		/* Should never have loaded on this device */
357169240Sjfv		ret_val = -E1000_ERR_MAC_INIT;
358169240Sjfv		break;
359169240Sjfv	}
360169240Sjfv
361169240Sjfv	return ret_val;
362169240Sjfv}
363169240Sjfv
364169240Sjfv/**
365169240Sjfv *  e1000_setup_init_funcs - Initializes function pointers
366169589Sjfv *  @hw: pointer to the HW structure
367169589Sjfv *  @init_device: TRUE will initialize the rest of the function pointers
368228386Sjfv *		  getting the device ready for use.  FALSE will only set
369228386Sjfv *		  MAC type and the function pointers for the other init
370228386Sjfv *		  functions.  Passing FALSE will not generate any hardware
371228386Sjfv *		  reads or writes.
372169240Sjfv *
373169240Sjfv *  This function must be called by a driver in order to use the rest
374169240Sjfv *  of the 'shared' code files. Called by drivers only.
375169240Sjfv **/
376173788Sjfvs32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
377169240Sjfv{
378169240Sjfv	s32 ret_val;
379169240Sjfv
380173788Sjfv	/* Can't do much good without knowing the MAC type. */
381169240Sjfv	ret_val = e1000_set_mac_type(hw);
382169240Sjfv	if (ret_val) {
383169240Sjfv		DEBUGOUT("ERROR: MAC type could not be set properly.\n");
384169240Sjfv		goto out;
385169240Sjfv	}
386169240Sjfv
387169240Sjfv	if (!hw->hw_addr) {
388169240Sjfv		DEBUGOUT("ERROR: Registers not mapped\n");
389169240Sjfv		ret_val = -E1000_ERR_CONFIG;
390169240Sjfv		goto out;
391169240Sjfv	}
392169240Sjfv
393173788Sjfv	/*
394177867Sjfv	 * Init function pointers to generic implementations. We do this first
395177867Sjfv	 * allowing a driver module to override it afterward.
396169240Sjfv	 */
397177867Sjfv	e1000_init_mac_ops_generic(hw);
398177867Sjfv	e1000_init_phy_ops_generic(hw);
399177867Sjfv	e1000_init_nvm_ops_generic(hw);
400209616Sjfv	e1000_init_mbx_ops_generic(hw);
401169240Sjfv
402173788Sjfv	/*
403173788Sjfv	 * Set up the init function pointers. These are functions within the
404169240Sjfv	 * adapter family file that sets up function pointers for the rest of
405169240Sjfv	 * the functions in that family.
406169240Sjfv	 */
407169240Sjfv	switch (hw->mac.type) {
408169240Sjfv	case e1000_82542:
409169240Sjfv		e1000_init_function_pointers_82542(hw);
410169240Sjfv		break;
411169240Sjfv	case e1000_82543:
412169240Sjfv	case e1000_82544:
413169240Sjfv		e1000_init_function_pointers_82543(hw);
414169240Sjfv		break;
415169240Sjfv	case e1000_82540:
416169240Sjfv	case e1000_82545:
417169240Sjfv	case e1000_82545_rev_3:
418169240Sjfv	case e1000_82546:
419169240Sjfv	case e1000_82546_rev_3:
420169240Sjfv		e1000_init_function_pointers_82540(hw);
421169240Sjfv		break;
422169240Sjfv	case e1000_82541:
423169240Sjfv	case e1000_82541_rev_2:
424169240Sjfv	case e1000_82547:
425169240Sjfv	case e1000_82547_rev_2:
426169240Sjfv		e1000_init_function_pointers_82541(hw);
427169240Sjfv		break;
428169240Sjfv	case e1000_82571:
429169240Sjfv	case e1000_82572:
430169240Sjfv	case e1000_82573:
431178523Sjfv	case e1000_82574:
432194865Sjfv	case e1000_82583:
433169240Sjfv		e1000_init_function_pointers_82571(hw);
434169240Sjfv		break;
435169240Sjfv	case e1000_80003es2lan:
436169240Sjfv		e1000_init_function_pointers_80003es2lan(hw);
437169240Sjfv		break;
438169240Sjfv	case e1000_ich8lan:
439169240Sjfv	case e1000_ich9lan:
440178523Sjfv	case e1000_ich10lan:
441194865Sjfv	case e1000_pchlan:
442213234Sjfv	case e1000_pch2lan:
443247064Sjfv	case e1000_pch_lpt:
444169240Sjfv		e1000_init_function_pointers_ich8lan(hw);
445169240Sjfv		break;
446177867Sjfv	case e1000_82575:
447181027Sjfv	case e1000_82576:
448200243Sjfv	case e1000_82580:
449218530Sjfv	case e1000_i350:
450177867Sjfv		e1000_init_function_pointers_82575(hw);
451177867Sjfv		break;
452238148Sjfv	case e1000_i210:
453238148Sjfv	case e1000_i211:
454238148Sjfv		e1000_init_function_pointers_i210(hw);
455238148Sjfv		break;
456209616Sjfv	case e1000_vfadapt:
457209616Sjfv		e1000_init_function_pointers_vf(hw);
458209616Sjfv		break;
459218530Sjfv	case e1000_vfadapt_i350:
460218530Sjfv		e1000_init_function_pointers_vf(hw);
461218530Sjfv		break;
462169240Sjfv	default:
463169240Sjfv		DEBUGOUT("Hardware not supported\n");
464169240Sjfv		ret_val = -E1000_ERR_CONFIG;
465169240Sjfv		break;
466169240Sjfv	}
467169240Sjfv
468173788Sjfv	/*
469173788Sjfv	 * Initialize the rest of the function pointers. These require some
470169240Sjfv	 * register reads/writes in some cases.
471169240Sjfv	 */
472173788Sjfv	if (!(ret_val) && init_device) {
473169240Sjfv		ret_val = e1000_init_mac_params(hw);
474169240Sjfv		if (ret_val)
475169240Sjfv			goto out;
476169240Sjfv
477169240Sjfv		ret_val = e1000_init_nvm_params(hw);
478169240Sjfv		if (ret_val)
479169240Sjfv			goto out;
480169240Sjfv
481169240Sjfv		ret_val = e1000_init_phy_params(hw);
482169240Sjfv		if (ret_val)
483169240Sjfv			goto out;
484209616Sjfv
485209616Sjfv		ret_val = e1000_init_mbx_params(hw);
486209616Sjfv		if (ret_val)
487209616Sjfv			goto out;
488169240Sjfv	}
489169240Sjfv
490169240Sjfvout:
491169240Sjfv	return ret_val;
492169240Sjfv}
493169240Sjfv
494169240Sjfv/**
495169240Sjfv *  e1000_get_bus_info - Obtain bus information for adapter
496169589Sjfv *  @hw: pointer to the HW structure
497169240Sjfv *
498169240Sjfv *  This will obtain information about the HW bus for which the
499176667Sjfv *  adapter is attached and stores it in the hw structure. This is a
500169240Sjfv *  function pointer entry point called by drivers.
501169240Sjfv **/
502173788Sjfvs32 e1000_get_bus_info(struct e1000_hw *hw)
503169240Sjfv{
504177867Sjfv	if (hw->mac.ops.get_bus_info)
505177867Sjfv		return hw->mac.ops.get_bus_info(hw);
506173788Sjfv
507173788Sjfv	return E1000_SUCCESS;
508169240Sjfv}
509169240Sjfv
510169240Sjfv/**
511169240Sjfv *  e1000_clear_vfta - Clear VLAN filter table
512169589Sjfv *  @hw: pointer to the HW structure
513169240Sjfv *
514169240Sjfv *  This clears the VLAN filter table on the adapter. This is a function
515169240Sjfv *  pointer entry point called by drivers.
516169240Sjfv **/
517173788Sjfvvoid e1000_clear_vfta(struct e1000_hw *hw)
518169240Sjfv{
519177867Sjfv	if (hw->mac.ops.clear_vfta)
520178523Sjfv		hw->mac.ops.clear_vfta(hw);
521169240Sjfv}
522169240Sjfv
523169240Sjfv/**
524169240Sjfv *  e1000_write_vfta - Write value to VLAN filter table
525169589Sjfv *  @hw: pointer to the HW structure
526169589Sjfv *  @offset: the 32-bit offset in which to write the value to.
527169589Sjfv *  @value: the 32-bit value to write at location offset.
528169240Sjfv *
529169240Sjfv *  This writes a 32-bit value to a 32-bit offset in the VLAN filter
530169240Sjfv *  table. This is a function pointer entry point called by drivers.
531169240Sjfv **/
532173788Sjfvvoid e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
533169240Sjfv{
534177867Sjfv	if (hw->mac.ops.write_vfta)
535177867Sjfv		hw->mac.ops.write_vfta(hw, offset, value);
536169240Sjfv}
537169240Sjfv
538169240Sjfv/**
539173788Sjfv *  e1000_update_mc_addr_list - Update Multicast addresses
540169589Sjfv *  @hw: pointer to the HW structure
541169589Sjfv *  @mc_addr_list: array of multicast addresses to program
542169589Sjfv *  @mc_addr_count: number of multicast addresses to program
543169240Sjfv *
544190872Sjfv *  Updates the Multicast Table Array.
545169240Sjfv *  The caller must have a packed mc_addr_list of multicast addresses.
546169240Sjfv **/
547173788Sjfvvoid e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
548228386Sjfv			       u32 mc_addr_count)
549169240Sjfv{
550177867Sjfv	if (hw->mac.ops.update_mc_addr_list)
551190872Sjfv		hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
552228386Sjfv						mc_addr_count);
553169240Sjfv}
554169240Sjfv
555169240Sjfv/**
556169240Sjfv *  e1000_force_mac_fc - Force MAC flow control
557169589Sjfv *  @hw: pointer to the HW structure
558169240Sjfv *
559169240Sjfv *  Force the MAC's flow control settings. Currently no func pointer exists
560169240Sjfv *  and all implementations are handled in the generic version of this
561169240Sjfv *  function.
562169240Sjfv **/
563173788Sjfvs32 e1000_force_mac_fc(struct e1000_hw *hw)
564169240Sjfv{
565169240Sjfv	return e1000_force_mac_fc_generic(hw);
566169240Sjfv}
567169240Sjfv
568169240Sjfv/**
569169240Sjfv *  e1000_check_for_link - Check/Store link connection
570169589Sjfv *  @hw: pointer to the HW structure
571169240Sjfv *
572169240Sjfv *  This checks the link condition of the adapter and stores the
573169240Sjfv *  results in the hw->mac structure. This is a function pointer entry
574169240Sjfv *  point called by drivers.
575169240Sjfv **/
576173788Sjfvs32 e1000_check_for_link(struct e1000_hw *hw)
577169240Sjfv{
578177867Sjfv	if (hw->mac.ops.check_for_link)
579177867Sjfv		return hw->mac.ops.check_for_link(hw);
580173788Sjfv
581173788Sjfv	return -E1000_ERR_CONFIG;
582169240Sjfv}
583169240Sjfv
584169240Sjfv/**
585169240Sjfv *  e1000_check_mng_mode - Check management mode
586169589Sjfv *  @hw: pointer to the HW structure
587169240Sjfv *
588169240Sjfv *  This checks if the adapter has manageability enabled.
589169240Sjfv *  This is a function pointer entry point called by drivers.
590169240Sjfv **/
591173788Sjfvbool e1000_check_mng_mode(struct e1000_hw *hw)
592169240Sjfv{
593177867Sjfv	if (hw->mac.ops.check_mng_mode)
594177867Sjfv		return hw->mac.ops.check_mng_mode(hw);
595173788Sjfv
596173788Sjfv	return FALSE;
597169240Sjfv}
598169240Sjfv
599169240Sjfv/**
600169240Sjfv *  e1000_mng_write_dhcp_info - Writes DHCP info to host interface
601169589Sjfv *  @hw: pointer to the HW structure
602169589Sjfv *  @buffer: pointer to the host interface
603169589Sjfv *  @length: size of the buffer
604169240Sjfv *
605169240Sjfv *  Writes the DHCP information to the host interface.
606169240Sjfv **/
607173788Sjfvs32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
608169240Sjfv{
609169240Sjfv	return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
610169240Sjfv}
611169240Sjfv
612169240Sjfv/**
613169240Sjfv *  e1000_reset_hw - Reset hardware
614169589Sjfv *  @hw: pointer to the HW structure
615169240Sjfv *
616169240Sjfv *  This resets the hardware into a known state. This is a function pointer
617169240Sjfv *  entry point called by drivers.
618169240Sjfv **/
619173788Sjfvs32 e1000_reset_hw(struct e1000_hw *hw)
620169240Sjfv{
621177867Sjfv	if (hw->mac.ops.reset_hw)
622177867Sjfv		return hw->mac.ops.reset_hw(hw);
623173788Sjfv
624173788Sjfv	return -E1000_ERR_CONFIG;
625169240Sjfv}
626169240Sjfv
627169240Sjfv/**
628169240Sjfv *  e1000_init_hw - Initialize hardware
629169589Sjfv *  @hw: pointer to the HW structure
630169240Sjfv *
631169240Sjfv *  This inits the hardware readying it for operation. This is a function
632169240Sjfv *  pointer entry point called by drivers.
633169240Sjfv **/
634173788Sjfvs32 e1000_init_hw(struct e1000_hw *hw)
635169240Sjfv{
636177867Sjfv	if (hw->mac.ops.init_hw)
637177867Sjfv		return hw->mac.ops.init_hw(hw);
638173788Sjfv
639173788Sjfv	return -E1000_ERR_CONFIG;
640169240Sjfv}
641169240Sjfv
642169240Sjfv/**
643169240Sjfv *  e1000_setup_link - Configures link and flow control
644169589Sjfv *  @hw: pointer to the HW structure
645169240Sjfv *
646169240Sjfv *  This configures link and flow control settings for the adapter. This
647169240Sjfv *  is a function pointer entry point called by drivers. While modules can
648169240Sjfv *  also call this, they probably call their own version of this function.
649169240Sjfv **/
650173788Sjfvs32 e1000_setup_link(struct e1000_hw *hw)
651169240Sjfv{
652177867Sjfv	if (hw->mac.ops.setup_link)
653177867Sjfv		return hw->mac.ops.setup_link(hw);
654173788Sjfv
655173788Sjfv	return -E1000_ERR_CONFIG;
656169240Sjfv}
657169240Sjfv
658169240Sjfv/**
659169240Sjfv *  e1000_get_speed_and_duplex - Returns current speed and duplex
660169589Sjfv *  @hw: pointer to the HW structure
661169589Sjfv *  @speed: pointer to a 16-bit value to store the speed
662169589Sjfv *  @duplex: pointer to a 16-bit value to store the duplex.
663169240Sjfv *
664169240Sjfv *  This returns the speed and duplex of the adapter in the two 'out'
665169240Sjfv *  variables passed in. This is a function pointer entry point called
666169240Sjfv *  by drivers.
667169240Sjfv **/
668173788Sjfvs32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
669169240Sjfv{
670177867Sjfv	if (hw->mac.ops.get_link_up_info)
671177867Sjfv		return hw->mac.ops.get_link_up_info(hw, speed, duplex);
672173788Sjfv
673173788Sjfv	return -E1000_ERR_CONFIG;
674169240Sjfv}
675169240Sjfv
676169240Sjfv/**
677169240Sjfv *  e1000_setup_led - Configures SW controllable LED
678169589Sjfv *  @hw: pointer to the HW structure
679169240Sjfv *
680169240Sjfv *  This prepares the SW controllable LED for use and saves the current state
681169240Sjfv *  of the LED so it can be later restored. This is a function pointer entry
682169240Sjfv *  point called by drivers.
683169240Sjfv **/
684173788Sjfvs32 e1000_setup_led(struct e1000_hw *hw)
685169240Sjfv{
686177867Sjfv	if (hw->mac.ops.setup_led)
687177867Sjfv		return hw->mac.ops.setup_led(hw);
688173788Sjfv
689173788Sjfv	return E1000_SUCCESS;
690169240Sjfv}
691169240Sjfv
692169240Sjfv/**
693169240Sjfv *  e1000_cleanup_led - Restores SW controllable LED
694169589Sjfv *  @hw: pointer to the HW structure
695169240Sjfv *
696169240Sjfv *  This restores the SW controllable LED to the value saved off by
697169240Sjfv *  e1000_setup_led. This is a function pointer entry point called by drivers.
698169240Sjfv **/
699173788Sjfvs32 e1000_cleanup_led(struct e1000_hw *hw)
700169240Sjfv{
701177867Sjfv	if (hw->mac.ops.cleanup_led)
702177867Sjfv		return hw->mac.ops.cleanup_led(hw);
703173788Sjfv
704173788Sjfv	return E1000_SUCCESS;
705169240Sjfv}
706169240Sjfv
707169240Sjfv/**
708169240Sjfv *  e1000_blink_led - Blink SW controllable LED
709169589Sjfv *  @hw: pointer to the HW structure
710169240Sjfv *
711169240Sjfv *  This starts the adapter LED blinking. Request the LED to be setup first
712169240Sjfv *  and cleaned up after. This is a function pointer entry point called by
713169240Sjfv *  drivers.
714169240Sjfv **/
715173788Sjfvs32 e1000_blink_led(struct e1000_hw *hw)
716169240Sjfv{
717177867Sjfv	if (hw->mac.ops.blink_led)
718177867Sjfv		return hw->mac.ops.blink_led(hw);
719173788Sjfv
720173788Sjfv	return E1000_SUCCESS;
721169240Sjfv}
722169240Sjfv
723169240Sjfv/**
724190872Sjfv *  e1000_id_led_init - store LED configurations in SW
725190872Sjfv *  @hw: pointer to the HW structure
726190872Sjfv *
727190872Sjfv *  Initializes the LED config in SW. This is a function pointer entry point
728190872Sjfv *  called by drivers.
729190872Sjfv **/
730190872Sjfvs32 e1000_id_led_init(struct e1000_hw *hw)
731190872Sjfv{
732190872Sjfv	if (hw->mac.ops.id_led_init)
733190872Sjfv		return hw->mac.ops.id_led_init(hw);
734190872Sjfv
735190872Sjfv	return E1000_SUCCESS;
736190872Sjfv}
737190872Sjfv
738190872Sjfv/**
739169240Sjfv *  e1000_led_on - Turn on SW controllable LED
740169589Sjfv *  @hw: pointer to the HW structure
741169240Sjfv *
742169240Sjfv *  Turns the SW defined LED on. This is a function pointer entry point
743169240Sjfv *  called by drivers.
744169240Sjfv **/
745173788Sjfvs32 e1000_led_on(struct e1000_hw *hw)
746169240Sjfv{
747177867Sjfv	if (hw->mac.ops.led_on)
748177867Sjfv		return hw->mac.ops.led_on(hw);
749173788Sjfv
750173788Sjfv	return E1000_SUCCESS;
751169240Sjfv}
752169240Sjfv
753169240Sjfv/**
754169240Sjfv *  e1000_led_off - Turn off SW controllable LED
755169589Sjfv *  @hw: pointer to the HW structure
756169240Sjfv *
757169240Sjfv *  Turns the SW defined LED off. This is a function pointer entry point
758169240Sjfv *  called by drivers.
759169240Sjfv **/
760173788Sjfvs32 e1000_led_off(struct e1000_hw *hw)
761169240Sjfv{
762177867Sjfv	if (hw->mac.ops.led_off)
763177867Sjfv		return hw->mac.ops.led_off(hw);
764173788Sjfv
765173788Sjfv	return E1000_SUCCESS;
766169240Sjfv}
767169240Sjfv
768169240Sjfv/**
769169240Sjfv *  e1000_reset_adaptive - Reset adaptive IFS
770169589Sjfv *  @hw: pointer to the HW structure
771169240Sjfv *
772169240Sjfv *  Resets the adaptive IFS. Currently no func pointer exists and all
773169240Sjfv *  implementations are handled in the generic version of this function.
774169240Sjfv **/
775173788Sjfvvoid e1000_reset_adaptive(struct e1000_hw *hw)
776169240Sjfv{
777169240Sjfv	e1000_reset_adaptive_generic(hw);
778169240Sjfv}
779169240Sjfv
780169240Sjfv/**
781169240Sjfv *  e1000_update_adaptive - Update adaptive IFS
782169589Sjfv *  @hw: pointer to the HW structure
783169240Sjfv *
784169240Sjfv *  Updates adapter IFS. Currently no func pointer exists and all
785169240Sjfv *  implementations are handled in the generic version of this function.
786169240Sjfv **/
787173788Sjfvvoid e1000_update_adaptive(struct e1000_hw *hw)
788169240Sjfv{
789169240Sjfv	e1000_update_adaptive_generic(hw);
790169240Sjfv}
791169240Sjfv
792169240Sjfv/**
793169240Sjfv *  e1000_disable_pcie_master - Disable PCI-Express master access
794169589Sjfv *  @hw: pointer to the HW structure
795169240Sjfv *
796169240Sjfv *  Disables PCI-Express master access and verifies there are no pending
797169240Sjfv *  requests. Currently no func pointer exists and all implementations are
798169240Sjfv *  handled in the generic version of this function.
799169240Sjfv **/
800173788Sjfvs32 e1000_disable_pcie_master(struct e1000_hw *hw)
801169240Sjfv{
802169240Sjfv	return e1000_disable_pcie_master_generic(hw);
803169240Sjfv}
804169240Sjfv
805169240Sjfv/**
806169240Sjfv *  e1000_config_collision_dist - Configure collision distance
807169589Sjfv *  @hw: pointer to the HW structure
808169240Sjfv *
809169240Sjfv *  Configures the collision distance to the default value and is used
810169240Sjfv *  during link setup.
811169240Sjfv **/
812173788Sjfvvoid e1000_config_collision_dist(struct e1000_hw *hw)
813169240Sjfv{
814177867Sjfv	if (hw->mac.ops.config_collision_dist)
815177867Sjfv		hw->mac.ops.config_collision_dist(hw);
816169240Sjfv}
817169240Sjfv
818169240Sjfv/**
819169240Sjfv *  e1000_rar_set - Sets a receive address register
820169589Sjfv *  @hw: pointer to the HW structure
821169589Sjfv *  @addr: address to set the RAR to
822169589Sjfv *  @index: the RAR to set
823169240Sjfv *
824169240Sjfv *  Sets a Receive Address Register (RAR) to the specified address.
825169240Sjfv **/
826173788Sjfvvoid e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
827169240Sjfv{
828177867Sjfv	if (hw->mac.ops.rar_set)
829177867Sjfv		hw->mac.ops.rar_set(hw, addr, index);
830169240Sjfv}
831169240Sjfv
832169240Sjfv/**
833169240Sjfv *  e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
834169589Sjfv *  @hw: pointer to the HW structure
835169240Sjfv *
836169240Sjfv *  Ensures that the MDI/MDIX SW state is valid.
837169240Sjfv **/
838173788Sjfvs32 e1000_validate_mdi_setting(struct e1000_hw *hw)
839169240Sjfv{
840177867Sjfv	if (hw->mac.ops.validate_mdi_setting)
841177867Sjfv		return hw->mac.ops.validate_mdi_setting(hw);
842173788Sjfv
843173788Sjfv	return E1000_SUCCESS;
844169240Sjfv}
845169240Sjfv
846169240Sjfv/**
847169240Sjfv *  e1000_hash_mc_addr - Determines address location in multicast table
848169589Sjfv *  @hw: pointer to the HW structure
849169589Sjfv *  @mc_addr: Multicast address to hash.
850169240Sjfv *
851169240Sjfv *  This hashes an address to determine its location in the multicast
852169240Sjfv *  table. Currently no func pointer exists and all implementations
853169240Sjfv *  are handled in the generic version of this function.
854169240Sjfv **/
855173788Sjfvu32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
856169240Sjfv{
857169240Sjfv	return e1000_hash_mc_addr_generic(hw, mc_addr);
858169240Sjfv}
859169240Sjfv
860169240Sjfv/**
861169240Sjfv *  e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
862169589Sjfv *  @hw: pointer to the HW structure
863169240Sjfv *
864169240Sjfv *  Enables packet filtering on transmit packets if manageability is enabled
865169240Sjfv *  and host interface is enabled.
866169240Sjfv *  Currently no func pointer exists and all implementations are handled in the
867169240Sjfv *  generic version of this function.
868169240Sjfv **/
869173788Sjfvbool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
870169240Sjfv{
871169240Sjfv	return e1000_enable_tx_pkt_filtering_generic(hw);
872169240Sjfv}
873169240Sjfv
874169240Sjfv/**
875169240Sjfv *  e1000_mng_host_if_write - Writes to the manageability host interface
876169589Sjfv *  @hw: pointer to the HW structure
877169589Sjfv *  @buffer: pointer to the host interface buffer
878169589Sjfv *  @length: size of the buffer
879169589Sjfv *  @offset: location in the buffer to write to
880169589Sjfv *  @sum: sum of the data (not checksum)
881169240Sjfv *
882169240Sjfv *  This function writes the buffer content at the offset given on the host if.
883169240Sjfv *  It also does alignment considerations to do the writes in most efficient
884169240Sjfv *  way.  Also fills up the sum of the buffer in *buffer parameter.
885169240Sjfv **/
886228386Sjfvs32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
887228386Sjfv			    u16 offset, u8 *sum)
888169240Sjfv{
889247064Sjfv	return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
890169240Sjfv}
891169240Sjfv
892169240Sjfv/**
893169240Sjfv *  e1000_mng_write_cmd_header - Writes manageability command header
894169589Sjfv *  @hw: pointer to the HW structure
895169589Sjfv *  @hdr: pointer to the host interface command header
896169240Sjfv *
897169240Sjfv *  Writes the command header after does the checksum calculation.
898169240Sjfv **/
899173788Sjfvs32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
900228386Sjfv			       struct e1000_host_mng_command_header *hdr)
901169240Sjfv{
902247064Sjfv	return e1000_mng_write_cmd_header_generic(hw, hdr);
903169240Sjfv}
904169240Sjfv
905169240Sjfv/**
906169240Sjfv *  e1000_mng_enable_host_if - Checks host interface is enabled
907169589Sjfv *  @hw: pointer to the HW structure
908169240Sjfv *
909169240Sjfv *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
910169240Sjfv *
911176667Sjfv *  This function checks whether the HOST IF is enabled for command operation
912169240Sjfv *  and also checks whether the previous command is completed.  It busy waits
913169240Sjfv *  in case of previous command is not completed.
914169240Sjfv **/
915228386Sjfvs32 e1000_mng_enable_host_if(struct e1000_hw *hw)
916169240Sjfv{
917247064Sjfv	return e1000_mng_enable_host_if_generic(hw);
918169240Sjfv}
919169240Sjfv
920169240Sjfv/**
921247064Sjfv *  e1000_set_obff_timer - Set Optimized Buffer Flush/Fill timer
922169589Sjfv *  @hw: pointer to the HW structure
923247064Sjfv *  @itr: u32 indicating itr value
924169240Sjfv *
925247064Sjfv *  Set the OBFF timer based on the given interrupt rate.
926169240Sjfv **/
927247064Sjfvs32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
928169240Sjfv{
929247064Sjfv	if (hw->mac.ops.set_obff_timer)
930247064Sjfv		return hw->mac.ops.set_obff_timer(hw, itr);
931173788Sjfv
932173788Sjfv	return E1000_SUCCESS;
933169240Sjfv}
934169240Sjfv
935169240Sjfv/**
936169240Sjfv *  e1000_check_reset_block - Verifies PHY can be reset
937169589Sjfv *  @hw: pointer to the HW structure
938169240Sjfv *
939169240Sjfv *  Checks if the PHY is in a state that can be reset or if manageability
940169240Sjfv *  has it tied up. This is a function pointer entry point called by drivers.
941169240Sjfv **/
942173788Sjfvs32 e1000_check_reset_block(struct e1000_hw *hw)
943169240Sjfv{
944177867Sjfv	if (hw->phy.ops.check_reset_block)
945177867Sjfv		return hw->phy.ops.check_reset_block(hw);
946173788Sjfv
947173788Sjfv	return E1000_SUCCESS;
948169240Sjfv}
949169240Sjfv
950169240Sjfv/**
951169240Sjfv *  e1000_read_phy_reg - Reads PHY register
952169589Sjfv *  @hw: pointer to the HW structure
953169589Sjfv *  @offset: the register to read
954169589Sjfv *  @data: the buffer to store the 16-bit read.
955169240Sjfv *
956169240Sjfv *  Reads the PHY register and returns the value in data.
957169240Sjfv *  This is a function pointer entry point called by drivers.
958169240Sjfv **/
959173788Sjfvs32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
960169240Sjfv{
961177867Sjfv	if (hw->phy.ops.read_reg)
962177867Sjfv		return hw->phy.ops.read_reg(hw, offset, data);
963173788Sjfv
964173788Sjfv	return E1000_SUCCESS;
965169240Sjfv}
966169240Sjfv
967169240Sjfv/**
968169240Sjfv *  e1000_write_phy_reg - Writes PHY register
969169589Sjfv *  @hw: pointer to the HW structure
970169589Sjfv *  @offset: the register to write
971169589Sjfv *  @data: the value to write.
972169240Sjfv *
973169240Sjfv *  Writes the PHY register at offset with the value in data.
974169240Sjfv *  This is a function pointer entry point called by drivers.
975169240Sjfv **/
976173788Sjfvs32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
977169240Sjfv{
978177867Sjfv	if (hw->phy.ops.write_reg)
979177867Sjfv		return hw->phy.ops.write_reg(hw, offset, data);
980173788Sjfv
981173788Sjfv	return E1000_SUCCESS;
982169240Sjfv}
983169240Sjfv
984169240Sjfv/**
985177867Sjfv *  e1000_release_phy - Generic release PHY
986177867Sjfv *  @hw: pointer to the HW structure
987177867Sjfv *
988177867Sjfv *  Return if silicon family does not require a semaphore when accessing the
989177867Sjfv *  PHY.
990177867Sjfv **/
991177867Sjfvvoid e1000_release_phy(struct e1000_hw *hw)
992177867Sjfv{
993177867Sjfv	if (hw->phy.ops.release)
994177867Sjfv		hw->phy.ops.release(hw);
995177867Sjfv}
996177867Sjfv
997177867Sjfv/**
998177867Sjfv *  e1000_acquire_phy - Generic acquire PHY
999177867Sjfv *  @hw: pointer to the HW structure
1000177867Sjfv *
1001177867Sjfv *  Return success if silicon family does not require a semaphore when
1002177867Sjfv *  accessing the PHY.
1003177867Sjfv **/
1004177867Sjfvs32 e1000_acquire_phy(struct e1000_hw *hw)
1005177867Sjfv{
1006177867Sjfv	if (hw->phy.ops.acquire)
1007177867Sjfv		return hw->phy.ops.acquire(hw);
1008177867Sjfv
1009177867Sjfv	return E1000_SUCCESS;
1010177867Sjfv}
1011177867Sjfv
1012177867Sjfv/**
1013185353Sjfv *  e1000_cfg_on_link_up - Configure PHY upon link up
1014185353Sjfv *  @hw: pointer to the HW structure
1015185353Sjfv **/
1016185353Sjfvs32 e1000_cfg_on_link_up(struct e1000_hw *hw)
1017185353Sjfv{
1018185353Sjfv	if (hw->phy.ops.cfg_on_link_up)
1019185353Sjfv		return hw->phy.ops.cfg_on_link_up(hw);
1020185353Sjfv
1021185353Sjfv	return E1000_SUCCESS;
1022185353Sjfv}
1023185353Sjfv
1024185353Sjfv/**
1025169240Sjfv *  e1000_read_kmrn_reg - Reads register using Kumeran interface
1026169589Sjfv *  @hw: pointer to the HW structure
1027169589Sjfv *  @offset: the register to read
1028169589Sjfv *  @data: the location to store the 16-bit value read.
1029169240Sjfv *
1030169240Sjfv *  Reads a register out of the Kumeran interface. Currently no func pointer
1031169240Sjfv *  exists and all implementations are handled in the generic version of
1032169240Sjfv *  this function.
1033169240Sjfv **/
1034173788Sjfvs32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
1035169240Sjfv{
1036169240Sjfv	return e1000_read_kmrn_reg_generic(hw, offset, data);
1037169240Sjfv}
1038169240Sjfv
1039169240Sjfv/**
1040169240Sjfv *  e1000_write_kmrn_reg - Writes register using Kumeran interface
1041169589Sjfv *  @hw: pointer to the HW structure
1042169589Sjfv *  @offset: the register to write
1043169589Sjfv *  @data: the value to write.
1044169240Sjfv *
1045169240Sjfv *  Writes a register to the Kumeran interface. Currently no func pointer
1046169240Sjfv *  exists and all implementations are handled in the generic version of
1047169240Sjfv *  this function.
1048169240Sjfv **/
1049173788Sjfvs32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
1050169240Sjfv{
1051169240Sjfv	return e1000_write_kmrn_reg_generic(hw, offset, data);
1052169240Sjfv}
1053169240Sjfv
1054169240Sjfv/**
1055169240Sjfv *  e1000_get_cable_length - Retrieves cable length estimation
1056169589Sjfv *  @hw: pointer to the HW structure
1057169240Sjfv *
1058169240Sjfv *  This function estimates the cable length and stores them in
1059169240Sjfv *  hw->phy.min_length and hw->phy.max_length. This is a function pointer
1060169240Sjfv *  entry point called by drivers.
1061169240Sjfv **/
1062173788Sjfvs32 e1000_get_cable_length(struct e1000_hw *hw)
1063169240Sjfv{
1064177867Sjfv	if (hw->phy.ops.get_cable_length)
1065177867Sjfv		return hw->phy.ops.get_cable_length(hw);
1066173788Sjfv
1067173788Sjfv	return E1000_SUCCESS;
1068169240Sjfv}
1069169240Sjfv
1070169240Sjfv/**
1071169240Sjfv *  e1000_get_phy_info - Retrieves PHY information from registers
1072169589Sjfv *  @hw: pointer to the HW structure
1073169240Sjfv *
1074169240Sjfv *  This function gets some information from various PHY registers and
1075169240Sjfv *  populates hw->phy values with it. This is a function pointer entry
1076169240Sjfv *  point called by drivers.
1077169240Sjfv **/
1078173788Sjfvs32 e1000_get_phy_info(struct e1000_hw *hw)
1079169240Sjfv{
1080177867Sjfv	if (hw->phy.ops.get_info)
1081177867Sjfv		return hw->phy.ops.get_info(hw);
1082173788Sjfv
1083173788Sjfv	return E1000_SUCCESS;
1084169240Sjfv}
1085169240Sjfv
1086169240Sjfv/**
1087169240Sjfv *  e1000_phy_hw_reset - Hard PHY reset
1088169589Sjfv *  @hw: pointer to the HW structure
1089169240Sjfv *
1090169240Sjfv *  Performs a hard PHY reset. This is a function pointer entry point called
1091169240Sjfv *  by drivers.
1092169240Sjfv **/
1093173788Sjfvs32 e1000_phy_hw_reset(struct e1000_hw *hw)
1094169240Sjfv{
1095177867Sjfv	if (hw->phy.ops.reset)
1096177867Sjfv		return hw->phy.ops.reset(hw);
1097173788Sjfv
1098173788Sjfv	return E1000_SUCCESS;
1099169240Sjfv}
1100169240Sjfv
1101169240Sjfv/**
1102169240Sjfv *  e1000_phy_commit - Soft PHY reset
1103169589Sjfv *  @hw: pointer to the HW structure
1104169240Sjfv *
1105169240Sjfv *  Performs a soft PHY reset on those that apply. This is a function pointer
1106169240Sjfv *  entry point called by drivers.
1107169240Sjfv **/
1108173788Sjfvs32 e1000_phy_commit(struct e1000_hw *hw)
1109169240Sjfv{
1110177867Sjfv	if (hw->phy.ops.commit)
1111177867Sjfv		return hw->phy.ops.commit(hw);
1112173788Sjfv
1113173788Sjfv	return E1000_SUCCESS;
1114169240Sjfv}
1115169240Sjfv
1116169240Sjfv/**
1117177867Sjfv *  e1000_set_d0_lplu_state - Sets low power link up state for D0
1118169589Sjfv *  @hw: pointer to the HW structure
1119169589Sjfv *  @active: boolean used to enable/disable lplu
1120169240Sjfv *
1121169240Sjfv *  Success returns 0, Failure returns 1
1122169240Sjfv *
1123169240Sjfv *  The low power link up (lplu) state is set to the power management level D0
1124177867Sjfv *  and SmartSpeed is disabled when active is TRUE, else clear lplu for D0
1125169240Sjfv *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
1126169240Sjfv *  is used during Dx states where the power conservation is most important.
1127169240Sjfv *  During driver activity, SmartSpeed should be enabled so performance is
1128169240Sjfv *  maintained.  This is a function pointer entry point called by drivers.
1129169240Sjfv **/
1130173788Sjfvs32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
1131169240Sjfv{
1132177867Sjfv	if (hw->phy.ops.set_d0_lplu_state)
1133177867Sjfv		return hw->phy.ops.set_d0_lplu_state(hw, active);
1134173788Sjfv
1135173788Sjfv	return E1000_SUCCESS;
1136169240Sjfv}
1137169240Sjfv
1138169240Sjfv/**
1139169240Sjfv *  e1000_set_d3_lplu_state - Sets low power link up state for D3
1140169589Sjfv *  @hw: pointer to the HW structure
1141169589Sjfv *  @active: boolean used to enable/disable lplu
1142169240Sjfv *
1143169240Sjfv *  Success returns 0, Failure returns 1
1144169240Sjfv *
1145169240Sjfv *  The low power link up (lplu) state is set to the power management level D3
1146177867Sjfv *  and SmartSpeed is disabled when active is TRUE, else clear lplu for D3
1147169240Sjfv *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
1148169240Sjfv *  is used during Dx states where the power conservation is most important.
1149169240Sjfv *  During driver activity, SmartSpeed should be enabled so performance is
1150169240Sjfv *  maintained.  This is a function pointer entry point called by drivers.
1151169240Sjfv **/
1152173788Sjfvs32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
1153169240Sjfv{
1154177867Sjfv	if (hw->phy.ops.set_d3_lplu_state)
1155177867Sjfv		return hw->phy.ops.set_d3_lplu_state(hw, active);
1156173788Sjfv
1157173788Sjfv	return E1000_SUCCESS;
1158169240Sjfv}
1159169240Sjfv
1160169240Sjfv/**
1161169240Sjfv *  e1000_read_mac_addr - Reads MAC address
1162169589Sjfv *  @hw: pointer to the HW structure
1163169240Sjfv *
1164169240Sjfv *  Reads the MAC address out of the adapter and stores it in the HW structure.
1165169240Sjfv *  Currently no func pointer exists and all implementations are handled in the
1166169240Sjfv *  generic version of this function.
1167169240Sjfv **/
1168173788Sjfvs32 e1000_read_mac_addr(struct e1000_hw *hw)
1169169240Sjfv{
1170177867Sjfv	if (hw->mac.ops.read_mac_addr)
1171177867Sjfv		return hw->mac.ops.read_mac_addr(hw);
1172173788Sjfv
1173169240Sjfv	return e1000_read_mac_addr_generic(hw);
1174169240Sjfv}
1175169240Sjfv
1176169240Sjfv/**
1177213234Sjfv *  e1000_read_pba_string - Read device part number string
1178213234Sjfv *  @hw: pointer to the HW structure
1179213234Sjfv *  @pba_num: pointer to device part number
1180213234Sjfv *  @pba_num_size: size of part number buffer
1181213234Sjfv *
1182213234Sjfv *  Reads the product board assembly (PBA) number from the EEPROM and stores
1183213234Sjfv *  the value in pba_num.
1184213234Sjfv *  Currently no func pointer exists and all implementations are handled in the
1185213234Sjfv *  generic version of this function.
1186213234Sjfv **/
1187213234Sjfvs32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
1188213234Sjfv{
1189213234Sjfv	return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
1190213234Sjfv}
1191213234Sjfv
1192213234Sjfv/**
1193213234Sjfv *  e1000_read_pba_length - Read device part number string length
1194213234Sjfv *  @hw: pointer to the HW structure
1195213234Sjfv *  @pba_num_size: size of part number buffer
1196213234Sjfv *
1197213234Sjfv *  Reads the product board assembly (PBA) number length from the EEPROM and
1198213234Sjfv *  stores the value in pba_num.
1199213234Sjfv *  Currently no func pointer exists and all implementations are handled in the
1200213234Sjfv *  generic version of this function.
1201213234Sjfv **/
1202213234Sjfvs32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
1203213234Sjfv{
1204213234Sjfv	return e1000_read_pba_length_generic(hw, pba_num_size);
1205213234Sjfv}
1206213234Sjfv
1207213234Sjfv/**
1208169240Sjfv *  e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1209169589Sjfv *  @hw: pointer to the HW structure
1210169240Sjfv *
1211169240Sjfv *  Validates the NVM checksum is correct. This is a function pointer entry
1212169240Sjfv *  point called by drivers.
1213169240Sjfv **/
1214173788Sjfvs32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
1215169240Sjfv{
1216177867Sjfv	if (hw->nvm.ops.validate)
1217177867Sjfv		return hw->nvm.ops.validate(hw);
1218173788Sjfv
1219173788Sjfv	return -E1000_ERR_CONFIG;
1220169240Sjfv}
1221169240Sjfv
1222169240Sjfv/**
1223169240Sjfv *  e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1224169589Sjfv *  @hw: pointer to the HW structure
1225169240Sjfv *
1226169240Sjfv *  Updates the NVM checksum. Currently no func pointer exists and all
1227169240Sjfv *  implementations are handled in the generic version of this function.
1228169240Sjfv **/
1229173788Sjfvs32 e1000_update_nvm_checksum(struct e1000_hw *hw)
1230169240Sjfv{
1231177867Sjfv	if (hw->nvm.ops.update)
1232177867Sjfv		return hw->nvm.ops.update(hw);
1233173788Sjfv
1234173788Sjfv	return -E1000_ERR_CONFIG;
1235169240Sjfv}
1236169240Sjfv
1237169240Sjfv/**
1238169240Sjfv *  e1000_reload_nvm - Reloads EEPROM
1239169589Sjfv *  @hw: pointer to the HW structure
1240169240Sjfv *
1241169240Sjfv *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1242169240Sjfv *  extended control register.
1243169240Sjfv **/
1244173788Sjfvvoid e1000_reload_nvm(struct e1000_hw *hw)
1245169240Sjfv{
1246177867Sjfv	if (hw->nvm.ops.reload)
1247177867Sjfv		hw->nvm.ops.reload(hw);
1248169240Sjfv}
1249169240Sjfv
1250169240Sjfv/**
1251169240Sjfv *  e1000_read_nvm - Reads NVM (EEPROM)
1252169589Sjfv *  @hw: pointer to the HW structure
1253169589Sjfv *  @offset: the word offset to read
1254169589Sjfv *  @words: number of 16-bit words to read
1255169589Sjfv *  @data: pointer to the properly sized buffer for the data.
1256169240Sjfv *
1257169240Sjfv *  Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1258169240Sjfv *  pointer entry point called by drivers.
1259169240Sjfv **/
1260173788Sjfvs32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1261169240Sjfv{
1262177867Sjfv	if (hw->nvm.ops.read)
1263177867Sjfv		return hw->nvm.ops.read(hw, offset, words, data);
1264173788Sjfv
1265173788Sjfv	return -E1000_ERR_CONFIG;
1266169240Sjfv}
1267169240Sjfv
1268169240Sjfv/**
1269169240Sjfv *  e1000_write_nvm - Writes to NVM (EEPROM)
1270169589Sjfv *  @hw: pointer to the HW structure
1271169589Sjfv *  @offset: the word offset to read
1272169589Sjfv *  @words: number of 16-bit words to write
1273169589Sjfv *  @data: pointer to the properly sized buffer for the data.
1274169240Sjfv *
1275169240Sjfv *  Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1276169240Sjfv *  pointer entry point called by drivers.
1277169240Sjfv **/
1278173788Sjfvs32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1279169240Sjfv{
1280177867Sjfv	if (hw->nvm.ops.write)
1281177867Sjfv		return hw->nvm.ops.write(hw, offset, words, data);
1282173788Sjfv
1283173788Sjfv	return E1000_SUCCESS;
1284169240Sjfv}
1285169240Sjfv
1286169240Sjfv/**
1287169240Sjfv *  e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1288169589Sjfv *  @hw: pointer to the HW structure
1289169589Sjfv *  @reg: 32bit register offset
1290169589Sjfv *  @offset: the register to write
1291169589Sjfv *  @data: the value to write.
1292169240Sjfv *
1293169240Sjfv *  Writes the PHY register at offset with the value in data.
1294169240Sjfv *  This is a function pointer entry point called by drivers.
1295169240Sjfv **/
1296176667Sjfvs32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
1297228386Sjfv			      u8 data)
1298169240Sjfv{
1299169240Sjfv	return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1300169240Sjfv}
1301173788Sjfv
1302173788Sjfv/**
1303173788Sjfv * e1000_power_up_phy - Restores link in case of PHY power down
1304173788Sjfv * @hw: pointer to the HW structure
1305173788Sjfv *
1306173788Sjfv * The phy may be powered down to save power, to turn off link when the
1307173788Sjfv * driver is unloaded, or wake on lan is not enabled (among others).
1308173788Sjfv **/
1309173788Sjfvvoid e1000_power_up_phy(struct e1000_hw *hw)
1310173788Sjfv{
1311177867Sjfv	if (hw->phy.ops.power_up)
1312177867Sjfv		hw->phy.ops.power_up(hw);
1313173788Sjfv
1314173788Sjfv	e1000_setup_link(hw);
1315173788Sjfv}
1316173788Sjfv
1317173788Sjfv/**
1318176667Sjfv * e1000_power_down_phy - Power down PHY
1319173788Sjfv * @hw: pointer to the HW structure
1320173788Sjfv *
1321173788Sjfv * The phy may be powered down to save power, to turn off link when the
1322173788Sjfv * driver is unloaded, or wake on lan is not enabled (among others).
1323173788Sjfv **/
1324173788Sjfvvoid e1000_power_down_phy(struct e1000_hw *hw)
1325173788Sjfv{
1326177867Sjfv	if (hw->phy.ops.power_down)
1327177867Sjfv		hw->phy.ops.power_down(hw);
1328173788Sjfv}
1329173788Sjfv
1330181027Sjfv/**
1331203049Sjfv *  e1000_power_up_fiber_serdes_link - Power up serdes link
1332203049Sjfv *  @hw: pointer to the HW structure
1333203049Sjfv *
1334203049Sjfv *  Power on the optics and PCS.
1335203049Sjfv **/
1336203049Sjfvvoid e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
1337203049Sjfv{
1338203049Sjfv	if (hw->mac.ops.power_up_serdes)
1339203049Sjfv		hw->mac.ops.power_up_serdes(hw);
1340203049Sjfv}
1341203049Sjfv
1342203049Sjfv/**
1343181027Sjfv *  e1000_shutdown_fiber_serdes_link - Remove link during power down
1344181027Sjfv *  @hw: pointer to the HW structure
1345181027Sjfv *
1346181027Sjfv *  Shutdown the optics and PCS on driver unload.
1347181027Sjfv **/
1348181027Sjfvvoid e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
1349181027Sjfv{
1350181027Sjfv	if (hw->mac.ops.shutdown_serdes)
1351181027Sjfv		hw->mac.ops.shutdown_serdes(hw);
1352181027Sjfv}
1353181027Sjfv
1354