Deleted Added
full compact
e1000_82542.c (176667) e1000_82542.c (177867)
1/*******************************************************************************
1/******************************************************************************
2
3 Copyright (c) 2001-2008, 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,

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

24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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
2
3 Copyright (c) 2001-2008, 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,

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

24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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_82542.c 176667 2008-02-29 21:50:11Z jfv $ */
32******************************************************************************/
33/*$FreeBSD: head/sys/dev/em/e1000_82542.c 177867 2008-04-02 22:00:36Z jfv $*/
34
34
35
36/* e1000_82542 (rev 1 & 2)
37 */
38
39#include "e1000_api.h"
40
35/* e1000_82542 (rev 1 & 2)
36 */
37
38#include "e1000_api.h"
39
41STATIC s32 e1000_init_phy_params_82542(struct e1000_hw *hw);
42STATIC s32 e1000_init_nvm_params_82542(struct e1000_hw *hw);
43STATIC s32 e1000_init_mac_params_82542(struct e1000_hw *hw);
44STATIC s32 e1000_get_bus_info_82542(struct e1000_hw *hw);
45STATIC s32 e1000_reset_hw_82542(struct e1000_hw *hw);
46STATIC s32 e1000_init_hw_82542(struct e1000_hw *hw);
47STATIC s32 e1000_setup_link_82542(struct e1000_hw *hw);
48STATIC s32 e1000_led_on_82542(struct e1000_hw *hw);
49STATIC s32 e1000_led_off_82542(struct e1000_hw *hw);
50STATIC void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw);
40static s32 e1000_init_phy_params_82542(struct e1000_hw *hw);
41static s32 e1000_init_nvm_params_82542(struct e1000_hw *hw);
42static s32 e1000_init_mac_params_82542(struct e1000_hw *hw);
43static s32 e1000_get_bus_info_82542(struct e1000_hw *hw);
44static s32 e1000_reset_hw_82542(struct e1000_hw *hw);
45static s32 e1000_init_hw_82542(struct e1000_hw *hw);
46static s32 e1000_setup_link_82542(struct e1000_hw *hw);
47static s32 e1000_led_on_82542(struct e1000_hw *hw);
48static s32 e1000_led_off_82542(struct e1000_hw *hw);
49static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index);
50static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw);
51
52struct e1000_dev_spec_82542 {
53 bool dma_fairness;
54};
55
56/**
57 * e1000_init_phy_params_82542 - Init PHY func ptrs.
58 * @hw: pointer to the HW structure
59 *
60 * This is a function pointer entry point called by the api module.
61 **/
51
52struct e1000_dev_spec_82542 {
53 bool dma_fairness;
54};
55
56/**
57 * e1000_init_phy_params_82542 - Init PHY func ptrs.
58 * @hw: pointer to the HW structure
59 *
60 * This is a function pointer entry point called by the api module.
61 **/
62STATIC s32 e1000_init_phy_params_82542(struct e1000_hw *hw)
62static s32 e1000_init_phy_params_82542(struct e1000_hw *hw)
63{
64 struct e1000_phy_info *phy = &hw->phy;
65 s32 ret_val = E1000_SUCCESS;
66
67 DEBUGFUNC("e1000_init_phy_params_82542");
68
69 phy->type = e1000_phy_none;
70
71 return ret_val;
72}
73
74/**
75 * e1000_init_nvm_params_82542 - Init NVM func ptrs.
76 * @hw: pointer to the HW structure
77 *
78 * This is a function pointer entry point called by the api module.
79 **/
63{
64 struct e1000_phy_info *phy = &hw->phy;
65 s32 ret_val = E1000_SUCCESS;
66
67 DEBUGFUNC("e1000_init_phy_params_82542");
68
69 phy->type = e1000_phy_none;
70
71 return ret_val;
72}
73
74/**
75 * e1000_init_nvm_params_82542 - Init NVM func ptrs.
76 * @hw: pointer to the HW structure
77 *
78 * This is a function pointer entry point called by the api module.
79 **/
80STATIC s32 e1000_init_nvm_params_82542(struct e1000_hw *hw)
80static s32 e1000_init_nvm_params_82542(struct e1000_hw *hw)
81{
82 struct e1000_nvm_info *nvm = &hw->nvm;
81{
82 struct e1000_nvm_info *nvm = &hw->nvm;
83 struct e1000_functions *func = &hw->func;
84
85 DEBUGFUNC("e1000_init_nvm_params_82542");
86
87 nvm->address_bits = 6;
88 nvm->delay_usec = 50;
89 nvm->opcode_bits = 3;
90 nvm->type = e1000_nvm_eeprom_microwire;
91 nvm->word_size = 64;
92
93 /* Function Pointers */
83
84 DEBUGFUNC("e1000_init_nvm_params_82542");
85
86 nvm->address_bits = 6;
87 nvm->delay_usec = 50;
88 nvm->opcode_bits = 3;
89 nvm->type = e1000_nvm_eeprom_microwire;
90 nvm->word_size = 64;
91
92 /* Function Pointers */
94 func->read_nvm = e1000_read_nvm_microwire;
95 func->release_nvm = e1000_stop_nvm;
96 func->write_nvm = e1000_write_nvm_microwire;
97 func->update_nvm = e1000_update_nvm_checksum_generic;
98 func->validate_nvm = e1000_validate_nvm_checksum_generic;
93 nvm->ops.read = e1000_read_nvm_microwire;
94 nvm->ops.release = e1000_stop_nvm;
95 nvm->ops.write = e1000_write_nvm_microwire;
96 nvm->ops.update = e1000_update_nvm_checksum_generic;
97 nvm->ops.validate = e1000_validate_nvm_checksum_generic;
99
100 return E1000_SUCCESS;
101}
102
103/**
104 * e1000_init_mac_params_82542 - Init MAC func ptrs.
105 * @hw: pointer to the HW structure
106 *
107 * This is a function pointer entry point called by the api module.
108 **/
98
99 return E1000_SUCCESS;
100}
101
102/**
103 * e1000_init_mac_params_82542 - Init MAC func ptrs.
104 * @hw: pointer to the HW structure
105 *
106 * This is a function pointer entry point called by the api module.
107 **/
109STATIC s32 e1000_init_mac_params_82542(struct e1000_hw *hw)
108static s32 e1000_init_mac_params_82542(struct e1000_hw *hw)
110{
111 struct e1000_mac_info *mac = &hw->mac;
109{
110 struct e1000_mac_info *mac = &hw->mac;
112 struct e1000_functions *func = &hw->func;
113 s32 ret_val = E1000_SUCCESS;
114
115 DEBUGFUNC("e1000_init_mac_params_82542");
116
117 /* Set media type */
118 hw->phy.media_type = e1000_media_type_fiber;
119
120 /* Set mta register count */
121 mac->mta_reg_count = 128;
122 /* Set rar entry count */
123 mac->rar_entry_count = E1000_RAR_ENTRIES;
124
125 /* Function pointers */
126
127 /* bus type/speed/width */
111 s32 ret_val = E1000_SUCCESS;
112
113 DEBUGFUNC("e1000_init_mac_params_82542");
114
115 /* Set media type */
116 hw->phy.media_type = e1000_media_type_fiber;
117
118 /* Set mta register count */
119 mac->mta_reg_count = 128;
120 /* Set rar entry count */
121 mac->rar_entry_count = E1000_RAR_ENTRIES;
122
123 /* Function pointers */
124
125 /* bus type/speed/width */
128 func->get_bus_info = e1000_get_bus_info_82542;
126 mac->ops.get_bus_info = e1000_get_bus_info_82542;
129 /* reset */
127 /* reset */
130 func->reset_hw = e1000_reset_hw_82542;
128 mac->ops.reset_hw = e1000_reset_hw_82542;
131 /* hw initialization */
129 /* hw initialization */
132 func->init_hw = e1000_init_hw_82542;
130 mac->ops.init_hw = e1000_init_hw_82542;
133 /* link setup */
131 /* link setup */
134 func->setup_link = e1000_setup_link_82542;
132 mac->ops.setup_link = e1000_setup_link_82542;
135 /* phy/fiber/serdes setup */
133 /* phy/fiber/serdes setup */
136 func->setup_physical_interface = e1000_setup_fiber_serdes_link_generic;
134 mac->ops.setup_physical_interface = e1000_setup_fiber_serdes_link_generic;
137 /* check for link */
135 /* check for link */
138 func->check_for_link = e1000_check_for_fiber_link_generic;
136 mac->ops.check_for_link = e1000_check_for_fiber_link_generic;
139 /* multicast address update */
137 /* multicast address update */
140 func->update_mc_addr_list = e1000_update_mc_addr_list_generic;
138 mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic;
141 /* writing VFTA */
139 /* writing VFTA */
142 func->write_vfta = e1000_write_vfta_generic;
140 mac->ops.write_vfta = e1000_write_vfta_generic;
143 /* clearing VFTA */
141 /* clearing VFTA */
144 func->clear_vfta = e1000_clear_vfta_generic;
142 mac->ops.clear_vfta = e1000_clear_vfta_generic;
145 /* setting MTA */
143 /* setting MTA */
146 func->mta_set = e1000_mta_set_generic;
144 mac->ops.mta_set = e1000_mta_set_generic;
145 /* set RAR */
146 mac->ops.rar_set = e1000_rar_set_82542;
147 /* turn on/off LED */
147 /* turn on/off LED */
148 func->led_on = e1000_led_on_82542;
149 func->led_off = e1000_led_off_82542;
148 mac->ops.led_on = e1000_led_on_82542;
149 mac->ops.led_off = e1000_led_off_82542;
150 /* remove device */
150 /* remove device */
151 func->remove_device = e1000_remove_device_generic;
151 mac->ops.remove_device = e1000_remove_device_generic;
152 /* clear hardware counters */
152 /* clear hardware counters */
153 func->clear_hw_cntrs = e1000_clear_hw_cntrs_82542;
153 mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82542;
154 /* link info */
154 /* link info */
155 func->get_link_up_info = e1000_get_speed_and_duplex_fiber_serdes_generic;
155 mac->ops.get_link_up_info = e1000_get_speed_and_duplex_fiber_serdes_generic;
156
157 hw->dev_spec_size = sizeof(struct e1000_dev_spec_82542);
158
159 /* Device-specific structure allocation */
160 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size);
161
162 return ret_val;
163}

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

