e1000_api.c revision 185353
12702Swollman/****************************************************************************** 22702Swollman 369315Scharnier Copyright (c) 2001-2008, Intel Corporation 42702Swollman All rights reserved. 52702Swollman 62702Swollman Redistribution and use in source and binary forms, with or without 730829Scharnier modification, are permitted provided that the following conditions are met: 830829Scharnier 950479Speter 1. Redistributions of source code must retain the above copyright notice, 1030829Scharnier this list of conditions and the following disclaimer. 1130829Scharnier 122702Swollman 2. Redistributions in binary form must reproduce the above copyright 132702Swollman notice, this list of conditions and the following disclaimer in the 1430829Scharnier documentation and/or other materials provided with the distribution. 1530829Scharnier 169937Swollman 3. Neither the name of the Intel Corporation nor the names of its 179937Swollman contributors may be used to endorse or promote products derived from 189937Swollman this software without specific prior written permission. 192702Swollman 2017214Swollman THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2117214Swollman AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2217214Swollman IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2317214Swollman ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2469315Scharnier LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2517214Swollman CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2617214Swollman SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2717214Swollman INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2817214Swollman CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2917214Swollman ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3017214Swollman POSSIBILITY OF SUCH DAMAGE. 3117214Swollman 3217214Swollman******************************************************************************/ 332702Swollman/*$FreeBSD: head/sys/dev/e1000/e1000_api.c 185353 2008-11-26 23:57:23Z jfv $*/ 342702Swollman 352702Swollman#include "e1000_api.h" 362702Swollman 372702Swollman/** 382702Swollman * e1000_init_mac_params - Initialize MAC function pointers 392702Swollman * @hw: pointer to the HW structure 402702Swollman * 412702Swollman * This function initializes the function pointers for the MAC 422702Swollman * set of functions. Called by drivers or by e1000_setup_init_funcs. 432702Swollman **/ 442702Swollmans32 e1000_init_mac_params(struct e1000_hw *hw) 452702Swollman{ 462702Swollman s32 ret_val = E1000_SUCCESS; 472702Swollman 482702Swollman if (hw->mac.ops.init_params) { 492702Swollman ret_val = hw->mac.ops.init_params(hw); 502702Swollman if (ret_val) { 519937Swollman DEBUGOUT("MAC Initialization Error\n"); 529937Swollman goto out; 532702Swollman } 542702Swollman } else { 552702Swollman DEBUGOUT("mac.init_mac_params was NULL\n"); 562702Swollman ret_val = -E1000_ERR_CONFIG; 572702Swollman } 582702Swollman 592702Swollmanout: 602702Swollman return ret_val; 612702Swollman} 622702Swollman 632702Swollman/** 642702Swollman * e1000_init_nvm_params - Initialize NVM function pointers 652702Swollman * @hw: pointer to the HW structure 662702Swollman * 672702Swollman * This function initializes the function pointers for the NVM 682702Swollman * set of functions. Called by drivers or by e1000_setup_init_funcs. 692702Swollman **/ 702702Swollmans32 e1000_init_nvm_params(struct e1000_hw *hw) 712702Swollman{ 722702Swollman s32 ret_val = E1000_SUCCESS; 732702Swollman 742702Swollman if (hw->nvm.ops.init_params) { 752702Swollman ret_val = hw->nvm.ops.init_params(hw); 762702Swollman if (ret_val) { 772702Swollman DEBUGOUT("NVM Initialization Error\n"); 782702Swollman goto out; 792702Swollman } 802702Swollman } else { 812702Swollman DEBUGOUT("nvm.init_nvm_params was NULL\n"); 822702Swollman ret_val = -E1000_ERR_CONFIG; 832702Swollman } 842702Swollman 852702Swollmanout: 862702Swollman return ret_val; 872702Swollman} 889937Swollman 892702Swollman/** 902702Swollman * e1000_init_phy_params - Initialize PHY function pointers 912702Swollman * @hw: pointer to the HW structure 922702Swollman * 932702Swollman * This function initializes the function pointers for the PHY 942702Swollman * set of functions. Called by drivers or by e1000_setup_init_funcs. 959937Swollman **/ 969937Swollmans32 e1000_init_phy_params(struct e1000_hw *hw) 972702Swollman{ 982702Swollman s32 ret_val = E1000_SUCCESS; 992702Swollman 1002702Swollman if (hw->phy.ops.init_params) { 1012702Swollman ret_val = hw->phy.ops.init_params(hw); 1022702Swollman if (ret_val) { 1032702Swollman DEBUGOUT("PHY Initialization Error\n"); 1042702Swollman goto out; 1052702Swollman } 1062702Swollman } else { 1072702Swollman DEBUGOUT("phy.init_phy_params was NULL\n"); 1082702Swollman ret_val = -E1000_ERR_CONFIG; 1092702Swollman } 1102702Swollman 1112702Swollmanout: 1122702Swollman return ret_val; 1132702Swollman} 1142702Swollman 1152702Swollman/** 1162702Swollman * e1000_set_mac_type - Sets MAC type 1172702Swollman * @hw: pointer to the HW structure 1182702Swollman * 1192702Swollman * This function sets the mac type of the adapter based on the 1202702Swollman * device ID stored in the hw structure. 1219937Swollman * MUST BE FIRST FUNCTION CALLED (explicitly or through 1222702Swollman * e1000_setup_init_funcs()). 1232702Swollman **/ 1249937Swollmans32 e1000_set_mac_type(struct e1000_hw *hw) 1259937Swollman{ 1269937Swollman struct e1000_mac_info *mac = &hw->mac; 1272702Swollman s32 ret_val = E1000_SUCCESS; 12842997Swollman 12942997Swollman DEBUGFUNC("e1000_set_mac_type"); 1302702Swollman 1312702Swollman switch (hw->device_id) { 1322702Swollman case E1000_DEV_ID_82542: 1332702Swollman mac->type = e1000_82542; 1342702Swollman break; 13542997Swollman case E1000_DEV_ID_82543GC_FIBER: 13617214Swollman case E1000_DEV_ID_82543GC_COPPER: 13742997Swollman mac->type = e1000_82543; 13817214Swollman break; 1392702Swollman case E1000_DEV_ID_82544EI_COPPER: 1402702Swollman case E1000_DEV_ID_82544EI_FIBER: 1412702Swollman case E1000_DEV_ID_82544GC_COPPER: 1422702Swollman case E1000_DEV_ID_82544GC_LOM: 1432702Swollman mac->type = e1000_82544; 1442702Swollman break; 1452702Swollman case E1000_DEV_ID_82540EM: 14642997Swollman case E1000_DEV_ID_82540EM_LOM: 1472702Swollman case E1000_DEV_ID_82540EP: 1482702Swollman case E1000_DEV_ID_82540EP_LOM: 14942997Swollman case E1000_DEV_ID_82540EP_LP: 1502702Swollman mac->type = e1000_82540; 1512702Swollman break; 1522702Swollman case E1000_DEV_ID_82545EM_COPPER: 1532702Swollman case E1000_DEV_ID_82545EM_FIBER: 1542702Swollman mac->type = e1000_82545; 1552702Swollman break; 1562702Swollman case E1000_DEV_ID_82545GM_COPPER: 1572702Swollman case E1000_DEV_ID_82545GM_FIBER: 1582702Swollman case E1000_DEV_ID_82545GM_SERDES: 1592702Swollman mac->type = e1000_82545_rev_3; 1602702Swollman break; 1612702Swollman case E1000_DEV_ID_82546EB_COPPER: 1622702Swollman case E1000_DEV_ID_82546EB_FIBER: 1632702Swollman case E1000_DEV_ID_82546EB_QUAD_COPPER: 1642702Swollman mac->type = e1000_82546; 1652702Swollman break; 1662702Swollman case E1000_DEV_ID_82546GB_COPPER: 1672702Swollman case E1000_DEV_ID_82546GB_FIBER: 1682702Swollman case E1000_DEV_ID_82546GB_SERDES: 1692702Swollman case E1000_DEV_ID_82546GB_PCIE: 1702702Swollman case E1000_DEV_ID_82546GB_QUAD_COPPER: 1712702Swollman case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1722702Swollman mac->type = e1000_82546_rev_3; 1732702Swollman break; 1742702Swollman case E1000_DEV_ID_82541EI: 1752702Swollman case E1000_DEV_ID_82541EI_MOBILE: 1762702Swollman case E1000_DEV_ID_82541ER_LOM: 1772702Swollman mac->type = e1000_82541; 1782702Swollman break; 1792702Swollman case E1000_DEV_ID_82541ER: 1802702Swollman case E1000_DEV_ID_82541GI: 1812702Swollman case E1000_DEV_ID_82541GI_LF: 1822702Swollman case E1000_DEV_ID_82541GI_MOBILE: 1832702Swollman mac->type = e1000_82541_rev_2; 1842702Swollman break; 1852702Swollman case E1000_DEV_ID_82547EI: 1862702Swollman case E1000_DEV_ID_82547EI_MOBILE: 1872702Swollman mac->type = e1000_82547; 1882702Swollman break; 1892702Swollman case E1000_DEV_ID_82547GI: 1902702Swollman mac->type = e1000_82547_rev_2; 1912702Swollman break; 1922702Swollman case E1000_DEV_ID_82571EB_COPPER: 1932702Swollman case E1000_DEV_ID_82571EB_FIBER: 1942702Swollman case E1000_DEV_ID_82571EB_SERDES: 1952702Swollman case E1000_DEV_ID_82571EB_SERDES_DUAL: 1962702Swollman case E1000_DEV_ID_82571EB_SERDES_QUAD: 1972702Swollman case E1000_DEV_ID_82571EB_QUAD_COPPER: 1982702Swollman case E1000_DEV_ID_82571PT_QUAD_COPPER: 1992702Swollman case E1000_DEV_ID_82571EB_QUAD_FIBER: 2002702Swollman case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: 2012702Swollman mac->type = e1000_82571; 2022702Swollman break; 2032702Swollman case E1000_DEV_ID_82572EI: 2042702Swollman case E1000_DEV_ID_82572EI_COPPER: 2052702Swollman case E1000_DEV_ID_82572EI_FIBER: 2062702Swollman case E1000_DEV_ID_82572EI_SERDES: 2072702Swollman mac->type = e1000_82572; 2082702Swollman break; 2092702Swollman case E1000_DEV_ID_82573E: 2102702Swollman case E1000_DEV_ID_82573E_IAMT: 2112702Swollman case E1000_DEV_ID_82573L: 2122702Swollman mac->type = e1000_82573; 2132702Swollman break; 2142702Swollman case E1000_DEV_ID_82574L: 2152702Swollman mac->type = e1000_82574; 2162702Swollman break; 2172702Swollman case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: 2182702Swollman case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: 2192702Swollman case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: 2202702Swollman case E1000_DEV_ID_80003ES2LAN_SERDES_SPT: 2212702Swollman mac->type = e1000_80003es2lan; 2222702Swollman break; 2232702Swollman case E1000_DEV_ID_ICH8_IFE: 2242702Swollman case E1000_DEV_ID_ICH8_IFE_GT: 2252702Swollman case E1000_DEV_ID_ICH8_IFE_G: 2262702Swollman case E1000_DEV_ID_ICH8_IGP_M: 2272702Swollman case E1000_DEV_ID_ICH8_IGP_M_AMT: 2282702Swollman case E1000_DEV_ID_ICH8_IGP_AMT: 2292702Swollman case E1000_DEV_ID_ICH8_IGP_C: 2302702Swollman mac->type = e1000_ich8lan; 2312702Swollman break; 2322702Swollman case E1000_DEV_ID_ICH9_IFE: 2332702Swollman case E1000_DEV_ID_ICH9_IFE_GT: 2342702Swollman case E1000_DEV_ID_ICH9_IFE_G: 2352702Swollman case E1000_DEV_ID_ICH9_IGP_M: 2362702Swollman case E1000_DEV_ID_ICH9_IGP_M_AMT: 2372702Swollman case E1000_DEV_ID_ICH9_IGP_M_V: 2382702Swollman case E1000_DEV_ID_ICH9_IGP_AMT: 2392702Swollman case E1000_DEV_ID_ICH9_BM: 2402702Swollman case E1000_DEV_ID_ICH9_IGP_C: 2412702Swollman case E1000_DEV_ID_ICH10_R_BM_LM: 2422702Swollman case E1000_DEV_ID_ICH10_R_BM_LF: 2432702Swollman case E1000_DEV_ID_ICH10_R_BM_V: 2442702Swollman mac->type = e1000_ich9lan; 2452702Swollman break; 2462702Swollman case E1000_DEV_ID_ICH10_D_BM_LM: 2472702Swollman case E1000_DEV_ID_ICH10_D_BM_LF: 2482702Swollman mac->type = e1000_ich10lan; 2492702Swollman break; 2502702Swollman case E1000_DEV_ID_82575EB_COPPER: 2512702Swollman case E1000_DEV_ID_82575EB_FIBER_SERDES: 2522702Swollman case E1000_DEV_ID_82575GB_QUAD_COPPER: 2532702Swollman mac->type = e1000_82575; 2542702Swollman break; 2552702Swollman case E1000_DEV_ID_82576: 2562702Swollman case E1000_DEV_ID_82576_FIBER: 2572702Swollman case E1000_DEV_ID_82576_SERDES: 2582702Swollman case E1000_DEV_ID_82576_QUAD_COPPER: 2592702Swollman mac->type = e1000_82576; 2602702Swollman break; 2612702Swollman default: 2622702Swollman /* Should never have loaded on this device */ 2632702Swollman ret_val = -E1000_ERR_MAC_INIT; 2642702Swollman break; 2652702Swollman } 2662702Swollman 2672702Swollman return ret_val; 2682702Swollman} 2692702Swollman 2702702Swollman/** 2712702Swollman * e1000_setup_init_funcs - Initializes function pointers 2722702Swollman * @hw: pointer to the HW structure 2732702Swollman * @init_device: TRUE will initialize the rest of the function pointers 2742702Swollman * getting the device ready for use. FALSE will only set 2752702Swollman * MAC type and the function pointers for the other init 2762702Swollman * functions. Passing FALSE will not generate any hardware 2772702Swollman * reads or writes. 2782702Swollman * 2792702Swollman * This function must be called by a driver in order to use the rest 2802702Swollman * of the 'shared' code files. Called by drivers only. 2812702Swollman **/ 2822702Swollmans32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) 2832702Swollman{ 2842702Swollman s32 ret_val; 2852702Swollman 2862702Swollman /* Can't do much good without knowing the MAC type. */ 2872702Swollman ret_val = e1000_set_mac_type(hw); 2882702Swollman if (ret_val) { 2892702Swollman DEBUGOUT("ERROR: MAC type could not be set properly.\n"); 2902702Swollman goto out; 2912702Swollman } 2922702Swollman 2932702Swollman if (!hw->hw_addr) { 2942702Swollman DEBUGOUT("ERROR: Registers not mapped\n"); 2952702Swollman ret_val = -E1000_ERR_CONFIG; 2962702Swollman goto out; 2972702Swollman } 2982702Swollman 2992702Swollman /* 3002702Swollman * Init function pointers to generic implementations. We do this first 3012702Swollman * allowing a driver module to override it afterward. 3022702Swollman */ 3032702Swollman e1000_init_mac_ops_generic(hw); 3042702Swollman e1000_init_phy_ops_generic(hw); 3052702Swollman e1000_init_nvm_ops_generic(hw); 3062702Swollman 3072702Swollman /* 3082702Swollman * Set up the init function pointers. These are functions within the 3092702Swollman * adapter family file that sets up function pointers for the rest of 3102702Swollman * the functions in that family. 3112702Swollman */ 3122702Swollman switch (hw->mac.type) { 3132702Swollman case e1000_82542: 3142702Swollman e1000_init_function_pointers_82542(hw); 3152702Swollman break; 3162702Swollman case e1000_82543: 3172702Swollman case e1000_82544: 3182702Swollman e1000_init_function_pointers_82543(hw); 3192702Swollman break; 3202702Swollman case e1000_82540: 3212702Swollman case e1000_82545: 3222702Swollman case e1000_82545_rev_3: 3232702Swollman case e1000_82546: 3242702Swollman case e1000_82546_rev_3: 3252702Swollman e1000_init_function_pointers_82540(hw); 3262702Swollman break; 3272702Swollman case e1000_82541: 3282702Swollman case e1000_82541_rev_2: 3292702Swollman case e1000_82547: 3302702Swollman case e1000_82547_rev_2: 3312702Swollman e1000_init_function_pointers_82541(hw); 3322702Swollman break; 3332702Swollman case e1000_82571: 3342702Swollman case e1000_82572: 33517214Swollman case e1000_82573: 33617214Swollman case e1000_82574: 33717214Swollman e1000_init_function_pointers_82571(hw); 33817214Swollman break; 3392702Swollman case e1000_80003es2lan: 3402702Swollman e1000_init_function_pointers_80003es2lan(hw); 3412702Swollman break; 3422702Swollman case e1000_ich8lan: 3439937Swollman case e1000_ich9lan: 3442702Swollman case e1000_ich10lan: 3452702Swollman e1000_init_function_pointers_ich8lan(hw); 3462702Swollman break; 3472702Swollman case e1000_82575: 3482702Swollman case e1000_82576: 3492702Swollman e1000_init_function_pointers_82575(hw); 3502702Swollman break; 3512702Swollman default: 3522702Swollman DEBUGOUT("Hardware not supported\n"); 3532702Swollman ret_val = -E1000_ERR_CONFIG; 3542702Swollman break; 3552702Swollman } 3562702Swollman 35730829Scharnier /* 35830829Scharnier * Initialize the rest of the function pointers. These require some 3592702Swollman * register reads/writes in some cases. 3602702Swollman */ 3612702Swollman if (!(ret_val) && init_device) { 3622702Swollman ret_val = e1000_init_mac_params(hw); 3639937Swollman if (ret_val) 3642702Swollman goto out; 3659937Swollman 3662702Swollman ret_val = e1000_init_nvm_params(hw); 3672702Swollman if (ret_val) 3682702Swollman goto out; 3692702Swollman 3702702Swollman ret_val = e1000_init_phy_params(hw); 37142997Swollman if (ret_val) 37217214Swollman goto out; 37317214Swollman 37417214Swollman } 37517214Swollman 37642997Swollmanout: 37742997Swollman return ret_val; 37817214Swollman} 37942997Swollman 38042997Swollman/** 38117214Swollman * e1000_get_bus_info - Obtain bus information for adapter 38242997Swollman * @hw: pointer to the HW structure 38317214Swollman * 3842702Swollman * This will obtain information about the HW bus for which the 3852702Swollman * adapter is attached and stores it in the hw structure. This is a 3862702Swollman * function pointer entry point called by drivers. 3872702Swollman **/ 3882702Swollmans32 e1000_get_bus_info(struct e1000_hw *hw) 3892702Swollman{ 3902702Swollman if (hw->mac.ops.get_bus_info) 3912702Swollman return hw->mac.ops.get_bus_info(hw); 3922702Swollman 3932702Swollman return E1000_SUCCESS; 3942702Swollman} 3952702Swollman 3962702Swollman/** 3972702Swollman * e1000_clear_vfta - Clear VLAN filter table 3982702Swollman * @hw: pointer to the HW structure 3992702Swollman * 4002702Swollman * This clears the VLAN filter table on the adapter. This is a function 4012702Swollman * pointer entry point called by drivers. 4022702Swollman **/ 4032702Swollmanvoid e1000_clear_vfta(struct e1000_hw *hw) 4042702Swollman{ 4052702Swollman if (hw->mac.ops.clear_vfta) 4062702Swollman hw->mac.ops.clear_vfta(hw); 4072702Swollman} 4082702Swollman 4092702Swollman/** 4102702Swollman * e1000_write_vfta - Write value to VLAN filter table 4119937Swollman * @hw: pointer to the HW structure 4122702Swollman * @offset: the 32-bit offset in which to write the value to. 4132702Swollman * @value: the 32-bit value to write at location offset. 41417214Swollman * 4152702Swollman * This writes a 32-bit value to a 32-bit offset in the VLAN filter 4162702Swollman * table. This is a function pointer entry point called by drivers. 41717214Swollman **/ 4182702Swollmanvoid e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) 4192702Swollman{ 4202702Swollman if (hw->mac.ops.write_vfta) 4212702Swollman hw->mac.ops.write_vfta(hw, offset, value); 4222702Swollman} 4232702Swollman 42417214Swollman/** 42517214Swollman * e1000_update_mc_addr_list - Update Multicast addresses 42617214Swollman * @hw: pointer to the HW structure 42717214Swollman * @mc_addr_list: array of multicast addresses to program 42817214Swollman * @mc_addr_count: number of multicast addresses to program 42942997Swollman * @rar_used_count: the first RAR register free to program 43017214Swollman * @rar_count: total number of supported Receive Address Registers 43142997Swollman * 43217214Swollman * Updates the Receive Address Registers and Multicast Table Array. 43317214Swollman * The caller must have a packed mc_addr_list of multicast addresses. 43417214Swollman * The parameter rar_count will usually be hw->mac.rar_entry_count 43517214Swollman * unless there are workarounds that change this. Currently no func pointer 43617214Swollman * exists and all implementations are handled in the generic version of this 4379937Swollman * function. 4382702Swollman **/ 43930829Scharniervoid e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, 44030829Scharnier u32 mc_addr_count, u32 rar_used_count, 44130829Scharnier u32 rar_count) 4422702Swollman{ 4432702Swollman if (hw->mac.ops.update_mc_addr_list) 4442702Swollman hw->mac.ops.update_mc_addr_list(hw, 4452702Swollman mc_addr_list, 4462702Swollman mc_addr_count, 4472702Swollman rar_used_count, 4482702Swollman rar_count); 4492702Swollman} 4502702Swollman 45142997Swollman/** 45243006Swollman * e1000_force_mac_fc - Force MAC flow control 45342997Swollman * @hw: pointer to the HW structure 45442997Swollman * 45542997Swollman * Force the MAC's flow control settings. Currently no func pointer exists 4562702Swollman * and all implementations are handled in the generic version of this 4572702Swollman * function. 4582702Swollman **/ 4592702Swollmans32 e1000_force_mac_fc(struct e1000_hw *hw) 4602702Swollman{ 4612702Swollman return e1000_force_mac_fc_generic(hw); 4629937Swollman} 4639937Swollman 4642702Swollman/** 4652702Swollman * e1000_check_for_link - Check/Store link connection 4662702Swollman * @hw: pointer to the HW structure 4679937Swollman * 4682702Swollman * This checks the link condition of the adapter and stores the 46917214Swollman * results in the hw->mac structure. This is a function pointer entry 47017214Swollman * point called by drivers. 47117214Swollman **/ 47217214Swollmans32 e1000_check_for_link(struct e1000_hw *hw) 47317214Swollman{ 47417214Swollman if (hw->mac.ops.check_for_link) 47517214Swollman return hw->mac.ops.check_for_link(hw); 47642997Swollman 4772702Swollman return -E1000_ERR_CONFIG; 4782702Swollman} 4792702Swollman 48042997Swollman/** 48142997Swollman * e1000_check_mng_mode - Check management mode 48242997Swollman * @hw: pointer to the HW structure 4832702Swollman * 4842702Swollman * This checks if the adapter has manageability enabled. 4852702Swollman * This is a function pointer entry point called by drivers. 48630829Scharnier **/ 48730829Scharnierbool e1000_check_mng_mode(struct e1000_hw *hw) 48830829Scharnier{ 4892702Swollman if (hw->mac.ops.check_mng_mode) 49042997Swollman return hw->mac.ops.check_mng_mode(hw); 49142997Swollman 49242997Swollman return FALSE; 4932702Swollman} 4942702Swollman 4952702Swollman/** 49630829Scharnier * e1000_mng_write_dhcp_info - Writes DHCP info to host interface 49730829Scharnier * @hw: pointer to the HW structure 49830829Scharnier * @buffer: pointer to the host interface 4992702Swollman * @length: size of the buffer 50042997Swollman * 50142997Swollman * Writes the DHCP information to the host interface. 50242997Swollman **/ 50342997Swollmans32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length) 50442997Swollman{ 50542997Swollman return e1000_mng_write_dhcp_info_generic(hw, buffer, length); 5062702Swollman} 5072702Swollman 5082702Swollman/** 50930829Scharnier * e1000_reset_hw - Reset hardware 51030829Scharnier * @hw: pointer to the HW structure 51130829Scharnier * 5122702Swollman * This resets the hardware into a known state. This is a function pointer 51342997Swollman * entry point called by drivers. 51442997Swollman **/ 51542997Swollmans32 e1000_reset_hw(struct e1000_hw *hw) 5162702Swollman{ 5172702Swollman if (hw->mac.ops.reset_hw) 5182702Swollman return hw->mac.ops.reset_hw(hw); 51930829Scharnier 52030829Scharnier return -E1000_ERR_CONFIG; 52130829Scharnier} 5222702Swollman 5232702Swollman/** 5242702Swollman * e1000_init_hw - Initialize hardware 5252702Swollman * @hw: pointer to the HW structure 52630829Scharnier * 52730829Scharnier * This inits the hardware readying it for operation. This is a function 52830829Scharnier * pointer entry point called by drivers. 5292702Swollman **/ 5302702Swollmans32 e1000_init_hw(struct e1000_hw *hw) 5312702Swollman{ 5322702Swollman if (hw->mac.ops.init_hw) 5332702Swollman return hw->mac.ops.init_hw(hw); 5342702Swollman 5352702Swollman return -E1000_ERR_CONFIG; 5362702Swollman} 5372702Swollman 5382702Swollman/** 5392702Swollman * e1000_setup_link - Configures link and flow control 5402702Swollman * @hw: pointer to the HW structure 5412702Swollman * 5422702Swollman * This configures link and flow control settings for the adapter. This 5432702Swollman * is a function pointer entry point called by drivers. While modules can 5442702Swollman * also call this, they probably call their own version of this function. 5452702Swollman **/ 5462702Swollmans32 e1000_setup_link(struct e1000_hw *hw) 5472702Swollman{ 5482702Swollman if (hw->mac.ops.setup_link) 5492702Swollman return hw->mac.ops.setup_link(hw); 5502702Swollman 5512702Swollman return -E1000_ERR_CONFIG; 5522702Swollman} 5532702Swollman 5542702Swollman/** 5552702Swollman * e1000_get_speed_and_duplex - Returns current speed and duplex 5562702Swollman * @hw: pointer to the HW structure 5572702Swollman * @speed: pointer to a 16-bit value to store the speed 5582702Swollman * @duplex: pointer to a 16-bit value to store the duplex. 5592702Swollman * 5602702Swollman * This returns the speed and duplex of the adapter in the two 'out' 5612702Swollman * variables passed in. This is a function pointer entry point called 5622702Swollman * by drivers. 5632702Swollman **/ 5642702Swollmans32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) 5652702Swollman{ 5662702Swollman if (hw->mac.ops.get_link_up_info) 5672702Swollman return hw->mac.ops.get_link_up_info(hw, speed, duplex); 5682702Swollman 5692702Swollman return -E1000_ERR_CONFIG; 5702702Swollman} 5712702Swollman 5722702Swollman/** 5732702Swollman * e1000_setup_led - Configures SW controllable LED 5742702Swollman * @hw: pointer to the HW structure 5752702Swollman * 5762702Swollman * This prepares the SW controllable LED for use and saves the current state 5772702Swollman * of the LED so it can be later restored. This is a function pointer entry 5782702Swollman * point called by drivers. 5792702Swollman **/ 5802702Swollmans32 e1000_setup_led(struct e1000_hw *hw) 5812702Swollman{ 5822702Swollman if (hw->mac.ops.setup_led) 5832702Swollman return hw->mac.ops.setup_led(hw); 5842702Swollman 5859937Swollman return E1000_SUCCESS; 5862702Swollman} 5872702Swollman 5882702Swollman/** 5892702Swollman * e1000_cleanup_led - Restores SW controllable LED 5902702Swollman * @hw: pointer to the HW structure 5912702Swollman * 5929937Swollman * This restores the SW controllable LED to the value saved off by 5932702Swollman * e1000_setup_led. This is a function pointer entry point called by drivers. 5942702Swollman **/ 5952702Swollmans32 e1000_cleanup_led(struct e1000_hw *hw) 5962702Swollman{ 5972702Swollman if (hw->mac.ops.cleanup_led) 5982702Swollman return hw->mac.ops.cleanup_led(hw); 5992702Swollman 6002702Swollman return E1000_SUCCESS; 6012702Swollman} 6022702Swollman 6032702Swollman/** 6042702Swollman * e1000_blink_led - Blink SW controllable LED 60542997Swollman * @hw: pointer to the HW structure 60642997Swollman * 6072702Swollman * This starts the adapter LED blinking. Request the LED to be setup first 6082702Swollman * and cleaned up after. This is a function pointer entry point called by 60942997Swollman * drivers. 61042997Swollman **/ 61142997Swollmans32 e1000_blink_led(struct e1000_hw *hw) 61242997Swollman{ 61342997Swollman if (hw->mac.ops.blink_led) 61442997Swollman return hw->mac.ops.blink_led(hw); 61542997Swollman 61642997Swollman return E1000_SUCCESS; 61742997Swollman} 61843774Swollman 61942997Swollman/** 62042997Swollman * e1000_led_on - Turn on SW controllable LED 6212702Swollman * @hw: pointer to the HW structure 6229937Swollman * 6239937Swollman * Turns the SW defined LED on. This is a function pointer entry point 6242702Swollman * called by drivers. 6252702Swollman **/ 62617214Swollmans32 e1000_led_on(struct e1000_hw *hw) 62717214Swollman{ 62817214Swollman if (hw->mac.ops.led_on) 62917214Swollman return hw->mac.ops.led_on(hw); 63017214Swollman 63117214Swollman return E1000_SUCCESS; 63217214Swollman} 63317214Swollman 63417214Swollman/** 63517214Swollman * e1000_led_off - Turn off SW controllable LED 63617214Swollman * @hw: pointer to the HW structure 63717214Swollman * 63817214Swollman * Turns the SW defined LED off. This is a function pointer entry point 63917214Swollman * called by drivers. 64017214Swollman **/ 64117214Swollmans32 e1000_led_off(struct e1000_hw *hw) 64217214Swollman{ 64317214Swollman if (hw->mac.ops.led_off) 6442702Swollman return hw->mac.ops.led_off(hw); 6459937Swollman 6462702Swollman return E1000_SUCCESS; 64717214Swollman} 64817214Swollman 64917214Swollman/** 65017214Swollman * e1000_reset_adaptive - Reset adaptive IFS 6512702Swollman * @hw: pointer to the HW structure 65217214Swollman * 6532702Swollman * Resets the adaptive IFS. Currently no func pointer exists and all 65417214Swollman * implementations are handled in the generic version of this function. 65517214Swollman **/ 65617214Swollmanvoid e1000_reset_adaptive(struct e1000_hw *hw) 65717214Swollman{ 6582702Swollman e1000_reset_adaptive_generic(hw); 6592702Swollman} 6602702Swollman 66142997Swollman/** 66242997Swollman * e1000_update_adaptive - Update adaptive IFS 6632702Swollman * @hw: pointer to the HW structure 6642702Swollman * 6652702Swollman * Updates adapter IFS. Currently no func pointer exists and all 6662702Swollman * implementations are handled in the generic version of this function. 6672702Swollman **/ 6682702Swollmanvoid e1000_update_adaptive(struct e1000_hw *hw) 6692702Swollman{ 6702702Swollman e1000_update_adaptive_generic(hw); 6712702Swollman} 6722702Swollman 6732702Swollman/** 6749937Swollman * e1000_disable_pcie_master - Disable PCI-Express master access 6752702Swollman * @hw: pointer to the HW structure 6762702Swollman * 6772702Swollman * Disables PCI-Express master access and verifies there are no pending 6782702Swollman * requests. Currently no func pointer exists and all implementations are 6792702Swollman * handled in the generic version of this function. 6802702Swollman **/ 6812702Swollmans32 e1000_disable_pcie_master(struct e1000_hw *hw) 6822702Swollman{ 6832702Swollman return e1000_disable_pcie_master_generic(hw); 6842702Swollman} 6852702Swollman 6862702Swollman/** 6872702Swollman * e1000_config_collision_dist - Configure collision distance 6882702Swollman * @hw: pointer to the HW structure 6899937Swollman * 6909937Swollman * Configures the collision distance to the default value and is used 6912702Swollman * during link setup. 6929937Swollman **/ 6939937Swollmanvoid e1000_config_collision_dist(struct e1000_hw *hw) 6942702Swollman{ 6952702Swollman if (hw->mac.ops.config_collision_dist) 6962702Swollman hw->mac.ops.config_collision_dist(hw); 6979937Swollman} 6982702Swollman 6992702Swollman/** 7002702Swollman * e1000_rar_set - Sets a receive address register 7012702Swollman * @hw: pointer to the HW structure 70217214Swollman * @addr: address to set the RAR to 7032702Swollman * @index: the RAR to set 70417214Swollman * 7059937Swollman * Sets a Receive Address Register (RAR) to the specified address. 7069937Swollman **/ 70717214Swollmanvoid e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) 70817214Swollman{ 70917214Swollman if (hw->mac.ops.rar_set) 71017214Swollman hw->mac.ops.rar_set(hw, addr, index); 71117214Swollman} 71217214Swollman 71317214Swollman/** 71417214Swollman * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state 71517214Swollman * @hw: pointer to the HW structure 71617214Swollman * 71717214Swollman * Ensures that the MDI/MDIX SW state is valid. 71817214Swollman **/ 71917214Swollmans32 e1000_validate_mdi_setting(struct e1000_hw *hw) 72017214Swollman{ 72117214Swollman if (hw->mac.ops.validate_mdi_setting) 72217214Swollman return hw->mac.ops.validate_mdi_setting(hw); 72317214Swollman 72417214Swollman return E1000_SUCCESS; 72517214Swollman} 72617214Swollman 72717214Swollman/** 72817214Swollman * e1000_mta_set - Sets multicast table bit 72917214Swollman * @hw: pointer to the HW structure 73017214Swollman * @hash_value: Multicast hash value. 73117214Swollman * 73217214Swollman * This sets the bit in the multicast table corresponding to the 7332702Swollman * hash value. This is a function pointer entry point called by drivers. 7342702Swollman **/ 7352702Swollmanvoid e1000_mta_set(struct e1000_hw *hw, u32 hash_value) 7362702Swollman{ 7372702Swollman if (hw->mac.ops.mta_set) 7382702Swollman hw->mac.ops.mta_set(hw, hash_value); 7392702Swollman} 7402702Swollman 7412702Swollman/** 7422702Swollman * e1000_hash_mc_addr - Determines address location in multicast table 7432702Swollman * @hw: pointer to the HW structure 7442702Swollman * @mc_addr: Multicast address to hash. 7452702Swollman * 7462702Swollman * This hashes an address to determine its location in the multicast 7472702Swollman * table. Currently no func pointer exists and all implementations 7482702Swollman * are handled in the generic version of this function. 7492702Swollman **/ 7502702Swollmanu32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) 7512702Swollman{ 7522702Swollman return e1000_hash_mc_addr_generic(hw, mc_addr); 7532702Swollman} 7542702Swollman 7552702Swollman/** 7562702Swollman * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX 7572702Swollman * @hw: pointer to the HW structure 75817214Swollman * 75917214Swollman * Enables packet filtering on transmit packets if manageability is enabled 7602702Swollman * and host interface is enabled. 7612702Swollman * Currently no func pointer exists and all implementations are handled in the 7622702Swollman * generic version of this function. 7632702Swollman **/ 7642702Swollmanbool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) 76517214Swollman{ 7662702Swollman return e1000_enable_tx_pkt_filtering_generic(hw); 7672702Swollman} 7682702Swollman 7692702Swollman/** 7702702Swollman * e1000_mng_host_if_write - Writes to the manageability host interface 7712702Swollman * @hw: pointer to the HW structure 7722702Swollman * @buffer: pointer to the host interface buffer 7732702Swollman * @length: size of the buffer 7742702Swollman * @offset: location in the buffer to write to 7752702Swollman * @sum: sum of the data (not checksum) 7762702Swollman * 7772702Swollman * This function writes the buffer content at the offset given on the host if. 7782702Swollman * It also does alignment considerations to do the writes in most efficient 7792702Swollman * way. Also fills up the sum of the buffer in *buffer parameter. 7802702Swollman **/ 7812702Swollmans32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length, 7822702Swollman u16 offset, u8 *sum) 7832702Swollman{ 7842702Swollman if (hw->mac.ops.mng_host_if_write) 7852702Swollman return hw->mac.ops.mng_host_if_write(hw, buffer, length, 78617214Swollman offset, sum); 7872702Swollman 78830829Scharnier return E1000_NOT_IMPLEMENTED; 78930829Scharnier} 7902702Swollman 7912702Swollman/** 7922702Swollman * e1000_mng_write_cmd_header - Writes manageability command header 7932702Swollman * @hw: pointer to the HW structure 7942702Swollman * @hdr: pointer to the host interface command header 7952702Swollman * 7962702Swollman * Writes the command header after does the checksum calculation. 79717214Swollman **/ 7982702Swollmans32 e1000_mng_write_cmd_header(struct e1000_hw *hw, 7992702Swollman struct e1000_host_mng_command_header *hdr) 8002702Swollman{ 8012702Swollman if (hw->mac.ops.mng_write_cmd_header) 8022702Swollman return hw->mac.ops.mng_write_cmd_header(hw, hdr); 8032702Swollman 8049937Swollman return E1000_NOT_IMPLEMENTED; 8052702Swollman} 80617214Swollman 8079937Swollman/** 8082702Swollman * e1000_mng_enable_host_if - Checks host interface is enabled 8092702Swollman * @hw: pointer to the HW structure 8102702Swollman * 8112702Swollman * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 8122702Swollman * 8132702Swollman * This function checks whether the HOST IF is enabled for command operation 8142702Swollman * and also checks whether the previous command is completed. It busy waits 8152702Swollman * in case of previous command is not completed. 8162702Swollman **/ 81717214Swollmans32 e1000_mng_enable_host_if(struct e1000_hw * hw) 8182702Swollman{ 8192702Swollman if (hw->mac.ops.mng_enable_host_if) 8202702Swollman return hw->mac.ops.mng_enable_host_if(hw); 8212702Swollman 8222702Swollman return E1000_NOT_IMPLEMENTED; 8232702Swollman} 8242702Swollman 8252702Swollman/** 8262702Swollman * e1000_wait_autoneg - Waits for autonegotiation completion 8272702Swollman * @hw: pointer to the HW structure 8282702Swollman * 8292702Swollman * Waits for autoneg to complete. Currently no func pointer exists and all 8302702Swollman * implementations are handled in the generic version of this function. 8312702Swollman **/ 83230829Scharniers32 e1000_wait_autoneg(struct e1000_hw *hw) 83330829Scharnier{ 8342702Swollman if (hw->mac.ops.wait_autoneg) 8352702Swollman return hw->mac.ops.wait_autoneg(hw); 8362702Swollman 8372702Swollman return E1000_SUCCESS; 83830829Scharnier} 83930829Scharnier 8402702Swollman/** 8412702Swollman * e1000_check_reset_block - Verifies PHY can be reset 8422702Swollman * @hw: pointer to the HW structure 8432702Swollman * 84430829Scharnier * Checks if the PHY is in a state that can be reset or if manageability 84530829Scharnier * has it tied up. This is a function pointer entry point called by drivers. 84630829Scharnier **/ 84730829Scharniers32 e1000_check_reset_block(struct e1000_hw *hw) 8482702Swollman{ 84917214Swollman if (hw->phy.ops.check_reset_block) 8502702Swollman return hw->phy.ops.check_reset_block(hw); 8512702Swollman 8522702Swollman return E1000_SUCCESS; 8532702Swollman} 8549937Swollman 8552702Swollman/** 8562702Swollman * e1000_read_phy_reg - Reads PHY register 8572702Swollman * @hw: pointer to the HW structure 8582702Swollman * @offset: the register to read 8592702Swollman * @data: the buffer to store the 16-bit read. 8602702Swollman * 8612702Swollman * Reads the PHY register and returns the value in data. 8622702Swollman * This is a function pointer entry point called by drivers. 8632702Swollman **/ 8642702Swollmans32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data) 8652702Swollman{ 8662702Swollman if (hw->phy.ops.read_reg) 8672702Swollman return hw->phy.ops.read_reg(hw, offset, data); 8682702Swollman 8692702Swollman return E1000_SUCCESS; 8702702Swollman} 8712702Swollman 8722702Swollman/** 8732702Swollman * e1000_write_phy_reg - Writes PHY register 8742702Swollman * @hw: pointer to the HW structure 8752702Swollman * @offset: the register to write 8762702Swollman * @data: the value to write. 8772702Swollman * 8782702Swollman * Writes the PHY register at offset with the value in data. 8792702Swollman * This is a function pointer entry point called by drivers. 8802702Swollman **/ 8812702Swollmans32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data) 8822702Swollman{ 8832702Swollman if (hw->phy.ops.write_reg) 8842702Swollman return hw->phy.ops.write_reg(hw, offset, data); 88542997Swollman 8862702Swollman return E1000_SUCCESS; 88742997Swollman} 88842997Swollman 8892702Swollman/** 8902702Swollman * e1000_release_phy - Generic release PHY 8912702Swollman * @hw: pointer to the HW structure 8922702Swollman * 8932702Swollman * Return if silicon family does not require a semaphore when accessing the 8942702Swollman * PHY. 8952702Swollman **/ 8962702Swollmanvoid e1000_release_phy(struct e1000_hw *hw) 8972702Swollman{ 8982702Swollman if (hw->phy.ops.release) 8992702Swollman hw->phy.ops.release(hw); 9002702Swollman} 9012702Swollman 9022702Swollman/** 9032702Swollman * e1000_acquire_phy - Generic acquire PHY 9042702Swollman * @hw: pointer to the HW structure 90517214Swollman * 9062702Swollman * Return success if silicon family does not require a semaphore when 9072702Swollman * accessing the PHY. 9082702Swollman **/ 90917214Swollmans32 e1000_acquire_phy(struct e1000_hw *hw) 9102702Swollman{ 9112702Swollman if (hw->phy.ops.acquire) 9122702Swollman return hw->phy.ops.acquire(hw); 9132702Swollman 91417214Swollman return E1000_SUCCESS; 9152702Swollman} 9162702Swollman 9172702Swollman/** 9182702Swollman * e1000_cfg_on_link_up - Configure PHY upon link up 9199937Swollman * @hw: pointer to the HW structure 9202702Swollman **/ 9212702Swollmans32 e1000_cfg_on_link_up(struct e1000_hw *hw) 9222702Swollman{ 9232702Swollman if (hw->phy.ops.cfg_on_link_up) 9242702Swollman return hw->phy.ops.cfg_on_link_up(hw); 9252702Swollman 9262702Swollman return E1000_SUCCESS; 9272702Swollman} 9282702Swollman 9292702Swollman/** 9302702Swollman * e1000_read_kmrn_reg - Reads register using Kumeran interface 9312702Swollman * @hw: pointer to the HW structure 9322702Swollman * @offset: the register to read 93317214Swollman * @data: the location to store the 16-bit value read. 9342702Swollman * 9352702Swollman * Reads a register out of the Kumeran interface. Currently no func pointer 9362702Swollman * exists and all implementations are handled in the generic version of 9379937Swollman * this function. 9382702Swollman **/ 93917214Swollmans32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) 9402702Swollman{ 9412702Swollman return e1000_read_kmrn_reg_generic(hw, offset, data); 9422702Swollman} 9432702Swollman 9442702Swollman/** 9459937Swollman * e1000_write_kmrn_reg - Writes register using Kumeran interface 9462702Swollman * @hw: pointer to the HW structure 94717214Swollman * @offset: the register to write 9482702Swollman * @data: the value to write. 9492702Swollman * 9502702Swollman * Writes a register to the Kumeran interface. Currently no func pointer 9512702Swollman * exists and all implementations are handled in the generic version of 9522702Swollman * this function. 9532702Swollman **/ 9542702Swollmans32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) 9559937Swollman{ 9562702Swollman return e1000_write_kmrn_reg_generic(hw, offset, data); 9579937Swollman} 9582702Swollman 95917214Swollman/** 9602702Swollman * e1000_get_cable_length - Retrieves cable length estimation 9612702Swollman * @hw: pointer to the HW structure 9622702Swollman * 9632702Swollman * This function estimates the cable length and stores them in 9642702Swollman * hw->phy.min_length and hw->phy.max_length. This is a function pointer 9652702Swollman * entry point called by drivers. 9662702Swollman **/ 9672702Swollmans32 e1000_get_cable_length(struct e1000_hw *hw) 9682702Swollman{ 9692702Swollman if (hw->phy.ops.get_cable_length) 9702702Swollman return hw->phy.ops.get_cable_length(hw); 9712702Swollman 9722702Swollman return E1000_SUCCESS; 9732702Swollman} 9742702Swollman 97517214Swollman/** 9762702Swollman * e1000_get_phy_info - Retrieves PHY information from registers 9772702Swollman * @hw: pointer to the HW structure 9782702Swollman * 9792702Swollman * This function gets some information from various PHY registers and 9802702Swollman * populates hw->phy values with it. This is a function pointer entry 9812702Swollman * point called by drivers. 9822702Swollman **/ 9832702Swollmans32 e1000_get_phy_info(struct e1000_hw *hw) 9842702Swollman{ 9852702Swollman if (hw->phy.ops.get_info) 9862702Swollman return hw->phy.ops.get_info(hw); 9872702Swollman 9882702Swollman return E1000_SUCCESS; 9892702Swollman} 9902702Swollman 9912702Swollman/** 9922702Swollman * e1000_phy_hw_reset - Hard PHY reset 9932702Swollman * @hw: pointer to the HW structure 9942702Swollman * 9952702Swollman * Performs a hard PHY reset. This is a function pointer entry point called 9962702Swollman * by drivers. 9972702Swollman **/ 9982702Swollmans32 e1000_phy_hw_reset(struct e1000_hw *hw) 9992702Swollman{ 10002702Swollman if (hw->phy.ops.reset) 10012702Swollman return hw->phy.ops.reset(hw); 10022702Swollman 10032702Swollman return E1000_SUCCESS; 10042702Swollman} 10052702Swollman 10062702Swollman/** 10072702Swollman * e1000_phy_commit - Soft PHY reset 10082702Swollman * @hw: pointer to the HW structure 10092702Swollman * 10102702Swollman * Performs a soft PHY reset on those that apply. This is a function pointer 10112702Swollman * entry point called by drivers. 10122702Swollman **/ 10132702Swollmans32 e1000_phy_commit(struct e1000_hw *hw) 10142702Swollman{ 101542997Swollman if (hw->phy.ops.commit) 10162702Swollman return hw->phy.ops.commit(hw); 10172702Swollman 101817214Swollman return E1000_SUCCESS; 10192702Swollman} 10202702Swollman 10212702Swollman/** 10222702Swollman * e1000_set_d0_lplu_state - Sets low power link up state for D0 10232702Swollman * @hw: pointer to the HW structure 10242702Swollman * @active: boolean used to enable/disable lplu 10252702Swollman * 10262702Swollman * Success returns 0, Failure returns 1 10272702Swollman * 10282702Swollman * The low power link up (lplu) state is set to the power management level D0 10292702Swollman * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0 10302702Swollman * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 10312702Swollman * is used during Dx states where the power conservation is most important. 10322702Swollman * During driver activity, SmartSpeed should be enabled so performance is 10332702Swollman * maintained. This is a function pointer entry point called by drivers. 10342702Swollman **/ 10352702Swollmans32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) 10362702Swollman{ 10372702Swollman if (hw->phy.ops.set_d0_lplu_state) 10382702Swollman return hw->phy.ops.set_d0_lplu_state(hw, active); 10392702Swollman 10402702Swollman return E1000_SUCCESS; 10412702Swollman} 10422702Swollman 10432702Swollman/** 104417214Swollman * e1000_set_d3_lplu_state - Sets low power link up state for D3 10452702Swollman * @hw: pointer to the HW structure 10462702Swollman * @active: boolean used to enable/disable lplu 10472702Swollman * 10489937Swollman * Success returns 0, Failure returns 1 10492702Swollman * 10502702Swollman * The low power link up (lplu) state is set to the power management level D3 10512702Swollman * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 10522702Swollman * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 10532702Swollman * is used during Dx states where the power conservation is most important. 10542702Swollman * During driver activity, SmartSpeed should be enabled so performance is 10552702Swollman * maintained. This is a function pointer entry point called by drivers. 10562702Swollman **/ 10572702Swollmans32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) 10582702Swollman{ 10592702Swollman if (hw->phy.ops.set_d3_lplu_state) 10602702Swollman return hw->phy.ops.set_d3_lplu_state(hw, active); 10612702Swollman 10622702Swollman return E1000_SUCCESS; 10632702Swollman} 10642702Swollman 10652702Swollman/** 10662702Swollman * e1000_read_mac_addr - Reads MAC address 10672702Swollman * @hw: pointer to the HW structure 10682702Swollman * 10692702Swollman * Reads the MAC address out of the adapter and stores it in the HW structure. 10702702Swollman * Currently no func pointer exists and all implementations are handled in the 107117214Swollman * generic version of this function. 10722702Swollman **/ 10732702Swollmans32 e1000_read_mac_addr(struct e1000_hw *hw) 10742702Swollman{ 10752702Swollman if (hw->mac.ops.read_mac_addr) 10762702Swollman return hw->mac.ops.read_mac_addr(hw); 10772702Swollman 10782702Swollman return e1000_read_mac_addr_generic(hw); 10792702Swollman} 108017214Swollman 10812702Swollman/** 10822702Swollman * e1000_read_pba_num - Read device part number 10832702Swollman * @hw: pointer to the HW structure 10842702Swollman * @pba_num: pointer to device part number 10852702Swollman * 10862702Swollman * Reads the product board assembly (PBA) number from the EEPROM and stores 10872702Swollman * the value in pba_num. 10882702Swollman * Currently no func pointer exists and all implementations are handled in the 10892702Swollman * generic version of this function. 10902702Swollman **/ 10912702Swollmans32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) 10922702Swollman{ 10932702Swollman return e1000_read_pba_num_generic(hw, pba_num); 10942702Swollman} 109517214Swollman 10962702Swollman/** 10972702Swollman * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum 10982702Swollman * @hw: pointer to the HW structure 10992702Swollman * 11002702Swollman * Validates the NVM checksum is correct. This is a function pointer entry 11012702Swollman * point called by drivers. 11022702Swollman **/ 11032702Swollmans32 e1000_validate_nvm_checksum(struct e1000_hw *hw) 11042702Swollman{ 11052702Swollman if (hw->nvm.ops.validate) 11062702Swollman return hw->nvm.ops.validate(hw); 11072702Swollman 110817214Swollman return -E1000_ERR_CONFIG; 11092702Swollman} 11102702Swollman 11112702Swollman/** 111217214Swollman * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum 111317214Swollman * @hw: pointer to the HW structure 11142702Swollman * 11152702Swollman * Updates the NVM checksum. Currently no func pointer exists and all 11162702Swollman * implementations are handled in the generic version of this function. 11172702Swollman **/ 11182702Swollmans32 e1000_update_nvm_checksum(struct e1000_hw *hw) 11192702Swollman{ 11202702Swollman if (hw->nvm.ops.update) 112117214Swollman return hw->nvm.ops.update(hw); 11222702Swollman 11232702Swollman return -E1000_ERR_CONFIG; 112417214Swollman} 11252702Swollman 11262702Swollman/** 11272702Swollman * e1000_reload_nvm - Reloads EEPROM 11282702Swollman * @hw: pointer to the HW structure 11292702Swollman * 11302702Swollman * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the 11312702Swollman * extended control register. 11322702Swollman **/ 11332702Swollmanvoid e1000_reload_nvm(struct e1000_hw *hw) 11342702Swollman{ 11352702Swollman if (hw->nvm.ops.reload) 11362702Swollman hw->nvm.ops.reload(hw); 11372702Swollman} 11382702Swollman 11392702Swollman/** 11402702Swollman * e1000_read_nvm - Reads NVM (EEPROM) 11412702Swollman * @hw: pointer to the HW structure 11422702Swollman * @offset: the word offset to read 114317214Swollman * @words: number of 16-bit words to read 11442702Swollman * @data: pointer to the properly sized buffer for the data. 11452702Swollman * 11462702Swollman * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function 114717214Swollman * pointer entry point called by drivers. 11482702Swollman **/ 11492702Swollmans32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 11502702Swollman{ 11512702Swollman if (hw->nvm.ops.read) 11522702Swollman return hw->nvm.ops.read(hw, offset, words, data); 11532702Swollman 11542702Swollman return -E1000_ERR_CONFIG; 11552702Swollman} 11562702Swollman 11572702Swollman/** 11582702Swollman * e1000_write_nvm - Writes to NVM (EEPROM) 11592702Swollman * @hw: pointer to the HW structure 11602702Swollman * @offset: the word offset to read 11612702Swollman * @words: number of 16-bit words to write 116217214Swollman * @data: pointer to the properly sized buffer for the data. 11632702Swollman * 11642702Swollman * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function 11652702Swollman * pointer entry point called by drivers. 116617214Swollman **/ 11672702Swollmans32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 11682702Swollman{ 11692702Swollman if (hw->nvm.ops.write) 117017214Swollman return hw->nvm.ops.write(hw, offset, words, data); 11712702Swollman 11722702Swollman return E1000_SUCCESS; 11732702Swollman} 11742702Swollman 11752702Swollman/** 11762702Swollman * e1000_write_8bit_ctrl_reg - Writes 8bit Control register 11779937Swollman * @hw: pointer to the HW structure 11782702Swollman * @reg: 32bit register offset 11792702Swollman * @offset: the register to write 11802702Swollman * @data: the value to write. 11812702Swollman * 11822702Swollman * Writes the PHY register at offset with the value in data. 11832702Swollman * This is a function pointer entry point called by drivers. 11842702Swollman **/ 11859937Swollmans32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, 11869937Swollman u8 data) 11879937Swollman{ 11889937Swollman return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data); 11899937Swollman} 11909937Swollman 11912702Swollman/** 11929937Swollman * e1000_power_up_phy - Restores link in case of PHY power down 11939937Swollman * @hw: pointer to the HW structure 11949937Swollman * 11959937Swollman * The phy may be powered down to save power, to turn off link when the 11962702Swollman * driver is unloaded, or wake on lan is not enabled (among others). 11972702Swollman **/ 119817214Swollmanvoid e1000_power_up_phy(struct e1000_hw *hw) 11992702Swollman{ 12002702Swollman if (hw->phy.ops.power_up) 12012702Swollman hw->phy.ops.power_up(hw); 12022702Swollman 12039937Swollman e1000_setup_link(hw); 12049937Swollman} 12059937Swollman 12069937Swollman/** 12079937Swollman * e1000_power_down_phy - Power down PHY 12089937Swollman * @hw: pointer to the HW structure 12092702Swollman * 12109937Swollman * The phy may be powered down to save power, to turn off link when the 12119937Swollman * driver is unloaded, or wake on lan is not enabled (among others). 12122702Swollman **/ 12139937Swollmanvoid e1000_power_down_phy(struct e1000_hw *hw) 12142702Swollman{ 12159937Swollman if (hw->phy.ops.power_down) 12169937Swollman hw->phy.ops.power_down(hw); 121742997Swollman} 12189937Swollman 12199937Swollman/** 12209937Swollman * e1000_shutdown_fiber_serdes_link - Remove link during power down 12219937Swollman * @hw: pointer to the HW structure 12229937Swollman * 12239937Swollman * Shutdown the optics and PCS on driver unload. 12242702Swollman **/ 12252702Swollmanvoid e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw) 12262702Swollman{ 122717214Swollman if (hw->mac.ops.shutdown_serdes) 12289937Swollman hw->mac.ops.shutdown_serdes(hw); 12292702Swollman} 12302702Swollman 12312702Swollman