15779Sxy150489 /* 25779Sxy150489 * CDDL HEADER START 35779Sxy150489 * 48571SChenlu.Chen@Sun.COM * Copyright(c) 2007-2009 Intel Corporation. All rights reserved. 55779Sxy150489 * The contents of this file are subject to the terms of the 65779Sxy150489 * Common Development and Distribution License (the "License"). 75779Sxy150489 * You may not use this file except in compliance with the License. 85779Sxy150489 * 95779Sxy150489 * You can obtain a copy of the license at: 105779Sxy150489 * http://www.opensolaris.org/os/licensing. 115779Sxy150489 * See the License for the specific language governing permissions 125779Sxy150489 * and limitations under the License. 135779Sxy150489 * 145779Sxy150489 * When using or redistributing this file, you may do so under the 155779Sxy150489 * License only. No other modification of this header is permitted. 165779Sxy150489 * 175779Sxy150489 * If applicable, add the following below this CDDL HEADER, with the 185779Sxy150489 * fields enclosed by brackets "[]" replaced with your own identifying 195779Sxy150489 * information: Portions Copyright [yyyy] [name of copyright owner] 205779Sxy150489 * 215779Sxy150489 * CDDL HEADER END 225779Sxy150489 */ 235779Sxy150489 245779Sxy150489 /* 258571SChenlu.Chen@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 265779Sxy150489 * Use is subject to license terms of the CDDL. 275779Sxy150489 */ 285779Sxy150489 29*11155SJason.Xu@Sun.COM /* IntelVersion: 1.128 scm_100809_154340 */ 305779Sxy150489 315779Sxy150489 #include "igb_api.h" 325779Sxy150489 335779Sxy150489 /* 345779Sxy150489 * e1000_init_mac_params - Initialize MAC function pointers 355779Sxy150489 * @hw: pointer to the HW structure 365779Sxy150489 * 375779Sxy150489 * This function initializes the function pointers for the MAC 385779Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 395779Sxy150489 */ 405779Sxy150489 s32 415779Sxy150489 e1000_init_mac_params(struct e1000_hw *hw) 425779Sxy150489 { 435779Sxy150489 s32 ret_val = E1000_SUCCESS; 445779Sxy150489 458571SChenlu.Chen@Sun.COM if (hw->mac.ops.init_params) { 468571SChenlu.Chen@Sun.COM ret_val = hw->mac.ops.init_params(hw); 475779Sxy150489 if (ret_val) { 485779Sxy150489 DEBUGOUT("MAC Initialization Error\n"); 495779Sxy150489 goto out; 505779Sxy150489 } 515779Sxy150489 } else { 525779Sxy150489 DEBUGOUT("mac.init_mac_params was NULL\n"); 535779Sxy150489 ret_val = -E1000_ERR_CONFIG; 545779Sxy150489 } 555779Sxy150489 565779Sxy150489 out: 575779Sxy150489 return (ret_val); 585779Sxy150489 } 595779Sxy150489 605779Sxy150489 /* 615779Sxy150489 * e1000_init_nvm_params - Initialize NVM function pointers 625779Sxy150489 * @hw: pointer to the HW structure 635779Sxy150489 * 645779Sxy150489 * This function initializes the function pointers for the NVM 655779Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 665779Sxy150489 */ 675779Sxy150489 s32 685779Sxy150489 e1000_init_nvm_params(struct e1000_hw *hw) 695779Sxy150489 { 705779Sxy150489 s32 ret_val = E1000_SUCCESS; 715779Sxy150489 728571SChenlu.Chen@Sun.COM if (hw->nvm.ops.init_params) { 738571SChenlu.Chen@Sun.COM ret_val = hw->nvm.ops.init_params(hw); 745779Sxy150489 if (ret_val) { 755779Sxy150489 DEBUGOUT("NVM Initialization Error\n"); 765779Sxy150489 goto out; 775779Sxy150489 } 785779Sxy150489 } else { 795779Sxy150489 DEBUGOUT("nvm.init_nvm_params was NULL\n"); 805779Sxy150489 ret_val = -E1000_ERR_CONFIG; 815779Sxy150489 } 825779Sxy150489 835779Sxy150489 out: 845779Sxy150489 return (ret_val); 855779Sxy150489 } 865779Sxy150489 875779Sxy150489 /* 885779Sxy150489 * e1000_init_phy_params - Initialize PHY function pointers 895779Sxy150489 * @hw: pointer to the HW structure 905779Sxy150489 * 915779Sxy150489 * This function initializes the function pointers for the PHY 925779Sxy150489 * set of functions. Called by drivers or by e1000_setup_init_funcs. 935779Sxy150489 */ 945779Sxy150489 s32 955779Sxy150489 e1000_init_phy_params(struct e1000_hw *hw) 965779Sxy150489 { 975779Sxy150489 s32 ret_val = E1000_SUCCESS; 985779Sxy150489 998571SChenlu.Chen@Sun.COM if (hw->phy.ops.init_params) { 1008571SChenlu.Chen@Sun.COM ret_val = hw->phy.ops.init_params(hw); 1015779Sxy150489 if (ret_val) { 1025779Sxy150489 DEBUGOUT("PHY Initialization Error\n"); 1035779Sxy150489 goto out; 1045779Sxy150489 } 1055779Sxy150489 } else { 1065779Sxy150489 DEBUGOUT("phy.init_phy_params was NULL\n"); 1075779Sxy150489 ret_val = -E1000_ERR_CONFIG; 1085779Sxy150489 } 1095779Sxy150489 1105779Sxy150489 out: 1115779Sxy150489 return (ret_val); 1125779Sxy150489 } 1135779Sxy150489 1145779Sxy150489 /* 1155779Sxy150489 * e1000_set_mac_type - Sets MAC type 1165779Sxy150489 * @hw: pointer to the HW structure 1175779Sxy150489 * 1185779Sxy150489 * This function sets the mac type of the adapter based on the 1195779Sxy150489 * device ID stored in the hw structure. 1205779Sxy150489 * MUST BE FIRST FUNCTION CALLED (explicitly or through 1215779Sxy150489 * e1000_setup_init_funcs()). 1225779Sxy150489 */ 1235779Sxy150489 s32 1245779Sxy150489 e1000_set_mac_type(struct e1000_hw *hw) 1255779Sxy150489 { 1265779Sxy150489 struct e1000_mac_info *mac = &hw->mac; 1275779Sxy150489 s32 ret_val = E1000_SUCCESS; 1285779Sxy150489 1295779Sxy150489 DEBUGFUNC("e1000_set_mac_type"); 1305779Sxy150489 1315779Sxy150489 switch (hw->device_id) { 1325779Sxy150489 case E1000_DEV_ID_82575EB_COPPER: 1335779Sxy150489 case E1000_DEV_ID_82575EB_FIBER_SERDES: 1345779Sxy150489 case E1000_DEV_ID_82575GB_QUAD_COPPER: 1355779Sxy150489 mac->type = e1000_82575; 1365779Sxy150489 break; 1378571SChenlu.Chen@Sun.COM case E1000_DEV_ID_82576: 1388571SChenlu.Chen@Sun.COM case E1000_DEV_ID_82576_FIBER: 1398571SChenlu.Chen@Sun.COM case E1000_DEV_ID_82576_SERDES: 1408571SChenlu.Chen@Sun.COM case E1000_DEV_ID_82576_QUAD_COPPER: 14110319SJason.Xu@Sun.COM case E1000_DEV_ID_82576_NS: 142*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82576_NS_SERDES: 14310319SJason.Xu@Sun.COM case E1000_DEV_ID_82576_SERDES_QUAD: 1448571SChenlu.Chen@Sun.COM mac->type = e1000_82576; 1458571SChenlu.Chen@Sun.COM break; 146*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82580_COPPER: 147*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82580_FIBER: 148*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82580_SERDES: 149*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82580_SGMII: 150*11155SJason.Xu@Sun.COM case E1000_DEV_ID_82580_COPPER_DUAL: 151*11155SJason.Xu@Sun.COM mac->type = e1000_82580; 152*11155SJason.Xu@Sun.COM break; 1535779Sxy150489 default: 1545779Sxy150489 /* Should never have loaded on this device */ 1555779Sxy150489 ret_val = -E1000_ERR_MAC_INIT; 1565779Sxy150489 break; 1575779Sxy150489 } 1585779Sxy150489 1595779Sxy150489 return (ret_val); 1605779Sxy150489 } 1615779Sxy150489 1625779Sxy150489 /* 1635779Sxy150489 * e1000_setup_init_funcs - Initializes function pointers 1645779Sxy150489 * @hw: pointer to the HW structure 1658571SChenlu.Chen@Sun.COM * @init_device: true will initialize the rest of the function pointers 1668571SChenlu.Chen@Sun.COM * getting the device ready for use. false will only set 1675779Sxy150489 * MAC type and the function pointers for the other init 1688571SChenlu.Chen@Sun.COM * functions. Passing false will not generate any hardware 1695779Sxy150489 * reads or writes. 1705779Sxy150489 * 1715779Sxy150489 * This function must be called by a driver in order to use the rest 1725779Sxy150489 * of the 'shared' code files. Called by drivers only. 1735779Sxy150489 */ 1745779Sxy150489 s32 1755779Sxy150489 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) 1765779Sxy150489 { 1775779Sxy150489 s32 ret_val; 1785779Sxy150489 1795779Sxy150489 /* Can't do much good without knowing the MAC type. */ 1805779Sxy150489 ret_val = e1000_set_mac_type(hw); 1815779Sxy150489 if (ret_val) { 1825779Sxy150489 DEBUGOUT("ERROR: MAC type could not be set properly.\n"); 1835779Sxy150489 goto out; 1845779Sxy150489 } 1855779Sxy150489 1865779Sxy150489 if (!hw->hw_addr) { 1875779Sxy150489 DEBUGOUT("ERROR: Registers not mapped\n"); 1885779Sxy150489 ret_val = -E1000_ERR_CONFIG; 1895779Sxy150489 goto out; 1905779Sxy150489 } 1915779Sxy150489 1925779Sxy150489 /* 1938571SChenlu.Chen@Sun.COM * Init function pointers to generic implementations. We do this first 1948571SChenlu.Chen@Sun.COM * allowing a driver module to override it afterward. 1955779Sxy150489 */ 1968571SChenlu.Chen@Sun.COM e1000_init_mac_ops_generic(hw); 1978571SChenlu.Chen@Sun.COM e1000_init_phy_ops_generic(hw); 1988571SChenlu.Chen@Sun.COM e1000_init_nvm_ops_generic(hw); 1995779Sxy150489 2005779Sxy150489 /* 2015779Sxy150489 * Set up the init function pointers. These are functions within the 2025779Sxy150489 * adapter family file that sets up function pointers for the rest of 2035779Sxy150489 * the functions in that family. 2045779Sxy150489 */ 2055779Sxy150489 switch (hw->mac.type) { 2065779Sxy150489 case e1000_82575: 2078571SChenlu.Chen@Sun.COM case e1000_82576: 208*11155SJason.Xu@Sun.COM case e1000_82580: 2095779Sxy150489 e1000_init_function_pointers_82575(hw); 2105779Sxy150489 break; 2115779Sxy150489 default: 2125779Sxy150489 DEBUGOUT("Hardware not supported\n"); 2135779Sxy150489 ret_val = -E1000_ERR_CONFIG; 2145779Sxy150489 break; 2155779Sxy150489 } 2165779Sxy150489 2175779Sxy150489 /* 2185779Sxy150489 * Initialize the rest of the function pointers. These require some 2195779Sxy150489 * register reads/writes in some cases. 2205779Sxy150489 */ 2215779Sxy150489 if (!(ret_val) && init_device) { 2225779Sxy150489 ret_val = e1000_init_mac_params(hw); 2235779Sxy150489 if (ret_val) 2245779Sxy150489 goto out; 2255779Sxy150489 2265779Sxy150489 ret_val = e1000_init_nvm_params(hw); 2275779Sxy150489 if (ret_val) 2285779Sxy150489 goto out; 2295779Sxy150489 2305779Sxy150489 ret_val = e1000_init_phy_params(hw); 2315779Sxy150489 if (ret_val) 2325779Sxy150489 goto out; 2335779Sxy150489 2345779Sxy150489 } 2355779Sxy150489 2365779Sxy150489 out: 2375779Sxy150489 return (ret_val); 2385779Sxy150489 } 2395779Sxy150489 2405779Sxy150489 /* 2415779Sxy150489 * e1000_get_bus_info - Obtain bus information for adapter 2425779Sxy150489 * @hw: pointer to the HW structure 2435779Sxy150489 * 2445779Sxy150489 * This will obtain information about the HW bus for which the 2458571SChenlu.Chen@Sun.COM * adapter is attached and stores it in the hw structure. This is a 2465779Sxy150489 * function pointer entry point called by drivers. 2475779Sxy150489 */ 2485779Sxy150489 s32 2495779Sxy150489 e1000_get_bus_info(struct e1000_hw *hw) 2505779Sxy150489 { 2518571SChenlu.Chen@Sun.COM if (hw->mac.ops.get_bus_info) 2528571SChenlu.Chen@Sun.COM return (hw->mac.ops.get_bus_info(hw)); 2535779Sxy150489 2545779Sxy150489 return (E1000_SUCCESS); 2555779Sxy150489 } 2565779Sxy150489 2575779Sxy150489 /* 2585779Sxy150489 * e1000_clear_vfta - Clear VLAN filter table 2595779Sxy150489 * @hw: pointer to the HW structure 2605779Sxy150489 * 2615779Sxy150489 * This clears the VLAN filter table on the adapter. This is a function 2625779Sxy150489 * pointer entry point called by drivers. 2635779Sxy150489 */ 2645779Sxy150489 void 2655779Sxy150489 e1000_clear_vfta(struct e1000_hw *hw) 2665779Sxy150489 { 2678571SChenlu.Chen@Sun.COM if (hw->mac.ops.clear_vfta) 2688571SChenlu.Chen@Sun.COM hw->mac.ops.clear_vfta(hw); 2695779Sxy150489 } 2705779Sxy150489 2715779Sxy150489 /* 2725779Sxy150489 * e1000_write_vfta - Write value to VLAN filter table 2735779Sxy150489 * @hw: pointer to the HW structure 2745779Sxy150489 * @offset: the 32-bit offset in which to write the value to. 2755779Sxy150489 * @value: the 32-bit value to write at location offset. 2765779Sxy150489 * 2775779Sxy150489 * This writes a 32-bit value to a 32-bit offset in the VLAN filter 2785779Sxy150489 * table. This is a function pointer entry point called by drivers. 2795779Sxy150489 */ 2805779Sxy150489 void 2815779Sxy150489 e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) 2825779Sxy150489 { 2838571SChenlu.Chen@Sun.COM if (hw->mac.ops.write_vfta) 2848571SChenlu.Chen@Sun.COM hw->mac.ops.write_vfta(hw, offset, value); 2855779Sxy150489 } 2865779Sxy150489 2875779Sxy150489 /* 2885779Sxy150489 * e1000_update_mc_addr_list - Update Multicast addresses 2895779Sxy150489 * @hw: pointer to the HW structure 2905779Sxy150489 * @mc_addr_list: array of multicast addresses to program 2915779Sxy150489 * @mc_addr_count: number of multicast addresses to program 2925779Sxy150489 * 29310319SJason.Xu@Sun.COM * Updates the Multicast Table Array. 2945779Sxy150489 * The caller must have a packed mc_addr_list of multicast addresses. 2955779Sxy150489 */ 2965779Sxy150489 void 2975779Sxy150489 e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, 29810319SJason.Xu@Sun.COM u32 mc_addr_count) 2995779Sxy150489 { 3008571SChenlu.Chen@Sun.COM if (hw->mac.ops.update_mc_addr_list) 3018571SChenlu.Chen@Sun.COM hw->mac.ops.update_mc_addr_list(hw, 30210319SJason.Xu@Sun.COM mc_addr_list, mc_addr_count); 3035779Sxy150489 } 3045779Sxy150489 3055779Sxy150489 /* 3065779Sxy150489 * e1000_force_mac_fc - Force MAC flow control 3075779Sxy150489 * @hw: pointer to the HW structure 3085779Sxy150489 * 3095779Sxy150489 * Force the MAC's flow control settings. Currently no func pointer exists 3105779Sxy150489 * and all implementations are handled in the generic version of this 3115779Sxy150489 * function. 3125779Sxy150489 */ 3135779Sxy150489 s32 3145779Sxy150489 e1000_force_mac_fc(struct e1000_hw *hw) 3155779Sxy150489 { 3165779Sxy150489 return (e1000_force_mac_fc_generic(hw)); 3175779Sxy150489 } 3185779Sxy150489 3195779Sxy150489 /* 3205779Sxy150489 * e1000_check_for_link - Check/Store link connection 3215779Sxy150489 * @hw: pointer to the HW structure 3225779Sxy150489 * 3235779Sxy150489 * This checks the link condition of the adapter and stores the 3245779Sxy150489 * results in the hw->mac structure. This is a function pointer entry 3255779Sxy150489 * point called by drivers. 3265779Sxy150489 */ 3275779Sxy150489 s32 3285779Sxy150489 e1000_check_for_link(struct e1000_hw *hw) 3295779Sxy150489 { 3308571SChenlu.Chen@Sun.COM if (hw->mac.ops.check_for_link) 3318571SChenlu.Chen@Sun.COM return (hw->mac.ops.check_for_link(hw)); 3325779Sxy150489 3335779Sxy150489 return (-E1000_ERR_CONFIG); 3345779Sxy150489 } 3355779Sxy150489 3365779Sxy150489 /* 3375779Sxy150489 * e1000_check_mng_mode - Check management mode 3385779Sxy150489 * @hw: pointer to the HW structure 3395779Sxy150489 * 3405779Sxy150489 * This checks if the adapter has manageability enabled. 3415779Sxy150489 * This is a function pointer entry point called by drivers. 3425779Sxy150489 */ 3435779Sxy150489 bool 3445779Sxy150489 e1000_check_mng_mode(struct e1000_hw *hw) 3455779Sxy150489 { 3468571SChenlu.Chen@Sun.COM if (hw->mac.ops.check_mng_mode) 3478571SChenlu.Chen@Sun.COM return (hw->mac.ops.check_mng_mode(hw)); 3485779Sxy150489 3498571SChenlu.Chen@Sun.COM return (false); 3505779Sxy150489 } 3515779Sxy150489 3525779Sxy150489 /* 3535779Sxy150489 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface 3545779Sxy150489 * @hw: pointer to the HW structure 3555779Sxy150489 * @buffer: pointer to the host interface 3565779Sxy150489 * @length: size of the buffer 3575779Sxy150489 * 3585779Sxy150489 * Writes the DHCP information to the host interface. 3595779Sxy150489 */ 3605779Sxy150489 s32 3615779Sxy150489 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length) 3625779Sxy150489 { 3635779Sxy150489 return (e1000_mng_write_dhcp_info_generic(hw, buffer, length)); 3645779Sxy150489 } 3655779Sxy150489 3665779Sxy150489 /* 3675779Sxy150489 * e1000_reset_hw - Reset hardware 3685779Sxy150489 * @hw: pointer to the HW structure 3695779Sxy150489 * 3705779Sxy150489 * This resets the hardware into a known state. This is a function pointer 3715779Sxy150489 * entry point called by drivers. 3725779Sxy150489 */ 3735779Sxy150489 s32 3745779Sxy150489 e1000_reset_hw(struct e1000_hw *hw) 3755779Sxy150489 { 3768571SChenlu.Chen@Sun.COM if (hw->mac.ops.reset_hw) 3778571SChenlu.Chen@Sun.COM return (hw->mac.ops.reset_hw(hw)); 3785779Sxy150489 3795779Sxy150489 return (-E1000_ERR_CONFIG); 3805779Sxy150489 } 3815779Sxy150489 3825779Sxy150489 /* 3835779Sxy150489 * e1000_init_hw - Initialize hardware 3845779Sxy150489 * @hw: pointer to the HW structure 3855779Sxy150489 * 3865779Sxy150489 * This inits the hardware readying it for operation. This is a function 3875779Sxy150489 * pointer entry point called by drivers. 3885779Sxy150489 */ 3895779Sxy150489 s32 3905779Sxy150489 e1000_init_hw(struct e1000_hw *hw) 3915779Sxy150489 { 3928571SChenlu.Chen@Sun.COM if (hw->mac.ops.init_hw) 3938571SChenlu.Chen@Sun.COM return (hw->mac.ops.init_hw(hw)); 3945779Sxy150489 3955779Sxy150489 return (-E1000_ERR_CONFIG); 3965779Sxy150489 } 3975779Sxy150489 3985779Sxy150489 /* 3995779Sxy150489 * e1000_setup_link - Configures link and flow control 4005779Sxy150489 * @hw: pointer to the HW structure 4015779Sxy150489 * 4025779Sxy150489 * This configures link and flow control settings for the adapter. This 4035779Sxy150489 * is a function pointer entry point called by drivers. While modules can 4045779Sxy150489 * also call this, they probably call their own version of this function. 4055779Sxy150489 */ 4065779Sxy150489 s32 4075779Sxy150489 e1000_setup_link(struct e1000_hw *hw) 4085779Sxy150489 { 4098571SChenlu.Chen@Sun.COM if (hw->mac.ops.setup_link) 4108571SChenlu.Chen@Sun.COM return (hw->mac.ops.setup_link(hw)); 4115779Sxy150489 4125779Sxy150489 return (-E1000_ERR_CONFIG); 4135779Sxy150489 } 4145779Sxy150489 4155779Sxy150489 /* 4165779Sxy150489 * e1000_get_speed_and_duplex - Returns current speed and duplex 4175779Sxy150489 * @hw: pointer to the HW structure 4185779Sxy150489 * @speed: pointer to a 16-bit value to store the speed 4195779Sxy150489 * @duplex: pointer to a 16-bit value to store the duplex. 4205779Sxy150489 * 4215779Sxy150489 * This returns the speed and duplex of the adapter in the two 'out' 4225779Sxy150489 * variables passed in. This is a function pointer entry point called 4235779Sxy150489 * by drivers. 4245779Sxy150489 */ 4255779Sxy150489 s32 4265779Sxy150489 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) 4275779Sxy150489 { 4288571SChenlu.Chen@Sun.COM if (hw->mac.ops.get_link_up_info) 4298571SChenlu.Chen@Sun.COM return (hw->mac.ops.get_link_up_info(hw, speed, duplex)); 4305779Sxy150489 4315779Sxy150489 return (-E1000_ERR_CONFIG); 4325779Sxy150489 } 4335779Sxy150489 4345779Sxy150489 /* 4355779Sxy150489 * e1000_setup_led - Configures SW controllable LED 4365779Sxy150489 * @hw: pointer to the HW structure 4375779Sxy150489 * 4385779Sxy150489 * This prepares the SW controllable LED for use and saves the current state 4395779Sxy150489 * of the LED so it can be later restored. This is a function pointer entry 4405779Sxy150489 * point called by drivers. 4415779Sxy150489 */ 4425779Sxy150489 s32 4435779Sxy150489 e1000_setup_led(struct e1000_hw *hw) 4445779Sxy150489 { 4458571SChenlu.Chen@Sun.COM if (hw->mac.ops.setup_led) 4468571SChenlu.Chen@Sun.COM return (hw->mac.ops.setup_led(hw)); 4475779Sxy150489 4485779Sxy150489 return (E1000_SUCCESS); 4495779Sxy150489 } 4505779Sxy150489 4515779Sxy150489 /* 4525779Sxy150489 * e1000_cleanup_led - Restores SW controllable LED 4535779Sxy150489 * @hw: pointer to the HW structure 4545779Sxy150489 * 4555779Sxy150489 * This restores the SW controllable LED to the value saved off by 4565779Sxy150489 * e1000_setup_led. This is a function pointer entry point called by drivers. 4575779Sxy150489 */ 4585779Sxy150489 s32 4595779Sxy150489 e1000_cleanup_led(struct e1000_hw *hw) 4605779Sxy150489 { 4618571SChenlu.Chen@Sun.COM if (hw->mac.ops.cleanup_led) 4628571SChenlu.Chen@Sun.COM return (hw->mac.ops.cleanup_led(hw)); 4635779Sxy150489 4645779Sxy150489 return (E1000_SUCCESS); 4655779Sxy150489 } 4665779Sxy150489 4675779Sxy150489 /* 4685779Sxy150489 * e1000_blink_led - Blink SW controllable LED 4695779Sxy150489 * @hw: pointer to the HW structure 4705779Sxy150489 * 4715779Sxy150489 * This starts the adapter LED blinking. Request the LED to be setup first 4725779Sxy150489 * and cleaned up after. This is a function pointer entry point called by 4735779Sxy150489 * drivers. 4745779Sxy150489 */ 4755779Sxy150489 s32 4765779Sxy150489 e1000_blink_led(struct e1000_hw *hw) 4775779Sxy150489 { 4788571SChenlu.Chen@Sun.COM if (hw->mac.ops.blink_led) 4798571SChenlu.Chen@Sun.COM return (hw->mac.ops.blink_led(hw)); 4805779Sxy150489 4815779Sxy150489 return (E1000_SUCCESS); 4825779Sxy150489 } 4835779Sxy150489 4845779Sxy150489 /* 48510319SJason.Xu@Sun.COM * e1000_id_led_init - store LED configurations in SW 48610319SJason.Xu@Sun.COM * @hw: pointer to the HW structure 48710319SJason.Xu@Sun.COM * 48810319SJason.Xu@Sun.COM * Initializes the LED config in SW. This is a function pointer entry point 48910319SJason.Xu@Sun.COM * called by drivers. 49010319SJason.Xu@Sun.COM */ 49110319SJason.Xu@Sun.COM s32 49210319SJason.Xu@Sun.COM e1000_id_led_init(struct e1000_hw *hw) 49310319SJason.Xu@Sun.COM { 49410319SJason.Xu@Sun.COM if (hw->mac.ops.id_led_init) 49510319SJason.Xu@Sun.COM return (hw->mac.ops.id_led_init(hw)); 49610319SJason.Xu@Sun.COM 49710319SJason.Xu@Sun.COM return (E1000_SUCCESS); 49810319SJason.Xu@Sun.COM } 49910319SJason.Xu@Sun.COM 50010319SJason.Xu@Sun.COM /* 5015779Sxy150489 * e1000_led_on - Turn on SW controllable LED 5025779Sxy150489 * @hw: pointer to the HW structure 5035779Sxy150489 * 5045779Sxy150489 * Turns the SW defined LED on. This is a function pointer entry point 5055779Sxy150489 * called by drivers. 5065779Sxy150489 */ 5075779Sxy150489 s32 5085779Sxy150489 e1000_led_on(struct e1000_hw *hw) 5095779Sxy150489 { 5108571SChenlu.Chen@Sun.COM if (hw->mac.ops.led_on) 5118571SChenlu.Chen@Sun.COM return (hw->mac.ops.led_on(hw)); 5125779Sxy150489 5135779Sxy150489 return (E1000_SUCCESS); 5145779Sxy150489 } 5155779Sxy150489 5165779Sxy150489 /* 5175779Sxy150489 * e1000_led_off - Turn off SW controllable LED 5185779Sxy150489 * @hw: pointer to the HW structure 5195779Sxy150489 * 5205779Sxy150489 * Turns the SW defined LED off. This is a function pointer entry point 5215779Sxy150489 * called by drivers. 5225779Sxy150489 */ 5235779Sxy150489 s32 5245779Sxy150489 e1000_led_off(struct e1000_hw *hw) 5255779Sxy150489 { 5268571SChenlu.Chen@Sun.COM if (hw->mac.ops.led_off) 5278571SChenlu.Chen@Sun.COM return (hw->mac.ops.led_off(hw)); 5285779Sxy150489 5295779Sxy150489 return (E1000_SUCCESS); 5305779Sxy150489 } 5315779Sxy150489 5325779Sxy150489 /* 5335779Sxy150489 * e1000_reset_adaptive - Reset adaptive IFS 5345779Sxy150489 * @hw: pointer to the HW structure 5355779Sxy150489 * 5365779Sxy150489 * Resets the adaptive IFS. Currently no func pointer exists and all 5375779Sxy150489 * implementations are handled in the generic version of this function. 5385779Sxy150489 */ 5395779Sxy150489 void 5405779Sxy150489 e1000_reset_adaptive(struct e1000_hw *hw) 5415779Sxy150489 { 5425779Sxy150489 e1000_reset_adaptive_generic(hw); 5435779Sxy150489 } 5445779Sxy150489 5455779Sxy150489 /* 5465779Sxy150489 * e1000_update_adaptive - Update adaptive IFS 5475779Sxy150489 * @hw: pointer to the HW structure 5485779Sxy150489 * 5495779Sxy150489 * Updates adapter IFS. Currently no func pointer exists and all 5505779Sxy150489 * implementations are handled in the generic version of this function. 5515779Sxy150489 */ 5525779Sxy150489 void 5535779Sxy150489 e1000_update_adaptive(struct e1000_hw *hw) 5545779Sxy150489 { 5555779Sxy150489 e1000_update_adaptive_generic(hw); 5565779Sxy150489 } 5575779Sxy150489 5585779Sxy150489 /* 5595779Sxy150489 * e1000_disable_pcie_master - Disable PCI-Express master access 5605779Sxy150489 * @hw: pointer to the HW structure 5615779Sxy150489 * 5625779Sxy150489 * Disables PCI-Express master access and verifies there are no pending 5635779Sxy150489 * requests. Currently no func pointer exists and all implementations are 5645779Sxy150489 * handled in the generic version of this function. 5655779Sxy150489 */ 5665779Sxy150489 s32 5675779Sxy150489 e1000_disable_pcie_master(struct e1000_hw *hw) 5685779Sxy150489 { 5695779Sxy150489 return (e1000_disable_pcie_master_generic(hw)); 5705779Sxy150489 } 5715779Sxy150489 5725779Sxy150489 /* 5735779Sxy150489 * e1000_config_collision_dist - Configure collision distance 5745779Sxy150489 * @hw: pointer to the HW structure 5755779Sxy150489 * 5765779Sxy150489 * Configures the collision distance to the default value and is used 5775779Sxy150489 * during link setup. 5785779Sxy150489 */ 5795779Sxy150489 void 5805779Sxy150489 e1000_config_collision_dist(struct e1000_hw *hw) 5815779Sxy150489 { 5828571SChenlu.Chen@Sun.COM if (hw->mac.ops.config_collision_dist) 5838571SChenlu.Chen@Sun.COM hw->mac.ops.config_collision_dist(hw); 5845779Sxy150489 } 5855779Sxy150489 5865779Sxy150489 /* 5875779Sxy150489 * e1000_rar_set - Sets a receive address register 5885779Sxy150489 * @hw: pointer to the HW structure 5895779Sxy150489 * @addr: address to set the RAR to 5905779Sxy150489 * @index: the RAR to set 5915779Sxy150489 * 5925779Sxy150489 * Sets a Receive Address Register (RAR) to the specified address. 5935779Sxy150489 */ 5945779Sxy150489 void 5955779Sxy150489 e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) 5965779Sxy150489 { 5978571SChenlu.Chen@Sun.COM if (hw->mac.ops.rar_set) 5988571SChenlu.Chen@Sun.COM hw->mac.ops.rar_set(hw, addr, index); 5995779Sxy150489 } 6005779Sxy150489 6015779Sxy150489 /* 6025779Sxy150489 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state 6035779Sxy150489 * @hw: pointer to the HW structure 6045779Sxy150489 * 6055779Sxy150489 * Ensures that the MDI/MDIX SW state is valid. 6065779Sxy150489 */ 6075779Sxy150489 s32 6085779Sxy150489 e1000_validate_mdi_setting(struct e1000_hw *hw) 6095779Sxy150489 { 6108571SChenlu.Chen@Sun.COM if (hw->mac.ops.validate_mdi_setting) 6118571SChenlu.Chen@Sun.COM return (hw->mac.ops.validate_mdi_setting(hw)); 6125779Sxy150489 6135779Sxy150489 return (E1000_SUCCESS); 6145779Sxy150489 } 6155779Sxy150489 6165779Sxy150489 /* 6175779Sxy150489 * e1000_mta_set - Sets multicast table bit 6185779Sxy150489 * @hw: pointer to the HW structure 6195779Sxy150489 * @hash_value: Multicast hash value. 6205779Sxy150489 * 6215779Sxy150489 * This sets the bit in the multicast table corresponding to the 6225779Sxy150489 * hash value. This is a function pointer entry point called by drivers. 6235779Sxy150489 */ 6245779Sxy150489 void 6255779Sxy150489 e1000_mta_set(struct e1000_hw *hw, u32 hash_value) 6265779Sxy150489 { 6278571SChenlu.Chen@Sun.COM if (hw->mac.ops.mta_set) 6288571SChenlu.Chen@Sun.COM hw->mac.ops.mta_set(hw, hash_value); 6295779Sxy150489 } 6305779Sxy150489 6315779Sxy150489 /* 6325779Sxy150489 * e1000_hash_mc_addr - Determines address location in multicast table 6335779Sxy150489 * @hw: pointer to the HW structure 6345779Sxy150489 * @mc_addr: Multicast address to hash. 6355779Sxy150489 * 6365779Sxy150489 * This hashes an address to determine its location in the multicast 6375779Sxy150489 * table. Currently no func pointer exists and all implementations 6385779Sxy150489 * are handled in the generic version of this function. 6395779Sxy150489 */ 6405779Sxy150489 u32 6415779Sxy150489 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) 6425779Sxy150489 { 6435779Sxy150489 return (e1000_hash_mc_addr_generic(hw, mc_addr)); 6445779Sxy150489 } 6455779Sxy150489 6465779Sxy150489 /* 6475779Sxy150489 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX 6485779Sxy150489 * @hw: pointer to the HW structure 6495779Sxy150489 * 6505779Sxy150489 * Enables packet filtering on transmit packets if manageability is enabled 6515779Sxy150489 * and host interface is enabled. 6525779Sxy150489 * Currently no func pointer exists and all implementations are handled in the 6535779Sxy150489 * generic version of this function. 6545779Sxy150489 */ 6555779Sxy150489 bool 6565779Sxy150489 e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) 6575779Sxy150489 { 6585779Sxy150489 return (e1000_enable_tx_pkt_filtering_generic(hw)); 6595779Sxy150489 } 6605779Sxy150489 6615779Sxy150489 /* 6625779Sxy150489 * e1000_mng_host_if_write - Writes to the manageability host interface 6635779Sxy150489 * @hw: pointer to the HW structure 6645779Sxy150489 * @buffer: pointer to the host interface buffer 6655779Sxy150489 * @length: size of the buffer 6665779Sxy150489 * @offset: location in the buffer to write to 6675779Sxy150489 * @sum: sum of the data (not checksum) 6685779Sxy150489 * 6695779Sxy150489 * This function writes the buffer content at the offset given on the host if. 6705779Sxy150489 * It also does alignment considerations to do the writes in most efficient 6715779Sxy150489 * way. Also fills up the sum of the buffer in *buffer parameter. 6725779Sxy150489 */ 6735779Sxy150489 s32 6745779Sxy150489 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length, 6755779Sxy150489 u16 offset, u8 *sum) 6765779Sxy150489 { 6778571SChenlu.Chen@Sun.COM if (hw->mac.ops.mng_host_if_write) 6788571SChenlu.Chen@Sun.COM return (hw->mac.ops.mng_host_if_write(hw, buffer, length, 6798571SChenlu.Chen@Sun.COM offset, sum)); 6805779Sxy150489 6815779Sxy150489 return (E1000_NOT_IMPLEMENTED); 6825779Sxy150489 } 6835779Sxy150489 6845779Sxy150489 /* 6855779Sxy150489 * e1000_mng_write_cmd_header - Writes manageability command header 6865779Sxy150489 * @hw: pointer to the HW structure 6875779Sxy150489 * @hdr: pointer to the host interface command header 6885779Sxy150489 * 6895779Sxy150489 * Writes the command header after does the checksum calculation. 6905779Sxy150489 */ 6915779Sxy150489 s32 6925779Sxy150489 e1000_mng_write_cmd_header(struct e1000_hw *hw, 6935779Sxy150489 struct e1000_host_mng_command_header *hdr) 6945779Sxy150489 { 6958571SChenlu.Chen@Sun.COM if (hw->mac.ops.mng_write_cmd_header) 6968571SChenlu.Chen@Sun.COM return (hw->mac.ops.mng_write_cmd_header(hw, hdr)); 6975779Sxy150489 6985779Sxy150489 return (E1000_NOT_IMPLEMENTED); 6995779Sxy150489 } 7005779Sxy150489 7015779Sxy150489 /* 7025779Sxy150489 * e1000_mng_enable_host_if - Checks host interface is enabled 7035779Sxy150489 * @hw: pointer to the HW structure 7045779Sxy150489 * 7055779Sxy150489 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 7065779Sxy150489 * 7078571SChenlu.Chen@Sun.COM * This function checks whether the HOST IF is enabled for command operation 7085779Sxy150489 * and also checks whether the previous command is completed. It busy waits 7095779Sxy150489 * in case of previous command is not completed. 7105779Sxy150489 */ 7115779Sxy150489 s32 7125779Sxy150489 e1000_mng_enable_host_if(struct e1000_hw *hw) 7135779Sxy150489 { 7148571SChenlu.Chen@Sun.COM if (hw->mac.ops.mng_enable_host_if) 7158571SChenlu.Chen@Sun.COM return (hw->mac.ops.mng_enable_host_if(hw)); 7165779Sxy150489 7175779Sxy150489 return (E1000_NOT_IMPLEMENTED); 7185779Sxy150489 } 7195779Sxy150489 7205779Sxy150489 /* 7215779Sxy150489 * e1000_wait_autoneg - Waits for autonegotiation completion 7225779Sxy150489 * @hw: pointer to the HW structure 7235779Sxy150489 * 7245779Sxy150489 * Waits for autoneg to complete. Currently no func pointer exists and all 7255779Sxy150489 * implementations are handled in the generic version of this function. 7265779Sxy150489 */ 7275779Sxy150489 s32 7285779Sxy150489 e1000_wait_autoneg(struct e1000_hw *hw) 7295779Sxy150489 { 7308571SChenlu.Chen@Sun.COM if (hw->mac.ops.wait_autoneg) 7318571SChenlu.Chen@Sun.COM return (hw->mac.ops.wait_autoneg(hw)); 7325779Sxy150489 7335779Sxy150489 return (E1000_SUCCESS); 7345779Sxy150489 } 7355779Sxy150489 7365779Sxy150489 /* 7375779Sxy150489 * e1000_check_reset_block - Verifies PHY can be reset 7385779Sxy150489 * @hw: pointer to the HW structure 7395779Sxy150489 * 7405779Sxy150489 * Checks if the PHY is in a state that can be reset or if manageability 7415779Sxy150489 * has it tied up. This is a function pointer entry point called by drivers. 7425779Sxy150489 */ 7435779Sxy150489 s32 7445779Sxy150489 e1000_check_reset_block(struct e1000_hw *hw) 7455779Sxy150489 { 7468571SChenlu.Chen@Sun.COM if (hw->phy.ops.check_reset_block) 7478571SChenlu.Chen@Sun.COM return (hw->phy.ops.check_reset_block(hw)); 7485779Sxy150489 7495779Sxy150489 return (E1000_SUCCESS); 7505779Sxy150489 } 7515779Sxy150489 7525779Sxy150489 /* 7535779Sxy150489 * e1000_read_phy_reg - Reads PHY register 7545779Sxy150489 * @hw: pointer to the HW structure 7555779Sxy150489 * @offset: the register to read 7565779Sxy150489 * @data: the buffer to store the 16-bit read. 7575779Sxy150489 * 7585779Sxy150489 * Reads the PHY register and returns the value in data. 7595779Sxy150489 * This is a function pointer entry point called by drivers. 7605779Sxy150489 */ 7615779Sxy150489 s32 7625779Sxy150489 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data) 7635779Sxy150489 { 7648571SChenlu.Chen@Sun.COM if (hw->phy.ops.read_reg) 7658571SChenlu.Chen@Sun.COM return (hw->phy.ops.read_reg(hw, offset, data)); 7665779Sxy150489 7675779Sxy150489 return (E1000_SUCCESS); 7685779Sxy150489 } 7695779Sxy150489 7705779Sxy150489 /* 7715779Sxy150489 * e1000_write_phy_reg - Writes PHY register 7725779Sxy150489 * @hw: pointer to the HW structure 7735779Sxy150489 * @offset: the register to write 7745779Sxy150489 * @data: the value to write. 7755779Sxy150489 * 7765779Sxy150489 * Writes the PHY register at offset with the value in data. 7775779Sxy150489 * This is a function pointer entry point called by drivers. 7785779Sxy150489 */ 7795779Sxy150489 s32 7805779Sxy150489 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data) 7815779Sxy150489 { 7828571SChenlu.Chen@Sun.COM if (hw->phy.ops.write_reg) 7838571SChenlu.Chen@Sun.COM return (hw->phy.ops.write_reg(hw, offset, data)); 7848571SChenlu.Chen@Sun.COM 7858571SChenlu.Chen@Sun.COM return (E1000_SUCCESS); 7868571SChenlu.Chen@Sun.COM } 7878571SChenlu.Chen@Sun.COM 7888571SChenlu.Chen@Sun.COM /* 7898571SChenlu.Chen@Sun.COM * e1000_release_phy - Generic release PHY 7908571SChenlu.Chen@Sun.COM * @hw: pointer to the HW structure 7918571SChenlu.Chen@Sun.COM * 7928571SChenlu.Chen@Sun.COM * Return if silicon family does not require a semaphore when accessing the 7938571SChenlu.Chen@Sun.COM * PHY. 7948571SChenlu.Chen@Sun.COM */ 7958571SChenlu.Chen@Sun.COM void 7968571SChenlu.Chen@Sun.COM e1000_release_phy(struct e1000_hw *hw) 7978571SChenlu.Chen@Sun.COM { 7988571SChenlu.Chen@Sun.COM if (hw->phy.ops.release) 7998571SChenlu.Chen@Sun.COM hw->phy.ops.release(hw); 8008571SChenlu.Chen@Sun.COM } 8018571SChenlu.Chen@Sun.COM 8028571SChenlu.Chen@Sun.COM /* 8038571SChenlu.Chen@Sun.COM * e1000_acquire_phy - Generic acquire PHY 8048571SChenlu.Chen@Sun.COM * @hw: pointer to the HW structure 8058571SChenlu.Chen@Sun.COM * 8068571SChenlu.Chen@Sun.COM * Return success if silicon family does not require a semaphore when 8078571SChenlu.Chen@Sun.COM * accessing the PHY. 8088571SChenlu.Chen@Sun.COM */ 8098571SChenlu.Chen@Sun.COM s32 8108571SChenlu.Chen@Sun.COM e1000_acquire_phy(struct e1000_hw *hw) 8118571SChenlu.Chen@Sun.COM { 8128571SChenlu.Chen@Sun.COM if (hw->phy.ops.acquire) 8138571SChenlu.Chen@Sun.COM return (hw->phy.ops.acquire(hw)); 8145779Sxy150489 8155779Sxy150489 return (E1000_SUCCESS); 8165779Sxy150489 } 8175779Sxy150489 8185779Sxy150489 /* 8195779Sxy150489 * e1000_read_kmrn_reg - Reads register using Kumeran interface 8205779Sxy150489 * @hw: pointer to the HW structure 8215779Sxy150489 * @offset: the register to read 8225779Sxy150489 * @data: the location to store the 16-bit value read. 8235779Sxy150489 * 8245779Sxy150489 * Reads a register out of the Kumeran interface. Currently no func pointer 8255779Sxy150489 * exists and all implementations are handled in the generic version of 8265779Sxy150489 * this function. 8275779Sxy150489 */ 8285779Sxy150489 s32 8295779Sxy150489 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) 8305779Sxy150489 { 8315779Sxy150489 return (e1000_read_kmrn_reg_generic(hw, offset, data)); 8325779Sxy150489 } 8335779Sxy150489 8345779Sxy150489 /* 8355779Sxy150489 * e1000_write_kmrn_reg - Writes register using Kumeran interface 8365779Sxy150489 * @hw: pointer to the HW structure 8375779Sxy150489 * @offset: the register to write 8385779Sxy150489 * @data: the value to write. 8395779Sxy150489 * 8405779Sxy150489 * Writes a register to the Kumeran interface. Currently no func pointer 8415779Sxy150489 * exists and all implementations are handled in the generic version of 8425779Sxy150489 * this function. 8435779Sxy150489 */ 8445779Sxy150489 s32 8455779Sxy150489 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) 8465779Sxy150489 { 8475779Sxy150489 return (e1000_write_kmrn_reg_generic(hw, offset, data)); 8485779Sxy150489 } 8495779Sxy150489 8505779Sxy150489 /* 8515779Sxy150489 * e1000_get_cable_length - Retrieves cable length estimation 8525779Sxy150489 * @hw: pointer to the HW structure 8535779Sxy150489 * 8545779Sxy150489 * This function estimates the cable length and stores them in 8555779Sxy150489 * hw->phy.min_length and hw->phy.max_length. This is a function pointer 8565779Sxy150489 * entry point called by drivers. 8575779Sxy150489 */ 8585779Sxy150489 s32 8595779Sxy150489 e1000_get_cable_length(struct e1000_hw *hw) 8605779Sxy150489 { 8618571SChenlu.Chen@Sun.COM if (hw->phy.ops.get_cable_length) 8628571SChenlu.Chen@Sun.COM return (hw->phy.ops.get_cable_length(hw)); 8635779Sxy150489 8645779Sxy150489 return (E1000_SUCCESS); 8655779Sxy150489 } 8665779Sxy150489 8675779Sxy150489 /* 8685779Sxy150489 * e1000_get_phy_info - Retrieves PHY information from registers 8695779Sxy150489 * @hw: pointer to the HW structure 8705779Sxy150489 * 8715779Sxy150489 * This function gets some information from various PHY registers and 8725779Sxy150489 * populates hw->phy values with it. This is a function pointer entry 8735779Sxy150489 * point called by drivers. 8745779Sxy150489 */ 8755779Sxy150489 s32 8765779Sxy150489 e1000_get_phy_info(struct e1000_hw *hw) 8775779Sxy150489 { 8788571SChenlu.Chen@Sun.COM if (hw->phy.ops.get_info) 8798571SChenlu.Chen@Sun.COM return (hw->phy.ops.get_info(hw)); 8805779Sxy150489 8815779Sxy150489 return (E1000_SUCCESS); 8825779Sxy150489 } 8835779Sxy150489 8845779Sxy150489 /* 8855779Sxy150489 * e1000_phy_hw_reset - Hard PHY reset 8865779Sxy150489 * @hw: pointer to the HW structure 8875779Sxy150489 * 8885779Sxy150489 * Performs a hard PHY reset. This is a function pointer entry point called 8895779Sxy150489 * by drivers. 8905779Sxy150489 */ 8915779Sxy150489 s32 8925779Sxy150489 e1000_phy_hw_reset(struct e1000_hw *hw) 8935779Sxy150489 { 8948571SChenlu.Chen@Sun.COM if (hw->phy.ops.reset) 8958571SChenlu.Chen@Sun.COM return (hw->phy.ops.reset(hw)); 8965779Sxy150489 8975779Sxy150489 return (E1000_SUCCESS); 8985779Sxy150489 } 8995779Sxy150489 9005779Sxy150489 /* 9015779Sxy150489 * e1000_phy_commit - Soft PHY reset 9025779Sxy150489 * @hw: pointer to the HW structure 9035779Sxy150489 * 9045779Sxy150489 * Performs a soft PHY reset on those that apply. This is a function pointer 9055779Sxy150489 * entry point called by drivers. 9065779Sxy150489 */ 9075779Sxy150489 s32 9085779Sxy150489 e1000_phy_commit(struct e1000_hw *hw) 9095779Sxy150489 { 9108571SChenlu.Chen@Sun.COM if (hw->phy.ops.commit) 9118571SChenlu.Chen@Sun.COM return (hw->phy.ops.commit(hw)); 9125779Sxy150489 9135779Sxy150489 return (E1000_SUCCESS); 9145779Sxy150489 } 9155779Sxy150489 9165779Sxy150489 /* 9178571SChenlu.Chen@Sun.COM * e1000_set_d0_lplu_state - Sets low power link up state for D0 9185779Sxy150489 * @hw: pointer to the HW structure 9195779Sxy150489 * @active: boolean used to enable/disable lplu 9205779Sxy150489 * 9215779Sxy150489 * Success returns 0, Failure returns 1 9225779Sxy150489 * 9235779Sxy150489 * The low power link up (lplu) state is set to the power management level D0 9245779Sxy150489 * and SmartSpeed is disabled when active is true, else clear lplu for D0 9255779Sxy150489 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 9265779Sxy150489 * is used during Dx states where the power conservation is most important. 9275779Sxy150489 * During driver activity, SmartSpeed should be enabled so performance is 9285779Sxy150489 * maintained. This is a function pointer entry point called by drivers. 9295779Sxy150489 */ 9305779Sxy150489 s32 9315779Sxy150489 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) 9325779Sxy150489 { 9338571SChenlu.Chen@Sun.COM if (hw->phy.ops.set_d0_lplu_state) 9348571SChenlu.Chen@Sun.COM return (hw->phy.ops.set_d0_lplu_state(hw, active)); 9355779Sxy150489 9365779Sxy150489 return (E1000_SUCCESS); 9375779Sxy150489 } 9385779Sxy150489 9395779Sxy150489 /* 9405779Sxy150489 * e1000_set_d3_lplu_state - Sets low power link up state for D3 9415779Sxy150489 * @hw: pointer to the HW structure 9425779Sxy150489 * @active: boolean used to enable/disable lplu 9435779Sxy150489 * 9445779Sxy150489 * Success returns 0, Failure returns 1 9455779Sxy150489 * 9465779Sxy150489 * The low power link up (lplu) state is set to the power management level D3 9475779Sxy150489 * and SmartSpeed is disabled when active is true, else clear lplu for D3 9485779Sxy150489 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 9495779Sxy150489 * is used during Dx states where the power conservation is most important. 9505779Sxy150489 * During driver activity, SmartSpeed should be enabled so performance is 9515779Sxy150489 * maintained. This is a function pointer entry point called by drivers. 9525779Sxy150489 */ 9535779Sxy150489 s32 9545779Sxy150489 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) 9555779Sxy150489 { 9568571SChenlu.Chen@Sun.COM if (hw->phy.ops.set_d3_lplu_state) 9578571SChenlu.Chen@Sun.COM return (hw->phy.ops.set_d3_lplu_state(hw, active)); 9585779Sxy150489 9595779Sxy150489 return (E1000_SUCCESS); 9605779Sxy150489 } 9615779Sxy150489 9625779Sxy150489 /* 9635779Sxy150489 * e1000_read_mac_addr - Reads MAC address 9645779Sxy150489 * @hw: pointer to the HW structure 9655779Sxy150489 * 9665779Sxy150489 * Reads the MAC address out of the adapter and stores it in the HW structure. 9675779Sxy150489 * Currently no func pointer exists and all implementations are handled in the 9685779Sxy150489 * generic version of this function. 9695779Sxy150489 */ 9705779Sxy150489 s32 9715779Sxy150489 e1000_read_mac_addr(struct e1000_hw *hw) 9725779Sxy150489 { 9738571SChenlu.Chen@Sun.COM if (hw->mac.ops.read_mac_addr) 9748571SChenlu.Chen@Sun.COM return (hw->mac.ops.read_mac_addr(hw)); 9755779Sxy150489 9765779Sxy150489 return (e1000_read_mac_addr_generic(hw)); 9775779Sxy150489 } 9785779Sxy150489 9795779Sxy150489 /* 9805779Sxy150489 * e1000_read_pba_num - Read device part number 9815779Sxy150489 * @hw: pointer to the HW structure 9825779Sxy150489 * @pba_num: pointer to device part number 9835779Sxy150489 * 9845779Sxy150489 * Reads the product board assembly (PBA) number from the EEPROM and stores 9855779Sxy150489 * the value in pba_num. 9865779Sxy150489 * Currently no func pointer exists and all implementations are handled in the 9875779Sxy150489 * generic version of this function. 9885779Sxy150489 */ 9895779Sxy150489 s32 9905779Sxy150489 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) 9915779Sxy150489 { 9925779Sxy150489 return (e1000_read_pba_num_generic(hw, pba_num)); 9935779Sxy150489 } 9945779Sxy150489 9955779Sxy150489 /* 9965779Sxy150489 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum 9975779Sxy150489 * @hw: pointer to the HW structure 9985779Sxy150489 * 9995779Sxy150489 * Validates the NVM checksum is correct. This is a function pointer entry 10005779Sxy150489 * point called by drivers. 10015779Sxy150489 */ 10025779Sxy150489 s32 10035779Sxy150489 e1000_validate_nvm_checksum(struct e1000_hw *hw) 10045779Sxy150489 { 10058571SChenlu.Chen@Sun.COM if (hw->nvm.ops.validate) 10068571SChenlu.Chen@Sun.COM return (hw->nvm.ops.validate(hw)); 10075779Sxy150489 10085779Sxy150489 return (-E1000_ERR_CONFIG); 10095779Sxy150489 } 10105779Sxy150489 10115779Sxy150489 /* 10125779Sxy150489 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum 10135779Sxy150489 * @hw: pointer to the HW structure 10145779Sxy150489 * 10155779Sxy150489 * Updates the NVM checksum. Currently no func pointer exists and all 10165779Sxy150489 * implementations are handled in the generic version of this function. 10175779Sxy150489 */ 10185779Sxy150489 s32 10195779Sxy150489 e1000_update_nvm_checksum(struct e1000_hw *hw) 10205779Sxy150489 { 10218571SChenlu.Chen@Sun.COM if (hw->nvm.ops.update) 10228571SChenlu.Chen@Sun.COM return (hw->nvm.ops.update(hw)); 10235779Sxy150489 10245779Sxy150489 return (-E1000_ERR_CONFIG); 10255779Sxy150489 } 10265779Sxy150489 10275779Sxy150489 /* 10285779Sxy150489 * e1000_reload_nvm - Reloads EEPROM 10295779Sxy150489 * @hw: pointer to the HW structure 10305779Sxy150489 * 10315779Sxy150489 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the 10325779Sxy150489 * extended control register. 10335779Sxy150489 */ 10345779Sxy150489 void 10355779Sxy150489 e1000_reload_nvm(struct e1000_hw *hw) 10365779Sxy150489 { 10378571SChenlu.Chen@Sun.COM if (hw->nvm.ops.reload) 10388571SChenlu.Chen@Sun.COM hw->nvm.ops.reload(hw); 10395779Sxy150489 } 10405779Sxy150489 10415779Sxy150489 /* 10425779Sxy150489 * e1000_read_nvm - Reads NVM (EEPROM) 10435779Sxy150489 * @hw: pointer to the HW structure 10445779Sxy150489 * @offset: the word offset to read 10455779Sxy150489 * @words: number of 16-bit words to read 10465779Sxy150489 * @data: pointer to the properly sized buffer for the data. 10475779Sxy150489 * 10485779Sxy150489 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function 10495779Sxy150489 * pointer entry point called by drivers. 10505779Sxy150489 */ 10515779Sxy150489 s32 10525779Sxy150489 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 10535779Sxy150489 { 10548571SChenlu.Chen@Sun.COM if (hw->nvm.ops.read) 10558571SChenlu.Chen@Sun.COM return (hw->nvm.ops.read(hw, offset, words, data)); 10565779Sxy150489 10575779Sxy150489 return (-E1000_ERR_CONFIG); 10585779Sxy150489 } 10595779Sxy150489 10605779Sxy150489 /* 10615779Sxy150489 * e1000_write_nvm - Writes to NVM (EEPROM) 10625779Sxy150489 * @hw: pointer to the HW structure 10635779Sxy150489 * @offset: the word offset to read 10645779Sxy150489 * @words: number of 16-bit words to write 10655779Sxy150489 * @data: pointer to the properly sized buffer for the data. 10665779Sxy150489 * 10675779Sxy150489 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function 10685779Sxy150489 * pointer entry point called by drivers. 10695779Sxy150489 */ 10705779Sxy150489 s32 10715779Sxy150489 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 10725779Sxy150489 { 10738571SChenlu.Chen@Sun.COM if (hw->nvm.ops.write) 10748571SChenlu.Chen@Sun.COM return (hw->nvm.ops.write(hw, offset, words, data)); 10755779Sxy150489 10765779Sxy150489 return (E1000_SUCCESS); 10775779Sxy150489 } 10785779Sxy150489 10795779Sxy150489 /* 10805779Sxy150489 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register 10815779Sxy150489 * @hw: pointer to the HW structure 10825779Sxy150489 * @reg: 32bit register offset 10835779Sxy150489 * @offset: the register to write 10845779Sxy150489 * @data: the value to write. 10855779Sxy150489 * 10865779Sxy150489 * Writes the PHY register at offset with the value in data. 10875779Sxy150489 * This is a function pointer entry point called by drivers. 10885779Sxy150489 */ 10895779Sxy150489 s32 10905779Sxy150489 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data) 10915779Sxy150489 { 10925779Sxy150489 return (e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data)); 10935779Sxy150489 } 10945779Sxy150489 10955779Sxy150489 /* 10965779Sxy150489 * e1000_power_up_phy - Restores link in case of PHY power down 10975779Sxy150489 * @hw: pointer to the HW structure 10985779Sxy150489 * 10995779Sxy150489 * The phy may be powered down to save power, to turn off link when the 11005779Sxy150489 * driver is unloaded, or wake on lan is not enabled (among others). 11015779Sxy150489 */ 11025779Sxy150489 void 11035779Sxy150489 e1000_power_up_phy(struct e1000_hw *hw) 11045779Sxy150489 { 11058571SChenlu.Chen@Sun.COM if (hw->phy.ops.power_up) 11068571SChenlu.Chen@Sun.COM hw->phy.ops.power_up(hw); 11075779Sxy150489 11085779Sxy150489 (void) e1000_setup_link(hw); 11095779Sxy150489 } 11105779Sxy150489 11115779Sxy150489 /* 11125779Sxy150489 * e1000_power_down_phy - Power down PHY 11135779Sxy150489 * @hw: pointer to the HW structure 11145779Sxy150489 * 11155779Sxy150489 * The phy may be powered down to save power, to turn off link when the 11165779Sxy150489 * driver is unloaded, or wake on lan is not enabled (among others). 11175779Sxy150489 */ 11185779Sxy150489 void 11195779Sxy150489 e1000_power_down_phy(struct e1000_hw *hw) 11205779Sxy150489 { 11218571SChenlu.Chen@Sun.COM if (hw->phy.ops.power_down) 11228571SChenlu.Chen@Sun.COM hw->phy.ops.power_down(hw); 11235779Sxy150489 } 11248571SChenlu.Chen@Sun.COM 11258571SChenlu.Chen@Sun.COM /* 11268571SChenlu.Chen@Sun.COM * e1000_shutdown_fiber_serdes_link - Remove link during power down 11278571SChenlu.Chen@Sun.COM * @hw: pointer to the HW structure 11288571SChenlu.Chen@Sun.COM * 11298571SChenlu.Chen@Sun.COM * Shutdown the optics and PCS on driver unload. 11308571SChenlu.Chen@Sun.COM */ 11318571SChenlu.Chen@Sun.COM void 11328571SChenlu.Chen@Sun.COM e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw) 11338571SChenlu.Chen@Sun.COM { 11348571SChenlu.Chen@Sun.COM if (hw->mac.ops.shutdown_serdes) 11358571SChenlu.Chen@Sun.COM hw->mac.ops.shutdown_serdes(hw); 11368571SChenlu.Chen@Sun.COM } 1137