168 *
169 * The only function explicitly called by the api module to initialize
170 * all function pointers and parameters.
171 **/
172void e1000_init_function_pointers_82542(struct e1000_hw *hw)
173{
174 DEBUGFUNC("e1000_init_function_pointers_82542");
175
156
157 hw->dev_spec_size = sizeof(struct e1000_dev_spec_82542);
158
159 /* Device-specific structure allocation */
160 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size);
161
162 return ret_val;
163}

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

168 *
169 * The only function explicitly called by the api module to initialize
170 * all function pointers and parameters.
171 **/
172void e1000_init_function_pointers_82542(struct e1000_hw *hw)
173{
174 DEBUGFUNC("e1000_init_function_pointers_82542");
175
176 hw->func.init_mac_params = e1000_init_mac_params_82542;
177 hw->func.init_nvm_params = e1000_init_nvm_params_82542;
178 hw->func.init_phy_params = e1000_init_phy_params_82542;
176 hw->mac.ops.init_params = e1000_init_mac_params_82542;
177 hw->nvm.ops.init_params = e1000_init_nvm_params_82542;
178 hw->phy.ops.init_params = e1000_init_phy_params_82542;
179}
180
181/**
182 * e1000_get_bus_info_82542 - Obtain bus information for adapter
183 * @hw: pointer to the HW structure
184 *
185 * This will obtain information about the HW bus for which the
186 * adapter is attached and stores it in the hw structure. This is a function
187 * pointer entry point called by the api module.
188 **/
179}
180
181/**
182 * e1000_get_bus_info_82542 - Obtain bus information for adapter
183 * @hw: pointer to the HW structure
184 *
185 * This will obtain information about the HW bus for which the
186 * adapter is attached and stores it in the hw structure. This is a function
187 * pointer entry point called by the api module.
188 **/
189STATIC s32 e1000_get_bus_info_82542(struct e1000_hw *hw)
189static s32 e1000_get_bus_info_82542(struct e1000_hw *hw)
190{
191 DEBUGFUNC("e1000_get_bus_info_82542");
192
193 hw->bus.type = e1000_bus_type_pci;
194 hw->bus.speed = e1000_bus_speed_unknown;
195 hw->bus.width = e1000_bus_width_unknown;
196
197 return E1000_SUCCESS;
198}
199
200/**
201 * e1000_reset_hw_82542 - Reset hardware
202 * @hw: pointer to the HW structure
203 *
204 * This resets the hardware into a known state. This is a
205 * function pointer entry point called by the api module.
206 **/
190{
191 DEBUGFUNC("e1000_get_bus_info_82542");
192
193 hw->bus.type = e1000_bus_type_pci;
194 hw->bus.speed = e1000_bus_speed_unknown;
195 hw->bus.width = e1000_bus_width_unknown;
196
197 return E1000_SUCCESS;
198}
199
200/**
201 * e1000_reset_hw_82542 - Reset hardware
202 * @hw: pointer to the HW structure
203 *
204 * This resets the hardware into a known state. This is a
205 * function pointer entry point called by the api module.
206 **/
207STATIC s32 e1000_reset_hw_82542(struct e1000_hw *hw)
207static s32 e1000_reset_hw_82542(struct e1000_hw *hw)
208{
209 struct e1000_bus_info *bus = &hw->bus;
210 s32 ret_val = E1000_SUCCESS;
211 u32 ctrl, icr;
212
213 DEBUGFUNC("e1000_reset_hw_82542");
214
215 if (hw->revision_id == E1000_REVISION_2) {

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

230 */
231 msec_delay(10);
232
233 ctrl = E1000_READ_REG(hw, E1000_CTRL);
234
235 DEBUGOUT("Issuing a global reset to 82542/82543 MAC\n");
236 E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
237
208{
209 struct e1000_bus_info *bus = &hw->bus;
210 s32 ret_val = E1000_SUCCESS;
211 u32 ctrl, icr;
212
213 DEBUGFUNC("e1000_reset_hw_82542");
214
215 if (hw->revision_id == E1000_REVISION_2) {

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

230 */
231 msec_delay(10);
232
233 ctrl = E1000_READ_REG(hw, E1000_CTRL);
234
235 DEBUGOUT("Issuing a global reset to 82542/82543 MAC\n");
236 E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
237
238 e1000_reload_nvm(hw);
238 hw->nvm.ops.reload(hw);
239 msec_delay(2);
240
241 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
242 icr = E1000_READ_REG(hw, E1000_ICR);
243
244 if (hw->revision_id == E1000_REVISION_2) {
245 if (bus->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
246 e1000_pci_set_mwi(hw);

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

251
252/**
253 * e1000_init_hw_82542 - Initialize hardware
254 * @hw: pointer to the HW structure
255 *
256 * This inits the hardware readying it for operation. This is a
257 * function pointer entry point called by the api module.
258 **/
239 msec_delay(2);
240
241 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
242 icr = E1000_READ_REG(hw, E1000_ICR);
243
244 if (hw->revision_id == E1000_REVISION_2) {
245 if (bus->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
246 e1000_pci_set_mwi(hw);

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

251
252/**
253 * e1000_init_hw_82542 - Initialize hardware
254 * @hw: pointer to the HW structure
255 *
256 * This inits the hardware readying it for operation. This is a
257 * function pointer entry point called by the api module.
258 **/
259STATIC s32 e1000_init_hw_82542(struct e1000_hw *hw)
259static s32 e1000_init_hw_82542(struct e1000_hw *hw)
260{
261 struct e1000_mac_info *mac = &hw->mac;
262 struct e1000_dev_spec_82542 *dev_spec;
263 s32 ret_val = E1000_SUCCESS;
264 u32 ctrl;
265 u16 i;
266
267 DEBUGFUNC("e1000_init_hw_82542");
268
269 dev_spec = (struct e1000_dev_spec_82542 *)hw->dev_spec;
270
271 /* Disabling VLAN filtering */
272 E1000_WRITE_REG(hw, E1000_VET, 0);
260{
261 struct e1000_mac_info *mac = &hw->mac;
262 struct e1000_dev_spec_82542 *dev_spec;
263 s32 ret_val = E1000_SUCCESS;
264 u32 ctrl;
265 u16 i;
266
267 DEBUGFUNC("e1000_init_hw_82542");
268
269 dev_spec = (struct e1000_dev_spec_82542 *)hw->dev_spec;
270
271 /* Disabling VLAN filtering */
272 E1000_WRITE_REG(hw, E1000_VET, 0);
273 e1000_clear_vfta(hw);
273 mac->ops.clear_vfta(hw);
274
275 /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */
276 if (hw->revision_id == E1000_REVISION_2) {
277 DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
278 e1000_pci_clear_mwi(hw);
279 E1000_WRITE_REG(hw, E1000_RCTL, E1000_RCTL_RST);
280 E1000_WRITE_FLUSH(hw);
281 msec_delay(5);

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

328 *
329 * Determines which flow control settings to use, then configures flow
330 * control. Calls the appropriate media-specific link configuration
331 * function. Assuming the adapter has a valid link partner, a valid link
332 * should be established. Assumes the hardware has previously been reset
333 * and the transmitter and receiver are not enabled. This is a function
334 * pointer entry point called by the api module.
335 **/
274
275 /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */
276 if (hw->revision_id == E1000_REVISION_2) {
277 DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
278 e1000_pci_clear_mwi(hw);
279 E1000_WRITE_REG(hw, E1000_RCTL, E1000_RCTL_RST);
280 E1000_WRITE_FLUSH(hw);
281 msec_delay(5);

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

328 *
329 * Determines which flow control settings to use, then configures flow
330 * control. Calls the appropriate media-specific link configuration
331 * function. Assuming the adapter has a valid link partner, a valid link
332 * should be established. Assumes the hardware has previously been reset
333 * and the transmitter and receiver are not enabled. This is a function
334 * pointer entry point called by the api module.
335 **/
336STATIC s32 e1000_setup_link_82542(struct e1000_hw *hw)
336static s32 e1000_setup_link_82542(struct e1000_hw *hw)
337{
338 struct e1000_mac_info *mac = &hw->mac;
337{
338 struct e1000_mac_info *mac = &hw->mac;
339 struct e1000_functions *func = &hw->func;
340 s32 ret_val = E1000_SUCCESS;
341
342 DEBUGFUNC("e1000_setup_link_82542");
343
344 ret_val = e1000_set_default_fc_generic(hw);
345 if (ret_val)
346 goto out;
347

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

355 * case we get disconnected and then reconnected into a different hub
356 * or switch with different Flow Control capabilities.
357 */
358 hw->fc.original_type = hw->fc.type;
359
360 DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc.type);
361
362 /* Call the necessary subroutine to configure the link. */
339 s32 ret_val = E1000_SUCCESS;
340
341 DEBUGFUNC("e1000_setup_link_82542");
342
343 ret_val = e1000_set_default_fc_generic(hw);
344 if (ret_val)
345 goto out;
346

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

354 * case we get disconnected and then reconnected into a different hub
355 * or switch with different Flow Control capabilities.
356 */
357 hw->fc.original_type = hw->fc.type;
358
359 DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc.type);
360
361 /* Call the necessary subroutine to configure the link. */
363 ret_val = func->setup_physical_interface(hw);
362 ret_val = mac->ops.setup_physical_interface(hw);
364 if (ret_val)
365 goto out;
366
367 /*
368 * Initialize the flow control address, type, and PAUSE timer
369 * registers to their default values. This is done even if flow
370 * control is disabled, because it does not hurt anything to
371 * initialize these registers.

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

386
387/**
388 * e1000_led_on_82542 - Turn on SW controllable LED
389 * @hw: pointer to the HW structure
390 *
391 * Turns the SW defined LED on. This is a function pointer entry point
392 * called by the api module.
393 **/
363 if (ret_val)
364 goto out;
365
366 /*
367 * Initialize the flow control address, type, and PAUSE timer
368 * registers to their default values. This is done even if flow
369 * control is disabled, because it does not hurt anything to
370 * initialize these registers.

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

385
386/**
387 * e1000_led_on_82542 - Turn on SW controllable LED
388 * @hw: pointer to the HW structure
389 *
390 * Turns the SW defined LED on. This is a function pointer entry point
391 * called by the api module.
392 **/
394STATIC s32 e1000_led_on_82542(struct e1000_hw *hw)
393static s32 e1000_led_on_82542(struct e1000_hw *hw)
395{
396 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL);
397
398 DEBUGFUNC("e1000_led_on_82542");
399
400 ctrl |= E1000_CTRL_SWDPIN0;
401 ctrl |= E1000_CTRL_SWDPIO0;
402 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
403
404 return E1000_SUCCESS;
405}
406
407/**
408 * e1000_led_off_82542 - Turn off SW controllable LED
409 * @hw: pointer to the HW structure
410 *
411 * Turns the SW defined LED off. This is a function pointer entry point
412 * called by the api module.
413 **/
394{
395 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL);
396
397 DEBUGFUNC("e1000_led_on_82542");
398
399 ctrl |= E1000_CTRL_SWDPIN0;
400 ctrl |= E1000_CTRL_SWDPIO0;
401 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
402
403 return E1000_SUCCESS;
404}
405
406/**
407 * e1000_led_off_82542 - Turn off SW controllable LED
408 * @hw: pointer to the HW structure
409 *
410 * Turns the SW defined LED off. This is a function pointer entry point
411 * called by the api module.
412 **/
414STATIC s32 e1000_led_off_82542(struct e1000_hw *hw)
413static s32 e1000_led_off_82542(struct e1000_hw *hw)
415{
416 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL);
417
418 DEBUGFUNC("e1000_led_off_82542");
419
420 ctrl &= ~E1000_CTRL_SWDPIN0;
421 ctrl |= E1000_CTRL_SWDPIO0;
422 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
423
424 return E1000_SUCCESS;
425}
426
427/**
414{
415 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL);
416
417 DEBUGFUNC("e1000_led_off_82542");
418
419 ctrl &= ~E1000_CTRL_SWDPIN0;
420 ctrl |= E1000_CTRL_SWDPIO0;
421 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
422
423 return E1000_SUCCESS;
424}
425
426/**
427 * e1000_rar_set_82542 - Set receive address register
428 * @hw: pointer to the HW structure
429 * @addr: pointer to the receive address
430 * @index: receive address array register
431 *
432 * Sets the receive address array register at index to the address passed
433 * in by addr.
434 **/
435static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index)
436{
437 u32 rar_low, rar_high;
438
439 DEBUGFUNC("e1000_rar_set_82542");
440
441 /*
442 * HW expects these in little endian so we reverse the byte order
443 * from network order (big endian) to little endian
444 */
445 rar_low = ((u32) addr[0] |
446 ((u32) addr[1] << 8) |
447 ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
448
449 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
450
451 /* If MAC address zero, no need to set the AV bit */
452 if (rar_low || rar_high) {
453 if (!hw->mac.disable_av)
454 rar_high |= E1000_RAH_AV;
455 }
456
457 E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low);
458 E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high);
459}
460
461/**
428 * e1000_translate_register_82542 - Translate the proper register offset
429 * @reg: e1000 register to be read
430 *
431 * Registers in 82542 are located in different offsets than other adapters
432 * even though they function in the same manner. This function takes in
433 * the name of the register to read and returns the correct offset for
434 * 82542 silicon.
435 **/

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

522}
523
524/**
525 * e1000_clear_hw_cntrs_82542 - Clear device specific hardware counters
526 * @hw: pointer to the HW structure
527 *
528 * Clears the hardware counters by reading the counter registers.
529 **/
462 * e1000_translate_register_82542 - Translate the proper register offset
463 * @reg: e1000 register to be read
464 *
465 * Registers in 82542 are located in different offsets than other adapters
466 * even though they function in the same manner. This function takes in
467 * the name of the register to read and returns the correct offset for
468 * 82542 silicon.
469 **/

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

556}
557
558/**
559 * e1000_clear_hw_cntrs_82542 - Clear device specific hardware counters
560 * @hw: pointer to the HW structure
561 *
562 * Clears the hardware counters by reading the counter registers.
563 **/
530STATIC void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw)
564static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw)
531{
532 volatile u32 temp;
533
534 DEBUGFUNC("e1000_clear_hw_cntrs_82542");
535
536 e1000_clear_hw_cntrs_base_generic(hw);
537
538 temp = E1000_READ_REG(hw, E1000_PRC64);

--- 12 unchanged lines hidden ---
565{
566 volatile u32 temp;
567
568 DEBUGFUNC("e1000_clear_hw_cntrs_82542");
569
570 e1000_clear_hw_cntrs_base_generic(hw);
571
572 temp = E1000_READ_REG(hw, E1000_PRC64);

--- 12 unchanged lines hidden ---