igb_api.c

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003   Intel(R) Gigabit Ethernet Linux driver
00004   Copyright(c) 2007-2009 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   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
00024   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
00025 
00026 *******************************************************************************/
00027 
00028 FILE_LICENCE ( GPL2_ONLY );
00029 
00030 #include "igb.h"
00031 
00032 /**
00033  *  igb_init_mac_params - Initialize MAC function pointers
00034  *  @hw: pointer to the HW structure
00035  *
00036  *  This function initializes the function pointers for the MAC
00037  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00038  **/
00039 s32 igb_init_mac_params(struct e1000_hw *hw)
00040 {
00041         s32 ret_val = E1000_SUCCESS;
00042 
00043         if (hw->mac.ops.init_params) {
00044                 ret_val = hw->mac.ops.init_params(hw);
00045                 if (ret_val) {
00046                         DEBUGOUT("MAC Initialization Error\n");
00047                         goto out;
00048                 }
00049         } else {
00050                 DEBUGOUT("mac.init_mac_params was NULL\n");
00051                 ret_val = -E1000_ERR_CONFIG;
00052         }
00053 
00054 out:
00055         return ret_val;
00056 }
00057 
00058 /**
00059  *  igb_init_nvm_params - Initialize NVM function pointers
00060  *  @hw: pointer to the HW structure
00061  *
00062  *  This function initializes the function pointers for the NVM
00063  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00064  **/
00065 s32 igb_init_nvm_params(struct e1000_hw *hw)
00066 {
00067         s32 ret_val = E1000_SUCCESS;
00068 
00069         if (hw->nvm.ops.init_params) {
00070                 ret_val = hw->nvm.ops.init_params(hw);
00071                 if (ret_val) {
00072                         DEBUGOUT("NVM Initialization Error\n");
00073                         goto out;
00074                 }
00075         } else {
00076                 DEBUGOUT("nvm.init_nvm_params was NULL\n");
00077                 ret_val = -E1000_ERR_CONFIG;
00078         }
00079 
00080 out:
00081         return ret_val;
00082 }
00083 
00084 /**
00085  *  igb_init_phy_params - Initialize PHY function pointers
00086  *  @hw: pointer to the HW structure
00087  *
00088  *  This function initializes the function pointers for the PHY
00089  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00090  **/
00091 s32 igb_init_phy_params(struct e1000_hw *hw)
00092 {
00093         s32 ret_val = E1000_SUCCESS;
00094 
00095         if (hw->phy.ops.init_params) {
00096                 ret_val = hw->phy.ops.init_params(hw);
00097                 if (ret_val) {
00098                         DEBUGOUT("PHY Initialization Error\n");
00099                         goto out;
00100                 }
00101         } else {
00102                 DEBUGOUT("phy.init_phy_params was NULL\n");
00103                 ret_val =  -E1000_ERR_CONFIG;
00104         }
00105 
00106 out:
00107         return ret_val;
00108 }
00109 
00110 #if 0
00111 /**
00112  *  igb_init_mbx_params - Initialize mailbox function pointers
00113  *  @hw: pointer to the HW structure
00114  *
00115  *  This function initializes the function pointers for the PHY
00116  *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
00117  **/
00118 s32 igb_init_mbx_params(struct e1000_hw *hw)
00119 {
00120         s32 ret_val = E1000_SUCCESS;
00121 
00122         if (hw->mbx.ops.init_params) {
00123                 ret_val = hw->mbx.ops.init_params(hw);
00124                 if (ret_val) {
00125                         DEBUGOUT("Mailbox Initialization Error\n");
00126                         goto out;
00127                 }
00128         } else {
00129                 DEBUGOUT("mbx.init_mbx_params was NULL\n");
00130                 ret_val =  -E1000_ERR_CONFIG;
00131         }
00132 
00133 out:
00134         return ret_val;
00135 }
00136 #endif
00137 
00138 /**
00139  *  igb_set_mac_type - Sets MAC type
00140  *  @hw: pointer to the HW structure
00141  *
00142  *  This function sets the mac type of the adapter based on the
00143  *  device ID stored in the hw structure.
00144  *  MUST BE FIRST FUNCTION CALLED (explicitly or through
00145  *  igb_setup_init_funcs()).
00146  **/
00147 s32 igb_set_mac_type(struct e1000_hw *hw)
00148 {
00149         struct e1000_mac_info *mac = &hw->mac;
00150         s32 ret_val = E1000_SUCCESS;
00151 
00152         DEBUGFUNC("igb_set_mac_type");
00153 
00154         switch (hw->device_id) {
00155         case E1000_DEV_ID_82575EB_COPPER:
00156         case E1000_DEV_ID_82575EB_FIBER_SERDES:
00157         case E1000_DEV_ID_82575GB_QUAD_COPPER:
00158                 mac->type = e1000_82575;
00159                 break;
00160         case E1000_DEV_ID_82576:
00161         case E1000_DEV_ID_82576_FIBER:
00162         case E1000_DEV_ID_82576_SERDES:
00163         case E1000_DEV_ID_82576_QUAD_COPPER:
00164         case E1000_DEV_ID_82576_NS:
00165         case E1000_DEV_ID_82576_NS_SERDES:
00166         case E1000_DEV_ID_82576_SERDES_QUAD:
00167                 mac->type = e1000_82576;
00168                 break;
00169         default:
00170                 /* Should never have loaded on this device */
00171                 ret_val = -E1000_ERR_MAC_INIT;
00172                 break;
00173         }
00174 
00175         return ret_val;
00176 }
00177 
00178 /**
00179  *  igb_setup_init_funcs - Initializes function pointers
00180  *  @hw: pointer to the HW structure
00181  *  @init_device: true will initialize the rest of the function pointers
00182  *                 getting the device ready for use.  false will only set
00183  *                 MAC type and the function pointers for the other init
00184  *                 functions.  Passing false will not generate any hardware
00185  *                 reads or writes.
00186  *
00187  *  This function must be called by a driver in order to use the rest
00188  *  of the 'shared' code files. Called by drivers only.
00189  **/
00190 s32 igb_setup_init_funcs(struct e1000_hw *hw, bool init_device)
00191 {
00192         s32 ret_val;
00193 
00194         /* Can't do much good without knowing the MAC type. */
00195         ret_val = igb_set_mac_type(hw);
00196         if (ret_val) {
00197                 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
00198                 goto out;
00199         }
00200 
00201         if (!hw->hw_addr) {
00202                 DEBUGOUT("ERROR: Registers not mapped\n");
00203                 ret_val = -E1000_ERR_CONFIG;
00204                 goto out;
00205         }
00206 
00207         /*
00208          * Init function pointers to generic implementations. We do this first
00209          * allowing a driver module to override it afterward.
00210          */
00211         igb_init_mac_ops_generic(hw);
00212         igb_init_nvm_ops_generic(hw);
00213 #if 0
00214         igb_init_mbx_ops_generic(hw);
00215 #endif
00216         /*
00217          * Set up the init function pointers. These are functions within the
00218          * adapter family file that sets up function pointers for the rest of
00219          * the functions in that family.
00220          */
00221         switch (hw->mac.type) {
00222         case e1000_82575:
00223         case e1000_82576:
00224                 igb_init_function_pointers_82575(hw);
00225                 break;
00226         default:
00227                 DEBUGOUT("Hardware not supported\n");
00228                 ret_val = -E1000_ERR_CONFIG;
00229                 break;
00230         }
00231 
00232         /*
00233          * Initialize the rest of the function pointers. These require some
00234          * register reads/writes in some cases.
00235          */
00236         if (!(ret_val) && init_device) {
00237                 ret_val = igb_init_mac_params(hw);
00238                 if (ret_val)
00239                         goto out;
00240 
00241                 ret_val = igb_init_nvm_params(hw);
00242                 if (ret_val)
00243                         goto out;
00244 
00245                 ret_val = igb_init_phy_params(hw);
00246                 if (ret_val)
00247                         goto out;
00248 #if 0
00249                 ret_val = igb_init_mbx_params(hw);
00250                 if (ret_val)
00251                         goto out;
00252 #endif
00253         }
00254 
00255 out:
00256         return ret_val;
00257 }
00258 
00259 /**
00260  *  igb_get_bus_info - Obtain bus information for adapter
00261  *  @hw: pointer to the HW structure
00262  *
00263  *  This will obtain information about the HW bus for which the
00264  *  adapter is attached and stores it in the hw structure. This is a
00265  *  function pointer entry point called by drivers.
00266  **/
00267 s32 igb_get_bus_info(struct e1000_hw *hw)
00268 {
00269         if (hw->mac.ops.get_bus_info)
00270                 return hw->mac.ops.get_bus_info(hw);
00271 
00272         return E1000_SUCCESS;
00273 }
00274 
00275 /**
00276  *  igb_clear_vfta - Clear VLAN filter table
00277  *  @hw: pointer to the HW structure
00278  *
00279  *  This clears the VLAN filter table on the adapter. This is a function
00280  *  pointer entry point called by drivers.
00281  **/
00282 void igb_clear_vfta(struct e1000_hw *hw)
00283 {
00284         if (hw->mac.ops.clear_vfta)
00285                 hw->mac.ops.clear_vfta(hw);
00286 }
00287 
00288 /**
00289  *  igb_write_vfta - Write value to VLAN filter table
00290  *  @hw: pointer to the HW structure
00291  *  @offset: the 32-bit offset in which to write the value to.
00292  *  @value: the 32-bit value to write at location offset.
00293  *
00294  *  This writes a 32-bit value to a 32-bit offset in the VLAN filter
00295  *  table. This is a function pointer entry point called by drivers.
00296  **/
00297 void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
00298 {
00299         if (hw->mac.ops.write_vfta)
00300                 hw->mac.ops.write_vfta(hw, offset, value);
00301 }
00302 
00303 /**
00304  *  igb_update_mc_addr_list - Update Multicast addresses
00305  *  @hw: pointer to the HW structure
00306  *  @mc_addr_list: array of multicast addresses to program
00307  *  @mc_addr_count: number of multicast addresses to program
00308  *
00309  *  Updates the Multicast Table Array.
00310  *  The caller must have a packed mc_addr_list of multicast addresses.
00311  **/
00312 void igb_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
00313                                u32 mc_addr_count)
00314 {
00315         if (hw->mac.ops.update_mc_addr_list)
00316                 hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
00317                                                 mc_addr_count);
00318 }
00319 
00320 /**
00321  *  igb_force_mac_fc - Force MAC flow control
00322  *  @hw: pointer to the HW structure
00323  *
00324  *  Force the MAC's flow control settings. Currently no func pointer exists
00325  *  and all implementations are handled in the generic version of this
00326  *  function.
00327  **/
00328 s32 igb_force_mac_fc(struct e1000_hw *hw)
00329 {
00330         return igb_force_mac_fc_generic(hw);
00331 }
00332 
00333 /**
00334  *  igb_check_for_link - Check/Store link connection
00335  *  @hw: pointer to the HW structure
00336  *
00337  *  This checks the link condition of the adapter and stores the
00338  *  results in the hw->mac structure. This is a function pointer entry
00339  *  point called by drivers.
00340  **/
00341 s32 igb_check_for_link(struct e1000_hw *hw)
00342 {
00343         if (hw->mac.ops.check_for_link)
00344                 return hw->mac.ops.check_for_link(hw);
00345 
00346         return -E1000_ERR_CONFIG;
00347 }
00348 
00349 /**
00350  *  igb_check_mng_mode - Check management mode
00351  *  @hw: pointer to the HW structure
00352  *
00353  *  This checks if the adapter has manageability enabled.
00354  *  This is a function pointer entry point called by drivers.
00355  **/
00356 bool igb_check_mng_mode(struct e1000_hw *hw)
00357 {
00358         if (hw->mac.ops.check_mng_mode)
00359                 return hw->mac.ops.check_mng_mode(hw);
00360 
00361         return false;
00362 }
00363 
00364 #if 0
00365 /**
00366  *  igb_mng_write_dhcp_info - Writes DHCP info to host interface
00367  *  @hw: pointer to the HW structure
00368  *  @buffer: pointer to the host interface
00369  *  @length: size of the buffer
00370  *
00371  *  Writes the DHCP information to the host interface.
00372  **/
00373 s32 igb_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
00374 {
00375         return igb_mng_write_dhcp_info_generic(hw, buffer, length);
00376 }
00377 #endif
00378 
00379 /**
00380  *  igb_reset_hw - Reset hardware
00381  *  @hw: pointer to the HW structure
00382  *
00383  *  This resets the hardware into a known state. This is a function pointer
00384  *  entry point called by drivers.
00385  **/
00386 s32 igb_reset_hw(struct e1000_hw *hw)
00387 {
00388         if (hw->mac.ops.reset_hw)
00389                 return hw->mac.ops.reset_hw(hw);
00390 
00391         return -E1000_ERR_CONFIG;
00392 }
00393 
00394 /**
00395  *  igb_init_hw - Initialize hardware
00396  *  @hw: pointer to the HW structure
00397  *
00398  *  This inits the hardware readying it for operation. This is a function
00399  *  pointer entry point called by drivers.
00400  **/
00401 s32 igb_init_hw(struct e1000_hw *hw)
00402 {
00403         if (hw->mac.ops.init_hw)
00404                 return hw->mac.ops.init_hw(hw);
00405 
00406         return -E1000_ERR_CONFIG;
00407 }
00408 
00409 /**
00410  *  igb_setup_link - Configures link and flow control
00411  *  @hw: pointer to the HW structure
00412  *
00413  *  This configures link and flow control settings for the adapter. This
00414  *  is a function pointer entry point called by drivers. While modules can
00415  *  also call this, they probably call their own version of this function.
00416  **/
00417 s32 igb_setup_link(struct e1000_hw *hw)
00418 {
00419         if (hw->mac.ops.setup_link)
00420                 return hw->mac.ops.setup_link(hw);
00421 
00422         return -E1000_ERR_CONFIG;
00423 }
00424 
00425 /**
00426  *  igb_get_speed_and_duplex - Returns current speed and duplex
00427  *  @hw: pointer to the HW structure
00428  *  @speed: pointer to a 16-bit value to store the speed
00429  *  @duplex: pointer to a 16-bit value to store the duplex.
00430  *
00431  *  This returns the speed and duplex of the adapter in the two 'out'
00432  *  variables passed in. This is a function pointer entry point called
00433  *  by drivers.
00434  **/
00435 s32 igb_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
00436 {
00437         if (hw->mac.ops.get_link_up_info)
00438                 return hw->mac.ops.get_link_up_info(hw, speed, duplex);
00439 
00440         return -E1000_ERR_CONFIG;
00441 }
00442 
00443 /**
00444  *  igb_setup_led - Configures SW controllable LED
00445  *  @hw: pointer to the HW structure
00446  *
00447  *  This prepares the SW controllable LED for use and saves the current state
00448  *  of the LED so it can be later restored. This is a function pointer entry
00449  *  point called by drivers.
00450  **/
00451 s32 igb_setup_led(struct e1000_hw *hw)
00452 {
00453         if (hw->mac.ops.setup_led)
00454                 return hw->mac.ops.setup_led(hw);
00455 
00456         return E1000_SUCCESS;
00457 }
00458 
00459 /**
00460  *  igb_cleanup_led - Restores SW controllable LED
00461  *  @hw: pointer to the HW structure
00462  *
00463  *  This restores the SW controllable LED to the value saved off by
00464  *  e1000_setup_led. This is a function pointer entry point called by drivers.
00465  **/
00466 s32 igb_cleanup_led(struct e1000_hw *hw)
00467 {
00468         if (hw->mac.ops.cleanup_led)
00469                 return hw->mac.ops.cleanup_led(hw);
00470 
00471         return E1000_SUCCESS;
00472 }
00473 
00474 /**
00475  *  igb_blink_led - Blink SW controllable LED
00476  *  @hw: pointer to the HW structure
00477  *
00478  *  This starts the adapter LED blinking. Request the LED to be setup first
00479  *  and cleaned up after. This is a function pointer entry point called by
00480  *  drivers.
00481  **/
00482 s32 igb_blink_led(struct e1000_hw *hw)
00483 {
00484         if (hw->mac.ops.blink_led)
00485                 return hw->mac.ops.blink_led(hw);
00486 
00487         return E1000_SUCCESS;
00488 }
00489 
00490 /**
00491  *  igb_id_led_init - store LED configurations in SW
00492  *  @hw: pointer to the HW structure
00493  *
00494  *  Initializes the LED config in SW. This is a function pointer entry point
00495  *  called by drivers.
00496  **/
00497 s32 igb_id_led_init(struct e1000_hw *hw)
00498 {
00499         if (hw->mac.ops.id_led_init)
00500                 return hw->mac.ops.id_led_init(hw);
00501 
00502         return E1000_SUCCESS;
00503 }
00504 
00505 /**
00506  *  igb_led_on - Turn on SW controllable LED
00507  *  @hw: pointer to the HW structure
00508  *
00509  *  Turns the SW defined LED on. This is a function pointer entry point
00510  *  called by drivers.
00511  **/
00512 s32 igb_led_on(struct e1000_hw *hw)
00513 {
00514         if (hw->mac.ops.led_on)
00515                 return hw->mac.ops.led_on(hw);
00516 
00517         return E1000_SUCCESS;
00518 }
00519 
00520 /**
00521  *  igb_led_off - Turn off SW controllable LED
00522  *  @hw: pointer to the HW structure
00523  *
00524  *  Turns the SW defined LED off. This is a function pointer entry point
00525  *  called by drivers.
00526  **/
00527 s32 igb_led_off(struct e1000_hw *hw)
00528 {
00529         if (hw->mac.ops.led_off)
00530                 return hw->mac.ops.led_off(hw);
00531 
00532         return E1000_SUCCESS;
00533 }
00534 
00535 /**
00536  *  igb_reset_adaptive - Reset adaptive IFS
00537  *  @hw: pointer to the HW structure
00538  *
00539  *  Resets the adaptive IFS. Currently no func pointer exists and all
00540  *  implementations are handled in the generic version of this function.
00541  **/
00542 void igb_reset_adaptive(struct e1000_hw *hw)
00543 {
00544         igb_reset_adaptive_generic(hw);
00545 }
00546 
00547 /**
00548  *  igb_update_adaptive - Update adaptive IFS
00549  *  @hw: pointer to the HW structure
00550  *
00551  *  Updates adapter IFS. Currently no func pointer exists and all
00552  *  implementations are handled in the generic version of this function.
00553  **/
00554 void igb_update_adaptive(struct e1000_hw *hw)
00555 {
00556         igb_update_adaptive_generic(hw);
00557 }
00558 
00559 /**
00560  *  igb_disable_pcie_master - Disable PCI-Express master access
00561  *  @hw: pointer to the HW structure
00562  *
00563  *  Disables PCI-Express master access and verifies there are no pending
00564  *  requests. Currently no func pointer exists and all implementations are
00565  *  handled in the generic version of this function.
00566  **/
00567 s32 igb_disable_pcie_master(struct e1000_hw *hw)
00568 {
00569         return igb_disable_pcie_master_generic(hw);
00570 }
00571 
00572 /**
00573  *  igb_config_collision_dist - Configure collision distance
00574  *  @hw: pointer to the HW structure
00575  *
00576  *  Configures the collision distance to the default value and is used
00577  *  during link setup.
00578  **/
00579 void igb_config_collision_dist(struct e1000_hw *hw)
00580 {
00581         if (hw->mac.ops.config_collision_dist)
00582                 hw->mac.ops.config_collision_dist(hw);
00583 }
00584 
00585 /**
00586  *  igb_rar_set - Sets a receive address register
00587  *  @hw: pointer to the HW structure
00588  *  @addr: address to set the RAR to
00589  *  @index: the RAR to set
00590  *
00591  *  Sets a Receive Address Register (RAR) to the specified address.
00592  **/
00593 void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
00594 {
00595         if (hw->mac.ops.rar_set)
00596                 hw->mac.ops.rar_set(hw, addr, index);
00597 }
00598 
00599 /**
00600  *  igb_validate_mdi_setting - Ensures valid MDI/MDIX SW state
00601  *  @hw: pointer to the HW structure
00602  *
00603  *  Ensures that the MDI/MDIX SW state is valid.
00604  **/
00605 s32 igb_validate_mdi_setting(struct e1000_hw *hw)
00606 {
00607         if (hw->mac.ops.validate_mdi_setting)
00608                 return hw->mac.ops.validate_mdi_setting(hw);
00609 
00610         return E1000_SUCCESS;
00611 }
00612 
00613 /**
00614  *  igb_mta_set - Sets multicast table bit
00615  *  @hw: pointer to the HW structure
00616  *  @hash_value: Multicast hash value.
00617  *
00618  *  This sets the bit in the multicast table corresponding to the
00619  *  hash value.  This is a function pointer entry point called by drivers.
00620  **/
00621 void igb_mta_set(struct e1000_hw *hw, u32 hash_value)
00622 {
00623         if (hw->mac.ops.mta_set)
00624                 hw->mac.ops.mta_set(hw, hash_value);
00625 }
00626 
00627 /**
00628  *  igb_hash_mc_addr - Determines address location in multicast table
00629  *  @hw: pointer to the HW structure
00630  *  @mc_addr: Multicast address to hash.
00631  *
00632  *  This hashes an address to determine its location in the multicast
00633  *  table. Currently no func pointer exists and all implementations
00634  *  are handled in the generic version of this function.
00635  **/
00636 u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
00637 {
00638         return igb_hash_mc_addr_generic(hw, mc_addr);
00639 }
00640 
00641 /**
00642  *  igb_enable_tx_pkt_filtering - Enable packet filtering on TX
00643  *  @hw: pointer to the HW structure
00644  *
00645  *  Enables packet filtering on transmit packets if manageability is enabled
00646  *  and host interface is enabled.
00647  *  Currently no func pointer exists and all implementations are handled in the
00648  *  generic version of this function.
00649  **/
00650 #if 0
00651 bool igb_enable_tx_pkt_filtering(struct e1000_hw *hw)
00652 {
00653         return igb_enable_tx_pkt_filtering_generic(hw);
00654 }
00655 #endif
00656 
00657 /**
00658  *  igb_mng_host_if_write - Writes to the manageability host interface
00659  *  @hw: pointer to the HW structure
00660  *  @buffer: pointer to the host interface buffer
00661  *  @length: size of the buffer
00662  *  @offset: location in the buffer to write to
00663  *  @sum: sum of the data (not checksum)
00664  *
00665  *  This function writes the buffer content at the offset given on the host if.
00666  *  It also does alignment considerations to do the writes in most efficient
00667  *  way.  Also fills up the sum of the buffer in *buffer parameter.
00668  **/
00669 s32 igb_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
00670                             u16 offset, u8 *sum)
00671 {
00672         if (hw->mac.ops.mng_host_if_write)
00673                 return hw->mac.ops.mng_host_if_write(hw, buffer, length,
00674                                                      offset, sum);
00675 
00676         return E1000_NOT_IMPLEMENTED;
00677 }
00678 
00679 /**
00680  *  igb_mng_write_cmd_header - Writes manageability command header
00681  *  @hw: pointer to the HW structure
00682  *  @hdr: pointer to the host interface command header
00683  *
00684  *  Writes the command header after does the checksum calculation.
00685  **/
00686 s32 igb_mng_write_cmd_header(struct e1000_hw *hw,
00687                                struct e1000_host_mng_command_header *hdr)
00688 {
00689         if (hw->mac.ops.mng_write_cmd_header)
00690                 return hw->mac.ops.mng_write_cmd_header(hw, hdr);
00691 
00692         return E1000_NOT_IMPLEMENTED;
00693 }
00694 
00695 /**
00696  *  igb_mng_enable_host_if - Checks host interface is enabled
00697  *  @hw: pointer to the HW structure
00698  *
00699  *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
00700  *
00701  *  This function checks whether the HOST IF is enabled for command operation
00702  *  and also checks whether the previous command is completed.  It busy waits
00703  *  in case of previous command is not completed.
00704  **/
00705 s32 igb_mng_enable_host_if(struct e1000_hw * hw)
00706 {
00707         if (hw->mac.ops.mng_enable_host_if)
00708                 return hw->mac.ops.mng_enable_host_if(hw);
00709 
00710         return E1000_NOT_IMPLEMENTED;
00711 }
00712 
00713 /**
00714  *  igb_wait_autoneg - Waits for autonegotiation completion
00715  *  @hw: pointer to the HW structure
00716  *
00717  *  Waits for autoneg to complete. Currently no func pointer exists and all
00718  *  implementations are handled in the generic version of this function.
00719  **/
00720 s32 igb_wait_autoneg(struct e1000_hw *hw)
00721 {
00722         if (hw->mac.ops.wait_autoneg)
00723                 return hw->mac.ops.wait_autoneg(hw);
00724 
00725         return E1000_SUCCESS;
00726 }
00727 
00728 /**
00729  *  igb_check_reset_block - Verifies PHY can be reset
00730  *  @hw: pointer to the HW structure
00731  *
00732  *  Checks if the PHY is in a state that can be reset or if manageability
00733  *  has it tied up. This is a function pointer entry point called by drivers.
00734  **/
00735 s32 igb_check_reset_block(struct e1000_hw *hw)
00736 {
00737         if (hw->phy.ops.check_reset_block)
00738                 return hw->phy.ops.check_reset_block(hw);
00739 
00740         return E1000_SUCCESS;
00741 }
00742 
00743 /**
00744  *  igb_read_phy_reg - Reads PHY register
00745  *  @hw: pointer to the HW structure
00746  *  @offset: the register to read
00747  *  @data: the buffer to store the 16-bit read.
00748  *
00749  *  Reads the PHY register and returns the value in data.
00750  *  This is a function pointer entry point called by drivers.
00751  **/
00752 s32 igb_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
00753 {
00754         if (hw->phy.ops.read_reg)
00755                 return hw->phy.ops.read_reg(hw, offset, data);
00756 
00757         return E1000_SUCCESS;
00758 }
00759 
00760 /**
00761  *  igb_write_phy_reg - Writes PHY register
00762  *  @hw: pointer to the HW structure
00763  *  @offset: the register to write
00764  *  @data: the value to write.
00765  *
00766  *  Writes the PHY register at offset with the value in data.
00767  *  This is a function pointer entry point called by drivers.
00768  **/
00769 s32 igb_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
00770 {
00771         if (hw->phy.ops.write_reg)
00772                 return hw->phy.ops.write_reg(hw, offset, data);
00773 
00774         return E1000_SUCCESS;
00775 }
00776 
00777 /**
00778  *  igb_release_phy - Generic release PHY
00779  *  @hw: pointer to the HW structure
00780  *
00781  *  Return if silicon family does not require a semaphore when accessing the
00782  *  PHY.
00783  **/
00784 void igb_release_phy(struct e1000_hw *hw)
00785 {
00786         if (hw->phy.ops.release)
00787                 hw->phy.ops.release(hw);
00788 }
00789 
00790 /**
00791  *  igb_acquire_phy - Generic acquire PHY
00792  *  @hw: pointer to the HW structure
00793  *
00794  *  Return success if silicon family does not require a semaphore when
00795  *  accessing the PHY.
00796  **/
00797 s32 igb_acquire_phy(struct e1000_hw *hw)
00798 {
00799         if (hw->phy.ops.acquire)
00800                 return hw->phy.ops.acquire(hw);
00801 
00802         return E1000_SUCCESS;
00803 }
00804 
00805 /**
00806  *  igb_read_kmrn_reg - Reads register using Kumeran interface
00807  *  @hw: pointer to the HW structure
00808  *  @offset: the register to read
00809  *  @data: the location to store the 16-bit value read.
00810  *
00811  *  Reads a register out of the Kumeran interface. Currently no func pointer
00812  *  exists and all implementations are handled in the generic version of
00813  *  this function.
00814  **/
00815 s32 igb_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
00816 {
00817         return igb_read_kmrn_reg_generic(hw, offset, data);
00818 }
00819 
00820 /**
00821  *  igb_write_kmrn_reg - Writes register using Kumeran interface
00822  *  @hw: pointer to the HW structure
00823  *  @offset: the register to write
00824  *  @data: the value to write.
00825  *
00826  *  Writes a register to the Kumeran interface. Currently no func pointer
00827  *  exists and all implementations are handled in the generic version of
00828  *  this function.
00829  **/
00830 s32 igb_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
00831 {
00832         return igb_write_kmrn_reg_generic(hw, offset, data);
00833 }
00834 
00835 #if 0
00836 /**
00837  *  igb_get_cable_length - Retrieves cable length estimation
00838  *  @hw: pointer to the HW structure
00839  *
00840  *  This function estimates the cable length and stores them in
00841  *  hw->phy.min_length and hw->phy.max_length. This is a function pointer
00842  *  entry point called by drivers.
00843  **/
00844 s32 igb_get_cable_length(struct e1000_hw *hw)
00845 {
00846         if (hw->phy.ops.get_cable_length)
00847                 return hw->phy.ops.get_cable_length(hw);
00848 
00849         return E1000_SUCCESS;
00850 }
00851 #endif
00852 
00853 /**
00854  *  igb_get_phy_info - Retrieves PHY information from registers
00855  *  @hw: pointer to the HW structure
00856  *
00857  *  This function gets some information from various PHY registers and
00858  *  populates hw->phy values with it. This is a function pointer entry
00859  *  point called by drivers.
00860  **/
00861 s32 igb_get_phy_info(struct e1000_hw *hw)
00862 {
00863         if (hw->phy.ops.get_info)
00864                 return hw->phy.ops.get_info(hw);
00865 
00866         return E1000_SUCCESS;
00867 }
00868 
00869 /**
00870  *  igb_phy_hw_reset - Hard PHY reset
00871  *  @hw: pointer to the HW structure
00872  *
00873  *  Performs a hard PHY reset. This is a function pointer entry point called
00874  *  by drivers.
00875  **/
00876 s32 igb_phy_hw_reset(struct e1000_hw *hw)
00877 {
00878         if (hw->phy.ops.reset)
00879                 return hw->phy.ops.reset(hw);
00880 
00881         return E1000_SUCCESS;
00882 }
00883 
00884 /**
00885  *  igb_phy_commit - Soft PHY reset
00886  *  @hw: pointer to the HW structure
00887  *
00888  *  Performs a soft PHY reset on those that apply. This is a function pointer
00889  *  entry point called by drivers.
00890  **/
00891 s32 igb_phy_commit(struct e1000_hw *hw)
00892 {
00893         if (hw->phy.ops.commit)
00894                 return hw->phy.ops.commit(hw);
00895 
00896         return E1000_SUCCESS;
00897 }
00898 
00899 /**
00900  *  igb_set_d0_lplu_state - Sets low power link up state for D0
00901  *  @hw: pointer to the HW structure
00902  *  @active: boolean used to enable/disable lplu
00903  *
00904  *  Success returns 0, Failure returns 1
00905  *
00906  *  The low power link up (lplu) state is set to the power management level D0
00907  *  and SmartSpeed is disabled when active is true, else clear lplu for D0
00908  *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
00909  *  is used during Dx states where the power conservation is most important.
00910  *  During driver activity, SmartSpeed should be enabled so performance is
00911  *  maintained.  This is a function pointer entry point called by drivers.
00912  **/
00913 s32 igb_set_d0_lplu_state(struct e1000_hw *hw, bool active)
00914 {
00915         if (hw->phy.ops.set_d0_lplu_state)
00916                 return hw->phy.ops.set_d0_lplu_state(hw, active);
00917 
00918         return E1000_SUCCESS;
00919 }
00920 
00921 /**
00922  *  igb_set_d3_lplu_state - Sets low power link up state for D3
00923  *  @hw: pointer to the HW structure
00924  *  @active: boolean used to enable/disable lplu
00925  *
00926  *  Success returns 0, Failure returns 1
00927  *
00928  *  The low power link up (lplu) state is set to the power management level D3
00929  *  and SmartSpeed is disabled when active is true, else clear lplu for D3
00930  *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
00931  *  is used during Dx states where the power conservation is most important.
00932  *  During driver activity, SmartSpeed should be enabled so performance is
00933  *  maintained.  This is a function pointer entry point called by drivers.
00934  **/
00935 s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
00936 {
00937         if (hw->phy.ops.set_d3_lplu_state)
00938                 return hw->phy.ops.set_d3_lplu_state(hw, active);
00939 
00940         return E1000_SUCCESS;
00941 }
00942 
00943 /**
00944  *  igb_read_mac_addr - Reads MAC address
00945  *  @hw: pointer to the HW structure
00946  *
00947  *  Reads the MAC address out of the adapter and stores it in the HW structure.
00948  *  Currently no func pointer exists and all implementations are handled in the
00949  *  generic version of this function.
00950  **/
00951 s32 igb_read_mac_addr(struct e1000_hw *hw)
00952 {
00953         if (hw->mac.ops.read_mac_addr)
00954                 return hw->mac.ops.read_mac_addr(hw);
00955 
00956         return igb_read_mac_addr_generic(hw);
00957 }
00958 
00959 /**
00960  *  igb_read_pba_num - Read device part number
00961  *  @hw: pointer to the HW structure
00962  *  @pba_num: pointer to device part number
00963  *
00964  *  Reads the product board assembly (PBA) number from the EEPROM and stores
00965  *  the value in pba_num.
00966  *  Currently no func pointer exists and all implementations are handled in the
00967  *  generic version of this function.
00968  **/
00969 s32 igb_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
00970 {
00971         return igb_read_pba_num_generic(hw, pba_num);
00972 }
00973 
00974 /**
00975  *  igb_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
00976  *  @hw: pointer to the HW structure
00977  *
00978  *  Validates the NVM checksum is correct. This is a function pointer entry
00979  *  point called by drivers.
00980  **/
00981 s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
00982 {
00983         if (hw->nvm.ops.validate)
00984                 return hw->nvm.ops.validate(hw);
00985 
00986         return -E1000_ERR_CONFIG;
00987 }
00988 
00989 /**
00990  *  igb_update_nvm_checksum - Updates NVM (EEPROM) checksum
00991  *  @hw: pointer to the HW structure
00992  *
00993  *  Updates the NVM checksum. Currently no func pointer exists and all
00994  *  implementations are handled in the generic version of this function.
00995  **/
00996 s32 igb_update_nvm_checksum(struct e1000_hw *hw)
00997 {
00998         if (hw->nvm.ops.update)
00999                 return hw->nvm.ops.update(hw);
01000 
01001         return -E1000_ERR_CONFIG;
01002 }
01003 
01004 /**
01005  *  igb_reload_nvm - Reloads EEPROM
01006  *  @hw: pointer to the HW structure
01007  *
01008  *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
01009  *  extended control register.
01010  **/
01011 void igb_reload_nvm(struct e1000_hw *hw)
01012 {
01013         if (hw->nvm.ops.reload)
01014                 hw->nvm.ops.reload(hw);
01015 }
01016 
01017 /**
01018  *  igb_read_nvm - Reads NVM (EEPROM)
01019  *  @hw: pointer to the HW structure
01020  *  @offset: the word offset to read
01021  *  @words: number of 16-bit words to read
01022  *  @data: pointer to the properly sized buffer for the data.
01023  *
01024  *  Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
01025  *  pointer entry point called by drivers.
01026  **/
01027 s32 igb_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
01028 {
01029         if (hw->nvm.ops.read)
01030                 return hw->nvm.ops.read(hw, offset, words, data);
01031 
01032         return -E1000_ERR_CONFIG;
01033 }
01034 
01035 /**
01036  *  igb_write_nvm - Writes to NVM (EEPROM)
01037  *  @hw: pointer to the HW structure
01038  *  @offset: the word offset to read
01039  *  @words: number of 16-bit words to write
01040  *  @data: pointer to the properly sized buffer for the data.
01041  *
01042  *  Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
01043  *  pointer entry point called by drivers.
01044  **/
01045 s32 igb_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
01046 {
01047         if (hw->nvm.ops.write)
01048                 return hw->nvm.ops.write(hw, offset, words, data);
01049 
01050         return E1000_SUCCESS;
01051 }
01052 
01053 /**
01054  *  igb_write_8bit_ctrl_reg - Writes 8bit Control register
01055  *  @hw: pointer to the HW structure
01056  *  @reg: 32bit register offset
01057  *  @offset: the register to write
01058  *  @data: the value to write.
01059  *
01060  *  Writes the PHY register at offset with the value in data.
01061  *  This is a function pointer entry point called by drivers.
01062  **/
01063 s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
01064                               u8 data)
01065 {
01066         return igb_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
01067 }
01068 
01069 /**
01070  * igb_power_up_phy - Restores link in case of PHY power down
01071  * @hw: pointer to the HW structure
01072  *
01073  * The phy may be powered down to save power, to turn off link when the
01074  * driver is unloaded, or wake on lan is not enabled (among others).
01075  **/
01076 void igb_power_up_phy(struct e1000_hw *hw)
01077 {
01078         if (hw->phy.ops.power_up)
01079                 hw->phy.ops.power_up(hw);
01080 
01081         igb_setup_link(hw);
01082 }
01083 
01084 /**
01085  * igb_power_down_phy - Power down PHY
01086  * @hw: pointer to the HW structure
01087  *
01088  * The phy may be powered down to save power, to turn off link when the
01089  * driver is unloaded, or wake on lan is not enabled (among others).
01090  **/
01091 void igb_power_down_phy(struct e1000_hw *hw)
01092 {
01093         if (hw->phy.ops.power_down)
01094                 hw->phy.ops.power_down(hw);
01095 }
01096 
01097 /**
01098  *  igb_shutdown_fiber_serdes_link - Remove link during power down
01099  *  @hw: pointer to the HW structure
01100  *
01101  *  Shutdown the optics and PCS on driver unload.
01102  **/
01103 void igb_shutdown_fiber_serdes_link(struct e1000_hw *hw)
01104 {
01105         if (hw->mac.ops.shutdown_serdes)
01106                 hw->mac.ops.shutdown_serdes(hw);
01107 }
01108 

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