xref: /onnv-gate/usr/src/uts/common/io/ixgbe/ixgbe_api.c (revision 10998:fa3b21f3b03c)
16621Sbt150084 /*
26621Sbt150084  * CDDL HEADER START
36621Sbt150084  *
49353SSamuel.Tu@Sun.COM  * Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
56621Sbt150084  * The contents of this file are subject to the terms of the
66621Sbt150084  * Common Development and Distribution License (the "License").
76621Sbt150084  * You may not use this file except in compliance with the License.
86621Sbt150084  *
96621Sbt150084  * You can obtain a copy of the license at:
106621Sbt150084  *      http://www.opensolaris.org/os/licensing.
116621Sbt150084  * See the License for the specific language governing permissions
126621Sbt150084  * and limitations under the License.
136621Sbt150084  *
146621Sbt150084  * When using or redistributing this file, you may do so under the
156621Sbt150084  * License only. No other modification of this header is permitted.
166621Sbt150084  *
176621Sbt150084  * If applicable, add the following below this CDDL HEADER, with the
186621Sbt150084  * fields enclosed by brackets "[]" replaced with your own identifying
196621Sbt150084  * information: Portions Copyright [yyyy] [name of copyright owner]
206621Sbt150084  *
216621Sbt150084  * CDDL HEADER END
226621Sbt150084  */
236621Sbt150084 
246621Sbt150084 /*
258490SPaul.Guo@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
269353SSamuel.Tu@Sun.COM  * Use is subject to license terms.
276621Sbt150084  */
286621Sbt150084 
29*10998SChenlu.Chen@Sun.COM /* IntelVersion: 1.131 scm_100309_002210 */
306621Sbt150084 
316621Sbt150084 #include "ixgbe_api.h"
326621Sbt150084 #include "ixgbe_common.h"
336621Sbt150084 
346621Sbt150084 extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
359353SSamuel.Tu@Sun.COM extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
366621Sbt150084 
376621Sbt150084 /*
386621Sbt150084  * ixgbe_init_shared_code - Initialize the shared code
396621Sbt150084  * @hw: pointer to hardware structure
406621Sbt150084  *
416621Sbt150084  * This will assign function pointers and assign the MAC type and PHY code.
426621Sbt150084  * Does not touch the hardware. This function must be called prior to any
436621Sbt150084  * other function in the shared code. The ixgbe_hw structure should be
446621Sbt150084  * memset to 0 prior to calling this function.  The following fields in
456621Sbt150084  * hw structure should be filled in prior to calling this function:
466621Sbt150084  * hw_addr, back, device_id, vendor_id, subsystem_device_id,
479353SSamuel.Tu@Sun.COM  * subsystem_vendor_id, and revision_id
486621Sbt150084  */
496621Sbt150084 s32
506621Sbt150084 ixgbe_init_shared_code(struct ixgbe_hw *hw)
516621Sbt150084 {
526621Sbt150084 	s32 status;
536621Sbt150084 
54*10998SChenlu.Chen@Sun.COM 	DEBUGFUNC("ixgbe_init_shared_code");
55*10998SChenlu.Chen@Sun.COM 
566621Sbt150084 	/*
576621Sbt150084 	 * Set the mac type
586621Sbt150084 	 */
596621Sbt150084 	(void) ixgbe_set_mac_type(hw);
606621Sbt150084 
616621Sbt150084 	switch (hw->mac.type) {
626621Sbt150084 	case ixgbe_mac_82598EB:
636621Sbt150084 		status = ixgbe_init_ops_82598(hw);
646621Sbt150084 		break;
659353SSamuel.Tu@Sun.COM 	case ixgbe_mac_82599EB:
669353SSamuel.Tu@Sun.COM 		status = ixgbe_init_ops_82599(hw);
679353SSamuel.Tu@Sun.COM 		break;
686621Sbt150084 	default:
696621Sbt150084 		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
706621Sbt150084 		break;
716621Sbt150084 	}
726621Sbt150084 
736621Sbt150084 	return (status);
746621Sbt150084 }
756621Sbt150084 
766621Sbt150084 /*
776621Sbt150084  * ixgbe_set_mac_type - Sets MAC type
786621Sbt150084  * @hw: pointer to the HW structure
796621Sbt150084  *
806621Sbt150084  * This function sets the mac type of the adapter based on the
816621Sbt150084  * vendor ID and device ID stored in the hw structure.
826621Sbt150084  */
836621Sbt150084 s32
846621Sbt150084 ixgbe_set_mac_type(struct ixgbe_hw *hw)
856621Sbt150084 {
866621Sbt150084 	s32 ret_val = IXGBE_SUCCESS;
876621Sbt150084 
888490SPaul.Guo@Sun.COM 	DEBUGFUNC("ixgbe_set_mac_type\n");
896621Sbt150084 
906621Sbt150084 	if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
916621Sbt150084 		switch (hw->device_id) {
929353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82598:
939353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82598_BX:
946621Sbt150084 		case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
956621Sbt150084 		case IXGBE_DEV_ID_82598AF_DUAL_PORT:
968490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598AT:
97*10998SChenlu.Chen@Sun.COM 		case IXGBE_DEV_ID_82598AT2:
986621Sbt150084 		case IXGBE_DEV_ID_82598EB_CX4:
996621Sbt150084 		case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
1008490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
1018490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
1026621Sbt150084 		case IXGBE_DEV_ID_82598EB_XF_LR:
1038490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598EB_SFP_LOM:
1046621Sbt150084 			hw->mac.type = ixgbe_mac_82598EB;
1056621Sbt150084 			break;
1069353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_KX4:
107*10998SChenlu.Chen@Sun.COM 		case IXGBE_DEV_ID_82599_KX4_MEZZ:
10810305SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82599_XAUI_LOM:
109*10998SChenlu.Chen@Sun.COM 		case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
1109353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_SFP:
111*10998SChenlu.Chen@Sun.COM 		case IXGBE_DEV_ID_82599_SFP_EM:
1129353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_CX4:
1139353SSamuel.Tu@Sun.COM 			hw->mac.type = ixgbe_mac_82599EB;
1149353SSamuel.Tu@Sun.COM 			break;
1156621Sbt150084 		default:
1166621Sbt150084 			ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
1176621Sbt150084 			break;
1186621Sbt150084 		}
1196621Sbt150084 	} else {
1206621Sbt150084 		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
1216621Sbt150084 	}
1226621Sbt150084 
1238490SPaul.Guo@Sun.COM 	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
1248490SPaul.Guo@Sun.COM 	    hw->mac.type, ret_val);
1258490SPaul.Guo@Sun.COM 
1266621Sbt150084 	return (ret_val);
1276621Sbt150084 }
1286621Sbt150084 
1296621Sbt150084 /*
1306621Sbt150084  * ixgbe_init_hw - Initialize the hardware
1316621Sbt150084  * @hw: pointer to hardware structure
1326621Sbt150084  *
1336621Sbt150084  * Initialize the hardware by resetting and then starting the hardware
1346621Sbt150084  */
1356621Sbt150084 s32
1366621Sbt150084 ixgbe_init_hw(struct ixgbe_hw *hw)
1376621Sbt150084 {
1386621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
1396621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1406621Sbt150084 }
1416621Sbt150084 
1426621Sbt150084 /*
1436621Sbt150084  * ixgbe_reset_hw - Performs a hardware reset
1446621Sbt150084  * @hw: pointer to hardware structure
1456621Sbt150084  *
1466621Sbt150084  * Resets the hardware by resetting the transmit and receive units, masks and
1476621Sbt150084  * clears all interrupts, performs a PHY reset, and performs a MAC reset
1486621Sbt150084  */
1496621Sbt150084 s32
1506621Sbt150084 ixgbe_reset_hw(struct ixgbe_hw *hw)
1516621Sbt150084 {
1526621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
1536621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1546621Sbt150084 }
1556621Sbt150084 
1566621Sbt150084 /*
1576621Sbt150084  * ixgbe_start_hw - Prepares hardware for Rx/Tx
1586621Sbt150084  * @hw: pointer to hardware structure
1596621Sbt150084  *
1606621Sbt150084  * Starts the hardware by filling the bus info structure and media type,
1616621Sbt150084  * clears all on chip counters, initializes receive address registers,
1626621Sbt150084  * multicast table, VLAN filter table, calls routine to setup link and
1636621Sbt150084  * flow control settings, and leaves transmit and receive units disabled
1646621Sbt150084  * and uninitialized.
1656621Sbt150084  */
1666621Sbt150084 s32
1676621Sbt150084 ixgbe_start_hw(struct ixgbe_hw *hw)
1686621Sbt150084 {
1696621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
1706621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1716621Sbt150084 }
1726621Sbt150084 
1736621Sbt150084 /*
1746621Sbt150084  * ixgbe_clear_hw_cntrs - Clear hardware counters
1756621Sbt150084  * @hw: pointer to hardware structure
1766621Sbt150084  *
1776621Sbt150084  * Clears all hardware statistics counters by reading them from the hardware
1786621Sbt150084  * Statistics counters are clear on read.
1796621Sbt150084  */
1806621Sbt150084 s32
1816621Sbt150084 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
1826621Sbt150084 {
1836621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
1846621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1856621Sbt150084 }
1866621Sbt150084 
1876621Sbt150084 /*
1886621Sbt150084  * ixgbe_get_media_type - Get media type
1896621Sbt150084  * @hw: pointer to hardware structure
1906621Sbt150084  *
1916621Sbt150084  * Returns the media type (fiber, copper, backplane)
1926621Sbt150084  */
1936621Sbt150084 enum ixgbe_media_type
1946621Sbt150084 ixgbe_get_media_type(struct ixgbe_hw *hw)
1956621Sbt150084 {
1966621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
1976621Sbt150084 	    ixgbe_media_type_unknown);
1986621Sbt150084 }
1996621Sbt150084 
2006621Sbt150084 /*
2016621Sbt150084  * ixgbe_get_mac_addr - Get MAC address
2026621Sbt150084  * @hw: pointer to hardware structure
2036621Sbt150084  * @mac_addr: Adapter MAC address
2046621Sbt150084  *
2056621Sbt150084  * Reads the adapter's MAC address from the first Receive Address Register
2066621Sbt150084  * (RAR0) A reset of the adapter must have been performed prior to calling
2076621Sbt150084  * this function in order for the MAC address to have been loaded from the
2086621Sbt150084  * EEPROM into RAR0
2096621Sbt150084  */
2106621Sbt150084 s32
2116621Sbt150084 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
2126621Sbt150084 {
2136621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
2146621Sbt150084 	    (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
2156621Sbt150084 }
2166621Sbt150084 
2176621Sbt150084 /*
2189353SSamuel.Tu@Sun.COM  * ixgbe_get_san_mac_addr - Get SAN MAC address
2199353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2209353SSamuel.Tu@Sun.COM  * @san_mac_addr: SAN MAC address
2219353SSamuel.Tu@Sun.COM  *
2229353SSamuel.Tu@Sun.COM  * Reads the SAN MAC address from the EEPROM, if it's available.  This is
2239353SSamuel.Tu@Sun.COM  * per-port, so set_lan_id() must be called before reading the addresses.
2249353SSamuel.Tu@Sun.COM  */
2259353SSamuel.Tu@Sun.COM s32
2269353SSamuel.Tu@Sun.COM ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
2279353SSamuel.Tu@Sun.COM {
2289353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
2299353SSamuel.Tu@Sun.COM 	    (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
2309353SSamuel.Tu@Sun.COM }
2319353SSamuel.Tu@Sun.COM 
2329353SSamuel.Tu@Sun.COM /*
2339353SSamuel.Tu@Sun.COM  * ixgbe_set_san_mac_addr - Write a SAN MAC address
2349353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2359353SSamuel.Tu@Sun.COM  * @san_mac_addr: SAN MAC address
2369353SSamuel.Tu@Sun.COM  *
2379353SSamuel.Tu@Sun.COM  * Writes A SAN MAC address to the EEPROM.
2389353SSamuel.Tu@Sun.COM  */
2399353SSamuel.Tu@Sun.COM s32
2409353SSamuel.Tu@Sun.COM ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
2419353SSamuel.Tu@Sun.COM {
2429353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
2439353SSamuel.Tu@Sun.COM 	    (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
2449353SSamuel.Tu@Sun.COM }
2459353SSamuel.Tu@Sun.COM 
2469353SSamuel.Tu@Sun.COM /*
2479353SSamuel.Tu@Sun.COM  * ixgbe_get_device_caps - Get additional device capabilities
2489353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2499353SSamuel.Tu@Sun.COM  * @device_caps: the EEPROM word for device capabilities
2509353SSamuel.Tu@Sun.COM  *
2519353SSamuel.Tu@Sun.COM  * Reads the extra device capabilities from the EEPROM
2529353SSamuel.Tu@Sun.COM  */
2539353SSamuel.Tu@Sun.COM s32
2549353SSamuel.Tu@Sun.COM ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
2559353SSamuel.Tu@Sun.COM {
2569353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
2579353SSamuel.Tu@Sun.COM 	    (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
2589353SSamuel.Tu@Sun.COM }
2599353SSamuel.Tu@Sun.COM 
2609353SSamuel.Tu@Sun.COM /*
261*10998SChenlu.Chen@Sun.COM  * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
262*10998SChenlu.Chen@Sun.COM  * @hw: pointer to hardware structure
263*10998SChenlu.Chen@Sun.COM  * @wwnn_prefix: the alternative WWNN prefix
264*10998SChenlu.Chen@Sun.COM  * @wwpn_prefix: the alternative WWPN prefix
265*10998SChenlu.Chen@Sun.COM  *
266*10998SChenlu.Chen@Sun.COM  * This function will read the EEPROM from the alternative SAN MAC address
267*10998SChenlu.Chen@Sun.COM  * block to check the support for the alternative WWNN/WWPN prefix support.
268*10998SChenlu.Chen@Sun.COM  */
269*10998SChenlu.Chen@Sun.COM s32
270*10998SChenlu.Chen@Sun.COM ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix, u16 *wwpn_prefix)
271*10998SChenlu.Chen@Sun.COM {
272*10998SChenlu.Chen@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
273*10998SChenlu.Chen@Sun.COM 	    (hw, wwnn_prefix, wwpn_prefix), IXGBE_NOT_IMPLEMENTED);
274*10998SChenlu.Chen@Sun.COM }
275*10998SChenlu.Chen@Sun.COM 
276*10998SChenlu.Chen@Sun.COM /*
2776621Sbt150084  * ixgbe_get_bus_info - Set PCI bus info
2786621Sbt150084  * @hw: pointer to hardware structure
2796621Sbt150084  *
2806621Sbt150084  * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
2816621Sbt150084  */
2826621Sbt150084 s32
2836621Sbt150084 ixgbe_get_bus_info(struct ixgbe_hw *hw)
2846621Sbt150084 {
2856621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
2866621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
2876621Sbt150084 }
2886621Sbt150084 
2896621Sbt150084 /*
2906621Sbt150084  * ixgbe_get_num_of_tx_queues - Get Tx queues
2916621Sbt150084  * @hw: pointer to hardware structure
2926621Sbt150084  *
2936621Sbt150084  * Returns the number of transmit queues for the given adapter.
2946621Sbt150084  */
2956621Sbt150084 u32
2966621Sbt150084 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
2976621Sbt150084 {
2986621Sbt150084 	return (hw->mac.max_tx_queues);
2996621Sbt150084 }
3006621Sbt150084 
3016621Sbt150084 /*
3026621Sbt150084  * ixgbe_get_num_of_rx_queues - Get Rx queues
3036621Sbt150084  * @hw: pointer to hardware structure
3046621Sbt150084  *
3056621Sbt150084  * Returns the number of receive queues for the given adapter.
3066621Sbt150084  */
3076621Sbt150084 u32
3086621Sbt150084 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
3096621Sbt150084 {
3106621Sbt150084 	return (hw->mac.max_rx_queues);
3116621Sbt150084 }
3126621Sbt150084 
3136621Sbt150084 /*
3146621Sbt150084  * ixgbe_stop_adapter - Disable Rx/Tx units
3156621Sbt150084  * @hw: pointer to hardware structure
3166621Sbt150084  *
3176621Sbt150084  * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
3186621Sbt150084  * disables transmit and receive units. The adapter_stopped flag is used by
3196621Sbt150084  * the shared code and drivers to determine if the adapter is in a stopped
3206621Sbt150084  * state and should not touch the hardware.
3216621Sbt150084  */
3226621Sbt150084 s32
3236621Sbt150084 ixgbe_stop_adapter(struct ixgbe_hw *hw)
3246621Sbt150084 {
3256621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
3266621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
3276621Sbt150084 }
3286621Sbt150084 
3296621Sbt150084 /*
3306621Sbt150084  * ixgbe_read_pba_num - Reads part number from EEPROM
3316621Sbt150084  * @hw: pointer to hardware structure
3326621Sbt150084  * @pba_num: stores the part number from the EEPROM
3336621Sbt150084  *
3346621Sbt150084  * Reads the part number from the EEPROM.
3356621Sbt150084  */
3366621Sbt150084 s32
3376621Sbt150084 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
3386621Sbt150084 {
3396621Sbt150084 	return (ixgbe_read_pba_num_generic(hw, pba_num));
3406621Sbt150084 }
3416621Sbt150084 
3426621Sbt150084 /*
3436621Sbt150084  * ixgbe_identify_phy - Get PHY type
3446621Sbt150084  * @hw: pointer to hardware structure
3456621Sbt150084  *
3466621Sbt150084  * Determines the physical layer module found on the current adapter.
3476621Sbt150084  */
3486621Sbt150084 s32
3496621Sbt150084 ixgbe_identify_phy(struct ixgbe_hw *hw)
3506621Sbt150084 {
3516621Sbt150084 	s32 status = IXGBE_SUCCESS;
3526621Sbt150084 
3536621Sbt150084 	if (hw->phy.type == ixgbe_phy_unknown) {
3546621Sbt150084 		status = ixgbe_call_func(hw,
3556621Sbt150084 		    hw->phy.ops.identify,
3566621Sbt150084 		    (hw),
3576621Sbt150084 		    IXGBE_NOT_IMPLEMENTED);
3586621Sbt150084 	}
3596621Sbt150084 
3606621Sbt150084 	return (status);
3616621Sbt150084 }
3626621Sbt150084 
3636621Sbt150084 /*
3646621Sbt150084  * ixgbe_reset_phy - Perform a PHY reset
3656621Sbt150084  * @hw: pointer to hardware structure
3666621Sbt150084  */
3676621Sbt150084 s32
3686621Sbt150084 ixgbe_reset_phy(struct ixgbe_hw *hw)
3696621Sbt150084 {
3706621Sbt150084 	s32 status = IXGBE_SUCCESS;
3716621Sbt150084 
3726621Sbt150084 	if (hw->phy.type == ixgbe_phy_unknown) {
3736621Sbt150084 		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
3746621Sbt150084 			status = IXGBE_ERR_PHY;
3756621Sbt150084 		}
3766621Sbt150084 	}
3776621Sbt150084 
3786621Sbt150084 	if (status == IXGBE_SUCCESS) {
3796621Sbt150084 		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
3806621Sbt150084 		    IXGBE_NOT_IMPLEMENTED);
3816621Sbt150084 	}
3826621Sbt150084 	return (status);
3836621Sbt150084 }
3846621Sbt150084 
3856621Sbt150084 /*
3868490SPaul.Guo@Sun.COM  * ixgbe_get_phy_firmware_version -
3878490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
3888490SPaul.Guo@Sun.COM  * @firmware_version: pointer to firmware version
3898490SPaul.Guo@Sun.COM  */
3908490SPaul.Guo@Sun.COM s32
3918490SPaul.Guo@Sun.COM ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
3928490SPaul.Guo@Sun.COM {
3938490SPaul.Guo@Sun.COM 	s32 status = IXGBE_SUCCESS;
3948490SPaul.Guo@Sun.COM 
3958490SPaul.Guo@Sun.COM 	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
3968490SPaul.Guo@Sun.COM 	    (hw, firmware_version), IXGBE_NOT_IMPLEMENTED);
3978490SPaul.Guo@Sun.COM 	return (status);
3988490SPaul.Guo@Sun.COM }
3998490SPaul.Guo@Sun.COM 
4008490SPaul.Guo@Sun.COM /*
4016621Sbt150084  * ixgbe_read_phy_reg - Read PHY register
4026621Sbt150084  * @hw: pointer to hardware structure
4036621Sbt150084  * @reg_addr: 32 bit address of PHY register to read
4046621Sbt150084  * @phy_data: Pointer to read data from PHY register
4056621Sbt150084  *
4066621Sbt150084  * Reads a value from a specified PHY register
4076621Sbt150084  */
4086621Sbt150084 s32
4096621Sbt150084 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
4106621Sbt150084 	u16 *phy_data)
4116621Sbt150084 {
4129353SSamuel.Tu@Sun.COM 	if (hw->phy.id == 0)
4139353SSamuel.Tu@Sun.COM 		(void) ixgbe_identify_phy(hw);
4149353SSamuel.Tu@Sun.COM 
4156621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
4166621Sbt150084 	    device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
4176621Sbt150084 }
4186621Sbt150084 
4196621Sbt150084 /*
4206621Sbt150084  * ixgbe_write_phy_reg - Write PHY register
4216621Sbt150084  * @hw: pointer to hardware structure
4226621Sbt150084  * @reg_addr: 32 bit PHY register to write
4236621Sbt150084  * @phy_data: Data to write to the PHY register
4246621Sbt150084  *
4256621Sbt150084  * Writes a value to specified PHY register
4266621Sbt150084  */
4276621Sbt150084 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
4286621Sbt150084     u16 phy_data)
4296621Sbt150084 {
4309353SSamuel.Tu@Sun.COM 	if (hw->phy.id == 0)
4319353SSamuel.Tu@Sun.COM 		(void) ixgbe_identify_phy(hw);
4329353SSamuel.Tu@Sun.COM 
4336621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
4346621Sbt150084 	    device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
4356621Sbt150084 }
4366621Sbt150084 
4376621Sbt150084 /*
4386621Sbt150084  * ixgbe_setup_phy_link - Restart PHY autoneg
4396621Sbt150084  * @hw: pointer to hardware structure
4406621Sbt150084  *
4416621Sbt150084  * Restart autonegotiation and PHY and waits for completion.
4426621Sbt150084  */
4436621Sbt150084 s32
4446621Sbt150084 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
4456621Sbt150084 {
4466621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
4476621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
4486621Sbt150084 }
4496621Sbt150084 
4506621Sbt150084 /*
4518490SPaul.Guo@Sun.COM  * ixgbe_check_phy_link - Determine link and speed status
4528490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
4538490SPaul.Guo@Sun.COM  *
4548490SPaul.Guo@Sun.COM  * Reads a PHY register to determine if link is up and the current speed for
4558490SPaul.Guo@Sun.COM  * the PHY.
4568490SPaul.Guo@Sun.COM  */
4578490SPaul.Guo@Sun.COM s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
4588490SPaul.Guo@Sun.COM     bool *link_up)
4598490SPaul.Guo@Sun.COM {
4608490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
4618490SPaul.Guo@Sun.COM 	    link_up), IXGBE_NOT_IMPLEMENTED);
4628490SPaul.Guo@Sun.COM }
4638490SPaul.Guo@Sun.COM 
4648490SPaul.Guo@Sun.COM /*
4656621Sbt150084  * ixgbe_setup_phy_link_speed - Set auto advertise
4666621Sbt150084  * @hw: pointer to hardware structure
4676621Sbt150084  * @speed: new link speed
4688490SPaul.Guo@Sun.COM  * @autoneg: true if autonegotiation enabled
4696621Sbt150084  *
4706621Sbt150084  * Sets the auto advertised capabilities
4716621Sbt150084  */
4726621Sbt150084 s32
4736621Sbt150084 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
4746621Sbt150084     bool autoneg,
4756621Sbt150084     bool autoneg_wait_to_complete)
4766621Sbt150084 {
4776621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
4786621Sbt150084 	    autoneg, autoneg_wait_to_complete),
4796621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
4806621Sbt150084 }
4816621Sbt150084 
4826621Sbt150084 /*
4836621Sbt150084  * ixgbe_check_link - Get link and speed status
4846621Sbt150084  * @hw: pointer to hardware structure
4856621Sbt150084  *
4866621Sbt150084  * Reads the links register to determine if link is up and the current speed
4876621Sbt150084  */
4886621Sbt150084 s32
4896621Sbt150084 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
4908490SPaul.Guo@Sun.COM     bool *link_up, bool link_up_wait_to_complete)
4916621Sbt150084 {
4926621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
4938490SPaul.Guo@Sun.COM 	    link_up, link_up_wait_to_complete), IXGBE_NOT_IMPLEMENTED);
4946621Sbt150084 }
4956621Sbt150084 
4966621Sbt150084 /*
497*10998SChenlu.Chen@Sun.COM  * ixgbe_setup_link - Set link speed
4986621Sbt150084  * @hw: pointer to hardware structure
4996621Sbt150084  * @speed: new link speed
5008490SPaul.Guo@Sun.COM  * @autoneg: true if autonegotiation enabled
5016621Sbt150084  *
502*10998SChenlu.Chen@Sun.COM  * Configures link settings.  Restarts the link.
503*10998SChenlu.Chen@Sun.COM  * Performs autonegotiation if needed.
5046621Sbt150084  */
505*10998SChenlu.Chen@Sun.COM s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
5066621Sbt150084     bool autoneg,
5076621Sbt150084     bool autoneg_wait_to_complete)
5086621Sbt150084 {
509*10998SChenlu.Chen@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
5106621Sbt150084 	    autoneg, autoneg_wait_to_complete),
5116621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5126621Sbt150084 }
5136621Sbt150084 
5146621Sbt150084 /*
5156621Sbt150084  * ixgbe_get_link_capabilities - Returns link capabilities
5166621Sbt150084  * @hw: pointer to hardware structure
5176621Sbt150084  *
5186621Sbt150084  * Determines the link capabilities of the current configuration.
5196621Sbt150084  */
5206621Sbt150084 s32
5216621Sbt150084 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
5226621Sbt150084     bool *autoneg)
5236621Sbt150084 {
5246621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
5256621Sbt150084 	    speed, autoneg), IXGBE_NOT_IMPLEMENTED);
5266621Sbt150084 }
5276621Sbt150084 
5286621Sbt150084 /*
5296621Sbt150084  * ixgbe_led_on - Turn on LEDs
5306621Sbt150084  * @hw: pointer to hardware structure
5316621Sbt150084  * @index: led number to turn on
5326621Sbt150084  *
5336621Sbt150084  * Turns on the software controllable LEDs.
5346621Sbt150084  */
5356621Sbt150084 s32
5366621Sbt150084 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
5376621Sbt150084 {
5386621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
5396621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5406621Sbt150084 }
5416621Sbt150084 
5426621Sbt150084 /*
5436621Sbt150084  * ixgbe_led_off - Turn off LEDs
5446621Sbt150084  * @hw: pointer to hardware structure
5456621Sbt150084  * @index: led number to turn off
5466621Sbt150084  *
5476621Sbt150084  * Turns off the software controllable LEDs.
5486621Sbt150084  */
5496621Sbt150084 s32
5506621Sbt150084 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
5516621Sbt150084 {
5526621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
5536621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5546621Sbt150084 }
5556621Sbt150084 
5566621Sbt150084 /*
5576621Sbt150084  * ixgbe_blink_led_start - Blink LEDs
5586621Sbt150084  * @hw: pointer to hardware structure
5596621Sbt150084  * @index: led number to blink
5606621Sbt150084  *
5616621Sbt150084  * Blink LED based on index.
5626621Sbt150084  */
5636621Sbt150084 s32
5646621Sbt150084 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
5656621Sbt150084 {
5666621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
5676621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5686621Sbt150084 }
5696621Sbt150084 
5706621Sbt150084 /*
5716621Sbt150084  * ixgbe_blink_led_stop - Stop blinking LEDs
5726621Sbt150084  * @hw: pointer to hardware structure
5736621Sbt150084  *
5746621Sbt150084  * Stop blinking LED based on index.
5756621Sbt150084  */
5766621Sbt150084 s32
5776621Sbt150084 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
5786621Sbt150084 {
5796621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
5806621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5816621Sbt150084 }
5826621Sbt150084 
5836621Sbt150084 /*
5846621Sbt150084  * ixgbe_init_eeprom_params - Initialize EEPROM parameters
5856621Sbt150084  * @hw: pointer to hardware structure
5866621Sbt150084  *
5876621Sbt150084  * Initializes the EEPROM parameters ixgbe_eeprom_info within the
5886621Sbt150084  * ixgbe_hw struct in order to set up EEPROM access.
5896621Sbt150084  */
5906621Sbt150084 s32
5916621Sbt150084 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
5926621Sbt150084 {
5936621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
5946621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5956621Sbt150084 }
5966621Sbt150084 
5976621Sbt150084 
5986621Sbt150084 /*
5996621Sbt150084  * ixgbe_write_eeprom - Write word to EEPROM
6006621Sbt150084  * @hw: pointer to hardware structure
6016621Sbt150084  * @offset: offset within the EEPROM to be written to
6026621Sbt150084  * @data: 16 bit word to be written to the EEPROM
6036621Sbt150084  *
6046621Sbt150084  * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
6056621Sbt150084  * called after this function, the EEPROM will most likely contain an
6066621Sbt150084  * invalid checksum.
6076621Sbt150084  */
6086621Sbt150084 s32
6096621Sbt150084 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
6106621Sbt150084 {
6116621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
6126621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6136621Sbt150084 }
6146621Sbt150084 
6156621Sbt150084 /*
6166621Sbt150084  * ixgbe_read_eeprom - Read word from EEPROM
6176621Sbt150084  * @hw: pointer to hardware structure
6186621Sbt150084  * @offset: offset within the EEPROM to be read
6196621Sbt150084  * @data: read 16 bit value from EEPROM
6206621Sbt150084  *
6216621Sbt150084  * Reads 16 bit value from EEPROM
6226621Sbt150084  */
6236621Sbt150084 s32
6246621Sbt150084 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
6256621Sbt150084 {
6266621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
6276621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6286621Sbt150084 }
6296621Sbt150084 
6306621Sbt150084 /*
6316621Sbt150084  * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
6326621Sbt150084  * @hw: pointer to hardware structure
6336621Sbt150084  * @checksum_val: calculated checksum
6346621Sbt150084  *
6356621Sbt150084  * Performs checksum calculation and validates the EEPROM checksum
6366621Sbt150084  */
6376621Sbt150084 s32
6386621Sbt150084 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
6396621Sbt150084 {
6406621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
6416621Sbt150084 	    (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
6426621Sbt150084 }
6436621Sbt150084 
6446621Sbt150084 /*
6456621Sbt150084  * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
6466621Sbt150084  * @hw: pointer to hardware structure
6476621Sbt150084  */
6486621Sbt150084 s32
6496621Sbt150084 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
6506621Sbt150084 {
6516621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
6526621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6536621Sbt150084 }
6546621Sbt150084 
6556621Sbt150084 /*
6569353SSamuel.Tu@Sun.COM  * ixgbe_insert_mac_addr - Find a RAR for this mac address
6579353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
6589353SSamuel.Tu@Sun.COM  * @addr: Address to put into receive address register
6599353SSamuel.Tu@Sun.COM  * @vmdq: VMDq pool to assign
6609353SSamuel.Tu@Sun.COM  *
6619353SSamuel.Tu@Sun.COM  * Puts an ethernet address into a receive address register, or
6629353SSamuel.Tu@Sun.COM  * finds the rar that it is aleady in; adds to the pool list
6639353SSamuel.Tu@Sun.COM  */
6649353SSamuel.Tu@Sun.COM s32
6659353SSamuel.Tu@Sun.COM ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
6669353SSamuel.Tu@Sun.COM {
6679353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
6689353SSamuel.Tu@Sun.COM 	    (hw, addr, vmdq), IXGBE_NOT_IMPLEMENTED);
6699353SSamuel.Tu@Sun.COM }
6709353SSamuel.Tu@Sun.COM 
6719353SSamuel.Tu@Sun.COM /*
6726621Sbt150084  * ixgbe_set_rar - Set Rx address register
6736621Sbt150084  * @hw: pointer to hardware structure
6746621Sbt150084  * @index: Receive address register to write
6756621Sbt150084  * @addr: Address to put into receive address register
6766621Sbt150084  * @vmdq: VMDq "set"
6776621Sbt150084  * @enable_addr: set flag that address is active
6786621Sbt150084  *
6796621Sbt150084  * Puts an ethernet address into a receive address register.
6806621Sbt150084  */
6816621Sbt150084 s32
6826621Sbt150084 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
6836621Sbt150084     u32 enable_addr)
6846621Sbt150084 {
6856621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
6866621Sbt150084 	    enable_addr), IXGBE_NOT_IMPLEMENTED);
6876621Sbt150084 }
6886621Sbt150084 
6896621Sbt150084 /*
6908490SPaul.Guo@Sun.COM  * ixgbe_clear_rar - Clear Rx address register
6918490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
6928490SPaul.Guo@Sun.COM  * @index: Receive address register to write
6938490SPaul.Guo@Sun.COM  *
6948490SPaul.Guo@Sun.COM  * Puts an ethernet address into a receive address register.
6958490SPaul.Guo@Sun.COM  */
6968490SPaul.Guo@Sun.COM s32
6978490SPaul.Guo@Sun.COM ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
6988490SPaul.Guo@Sun.COM {
6998490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
7008490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
7018490SPaul.Guo@Sun.COM }
7028490SPaul.Guo@Sun.COM 
7038490SPaul.Guo@Sun.COM /*
7046621Sbt150084  * ixgbe_set_vmdq - Associate a VMDq index with a receive address
7056621Sbt150084  * @hw: pointer to hardware structure
7066621Sbt150084  * @rar: receive address register index to associate with VMDq index
7076621Sbt150084  * @vmdq: VMDq set or pool index
7086621Sbt150084  */
7096621Sbt150084 s32
7106621Sbt150084 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
7116621Sbt150084 {
7126621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
7136621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7146621Sbt150084 }
7156621Sbt150084 
7166621Sbt150084 /*
7178490SPaul.Guo@Sun.COM  * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
7188490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
7198490SPaul.Guo@Sun.COM  * @rar: receive address register index to disassociate with VMDq index
7208490SPaul.Guo@Sun.COM  * @vmdq: VMDq set or pool index
7218490SPaul.Guo@Sun.COM  */
7228490SPaul.Guo@Sun.COM s32
7238490SPaul.Guo@Sun.COM ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
7248490SPaul.Guo@Sun.COM {
7258490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
7268490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
7278490SPaul.Guo@Sun.COM }
7288490SPaul.Guo@Sun.COM 
7298490SPaul.Guo@Sun.COM /*
7306621Sbt150084  * ixgbe_init_rx_addrs - Initializes receive address filters.
7316621Sbt150084  * @hw: pointer to hardware structure
7326621Sbt150084  *
7336621Sbt150084  * Places the MAC address in receive address register 0 and clears the rest
7346621Sbt150084  * of the receive address registers. Clears the multicast table. Assumes
7356621Sbt150084  * the receiver is in reset when the routine is called.
7366621Sbt150084  */
7376621Sbt150084 s32
7386621Sbt150084 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
7396621Sbt150084 {
7406621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
7416621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7426621Sbt150084 }
7436621Sbt150084 
7446621Sbt150084 /*
7456621Sbt150084  * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
7466621Sbt150084  * @hw: pointer to hardware structure
7476621Sbt150084  */
7486621Sbt150084 u32
7496621Sbt150084 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
7506621Sbt150084 {
7516621Sbt150084 	return (hw->mac.num_rar_entries);
7526621Sbt150084 }
7536621Sbt150084 
7546621Sbt150084 /*
7556621Sbt150084  * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
7566621Sbt150084  * @hw: pointer to hardware structure
7576621Sbt150084  * @addr_list: the list of new multicast addresses
7586621Sbt150084  * @addr_count: number of addresses
7596621Sbt150084  * @func: iterator function to walk the multicast address list
7606621Sbt150084  *
7616621Sbt150084  * The given list replaces any existing list. Clears the secondary addrs from
7626621Sbt150084  * receive address registers. Uses unused receive address registers for the
7636621Sbt150084  * first secondary addresses, and falls back to promiscuous mode as needed.
7646621Sbt150084  */
7656621Sbt150084 s32
7666621Sbt150084 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
7676621Sbt150084     u32 addr_count, ixgbe_mc_addr_itr func)
7686621Sbt150084 {
7696621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
7706621Sbt150084 	    addr_list, addr_count, func),
7716621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7726621Sbt150084 }
7736621Sbt150084 
7746621Sbt150084 /*
7756621Sbt150084  * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
7766621Sbt150084  * @hw: pointer to hardware structure
7776621Sbt150084  * @mc_addr_list: the list of new multicast addresses
7786621Sbt150084  * @mc_addr_count: number of addresses
7796621Sbt150084  * @func: iterator function to walk the multicast address list
7806621Sbt150084  *
7816621Sbt150084  * The given list replaces any existing list. Clears the MC addrs from receive
7826621Sbt150084  * address registers and the multicast table. Uses unused receive address
7836621Sbt150084  * registers for the first multicast addresses, and hashes the rest into the
7846621Sbt150084  * multicast table.
7856621Sbt150084  */
7866621Sbt150084 s32
7876621Sbt150084 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
7886621Sbt150084     u32 mc_addr_count, ixgbe_mc_addr_itr func)
7896621Sbt150084 {
7906621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
7916621Sbt150084 	    mc_addr_list, mc_addr_count, func),
7926621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7936621Sbt150084 }
7946621Sbt150084 
7956621Sbt150084 /*
7966621Sbt150084  * ixgbe_enable_mc - Enable multicast address in RAR
7976621Sbt150084  * @hw: pointer to hardware structure
7986621Sbt150084  *
7996621Sbt150084  * Enables multicast address in RAR and the use of the multicast hash table.
8006621Sbt150084  */
8016621Sbt150084 s32
8026621Sbt150084 ixgbe_enable_mc(struct ixgbe_hw *hw)
8036621Sbt150084 {
8046621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
8056621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8066621Sbt150084 }
8076621Sbt150084 
8086621Sbt150084 /*
8096621Sbt150084  * ixgbe_disable_mc - Disable multicast address in RAR
8106621Sbt150084  * @hw: pointer to hardware structure
8116621Sbt150084  *
8126621Sbt150084  * Disables multicast address in RAR and the use of the multicast hash table.
8136621Sbt150084  */
8146621Sbt150084 s32
8156621Sbt150084 ixgbe_disable_mc(struct ixgbe_hw *hw)
8166621Sbt150084 {
8176621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
8186621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8196621Sbt150084 }
8206621Sbt150084 
8216621Sbt150084 /*
8226621Sbt150084  * ixgbe_clear_vfta - Clear VLAN filter table
8236621Sbt150084  * @hw: pointer to hardware structure
8246621Sbt150084  *
8256621Sbt150084  * Clears the VLAN filer table, and the VMDq index associated with the filter
8266621Sbt150084  */
8276621Sbt150084 s32
8286621Sbt150084 ixgbe_clear_vfta(struct ixgbe_hw *hw)
8296621Sbt150084 {
8306621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
8316621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8326621Sbt150084 }
8336621Sbt150084 
8346621Sbt150084 /*
8356621Sbt150084  * ixgbe_set_vfta - Set VLAN filter table
8366621Sbt150084  * @hw: pointer to hardware structure
8376621Sbt150084  * @vlan: VLAN id to write to VLAN filter
8386621Sbt150084  * @vind: VMDq output index that maps queue to VLAN id in VFTA
8396621Sbt150084  * @vlan_on: boolean flag to turn on/off VLAN in VFTA
8406621Sbt150084  *
8416621Sbt150084  * Turn on/off specified VLAN in the VLAN filter table.
8426621Sbt150084  */
8436621Sbt150084 s32
8446621Sbt150084 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
8456621Sbt150084 {
8466621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
8476621Sbt150084 	    vlan_on), IXGBE_NOT_IMPLEMENTED);
8486621Sbt150084 }
8496621Sbt150084 
8506621Sbt150084 /*
8519353SSamuel.Tu@Sun.COM  * ixgbe_fc_enable - Enable flow control
8526621Sbt150084  * @hw: pointer to hardware structure
8536621Sbt150084  * @packetbuf_num: packet buffer number (0-7)
8546621Sbt150084  *
8556621Sbt150084  * Configures the flow control settings based on SW configuration.
8566621Sbt150084  */
8576621Sbt150084 s32
8589353SSamuel.Tu@Sun.COM ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
8596621Sbt150084 {
8609353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw, packetbuf_num),
8616621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8626621Sbt150084 }
8636621Sbt150084 
8646621Sbt150084 /*
8656621Sbt150084  * ixgbe_read_analog_reg8 - Reads 8 bit analog register
8666621Sbt150084  * @hw: pointer to hardware structure
8676621Sbt150084  * @reg: analog register to read
8686621Sbt150084  * @val: read value
8696621Sbt150084  *
8706621Sbt150084  * Performs write operation to analog register specified.
8716621Sbt150084  */
8726621Sbt150084 s32
8736621Sbt150084 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
8746621Sbt150084 {
8756621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
8766621Sbt150084 	    val), IXGBE_NOT_IMPLEMENTED);
8776621Sbt150084 }
8786621Sbt150084 
8796621Sbt150084 /*
8806621Sbt150084  * ixgbe_write_analog_reg8 - Writes 8 bit analog register
8816621Sbt150084  * @hw: pointer to hardware structure
8826621Sbt150084  * @reg: analog register to write
8836621Sbt150084  * @val: value to write
8846621Sbt150084  *
8856621Sbt150084  * Performs write operation to Atlas analog register specified.
8866621Sbt150084  */
8876621Sbt150084 s32
8886621Sbt150084 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
8896621Sbt150084 {
8906621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
8916621Sbt150084 	    val), IXGBE_NOT_IMPLEMENTED);
8926621Sbt150084 }
8938490SPaul.Guo@Sun.COM 
8948490SPaul.Guo@Sun.COM /*
8958490SPaul.Guo@Sun.COM  * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
8968490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
8978490SPaul.Guo@Sun.COM  *
8988490SPaul.Guo@Sun.COM  * Initializes the Unicast Table Arrays to zero on device load.  This
8998490SPaul.Guo@Sun.COM  * is part of the Rx init addr execution path.
9008490SPaul.Guo@Sun.COM  */
9018490SPaul.Guo@Sun.COM s32
9028490SPaul.Guo@Sun.COM ixgbe_init_uta_tables(struct ixgbe_hw *hw)
9038490SPaul.Guo@Sun.COM {
9048490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
9058490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
9068490SPaul.Guo@Sun.COM }
9078490SPaul.Guo@Sun.COM 
9088490SPaul.Guo@Sun.COM /*
9099353SSamuel.Tu@Sun.COM  * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
9109353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9119353SSamuel.Tu@Sun.COM  * @byte_offset: byte offset to read
9129353SSamuel.Tu@Sun.COM  * @data: value read
9139353SSamuel.Tu@Sun.COM  *
9149353SSamuel.Tu@Sun.COM  * Performs byte read operation to SFP module's EEPROM over I2C interface.
9159353SSamuel.Tu@Sun.COM  */
9169353SSamuel.Tu@Sun.COM s32
9179353SSamuel.Tu@Sun.COM ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
9189353SSamuel.Tu@Sun.COM     u8 *data)
9199353SSamuel.Tu@Sun.COM {
9209353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
9219353SSamuel.Tu@Sun.COM 	    dev_addr, data), IXGBE_NOT_IMPLEMENTED);
9229353SSamuel.Tu@Sun.COM }
9239353SSamuel.Tu@Sun.COM 
9249353SSamuel.Tu@Sun.COM /*
9259353SSamuel.Tu@Sun.COM  * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
9269353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9279353SSamuel.Tu@Sun.COM  * @byte_offset: byte offset to write
9289353SSamuel.Tu@Sun.COM  * @data: value to write
9299353SSamuel.Tu@Sun.COM  *
9309353SSamuel.Tu@Sun.COM  * Performs byte write operation to SFP module's EEPROM over I2C interface
9319353SSamuel.Tu@Sun.COM  * at a specified device address.
9329353SSamuel.Tu@Sun.COM  */
9339353SSamuel.Tu@Sun.COM s32
9349353SSamuel.Tu@Sun.COM ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
9359353SSamuel.Tu@Sun.COM     u8 data)
9369353SSamuel.Tu@Sun.COM {
9379353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte,
9389353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, dev_addr, data), IXGBE_NOT_IMPLEMENTED);
9399353SSamuel.Tu@Sun.COM }
9409353SSamuel.Tu@Sun.COM 
9419353SSamuel.Tu@Sun.COM /*
9429353SSamuel.Tu@Sun.COM  * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
9439353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9449353SSamuel.Tu@Sun.COM  * @byte_offset: EEPROM byte offset to write
9459353SSamuel.Tu@Sun.COM  * @eeprom_data: value to write
9469353SSamuel.Tu@Sun.COM  *
9479353SSamuel.Tu@Sun.COM  * Performs byte write operation to SFP module's EEPROM over I2C interface.
9489353SSamuel.Tu@Sun.COM  */
9499353SSamuel.Tu@Sun.COM s32
9509353SSamuel.Tu@Sun.COM ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 eeprom_data)
9519353SSamuel.Tu@Sun.COM {
9529353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
9539353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, eeprom_data), IXGBE_NOT_IMPLEMENTED);
9549353SSamuel.Tu@Sun.COM }
9559353SSamuel.Tu@Sun.COM 
9569353SSamuel.Tu@Sun.COM /*
9578490SPaul.Guo@Sun.COM  * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
9588490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
9598490SPaul.Guo@Sun.COM  * @byte_offset: EEPROM byte offset to read
9608490SPaul.Guo@Sun.COM  * @eeprom_data: value read
9618490SPaul.Guo@Sun.COM  *
9628490SPaul.Guo@Sun.COM  * Performs byte read operation to SFP module's EEPROM over I2C interface.
9638490SPaul.Guo@Sun.COM  */
9648490SPaul.Guo@Sun.COM s32
9658490SPaul.Guo@Sun.COM ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
9668490SPaul.Guo@Sun.COM {
9678490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
9689353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, eeprom_data), IXGBE_NOT_IMPLEMENTED);
9698490SPaul.Guo@Sun.COM }
9708490SPaul.Guo@Sun.COM 
9718490SPaul.Guo@Sun.COM /*
9728490SPaul.Guo@Sun.COM  * ixgbe_get_supported_physical_layer - Returns physical layer type
9738490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
9748490SPaul.Guo@Sun.COM  *
9758490SPaul.Guo@Sun.COM  * Determines physical layer capabilities of the current configuration.
9768490SPaul.Guo@Sun.COM  */
9779353SSamuel.Tu@Sun.COM u32
9788490SPaul.Guo@Sun.COM ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
9798490SPaul.Guo@Sun.COM {
9808490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
9818490SPaul.Guo@Sun.COM 	    (hw), IXGBE_NOT_IMPLEMENTED);
9828490SPaul.Guo@Sun.COM }
9839353SSamuel.Tu@Sun.COM 
9849353SSamuel.Tu@Sun.COM /*
9859353SSamuel.Tu@Sun.COM  * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependant on device specifics
9869353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9879353SSamuel.Tu@Sun.COM  * @regval: bitfield to write to the Rx DMA register
9889353SSamuel.Tu@Sun.COM  *
9899353SSamuel.Tu@Sun.COM  * Enables the Rx DMA unit of the device.
9909353SSamuel.Tu@Sun.COM  */
9919353SSamuel.Tu@Sun.COM s32
9929353SSamuel.Tu@Sun.COM ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
9939353SSamuel.Tu@Sun.COM {
9949353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
9959353SSamuel.Tu@Sun.COM 	    (hw, regval), IXGBE_NOT_IMPLEMENTED);
9969353SSamuel.Tu@Sun.COM }
99710305SPaul.Guo@Sun.COM 
99810305SPaul.Guo@Sun.COM /*
99910305SPaul.Guo@Sun.COM  * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
100010305SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
100110305SPaul.Guo@Sun.COM  * @mask: Mask to specify which semaphore to acquire
100210305SPaul.Guo@Sun.COM  *
100310305SPaul.Guo@Sun.COM  * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
100410305SPaul.Guo@Sun.COM  * function (CSR, PHY0, PHY1, EEPROM, Flash)
100510305SPaul.Guo@Sun.COM  */
100610305SPaul.Guo@Sun.COM s32
100710305SPaul.Guo@Sun.COM ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
100810305SPaul.Guo@Sun.COM {
100910305SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
101010305SPaul.Guo@Sun.COM 	    (hw, mask), IXGBE_NOT_IMPLEMENTED);
101110305SPaul.Guo@Sun.COM }
101210305SPaul.Guo@Sun.COM 
101310305SPaul.Guo@Sun.COM /*
101410305SPaul.Guo@Sun.COM  * ixgbe_release_swfw_semaphore - Release SWFW semaphore
101510305SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
101610305SPaul.Guo@Sun.COM  * @mask: Mask to specify which semaphore to release
101710305SPaul.Guo@Sun.COM  *
101810305SPaul.Guo@Sun.COM  * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
101910305SPaul.Guo@Sun.COM  * function (CSR, PHY0, PHY1, EEPROM, Flash)
102010305SPaul.Guo@Sun.COM  */
102110305SPaul.Guo@Sun.COM void
102210305SPaul.Guo@Sun.COM ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
102310305SPaul.Guo@Sun.COM {
102410305SPaul.Guo@Sun.COM 	if (hw->mac.ops.release_swfw_sync)
102510305SPaul.Guo@Sun.COM 		hw->mac.ops.release_swfw_sync(hw, mask);
102610305SPaul.Guo@Sun.COM }
1027