1*4919Sxy150489 /* 2*4919Sxy150489 * This file is provided under a CDDLv1 license. When using or 3*4919Sxy150489 * redistributing this file, you may do so under this license. 4*4919Sxy150489 * In redistributing this file this license must be included 5*4919Sxy150489 * and no other modification of this header file is permitted. 6*4919Sxy150489 * 7*4919Sxy150489 * CDDL LICENSE SUMMARY 8*4919Sxy150489 * 9*4919Sxy150489 * Copyright(c) 1999 - 2007 Intel Corporation. All rights reserved. 10*4919Sxy150489 * 11*4919Sxy150489 * The contents of this file are subject to the terms of Version 12*4919Sxy150489 * 1.0 of the Common Development and Distribution License (the "License"). 13*4919Sxy150489 * 14*4919Sxy150489 * You should have received a copy of the License with this software. 15*4919Sxy150489 * You can obtain a copy of the License at 16*4919Sxy150489 * http://www.opensolaris.org/os/licensing. 17*4919Sxy150489 * See the License for the specific language governing permissions 18*4919Sxy150489 * and limitations under the License. 19*4919Sxy150489 */ 20*4919Sxy150489 21*4919Sxy150489 /* 22*4919Sxy150489 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*4919Sxy150489 * Use is subject to license terms of the CDDLv1. 24*4919Sxy150489 */ 25*4919Sxy150489 26*4919Sxy150489 #pragma ident "%Z%%M% %I% %E% SMI" 27*4919Sxy150489 28*4919Sxy150489 /* 29*4919Sxy150489 * IntelVersion: HSD_2343720b_DragonLake3 v2007-06-14_HSD_2343720b_DragonLake3 30*4919Sxy150489 */ 31*4919Sxy150489 #include "e1000_api.h" 32*4919Sxy150489 #include "e1000_mac.h" 33*4919Sxy150489 #include "e1000_nvm.h" 34*4919Sxy150489 #include "e1000_phy.h" 35*4919Sxy150489 36*4919Sxy150489 extern void e1000_init_function_pointers_82542(struct e1000_hw *hw); 37*4919Sxy150489 extern void e1000_init_function_pointers_82543(struct e1000_hw *hw); 38*4919Sxy150489 extern void e1000_init_function_pointers_82540(struct e1000_hw *hw); 39*4919Sxy150489 extern void e1000_init_function_pointers_82571(struct e1000_hw *hw); 40*4919Sxy150489 extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); 41*4919Sxy150489 extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); 42*4919Sxy150489 extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); 43*4919Sxy150489 extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); 44*4919Sxy150489 45*4919Sxy150489 /* 46*4919Sxy150489 * e1000_init_mac_params - Initialize MAC function pointers 47*4919Sxy150489 * @hw: pointer to the HW structure 48*4919Sxy150489 * 49*4919Sxy150489 * This function initializes the function pointers for the MAC 50*4919Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 51*4919Sxy150489 */ 52*4919Sxy150489 s32 53*4919Sxy150489 e1000_init_mac_params(struct e1000_hw *hw) 54*4919Sxy150489 { 55*4919Sxy150489 s32 ret_val = E1000_SUCCESS; 56*4919Sxy150489 57*4919Sxy150489 if (hw->func.init_mac_params) { 58*4919Sxy150489 ret_val = hw->func.init_mac_params(hw); 59*4919Sxy150489 if (ret_val) { 60*4919Sxy150489 DEBUGOUT("MAC Initialization Error\n"); 61*4919Sxy150489 goto out; 62*4919Sxy150489 } 63*4919Sxy150489 } else { 64*4919Sxy150489 DEBUGOUT("mac.init_mac_params was NULL\n"); 65*4919Sxy150489 ret_val = -E1000_ERR_CONFIG; 66*4919Sxy150489 } 67*4919Sxy150489 68*4919Sxy150489 out: 69*4919Sxy150489 return (ret_val); 70*4919Sxy150489 } 71*4919Sxy150489 72*4919Sxy150489 /* 73*4919Sxy150489 * e1000_init_nvm_params - Initialize NVM function pointers 74*4919Sxy150489 * @hw: pointer to the HW structure 75*4919Sxy150489 * 76*4919Sxy150489 * This function initializes the function pointers for the NVM 77*4919Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 78*4919Sxy150489 */ 79*4919Sxy150489 s32 80*4919Sxy150489 e1000_init_nvm_params(struct e1000_hw *hw) 81*4919Sxy150489 { 82*4919Sxy150489 s32 ret_val = E1000_SUCCESS; 83*4919Sxy150489 84*4919Sxy150489 if (hw->func.init_nvm_params) { 85*4919Sxy150489 ret_val = hw->func.init_nvm_params(hw); 86*4919Sxy150489 if (ret_val) { 87*4919Sxy150489 DEBUGOUT("NVM Initialization Error\n"); 88*4919Sxy150489 goto out; 89*4919Sxy150489 } 90*4919Sxy150489 } else { 91*4919Sxy150489 DEBUGOUT("nvm.init_nvm_params was NULL\n"); 92*4919Sxy150489 ret_val = -E1000_ERR_CONFIG; 93*4919Sxy150489 } 94*4919Sxy150489 95*4919Sxy150489 out: 96*4919Sxy150489 return (ret_val); 97*4919Sxy150489 } 98*4919Sxy150489 99*4919Sxy150489 /* 100*4919Sxy150489 * e1000_init_phy_params - Initialize PHY function pointers 101*4919Sxy150489 * @hw: pointer to the HW structure 102*4919Sxy150489 * 103*4919Sxy150489 * This function initializes the function pointers for the PHY 104*4919Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 105*4919Sxy150489 */ 106*4919Sxy150489 s32 107*4919Sxy150489 e1000_init_phy_params(struct e1000_hw *hw) 108*4919Sxy150489 { 109*4919Sxy150489 s32 ret_val = E1000_SUCCESS; 110*4919Sxy150489 111*4919Sxy150489 if (hw->func.init_phy_params) { 112*4919Sxy150489 ret_val = hw->func.init_phy_params(hw); 113*4919Sxy150489 if (ret_val) { 114*4919Sxy150489 DEBUGOUT("PHY Initialization Error\n"); 115*4919Sxy150489 goto out; 116*4919Sxy150489 } 117*4919Sxy150489 } else { 118*4919Sxy150489 DEBUGOUT("phy.init_phy_params was NULL\n"); 119*4919Sxy150489 ret_val = -E1000_ERR_CONFIG; 120*4919Sxy150489 } 121*4919Sxy150489 122*4919Sxy150489 out: 123*4919Sxy150489 return (ret_val); 124*4919Sxy150489 } 125*4919Sxy150489 126*4919Sxy150489 /* 127*4919Sxy150489 * e1000_set_mac_type - Sets MAC type 128*4919Sxy150489 * @hw: pointer to the HW structure 129*4919Sxy150489 * 130*4919Sxy150489 * This function sets the mac type of the adapter based on the 131*4919Sxy150489 * device ID stored in the hw structure. 132*4919Sxy150489 * MUST BE FIRST FUNCTION CALLED (explicitly or through 133*4919Sxy150489 * e1000_setup_init_funcs()). 134*4919Sxy150489 */ 135*4919Sxy150489 s32 136*4919Sxy150489 e1000_set_mac_type(struct e1000_hw *hw) 137*4919Sxy150489 { 138*4919Sxy150489 struct e1000_mac_info *mac = &hw->mac; 139*4919Sxy150489 s32 ret_val = E1000_SUCCESS; 140*4919Sxy150489 141*4919Sxy150489 DEBUGFUNC("e1000_set_mac_type"); 142*4919Sxy150489 143*4919Sxy150489 switch (hw->device_id) { 144*4919Sxy150489 case E1000_DEV_ID_82542: 145*4919Sxy150489 mac->type = e1000_82542; 146*4919Sxy150489 break; 147*4919Sxy150489 case E1000_DEV_ID_82543GC_FIBER: 148*4919Sxy150489 case E1000_DEV_ID_82543GC_COPPER: 149*4919Sxy150489 mac->type = e1000_82543; 150*4919Sxy150489 break; 151*4919Sxy150489 case E1000_DEV_ID_82544EI_COPPER: 152*4919Sxy150489 case E1000_DEV_ID_82544EI_FIBER: 153*4919Sxy150489 case E1000_DEV_ID_82544GC_COPPER: 154*4919Sxy150489 case E1000_DEV_ID_82544GC_LOM: 155*4919Sxy150489 mac->type = e1000_82544; 156*4919Sxy150489 break; 157*4919Sxy150489 case E1000_DEV_ID_82540EM: 158*4919Sxy150489 case E1000_DEV_ID_82540EM_LOM: 159*4919Sxy150489 case E1000_DEV_ID_82540EP: 160*4919Sxy150489 case E1000_DEV_ID_82540EP_LOM: 161*4919Sxy150489 case E1000_DEV_ID_82540EP_LP: 162*4919Sxy150489 mac->type = e1000_82540; 163*4919Sxy150489 break; 164*4919Sxy150489 case E1000_DEV_ID_82545EM_COPPER: 165*4919Sxy150489 case E1000_DEV_ID_82545EM_FIBER: 166*4919Sxy150489 mac->type = e1000_82545; 167*4919Sxy150489 break; 168*4919Sxy150489 case E1000_DEV_ID_82545GM_COPPER: 169*4919Sxy150489 case E1000_DEV_ID_82545GM_FIBER: 170*4919Sxy150489 case E1000_DEV_ID_82545GM_SERDES: 171*4919Sxy150489 mac->type = e1000_82545_rev_3; 172*4919Sxy150489 break; 173*4919Sxy150489 case E1000_DEV_ID_82546EB_COPPER: 174*4919Sxy150489 case E1000_DEV_ID_82546EB_FIBER: 175*4919Sxy150489 case E1000_DEV_ID_82546EB_QUAD_COPPER: 176*4919Sxy150489 mac->type = e1000_82546; 177*4919Sxy150489 break; 178*4919Sxy150489 case E1000_DEV_ID_82546GB_COPPER: 179*4919Sxy150489 case E1000_DEV_ID_82546GB_FIBER: 180*4919Sxy150489 case E1000_DEV_ID_82546GB_SERDES: 181*4919Sxy150489 case E1000_DEV_ID_82546GB_PCIE: 182*4919Sxy150489 case E1000_DEV_ID_82546GB_QUAD_COPPER: 183*4919Sxy150489 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 184*4919Sxy150489 mac->type = e1000_82546_rev_3; 185*4919Sxy150489 break; 186*4919Sxy150489 case E1000_DEV_ID_82541EI: 187*4919Sxy150489 case E1000_DEV_ID_82541EI_MOBILE: 188*4919Sxy150489 case E1000_DEV_ID_82541ER_LOM: 189*4919Sxy150489 mac->type = e1000_82541; 190*4919Sxy150489 break; 191*4919Sxy150489 case E1000_DEV_ID_82541ER: 192*4919Sxy150489 case E1000_DEV_ID_82541GI: 193*4919Sxy150489 case E1000_DEV_ID_82541GI_LF: 194*4919Sxy150489 case E1000_DEV_ID_82541GI_MOBILE: 195*4919Sxy150489 mac->type = e1000_82541_rev_2; 196*4919Sxy150489 break; 197*4919Sxy150489 case E1000_DEV_ID_82547EI: 198*4919Sxy150489 case E1000_DEV_ID_82547EI_MOBILE: 199*4919Sxy150489 mac->type = e1000_82547; 200*4919Sxy150489 break; 201*4919Sxy150489 case E1000_DEV_ID_82547GI: 202*4919Sxy150489 mac->type = e1000_82547_rev_2; 203*4919Sxy150489 break; 204*4919Sxy150489 case E1000_DEV_ID_82571EB_COPPER: 205*4919Sxy150489 case E1000_DEV_ID_82571EB_FIBER: 206*4919Sxy150489 case E1000_DEV_ID_82571EB_SERDES: 207*4919Sxy150489 case E1000_DEV_ID_82571EB_SERDES_DUAL: 208*4919Sxy150489 case E1000_DEV_ID_82571EB_SERDES_QUAD: 209*4919Sxy150489 case E1000_DEV_ID_82571EB_QUAD_COPPER: 210*4919Sxy150489 case E1000_DEV_ID_82571PT_QUAD_COPPER: 211*4919Sxy150489 case E1000_DEV_ID_82571EB_QUAD_FIBER: 212*4919Sxy150489 case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: 213*4919Sxy150489 mac->type = e1000_82571; 214*4919Sxy150489 break; 215*4919Sxy150489 case E1000_DEV_ID_82572EI: 216*4919Sxy150489 case E1000_DEV_ID_82572EI_COPPER: 217*4919Sxy150489 case E1000_DEV_ID_82572EI_FIBER: 218*4919Sxy150489 case E1000_DEV_ID_82572EI_SERDES: 219*4919Sxy150489 mac->type = e1000_82572; 220*4919Sxy150489 break; 221*4919Sxy150489 case E1000_DEV_ID_82573E: 222*4919Sxy150489 case E1000_DEV_ID_82573E_IAMT: 223*4919Sxy150489 case E1000_DEV_ID_82573L: 224*4919Sxy150489 mac->type = e1000_82573; 225*4919Sxy150489 break; 226*4919Sxy150489 case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: 227*4919Sxy150489 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: 228*4919Sxy150489 case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: 229*4919Sxy150489 case E1000_DEV_ID_80003ES2LAN_SERDES_SPT: 230*4919Sxy150489 mac->type = e1000_80003es2lan; 231*4919Sxy150489 break; 232*4919Sxy150489 case E1000_DEV_ID_ICH8_IFE: 233*4919Sxy150489 case E1000_DEV_ID_ICH8_IFE_GT: 234*4919Sxy150489 case E1000_DEV_ID_ICH8_IFE_G: 235*4919Sxy150489 case E1000_DEV_ID_ICH8_IGP_M: 236*4919Sxy150489 case E1000_DEV_ID_ICH8_IGP_M_AMT: 237*4919Sxy150489 case E1000_DEV_ID_ICH8_IGP_AMT: 238*4919Sxy150489 case E1000_DEV_ID_ICH8_IGP_C: 239*4919Sxy150489 mac->type = e1000_ich8lan; 240*4919Sxy150489 break; 241*4919Sxy150489 case E1000_DEV_ID_ICH9_IFE: 242*4919Sxy150489 case E1000_DEV_ID_ICH9_IFE_GT: 243*4919Sxy150489 case E1000_DEV_ID_ICH9_IFE_G: 244*4919Sxy150489 case E1000_DEV_ID_ICH9_IGP_AMT: 245*4919Sxy150489 case E1000_DEV_ID_ICH9_IGP_C: 246*4919Sxy150489 mac->type = e1000_ich9lan; 247*4919Sxy150489 break; 248*4919Sxy150489 default: 249*4919Sxy150489 /* Should never have loaded on this device */ 250*4919Sxy150489 ret_val = -E1000_ERR_MAC_INIT; 251*4919Sxy150489 break; 252*4919Sxy150489 } 253*4919Sxy150489 254*4919Sxy150489 return (ret_val); 255*4919Sxy150489 } 256*4919Sxy150489 257*4919Sxy150489 /* 258*4919Sxy150489 * e1000_setup_init_funcs - Initializes function pointers 259*4919Sxy150489 * @hw: pointer to the HW structure 260*4919Sxy150489 * @init_device: TRUE will initialize the rest of the function pointers 261*4919Sxy150489 * getting the device ready for use. FALSE will only set 262*4919Sxy150489 * MAC type and the function pointers for the other init 263*4919Sxy150489 * functions. Passing FALSE will not generate any hardware 264*4919Sxy150489 * reads or writes. 265*4919Sxy150489 * 266*4919Sxy150489 * This function must be called by a driver in order to use the rest 267*4919Sxy150489 * of the 'shared' code files. Called by drivers only. 268*4919Sxy150489 */ 269*4919Sxy150489 s32 270*4919Sxy150489 e1000_setup_init_funcs(struct e1000_hw *hw, boolean_t init_device) 271*4919Sxy150489 { 272*4919Sxy150489 s32 ret_val; 273*4919Sxy150489 274*4919Sxy150489 /* Can't do much good without knowing the MAC type. */ 275*4919Sxy150489 ret_val = e1000_set_mac_type(hw); 276*4919Sxy150489 if (ret_val) { 277*4919Sxy150489 DEBUGOUT("ERROR: MAC type could not be set properly.\n"); 278*4919Sxy150489 goto out; 279*4919Sxy150489 } 280*4919Sxy150489 if (!hw->hw_addr) { 281*4919Sxy150489 DEBUGOUT("ERROR: Registers not mapped\n"); 282*4919Sxy150489 ret_val = -E1000_ERR_CONFIG; 283*4919Sxy150489 goto out; 284*4919Sxy150489 } 285*4919Sxy150489 286*4919Sxy150489 /* 287*4919Sxy150489 * Init some generic function pointers that are currently all pointing 288*4919Sxy150489 * to generic implementations. We do this first allowing a driver 289*4919Sxy150489 * module to override it afterwards. 290*4919Sxy150489 */ 291*4919Sxy150489 hw->func.config_collision_dist = e1000_config_collision_dist_generic; 292*4919Sxy150489 hw->func.rar_set = e1000_rar_set_generic; 293*4919Sxy150489 hw->func.validate_mdi_setting = e1000_validate_mdi_setting_generic; 294*4919Sxy150489 hw->func.mng_host_if_write = e1000_mng_host_if_write_generic; 295*4919Sxy150489 hw->func.mng_write_cmd_header = e1000_mng_write_cmd_header_generic; 296*4919Sxy150489 hw->func.mng_enable_host_if = e1000_mng_enable_host_if_generic; 297*4919Sxy150489 hw->func.wait_autoneg = e1000_wait_autoneg_generic; 298*4919Sxy150489 hw->func.reload_nvm = e1000_reload_nvm_generic; 299*4919Sxy150489 300*4919Sxy150489 /* 301*4919Sxy150489 * Set up the init function pointers. These are functions within the 302*4919Sxy150489 * adapter family file that sets up function pointers for the rest of 303*4919Sxy150489 * the functions in that family. 304*4919Sxy150489 */ 305*4919Sxy150489 switch (hw->mac.type) { 306*4919Sxy150489 case e1000_82542: 307*4919Sxy150489 e1000_init_function_pointers_82542(hw); 308*4919Sxy150489 break; 309*4919Sxy150489 case e1000_82543: 310*4919Sxy150489 case e1000_82544: 311*4919Sxy150489 e1000_init_function_pointers_82543(hw); 312*4919Sxy150489 break; 313*4919Sxy150489 case e1000_82540: 314*4919Sxy150489 case e1000_82545: 315*4919Sxy150489 case e1000_82545_rev_3: 316*4919Sxy150489 case e1000_82546: 317*4919Sxy150489 case e1000_82546_rev_3: 318*4919Sxy150489 e1000_init_function_pointers_82540(hw); 319*4919Sxy150489 break; 320*4919Sxy150489 case e1000_82541: 321*4919Sxy150489 case e1000_82541_rev_2: 322*4919Sxy150489 case e1000_82547: 323*4919Sxy150489 case e1000_82547_rev_2: 324*4919Sxy150489 e1000_init_function_pointers_82541(hw); 325*4919Sxy150489 break; 326*4919Sxy150489 case e1000_82571: 327*4919Sxy150489 case e1000_82572: 328*4919Sxy150489 case e1000_82573: 329*4919Sxy150489 e1000_init_function_pointers_82571(hw); 330*4919Sxy150489 break; 331*4919Sxy150489 case e1000_80003es2lan: 332*4919Sxy150489 e1000_init_function_pointers_80003es2lan(hw); 333*4919Sxy150489 break; 334*4919Sxy150489 case e1000_ich8lan: 335*4919Sxy150489 case e1000_ich9lan: 336*4919Sxy150489 e1000_init_function_pointers_ich8lan(hw); 337*4919Sxy150489 break; 338*4919Sxy150489 default: 339*4919Sxy150489 DEBUGOUT("Hardware not supported\n"); 340*4919Sxy150489 ret_val = -E1000_ERR_CONFIG; 341*4919Sxy150489 break; 342*4919Sxy150489 } 343*4919Sxy150489 344*4919Sxy150489 /* 345*4919Sxy150489 * Initialize the rest of the function pointers. These require some 346*4919Sxy150489 * register reads/writes in some cases. 347*4919Sxy150489 */ 348*4919Sxy150489 if (!(ret_val) && init_device) { 349*4919Sxy150489 ret_val = e1000_init_mac_params(hw); 350*4919Sxy150489 if (ret_val) 351*4919Sxy150489 goto out; 352*4919Sxy150489 353*4919Sxy150489 ret_val = e1000_init_nvm_params(hw); 354*4919Sxy150489 if (ret_val) 355*4919Sxy150489 goto out; 356*4919Sxy150489 357*4919Sxy150489 ret_val = e1000_init_phy_params(hw); 358*4919Sxy150489 if (ret_val) 359*4919Sxy150489 goto out; 360*4919Sxy150489 361*4919Sxy150489 } 362*4919Sxy150489 363*4919Sxy150489 out: 364*4919Sxy150489 return (ret_val); 365*4919Sxy150489 } 366*4919Sxy150489 367*4919Sxy150489 /* 368*4919Sxy150489 * e1000_remove_device - Free device specific structure 369*4919Sxy150489 * @hw: pointer to the HW structure 370*4919Sxy150489 * 371*4919Sxy150489 * If a device specific structure was allocated, this function will 372*4919Sxy150489 * free it. This is a function pointer entry point called by drivers. 373*4919Sxy150489 */ 374*4919Sxy150489 void 375*4919Sxy150489 e1000_remove_device(struct e1000_hw *hw) 376*4919Sxy150489 { 377*4919Sxy150489 if (hw->func.remove_device) 378*4919Sxy150489 hw->func.remove_device(hw); 379*4919Sxy150489 } 380*4919Sxy150489 381*4919Sxy150489 /* 382*4919Sxy150489 * e1000_get_bus_info - Obtain bus information for adapter 383*4919Sxy150489 * @hw: pointer to the HW structure 384*4919Sxy150489 * 385*4919Sxy150489 * This will obtain information about the HW bus for which the 386*4919Sxy150489 * adaper is attached and stores it in the hw structure. This is a 387*4919Sxy150489 * function pointer entry point called by drivers. 388*4919Sxy150489 */ 389*4919Sxy150489 s32 390*4919Sxy150489 e1000_get_bus_info(struct e1000_hw *hw) 391*4919Sxy150489 { 392*4919Sxy150489 if (hw->func.get_bus_info) 393*4919Sxy150489 return (hw->func.get_bus_info(hw)); 394*4919Sxy150489 395*4919Sxy150489 return (E1000_SUCCESS); 396*4919Sxy150489 } 397*4919Sxy150489 398*4919Sxy150489 /* 399*4919Sxy150489 * e1000_clear_vfta - Clear VLAN filter table 400*4919Sxy150489 * @hw: pointer to the HW structure 401*4919Sxy150489 * 402*4919Sxy150489 * This clears the VLAN filter table on the adapter. This is a function 403*4919Sxy150489 * pointer entry point called by drivers. 404*4919Sxy150489 */ 405*4919Sxy150489 void 406*4919Sxy150489 e1000_clear_vfta(struct e1000_hw *hw) 407*4919Sxy150489 { 408*4919Sxy150489 if (hw->func.clear_vfta) 409*4919Sxy150489 hw->func.clear_vfta(hw); 410*4919Sxy150489 } 411*4919Sxy150489 412*4919Sxy150489 /* 413*4919Sxy150489 * e1000_write_vfta - Write value to VLAN filter table 414*4919Sxy150489 * @hw: pointer to the HW structure 415*4919Sxy150489 * @offset: the 32-bit offset in which to write the value to. 416*4919Sxy150489 * @value: the 32-bit value to write at location offset. 417*4919Sxy150489 * 418*4919Sxy150489 * This writes a 32-bit value to a 32-bit offset in the VLAN filter 419*4919Sxy150489 * table. This is a function pointer entry point called by drivers. 420*4919Sxy150489 */ 421*4919Sxy150489 void 422*4919Sxy150489 e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) 423*4919Sxy150489 { 424*4919Sxy150489 if (hw->func.write_vfta) 425*4919Sxy150489 hw->func.write_vfta(hw, offset, value); 426*4919Sxy150489 } 427*4919Sxy150489 428*4919Sxy150489 /* 429*4919Sxy150489 * e1000_mc_addr_list_update - Update Multicast addresses 430*4919Sxy150489 * @hw: pointer to the HW structure 431*4919Sxy150489 * @mc_addr_list: array of multicast addresses to program 432*4919Sxy150489 * @mc_addr_count: number of multicast addresses to program 433*4919Sxy150489 * @rar_used_count: the first RAR register free to program 434*4919Sxy150489 * @rar_count: total number of supported Receive Address Registers 435*4919Sxy150489 * 436*4919Sxy150489 * Updates the Receive Address Registers and Multicast Table Array. 437*4919Sxy150489 * The caller must have a packed mc_addr_list of multicast addresses. 438*4919Sxy150489 * The parameter rar_count will usually be hw->mac.rar_entry_count 439*4919Sxy150489 * unless there are workarounds that change this. Currently no func pointer 440*4919Sxy150489 * exists and all implementations are handled in the generic version of this 441*4919Sxy150489 * function. 442*4919Sxy150489 */ 443*4919Sxy150489 void 444*4919Sxy150489 e1000_mc_addr_list_update(struct e1000_hw *hw, u8 *mc_addr_list, 445*4919Sxy150489 u32 mc_addr_count, u32 rar_used_count, u32 rar_count) 446*4919Sxy150489 { 447*4919Sxy150489 if (hw->func.mc_addr_list_update) 448*4919Sxy150489 hw->func.mc_addr_list_update(hw, 449*4919Sxy150489 mc_addr_list, 450*4919Sxy150489 mc_addr_count, 451*4919Sxy150489 rar_used_count, 452*4919Sxy150489 rar_count); 453*4919Sxy150489 } 454*4919Sxy150489 455*4919Sxy150489 /* 456*4919Sxy150489 * e1000_force_mac_fc - Force MAC flow control 457*4919Sxy150489 * @hw: pointer to the HW structure 458*4919Sxy150489 * 459*4919Sxy150489 * Force the MAC's flow control settings. Currently no func pointer exists 460*4919Sxy150489 * and all implementations are handled in the generic version of this 461*4919Sxy150489 * function. 462*4919Sxy150489 */ 463*4919Sxy150489 s32 464*4919Sxy150489 e1000_force_mac_fc(struct e1000_hw *hw) 465*4919Sxy150489 { 466*4919Sxy150489 return (e1000_force_mac_fc_generic(hw)); 467*4919Sxy150489 } 468*4919Sxy150489 469*4919Sxy150489 /* 470*4919Sxy150489 * e1000_check_for_link - Check/Store link connection 471*4919Sxy150489 * @hw: pointer to the HW structure 472*4919Sxy150489 * 473*4919Sxy150489 * This checks the link condition of the adapter and stores the 474*4919Sxy150489 * results in the hw->mac structure. This is a function pointer entry 475*4919Sxy150489 * point called by drivers. 476*4919Sxy150489 */ 477*4919Sxy150489 s32 478*4919Sxy150489 e1000_check_for_link(struct e1000_hw *hw) 479*4919Sxy150489 { 480*4919Sxy150489 if (hw->func.check_for_link) 481*4919Sxy150489 return (hw->func.check_for_link(hw)); 482*4919Sxy150489 483*4919Sxy150489 return (-E1000_ERR_CONFIG); 484*4919Sxy150489 } 485*4919Sxy150489 486*4919Sxy150489 /* 487*4919Sxy150489 * e1000_check_mng_mode - Check management mode 488*4919Sxy150489 * @hw: pointer to the HW structure 489*4919Sxy150489 * 490*4919Sxy150489 * This checks if the adapter has manageability enabled. 491*4919Sxy150489 * This is a function pointer entry point called by drivers. 492*4919Sxy150489 */ 493*4919Sxy150489 boolean_t 494*4919Sxy150489 e1000_check_mng_mode(struct e1000_hw *hw) 495*4919Sxy150489 { 496*4919Sxy150489 if (hw->func.check_mng_mode) 497*4919Sxy150489 return (hw->func.check_mng_mode(hw)); 498*4919Sxy150489 499*4919Sxy150489 return (FALSE); 500*4919Sxy150489 } 501*4919Sxy150489 502*4919Sxy150489 /* 503*4919Sxy150489 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface 504*4919Sxy150489 * @hw: pointer to the HW structure 505*4919Sxy150489 * @buffer: pointer to the host interface 506*4919Sxy150489 * @length: size of the buffer 507*4919Sxy150489 * 508*4919Sxy150489 * Writes the DHCP information to the host interface. 509*4919Sxy150489 */ 510*4919Sxy150489 s32 511*4919Sxy150489 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 * buffer, u16 length) 512*4919Sxy150489 { 513*4919Sxy150489 return (e1000_mng_write_dhcp_info_generic(hw, buffer, length)); 514*4919Sxy150489 } 515*4919Sxy150489 516*4919Sxy150489 /* 517*4919Sxy150489 * e1000_reset_hw - Reset hardware 518*4919Sxy150489 * @hw: pointer to the HW structure 519*4919Sxy150489 * 520*4919Sxy150489 * This resets the hardware into a known state. This is a function pointer 521*4919Sxy150489 * entry point called by drivers. 522*4919Sxy150489 */ 523*4919Sxy150489 s32 524*4919Sxy150489 e1000_reset_hw(struct e1000_hw *hw) 525*4919Sxy150489 { 526*4919Sxy150489 if (hw->func.reset_hw) 527*4919Sxy150489 return (hw->func.reset_hw(hw)); 528*4919Sxy150489 529*4919Sxy150489 return (-E1000_ERR_CONFIG); 530*4919Sxy150489 } 531*4919Sxy150489 532*4919Sxy150489 /* 533*4919Sxy150489 * e1000_init_hw - Initialize hardware 534*4919Sxy150489 * @hw: pointer to the HW structure 535*4919Sxy150489 * 536*4919Sxy150489 * This inits the hardware readying it for operation. This is a function 537*4919Sxy150489 * pointer entry point called by drivers. 538*4919Sxy150489 */ 539*4919Sxy150489 s32 540*4919Sxy150489 e1000_init_hw(struct e1000_hw *hw) 541*4919Sxy150489 { 542*4919Sxy150489 if (hw->func.init_hw) 543*4919Sxy150489 return (hw->func.init_hw(hw)); 544*4919Sxy150489 545*4919Sxy150489 return (-E1000_ERR_CONFIG); 546*4919Sxy150489 } 547*4919Sxy150489 548*4919Sxy150489 /* 549*4919Sxy150489 * e1000_setup_link - Configures link and flow control 550*4919Sxy150489 * @hw: pointer to the HW structure 551*4919Sxy150489 * 552*4919Sxy150489 * This configures link and flow control settings for the adapter. This 553*4919Sxy150489 * is a function pointer entry point called by drivers. While modules can 554*4919Sxy150489 * also call this, they probably call their own version of this function. 555*4919Sxy150489 */ 556*4919Sxy150489 s32 557*4919Sxy150489 e1000_setup_link(struct e1000_hw *hw) 558*4919Sxy150489 { 559*4919Sxy150489 if (hw->func.setup_link) 560*4919Sxy150489 return (hw->func.setup_link(hw)); 561*4919Sxy150489 562*4919Sxy150489 return (-E1000_ERR_CONFIG); 563*4919Sxy150489 } 564*4919Sxy150489 565*4919Sxy150489 /* 566*4919Sxy150489 * e1000_get_speed_and_duplex - Returns current speed and duplex 567*4919Sxy150489 * @hw: pointer to the HW structure 568*4919Sxy150489 * @speed: pointer to a 16-bit value to store the speed 569*4919Sxy150489 * @duplex: pointer to a 16-bit value to store the duplex. 570*4919Sxy150489 * 571*4919Sxy150489 * This returns the speed and duplex of the adapter in the two 'out' 572*4919Sxy150489 * variables passed in. This is a function pointer entry point called 573*4919Sxy150489 * by drivers. 574*4919Sxy150489 */ 575*4919Sxy150489 s32 576*4919Sxy150489 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 * speed, u16 * duplex) 577*4919Sxy150489 { 578*4919Sxy150489 if (hw->func.get_link_up_info) 579*4919Sxy150489 return (hw->func.get_link_up_info(hw, speed, duplex)); 580*4919Sxy150489 581*4919Sxy150489 return (-E1000_ERR_CONFIG); 582*4919Sxy150489 } 583*4919Sxy150489 584*4919Sxy150489 /* 585*4919Sxy150489 * e1000_setup_led - Configures SW controllable LED 586*4919Sxy150489 * @hw: pointer to the HW structure 587*4919Sxy150489 * 588*4919Sxy150489 * This prepares the SW controllable LED for use and saves the current state 589*4919Sxy150489 * of the LED so it can be later restored. This is a function pointer entry 590*4919Sxy150489 * point called by drivers. 591*4919Sxy150489 */ 592*4919Sxy150489 s32 593*4919Sxy150489 e1000_setup_led(struct e1000_hw *hw) 594*4919Sxy150489 { 595*4919Sxy150489 if (hw->func.setup_led) 596*4919Sxy150489 return (hw->func.setup_led(hw)); 597*4919Sxy150489 598*4919Sxy150489 return (E1000_SUCCESS); 599*4919Sxy150489 } 600*4919Sxy150489 601*4919Sxy150489 /* 602*4919Sxy150489 * e1000_cleanup_led - Restores SW controllable LED 603*4919Sxy150489 * @hw: pointer to the HW structure 604*4919Sxy150489 * 605*4919Sxy150489 * This restores the SW controllable LED to the value saved off by 606*4919Sxy150489 * e1000_setup_led. This is a function pointer entry point called by drivers. 607*4919Sxy150489 */ 608*4919Sxy150489 s32 609*4919Sxy150489 e1000_cleanup_led(struct e1000_hw *hw) 610*4919Sxy150489 { 611*4919Sxy150489 if (hw->func.cleanup_led) 612*4919Sxy150489 return (hw->func.cleanup_led(hw)); 613*4919Sxy150489 614*4919Sxy150489 return (E1000_SUCCESS); 615*4919Sxy150489 } 616*4919Sxy150489 617*4919Sxy150489 /* 618*4919Sxy150489 * e1000_blink_led - Blink SW controllable LED 619*4919Sxy150489 * @hw: pointer to the HW structure 620*4919Sxy150489 * 621*4919Sxy150489 * This starts the adapter LED blinking. Request the LED to be setup first 622*4919Sxy150489 * and cleaned up after. This is a function pointer entry point called by 623*4919Sxy150489 * drivers. 624*4919Sxy150489 */ 625*4919Sxy150489 s32 626*4919Sxy150489 e1000_blink_led(struct e1000_hw *hw) 627*4919Sxy150489 { 628*4919Sxy150489 if (hw->func.blink_led) 629*4919Sxy150489 return (hw->func.blink_led(hw)); 630*4919Sxy150489 631*4919Sxy150489 return (E1000_SUCCESS); 632*4919Sxy150489 } 633*4919Sxy150489 634*4919Sxy150489 /* 635*4919Sxy150489 * e1000_led_on - Turn on SW controllable LED 636*4919Sxy150489 * @hw: pointer to the HW structure 637*4919Sxy150489 * 638*4919Sxy150489 * Turns the SW defined LED on. This is a function pointer entry point 639*4919Sxy150489 * called by drivers. 640*4919Sxy150489 */ 641*4919Sxy150489 s32 642*4919Sxy150489 e1000_led_on(struct e1000_hw *hw) 643*4919Sxy150489 { 644*4919Sxy150489 if (hw->func.led_on) 645*4919Sxy150489 return (hw->func.led_on(hw)); 646*4919Sxy150489 647*4919Sxy150489 return (E1000_SUCCESS); 648*4919Sxy150489 } 649*4919Sxy150489 650*4919Sxy150489 /* 651*4919Sxy150489 * e1000_led_off - Turn off SW controllable LED 652*4919Sxy150489 * @hw: pointer to the HW structure 653*4919Sxy150489 * 654*4919Sxy150489 * Turns the SW defined LED off. This is a function pointer entry point 655*4919Sxy150489 * called by drivers. 656*4919Sxy150489 */ 657*4919Sxy150489 s32 658*4919Sxy150489 e1000_led_off(struct e1000_hw *hw) 659*4919Sxy150489 { 660*4919Sxy150489 if (hw->func.led_off) 661*4919Sxy150489 return (hw->func.led_off(hw)); 662*4919Sxy150489 663*4919Sxy150489 return (E1000_SUCCESS); 664*4919Sxy150489 } 665*4919Sxy150489 666*4919Sxy150489 /* 667*4919Sxy150489 * e1000_reset_adaptive - Reset adaptive IFS 668*4919Sxy150489 * @hw: pointer to the HW structure 669*4919Sxy150489 * 670*4919Sxy150489 * Resets the adaptive IFS. Currently no func pointer exists and all 671*4919Sxy150489 * implementations are handled in the generic version of this function. 672*4919Sxy150489 */ 673*4919Sxy150489 void 674*4919Sxy150489 e1000_reset_adaptive(struct e1000_hw *hw) 675*4919Sxy150489 { 676*4919Sxy150489 e1000_reset_adaptive_generic(hw); 677*4919Sxy150489 } 678*4919Sxy150489 679*4919Sxy150489 /* 680*4919Sxy150489 * e1000_update_adaptive - Update adaptive IFS 681*4919Sxy150489 * @hw: pointer to the HW structure 682*4919Sxy150489 * 683*4919Sxy150489 * Updates adapter IFS. Currently no func pointer exists and all 684*4919Sxy150489 * implementations are handled in the generic version of this function. 685*4919Sxy150489 */ 686*4919Sxy150489 void 687*4919Sxy150489 e1000_update_adaptive(struct e1000_hw *hw) 688*4919Sxy150489 { 689*4919Sxy150489 e1000_update_adaptive_generic(hw); 690*4919Sxy150489 } 691*4919Sxy150489 692*4919Sxy150489 /* 693*4919Sxy150489 * e1000_disable_pcie_master - Disable PCI-Express master access 694*4919Sxy150489 * @hw: pointer to the HW structure 695*4919Sxy150489 * 696*4919Sxy150489 * Disables PCI-Express master access and verifies there are no pending 697*4919Sxy150489 * requests. Currently no func pointer exists and all implementations are 698*4919Sxy150489 * handled in the generic version of this function. 699*4919Sxy150489 */ 700*4919Sxy150489 s32 701*4919Sxy150489 e1000_disable_pcie_master(struct e1000_hw *hw) 702*4919Sxy150489 { 703*4919Sxy150489 return (e1000_disable_pcie_master_generic(hw)); 704*4919Sxy150489 } 705*4919Sxy150489 706*4919Sxy150489 /* 707*4919Sxy150489 * e1000_config_collision_dist - Configure collision distance 708*4919Sxy150489 * @hw: pointer to the HW structure 709*4919Sxy150489 * 710*4919Sxy150489 * Configures the collision distance to the default value and is used 711*4919Sxy150489 * during link setup. 712*4919Sxy150489 */ 713*4919Sxy150489 void 714*4919Sxy150489 e1000_config_collision_dist(struct e1000_hw *hw) 715*4919Sxy150489 { 716*4919Sxy150489 if (hw->func.config_collision_dist) 717*4919Sxy150489 hw->func.config_collision_dist(hw); 718*4919Sxy150489 } 719*4919Sxy150489 720*4919Sxy150489 /* 721*4919Sxy150489 * e1000_rar_set - Sets a receive address register 722*4919Sxy150489 * @hw: pointer to the HW structure 723*4919Sxy150489 * @addr: address to set the RAR to 724*4919Sxy150489 * @index: the RAR to set 725*4919Sxy150489 * 726*4919Sxy150489 * Sets a Receive Address Register (RAR) to the specified address. 727*4919Sxy150489 */ 728*4919Sxy150489 void 729*4919Sxy150489 e1000_rar_set(struct e1000_hw *hw, u8 * addr, u32 index) 730*4919Sxy150489 { 731*4919Sxy150489 if (hw->func.rar_set) 732*4919Sxy150489 hw->func.rar_set(hw, addr, index); 733*4919Sxy150489 } 734*4919Sxy150489 735*4919Sxy150489 /* 736*4919Sxy150489 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state 737*4919Sxy150489 * @hw: pointer to the HW structure 738*4919Sxy150489 * 739*4919Sxy150489 * Ensures that the MDI/MDIX SW state is valid. 740*4919Sxy150489 */ 741*4919Sxy150489 s32 742*4919Sxy150489 e1000_validate_mdi_setting(struct e1000_hw *hw) 743*4919Sxy150489 { 744*4919Sxy150489 if (hw->func.validate_mdi_setting) 745*4919Sxy150489 return (hw->func.validate_mdi_setting(hw)); 746*4919Sxy150489 747*4919Sxy150489 return (E1000_SUCCESS); 748*4919Sxy150489 } 749*4919Sxy150489 750*4919Sxy150489 /* 751*4919Sxy150489 * e1000_mta_set - Sets multicast table bit 752*4919Sxy150489 * @hw: pointer to the HW structure 753*4919Sxy150489 * @hash_value: Multicast hash value. 754*4919Sxy150489 * 755*4919Sxy150489 * This sets the bit in the multicast table corresponding to the 756*4919Sxy150489 * hash value. This is a function pointer entry point called by drivers. 757*4919Sxy150489 */ 758*4919Sxy150489 void 759*4919Sxy150489 e1000_mta_set(struct e1000_hw *hw, u32 hash_value) 760*4919Sxy150489 { 761*4919Sxy150489 if (hw->func.mta_set) 762*4919Sxy150489 hw->func.mta_set(hw, hash_value); 763*4919Sxy150489 } 764*4919Sxy150489 765*4919Sxy150489 /* 766*4919Sxy150489 * e1000_hash_mc_addr - Determines address location in multicast table 767*4919Sxy150489 * @hw: pointer to the HW structure 768*4919Sxy150489 * @mc_addr: Multicast address to hash. 769*4919Sxy150489 * 770*4919Sxy150489 * This hashes an address to determine its location in the multicast 771*4919Sxy150489 * table. Currently no func pointer exists and all implementations 772*4919Sxy150489 * are handled in the generic version of this function. 773*4919Sxy150489 */ 774*4919Sxy150489 u32 775*4919Sxy150489 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) 776*4919Sxy150489 { 777*4919Sxy150489 return (e1000_hash_mc_addr_generic(hw, mc_addr)); 778*4919Sxy150489 } 779*4919Sxy150489 780*4919Sxy150489 /* 781*4919Sxy150489 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX 782*4919Sxy150489 * @hw: pointer to the HW structure 783*4919Sxy150489 * 784*4919Sxy150489 * Enables packet filtering on transmit packets if manageability is enabled 785*4919Sxy150489 * and host interface is enabled. 786*4919Sxy150489 * Currently no func pointer exists and all implementations are handled in the 787*4919Sxy150489 * generic version of this function. 788*4919Sxy150489 */ 789*4919Sxy150489 boolean_t 790*4919Sxy150489 e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) 791*4919Sxy150489 { 792*4919Sxy150489 return (e1000_enable_tx_pkt_filtering_generic(hw)); 793*4919Sxy150489 } 794*4919Sxy150489 795*4919Sxy150489 /* 796*4919Sxy150489 * e1000_mng_host_if_write - Writes to the manageability host interface 797*4919Sxy150489 * @hw: pointer to the HW structure 798*4919Sxy150489 * @buffer: pointer to the host interface buffer 799*4919Sxy150489 * @length: size of the buffer 800*4919Sxy150489 * @offset: location in the buffer to write to 801*4919Sxy150489 * @sum: sum of the data (not checksum) 802*4919Sxy150489 * 803*4919Sxy150489 * This function writes the buffer content at the offset given on the host if. 804*4919Sxy150489 * It also does alignment considerations to do the writes in most efficient 805*4919Sxy150489 * way. Also fills up the sum of the buffer in *buffer parameter. 806*4919Sxy150489 */ 807*4919Sxy150489 s32 808*4919Sxy150489 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length, 809*4919Sxy150489 u16 offset, u8 *sum) 810*4919Sxy150489 { 811*4919Sxy150489 if (hw->func.mng_host_if_write) 812*4919Sxy150489 return (hw->func.mng_host_if_write(hw, buffer, length, offset, 813*4919Sxy150489 sum)); 814*4919Sxy150489 815*4919Sxy150489 return (E1000_NOT_IMPLEMENTED); 816*4919Sxy150489 } 817*4919Sxy150489 818*4919Sxy150489 /* 819*4919Sxy150489 * e1000_mng_write_cmd_header - Writes manageability command header 820*4919Sxy150489 * @hw: pointer to the HW structure 821*4919Sxy150489 * @hdr: pointer to the host interface command header 822*4919Sxy150489 * 823*4919Sxy150489 * Writes the command header after does the checksum calculation. 824*4919Sxy150489 */ 825*4919Sxy150489 s32 826*4919Sxy150489 e1000_mng_write_cmd_header(struct e1000_hw *hw, 827*4919Sxy150489 struct e1000_host_mng_command_header *hdr) 828*4919Sxy150489 { 829*4919Sxy150489 if (hw->func.mng_write_cmd_header) 830*4919Sxy150489 return (hw->func.mng_write_cmd_header(hw, hdr)); 831*4919Sxy150489 832*4919Sxy150489 return (E1000_NOT_IMPLEMENTED); 833*4919Sxy150489 } 834*4919Sxy150489 835*4919Sxy150489 /* 836*4919Sxy150489 * e1000_mng_enable_host_if - Checks host interface is enabled 837*4919Sxy150489 * @hw: pointer to the HW structure 838*4919Sxy150489 * 839*4919Sxy150489 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 840*4919Sxy150489 * 841*4919Sxy150489 * This function checks whether the HOST IF is enabled for command operaton 842*4919Sxy150489 * and also checks whether the previous command is completed. It busy waits 843*4919Sxy150489 * in case of previous command is not completed. 844*4919Sxy150489 */ 845*4919Sxy150489 s32 846*4919Sxy150489 e1000_mng_enable_host_if(struct e1000_hw *hw) 847*4919Sxy150489 { 848*4919Sxy150489 if (hw->func.mng_enable_host_if) 849*4919Sxy150489 return (hw->func.mng_enable_host_if(hw)); 850*4919Sxy150489 851*4919Sxy150489 return (E1000_NOT_IMPLEMENTED); 852*4919Sxy150489 } 853*4919Sxy150489 854*4919Sxy150489 /* 855*4919Sxy150489 * e1000_wait_autoneg - Waits for autonegotiation completion 856*4919Sxy150489 * @hw: pointer to the HW structure 857*4919Sxy150489 * 858*4919Sxy150489 * Waits for autoneg to complete. Currently no func pointer exists and all 859*4919Sxy150489 * implementations are handled in the generic version of this function. 860*4919Sxy150489 */ 861*4919Sxy150489 s32 862*4919Sxy150489 e1000_wait_autoneg(struct e1000_hw *hw) 863*4919Sxy150489 { 864*4919Sxy150489 if (hw->func.wait_autoneg) 865*4919Sxy150489 return (hw->func.wait_autoneg(hw)); 866*4919Sxy150489 867*4919Sxy150489 return (E1000_SUCCESS); 868*4919Sxy150489 } 869*4919Sxy150489 870*4919Sxy150489 /* 871*4919Sxy150489 * e1000_check_reset_block - Verifies PHY can be reset 872*4919Sxy150489 * @hw: pointer to the HW structure 873*4919Sxy150489 * 874*4919Sxy150489 * Checks if the PHY is in a state that can be reset or if manageability 875*4919Sxy150489 * has it tied up. This is a function pointer entry point called by drivers. 876*4919Sxy150489 */ 877*4919Sxy150489 s32 878*4919Sxy150489 e1000_check_reset_block(struct e1000_hw *hw) 879*4919Sxy150489 { 880*4919Sxy150489 if (hw->func.check_reset_block) 881*4919Sxy150489 return (hw->func.check_reset_block(hw)); 882*4919Sxy150489 883*4919Sxy150489 return (E1000_SUCCESS); 884*4919Sxy150489 } 885*4919Sxy150489 886*4919Sxy150489 /* 887*4919Sxy150489 * e1000_read_phy_reg - Reads PHY register 888*4919Sxy150489 * @hw: pointer to the HW structure 889*4919Sxy150489 * @offset: the register to read 890*4919Sxy150489 * @data: the buffer to store the 16-bit read. 891*4919Sxy150489 * 892*4919Sxy150489 * Reads the PHY register and returns the value in data. 893*4919Sxy150489 * This is a function pointer entry point called by drivers. 894*4919Sxy150489 */ 895*4919Sxy150489 s32 896*4919Sxy150489 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data) 897*4919Sxy150489 { 898*4919Sxy150489 if (hw->func.read_phy_reg) 899*4919Sxy150489 return (hw->func.read_phy_reg(hw, offset, data)); 900*4919Sxy150489 901*4919Sxy150489 return (E1000_SUCCESS); 902*4919Sxy150489 } 903*4919Sxy150489 904*4919Sxy150489 /* 905*4919Sxy150489 * e1000_write_phy_reg - Writes PHY register 906*4919Sxy150489 * @hw: pointer to the HW structure 907*4919Sxy150489 * @offset: the register to write 908*4919Sxy150489 * @data: the value to write. 909*4919Sxy150489 * 910*4919Sxy150489 * Writes the PHY register at offset with the value in data. 911*4919Sxy150489 * This is a function pointer entry point called by drivers. 912*4919Sxy150489 */ 913*4919Sxy150489 s32 914*4919Sxy150489 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data) 915*4919Sxy150489 { 916*4919Sxy150489 if (hw->func.write_phy_reg) 917*4919Sxy150489 return (hw->func.write_phy_reg(hw, offset, data)); 918*4919Sxy150489 919*4919Sxy150489 return (E1000_SUCCESS); 920*4919Sxy150489 } 921*4919Sxy150489 922*4919Sxy150489 /* 923*4919Sxy150489 * e1000_read_kmrn_reg - Reads register using Kumeran interface 924*4919Sxy150489 * @hw: pointer to the HW structure 925*4919Sxy150489 * @offset: the register to read 926*4919Sxy150489 * @data: the location to store the 16-bit value read. 927*4919Sxy150489 * 928*4919Sxy150489 * Reads a register out of the Kumeran interface. Currently no func pointer 929*4919Sxy150489 * exists and all implementations are handled in the generic version of 930*4919Sxy150489 * this function. 931*4919Sxy150489 */ 932*4919Sxy150489 s32 933*4919Sxy150489 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) 934*4919Sxy150489 { 935*4919Sxy150489 return (e1000_read_kmrn_reg_generic(hw, offset, data)); 936*4919Sxy150489 } 937*4919Sxy150489 938*4919Sxy150489 /* 939*4919Sxy150489 * e1000_write_kmrn_reg - Writes register using Kumeran interface 940*4919Sxy150489 * @hw: pointer to the HW structure 941*4919Sxy150489 * @offset: the register to write 942*4919Sxy150489 * @data: the value to write. 943*4919Sxy150489 * 944*4919Sxy150489 * Writes a register to the Kumeran interface. Currently no func pointer 945*4919Sxy150489 * exists and all implementations are handled in the generic version of 946*4919Sxy150489 * this function. 947*4919Sxy150489 */ 948*4919Sxy150489 s32 949*4919Sxy150489 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) 950*4919Sxy150489 { 951*4919Sxy150489 return (e1000_write_kmrn_reg_generic(hw, offset, data)); 952*4919Sxy150489 } 953*4919Sxy150489 954*4919Sxy150489 /* 955*4919Sxy150489 * e1000_get_cable_length - Retrieves cable length estimation 956*4919Sxy150489 * @hw: pointer to the HW structure 957*4919Sxy150489 * 958*4919Sxy150489 * This function estimates the cable length and stores them in 959*4919Sxy150489 * hw->phy.min_length and hw->phy.max_length. This is a function pointer 960*4919Sxy150489 * entry point called by drivers. 961*4919Sxy150489 */ 962*4919Sxy150489 s32 963*4919Sxy150489 e1000_get_cable_length(struct e1000_hw *hw) 964*4919Sxy150489 { 965*4919Sxy150489 if (hw->func.get_cable_length) 966*4919Sxy150489 return (hw->func.get_cable_length(hw)); 967*4919Sxy150489 968*4919Sxy150489 return (E1000_SUCCESS); 969*4919Sxy150489 } 970*4919Sxy150489 971*4919Sxy150489 /* 972*4919Sxy150489 * e1000_get_phy_info - Retrieves PHY information from registers 973*4919Sxy150489 * @hw: pointer to the HW structure 974*4919Sxy150489 * 975*4919Sxy150489 * This function gets some information from various PHY registers and 976*4919Sxy150489 * populates hw->phy values with it. This is a function pointer entry 977*4919Sxy150489 * point called by drivers. 978*4919Sxy150489 */ 979*4919Sxy150489 s32 980*4919Sxy150489 e1000_get_phy_info(struct e1000_hw *hw) 981*4919Sxy150489 { 982*4919Sxy150489 if (hw->func.get_phy_info) 983*4919Sxy150489 return (hw->func.get_phy_info(hw)); 984*4919Sxy150489 985*4919Sxy150489 return (E1000_SUCCESS); 986*4919Sxy150489 } 987*4919Sxy150489 988*4919Sxy150489 /* 989*4919Sxy150489 * e1000_phy_hw_reset - Hard PHY reset 990*4919Sxy150489 * @hw: pointer to the HW structure 991*4919Sxy150489 * 992*4919Sxy150489 * Performs a hard PHY reset. This is a function pointer entry point called 993*4919Sxy150489 * by drivers. 994*4919Sxy150489 */ 995*4919Sxy150489 s32 996*4919Sxy150489 e1000_phy_hw_reset(struct e1000_hw *hw) 997*4919Sxy150489 { 998*4919Sxy150489 if (hw->func.reset_phy) 999*4919Sxy150489 return (hw->func.reset_phy(hw)); 1000*4919Sxy150489 1001*4919Sxy150489 return (E1000_SUCCESS); 1002*4919Sxy150489 } 1003*4919Sxy150489 1004*4919Sxy150489 /* 1005*4919Sxy150489 * e1000_phy_commit - Soft PHY reset 1006*4919Sxy150489 * @hw: pointer to the HW structure 1007*4919Sxy150489 * 1008*4919Sxy150489 * Performs a soft PHY reset on those that apply. This is a function pointer 1009*4919Sxy150489 * entry point called by drivers. 1010*4919Sxy150489 */ 1011*4919Sxy150489 s32 1012*4919Sxy150489 e1000_phy_commit(struct e1000_hw *hw) 1013*4919Sxy150489 { 1014*4919Sxy150489 if (hw->func.commit_phy) 1015*4919Sxy150489 return (hw->func.commit_phy(hw)); 1016*4919Sxy150489 1017*4919Sxy150489 return (E1000_SUCCESS); 1018*4919Sxy150489 } 1019*4919Sxy150489 1020*4919Sxy150489 /* 1021*4919Sxy150489 * e1000_set_d3_lplu_state - Sets low power link up state for D0 1022*4919Sxy150489 * @hw: pointer to the HW structure 1023*4919Sxy150489 * @active: boolean used to enable/disable lplu 1024*4919Sxy150489 * 1025*4919Sxy150489 * Success returns 0, Failure returns 1 1026*4919Sxy150489 * 1027*4919Sxy150489 * The low power link up (lplu) state is set to the power management level D0 1028*4919Sxy150489 * and SmartSpeed is disabled when active is true, else clear lplu for D0 1029*4919Sxy150489 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 1030*4919Sxy150489 * is used during Dx states where the power conservation is most important. 1031*4919Sxy150489 * During driver activity, SmartSpeed should be enabled so performance is 1032*4919Sxy150489 * maintained. This is a function pointer entry point called by drivers. 1033*4919Sxy150489 */ 1034*4919Sxy150489 s32 1035*4919Sxy150489 e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active) 1036*4919Sxy150489 { 1037*4919Sxy150489 if (hw->func.set_d0_lplu_state) 1038*4919Sxy150489 return (hw->func.set_d0_lplu_state(hw, active)); 1039*4919Sxy150489 1040*4919Sxy150489 return (E1000_SUCCESS); 1041*4919Sxy150489 } 1042*4919Sxy150489 1043*4919Sxy150489 /* 1044*4919Sxy150489 * e1000_set_d3_lplu_state - Sets low power link up state for D3 1045*4919Sxy150489 * @hw: pointer to the HW structure 1046*4919Sxy150489 * @active: boolean used to enable/disable lplu 1047*4919Sxy150489 * 1048*4919Sxy150489 * Success returns 0, Failure returns 1 1049*4919Sxy150489 * 1050*4919Sxy150489 * The low power link up (lplu) state is set to the power management level D3 1051*4919Sxy150489 * and SmartSpeed is disabled when active is true, else clear lplu for D3 1052*4919Sxy150489 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 1053*4919Sxy150489 * is used during Dx states where the power conservation is most important. 1054*4919Sxy150489 * During driver activity, SmartSpeed should be enabled so performance is 1055*4919Sxy150489 * maintained. This is a function pointer entry point called by drivers. 1056*4919Sxy150489 */ 1057*4919Sxy150489 s32 1058*4919Sxy150489 e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active) 1059*4919Sxy150489 { 1060*4919Sxy150489 if (hw->func.set_d3_lplu_state) 1061*4919Sxy150489 return (hw->func.set_d3_lplu_state(hw, active)); 1062*4919Sxy150489 1063*4919Sxy150489 return (E1000_SUCCESS); 1064*4919Sxy150489 } 1065*4919Sxy150489 1066*4919Sxy150489 /* 1067*4919Sxy150489 * e1000_read_mac_addr - Reads MAC address 1068*4919Sxy150489 * @hw: pointer to the HW structure 1069*4919Sxy150489 * 1070*4919Sxy150489 * Reads the MAC address out of the adapter and stores it in the HW structure. 1071*4919Sxy150489 * Currently no func pointer exists and all implementations are handled in the 1072*4919Sxy150489 * generic version of this function. 1073*4919Sxy150489 */ 1074*4919Sxy150489 s32 1075*4919Sxy150489 e1000_read_mac_addr(struct e1000_hw *hw) 1076*4919Sxy150489 { 1077*4919Sxy150489 return (e1000_read_mac_addr_generic(hw)); 1078*4919Sxy150489 } 1079*4919Sxy150489 1080*4919Sxy150489 /* 1081*4919Sxy150489 * e1000_read_part_num - Read device part number 1082*4919Sxy150489 * @hw: pointer to the HW structure 1083*4919Sxy150489 * @part_num: pointer to device part number 1084*4919Sxy150489 * 1085*4919Sxy150489 * Reads the product board assembly (PBA) number from the EEPROM and stores 1086*4919Sxy150489 * the value in part_num. 1087*4919Sxy150489 * Currently no func pointer exists and all implementations are handled in the 1088*4919Sxy150489 * generic version of this function. 1089*4919Sxy150489 */ 1090*4919Sxy150489 s32 1091*4919Sxy150489 e1000_read_part_num(struct e1000_hw *hw, u32 * part_num) 1092*4919Sxy150489 { 1093*4919Sxy150489 return (e1000_read_part_num_generic(hw, part_num)); 1094*4919Sxy150489 } 1095*4919Sxy150489 1096*4919Sxy150489 /* 1097*4919Sxy150489 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum 1098*4919Sxy150489 * @hw: pointer to the HW structure 1099*4919Sxy150489 * 1100*4919Sxy150489 * Validates the NVM checksum is correct. This is a function pointer entry 1101*4919Sxy150489 * point called by drivers. 1102*4919Sxy150489 */ 1103*4919Sxy150489 s32 1104*4919Sxy150489 e1000_validate_nvm_checksum(struct e1000_hw *hw) 1105*4919Sxy150489 { 1106*4919Sxy150489 if (hw->func.validate_nvm) 1107*4919Sxy150489 return (hw->func.validate_nvm(hw)); 1108*4919Sxy150489 1109*4919Sxy150489 return (-E1000_ERR_CONFIG); 1110*4919Sxy150489 } 1111*4919Sxy150489 1112*4919Sxy150489 /* 1113*4919Sxy150489 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum 1114*4919Sxy150489 * @hw: pointer to the HW structure 1115*4919Sxy150489 * 1116*4919Sxy150489 * Updates the NVM checksum. Currently no func pointer exists and all 1117*4919Sxy150489 * implementations are handled in the generic version of this function. 1118*4919Sxy150489 */ 1119*4919Sxy150489 s32 1120*4919Sxy150489 e1000_update_nvm_checksum(struct e1000_hw *hw) 1121*4919Sxy150489 { 1122*4919Sxy150489 if (hw->func.update_nvm) 1123*4919Sxy150489 return (hw->func.update_nvm(hw)); 1124*4919Sxy150489 1125*4919Sxy150489 return (-E1000_ERR_CONFIG); 1126*4919Sxy150489 } 1127*4919Sxy150489 1128*4919Sxy150489 /* 1129*4919Sxy150489 * e1000_reload_nvm - Reloads EEPROM 1130*4919Sxy150489 * @hw: pointer to the HW structure 1131*4919Sxy150489 * 1132*4919Sxy150489 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the 1133*4919Sxy150489 * extended control register. 1134*4919Sxy150489 */ 1135*4919Sxy150489 void 1136*4919Sxy150489 e1000_reload_nvm(struct e1000_hw *hw) 1137*4919Sxy150489 { 1138*4919Sxy150489 if (hw->func.reload_nvm) 1139*4919Sxy150489 hw->func.reload_nvm(hw); 1140*4919Sxy150489 } 1141*4919Sxy150489 1142*4919Sxy150489 /* 1143*4919Sxy150489 * e1000_read_nvm - Reads NVM (EEPROM) 1144*4919Sxy150489 * @hw: pointer to the HW structure 1145*4919Sxy150489 * @offset: the word offset to read 1146*4919Sxy150489 * @words: number of 16-bit words to read 1147*4919Sxy150489 * @data: pointer to the properly sized buffer for the data. 1148*4919Sxy150489 * 1149*4919Sxy150489 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function 1150*4919Sxy150489 * pointer entry point called by drivers. 1151*4919Sxy150489 */ 1152*4919Sxy150489 s32 1153*4919Sxy150489 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 1154*4919Sxy150489 { 1155*4919Sxy150489 if (hw->func.read_nvm) 1156*4919Sxy150489 return (hw->func.read_nvm(hw, offset, words, data)); 1157*4919Sxy150489 1158*4919Sxy150489 return (-E1000_ERR_CONFIG); 1159*4919Sxy150489 } 1160*4919Sxy150489 1161*4919Sxy150489 /* 1162*4919Sxy150489 * e1000_write_nvm - Writes to NVM (EEPROM) 1163*4919Sxy150489 * @hw: pointer to the HW structure 1164*4919Sxy150489 * @offset: the word offset to read 1165*4919Sxy150489 * @words: number of 16-bit words to write 1166*4919Sxy150489 * @data: pointer to the properly sized buffer for the data. 1167*4919Sxy150489 * 1168*4919Sxy150489 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function 1169*4919Sxy150489 * pointer entry point called by drivers. 1170*4919Sxy150489 */ 1171*4919Sxy150489 s32 1172*4919Sxy150489 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 1173*4919Sxy150489 { 1174*4919Sxy150489 if (hw->func.write_nvm) 1175*4919Sxy150489 return (hw->func.write_nvm(hw, offset, words, data)); 1176*4919Sxy150489 1177*4919Sxy150489 return (E1000_SUCCESS); 1178*4919Sxy150489 } 1179*4919Sxy150489 1180*4919Sxy150489 /* 1181*4919Sxy150489 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register 1182*4919Sxy150489 * @hw: pointer to the HW structure 1183*4919Sxy150489 * @reg: 32bit register offset 1184*4919Sxy150489 * @offset: the register to write 1185*4919Sxy150489 * @data: the value to write. 1186*4919Sxy150489 * 1187*4919Sxy150489 * Writes the PHY register at offset with the value in data. 1188*4919Sxy150489 * This is a function pointer entry point called by drivers. 1189*4919Sxy150489 */ 1190*4919Sxy150489 s32 1191*4919Sxy150489 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data) 1192*4919Sxy150489 { 1193*4919Sxy150489 return (e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data)); 1194*4919Sxy150489 } 1195