e1000_api.h File Reference

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <gpxe/io.h>
#include <errno.h>
#include <byteswap.h>
#include <gpxe/pci.h>
#include <gpxe/malloc.h>
#include <gpxe/if_ether.h>
#include <gpxe/ethernet.h>
#include <gpxe/iobuf.h>
#include <gpxe/netdevice.h>
#include "e1000_hw.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void e1000_init_function_pointers_82542 (struct e1000_hw *hw)
 e1000_init_function_pointers_82542 - Init func ptrs.
void e1000_init_function_pointers_82543 (struct e1000_hw *hw)
 e1000_init_function_pointers_82543 - Init func ptrs.
void e1000_init_function_pointers_82540 (struct e1000_hw *hw)
 e1000_init_function_pointers_82540 - Init func ptrs.
void e1000_init_function_pointers_82541 (struct e1000_hw *hw)
 e1000_init_function_pointers_82541 - Init func ptrs.
s32 e1000_set_mac_type (struct e1000_hw *hw)
 e1000_set_mac_type - Sets MAC type : pointer to the HW structure
s32 e1000_setup_init_funcs (struct e1000_hw *hw, bool init_device)
 e1000_setup_init_funcs - Initializes function pointers : pointer to the HW structure : true will initialize the rest of the function pointers getting the device ready for use.
s32 e1000_init_mac_params (struct e1000_hw *hw)
 e1000_init_mac_params - Initialize MAC function pointers : pointer to the HW structure
s32 e1000_init_nvm_params (struct e1000_hw *hw)
 e1000_init_nvm_params - Initialize NVM function pointers : pointer to the HW structure
s32 e1000_init_phy_params (struct e1000_hw *hw)
 e1000_init_phy_params - Initialize PHY function pointers : pointer to the HW structure
s32 e1000_get_bus_info (struct e1000_hw *hw)
 e1000_get_bus_info - Obtain bus information for adapter : pointer to the HW structure
void e1000_clear_vfta (struct e1000_hw *hw)
 e1000_clear_vfta - Clear VLAN filter table : pointer to the HW structure
void e1000_write_vfta (struct e1000_hw *hw, u32 offset, u32 value)
 e1000_write_vfta - Write value to VLAN filter table : pointer to the HW structure : the 32-bit offset in which to write the value to.
s32 e1000_force_mac_fc (struct e1000_hw *hw)
 e1000_force_mac_fc - Force MAC flow control : pointer to the HW structure
s32 e1000_check_for_link (struct e1000_hw *hw)
 e1000_check_for_link - Check/Store link connection : pointer to the HW structure
s32 e1000_reset_hw (struct e1000_hw *hw)
 e1000_reset_hw - Reset hardware : pointer to the HW structure
s32 e1000_init_hw (struct e1000_hw *hw)
 e1000_init_hw - Initialize hardware : pointer to the HW structure
s32 e1000_setup_link (struct e1000_hw *hw)
 e1000_setup_link - Configures link and flow control : pointer to the HW structure
s32 e1000_get_speed_and_duplex (struct e1000_hw *hw, u16 *speed, u16 *duplex)
 e1000_get_speed_and_duplex - Returns current speed and duplex : pointer to the HW structure : pointer to a 16-bit value to store the speed : pointer to a 16-bit value to store the duplex.
s32 e1000_disable_pcie_master (struct e1000_hw *hw)
 e1000_disable_pcie_master - Disable PCI-Express master access : pointer to the HW structure
void e1000_config_collision_dist (struct e1000_hw *hw)
 e1000_config_collision_dist - Configure collision distance : pointer to the HW structure
void e1000_rar_set (struct e1000_hw *hw, u8 *addr, u32 index)
 e1000_rar_set - Sets a receive address register : pointer to the HW structure : address to set the RAR to : the RAR to set
void e1000_mta_set (struct e1000_hw *hw, u32 hash_value)
 e1000_mta_set - Sets multicast table bit : pointer to the HW structure : Multicast hash value.
u32 e1000_hash_mc_addr (struct e1000_hw *hw, u8 *mc_addr)
 e1000_hash_mc_addr - Determines address location in multicast table : pointer to the HW structure : Multicast address to hash.
void e1000_update_mc_addr_list (struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count)
 e1000_update_mc_addr_list - Update Multicast addresses : pointer to the HW structure : array of multicast addresses to program : number of multicast addresses to program
s32 e1000_setup_led (struct e1000_hw *hw)
 e1000_setup_led - Configures SW controllable LED : pointer to the HW structure
s32 e1000_cleanup_led (struct e1000_hw *hw)
 e1000_cleanup_led - Restores SW controllable LED : pointer to the HW structure
s32 e1000_check_reset_block (struct e1000_hw *hw)
 e1000_check_reset_block - Verifies PHY can be reset : pointer to the HW structure
s32 e1000_blink_led (struct e1000_hw *hw)
 e1000_blink_led - Blink SW controllable LED : pointer to the HW structure
s32 e1000_led_on (struct e1000_hw *hw)
 e1000_led_on - Turn on SW controllable LED : pointer to the HW structure
s32 e1000_led_off (struct e1000_hw *hw)
 e1000_led_off - Turn off SW controllable LED : pointer to the HW structure
s32 e1000_id_led_init (struct e1000_hw *hw)
 e1000_id_led_init - store LED configurations in SW : pointer to the HW structure
void e1000_reset_adaptive (struct e1000_hw *hw)
 e1000_reset_adaptive - Reset adaptive IFS : pointer to the HW structure
void e1000_update_adaptive (struct e1000_hw *hw)
 e1000_update_adaptive - Update adaptive IFS : pointer to the HW structure
s32 e1000_validate_mdi_setting (struct e1000_hw *hw)
 e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state : pointer to the HW structure
s32 e1000_read_phy_reg (struct e1000_hw *hw, u32 offset, u16 *data)
 e1000_read_phy_reg - Reads PHY register : pointer to the HW structure : the register to read : the buffer to store the 16-bit read.
s32 e1000_write_phy_reg (struct e1000_hw *hw, u32 offset, u16 data)
 e1000_write_phy_reg - Writes PHY register : pointer to the HW structure : the register to write : the value to write.
s32 e1000_get_phy_info (struct e1000_hw *hw)
 e1000_get_phy_info - Retrieves PHY information from registers : pointer to the HW structure
void e1000_release_phy (struct e1000_hw *hw)
 e1000_release_phy - Generic release PHY : pointer to the HW structure
s32 e1000_acquire_phy (struct e1000_hw *hw)
 e1000_acquire_phy - Generic acquire PHY : pointer to the HW structure
s32 e1000_phy_hw_reset (struct e1000_hw *hw)
 e1000_phy_hw_reset - Hard PHY reset : pointer to the HW structure
s32 e1000_phy_commit (struct e1000_hw *hw)
 e1000_phy_commit - Soft PHY reset : pointer to the HW structure
void e1000_power_up_phy (struct e1000_hw *hw)
 e1000_power_up_phy - Restores link in case of PHY power down : pointer to the HW structure
void e1000_power_down_phy (struct e1000_hw *hw)
 e1000_power_down_phy - Power down PHY : pointer to the HW structure
s32 e1000_read_mac_addr (struct e1000_hw *hw)
 e1000_read_mac_addr - Reads MAC address : pointer to the HW structure
s32 e1000_read_pba_num (struct e1000_hw *hw, u32 *part_num)
 e1000_read_pba_num - Read device part number : pointer to the HW structure : pointer to device part number
void e1000_reload_nvm (struct e1000_hw *hw)
 e1000_reload_nvm - Reloads EEPROM : pointer to the HW structure
s32 e1000_update_nvm_checksum (struct e1000_hw *hw)
 e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum : pointer to the HW structure
s32 e1000_validate_nvm_checksum (struct e1000_hw *hw)
 e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum : pointer to the HW structure
