3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 */
29
30 /* IntelVersion: 1.129.2.1 v3_3_14_3_BHSW1 */
31
32 #include "igb_api.h"
33
34 /*
35 * e1000_init_mac_params - Initialize MAC function pointers
36 * @hw: pointer to the HW structure
37 *
38 * This function initializes the function pointers for the MAC
39 * set of functions. Called by drivers or by e1000_setup_init_funcs.
40 */
41 s32
42 e1000_init_mac_params(struct e1000_hw *hw)
43 {
122 * e1000_setup_init_funcs()).
123 */
124 s32
125 e1000_set_mac_type(struct e1000_hw *hw)
126 {
127 struct e1000_mac_info *mac = &hw->mac;
128 s32 ret_val = E1000_SUCCESS;
129
130 DEBUGFUNC("e1000_set_mac_type");
131
132 switch (hw->device_id) {
133 case E1000_DEV_ID_82575EB_COPPER:
134 case E1000_DEV_ID_82575EB_FIBER_SERDES:
135 case E1000_DEV_ID_82575GB_QUAD_COPPER:
136 mac->type = e1000_82575;
137 break;
138 case E1000_DEV_ID_82576:
139 case E1000_DEV_ID_82576_FIBER:
140 case E1000_DEV_ID_82576_SERDES:
141 case E1000_DEV_ID_82576_QUAD_COPPER:
142 case E1000_DEV_ID_82576_NS:
143 case E1000_DEV_ID_82576_NS_SERDES:
144 case E1000_DEV_ID_82576_SERDES_QUAD:
145 mac->type = e1000_82576;
146 break;
147 case E1000_DEV_ID_82580_COPPER:
148 case E1000_DEV_ID_82580_FIBER:
149 case E1000_DEV_ID_82580_SERDES:
150 case E1000_DEV_ID_82580_SGMII:
151 case E1000_DEV_ID_82580_COPPER_DUAL:
152 mac->type = e1000_82580;
153 break;
154 default:
155 /* Should never have loaded on this device */
156 ret_val = -E1000_ERR_MAC_INIT;
157 break;
158 }
159
160 return (ret_val);
161 }
162
163 /*
164 * e1000_setup_init_funcs - Initializes function pointers
165 * @hw: pointer to the HW structure
166 * @init_device: true will initialize the rest of the function pointers
167 * getting the device ready for use. false will only set
168 * MAC type and the function pointers for the other init
169 * functions. Passing false will not generate any hardware
170 * reads or writes.
171 *
172 * This function must be called by a driver in order to use the rest
173 * of the 'shared' code files. Called by drivers only.
190 goto out;
191 }
192
193 /*
194 * Init function pointers to generic implementations. We do this first
195 * allowing a driver module to override it afterward.
196 */
197 e1000_init_mac_ops_generic(hw);
198 e1000_init_phy_ops_generic(hw);
199 e1000_init_nvm_ops_generic(hw);
200
201 /*
202 * Set up the init function pointers. These are functions within the
203 * adapter family file that sets up function pointers for the rest of
204 * the functions in that family.
205 */
206 switch (hw->mac.type) {
207 case e1000_82575:
208 case e1000_82576:
209 case e1000_82580:
210 e1000_init_function_pointers_82575(hw);
211 break;
212 default:
213 DEBUGOUT("Hardware not supported\n");
214 ret_val = -E1000_ERR_CONFIG;
215 break;
216 }
217
218 /*
219 * Initialize the rest of the function pointers. These require some
220 * register reads/writes in some cases.
221 */
222 if (!(ret_val) && init_device) {
223 ret_val = e1000_init_mac_params(hw);
224 if (ret_val)
225 goto out;
226
227 ret_val = e1000_init_nvm_params(hw);
228 if (ret_val)
229 goto out;
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2007-2012 Intel Corporation. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 */
29
30 /* IntelVersion: 1.129.2.1 v3_3_14_3_BHSW1 */
31
32 #include "igb_api.h"
33
34 /*
35 * e1000_init_mac_params - Initialize MAC function pointers
36 * @hw: pointer to the HW structure
37 *
38 * This function initializes the function pointers for the MAC
39 * set of functions. Called by drivers or by e1000_setup_init_funcs.
40 */
41 s32
42 e1000_init_mac_params(struct e1000_hw *hw)
43 {
122 * e1000_setup_init_funcs()).
123 */
124 s32
125 e1000_set_mac_type(struct e1000_hw *hw)
126 {
127 struct e1000_mac_info *mac = &hw->mac;
128 s32 ret_val = E1000_SUCCESS;
129
130 DEBUGFUNC("e1000_set_mac_type");
131
132 switch (hw->device_id) {
133 case E1000_DEV_ID_82575EB_COPPER:
134 case E1000_DEV_ID_82575EB_FIBER_SERDES:
135 case E1000_DEV_ID_82575GB_QUAD_COPPER:
136 mac->type = e1000_82575;
137 break;
138 case E1000_DEV_ID_82576:
139 case E1000_DEV_ID_82576_FIBER:
140 case E1000_DEV_ID_82576_SERDES:
141 case E1000_DEV_ID_82576_QUAD_COPPER:
142 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
143 case E1000_DEV_ID_82576_NS:
144 case E1000_DEV_ID_82576_NS_SERDES:
145 case E1000_DEV_ID_82576_SERDES_QUAD:
146 mac->type = e1000_82576;
147 break;
148 case E1000_DEV_ID_82580_COPPER:
149 case E1000_DEV_ID_82580_FIBER:
150 case E1000_DEV_ID_82580_SERDES:
151 case E1000_DEV_ID_82580_SGMII:
152 case E1000_DEV_ID_82580_COPPER_DUAL:
153 mac->type = e1000_82580;
154 break;
155 case E1000_DEV_ID_I350_COPPER:
156 mac->type = e1000_i350;
157 break;
158 default:
159 /* Should never have loaded on this device */
160 ret_val = -E1000_ERR_MAC_INIT;
161 break;
162 }
163
164 return (ret_val);
165 }
166
167 /*
168 * e1000_setup_init_funcs - Initializes function pointers
169 * @hw: pointer to the HW structure
170 * @init_device: true will initialize the rest of the function pointers
171 * getting the device ready for use. false will only set
172 * MAC type and the function pointers for the other init
173 * functions. Passing false will not generate any hardware
174 * reads or writes.
175 *
176 * This function must be called by a driver in order to use the rest
177 * of the 'shared' code files. Called by drivers only.
194 goto out;
195 }
196
197 /*
198 * Init function pointers to generic implementations. We do this first
199 * allowing a driver module to override it afterward.
200 */
201 e1000_init_mac_ops_generic(hw);
202 e1000_init_phy_ops_generic(hw);
203 e1000_init_nvm_ops_generic(hw);
204
205 /*
206 * Set up the init function pointers. These are functions within the
207 * adapter family file that sets up function pointers for the rest of
208 * the functions in that family.
209 */
210 switch (hw->mac.type) {
211 case e1000_82575:
212 case e1000_82576:
213 case e1000_82580:
214 case e1000_i350:
215 e1000_init_function_pointers_82575(hw);
216 break;
217 default:
218 DEBUGOUT("Hardware not supported\n");
219 ret_val = -E1000_ERR_CONFIG;
220 break;
221 }
222
223 /*
224 * Initialize the rest of the function pointers. These require some
225 * register reads/writes in some cases.
226 */
227 if (!(ret_val) && init_device) {
228 ret_val = e1000_init_mac_params(hw);
229 if (ret_val)
230 goto out;
231
232 ret_val = e1000_init_nvm_params(hw);
233 if (ret_val)
234 goto out;
|