xref: /onnv-gate/usr/src/uts/common/io/igb/igb_api.c (revision 8571:60e408ef19cc)
15779Sxy150489 /*
25779Sxy150489  * CDDL HEADER START
35779Sxy150489  *
4*8571SChenlu.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 /*
25*8571SChenlu.Chen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
265779Sxy150489  * Use is subject to license terms of the CDDL.
275779Sxy150489  */
285779Sxy150489 
29*8571SChenlu.Chen@Sun.COM /* IntelVersion: 1.107 v2008-10-7 */
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 
45*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.init_params) {
46*8571SChenlu.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 
72*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.init_params) {
73*8571SChenlu.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 
99*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.init_params) {
100*8571SChenlu.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;
137*8571SChenlu.Chen@Sun.COM 	case E1000_DEV_ID_82576:
138*8571SChenlu.Chen@Sun.COM 	case E1000_DEV_ID_82576_FIBER:
139*8571SChenlu.Chen@Sun.COM 	case E1000_DEV_ID_82576_SERDES:
140*8571SChenlu.Chen@Sun.COM 	case E1000_DEV_ID_82576_QUAD_COPPER:
141*8571SChenlu.Chen@Sun.COM 		mac->type = e1000_82576;
142*8571SChenlu.Chen@Sun.COM 		break;
1435779Sxy150489 	default:
1445779Sxy150489 		/* Should never have loaded on this device */
1455779Sxy150489 		ret_val = -E1000_ERR_MAC_INIT;
1465779Sxy150489 		break;
1475779Sxy150489 	}
1485779Sxy150489 
1495779Sxy150489 	return (ret_val);
1505779Sxy150489 }
1515779Sxy150489 
1525779Sxy150489 /*
1535779Sxy150489  * e1000_setup_init_funcs - Initializes function pointers
1545779Sxy150489  * @hw: pointer to the HW structure
155*8571SChenlu.Chen@Sun.COM  * @init_device: true will initialize the rest of the function pointers
156*8571SChenlu.Chen@Sun.COM  *		getting the device ready for use.  false will only set
1575779Sxy150489  *		MAC type and the function pointers for the other init
158*8571SChenlu.Chen@Sun.COM  *		functions.  Passing false will not generate any hardware
1595779Sxy150489  *		reads or writes.
1605779Sxy150489  *
1615779Sxy150489  * This function must be called by a driver in order to use the rest
1625779Sxy150489  * of the 'shared' code files. Called by drivers only.
1635779Sxy150489  */
1645779Sxy150489 s32
1655779Sxy150489 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
1665779Sxy150489 {
1675779Sxy150489 	s32 ret_val;
1685779Sxy150489 
1695779Sxy150489 	/* Can't do much good without knowing the MAC type. */
1705779Sxy150489 	ret_val = e1000_set_mac_type(hw);
1715779Sxy150489 	if (ret_val) {
1725779Sxy150489 		DEBUGOUT("ERROR: MAC type could not be set properly.\n");
1735779Sxy150489 		goto out;
1745779Sxy150489 	}
1755779Sxy150489 
1765779Sxy150489 	if (!hw->hw_addr) {
1775779Sxy150489 		DEBUGOUT("ERROR: Registers not mapped\n");
1785779Sxy150489 		ret_val = -E1000_ERR_CONFIG;
1795779Sxy150489 		goto out;
1805779Sxy150489 	}
1815779Sxy150489 
1825779Sxy150489 	/*
183*8571SChenlu.Chen@Sun.COM 	 * Init function pointers to generic implementations. We do this first
184*8571SChenlu.Chen@Sun.COM 	 * allowing a driver module to override it afterward.
1855779Sxy150489 	 */
186*8571SChenlu.Chen@Sun.COM 	e1000_init_mac_ops_generic(hw);
187*8571SChenlu.Chen@Sun.COM 	e1000_init_phy_ops_generic(hw);
188*8571SChenlu.Chen@Sun.COM 	e1000_init_nvm_ops_generic(hw);
1895779Sxy150489 
1905779Sxy150489 	/*
1915779Sxy150489 	 * Set up the init function pointers. These are functions within the
1925779Sxy150489 	 * adapter family file that sets up function pointers for the rest of
1935779Sxy150489 	 * the functions in that family.
1945779Sxy150489 	 */
1955779Sxy150489 	switch (hw->mac.type) {
1965779Sxy150489 	case e1000_82575:
197*8571SChenlu.Chen@Sun.COM 	case e1000_82576:
1985779Sxy150489 		e1000_init_function_pointers_82575(hw);
1995779Sxy150489 		break;
2005779Sxy150489 	default:
2015779Sxy150489 		DEBUGOUT("Hardware not supported\n");
2025779Sxy150489 		ret_val = -E1000_ERR_CONFIG;
2035779Sxy150489 		break;
2045779Sxy150489 	}
2055779Sxy150489 
2065779Sxy150489 	/*
2075779Sxy150489 	 * Initialize the rest of the function pointers. These require some
2085779Sxy150489 	 * register reads/writes in some cases.
2095779Sxy150489 	 */
2105779Sxy150489 	if (!(ret_val) && init_device) {
2115779Sxy150489 		ret_val = e1000_init_mac_params(hw);
2125779Sxy150489 		if (ret_val)
2135779Sxy150489 			goto out;
2145779Sxy150489 
2155779Sxy150489 		ret_val = e1000_init_nvm_params(hw);
2165779Sxy150489 		if (ret_val)
2175779Sxy150489 			goto out;
2185779Sxy150489 
2195779Sxy150489 		ret_val = e1000_init_phy_params(hw);
2205779Sxy150489 		if (ret_val)
2215779Sxy150489 			goto out;
2225779Sxy150489 
2235779Sxy150489 	}
2245779Sxy150489 
2255779Sxy150489 out:
2265779Sxy150489 	return (ret_val);
2275779Sxy150489 }
2285779Sxy150489 
2295779Sxy150489 /*
2305779Sxy150489  * e1000_get_bus_info - Obtain bus information for adapter
2315779Sxy150489  * @hw: pointer to the HW structure
2325779Sxy150489  *
2335779Sxy150489  * This will obtain information about the HW bus for which the
234*8571SChenlu.Chen@Sun.COM  * adapter is attached and stores it in the hw structure. This is a
2355779Sxy150489  * function pointer entry point called by drivers.
2365779Sxy150489  */
2375779Sxy150489 s32
2385779Sxy150489 e1000_get_bus_info(struct e1000_hw *hw)
2395779Sxy150489 {
240*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.get_bus_info)
241*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.get_bus_info(hw));
2425779Sxy150489 
2435779Sxy150489 	return (E1000_SUCCESS);
2445779Sxy150489 }
2455779Sxy150489 
2465779Sxy150489 /*
2475779Sxy150489  * e1000_clear_vfta - Clear VLAN filter table
2485779Sxy150489  * @hw: pointer to the HW structure
2495779Sxy150489  *
2505779Sxy150489  * This clears the VLAN filter table on the adapter. This is a function
2515779Sxy150489  * pointer entry point called by drivers.
2525779Sxy150489  */
2535779Sxy150489 void
2545779Sxy150489 e1000_clear_vfta(struct e1000_hw *hw)
2555779Sxy150489 {
256*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.clear_vfta)
257*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.clear_vfta(hw);
2585779Sxy150489 }
2595779Sxy150489 
2605779Sxy150489 /*
2615779Sxy150489  * e1000_write_vfta - Write value to VLAN filter table
2625779Sxy150489  * @hw: pointer to the HW structure
2635779Sxy150489  * @offset: the 32-bit offset in which to write the value to.
2645779Sxy150489  * @value: the 32-bit value to write at location offset.
2655779Sxy150489  *
2665779Sxy150489  * This writes a 32-bit value to a 32-bit offset in the VLAN filter
2675779Sxy150489  * table. This is a function pointer entry point called by drivers.
2685779Sxy150489  */
2695779Sxy150489 void
2705779Sxy150489 e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
2715779Sxy150489 {
272*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.write_vfta)
273*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.write_vfta(hw, offset, value);
2745779Sxy150489 }
2755779Sxy150489 
2765779Sxy150489 /*
2775779Sxy150489  * e1000_update_mc_addr_list - Update Multicast addresses
2785779Sxy150489  * @hw: pointer to the HW structure
2795779Sxy150489  * @mc_addr_list: array of multicast addresses to program
2805779Sxy150489  * @mc_addr_count: number of multicast addresses to program
2815779Sxy150489  * @rar_used_count: the first RAR register free to program
2825779Sxy150489  * @rar_count: total number of supported Receive Address Registers
2835779Sxy150489  *
2845779Sxy150489  * Updates the Receive Address Registers and Multicast Table Array.
2855779Sxy150489  * The caller must have a packed mc_addr_list of multicast addresses.
2865779Sxy150489  * The parameter rar_count will usually be hw->mac.rar_entry_count
2875779Sxy150489  * unless there are workarounds that change this.  Currently no func pointer
2885779Sxy150489  * exists and all implementations are handled in the generic version of this
2895779Sxy150489  * function.
2905779Sxy150489  */
2915779Sxy150489 void
2925779Sxy150489 e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
2935779Sxy150489     u32 mc_addr_count, u32 rar_used_count, u32 rar_count)
2945779Sxy150489 {
295*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.update_mc_addr_list)
296*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.update_mc_addr_list(hw,
2975779Sxy150489 		    mc_addr_list,
2985779Sxy150489 		    mc_addr_count,
2995779Sxy150489 		    rar_used_count,
3005779Sxy150489 		    rar_count);
3015779Sxy150489 }
3025779Sxy150489 
3035779Sxy150489 /*
3045779Sxy150489  * e1000_force_mac_fc - Force MAC flow control
3055779Sxy150489  * @hw: pointer to the HW structure
3065779Sxy150489  *
3075779Sxy150489  * Force the MAC's flow control settings. Currently no func pointer exists
3085779Sxy150489  * and all implementations are handled in the generic version of this
3095779Sxy150489  * function.
3105779Sxy150489  */
3115779Sxy150489 s32
3125779Sxy150489 e1000_force_mac_fc(struct e1000_hw *hw)
3135779Sxy150489 {
3145779Sxy150489 	return (e1000_force_mac_fc_generic(hw));
3155779Sxy150489 }
3165779Sxy150489 
3175779Sxy150489 /*
3185779Sxy150489  * e1000_check_for_link - Check/Store link connection
3195779Sxy150489  * @hw: pointer to the HW structure
3205779Sxy150489  *
3215779Sxy150489  * This checks the link condition of the adapter and stores the
3225779Sxy150489  * results in the hw->mac structure. This is a function pointer entry
3235779Sxy150489  * point called by drivers.
3245779Sxy150489  */
3255779Sxy150489 s32
3265779Sxy150489 e1000_check_for_link(struct e1000_hw *hw)
3275779Sxy150489 {
328*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.check_for_link)
329*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.check_for_link(hw));
3305779Sxy150489 
3315779Sxy150489 	return (-E1000_ERR_CONFIG);
3325779Sxy150489 }
3335779Sxy150489 
3345779Sxy150489 /*
3355779Sxy150489  * e1000_check_mng_mode - Check management mode
3365779Sxy150489  * @hw: pointer to the HW structure
3375779Sxy150489  *
3385779Sxy150489  * This checks if the adapter has manageability enabled.
3395779Sxy150489  * This is a function pointer entry point called by drivers.
3405779Sxy150489  */
3415779Sxy150489 bool
3425779Sxy150489 e1000_check_mng_mode(struct e1000_hw *hw)
3435779Sxy150489 {
344*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.check_mng_mode)
345*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.check_mng_mode(hw));
3465779Sxy150489 
347*8571SChenlu.Chen@Sun.COM 	return (false);
3485779Sxy150489 }
3495779Sxy150489 
3505779Sxy150489 /*
3515779Sxy150489  * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
3525779Sxy150489  * @hw: pointer to the HW structure
3535779Sxy150489  * @buffer: pointer to the host interface
3545779Sxy150489  * @length: size of the buffer
3555779Sxy150489  *
3565779Sxy150489  * Writes the DHCP information to the host interface.
3575779Sxy150489  */
3585779Sxy150489 s32
3595779Sxy150489 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
3605779Sxy150489 {
3615779Sxy150489 	return (e1000_mng_write_dhcp_info_generic(hw, buffer, length));
3625779Sxy150489 }
3635779Sxy150489 
3645779Sxy150489 /*
3655779Sxy150489  * e1000_reset_hw - Reset hardware
3665779Sxy150489  * @hw: pointer to the HW structure
3675779Sxy150489  *
3685779Sxy150489  * This resets the hardware into a known state. This is a function pointer
3695779Sxy150489  * entry point called by drivers.
3705779Sxy150489  */
3715779Sxy150489 s32
3725779Sxy150489 e1000_reset_hw(struct e1000_hw *hw)
3735779Sxy150489 {
374*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.reset_hw)
375*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.reset_hw(hw));
3765779Sxy150489 
3775779Sxy150489 	return (-E1000_ERR_CONFIG);
3785779Sxy150489 }
3795779Sxy150489 
3805779Sxy150489 /*
3815779Sxy150489  * e1000_init_hw - Initialize hardware
3825779Sxy150489  * @hw: pointer to the HW structure
3835779Sxy150489  *
3845779Sxy150489  * This inits the hardware readying it for operation. This is a function
3855779Sxy150489  * pointer entry point called by drivers.
3865779Sxy150489  */
3875779Sxy150489 s32
3885779Sxy150489 e1000_init_hw(struct e1000_hw *hw)
3895779Sxy150489 {
390*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.init_hw)
391*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.init_hw(hw));
3925779Sxy150489 
3935779Sxy150489 	return (-E1000_ERR_CONFIG);
3945779Sxy150489 }
3955779Sxy150489 
3965779Sxy150489 /*
3975779Sxy150489  * e1000_setup_link - Configures link and flow control
3985779Sxy150489  * @hw: pointer to the HW structure
3995779Sxy150489  *
4005779Sxy150489  * This configures link and flow control settings for the adapter. This
4015779Sxy150489  * is a function pointer entry point called by drivers. While modules can
4025779Sxy150489  * also call this, they probably call their own version of this function.
4035779Sxy150489  */
4045779Sxy150489 s32
4055779Sxy150489 e1000_setup_link(struct e1000_hw *hw)
4065779Sxy150489 {
407*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.setup_link)
408*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.setup_link(hw));
4095779Sxy150489 
4105779Sxy150489 	return (-E1000_ERR_CONFIG);
4115779Sxy150489 }
4125779Sxy150489 
4135779Sxy150489 /*
4145779Sxy150489  * e1000_get_speed_and_duplex - Returns current speed and duplex
4155779Sxy150489  * @hw: pointer to the HW structure
4165779Sxy150489  * @speed: pointer to a 16-bit value to store the speed
4175779Sxy150489  * @duplex: pointer to a 16-bit value to store the duplex.
4185779Sxy150489  *
4195779Sxy150489  * This returns the speed and duplex of the adapter in the two 'out'
4205779Sxy150489  * variables passed in. This is a function pointer entry point called
4215779Sxy150489  * by drivers.
4225779Sxy150489  */
4235779Sxy150489 s32
4245779Sxy150489 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
4255779Sxy150489 {
426*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.get_link_up_info)
427*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.get_link_up_info(hw, speed, duplex));
4285779Sxy150489 
4295779Sxy150489 	return (-E1000_ERR_CONFIG);
4305779Sxy150489 }
4315779Sxy150489 
4325779Sxy150489 /*
4335779Sxy150489  * e1000_setup_led - Configures SW controllable LED
4345779Sxy150489  * @hw: pointer to the HW structure
4355779Sxy150489  *
4365779Sxy150489  * This prepares the SW controllable LED for use and saves the current state
4375779Sxy150489  * of the LED so it can be later restored. This is a function pointer entry
4385779Sxy150489  * point called by drivers.
4395779Sxy150489  */
4405779Sxy150489 s32
4415779Sxy150489 e1000_setup_led(struct e1000_hw *hw)
4425779Sxy150489 {
443*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.setup_led)
444*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.setup_led(hw));
4455779Sxy150489 
4465779Sxy150489 	return (E1000_SUCCESS);
4475779Sxy150489 }
4485779Sxy150489 
4495779Sxy150489 /*
4505779Sxy150489  * e1000_cleanup_led - Restores SW controllable LED
4515779Sxy150489  * @hw: pointer to the HW structure
4525779Sxy150489  *
4535779Sxy150489  * This restores the SW controllable LED to the value saved off by
4545779Sxy150489  * e1000_setup_led. This is a function pointer entry point called by drivers.
4555779Sxy150489  */
4565779Sxy150489 s32
4575779Sxy150489 e1000_cleanup_led(struct e1000_hw *hw)
4585779Sxy150489 {
459*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.cleanup_led)
460*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.cleanup_led(hw));
4615779Sxy150489 
4625779Sxy150489 	return (E1000_SUCCESS);
4635779Sxy150489 }
4645779Sxy150489 
4655779Sxy150489 /*
4665779Sxy150489  * e1000_blink_led - Blink SW controllable LED
4675779Sxy150489  * @hw: pointer to the HW structure
4685779Sxy150489  *
4695779Sxy150489  * This starts the adapter LED blinking. Request the LED to be setup first
4705779Sxy150489  * and cleaned up after. This is a function pointer entry point called by
4715779Sxy150489  * drivers.
4725779Sxy150489  */
4735779Sxy150489 s32
4745779Sxy150489 e1000_blink_led(struct e1000_hw *hw)
4755779Sxy150489 {
476*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.blink_led)
477*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.blink_led(hw));
4785779Sxy150489 
4795779Sxy150489 	return (E1000_SUCCESS);
4805779Sxy150489 }
4815779Sxy150489 
4825779Sxy150489 /*
4835779Sxy150489  * e1000_led_on - Turn on SW controllable LED
4845779Sxy150489  * @hw: pointer to the HW structure
4855779Sxy150489  *
4865779Sxy150489  * Turns the SW defined LED on. This is a function pointer entry point
4875779Sxy150489  * called by drivers.
4885779Sxy150489  */
4895779Sxy150489 s32
4905779Sxy150489 e1000_led_on(struct e1000_hw *hw)
4915779Sxy150489 {
492*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.led_on)
493*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.led_on(hw));
4945779Sxy150489 
4955779Sxy150489 	return (E1000_SUCCESS);
4965779Sxy150489 }
4975779Sxy150489 
4985779Sxy150489 /*
4995779Sxy150489  * e1000_led_off - Turn off SW controllable LED
5005779Sxy150489  * @hw: pointer to the HW structure
5015779Sxy150489  *
5025779Sxy150489  * Turns the SW defined LED off. This is a function pointer entry point
5035779Sxy150489  * called by drivers.
5045779Sxy150489  */
5055779Sxy150489 s32
5065779Sxy150489 e1000_led_off(struct e1000_hw *hw)
5075779Sxy150489 {
508*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.led_off)
509*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.led_off(hw));
5105779Sxy150489 
5115779Sxy150489 	return (E1000_SUCCESS);
5125779Sxy150489 }
5135779Sxy150489 
5145779Sxy150489 /*
5155779Sxy150489  * e1000_reset_adaptive - Reset adaptive IFS
5165779Sxy150489  * @hw: pointer to the HW structure
5175779Sxy150489  *
5185779Sxy150489  * Resets the adaptive IFS. Currently no func pointer exists and all
5195779Sxy150489  * implementations are handled in the generic version of this function.
5205779Sxy150489  */
5215779Sxy150489 void
5225779Sxy150489 e1000_reset_adaptive(struct e1000_hw *hw)
5235779Sxy150489 {
5245779Sxy150489 	e1000_reset_adaptive_generic(hw);
5255779Sxy150489 }
5265779Sxy150489 
5275779Sxy150489 /*
5285779Sxy150489  * e1000_update_adaptive - Update adaptive IFS
5295779Sxy150489  * @hw: pointer to the HW structure
5305779Sxy150489  *
5315779Sxy150489  * Updates adapter IFS. Currently no func pointer exists and all
5325779Sxy150489  * implementations are handled in the generic version of this function.
5335779Sxy150489  */
5345779Sxy150489 void
5355779Sxy150489 e1000_update_adaptive(struct e1000_hw *hw)
5365779Sxy150489 {
5375779Sxy150489 	e1000_update_adaptive_generic(hw);
5385779Sxy150489 }
5395779Sxy150489 
5405779Sxy150489 /*
5415779Sxy150489  * e1000_disable_pcie_master - Disable PCI-Express master access
5425779Sxy150489  * @hw: pointer to the HW structure
5435779Sxy150489  *
5445779Sxy150489  * Disables PCI-Express master access and verifies there are no pending
5455779Sxy150489  * requests. Currently no func pointer exists and all implementations are
5465779Sxy150489  * handled in the generic version of this function.
5475779Sxy150489  */
5485779Sxy150489 s32
5495779Sxy150489 e1000_disable_pcie_master(struct e1000_hw *hw)
5505779Sxy150489 {
5515779Sxy150489 	return (e1000_disable_pcie_master_generic(hw));
5525779Sxy150489 }
5535779Sxy150489 
5545779Sxy150489 /*
5555779Sxy150489  * e1000_config_collision_dist - Configure collision distance
5565779Sxy150489  * @hw: pointer to the HW structure
5575779Sxy150489  *
5585779Sxy150489  * Configures the collision distance to the default value and is used
5595779Sxy150489  * during link setup.
5605779Sxy150489  */
5615779Sxy150489 void
5625779Sxy150489 e1000_config_collision_dist(struct e1000_hw *hw)
5635779Sxy150489 {
564*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.config_collision_dist)
565*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.config_collision_dist(hw);
5665779Sxy150489 }
5675779Sxy150489 
5685779Sxy150489 /*
5695779Sxy150489  * e1000_rar_set - Sets a receive address register
5705779Sxy150489  * @hw: pointer to the HW structure
5715779Sxy150489  * @addr: address to set the RAR to
5725779Sxy150489  * @index: the RAR to set
5735779Sxy150489  *
5745779Sxy150489  * Sets a Receive Address Register (RAR) to the specified address.
5755779Sxy150489  */
5765779Sxy150489 void
5775779Sxy150489 e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
5785779Sxy150489 {
579*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.rar_set)
580*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.rar_set(hw, addr, index);
5815779Sxy150489 }
5825779Sxy150489 
5835779Sxy150489 /*
5845779Sxy150489  * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
5855779Sxy150489  * @hw: pointer to the HW structure
5865779Sxy150489  *
5875779Sxy150489  * Ensures that the MDI/MDIX SW state is valid.
5885779Sxy150489  */
5895779Sxy150489 s32
5905779Sxy150489 e1000_validate_mdi_setting(struct e1000_hw *hw)
5915779Sxy150489 {
592*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.validate_mdi_setting)
593*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.validate_mdi_setting(hw));
5945779Sxy150489 
5955779Sxy150489 	return (E1000_SUCCESS);
5965779Sxy150489 }
5975779Sxy150489 
5985779Sxy150489 /*
5995779Sxy150489  * e1000_mta_set - Sets multicast table bit
6005779Sxy150489  * @hw: pointer to the HW structure
6015779Sxy150489  * @hash_value: Multicast hash value.
6025779Sxy150489  *
6035779Sxy150489  * This sets the bit in the multicast table corresponding to the
6045779Sxy150489  * hash value.  This is a function pointer entry point called by drivers.
6055779Sxy150489  */
6065779Sxy150489 void
6075779Sxy150489 e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
6085779Sxy150489 {
609*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.mta_set)
610*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.mta_set(hw, hash_value);
6115779Sxy150489 }
6125779Sxy150489 
6135779Sxy150489 /*
6145779Sxy150489  * e1000_hash_mc_addr - Determines address location in multicast table
6155779Sxy150489  * @hw: pointer to the HW structure
6165779Sxy150489  * @mc_addr: Multicast address to hash.
6175779Sxy150489  *
6185779Sxy150489  * This hashes an address to determine its location in the multicast
6195779Sxy150489  * table. Currently no func pointer exists and all implementations
6205779Sxy150489  * are handled in the generic version of this function.
6215779Sxy150489  */
6225779Sxy150489 u32
6235779Sxy150489 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
6245779Sxy150489 {
6255779Sxy150489 	return (e1000_hash_mc_addr_generic(hw, mc_addr));
6265779Sxy150489 }
6275779Sxy150489 
6285779Sxy150489 /*
6295779Sxy150489  * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
6305779Sxy150489  * @hw: pointer to the HW structure
6315779Sxy150489  *
6325779Sxy150489  * Enables packet filtering on transmit packets if manageability is enabled
6335779Sxy150489  * and host interface is enabled.
6345779Sxy150489  * Currently no func pointer exists and all implementations are handled in the
6355779Sxy150489  * generic version of this function.
6365779Sxy150489  */
6375779Sxy150489 bool
6385779Sxy150489 e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
6395779Sxy150489 {
6405779Sxy150489 	return (e1000_enable_tx_pkt_filtering_generic(hw));
6415779Sxy150489 }
6425779Sxy150489 
6435779Sxy150489 /*
6445779Sxy150489  * e1000_mng_host_if_write - Writes to the manageability host interface
6455779Sxy150489  * @hw: pointer to the HW structure
6465779Sxy150489  * @buffer: pointer to the host interface buffer
6475779Sxy150489  * @length: size of the buffer
6485779Sxy150489  * @offset: location in the buffer to write to
6495779Sxy150489  * @sum: sum of the data (not checksum)
6505779Sxy150489  *
6515779Sxy150489  * This function writes the buffer content at the offset given on the host if.
6525779Sxy150489  * It also does alignment considerations to do the writes in most efficient
6535779Sxy150489  * way.  Also fills up the sum of the buffer in *buffer parameter.
6545779Sxy150489  */
6555779Sxy150489 s32
6565779Sxy150489 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
6575779Sxy150489     u16 offset, u8 *sum)
6585779Sxy150489 {
659*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.mng_host_if_write)
660*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.mng_host_if_write(hw, buffer, length,
661*8571SChenlu.Chen@Sun.COM 		    offset, sum));
6625779Sxy150489 
6635779Sxy150489 	return (E1000_NOT_IMPLEMENTED);
6645779Sxy150489 }
6655779Sxy150489 
6665779Sxy150489 /*
6675779Sxy150489  * e1000_mng_write_cmd_header - Writes manageability command header
6685779Sxy150489  * @hw: pointer to the HW structure
6695779Sxy150489  * @hdr: pointer to the host interface command header
6705779Sxy150489  *
6715779Sxy150489  * Writes the command header after does the checksum calculation.
6725779Sxy150489  */
6735779Sxy150489 s32
6745779Sxy150489 e1000_mng_write_cmd_header(struct e1000_hw *hw,
6755779Sxy150489     struct e1000_host_mng_command_header *hdr)
6765779Sxy150489 {
677*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.mng_write_cmd_header)
678*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.mng_write_cmd_header(hw, hdr));
6795779Sxy150489 
6805779Sxy150489 	return (E1000_NOT_IMPLEMENTED);
6815779Sxy150489 }
6825779Sxy150489 
6835779Sxy150489 /*
6845779Sxy150489  * e1000_mng_enable_host_if - Checks host interface is enabled
6855779Sxy150489  * @hw: pointer to the HW structure
6865779Sxy150489  *
6875779Sxy150489  * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
6885779Sxy150489  *
689*8571SChenlu.Chen@Sun.COM  * This function checks whether the HOST IF is enabled for command operation
6905779Sxy150489  * and also checks whether the previous command is completed.  It busy waits
6915779Sxy150489  * in case of previous command is not completed.
6925779Sxy150489  */
6935779Sxy150489 s32
6945779Sxy150489 e1000_mng_enable_host_if(struct e1000_hw *hw)
6955779Sxy150489 {
696*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.mng_enable_host_if)
697*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.mng_enable_host_if(hw));
6985779Sxy150489 
6995779Sxy150489 	return (E1000_NOT_IMPLEMENTED);
7005779Sxy150489 }
7015779Sxy150489 
7025779Sxy150489 /*
7035779Sxy150489  * e1000_wait_autoneg - Waits for autonegotiation completion
7045779Sxy150489  * @hw: pointer to the HW structure
7055779Sxy150489  *
7065779Sxy150489  * Waits for autoneg to complete. Currently no func pointer exists and all
7075779Sxy150489  * implementations are handled in the generic version of this function.
7085779Sxy150489  */
7095779Sxy150489 s32
7105779Sxy150489 e1000_wait_autoneg(struct e1000_hw *hw)
7115779Sxy150489 {
712*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.wait_autoneg)
713*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.wait_autoneg(hw));
7145779Sxy150489 
7155779Sxy150489 	return (E1000_SUCCESS);
7165779Sxy150489 }
7175779Sxy150489 
7185779Sxy150489 /*
7195779Sxy150489  * e1000_check_reset_block - Verifies PHY can be reset
7205779Sxy150489  * @hw: pointer to the HW structure
7215779Sxy150489  *
7225779Sxy150489  * Checks if the PHY is in a state that can be reset or if manageability
7235779Sxy150489  * has it tied up. This is a function pointer entry point called by drivers.
7245779Sxy150489  */
7255779Sxy150489 s32
7265779Sxy150489 e1000_check_reset_block(struct e1000_hw *hw)
7275779Sxy150489 {
728*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.check_reset_block)
729*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.check_reset_block(hw));
7305779Sxy150489 
7315779Sxy150489 	return (E1000_SUCCESS);
7325779Sxy150489 }
7335779Sxy150489 
7345779Sxy150489 /*
7355779Sxy150489  * e1000_read_phy_reg - Reads PHY register
7365779Sxy150489  * @hw: pointer to the HW structure
7375779Sxy150489  * @offset: the register to read
7385779Sxy150489  * @data: the buffer to store the 16-bit read.
7395779Sxy150489  *
7405779Sxy150489  * Reads the PHY register and returns the value in data.
7415779Sxy150489  * This is a function pointer entry point called by drivers.
7425779Sxy150489  */
7435779Sxy150489 s32
7445779Sxy150489 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
7455779Sxy150489 {
746*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.read_reg)
747*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.read_reg(hw, offset, data));
7485779Sxy150489 
7495779Sxy150489 	return (E1000_SUCCESS);
7505779Sxy150489 }
7515779Sxy150489 
7525779Sxy150489 /*
7535779Sxy150489  * e1000_write_phy_reg - Writes PHY register
7545779Sxy150489  * @hw: pointer to the HW structure
7555779Sxy150489  * @offset: the register to write
7565779Sxy150489  * @data: the value to write.
7575779Sxy150489  *
7585779Sxy150489  * Writes the PHY register at offset with the value in data.
7595779Sxy150489  * This is a function pointer entry point called by drivers.
7605779Sxy150489  */
7615779Sxy150489 s32
7625779Sxy150489 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
7635779Sxy150489 {
764*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.write_reg)
765*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.write_reg(hw, offset, data));
766*8571SChenlu.Chen@Sun.COM 
767*8571SChenlu.Chen@Sun.COM 	return (E1000_SUCCESS);
768*8571SChenlu.Chen@Sun.COM }
769*8571SChenlu.Chen@Sun.COM 
770*8571SChenlu.Chen@Sun.COM /*
771*8571SChenlu.Chen@Sun.COM  * e1000_release_phy - Generic release PHY
772*8571SChenlu.Chen@Sun.COM  * @hw: pointer to the HW structure
773*8571SChenlu.Chen@Sun.COM  *
774*8571SChenlu.Chen@Sun.COM  * Return if silicon family does not require a semaphore when accessing the
775*8571SChenlu.Chen@Sun.COM  * PHY.
776*8571SChenlu.Chen@Sun.COM  */
777*8571SChenlu.Chen@Sun.COM void
778*8571SChenlu.Chen@Sun.COM e1000_release_phy(struct e1000_hw *hw)
779*8571SChenlu.Chen@Sun.COM {
780*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.release)
781*8571SChenlu.Chen@Sun.COM 		hw->phy.ops.release(hw);
782*8571SChenlu.Chen@Sun.COM }
783*8571SChenlu.Chen@Sun.COM 
784*8571SChenlu.Chen@Sun.COM /*
785*8571SChenlu.Chen@Sun.COM  * e1000_acquire_phy - Generic acquire PHY
786*8571SChenlu.Chen@Sun.COM  * @hw: pointer to the HW structure
787*8571SChenlu.Chen@Sun.COM  *
788*8571SChenlu.Chen@Sun.COM  * Return success if silicon family does not require a semaphore when
789*8571SChenlu.Chen@Sun.COM  * accessing the PHY.
790*8571SChenlu.Chen@Sun.COM  */
791*8571SChenlu.Chen@Sun.COM s32
792*8571SChenlu.Chen@Sun.COM e1000_acquire_phy(struct e1000_hw *hw)
793*8571SChenlu.Chen@Sun.COM {
794*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.acquire)
795*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.acquire(hw));
7965779Sxy150489 
7975779Sxy150489 	return (E1000_SUCCESS);
7985779Sxy150489 }
7995779Sxy150489 
8005779Sxy150489 /*
8015779Sxy150489  * e1000_read_kmrn_reg - Reads register using Kumeran interface
8025779Sxy150489  * @hw: pointer to the HW structure
8035779Sxy150489  * @offset: the register to read
8045779Sxy150489  * @data: the location to store the 16-bit value read.
8055779Sxy150489  *
8065779Sxy150489  * Reads a register out of the Kumeran interface. Currently no func pointer
8075779Sxy150489  * exists and all implementations are handled in the generic version of
8085779Sxy150489  * this function.
8095779Sxy150489  */
8105779Sxy150489 s32
8115779Sxy150489 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
8125779Sxy150489 {
8135779Sxy150489 	return (e1000_read_kmrn_reg_generic(hw, offset, data));
8145779Sxy150489 }
8155779Sxy150489 
8165779Sxy150489 /*
8175779Sxy150489  * e1000_write_kmrn_reg - Writes register using Kumeran interface
8185779Sxy150489  * @hw: pointer to the HW structure
8195779Sxy150489  * @offset: the register to write
8205779Sxy150489  * @data: the value to write.
8215779Sxy150489  *
8225779Sxy150489  * Writes a register to the Kumeran interface. Currently no func pointer
8235779Sxy150489  * exists and all implementations are handled in the generic version of
8245779Sxy150489  * this function.
8255779Sxy150489  */
8265779Sxy150489 s32
8275779Sxy150489 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
8285779Sxy150489 {
8295779Sxy150489 	return (e1000_write_kmrn_reg_generic(hw, offset, data));
8305779Sxy150489 }
8315779Sxy150489 
8325779Sxy150489 /*
8335779Sxy150489  * e1000_get_cable_length - Retrieves cable length estimation
8345779Sxy150489  * @hw: pointer to the HW structure
8355779Sxy150489  *
8365779Sxy150489  * This function estimates the cable length and stores them in
8375779Sxy150489  * hw->phy.min_length and hw->phy.max_length. This is a function pointer
8385779Sxy150489  * entry point called by drivers.
8395779Sxy150489  */
8405779Sxy150489 s32
8415779Sxy150489 e1000_get_cable_length(struct e1000_hw *hw)
8425779Sxy150489 {
843*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.get_cable_length)
844*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.get_cable_length(hw));
8455779Sxy150489 
8465779Sxy150489 	return (E1000_SUCCESS);
8475779Sxy150489 }
8485779Sxy150489 
8495779Sxy150489 /*
8505779Sxy150489  * e1000_get_phy_info - Retrieves PHY information from registers
8515779Sxy150489  * @hw: pointer to the HW structure
8525779Sxy150489  *
8535779Sxy150489  * This function gets some information from various PHY registers and
8545779Sxy150489  * populates hw->phy values with it. This is a function pointer entry
8555779Sxy150489  * point called by drivers.
8565779Sxy150489  */
8575779Sxy150489 s32
8585779Sxy150489 e1000_get_phy_info(struct e1000_hw *hw)
8595779Sxy150489 {
860*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.get_info)
861*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.get_info(hw));
8625779Sxy150489 
8635779Sxy150489 	return (E1000_SUCCESS);
8645779Sxy150489 }
8655779Sxy150489 
8665779Sxy150489 /*
8675779Sxy150489  * e1000_phy_hw_reset - Hard PHY reset
8685779Sxy150489  * @hw: pointer to the HW structure
8695779Sxy150489  *
8705779Sxy150489  * Performs a hard PHY reset. This is a function pointer entry point called
8715779Sxy150489  * by drivers.
8725779Sxy150489  */
8735779Sxy150489 s32
8745779Sxy150489 e1000_phy_hw_reset(struct e1000_hw *hw)
8755779Sxy150489 {
876*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.reset)
877*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.reset(hw));
8785779Sxy150489 
8795779Sxy150489 	return (E1000_SUCCESS);
8805779Sxy150489 }
8815779Sxy150489 
8825779Sxy150489 /*
8835779Sxy150489  * e1000_phy_commit - Soft PHY reset
8845779Sxy150489  * @hw: pointer to the HW structure
8855779Sxy150489  *
8865779Sxy150489  * Performs a soft PHY reset on those that apply. This is a function pointer
8875779Sxy150489  * entry point called by drivers.
8885779Sxy150489  */
8895779Sxy150489 s32
8905779Sxy150489 e1000_phy_commit(struct e1000_hw *hw)
8915779Sxy150489 {
892*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.commit)
893*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.commit(hw));
8945779Sxy150489 
8955779Sxy150489 	return (E1000_SUCCESS);
8965779Sxy150489 }
8975779Sxy150489 
8985779Sxy150489 /*
899*8571SChenlu.Chen@Sun.COM  * e1000_set_d0_lplu_state - Sets low power link up state for D0
9005779Sxy150489  * @hw: pointer to the HW structure
9015779Sxy150489  * @active: boolean used to enable/disable lplu
9025779Sxy150489  *
9035779Sxy150489  * Success returns 0, Failure returns 1
9045779Sxy150489  *
9055779Sxy150489  * The low power link up (lplu) state is set to the power management level D0
9065779Sxy150489  * and SmartSpeed is disabled when active is true, else clear lplu for D0
9075779Sxy150489  * and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
9085779Sxy150489  * is used during Dx states where the power conservation is most important.
9095779Sxy150489  * During driver activity, SmartSpeed should be enabled so performance is
9105779Sxy150489  * maintained.  This is a function pointer entry point called by drivers.
9115779Sxy150489  */
9125779Sxy150489 s32
9135779Sxy150489 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
9145779Sxy150489 {
915*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.set_d0_lplu_state)
916*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.set_d0_lplu_state(hw, active));
9175779Sxy150489 
9185779Sxy150489 	return (E1000_SUCCESS);
9195779Sxy150489 }
9205779Sxy150489 
9215779Sxy150489 /*
9225779Sxy150489  * e1000_set_d3_lplu_state - Sets low power link up state for D3
9235779Sxy150489  * @hw: pointer to the HW structure
9245779Sxy150489  * @active: boolean used to enable/disable lplu
9255779Sxy150489  *
9265779Sxy150489  * Success returns 0, Failure returns 1
9275779Sxy150489  *
9285779Sxy150489  * The low power link up (lplu) state is set to the power management level D3
9295779Sxy150489  * and SmartSpeed is disabled when active is true, else clear lplu for D3
9305779Sxy150489  * and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
9315779Sxy150489  * is used during Dx states where the power conservation is most important.
9325779Sxy150489  * During driver activity, SmartSpeed should be enabled so performance is
9335779Sxy150489  * maintained.  This is a function pointer entry point called by drivers.
9345779Sxy150489  */
9355779Sxy150489 s32
9365779Sxy150489 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
9375779Sxy150489 {
938*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.set_d3_lplu_state)
939*8571SChenlu.Chen@Sun.COM 		return (hw->phy.ops.set_d3_lplu_state(hw, active));
9405779Sxy150489 
9415779Sxy150489 	return (E1000_SUCCESS);
9425779Sxy150489 }
9435779Sxy150489 
9445779Sxy150489 /*
9455779Sxy150489  * e1000_read_mac_addr - Reads MAC address
9465779Sxy150489  * @hw: pointer to the HW structure
9475779Sxy150489  *
9485779Sxy150489  * Reads the MAC address out of the adapter and stores it in the HW structure.
9495779Sxy150489  * Currently no func pointer exists and all implementations are handled in the
9505779Sxy150489  * generic version of this function.
9515779Sxy150489  */
9525779Sxy150489 s32
9535779Sxy150489 e1000_read_mac_addr(struct e1000_hw *hw)
9545779Sxy150489 {
955*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.read_mac_addr)
956*8571SChenlu.Chen@Sun.COM 		return (hw->mac.ops.read_mac_addr(hw));
9575779Sxy150489 
9585779Sxy150489 	return (e1000_read_mac_addr_generic(hw));
9595779Sxy150489 }
9605779Sxy150489 
9615779Sxy150489 /*
9625779Sxy150489  * e1000_read_pba_num - Read device part number
9635779Sxy150489  * @hw: pointer to the HW structure
9645779Sxy150489  * @pba_num: pointer to device part number
9655779Sxy150489  *
9665779Sxy150489  * Reads the product board assembly (PBA) number from the EEPROM and stores
9675779Sxy150489  * the value in pba_num.
9685779Sxy150489  * Currently no func pointer exists and all implementations are handled in the
9695779Sxy150489  * generic version of this function.
9705779Sxy150489  */
9715779Sxy150489 s32
9725779Sxy150489 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
9735779Sxy150489 {
9745779Sxy150489 	return (e1000_read_pba_num_generic(hw, pba_num));
9755779Sxy150489 }
9765779Sxy150489 
9775779Sxy150489 /*
9785779Sxy150489  * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
9795779Sxy150489  * @hw: pointer to the HW structure
9805779Sxy150489  *
9815779Sxy150489  * Validates the NVM checksum is correct. This is a function pointer entry
9825779Sxy150489  * point called by drivers.
9835779Sxy150489  */
9845779Sxy150489 s32
9855779Sxy150489 e1000_validate_nvm_checksum(struct e1000_hw *hw)
9865779Sxy150489 {
987*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.validate)
988*8571SChenlu.Chen@Sun.COM 		return (hw->nvm.ops.validate(hw));
9895779Sxy150489 
9905779Sxy150489 	return (-E1000_ERR_CONFIG);
9915779Sxy150489 }
9925779Sxy150489 
9935779Sxy150489 /*
9945779Sxy150489  * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
9955779Sxy150489  * @hw: pointer to the HW structure
9965779Sxy150489  *
9975779Sxy150489  * Updates the NVM checksum. Currently no func pointer exists and all
9985779Sxy150489  * implementations are handled in the generic version of this function.
9995779Sxy150489  */
10005779Sxy150489 s32
10015779Sxy150489 e1000_update_nvm_checksum(struct e1000_hw *hw)
10025779Sxy150489 {
1003*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.update)
1004*8571SChenlu.Chen@Sun.COM 		return (hw->nvm.ops.update(hw));
10055779Sxy150489 
10065779Sxy150489 	return (-E1000_ERR_CONFIG);
10075779Sxy150489 }
10085779Sxy150489 
10095779Sxy150489 /*
10105779Sxy150489  * e1000_reload_nvm - Reloads EEPROM
10115779Sxy150489  * @hw: pointer to the HW structure
10125779Sxy150489  *
10135779Sxy150489  * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
10145779Sxy150489  * extended control register.
10155779Sxy150489  */
10165779Sxy150489 void
10175779Sxy150489 e1000_reload_nvm(struct e1000_hw *hw)
10185779Sxy150489 {
1019*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.reload)
1020*8571SChenlu.Chen@Sun.COM 		hw->nvm.ops.reload(hw);
10215779Sxy150489 }
10225779Sxy150489 
10235779Sxy150489 /*
10245779Sxy150489  * e1000_read_nvm - Reads NVM (EEPROM)
10255779Sxy150489  * @hw: pointer to the HW structure
10265779Sxy150489  * @offset: the word offset to read
10275779Sxy150489  * @words: number of 16-bit words to read
10285779Sxy150489  * @data: pointer to the properly sized buffer for the data.
10295779Sxy150489  *
10305779Sxy150489  * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
10315779Sxy150489  * pointer entry point called by drivers.
10325779Sxy150489  */
10335779Sxy150489 s32
10345779Sxy150489 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
10355779Sxy150489 {
1036*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.read)
1037*8571SChenlu.Chen@Sun.COM 		return (hw->nvm.ops.read(hw, offset, words, data));
10385779Sxy150489 
10395779Sxy150489 	return (-E1000_ERR_CONFIG);
10405779Sxy150489 }
10415779Sxy150489 
10425779Sxy150489 /*
10435779Sxy150489  * e1000_write_nvm - Writes to NVM (EEPROM)
10445779Sxy150489  * @hw: pointer to the HW structure
10455779Sxy150489  * @offset: the word offset to read
10465779Sxy150489  * @words: number of 16-bit words to write
10475779Sxy150489  * @data: pointer to the properly sized buffer for the data.
10485779Sxy150489  *
10495779Sxy150489  * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
10505779Sxy150489  * pointer entry point called by drivers.
10515779Sxy150489  */
10525779Sxy150489 s32
10535779Sxy150489 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
10545779Sxy150489 {
1055*8571SChenlu.Chen@Sun.COM 	if (hw->nvm.ops.write)
1056*8571SChenlu.Chen@Sun.COM 		return (hw->nvm.ops.write(hw, offset, words, data));
10575779Sxy150489 
10585779Sxy150489 	return (E1000_SUCCESS);
10595779Sxy150489 }
10605779Sxy150489 
10615779Sxy150489 /*
10625779Sxy150489  * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
10635779Sxy150489  * @hw: pointer to the HW structure
10645779Sxy150489  * @reg: 32bit register offset
10655779Sxy150489  * @offset: the register to write
10665779Sxy150489  * @data: the value to write.
10675779Sxy150489  *
10685779Sxy150489  * Writes the PHY register at offset with the value in data.
10695779Sxy150489  * This is a function pointer entry point called by drivers.
10705779Sxy150489  */
10715779Sxy150489 s32
10725779Sxy150489 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
10735779Sxy150489 {
10745779Sxy150489 	return (e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data));
10755779Sxy150489 }
10765779Sxy150489 
10775779Sxy150489 /*
10785779Sxy150489  * e1000_power_up_phy - Restores link in case of PHY power down
10795779Sxy150489  * @hw: pointer to the HW structure
10805779Sxy150489  *
10815779Sxy150489  * The phy may be powered down to save power, to turn off link when the
10825779Sxy150489  * driver is unloaded, or wake on lan is not enabled (among others).
10835779Sxy150489  */
10845779Sxy150489 void
10855779Sxy150489 e1000_power_up_phy(struct e1000_hw *hw)
10865779Sxy150489 {
1087*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.power_up)
1088*8571SChenlu.Chen@Sun.COM 		hw->phy.ops.power_up(hw);
10895779Sxy150489 
10905779Sxy150489 	(void) e1000_setup_link(hw);
10915779Sxy150489 }
10925779Sxy150489 
10935779Sxy150489 /*
10945779Sxy150489  * e1000_power_down_phy - Power down PHY
10955779Sxy150489  * @hw: pointer to the HW structure
10965779Sxy150489  *
10975779Sxy150489  * The phy may be powered down to save power, to turn off link when the
10985779Sxy150489  * driver is unloaded, or wake on lan is not enabled (among others).
10995779Sxy150489  */
11005779Sxy150489 void
11015779Sxy150489 e1000_power_down_phy(struct e1000_hw *hw)
11025779Sxy150489 {
1103*8571SChenlu.Chen@Sun.COM 	if (hw->phy.ops.power_down)
1104*8571SChenlu.Chen@Sun.COM 		hw->phy.ops.power_down(hw);
11055779Sxy150489 }
1106*8571SChenlu.Chen@Sun.COM 
1107*8571SChenlu.Chen@Sun.COM /*
1108*8571SChenlu.Chen@Sun.COM  * e1000_shutdown_fiber_serdes_link - Remove link during power down
1109*8571SChenlu.Chen@Sun.COM  * @hw: pointer to the HW structure
1110*8571SChenlu.Chen@Sun.COM  *
1111*8571SChenlu.Chen@Sun.COM  * Shutdown the optics and PCS on driver unload.
1112*8571SChenlu.Chen@Sun.COM  */
1113*8571SChenlu.Chen@Sun.COM void
1114*8571SChenlu.Chen@Sun.COM e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
1115*8571SChenlu.Chen@Sun.COM {
1116*8571SChenlu.Chen@Sun.COM 	if (hw->mac.ops.shutdown_serdes)
1117*8571SChenlu.Chen@Sun.COM 		hw->mac.ops.shutdown_serdes(hw);
1118*8571SChenlu.Chen@Sun.COM }
1119