s32 e1000_read_nvm (struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 e1000_read_nvm - Reads NVM (EEPROM) : pointer to the HW structure : the word offset to read : number of 16-bit words to read : pointer to the properly sized buffer for the data.
s32 e1000_read_kmrn_reg (struct e1000_hw *hw, u32 offset, u16 *data)
 e1000_read_kmrn_reg - Reads register using Kumeran interface : pointer to the HW structure : the register to read : the location to store the 16-bit value read.
s32 e1000_write_kmrn_reg (struct e1000_hw *hw, u32 offset, u16 data)
 e1000_write_kmrn_reg - Writes register using Kumeran interface : pointer to the HW structure : the register to write : the value to write.
s32 e1000_write_nvm (struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 e1000_write_nvm - Writes to NVM (EEPROM) : pointer to the HW structure : the word offset to read : number of 16-bit words to write : pointer to the properly sized buffer for the data.
s32 e1000_wait_autoneg (struct e1000_hw *hw)
 e1000_wait_autoneg - Waits for autonegotiation completion : pointer to the HW structure
s32 e1000_set_d3_lplu_state (struct e1000_hw *hw, bool active)
 e1000_set_d3_lplu_state - Sets low power link up state for D3 : pointer to the HW structure : boolean used to enable/disable lplu
s32 e1000_set_d0_lplu_state (struct e1000_hw *hw, bool active)
 e1000_set_d0_lplu_state - Sets low power link up state for D0 : pointer to the HW structure : boolean used to enable/disable lplu
bool e1000_check_mng_mode (struct e1000_hw *hw)
bool e1000_enable_tx_pkt_filtering (struct e1000_hw *hw)
s32 e1000_mng_enable_host_if (struct e1000_hw *hw)
s32 e1000_mng_host_if_write (struct e1000_hw *hw, u8 *buffer, u16 length, u16 offset, u8 *sum)
s32 e1000_mng_write_cmd_header (struct e1000_hw *hw, struct e1000_host_mng_command_header *hdr)
s32 e1000_mng_write_dhcp_info (struct e1000_hw *hw, u8 *buffer, u16 length)
u32 e1000_translate_register_82542 (u32 reg)
 e1000_translate_register_82542 - Translate the proper register offset : e1000 register to be read
int e1000_probe (struct pci_device *pdev, const struct pci_device_id *id __unused)
 e1000_probe - Initial configuration of e1000 NIC
void e1000_remove (struct pci_device *pdev)
 e1000_remove - Device Removal Routine


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void e1000_init_function_pointers_82542 ( struct e1000_hw hw  ) 

e1000_init_function_pointers_82542 - Init func ptrs.

: pointer to the HW structure

Called to initialize all function pointers and parameters.

Definition at line 152 of file e1000_82542.c.

References DEBUGFUNC, e1000_init_mac_params_82542(), e1000_init_nvm_params_82542(), e1000_init_phy_params_82542(), e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.

Referenced by e1000_setup_init_funcs().

00153 {
00154         DEBUGFUNC("e1000_init_function_pointers_82542");
00155 
00156         hw->mac.ops.init_params = e1000_init_mac_params_82542;
00157         hw->nvm.ops.init_params = e1000_init_nvm_params_82542;
00158         hw->phy.ops.init_params = e1000_init_phy_params_82542;
00159 }

void e1000_init_function_pointers_82543 ( struct e1000_hw hw  ) 

e1000_init_function_pointers_82543 - Init func ptrs.

: pointer to the HW structure

Called to initialize all function pointers and parameters.

Definition at line 272 of file e1000_82543.c.

References DEBUGFUNC, e1000_init_mac_params_82543(), e1000_init_nvm_params_82543(), e1000_init_phy_params_82543(), e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.

Referenced by e1000_setup_init_funcs().

00273 {
00274         DEBUGFUNC("e1000_init_function_pointers_82543");
00275 
00276         hw->mac.ops.init_params = e1000_init_mac_params_82543;
00277         hw->nvm.ops.init_params = e1000_init_nvm_params_82543;
00278         hw->phy.ops.init_params = e1000_init_phy_params_82543;
00279 }

void e1000_init_function_pointers_82540 ( struct e1000_hw hw  ) 

e1000_init_function_pointers_82540 - Init func ptrs.

: pointer to the HW structure

Called to initialize all function pointers and parameters.

Definition at line 257 of file e1000_82540.c.

References DEBUGFUNC, e1000_init_mac_params_82540(), e1000_init_nvm_params_82540(), e1000_init_phy_params_82540(), e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.

Referenced by e1000_setup_init_funcs().

00258 {
00259         DEBUGFUNC("e1000_init_function_pointers_82540");
00260 
00261         hw->mac.ops.init_params = e1000_init_mac_params_82540;
00262         hw->nvm.ops.init_params = e1000_init_nvm_params_82540;
00263         hw->phy.ops.init_params = e1000_init_phy_params_82540;
00264 }

void e1000_init_function_pointers_82541 ( struct e1000_hw hw  ) 

e1000_init_function_pointers_82541 - Init func ptrs.

: pointer to the HW structure

Called to initialize all function pointers and parameters.

Definition at line 290 of file e1000_82541.c.

References DEBUGFUNC, e1000_init_mac_params_82541(), e1000_init_nvm_params_82541(), e1000_init_phy_params_82541(), e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.

Referenced by e1000_setup_init_funcs().

00291 {
00292         DEBUGFUNC("e1000_init_function_pointers_82541");
00293 
00294         hw->mac.ops.init_params = e1000_init_mac_params_82541;
00295         hw->nvm.ops.init_params = e1000_init_nvm_params_82541;
00296         hw->phy.ops.init_params = e1000_init_phy_params_82541;
00297 }

s32 e1000_set_mac_type ( struct e1000_hw hw  ) 

e1000_set_mac_type - Sets MAC type : pointer to the HW structure

This function sets the mac type of the adapter based on the device ID stored in the hw structure. MUST BE FIRST FUNCTION CALLED (explicitly or through e1000_setup_init_funcs()).

Definition at line 120 of file e1000_api.c.

References DEBUGFUNC, e1000_hw::device_id, e1000_82540, e1000_82541, e1000_82541_rev_2, e1000_82542, e1000_82543, e1000_82544, e1000_82545, e1000_82545_rev_3, e1000_82546, e1000_82546_rev_3, e1000_82547, e1000_82547_rev_2, E1000_DEV_ID_82540EM, E1000_DEV_ID_82540EM_LOM, E1000_DEV_ID_82540EP, E1000_DEV_ID_82540EP_LOM, E1000_DEV_ID_82540EP_LP, E1000_DEV_ID_82541EI, E1000_DEV_ID_82541EI_MOBILE, E1000_DEV_ID_82541ER, E1000_DEV_ID_82541ER_LOM, E1000_DEV_ID_82541GI, E1000_DEV_ID_82541GI_LF, E1000_DEV_ID_82541GI_MOBILE, E1000_DEV_ID_82542, E1000_DEV_ID_82543GC_COPPER, E1000_DEV_ID_82543GC_FIBER, E1000_DEV_ID_82544EI_COPPER, E1000_DEV_ID_82544EI_FIBER, E1000_DEV_ID_82544GC_COPPER, E1000_DEV_ID_82544GC_LOM, E1000_DEV_ID_82545EM_COPPER, E1000_DEV_ID_82545EM_FIBER, E1000_DEV_ID_82545GM_COPPER, E1000_DEV_ID_82545GM_FIBER, E1000_DEV_ID_82545GM_SERDES, E1000_DEV_ID_82546EB_COPPER, E1000_DEV_ID_82546EB_FIBER, E1000_DEV_ID_82546EB_QUAD_COPPER, E1000_DEV_ID_82546GB_COPPER, E1000_DEV_ID_82546GB_FIBER, E1000_DEV_ID_82546GB_PCIE, E1000_DEV_ID_82546GB_QUAD_COPPER, E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3, E1000_DEV_ID_82546GB_SERDES, E1000_DEV_ID_82547EI, E1000_DEV_ID_82547EI_MOBILE, E1000_DEV_ID_82547GI, E1000_ERR_MAC_INIT, E1000_SUCCESS, e1000_hw::mac, and e1000_mac_info::type.

Referenced by e1000_setup_init_funcs().

00121 {
00122         struct e1000_mac_info *mac = &hw->mac;
00123         s32 ret_val = E1000_SUCCESS;
00124 
00125         DEBUGFUNC("e1000_set_mac_type");
00126 
00127         switch (hw->device_id) {
00128         case E1000_DEV_ID_82542:
00129                 mac->type = e1000_82542;
00130                 break;
00131         case E1000_DEV_ID_82543GC_FIBER:
00132         case E1000_DEV_ID_82543GC_COPPER:
00133                 mac->type = e1000_82543;
00134                 break;
00135         case E1000_DEV_ID_82544EI_COPPER:
00136         case E1000_DEV_ID_82544EI_FIBER:
00137         case E1000_DEV_ID_82544GC_COPPER:
00138         case E1000_DEV_ID_82544GC_LOM:
00139                 mac->type = e1000_82544;
00140                 break;
00141         case E1000_DEV_ID_82540EM:
00142         case E1000_DEV_ID_82540EM_LOM:
00143         case E1000_DEV_ID_82540EP:
00144         case E1000_DEV_ID_82540EP_LOM:
00145         case E1000_DEV_ID_82540EP_LP:
00146                 mac->type = e1000_82540;
00147                 break;
00148         case E1000_DEV_ID_82545EM_COPPER:
00149         case E1000_DEV_ID_82545EM_FIBER:
00150                 mac->type = e1000_82545;
00151                 break;
00152         case E1000_DEV_ID_82545GM_COPPER:
00153         case E1000_DEV_ID_82545GM_FIBER:
00154         case E1000_DEV_ID_82545GM_SERDES:
00155                 mac->type = e1000_82545_rev_3;
00156                 break;
00157         case E1000_DEV_ID_82546EB_COPPER:
00158         case E1000_DEV_ID_82546EB_FIBER:
00159         case E1000_DEV_ID_82546EB_QUAD_COPPER:
00160                 mac->type = e1000_82546;
00161                 break;
00162         case E1000_DEV_ID_82546GB_COPPER:
00163         case E1000_DEV_ID_82546GB_FIBER:
00164         case E1000_DEV_ID_82546GB_SERDES:
00165         case E1000_DEV_ID_82546GB_PCIE:
00166         case E1000_DEV_ID_82546GB_QUAD_COPPER:
00167         case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
00168                 mac->type = e1000_82546_rev_3;
00169                 break;
00170         case E1000_DEV_ID_82541EI:
00171         case E1000_DEV_ID_82541EI_MOBILE:
00172         case E1000_DEV_ID_82541ER_LOM:
00173                 mac->type = e1000_82541;
00174                 break;
00175         case E1000_DEV_ID_82541ER:
00176         case E1000_DEV_ID_82541GI:
00177         case E1000_DEV_ID_82541GI_LF:
00178         case E1000_DEV_ID_82541GI_MOBILE:
00179                 mac->type = e1000_82541_rev_2;
00180                 break;
00181         case E1000_DEV_ID_82547EI:
00182         case E1000_DEV_ID_82547EI_MOBILE:
00183                 mac->type = e1000_82547;
00184                 break;
00185         case E1000_DEV_ID_82547GI:
00186                 mac->type = e1000_82547_rev_2;
00187                 break;
00188         default:
00189                 /* Should never have loaded on this device */
00190                 ret_val = -E1000_ERR_MAC_INIT;
00191                 break;
00192         }
00193 
00194         return ret_val;
00195 }

s32 e1000_setup_init_funcs ( struct e1000_hw hw,
bool  init_device 
)

e1000_setup_init_funcs - Initializes function pointers : pointer to the HW structure : true will initialize the rest of the function pointers getting the device ready for use.

false will only set MAC type and the function pointers for the other init functions. Passing false will not generate any hardware reads or writes.

This function must be called by a driver in order to use the rest of the 'shared' code files. Called by drivers only.

Definition at line 209 of file e1000_api.c.

References DEBUGOUT, e1000_82540, e1000_82541, e1000_82541_rev_2, e1000_82542, e1000_82543, e1000_82544, e1000_82545, e1000_82545_rev_3, e1000_82546, e1000_82546_rev_3, e1000_82547, e1000_82547_rev_2, E1000_ERR_CONFIG, e1000_init_function_pointers_82540(), e1000_init_function_pointers_82541(), e1000_init_function_pointers_82542(), e1000_init_function_pointers_82543(), e1000_init_mac_ops_generic(), e1000_init_mac_params(), e1000_init_nvm_ops_generic(), e1000_init_nvm_params(), e1000_init_phy_ops_generic(), e1000_init_phy_params(), e1000_set_mac_type(), e1000_hw::hw_addr, e1000_hw::mac, and e1000_mac_info::type.

Referenced by e1000_sw_init().

00210 {
00211         s32 ret_val;
00212 
00213         /* Can't do much good without knowing the MAC type. */
00214         ret_val = e1000_set_mac_type(hw);
00215         if (ret_val) {
00216                 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
00217                 goto out;
00218         }
00219 
00220         if (!hw->hw_addr) {
00221                 DEBUGOUT("ERROR: Registers not mapped\n");
00222                 ret_val = -E1000_ERR_CONFIG;
00223                 goto out;
00224         }
00225 
00226         /*
00227          * Init function pointers to generic implementations. We do this first
00228          * allowing a driver module to override it afterward.
00229          */
00230         e1000_init_mac_ops_generic(hw);
00231         e1000_init_phy_ops_generic(hw);
00232         e1000_init_nvm_ops_generic(hw);
00233 
00234         /*
00235          * Set up the init function pointers. These are functions within the
00236          * adapter family file that sets up function pointers for the rest of
00237          * the functions in that family.
00238          */
00239         switch (hw->mac.type) {
00240         case e1000_82542:
00241                 e1000_init_function_pointers_82542(hw);
00242                 break;
00243         case e1000_82543:
00244         case e1000_82544:
00245                 e1000_init_function_pointers_82543(hw);
00246                 break;
00247         case e1000_82540:
00248         case e1000_82545:
00249         case e1000_82545_rev_3:
00250         case e1000_82546:
00251         case e1000_82546_rev_3:
00252                 e1000_init_function_pointers_82540(hw);
00253                 break;
00254         case e1000_82541:
00255         case e1000_82541_rev_2:
00256         case e1000_82547:
00257         case e1000_82547_rev_2:
00258                 e1000_init_function_pointers_82541(hw);
00259                 break;
00260         default:
00261                 DEBUGOUT("Hardware not supported\n");
00262                 ret_val = -E1000_ERR_CONFIG;
00263                 break;
00264         }
00265 
00266         /*
00267          * Initialize the rest of the function pointers. These require some
00268          * register reads/writes in some cases.
00269          */
00270         if (!(ret_val) && init_device) {
00271                 ret_val = e1000_init_mac_params(hw);
00272                 if (ret_val)
00273                         goto out;
00274 
00275                 ret_val = e1000_init_nvm_params(hw);
00276                 if (ret_val)
00277                         goto out;
00278 
00279                 ret_val = e1000_init_phy_params(hw);
00280                 if (ret_val)
00281                         goto out;
00282         }
00283 
00284 out:
00285         return ret_val;
00286 }

s32 e1000_init_mac_params ( struct e1000_hw hw  ) 

e1000_init_mac_params - Initialize MAC function pointers : pointer to the HW structure

This function initializes the function pointers for the MAC set of functions. Called by drivers or by e1000_setup_init_funcs.

Definition at line 40 of file e1000_api.c.

References DEBUGOUT, E1000_ERR_CONFIG, E1000_SUCCESS, e1000_mac_operations::init_params, e1000_hw::mac, and e1000_mac_info::ops.

Referenced by e1000_probe(), and e1000_setup_init_funcs().

00041 {
00042         s32 ret_val = E1000_SUCCESS;
00043 
00044         if (hw->mac.ops.init_params) {
00045                 ret_val = hw->mac.ops.init_params(hw);
00046                 if (ret_val) {
00047                         DEBUGOUT("MAC Initialization Error\n");
00048                         goto out;
00049                 }
00050         } else {
00051                 DEBUGOUT("mac.init_mac_params was NULL\n");
00052                 ret_val = -E1000_ERR_CONFIG;
00053         }
00054 
00055 out:
00056         return ret_val;
00057 }

s32 e1000_init_nvm_params ( struct e1000_hw hw  ) 

e1000_init_nvm_params - Initialize NVM function pointers : pointer to the HW structure

This function initializes the function pointers for the NVM set of functions. Called by drivers or by e1000_setup_init_funcs.

Definition at line 66 of file e1000_api.c.

References DEBUGOUT, E1000_ERR_CONFIG, E1000_SUCCESS, e1000_nvm_operations::init_params, e1000_hw::nvm, and e1000_nvm_info::ops.

Referenced by e1000_probe(), and e1000_setup_init_funcs().

00067 {
00068         s32 ret_val = E1000_SUCCESS;
00069 
00070         if (hw->nvm.ops.init_params) {
00071                 ret_val = hw->nvm.ops.init_params(hw);
00072                 if (ret_val) {
00073                         DEBUGOUT("NVM Initialization Error\n");
00074                         goto out;
00075                 }
00076         } else {
00077                 DEBUGOUT("nvm.init_nvm_params was NULL\n");
00078                 ret_val = -E1000_ERR_CONFIG;
00079         }
00080 
00081 out:
00082         return ret_val;
00083 }

s32 e1000_init_phy_params ( struct e1000_hw hw  ) 

e1000_init_phy_params - Initialize PHY function pointers : pointer to the HW structure

This function initializes the function pointers for the PHY set of functions. Called by drivers or by e1000_setup_init_funcs.

Definition at line 92 of file e1000_api.c.

References DEBUGOUT, E1000_ERR_CONFIG, E1000_SUCCESS, e1000_phy_operations::init_params, e1000_phy_info::ops, and e1000_hw::phy.

Referenced by e1000_probe(), and e1000_setup_init_funcs().

00093 {
00094         s32 ret_val = E1000_SUCCESS;
00095 
00096         if (hw->phy.ops.init_params) {
00097                 ret_val = hw->phy.ops.init_params(hw);
00098                 if (ret_val) {
00099                         DEBUGOUT("PHY Initialization Error\n");
00100                         goto out;
00101                 }
00102         } else {
00103                 DEBUGOUT("phy.init_phy_params was NULL\n");
00104                 ret_val =  -E1000_ERR_CONFIG;
00105         }
00106 
00107 out:
00108         return ret_val;
00109 }

s32 e1000_get_bus_info ( struct e1000_hw hw  ) 

e1000_get_bus_info - Obtain bus information for adapter : pointer to the HW structure

This will obtain information about the HW bus for which the adapter is attached and stores it in the hw structure. This is a function pointer entry point called by drivers.

Definition at line 296 of file e1000_api.c.

References E1000_SUCCESS, e1000_mac_operations::get_bus_info, e1000_hw::mac, and e1000_mac_info::ops.

00297 {
00298         if (hw->mac.ops.get_bus_info)
00299                 return hw->mac.ops.get_bus_info(hw);
00300 
00301         return E1000_SUCCESS;
00302 }

void e1000_clear_vfta ( struct e1000_hw hw  ) 

e1000_clear_vfta - Clear VLAN filter table : pointer to the HW structure

This clears the VLAN filter table on the adapter. This is a function pointer entry point called by drivers.

Definition at line 311 of file e1000_api.c.

References e1000_mac_operations::clear_vfta, e1000_hw::mac, and e1000_mac_info::ops.

00312 {
00313         if (hw->mac.ops.clear_vfta)
00314                 hw->mac.ops.clear_vfta(hw);
00315 }

void e1000_write_vfta ( struct e1000_hw hw,
u32  offset,
u32  value 
)

e1000_write_vfta - Write value to VLAN filter table : pointer to the HW structure : the 32-bit offset in which to write the value to.

: the 32-bit value to write at location offset.

This writes a 32-bit value to a 32-bit offset in the VLAN filter table. This is a function pointer entry point called by drivers.

Definition at line 326 of file e1000_api.c.

References e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::write_vfta.

00327 {
00328         if (hw->mac.ops.write_vfta)
00329                 hw->mac.ops.write_vfta(hw, offset, value);
00330 }

s32 e1000_force_mac_fc ( struct e1000_hw hw  ) 

e1000_force_mac_fc - Force MAC flow control : pointer to the HW structure

Force the MAC's flow control settings. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 357 of file e1000_api.c.

References e1000_force_mac_fc_generic().

00358 {
00359         return e1000_force_mac_fc_generic(hw);
00360 }

s32 e1000_check_for_link ( struct e1000_hw hw  ) 

e1000_check_for_link - Check/Store link connection : pointer to the HW structure

This checks the link condition of the adapter and stores the results in the hw->mac structure. This is a function pointer entry point called by drivers.

Definition at line 370 of file e1000_api.c.

References e1000_mac_operations::check_for_link, E1000_ERR_CONFIG, e1000_hw::mac, and e1000_mac_info::ops.

00371 {
00372         if (hw->mac.ops.check_for_link)
00373                 return hw->mac.ops.check_for_link(hw);
00374 
00375         return -E1000_ERR_CONFIG;
00376 }

s32 e1000_reset_hw ( struct e1000_hw hw  ) 

e1000_reset_hw - Reset hardware : pointer to the HW structure

This resets the hardware into a known state. This is a function pointer entry point called by drivers.

Definition at line 415 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::reset_hw.

Referenced by e1000_close(), e1000_probe(), e1000_remove(), and e1000_reset().

00416 {
00417         if (hw->mac.ops.reset_hw)
00418                 return hw->mac.ops.reset_hw(hw);
00419 
00420         return -E1000_ERR_CONFIG;
00421 }

s32 e1000_init_hw ( struct e1000_hw hw  ) 

e1000_init_hw - Initialize hardware : pointer to the HW structure

This inits the hardware readying it for operation. This is a function pointer entry point called by drivers.

Definition at line 430 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_mac_operations::init_hw, e1000_hw::mac, and e1000_mac_info::ops.

Referenced by e1000_reset().

00431 {
00432         if (hw->mac.ops.init_hw)
00433                 return hw->mac.ops.init_hw(hw);
00434 
00435         return -E1000_ERR_CONFIG;
00436 }

s32 e1000_setup_link ( struct e1000_hw hw  ) 

e1000_setup_link - Configures link and flow control : pointer to the HW structure

This configures link and flow control settings for the adapter. This is a function pointer entry point called by drivers. While modules can also call this, they probably call their own version of this function.

Definition at line 446 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::setup_link.

Referenced by e1000_power_up_phy().

00447 {
00448         if (hw->mac.ops.setup_link)
00449                 return hw->mac.ops.setup_link(hw);
00450 
00451         return -E1000_ERR_CONFIG;
00452 }

s32 e1000_get_speed_and_duplex ( struct e1000_hw hw,
u16 speed,
u16 duplex 
)

e1000_get_speed_and_duplex - Returns current speed and duplex : pointer to the HW structure : pointer to a 16-bit value to store the speed : pointer to a 16-bit value to store the duplex.

This returns the speed and duplex of the adapter in the two 'out' variables passed in. This is a function pointer entry point called by drivers.

Definition at line 464 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_mac_operations::get_link_up_info, e1000_hw::mac, and e1000_mac_info::ops.

00465 {
00466         if (hw->mac.ops.get_link_up_info)
00467                 return hw->mac.ops.get_link_up_info(hw, speed, duplex);
00468 
00469         return -E1000_ERR_CONFIG;
00470 }

s32 e1000_disable_pcie_master ( struct e1000_hw hw  ) 

e1000_disable_pcie_master - Disable PCI-Express master access : pointer to the HW structure

Disables PCI-Express master access and verifies there are no pending requests. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 596 of file e1000_api.c.

References e1000_disable_pcie_master_generic().

00597 {
00598         return e1000_disable_pcie_master_generic(hw);
00599 }

void e1000_config_collision_dist ( struct e1000_hw hw  ) 

e1000_config_collision_dist - Configure collision distance : pointer to the HW structure

Configures the collision distance to the default value and is used during link setup.

Definition at line 608 of file e1000_api.c.

References e1000_mac_operations::config_collision_dist, e1000_hw::mac, and e1000_mac_info::ops.

Referenced by e1000_configure_tx().

00609 {
00610         if (hw->mac.ops.config_collision_dist)
00611                 hw->mac.ops.config_collision_dist(hw);
00612 }

void e1000_rar_set ( struct e1000_hw hw,
u8 addr,
u32  index 
)

e1000_rar_set - Sets a receive address register : pointer to the HW structure : address to set the RAR to : the RAR to set

Sets a Receive Address Register (RAR) to the specified address.

Definition at line 622 of file e1000_api.c.

References e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::rar_set.

00623 {
00624         if (hw->mac.ops.rar_set)
00625                 hw->mac.ops.rar_set(hw, addr, index);
00626 }

void e1000_mta_set ( struct e1000_hw hw,
u32  hash_value 
)

e1000_mta_set - Sets multicast table bit : pointer to the HW structure : Multicast hash value.

This sets the bit in the multicast table corresponding to the hash value. This is a function pointer entry point called by drivers.

Definition at line 650 of file e1000_api.c.

References e1000_hw::mac, e1000_mac_operations::mta_set, and e1000_mac_info::ops.

00651 {
00652         if (hw->mac.ops.mta_set)
00653                 hw->mac.ops.mta_set(hw, hash_value);
00654 }

u32 e1000_hash_mc_addr ( struct e1000_hw hw,
u8 mc_addr 
)

e1000_hash_mc_addr - Determines address location in multicast table : pointer to the HW structure : Multicast address to hash.

This hashes an address to determine its location in the multicast table. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 665 of file e1000_api.c.

References e1000_hash_mc_addr_generic().

00666 {
00667         return e1000_hash_mc_addr_generic(hw, mc_addr);
00668 }

void e1000_update_mc_addr_list ( struct e1000_hw hw,
u8 mc_addr_list,
u32  mc_addr_count 
)

e1000_update_mc_addr_list - Update Multicast addresses : pointer to the HW structure : array of multicast addresses to program : number of multicast addresses to program

Updates the Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses.

Definition at line 341 of file e1000_api.c.

References e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::update_mc_addr_list.

00343 {
00344         if (hw->mac.ops.update_mc_addr_list)
00345                 hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
00346                                                 mc_addr_count);
00347 }

s32 e1000_setup_led ( struct e1000_hw hw  ) 

e1000_setup_led - Configures SW controllable LED : pointer to the HW structure

This prepares the SW controllable LED for use and saves the current state of the LED so it can be later restored. This is a function pointer entry point called by drivers.

Definition at line 480 of file e1000_api.c.

References E1000_SUCCESS, e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::setup_led.

00481 {
00482         if (hw->mac.ops.setup_led)
00483                 return hw->mac.ops.setup_led(hw);
00484 
00485         return E1000_SUCCESS;
00486 }

s32 e1000_cleanup_led ( struct e1000_hw hw  ) 

e1000_cleanup_led - Restores SW controllable LED : pointer to the HW structure

This restores the SW controllable LED to the value saved off by e1000_setup_led. This is a function pointer entry point called by drivers.

Definition at line 495 of file e1000_api.c.

References e1000_mac_operations::cleanup_led, E1000_SUCCESS, e1000_hw::mac, and e1000_mac_info::ops.

00496 {
00497         if (hw->mac.ops.cleanup_led)
00498                 return hw->mac.ops.cleanup_led(hw);
00499 
00500         return E1000_SUCCESS;
00501 }

s32 e1000_check_reset_block ( struct e1000_hw hw  ) 

e1000_check_reset_block - Verifies PHY can be reset : pointer to the HW structure

Checks if the PHY is in a state that can be reset or if manageability has it tied up. This is a function pointer entry point called by drivers.

Definition at line 764 of file e1000_api.c.

References e1000_phy_operations::check_reset_block, E1000_SUCCESS, e1000_phy_info::ops, and e1000_hw::phy.

Referenced by e1000_probe().

00765 {
00766         if (hw->phy.ops.check_reset_block)
00767                 return hw->phy.ops.check_reset_block(hw);
00768 
00769         return E1000_SUCCESS;
00770 }

s32 e1000_blink_led ( struct e1000_hw hw  ) 

e1000_blink_led - Blink SW controllable LED : pointer to the HW structure

This starts the adapter LED blinking. Request the LED to be setup first and cleaned up after. This is a function pointer entry point called by drivers.

Definition at line 511 of file e1000_api.c.

References e1000_mac_operations::blink_led, E1000_SUCCESS, e1000_hw::mac, and e1000_mac_info::ops.

00512 {
00513         if (hw->mac.ops.blink_led)
00514                 return hw->mac.ops.blink_led(hw);
00515 
00516         return E1000_SUCCESS;
00517 }

s32 e1000_led_on ( struct e1000_hw hw  ) 

e1000_led_on - Turn on SW controllable LED : pointer to the HW structure

Turns the SW defined LED on. This is a function pointer entry point called by drivers.

Definition at line 541 of file e1000_api.c.

References E1000_SUCCESS, e1000_mac_operations::led_on, e1000_hw::mac, and e1000_mac_info::ops.

00542 {
00543         if (hw->mac.ops.led_on)
00544                 return hw->mac.ops.led_on(hw);
00545 
00546         return E1000_SUCCESS;
00547 }

s32 e1000_led_off ( struct e1000_hw hw  ) 

e1000_led_off - Turn off SW controllable LED : pointer to the HW structure

Turns the SW defined LED off. This is a function pointer entry point called by drivers.

Definition at line 556 of file e1000_api.c.

References E1000_SUCCESS, e1000_mac_operations::led_off, e1000_hw::mac, and e1000_mac_info::ops.

00557 {
00558         if (hw->mac.ops.led_off)
00559                 return hw->mac.ops.led_off(hw);
00560 
00561         return E1000_SUCCESS;
00562 }

s32 e1000_id_led_init ( struct e1000_hw hw  ) 

e1000_id_led_init - store LED configurations in SW : pointer to the HW structure

Initializes the LED config in SW. This is a function pointer entry point called by drivers.

Definition at line 526 of file e1000_api.c.

References E1000_SUCCESS, e1000_mac_operations::id_led_init, e1000_hw::mac, and e1000_mac_info::ops.

00527 {
00528         if (hw->mac.ops.id_led_init)
00529                 return hw->mac.ops.id_led_init(hw);
00530 
00531         return E1000_SUCCESS;
00532 }

void e1000_reset_adaptive ( struct e1000_hw hw  ) 

e1000_reset_adaptive - Reset adaptive IFS : pointer to the HW structure

Resets the adaptive IFS. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 571 of file e1000_api.c.

References e1000_reset_adaptive_generic().

Referenced by e1000_reset().

00572 {
00573         e1000_reset_adaptive_generic(hw);
00574 }

void e1000_update_adaptive ( struct e1000_hw hw  ) 

e1000_update_adaptive - Update adaptive IFS : pointer to the HW structure

Updates adapter IFS. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 583 of file e1000_api.c.

References e1000_update_adaptive_generic().

00584 {
00585         e1000_update_adaptive_generic(hw);
00586 }

s32 e1000_validate_mdi_setting ( struct e1000_hw hw  ) 

e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state : pointer to the HW structure

Ensures that the MDI/MDIX SW state is valid.

Definition at line 634 of file e1000_api.c.

References E1000_SUCCESS, e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::validate_mdi_setting.

00635 {
00636         if (hw->mac.ops.validate_mdi_setting)
00637                 return hw->mac.ops.validate_mdi_setting(hw);
00638 
00639         return E1000_SUCCESS;
00640 }

s32 e1000_read_phy_reg ( struct e1000_hw hw,
u32  offset,
u16 data 
)

e1000_read_phy_reg - Reads PHY register : pointer to the HW structure : the register to read : the buffer to store the 16-bit read.

Reads the PHY register and returns the value in data. This is a function pointer entry point called by drivers.

Definition at line 781 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::read_reg.

00782 {
00783         if (hw->phy.ops.read_reg)
00784                 return hw->phy.ops.read_reg(hw, offset, data);
00785 
00786         return E1000_SUCCESS;
00787 }

s32 e1000_write_phy_reg ( struct e1000_hw hw,
u32  offset,
u16  data 
)

e1000_write_phy_reg - Writes PHY register : pointer to the HW structure : the register to write : the value to write.

Writes the PHY register at offset with the value in data. This is a function pointer entry point called by drivers.

Definition at line 798 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::write_reg.

00799 {
00800         if (hw->phy.ops.write_reg)
00801                 return hw->phy.ops.write_reg(hw, offset, data);
00802 
00803         return E1000_SUCCESS;
00804 }

s32 e1000_get_phy_info ( struct e1000_hw hw  ) 

e1000_get_phy_info - Retrieves PHY information from registers : pointer to the HW structure

This function gets some information from various PHY registers and populates hw->phy values with it. This is a function pointer entry point called by drivers.

Definition at line 890 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_operations::get_info, e1000_phy_info::ops, and e1000_hw::phy.

Referenced by e1000_reset().

00891 {
00892         if (hw->phy.ops.get_info)
00893                 return hw->phy.ops.get_info(hw);
00894 
00895         return E1000_SUCCESS;
00896 }

void e1000_release_phy ( struct e1000_hw hw  ) 

e1000_release_phy - Generic release PHY : pointer to the HW structure

Return if silicon family does not require a semaphore when accessing the PHY.

Definition at line 813 of file e1000_api.c.

References e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::release.

00814 {
00815         if (hw->phy.ops.release)
00816                 hw->phy.ops.release(hw);
00817 }

s32 e1000_acquire_phy ( struct e1000_hw hw  ) 

e1000_acquire_phy - Generic acquire PHY : pointer to the HW structure

Return success if silicon family does not require a semaphore when accessing the PHY.

Definition at line 826 of file e1000_api.c.

References e1000_phy_operations::acquire, E1000_SUCCESS, e1000_phy_info::ops, and e1000_hw::phy.

00827 {
00828         if (hw->phy.ops.acquire)
00829                 return hw->phy.ops.acquire(hw);
00830 
00831         return E1000_SUCCESS;
00832 }

s32 e1000_phy_hw_reset ( struct e1000_hw hw  ) 

e1000_phy_hw_reset - Hard PHY reset : pointer to the HW structure

Performs a hard PHY reset. This is a function pointer entry point called by drivers.

Definition at line 905 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::reset.

Referenced by e1000_probe().

00906 {
00907         if (hw->phy.ops.reset)
00908                 return hw->phy.ops.reset(hw);
00909 
00910         return E1000_SUCCESS;
00911 }

s32 e1000_phy_commit ( struct e1000_hw hw  ) 

e1000_phy_commit - Soft PHY reset : pointer to the HW structure

Performs a soft PHY reset on those that apply. This is a function pointer entry point called by drivers.

Definition at line 920 of file e1000_api.c.

References e1000_phy_operations::commit, E1000_SUCCESS, e1000_phy_info::ops, and e1000_hw::phy.

00921 {
00922         if (hw->phy.ops.commit)
00923                 return hw->phy.ops.commit(hw);
00924 
00925         return E1000_SUCCESS;
00926 }

void e1000_power_up_phy ( struct e1000_hw hw  ) 

e1000_power_up_phy - Restores link in case of PHY power down : pointer to the HW structure

The phy may be powered down to save power, to turn off link when the driver is unloaded, or wake on lan is not enabled (among others).

Definition at line 1089 of file e1000_api.c.

References e1000_setup_link(), e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::power_up.

01090 {
01091         if (hw->phy.ops.power_up)
01092                 hw->phy.ops.power_up(hw);
01093 
01094         e1000_setup_link(hw);
01095 }

void e1000_power_down_phy ( struct e1000_hw hw  ) 

e1000_power_down_phy - Power down PHY : pointer to the HW structure

The phy may be powered down to save power, to turn off link when the driver is unloaded, or wake on lan is not enabled (among others).

Definition at line 1104 of file e1000_api.c.

References e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::power_down.

01105 {
01106         if (hw->phy.ops.power_down)
01107                 hw->phy.ops.power_down(hw);
01108 }

s32 e1000_read_mac_addr ( struct e1000_hw hw  ) 

e1000_read_mac_addr - Reads MAC address : pointer to the HW structure

Reads the MAC address out of the adapter and stores it in the HW structure. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 980 of file e1000_api.c.

References e1000_read_mac_addr_generic(), e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::read_mac_addr.

Referenced by e1000_probe().

00981 {
00982         if (hw->mac.ops.read_mac_addr)
00983                 return hw->mac.ops.read_mac_addr(hw);
00984 
00985         return e1000_read_mac_addr_generic(hw);
00986 }

s32 e1000_read_pba_num ( struct e1000_hw hw,
u32 pba_num 
)

e1000_read_pba_num - Read device part number : pointer to the HW structure : pointer to device part number

Reads the product board assembly (PBA) number from the EEPROM and stores the value in pba_num. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 998 of file e1000_api.c.

References e1000_read_pba_num_generic().

00999 {
01000         return e1000_read_pba_num_generic(hw, pba_num);
01001 }

void e1000_reload_nvm ( struct e1000_hw hw  ) 

e1000_reload_nvm - Reloads EEPROM : pointer to the HW structure

Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the extended control register.

Definition at line 1040 of file e1000_api.c.

References e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::reload.

01041 {
01042         if (hw->nvm.ops.reload)
01043                 hw->nvm.ops.reload(hw);
01044 }

s32 e1000_update_nvm_checksum ( struct e1000_hw hw  ) 

e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum : pointer to the HW structure

Updates the NVM checksum. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 1025 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::update.

01026 {
01027         if (hw->nvm.ops.update)
01028                 return hw->nvm.ops.update(hw);
01029 
01030         return -E1000_ERR_CONFIG;
01031 }

s32 e1000_validate_nvm_checksum ( struct e1000_hw hw  ) 

e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum : pointer to the HW structure

Validates the NVM checksum is correct. This is a function pointer entry point called by drivers.

Definition at line 1010 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::validate.

Referenced by e1000_probe().

01011 {
01012         if (hw->nvm.ops.validate)
01013                 return hw->nvm.ops.validate(hw);
01014 
01015         return -E1000_ERR_CONFIG;
01016 }

s32 e1000_read_nvm ( struct e1000_hw hw,
u16  offset,
u16  words,
u16 data 
)

e1000_read_nvm - Reads NVM (EEPROM) : pointer to the HW structure : the word offset to read : number of 16-bit words to read : pointer to the properly sized buffer for the data.

Reads 16-bit chunks of data from the NVM (EEPROM). This is a function pointer entry point called by drivers.

Definition at line 1056 of file e1000_api.c.

References E1000_ERR_CONFIG, e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::read.

01057 {
01058         if (hw->nvm.ops.read)
01059                 return hw->nvm.ops.read(hw, offset, words, data);
01060 
01061         return -E1000_ERR_CONFIG;
01062 }

s32 e1000_read_kmrn_reg ( struct e1000_hw hw,
u32  offset,
u16 data 
)

e1000_read_kmrn_reg - Reads register using Kumeran interface : pointer to the HW structure : the register to read : the location to store the 16-bit value read.

Reads a register out of the Kumeran interface. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 844 of file e1000_api.c.

References e1000_read_kmrn_reg_generic().

00845 {
00846         return e1000_read_kmrn_reg_generic(hw, offset, data);
00847 }

s32 e1000_write_kmrn_reg ( struct e1000_hw hw,
u32  offset,
u16  data 
)

e1000_write_kmrn_reg - Writes register using Kumeran interface : pointer to the HW structure : the register to write : the value to write.

Writes a register to the Kumeran interface. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 859 of file e1000_api.c.

References e1000_write_kmrn_reg_generic().

00860 {
00861         return e1000_write_kmrn_reg_generic(hw, offset, data);
00862 }

s32 e1000_write_nvm ( struct e1000_hw hw,
u16  offset,
u16  words,
u16 data 
)

e1000_write_nvm - Writes to NVM (EEPROM) : pointer to the HW structure : the word offset to read : number of 16-bit words to write : pointer to the properly sized buffer for the data.

Writes 16-bit chunks of data to the NVM (EEPROM). This is a function pointer entry point called by drivers.

Definition at line 1074 of file e1000_api.c.

References E1000_SUCCESS, e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::write.

01075 {
01076         if (hw->nvm.ops.write)
01077                 return hw->nvm.ops.write(hw, offset, words, data);
01078 
01079         return E1000_SUCCESS;
01080 }

s32 e1000_wait_autoneg ( struct e1000_hw hw  ) 

e1000_wait_autoneg - Waits for autonegotiation completion : pointer to the HW structure

Waits for autoneg to complete. Currently no func pointer exists and all implementations are handled in the generic version of this function.

Definition at line 749 of file e1000_api.c.

References E1000_SUCCESS, e1000_hw::mac, e1000_mac_info::ops, and e1000_mac_operations::wait_autoneg.

00750 {
00751         if (hw->mac.ops.wait_autoneg)
00752                 return hw->mac.ops.wait_autoneg(hw);
00753 
00754         return E1000_SUCCESS;
00755 }

s32 e1000_set_d3_lplu_state ( struct e1000_hw hw,
bool  active 
)

e1000_set_d3_lplu_state - Sets low power link up state for D3 : pointer to the HW structure : boolean used to enable/disable lplu

Success returns 0, Failure returns 1

The low power link up (lplu) state is set to the power management level D3 and SmartSpeed is disabled when active is true, else clear lplu for D3 and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU is used during Dx states where the power conservation is most important. During driver activity, SmartSpeed should be enabled so performance is maintained. This is a function pointer entry point called by drivers.

Definition at line 964 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::set_d3_lplu_state.

00965 {
00966         if (hw->phy.ops.set_d3_lplu_state)
00967                 return hw->phy.ops.set_d3_lplu_state(hw, active);
00968 
00969         return E1000_SUCCESS;
00970 }

s32 e1000_set_d0_lplu_state ( struct e1000_hw hw,
bool  active 
)

e1000_set_d0_lplu_state - Sets low power link up state for D0 : pointer to the HW structure : boolean used to enable/disable lplu

Success returns 0, Failure returns 1

The low power link up (lplu) state is set to the power management level D0 and SmartSpeed is disabled when active is true, else clear lplu for D0 and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU is used during Dx states where the power conservation is most important. During driver activity, SmartSpeed should be enabled so performance is maintained. This is a function pointer entry point called by drivers.

Definition at line 942 of file e1000_api.c.

References E1000_SUCCESS, e1000_phy_info::ops, e1000_hw::phy, and e1000_phy_operations::set_d0_lplu_state.

00943 {
00944         if (hw->phy.ops.set_d0_lplu_state)
00945                 return hw->phy.ops.set_d0_lplu_state(hw, active);
00946 
00947         return E1000_SUCCESS;
00948 }

bool e1000_check_mng_mode ( struct e1000_hw hw  ) 

bool e1000_enable_tx_pkt_filtering ( struct e1000_hw hw  ) 

s32 e1000_mng_enable_host_if ( struct e1000_hw hw  ) 

s32 e1000_mng_host_if_write ( struct e1000_hw hw,
u8 buffer,
u16  length,
u16  offset,
u8 sum 
)

s32 e1000_mng_write_cmd_header ( struct e1000_hw hw,
struct e1000_host_mng_command_header hdr 
)

s32 e1000_mng_write_dhcp_info ( struct e1000_hw hw,
u8 buffer,
u16  length 
)

u32 e1000_translate_register_82542 ( u32  reg  ) 

e1000_translate_register_82542 - Translate the proper register offset : e1000 register to be read

Registers in 82542 are located in different offsets than other adapters even though they function in the same manner. This function takes in the name of the register to read and returns the correct offset for 82542 silicon.

Definition at line 446 of file e1000_82542.c.

References E1000_FCRTH, E1000_FCRTL, E1000_MTA, E1000_RA, E1000_RDBAH, E1000_RDBAL, E1000_RDH, E1000_RDLEN, E1000_RDT, E1000_RDTR, E1000_TDBAH, E1000_TDBAL, E1000_TDFH, E1000_TDFT, E1000_TDH, E1000_TDLEN, E1000_TDT, E1000_TIDV, and E1000_VFTA.

00447 {
00448         /*
00449          * Some of the 82542 registers are located at different
00450          * offsets than they are in newer adapters.
00451          * Despite the difference in location, the registers
00452          * function in the same manner.
00453          */
00454         switch (reg) {
00455         case E1000_RA:
00456                 reg = 0x00040;
00457                 break;
00458         case E1000_RDTR:
00459                 reg = 0x00108;
00460                 break;
00461         case E1000_RDBAL(0):
00462                 reg = 0x00110;
00463                 break;
00464         case E1000_RDBAH(0):
00465                 reg = 0x00114;
00466                 break;
00467         case E1000_RDLEN(0):
00468                 reg = 0x00118;
00469                 break;
00470         case E1000_RDH(0):
00471                 reg = 0x00120;
00472                 break;
00473         case E1000_RDT(0):
00474                 reg = 0x00128;
00475                 break;
00476         case E1000_RDBAL(1):
00477                 reg = 0x00138;
00478                 break;
00479         case E1000_RDBAH(1):
00480                 reg = 0x0013C;
00481                 break;
00482         case E1000_RDLEN(1):
00483                 reg = 0x00140;
00484                 break;
00485         case E1000_RDH(1):
00486                 reg = 0x00148;
00487                 break;
00488         case E1000_RDT(1):
00489                 reg = 0x00150;
00490                 break;
00491         case E1000_FCRTH:
00492                 reg = 0x00160;
00493                 break;
00494         case E1000_FCRTL:
00495                 reg = 0x00168;
00496                 break;
00497         case E1000_MTA:
00498                 reg = 0x00200;
00499                 break;
00500         case E1000_TDBAL(0):
00501                 reg = 0x00420;
00502                 break;
00503         case E1000_TDBAH(0):
00504                 reg = 0x00424;
00505                 break;
00506         case E1000_TDLEN(0):
00507                 reg = 0x00428;
00508                 break;
00509         case E1000_TDH(0):
00510                 reg = 0x00430;
00511                 break;
00512         case E1000_TDT(0):
00513                 reg = 0x00438;
00514                 break;
00515         case E1000_TIDV:
00516                 reg = 0x00440;
00517                 break;
00518         case E1000_VFTA:
00519                 reg = 0x00600;
00520                 break;
00521         case E1000_TDFH:
00522                 reg = 0x08010;
00523                 break;
00524         case E1000_TDFT:
00525                 reg = 0x08018;
00526                 break;
00527         default:
00528                 break;
00529         }
00530 
00531         return reg;
00532 }

int e1000_probe ( struct pci_device pdev,
const struct pci_device_id *id  __unused 
)

e1000_probe - Initial configuration of e1000 NIC

Parameters:
pci PCI device
id PCI IDs
Return values:
rc Return status code

Definition at line 692 of file e1000_main.c.

References e1000_mac_info::adaptive_ifs, adjust_pci_device(), alloc_etherdev(), e1000_mac_info::autoneg, e1000_phy_info::autoneg_wait_to_complete, e1000_hw::back, DBG, pci_device::dev, net_device::dev, e1000_82540, e1000_82543, e1000_check_reset_block(), E1000_FLAG_BAD_TX_CARRIER_STATS_FD, E1000_FLAG_HAS_INTR_MODERATION, E1000_FLAG_HAS_SMBUS, e1000_init_mac_params(), e1000_init_nvm_params(), e1000_init_phy_params(), e1000_operations, e1000_phy_hw_reset(), e1000_read_mac_addr(), e1000_reset(), e1000_reset_hw(), e1000_sw_init(), e1000_validate_nvm_checksum(), EIO, ENOMEM, ETH_ALEN, e1000_adapter::flags, e1000_hw::flash_address, e1000_adapter::hw, net_device::hw_addr, e1000_hw::hw_addr, e1000_hw::io_base, pci_device::ioaddr, e1000_adapter::ioaddr, ioremap(), iounmap(), pci_device::irq, e1000_adapter::irqno, net_device::ll_addr, e1000_hw::mac, memcpy, memset(), e1000_adapter::netdev, netdev, netdev_init(), netdev_link_up(), netdev_priv(), netdev_put(), NUM_RX_DESC, NUM_TX_DESC, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, pci_set_drvdata(), e1000_adapter::pdev, e1000_mac_info::perm_addr, e1000_hw::phy, register_netdev(), e1000_adapter::rx_base, e1000_adapter::rx_ring_size, e1000_adapter::tx_base, e1000_adapter::tx_ring_size, and e1000_mac_info::type.

00694 {
00695         int i, err;
00696         struct net_device *netdev;
00697         struct e1000_adapter *adapter;
00698         unsigned long mmio_start, mmio_len;
00699 
00700         DBG ( "e1000_probe\n" );
00701 
00702         err = -ENOMEM;
00703 
00704         /* Allocate net device ( also allocates memory for netdev->priv
00705            and makes netdev-priv point to it ) */
00706         netdev = alloc_etherdev ( sizeof ( struct e1000_adapter ) );
00707         if ( ! netdev )
00708                 goto err_alloc_etherdev;
00709 
00710         /* Associate e1000-specific network operations operations with
00711          * generic network device layer */
00712         netdev_init ( netdev, &e1000_operations );
00713 
00714         /* Associate this network device with given PCI device */
00715         pci_set_drvdata ( pdev, netdev );
00716         netdev->dev = &pdev->dev;
00717 
00718         /* Initialize driver private storage */
00719         adapter = netdev_priv ( netdev );
00720         memset ( adapter, 0, ( sizeof ( *adapter ) ) );
00721 
00722         adapter->pdev       = pdev;
00723 
00724         adapter->ioaddr     = pdev->ioaddr;
00725         adapter->hw.io_base = pdev->ioaddr;
00726 
00727         adapter->irqno      = pdev->irq;
00728         adapter->netdev     = netdev;
00729         adapter->hw.back    = adapter;
00730 
00731         adapter->tx_ring_size = sizeof ( *adapter->tx_base ) * NUM_TX_DESC;
00732         adapter->rx_ring_size = sizeof ( *adapter->rx_base ) * NUM_RX_DESC;
00733 
00734         mmio_start = pci_bar_start ( pdev, PCI_BASE_ADDRESS_0 );
00735         mmio_len   = pci_bar_size  ( pdev, PCI_BASE_ADDRESS_0 );
00736 
00737         DBG ( "mmio_start: %#08lx\n", mmio_start );
00738         DBG ( "mmio_len: %#08lx\n", mmio_len );
00739 
00740         /* Fix up PCI device */
00741         adjust_pci_device ( pdev );
00742 
00743         err = -EIO;
00744 
00745         adapter->hw.hw_addr = ioremap ( mmio_start, mmio_len );
00746         DBG ( "adapter->hw.hw_addr: %p\n", adapter->hw.hw_addr );
00747 
00748         if ( ! adapter->hw.hw_addr )
00749                 goto err_ioremap;
00750 
00751         /* Hardware features, flags and workarounds */
00752         if (adapter->hw.mac.type >= e1000_82540) {
00753                 adapter->flags |= E1000_FLAG_HAS_SMBUS;
00754                 adapter->flags |= E1000_FLAG_HAS_INTR_MODERATION;
00755         }
00756 
00757         if (adapter->hw.mac.type == e1000_82543)
00758                 adapter->flags |= E1000_FLAG_BAD_TX_CARRIER_STATS_FD;
00759 
00760         adapter->hw.phy.autoneg_wait_to_complete = true;
00761         adapter->hw.mac.adaptive_ifs = true;
00762 
00763         /* setup the private structure */
00764         if ( ( err = e1000_sw_init ( adapter ) ) )
00765                 goto err_sw_init;
00766 
00767         if ((err = e1000_init_mac_params(&adapter->hw)))
00768                 goto err_hw_init;
00769 
00770         if ((err = e1000_init_nvm_params(&adapter->hw)))
00771                 goto err_hw_init;
00772 
00773         /* Force auto-negotiated speed and duplex */
00774         adapter->hw.mac.autoneg = 1;
00775 
00776         if ((err = e1000_init_phy_params(&adapter->hw)))
00777                 goto err_hw_init;
00778 
00779         DBG ( "adapter->hw.mac.type: %#08x\n", adapter->hw.mac.type );
00780 
00781         /* before reading the EEPROM, reset the controller to
00782          * put the device in a known good starting state
00783          */
00784         err = e1000_reset_hw ( &adapter->hw );
00785         if ( err < 0 ) {
00786                 DBG ( "Hardware Initialization Failed\n" );
00787                 goto err_reset;
00788         }
00789         /* make sure the NVM is good */
00790 
00791         if ( e1000_validate_nvm_checksum(&adapter->hw) < 0 ) {
00792                 DBG ( "The NVM Checksum Is Not Valid\n" );
00793                 err = -EIO;
00794                 goto err_eeprom;
00795         }
00796 
00797         /* copy the MAC address out of the EEPROM */
00798         if ( e1000_read_mac_addr ( &adapter->hw ) )
00799                 DBG ( "EEPROM Read Error\n" );
00800 
00801         memcpy ( netdev->hw_addr, adapter->hw.mac.perm_addr, ETH_ALEN );
00802 
00803         /* reset the hardware with the new settings */
00804         e1000_reset ( adapter );
00805 
00806         /* Mark as link up; we don't yet handle link state */
00807         netdev_link_up ( netdev );
00808 
00809         if ( ( err = register_netdev ( netdev ) ) != 0)
00810                 goto err_register;
00811 
00812         for (i = 0; i < 6; i++)
00813                 DBG ("%02x%s", netdev->ll_addr[i], i == 5 ? "\n" : ":");
00814 
00815         DBG ( "e1000_probe succeeded!\n" );
00816 
00817         /* No errors, return success */
00818         return 0;
00819 
00820 /* Error return paths */
00821 err_reset:
00822 err_register:
00823 err_hw_init:
00824 err_eeprom:
00825         if (!e1000_check_reset_block(&adapter->hw))
00826                 e1000_phy_hw_reset(&adapter->hw);
00827         if (adapter->hw.flash_address)
00828                 iounmap(adapter->hw.flash_address);
00829 err_sw_init:
00830         iounmap ( adapter->hw.hw_addr );
00831 err_ioremap:
00832         netdev_put ( netdev );
00833 err_alloc_etherdev:
00834         return err;
00835 }

void e1000_remove ( struct pci_device pdev  ) 

e1000_remove - Device Removal Routine

Parameters:
pdev PCI device information struct

Definition at line 843 of file e1000_main.c.

References DBG, e1000_reset_hw(), e1000_hw::flash_address, e1000_adapter::hw, e1000_hw::hw_addr, iounmap(), netdev, netdev_nullify(), netdev_priv(), netdev_put(), pci_get_drvdata(), and unregister_netdev().

00844 {
00845         struct net_device *netdev = pci_get_drvdata ( pdev );
00846         struct e1000_adapter *adapter = netdev_priv ( netdev );
00847 
00848         DBG ( "e1000_remove\n" );
00849 
00850         if ( adapter->hw.flash_address )
00851                 iounmap ( adapter->hw.flash_address );
00852         if  ( adapter->hw.hw_addr )
00853                 iounmap ( adapter->hw.hw_addr );
00854 
00855         unregister_netdev ( netdev );
00856         e1000_reset_hw ( &adapter->hw );
00857         netdev_nullify ( netdev );
00858         netdev_put ( netdev );
00859 }


Generated on Tue Apr 6 20:01:24 2010 for gPXE by  doxygen 1.5.7.1