e1000_api.c

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003   Intel PRO/1000 Linux driver
00004   Copyright(c) 1999 - 2008 Intel Corporation.
00005 
00006   This program is free software; you can redistribute it and/or modify it
00007   under the terms and conditions of the GNU General Public License,
00008   version 2, as published by the Free Software Foundation.
00009 
00010   This program is distributed in the hope it will be useful, but WITHOUT
00011   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013   more details.
00014 
00015   You should have received a copy of the GNU General Public License along with
00016   this program; if not, write to the Free Software Foundation, Inc.,
00017   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019   The full GNU General Public License is included in this distribution in
00020   the file called "COPYING".
00021 
00022   Contact Information:
00023   Linux NICS <linux.nics@intel.com>
00024   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
00025   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
00026 
00027 *******************************************************************************/
00028 
00029 FILE_LICENCE ( GPL2_OR_LATER );
00030 
00031 #include "e1000_api.h"
00032 
00033 /**
00034  *  e1000_init_mac_params - Initialize MAC function pointers
00035  *  @hw: pointer to the HW structure
00036  *
00037  *  This function initializes the function pointers for the MAC
00038  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00039  **/
00040 s32 e1000_init_mac_params(struct e1000_hw *hw)
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 }
00058 
00059 /**
00060  *  e1000_init_nvm_params - Initialize NVM function pointers
00061  *  @hw: pointer to the HW structure
00062  *
00063  *  This function initializes the function pointers for the NVM
00064  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00065  **/
00066 s32 e1000_init_nvm_params(struct e1000_hw *hw)
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 }
00084 
00085 /**
00086  *  e1000_init_phy_params - Initialize PHY function pointers
00087  *  @hw: pointer to the HW structure
00088  *
00089  *  This function initializes the function pointers for the PHY
00090  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00091  **/
00092 s32 e1000_init_phy_params(struct e1000_hw *hw)
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 }
00110 
00111 /**
00112  *  e1000_set_mac_type - Sets MAC type
00113  *  @hw: pointer to the HW structure
00114  *
00115  *  This function sets the mac type of the adapter based on the
00116  *  device ID stored in the hw structure.
00117  *  MUST BE FIRST FUNCTION CALLED (explicitly or through
00118  *  e1000_setup_init_funcs()).
00119  **/
00120 s32 e1000_set_mac_type(struct e1000_hw *hw)
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 }
00196 
00197 /**
00198  *  e1000_setup_init_funcs - Initializes function pointers
00199  *  @hw: pointer to the HW structure
00200  *  @init_device: true will initialize the rest of the function pointers
00201  *                 getting the device ready for use.  false will only set
00202  *                 MAC type and the function pointers for the other init
00203  *                 functions.  Passing false will not generate any hardware
00204  *                 reads or writes.
00205  *
00206  *  This function must be called by a driver in order to use the rest
00207  *  of the 'shared' code files. Called by drivers only.
00208  **/
00209 s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
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 }
00287 
00288 /**
00289  *  e1000_get_bus_info - Obtain bus information for adapter
00290  *  @hw: pointer to the HW structure
00291  *
00292  *  This will obtain information about the HW bus for which the
00293  *  adapter is attached and stores it in the hw structure. This is a
00294  *  function pointer entry point called by drivers.
00295  **/
00296 s32 e1000_get_bus_info(struct e1000_hw *hw)
00297 {
00298         if (hw->mac.ops.get_bus_info)
00299                 return hw->mac.ops.get_bus_info(hw);
00300 
00301         return E1000_SUCCESS;
00302 }
00303 
00304 /**
00305  *  e1000_clear_vfta - Clear VLAN filter table
00306  *  @hw: pointer to the HW structure
00307  *
00308  *  This clears the VLAN filter table on the adapter. This is a function
00309  *  pointer entry point called by drivers.
00310  **/
00311 void e1000_clear_vfta(struct e1000_hw *hw)
00312 {
00313         if (hw->mac.ops.clear_vfta)
00314                 hw->mac.ops.clear_vfta(hw);
00315 }
00316 
00317 /**
00318  *  e1000_write_vfta - Write value to VLAN filter table
00319  *  @hw: pointer to the HW structure
00320  *  @offset: the 32-bit offset in which to write the value to.
00321  *  @value: the 32-bit value to write at location offset.
00322  *
00323  *  This writes a 32-bit value to a 32-bit offset in the VLAN filter
00324  *  table. This is a function pointer entry point called by drivers.
00325  **/
00326 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
00327 {
00328         if (hw->mac.ops.write_vfta)
00329                 hw->mac.ops.write_vfta(hw, offset, value);
00330 }
00331 
00332 /**
00333  *  e1000_update_mc_addr_list - Update Multicast addresses
00334  *  @hw: pointer to the HW structure
00335  *  @mc_addr_list: array of multicast addresses to program
00336  *  @mc_addr_count: number of multicast addresses to program
00337  *
00338  *  Updates the Multicast Table Array.
00339  *  The caller must have a packed mc_addr_list of multicast addresses.
00340  **/
00341 void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
00342                                u32 mc_addr_count)
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 }
00348 
00349 /**
00350  *  e1000_force_mac_fc - Force MAC flow control
00351  *  @hw: pointer to the HW structure
00352  *
00353  *  Force the MAC's flow control settings. Currently no func pointer exists
00354  *  and all implementations are handled in the generic version of this
00355  *  function.
00356  **/
00357 s32 e1000_force_mac_fc(struct e1000_hw *hw)
00358 {
00359         return e1000_force_mac_fc_generic(hw);
00360 }
00361 
00362 /**
00363  *  e1000_check_for_link - Check/Store link connection
00364  *  @hw: pointer to the HW structure
00365  *
00366  *  This checks the link condition of the adapter and stores the
00367  *  results in the hw->mac structure. This is a function pointer entry
00368  *  point called by drivers.
00369  **/
00370 s32 e1000_check_for_link(struct e1000_hw *hw)
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 }
00377 
00378 #if 0
00379 /**
00380  *  e1000_check_mng_mode - Check management mode
00381  *  @hw: pointer to the HW structure
00382  *
00383  *  This checks if the adapter has manageability enabled.
00384  *  This is a function pointer entry point called by drivers.
00385  **/
00386 bool e1000_check_mng_mode(struct e1000_hw *hw)
00387 {
00388         if (hw->mac.ops.check_mng_mode)
00389                 return hw->mac.ops.check_mng_mode(hw);
00390 
00391         return false;
00392 }
00393 
00394 /**
00395  *  e1000_mng_write_dhcp_info - Writes DHCP info to host interface
00396  *  @hw: pointer to the HW structure
00397  *  @buffer: pointer to the host interface
00398  *  @length: size of the buffer
00399  *
00400  *  Writes the DHCP information to the host interface.
00401  **/
00402 s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
00403 {
00404         return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
00405 }
00406 #endif
00407 
00408 /**
00409  *  e1000_reset_hw - Reset hardware
00410  *  @hw: pointer to the HW structure
00411  *
00412  *  This resets the hardware into a known state. This is a function pointer
00413  *  entry point called by drivers.
00414  **/
00415 s32 e1000_reset_hw(struct e1000_hw *hw)
00416 {
00417         if (hw->mac.ops.reset_hw)
00418                 return hw->mac.ops.reset_hw(hw);
00419 
00420         return -E1000_ERR_CONFIG;
00421 }
00422 
00423 /**
00424  *  e1000_init_hw - Initialize hardware
00425  *  @hw: pointer to the HW structure
00426  *
00427  *  This inits the hardware readying it for operation. This is a function
00428  *  pointer entry point called by drivers.
00429  **/
00430 s32 e1000_init_hw(struct e1000_hw *hw)
00431 {
00432         if (hw->mac.ops.init_hw)
00433                 return hw->mac.ops.init_hw(hw);
00434 
00435         return -E1000_ERR_CONFIG;
00436 }
00437 
00438 /**
00439  *  e1000_setup_link - Configures link and flow control
00440  *  @hw: pointer to the HW structure
00441  *
00442  *  This configures link and flow control settings for the adapter. This
00443  *  is a function pointer entry point called by drivers. While modules can
00444  *  also call this, they probably call their own version of this function.
00445  **/
00446 s32 e1000_setup_link(struct e1000_hw *hw)
00447 {
00448         if (hw->mac.ops.setup_link)
00449                 return hw->mac.ops.setup_link(hw);
00450 
00451         return -E1000_ERR_CONFIG;
00452 }
00453 
00454 /**
00455  *  e1000_get_speed_and_duplex - Returns current speed and duplex
00456  *  @hw: pointer to the HW structure
00457  *  @speed: pointer to a 16-bit value to store the speed
00458  *  @duplex: pointer to a 16-bit value to store the duplex.
00459  *
00460  *  This returns the speed and duplex of the adapter in the two 'out'
00461  *  variables passed in. This is a function pointer entry point called
00462  *  by drivers.
00463  **/
00464 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
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 }
00471 
00472 /**
00473  *  e1000_setup_led - Configures SW controllable LED
00474  *  @hw: pointer to the HW structure
00475  *
00476  *  This prepares the SW controllable LED for use and saves the current state
00477  *  of the LED so it can be later restored. This is a function pointer entry
00478  *  point called by drivers.
00479  **/
00480 s32 e1000_setup_led(struct e1000_hw *hw)
00481 {
00482         if (hw->mac.ops.setup_led)
00483                 return hw->mac.ops.setup_led(hw);
00484 
00485         return E1000_SUCCESS;
00486 }
00487 
00488 /**
00489  *  e1000_cleanup_led - Restores SW controllable LED
00490  *  @hw: pointer to the HW structure
00491  *
00492  *  This restores the SW controllable LED to the value saved off by
00493  *  e1000_setup_led. This is a function pointer entry point called by drivers.
00494  **/
00495 s32 e1000_cleanup_led(struct e1000_hw *hw)
00496 {
00497         if (hw->mac.ops.cleanup_led)
00498                 return hw->mac.ops.cleanup_led(hw);
00499 
00500         return E1000_SUCCESS;
00501 }
00502 
00503 /**
00504  *  e1000_blink_led - Blink SW controllable LED
00505  *  @hw: pointer to the HW structure
00506  *
00507  *  This starts the adapter LED blinking. Request the LED to be setup first
00508  *  and cleaned up after. This is a function pointer entry point called by
00509  *  drivers.
00510  **/
00511 s32 e1000_blink_led(struct e1000_hw *hw)
00512 {
00513         if (hw->mac.ops.blink_led)
00514                 return hw->mac.ops.blink_led(hw);
00515 
00516         return E1000_SUCCESS;
00517 }
00518 
00519 /**
00520  *  e1000_id_led_init - store LED configurations in SW
00521  *  @hw: pointer to the HW structure
00522  *
00523  *  Initializes the LED config in SW. This is a function pointer entry point
00524  *  called by drivers.
00525  **/
00526 s32 e1000_id_led_init(struct e1000_hw *hw)
00527 {
00528         if (hw->mac.ops.id_led_init)
00529                 return hw->mac.ops.id_led_init(hw);
00530 
00531         return E1000_SUCCESS;
00532 }
00533 
00534 /**
00535  *  e1000_led_on - Turn on SW controllable LED
00536  *  @hw: pointer to the HW structure
00537  *
00538  *  Turns the SW defined LED on. This is a function pointer entry point
00539  *  called by drivers.
00540  **/
00541 s32 e1000_led_on(struct e1000_hw *hw)
00542 {
00543         if (hw->mac.ops.led_on)
00544                 return hw->mac.ops.led_on(hw);
00545 
00546         return E1000_SUCCESS;
00547 }
00548 
00549 /**
00550  *  e1000_led_off - Turn off SW controllable LED
00551  *  @hw: pointer to the HW structure
00552  *
00553  *  Turns the SW defined LED off. This is a function pointer entry point
00554  *  called by drivers.
00555  **/
00556 s32 e1000_led_off(struct e1000_hw *hw)
00557 {
00558         if (hw->mac.ops.led_off)
00559                 return hw->mac.ops.led_off(hw);
00560 
00561         return E1000_SUCCESS;
00562 }
00563 
00564 /**
00565  *  e1000_reset_adaptive - Reset adaptive IFS
00566  *  @hw: pointer to the HW structure
00567  *
00568  *  Resets the adaptive IFS. Currently no func pointer exists and all
00569  *  implementations are handled in the generic version of this function.
00570  **/
00571 void e1000_reset_adaptive(struct e1000_hw *hw)
00572 {
00573         e1000_reset_adaptive_generic(hw);
00574 }
00575 
00576 /**
00577  *  e1000_update_adaptive - Update adaptive IFS
00578  *  @hw: pointer to the HW structure
00579  *
00580  *  Updates adapter IFS. Currently no func pointer exists and all
00581  *  implementations are handled in the generic version of this function.
00582  **/
00583 void e1000_update_adaptive(struct e1000_hw *hw)
00584 {
00585         e1000_update_adaptive_generic(hw);
00586 }
00587 
00588 /**
00589  *  e1000_disable_pcie_master - Disable PCI-Express master access
00590  *  @hw: pointer to the HW structure
00591  *
00592  *  Disables PCI-Express master access and verifies there are no pending
00593  *  requests. Currently no func pointer exists and all implementations are
00594  *  handled in the generic version of this function.
00595  **/
00596 s32 e1000_disable_pcie_master(struct e1000_hw *hw)
00597 {
00598         return e1000_disable_pcie_master_generic(hw);
00599 }
00600 
00601 /**
00602  *  e1000_config_collision_dist - Configure collision distance
00603  *  @hw: pointer to the HW structure
00604  *
00605  *  Configures the collision distance to the default value and is used
00606  *  during link setup.
00607  **/
00608 void e1000_config_collision_dist(struct e1000_hw *hw)
00609 {
00610         if (hw->mac.ops.config_collision_dist)
00611                 hw->mac.ops.config_collision_dist(hw);
00612 }
00613 
00614 /**
00615  *  e1000_rar_set - Sets a receive address register
00616  *  @hw: pointer to the HW structure
00617  *  @addr: address to set the RAR to
00618  *  @index: the RAR to set
00619  *
00620  *  Sets a Receive Address Register (RAR) to the specified address.
00621  **/
00622 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
00623 {
00624         if (hw->mac.ops.rar_set)
00625                 hw->mac.ops.rar_set(hw, addr, index);
00626 }
00627 
00628 /**
00629  *  e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
00630  *  @hw: pointer to the HW structure
00631  *
00632  *  Ensures that the MDI/MDIX SW state is valid.
00633  **/
00634 s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
00635 {
00636         if (hw->mac.ops.validate_mdi_setting)
00637                 return hw->mac.ops.validate_mdi_setting(hw);
00638 
00639         return E1000_SUCCESS;
00640 }
00641 
00642 /**
00643  *  e1000_mta_set - Sets multicast table bit
00644  *  @hw: pointer to the HW structure
00645  *  @hash_value: Multicast hash value.
00646  *
00647  *  This sets the bit in the multicast table corresponding to the
00648  *  hash value.  This is a function pointer entry point called by drivers.
00649  **/
00650 void e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
00651 {
00652         if (hw->mac.ops.mta_set)
00653                 hw->mac.ops.mta_set(hw, hash_value);
00654 }
00655 
00656 /**
00657  *  e1000_hash_mc_addr - Determines address location in multicast table
00658  *  @hw: pointer to the HW structure
00659  *  @mc_addr: Multicast address to hash.
00660  *
00661  *  This hashes an address to determine its location in the multicast
00662  *  table. Currently no func pointer exists and all implementations
00663  *  are handled in the generic version of this function.
00664  **/
00665 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
00666 {
00667         return e1000_hash_mc_addr_generic(hw, mc_addr);
00668 }
00669 
00670 #if 0
00671 /**
00672  *  e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
00673  *  @hw: pointer to the HW structure
00674  *
00675  *  Enables packet filtering on transmit packets if manageability is enabled
00676  *  and host interface is enabled.
00677  *  Currently no func pointer exists and all implementations are handled in the
00678  *  generic version of this function.
00679  **/
00680 bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
00681 {
00682         return e1000_enable_tx_pkt_filtering_generic(hw);
00683 }
00684 
00685 /**
00686  *  e1000_mng_host_if_write - Writes to the manageability host interface
00687  *  @hw: pointer to the HW structure
00688  *  @buffer: pointer to the host interface buffer
00689  *  @length: size of the buffer
00690  *  @offset: location in the buffer to write to
00691  *  @sum: sum of the data (not checksum)
00692  *
00693  *  This function writes the buffer content at the offset given on the host if.
00694  *  It also does alignment considerations to do the writes in most efficient
00695  *  way.  Also fills up the sum of the buffer in *buffer parameter.
00696  **/
00697 s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
00698                             u16 offset, u8 *sum)
00699 {
00700         if (hw->mac.ops.mng_host_if_write)
00701                 return hw->mac.ops.mng_host_if_write(hw, buffer, length,
00702                                                      offset, sum);
00703 
00704         return E1000_NOT_IMPLEMENTED;
00705 }
00706 
00707 /**
00708  *  e1000_mng_write_cmd_header - Writes manageability command header
00709  *  @hw: pointer to the HW structure
00710  *  @hdr: pointer to the host interface command header
00711  *
00712  *  Writes the command header after does the checksum calculation.
00713  **/
00714 s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
00715                                struct e1000_host_mng_command_header *hdr)
00716 {
00717         if (hw->mac.ops.mng_write_cmd_header)
00718                 return hw->mac.ops.mng_write_cmd_header(hw, hdr);
00719 
00720         return E1000_NOT_IMPLEMENTED;
00721 }
00722 
00723 /**
00724  *  e1000_mng_enable_host_if - Checks host interface is enabled
00725  *  @hw: pointer to the HW structure
00726  *
00727  *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
00728  *
00729  *  This function checks whether the HOST IF is enabled for command operation
00730  *  and also checks whether the previous command is completed.  It busy waits
00731  *  in case of previous command is not completed.
00732  **/
00733 s32 e1000_mng_enable_host_if(struct e1000_hw * hw)
00734 {
00735         if (hw->mac.ops.mng_enable_host_if)
00736                 return hw->mac.ops.mng_enable_host_if(hw);
00737 
00738         return E1000_NOT_IMPLEMENTED;
00739 }
00740 #endif
00741 
00742 /**
00743  *  e1000_wait_autoneg - Waits for autonegotiation completion
00744  *  @hw: pointer to the HW structure
00745  *
00746  *  Waits for autoneg to complete. Currently no func pointer exists and all
00747  *  implementations are handled in the generic version of this function.
00748  **/
00749 s32 e1000_wait_autoneg(struct e1000_hw *hw)
00750 {
00751         if (hw->mac.ops.wait_autoneg)
00752                 return hw->mac.ops.wait_autoneg(hw);
00753 
00754         return E1000_SUCCESS;
00755 }
00756 
00757 /**
00758  *  e1000_check_reset_block - Verifies PHY can be reset
00759  *  @hw: pointer to the HW structure
00760  *
00761  *  Checks if the PHY is in a state that can be reset or if manageability
00762  *  has it tied up. This is a function pointer entry point called by drivers.
00763  **/
00764 s32 e1000_check_reset_block(struct e1000_hw *hw)
00765 {
00766         if (hw->phy.ops.check_reset_block)
00767                 return hw->phy.ops.check_reset_block(hw);
00768 
00769         return E1000_SUCCESS;
00770 }
00771 
00772 /**
00773  *  e1000_read_phy_reg - Reads PHY register
00774  *  @hw: pointer to the HW structure
00775  *  @offset: the register to read
00776  *  @data: the buffer to store the 16-bit read.
00777  *
00778  *  Reads the PHY register and returns the value in data.
00779  *  This is a function pointer entry point called by drivers.
00780  **/
00781 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
00782 {
00783         if (hw->phy.ops.read_reg)
00784                 return hw->phy.ops.read_reg(hw, offset, data);
00785 
00786         return E1000_SUCCESS;
00787 }
00788 
00789 /**
00790  *  e1000_write_phy_reg - Writes PHY register
00791  *  @hw: pointer to the HW structure
00792  *  @offset: the register to write
00793  *  @data: the value to write.
00794  *
00795  *  Writes the PHY register at offset with the value in data.
00796  *  This is a function pointer entry point called by drivers.
00797  **/
00798 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
00799 {
00800         if (hw->phy.ops.write_reg)
00801                 return hw->phy.ops.write_reg(hw, offset, data);
00802 
00803         return E1000_SUCCESS;
00804 }
00805 
00806 /**
00807  *  e1000_release_phy - Generic release PHY
00808  *  @hw: pointer to the HW structure
00809  *
00810  *  Return if silicon family does not require a semaphore when accessing the
00811  *  PHY.
00812  **/
00813 void e1000_release_phy(struct e1000_hw *hw)
00814 {
00815         if (hw->phy.ops.release)
00816                 hw->phy.ops.release(hw);
00817 }
00818 
00819 /**
00820  *  e1000_acquire_phy - Generic acquire PHY
00821  *  @hw: pointer to the HW structure
00822  *
00823  *  Return success if silicon family does not require a semaphore when
00824  *  accessing the PHY.
00825  **/
00826 s32 e1000_acquire_phy(struct e1000_hw *hw)
00827 {
00828         if (hw->phy.ops.acquire)
00829                 return hw->phy.ops.acquire(hw);
00830 
00831         return E1000_SUCCESS;
00832 }
00833 
00834 /**
00835  *  e1000_read_kmrn_reg - Reads register using Kumeran interface
00836  *  @hw: pointer to the HW structure
00837  *  @offset: the register to read
00838  *  @data: the location to store the 16-bit value read.
00839  *
00840  *  Reads a register out of the Kumeran interface. Currently no func pointer
00841  *  exists and all implementations are handled in the generic version of
00842  *  this function.
00843  **/
00844 s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
00845 {
00846         return e1000_read_kmrn_reg_generic(hw, offset, data);
00847 }
00848 
00849 /**
00850  *  e1000_write_kmrn_reg - Writes register using Kumeran interface
00851  *  @hw: pointer to the HW structure
00852  *  @offset: the register to write
00853  *  @data: the value to write.
00854  *
00855  *  Writes a register to the Kumeran interface. Currently no func pointer
00856  *  exists and all implementations are handled in the generic version of
00857  *  this function.
00858  **/
00859 s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
00860 {
00861         return e1000_write_kmrn_reg_generic(hw, offset, data);
00862 }
00863 
00864 #if 0
00865 /**
00866  *  e1000_get_cable_length - Retrieves cable length estimation
00867  *  @hw: pointer to the HW structure
00868  *
00869  *  This function estimates the cable length and stores them in
00870  *  hw->phy.min_length and hw->phy.max_length. This is a function pointer
00871  *  entry point called by drivers.
00872  **/
00873 s32 e1000_get_cable_length(struct e1000_hw *hw)
00874 {
00875         if (hw->phy.ops.get_cable_length)
00876                 return hw->phy.ops.get_cable_length(hw);
00877 
00878         return E1000_SUCCESS;
00879 }
00880 #endif
00881 
00882 /**
00883  *  e1000_get_phy_info - Retrieves PHY information from registers
00884  *  @hw: pointer to the HW structure
00885  *
00886  *  This function gets some information from various PHY registers and
00887  *  populates hw->phy values with it. This is a function pointer entry
00888  *  point called by drivers.
00889  **/
00890 s32 e1000_get_phy_info(struct e1000_hw *hw)
00891 {
00892         if (hw->phy.ops.get_info)
00893                 return hw->phy.ops.get_info(hw);
00894 
00895         return E1000_SUCCESS;
00896 }
00897 
00898 /**
00899  *  e1000_phy_hw_reset - Hard PHY reset
00900  *  @hw: pointer to the HW structure
00901  *
00902  *  Performs a hard PHY reset. This is a function pointer entry point called
00903  *  by drivers.
00904  **/
00905 s32 e1000_phy_hw_reset(struct e1000_hw *hw)
00906 {
00907         if (hw->phy.ops.reset)
00908                 return hw->phy.ops.reset(hw);
00909 
00910         return E1000_SUCCESS;
00911 }
00912 
00913 /**
00914  *  e1000_phy_commit - Soft PHY reset
00915  *  @hw: pointer to the HW structure
00916  *
00917  *  Performs a soft PHY reset on those that apply. This is a function pointer
00918  *  entry point called by drivers.
00919  **/
00920 s32 e1000_phy_commit(struct e1000_hw *hw)
00921 {
00922         if (hw->phy.ops.commit)
00923                 return hw->phy.ops.commit(hw);
00924 
00925         return E1000_SUCCESS;
00926 }
00927 
00928 /**
00929  *  e1000_set_d0_lplu_state - Sets low power link up state for D0
00930  *  @hw: pointer to the HW structure
00931  *  @active: boolean used to enable/disable lplu
00932  *
00933  *  Success returns 0, Failure returns 1
00934  *
00935  *  The low power link up (lplu) state is set to the power management level D0
00936  *  and SmartSpeed is disabled when active is true, else clear lplu for D0
00937  *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
00938  *  is used during Dx states where the power conservation is most important.
00939  *  During driver activity, SmartSpeed should be enabled so performance is
00940  *  maintained.  This is a function pointer entry point called by drivers.
00941  **/
00942 s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
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 }
00949 
00950 /**
00951  *  e1000_set_d3_lplu_state - Sets low power link up state for D3
00952  *  @hw: pointer to the HW structure
00953  *  @active: boolean used to enable/disable lplu
00954  *
00955  *  Success returns 0, Failure returns 1
00956  *
00957  *  The low power link up (lplu) state is set to the power management level D3
00958  *  and SmartSpeed is disabled when active is true, else clear lplu for D3
00959  *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
00960  *  is used during Dx states where the power conservation is most important.
00961  *  During driver activity, SmartSpeed should be enabled so performance is
00962  *  maintained.  This is a function pointer entry point called by drivers.
00963  **/
00964 s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
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 }
00971 
00972 /**
00973  *  e1000_read_mac_addr - Reads MAC address
00974  *  @hw: pointer to the HW structure
00975  *
00976  *  Reads the MAC address out of the adapter and stores it in the HW structure.
00977  *  Currently no func pointer exists and all implementations are handled in the
00978  *  generic version of this function.
00979  **/
00980 s32 e1000_read_mac_addr(struct e1000_hw *hw)
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 }
00987 
00988 /**
00989  *  e1000_read_pba_num - Read device part number
00990  *  @hw: pointer to the HW structure
00991  *  @pba_num: pointer to device part number
00992  *
00993  *  Reads the product board assembly (PBA) number from the EEPROM and stores
00994  *  the value in pba_num.
00995  *  Currently no func pointer exists and all implementations are handled in the
00996  *  generic version of this function.
00997  **/
00998 s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
00999 {
01000         return e1000_read_pba_num_generic(hw, pba_num);
01001 }
01002 
01003 /**
01004  *  e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
01005  *  @hw: pointer to the HW structure
01006  *
01007  *  Validates the NVM checksum is correct. This is a function pointer entry
01008  *  point called by drivers.
01009  **/
01010 s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
01011 {
01012         if (hw->nvm.ops.validate)
01013                 return hw->nvm.ops.validate(hw);
01014 
01015         return -E1000_ERR_CONFIG;
01016 }
01017 
01018 /**
01019  *  e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
01020  *  @hw: pointer to the HW structure
01021  *
01022  *  Updates the NVM checksum. Currently no func pointer exists and all
01023  *  implementations are handled in the generic version of this function.
01024  **/
01025 s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
01026 {
01027         if (hw->nvm.ops.update)
01028                 return hw->nvm.ops.update(hw);
01029 
01030         return -E1000_ERR_CONFIG;
01031 }
01032 
01033 /**
01034  *  e1000_reload_nvm - Reloads EEPROM
01035  *  @hw: pointer to the HW structure
01036  *
01037  *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
01038  *  extended control register.
01039  **/
01040 void e1000_reload_nvm(struct e1000_hw *hw)
01041 {
01042         if (hw->nvm.ops.reload)
01043                 hw->nvm.ops.reload(hw);
01044 }
01045 
01046 /**
01047  *  e1000_read_nvm - Reads NVM (EEPROM)
01048  *  @hw: pointer to the HW structure
01049  *  @offset: the word offset to read
01050  *  @words: number of 16-bit words to read
01051  *  @data: pointer to the properly sized buffer for the data.
01052  *
01053  *  Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
01054  *  pointer entry point called by drivers.
01055  **/
01056 s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
01057 {
01058         if (hw->nvm.ops.read)
01059                 return hw->nvm.ops.read(hw, offset, words, data);
01060 
01061         return -E1000_ERR_CONFIG;
01062 }
01063 
01064 /**
01065  *  e1000_write_nvm - Writes to NVM (EEPROM)
01066  *  @hw: pointer to the HW structure
01067  *  @offset: the word offset to read
01068  *  @words: number of 16-bit words to write
01069  *  @data: pointer to the properly sized buffer for the data.
01070  *
01071  *  Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
01072  *  pointer entry point called by drivers.
01073  **/
01074 s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
01075 {
01076         if (hw->nvm.ops.write)
01077                 return hw->nvm.ops.write(hw, offset, words, data);
01078 
01079         return E1000_SUCCESS;
01080 }
01081 
01082 /**
01083  * e1000_power_up_phy - Restores link in case of PHY power down
01084  * @hw: pointer to the HW structure
01085  *
01086  * The phy may be powered down to save power, to turn off link when the
01087  * driver is unloaded, or wake on lan is not enabled (among others).
01088  **/
01089 void e1000_power_up_phy(struct e1000_hw *hw)
01090 {
01091         if (hw->phy.ops.power_up)
01092                 hw->phy.ops.power_up(hw);
01093 
01094         e1000_setup_link(hw);
01095 }
01096 
01097 /**
01098  * e1000_power_down_phy - Power down PHY
01099  * @hw: pointer to the HW structure
01100  *
01101  * The phy may be powered down to save power, to turn off link when the
01102  * driver is unloaded, or wake on lan is not enabled (among others).
01103  **/
01104 void e1000_power_down_phy(struct e1000_hw *hw)
01105 {
01106         if (hw->phy.ops.power_down)
01107                 hw->phy.ops.power_down(hw);
01108 }

Generated on Tue Apr 6 20:00:57 2010 for gPXE by  doxygen 1.5.7.1