e1000_82542.c (169248) | e1000_82542.c (169589) |
---|---|
1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ | 1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ |
33/*$FreeBSD: head/sys/dev/em/e1000_82542.c 169589 2007-05-16 00:14:23Z jfv $*/ |
|
33 | 34 |
34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_82542.c 169248 2007-05-04 13:30:44Z rwatson $"); | |
36 | 35 |
37 | |
38/* e1000_82542 (rev 1 & 2) 39 */ 40 41#include "e1000_api.h" 42 43void e1000_init_function_pointers_82542(struct e1000_hw *hw); 44 45STATIC s32 e1000_init_phy_params_82542(struct e1000_hw *hw); --- 8 unchanged lines hidden (view full) --- 54STATIC void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); 55 56struct e1000_dev_spec_82542 { 57 boolean_t dma_fairness; 58}; 59 60/** 61 * e1000_init_phy_params_82542 - Init PHY func ptrs. | 36/* e1000_82542 (rev 1 & 2) 37 */ 38 39#include "e1000_api.h" 40 41void e1000_init_function_pointers_82542(struct e1000_hw *hw); 42 43STATIC s32 e1000_init_phy_params_82542(struct e1000_hw *hw); --- 8 unchanged lines hidden (view full) --- 52STATIC void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); 53 54struct e1000_dev_spec_82542 { 55 boolean_t dma_fairness; 56}; 57 58/** 59 * e1000_init_phy_params_82542 - Init PHY func ptrs. |
62 * @hw - pointer to the HW structure | 60 * @hw: pointer to the HW structure |
63 * 64 * This is a function pointer entry point called by the api module. 65 **/ 66STATIC s32 67e1000_init_phy_params_82542(struct e1000_hw *hw) 68{ 69 struct e1000_phy_info *phy = &hw->phy; 70 s32 ret_val = E1000_SUCCESS; 71 72 DEBUGFUNC("e1000_init_phy_params_82542"); 73 74 phy->type = e1000_phy_none; 75 76 return ret_val; 77} 78 79/** 80 * e1000_init_nvm_params_82542 - Init NVM func ptrs. | 61 * 62 * This is a function pointer entry point called by the api module. 63 **/ 64STATIC s32 65e1000_init_phy_params_82542(struct e1000_hw *hw) 66{ 67 struct e1000_phy_info *phy = &hw->phy; 68 s32 ret_val = E1000_SUCCESS; 69 70 DEBUGFUNC("e1000_init_phy_params_82542"); 71 72 phy->type = e1000_phy_none; 73 74 return ret_val; 75} 76 77/** 78 * e1000_init_nvm_params_82542 - Init NVM func ptrs. |
81 * @hw - pointer to the HW structure | 79 * @hw: pointer to the HW structure |
82 * 83 * This is a function pointer entry point called by the api module. 84 **/ 85STATIC s32 86e1000_init_nvm_params_82542(struct e1000_hw *hw) 87{ 88 struct e1000_nvm_info *nvm = &hw->nvm; 89 struct e1000_functions *func = &hw->func; --- 13 unchanged lines hidden (view full) --- 103 func->update_nvm = e1000_update_nvm_checksum_generic; 104 func->validate_nvm = e1000_validate_nvm_checksum_generic; 105 106 return E1000_SUCCESS; 107} 108 109/** 110 * e1000_init_mac_params_82542 - Init MAC func ptrs. | 80 * 81 * This is a function pointer entry point called by the api module. 82 **/ 83STATIC s32 84e1000_init_nvm_params_82542(struct e1000_hw *hw) 85{ 86 struct e1000_nvm_info *nvm = &hw->nvm; 87 struct e1000_functions *func = &hw->func; --- 13 unchanged lines hidden (view full) --- 101 func->update_nvm = e1000_update_nvm_checksum_generic; 102 func->validate_nvm = e1000_validate_nvm_checksum_generic; 103 104 return E1000_SUCCESS; 105} 106 107/** 108 * e1000_init_mac_params_82542 - Init MAC func ptrs. |
111 * @hw - pointer to the HW structure | 109 * @hw: pointer to the HW structure |
112 * 113 * This is a function pointer entry point called by the api module. 114 **/ 115STATIC s32 116e1000_init_mac_params_82542(struct e1000_hw *hw) 117{ 118 struct e1000_mac_info *mac = &hw->mac; 119 struct e1000_functions *func = &hw->func; --- 46 unchanged lines hidden (view full) --- 166 /* Device-specific structure allocation */ 167 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); 168 169 return ret_val; 170} 171 172/** 173 * e1000_init_function_pointers_82542 - Init func ptrs. | 110 * 111 * This is a function pointer entry point called by the api module. 112 **/ 113STATIC s32 114e1000_init_mac_params_82542(struct e1000_hw *hw) 115{ 116 struct e1000_mac_info *mac = &hw->mac; 117 struct e1000_functions *func = &hw->func; --- 46 unchanged lines hidden (view full) --- 164 /* Device-specific structure allocation */ 165 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); 166 167 return ret_val; 168} 169 170/** 171 * e1000_init_function_pointers_82542 - Init func ptrs. |
174 * @hw - pointer to the HW structure | 172 * @hw: pointer to the HW structure |
175 * 176 * The only function explicitly called by the api module to initialize 177 * all function pointers and parameters. 178 **/ 179void 180e1000_init_function_pointers_82542(struct e1000_hw *hw) 181{ 182 DEBUGFUNC("e1000_init_function_pointers_82542"); 183 184 hw->func.init_mac_params = e1000_init_mac_params_82542; 185 hw->func.init_nvm_params = e1000_init_nvm_params_82542; 186 hw->func.init_phy_params = e1000_init_phy_params_82542; 187} 188 189/** 190 * e1000_get_bus_info_82542 - Obtain bus information for adapter | 173 * 174 * The only function explicitly called by the api module to initialize 175 * all function pointers and parameters. 176 **/ 177void 178e1000_init_function_pointers_82542(struct e1000_hw *hw) 179{ 180 DEBUGFUNC("e1000_init_function_pointers_82542"); 181 182 hw->func.init_mac_params = e1000_init_mac_params_82542; 183 hw->func.init_nvm_params = e1000_init_nvm_params_82542; 184 hw->func.init_phy_params = e1000_init_phy_params_82542; 185} 186 187/** 188 * e1000_get_bus_info_82542 - Obtain bus information for adapter |
191 * @hw - pointer to the HW structure | 189 * @hw: pointer to the HW structure |
192 * 193 * This will obtain information about the HW bus for which the 194 * adaper is attached and stores it in the hw structure. This is a function 195 * pointer entry point called by the api module. 196 **/ 197STATIC s32 198e1000_get_bus_info_82542(struct e1000_hw *hw) 199{ 200 DEBUGFUNC("e1000_get_bus_info_82542"); 201 202 hw->bus.type = e1000_bus_type_pci; 203 hw->bus.speed = e1000_bus_speed_unknown; 204 hw->bus.width = e1000_bus_width_unknown; 205 206 return E1000_SUCCESS; 207} 208 209/** 210 * e1000_reset_hw_82542 - Reset hardware | 190 * 191 * This will obtain information about the HW bus for which the 192 * adaper is attached and stores it in the hw structure. This is a function 193 * pointer entry point called by the api module. 194 **/ 195STATIC s32 196e1000_get_bus_info_82542(struct e1000_hw *hw) 197{ 198 DEBUGFUNC("e1000_get_bus_info_82542"); 199 200 hw->bus.type = e1000_bus_type_pci; 201 hw->bus.speed = e1000_bus_speed_unknown; 202 hw->bus.width = e1000_bus_width_unknown; 203 204 return E1000_SUCCESS; 205} 206 207/** 208 * e1000_reset_hw_82542 - Reset hardware |
211 * @hw - pointer to the HW structure | 209 * @hw: pointer to the HW structure |
212 * 213 * This resets the hardware into a known state. This is a 214 * function pointer entry point called by the api module. 215 **/ 216STATIC s32 217e1000_reset_hw_82542(struct e1000_hw *hw) 218{ 219 struct e1000_bus_info *bus = &hw->bus; --- 35 unchanged lines hidden (view full) --- 255 e1000_pci_set_mwi(hw); 256 } 257 258 return ret_val; 259} 260 261/** 262 * e1000_init_hw_82542 - Initialize hardware | 210 * 211 * This resets the hardware into a known state. This is a 212 * function pointer entry point called by the api module. 213 **/ 214STATIC s32 215e1000_reset_hw_82542(struct e1000_hw *hw) 216{ 217 struct e1000_bus_info *bus = &hw->bus; --- 35 unchanged lines hidden (view full) --- 253 e1000_pci_set_mwi(hw); 254 } 255 256 return ret_val; 257} 258 259/** 260 * e1000_init_hw_82542 - Initialize hardware |
263 * @hw - pointer to the HW structure | 261 * @hw: pointer to the HW structure |
264 * 265 * This inits the hardware readying it for operation. This is a 266 * function pointer entry point called by the api module. 267 **/ 268STATIC s32 269e1000_init_hw_82542(struct e1000_hw *hw) 270{ 271 struct e1000_mac_info *mac = &hw->mac; --- 55 unchanged lines hidden (view full) --- 327 */ 328 e1000_clear_hw_cntrs_82542(hw); 329 330 return ret_val; 331} 332 333/** 334 * e1000_setup_link_82542 - Setup flow control and link settings | 262 * 263 * This inits the hardware readying it for operation. This is a 264 * function pointer entry point called by the api module. 265 **/ 266STATIC s32 267e1000_init_hw_82542(struct e1000_hw *hw) 268{ 269 struct e1000_mac_info *mac = &hw->mac; --- 55 unchanged lines hidden (view full) --- 325 */ 326 e1000_clear_hw_cntrs_82542(hw); 327 328 return ret_val; 329} 330 331/** 332 * e1000_setup_link_82542 - Setup flow control and link settings |
335 * @hw - pointer to the HW structure | 333 * @hw: pointer to the HW structure |
336 * 337 * Determines which flow control settings to use, then configures flow 338 * control. Calls the appropriate media-specific link configuration 339 * function. Assuming the adapter has a valid link partner, a valid link 340 * should be established. Assumes the hardware has previously been reset 341 * and the transmitter and receiver are not enabled. This is a function 342 * pointer entry point called by the api module. 343 **/ --- 44 unchanged lines hidden (view full) --- 388 ret_val = e1000_set_fc_watermarks_generic(hw); 389 390out: 391 return ret_val; 392} 393 394/** 395 * e1000_led_on_82542 - Turn on SW controllable LED | 334 * 335 * Determines which flow control settings to use, then configures flow 336 * control. Calls the appropriate media-specific link configuration 337 * function. Assuming the adapter has a valid link partner, a valid link 338 * should be established. Assumes the hardware has previously been reset 339 * and the transmitter and receiver are not enabled. This is a function 340 * pointer entry point called by the api module. 341 **/ --- 44 unchanged lines hidden (view full) --- 386 ret_val = e1000_set_fc_watermarks_generic(hw); 387 388out: 389 return ret_val; 390} 391 392/** 393 * e1000_led_on_82542 - Turn on SW controllable LED |
396 * @hw - pointer to the HW structure | 394 * @hw: pointer to the HW structure |
397 * 398 * Turns the SW defined LED on. This is a function pointer entry point 399 * called by the api module. 400 **/ 401STATIC s32 402e1000_led_on_82542(struct e1000_hw *hw) 403{ 404 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 4 unchanged lines hidden (view full) --- 409 ctrl |= E1000_CTRL_SWDPIO0; 410 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 411 412 return E1000_SUCCESS; 413} 414 415/** 416 * e1000_led_off_82542 - Turn off SW controllable LED | 395 * 396 * Turns the SW defined LED on. This is a function pointer entry point 397 * called by the api module. 398 **/ 399STATIC s32 400e1000_led_on_82542(struct e1000_hw *hw) 401{ 402 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 4 unchanged lines hidden (view full) --- 407 ctrl |= E1000_CTRL_SWDPIO0; 408 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 409 410 return E1000_SUCCESS; 411} 412 413/** 414 * e1000_led_off_82542 - Turn off SW controllable LED |
417 * @hw - pointer to the HW structure | 415 * @hw: pointer to the HW structure |
418 * 419 * Turns the SW defined LED off. This is a function pointer entry point 420 * called by the api module. 421 **/ 422STATIC s32 423e1000_led_off_82542(struct e1000_hw *hw) 424{ 425 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 4 unchanged lines hidden (view full) --- 430 ctrl |= E1000_CTRL_SWDPIO0; 431 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 432 433 return E1000_SUCCESS; 434} 435 436/** 437 * e1000_translate_register_82542 - Translate the proper regiser offset | 416 * 417 * Turns the SW defined LED off. This is a function pointer entry point 418 * called by the api module. 419 **/ 420STATIC s32 421e1000_led_off_82542(struct e1000_hw *hw) 422{ 423 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 4 unchanged lines hidden (view full) --- 428 ctrl |= E1000_CTRL_SWDPIO0; 429 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 430 431 return E1000_SUCCESS; 432} 433 434/** 435 * e1000_translate_register_82542 - Translate the proper regiser offset |
438 * @reg - e1000 register to be read | 436 * @reg: e1000 register to be read |
439 * 440 * Registers in 82542 are located in different offsets than other adapters 441 * even though they function in the same manner. This function takes in 442 * the name of the register to read and returns the correct offset for 443 * 82542 silicon. 444 **/ 445u32 446e1000_translate_register_82542(u32 reg) --- 80 unchanged lines hidden (view full) --- 527 break; 528 } 529 530 return reg; 531} 532 533/** 534 * e1000_clear_hw_cntrs_82542 - Clear device specific hardware counters | 437 * 438 * Registers in 82542 are located in different offsets than other adapters 439 * even though they function in the same manner. This function takes in 440 * the name of the register to read and returns the correct offset for 441 * 82542 silicon. 442 **/ 443u32 444e1000_translate_register_82542(u32 reg) --- 80 unchanged lines hidden (view full) --- 525 break; 526 } 527 528 return reg; 529} 530 531/** 532 * e1000_clear_hw_cntrs_82542 - Clear device specific hardware counters |
535 * @hw - pointer to the HW structure | 533 * @hw: pointer to the HW structure |
536 * 537 * Clears the hardware counters by reading the counter registers. 538 **/ 539STATIC void 540e1000_clear_hw_cntrs_82542(struct e1000_hw *hw) 541{ 542 volatile u32 temp; 543 --- 17 unchanged lines hidden --- | 534 * 535 * Clears the hardware counters by reading the counter registers. 536 **/ 537STATIC void 538e1000_clear_hw_cntrs_82542(struct e1000_hw *hw) 539{ 540 volatile u32 temp; 541 --- 17 unchanged lines hidden --- |