xref: /onnv-gate/usr/src/uts/common/io/ixgbe/ixgbe_api.c (revision 10305:f6df05de8700)
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*10305SPaul.Guo@Sun.COM /* IntelVersion: 1.120 v2-9-1-1_2009-6-10_NSW1 */
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 
546621Sbt150084 	/*
556621Sbt150084 	 * Set the mac type
566621Sbt150084 	 */
576621Sbt150084 	(void) ixgbe_set_mac_type(hw);
586621Sbt150084 
596621Sbt150084 	switch (hw->mac.type) {
606621Sbt150084 	case ixgbe_mac_82598EB:
616621Sbt150084 		status = ixgbe_init_ops_82598(hw);
626621Sbt150084 		break;
639353SSamuel.Tu@Sun.COM 	case ixgbe_mac_82599EB:
649353SSamuel.Tu@Sun.COM 		status = ixgbe_init_ops_82599(hw);
659353SSamuel.Tu@Sun.COM 		break;
666621Sbt150084 	default:
676621Sbt150084 		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
686621Sbt150084 		break;
696621Sbt150084 	}
706621Sbt150084 
716621Sbt150084 	return (status);
726621Sbt150084 }
736621Sbt150084 
746621Sbt150084 /*
756621Sbt150084  * ixgbe_set_mac_type - Sets MAC type
766621Sbt150084  * @hw: pointer to the HW structure
776621Sbt150084  *
786621Sbt150084  * This function sets the mac type of the adapter based on the
796621Sbt150084  * vendor ID and device ID stored in the hw structure.
806621Sbt150084  */
816621Sbt150084 s32
826621Sbt150084 ixgbe_set_mac_type(struct ixgbe_hw *hw)
836621Sbt150084 {
846621Sbt150084 	s32 ret_val = IXGBE_SUCCESS;
856621Sbt150084 
868490SPaul.Guo@Sun.COM 	DEBUGFUNC("ixgbe_set_mac_type\n");
876621Sbt150084 
886621Sbt150084 	if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
896621Sbt150084 		switch (hw->device_id) {
909353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82598:
919353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82598_BX:
926621Sbt150084 		case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
936621Sbt150084 		case IXGBE_DEV_ID_82598AF_DUAL_PORT:
948490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598AT:
956621Sbt150084 		case IXGBE_DEV_ID_82598EB_CX4:
966621Sbt150084 		case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
978490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
988490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
996621Sbt150084 		case IXGBE_DEV_ID_82598EB_XF_LR:
1008490SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82598EB_SFP_LOM:
1016621Sbt150084 			hw->mac.type = ixgbe_mac_82598EB;
1026621Sbt150084 			break;
1039353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_KX4:
1049353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_KX4_SIK:
105*10305SPaul.Guo@Sun.COM 		case IXGBE_DEV_ID_82599_XAUI_LOM:
1069353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_SFP:
1079353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_SPW:
1089353SSamuel.Tu@Sun.COM 		case IXGBE_DEV_ID_82599_CX4:
1099353SSamuel.Tu@Sun.COM 			hw->mac.type = ixgbe_mac_82599EB;
1109353SSamuel.Tu@Sun.COM 			break;
1116621Sbt150084 		default:
1126621Sbt150084 			ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
1136621Sbt150084 			break;
1146621Sbt150084 		}
1156621Sbt150084 	} else {
1166621Sbt150084 		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
1176621Sbt150084 	}
1186621Sbt150084 
1198490SPaul.Guo@Sun.COM 	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
1208490SPaul.Guo@Sun.COM 	    hw->mac.type, ret_val);
1218490SPaul.Guo@Sun.COM 
1226621Sbt150084 	return (ret_val);
1236621Sbt150084 }
1246621Sbt150084 
1256621Sbt150084 /*
1266621Sbt150084  * ixgbe_init_hw - Initialize the hardware
1276621Sbt150084  * @hw: pointer to hardware structure
1286621Sbt150084  *
1296621Sbt150084  * Initialize the hardware by resetting and then starting the hardware
1306621Sbt150084  */
1316621Sbt150084 s32
1326621Sbt150084 ixgbe_init_hw(struct ixgbe_hw *hw)
1336621Sbt150084 {
1346621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
1356621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1366621Sbt150084 }
1376621Sbt150084 
1386621Sbt150084 /*
1396621Sbt150084  * ixgbe_reset_hw - Performs a hardware reset
1406621Sbt150084  * @hw: pointer to hardware structure
1416621Sbt150084  *
1426621Sbt150084  * Resets the hardware by resetting the transmit and receive units, masks and
1436621Sbt150084  * clears all interrupts, performs a PHY reset, and performs a MAC reset
1446621Sbt150084  */
1456621Sbt150084 s32
1466621Sbt150084 ixgbe_reset_hw(struct ixgbe_hw *hw)
1476621Sbt150084 {
1486621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
1496621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1506621Sbt150084 }
1516621Sbt150084 
1526621Sbt150084 /*
1536621Sbt150084  * ixgbe_start_hw - Prepares hardware for Rx/Tx
1546621Sbt150084  * @hw: pointer to hardware structure
1556621Sbt150084  *
1566621Sbt150084  * Starts the hardware by filling the bus info structure and media type,
1576621Sbt150084  * clears all on chip counters, initializes receive address registers,
1586621Sbt150084  * multicast table, VLAN filter table, calls routine to setup link and
1596621Sbt150084  * flow control settings, and leaves transmit and receive units disabled
1606621Sbt150084  * and uninitialized.
1616621Sbt150084  */
1626621Sbt150084 s32
1636621Sbt150084 ixgbe_start_hw(struct ixgbe_hw *hw)
1646621Sbt150084 {
1656621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
1666621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1676621Sbt150084 }
1686621Sbt150084 
1696621Sbt150084 /*
1706621Sbt150084  * ixgbe_clear_hw_cntrs - Clear hardware counters
1716621Sbt150084  * @hw: pointer to hardware structure
1726621Sbt150084  *
1736621Sbt150084  * Clears all hardware statistics counters by reading them from the hardware
1746621Sbt150084  * Statistics counters are clear on read.
1756621Sbt150084  */
1766621Sbt150084 s32
1776621Sbt150084 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
1786621Sbt150084 {
1796621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
1806621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
1816621Sbt150084 }
1826621Sbt150084 
1836621Sbt150084 /*
1846621Sbt150084  * ixgbe_get_media_type - Get media type
1856621Sbt150084  * @hw: pointer to hardware structure
1866621Sbt150084  *
1876621Sbt150084  * Returns the media type (fiber, copper, backplane)
1886621Sbt150084  */
1896621Sbt150084 enum ixgbe_media_type
1906621Sbt150084 ixgbe_get_media_type(struct ixgbe_hw *hw)
1916621Sbt150084 {
1926621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
1936621Sbt150084 	    ixgbe_media_type_unknown);
1946621Sbt150084 }
1956621Sbt150084 
1966621Sbt150084 /*
1976621Sbt150084  * ixgbe_get_mac_addr - Get MAC address
1986621Sbt150084  * @hw: pointer to hardware structure
1996621Sbt150084  * @mac_addr: Adapter MAC address
2006621Sbt150084  *
2016621Sbt150084  * Reads the adapter's MAC address from the first Receive Address Register
2026621Sbt150084  * (RAR0) A reset of the adapter must have been performed prior to calling
2036621Sbt150084  * this function in order for the MAC address to have been loaded from the
2046621Sbt150084  * EEPROM into RAR0
2056621Sbt150084  */
2066621Sbt150084 s32
2076621Sbt150084 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
2086621Sbt150084 {
2096621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
2106621Sbt150084 	    (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
2116621Sbt150084 }
2126621Sbt150084 
2136621Sbt150084 /*
2149353SSamuel.Tu@Sun.COM  * ixgbe_get_san_mac_addr - Get SAN MAC address
2159353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2169353SSamuel.Tu@Sun.COM  * @san_mac_addr: SAN MAC address
2179353SSamuel.Tu@Sun.COM  *
2189353SSamuel.Tu@Sun.COM  * Reads the SAN MAC address from the EEPROM, if it's available.  This is
2199353SSamuel.Tu@Sun.COM  * per-port, so set_lan_id() must be called before reading the addresses.
2209353SSamuel.Tu@Sun.COM  */
2219353SSamuel.Tu@Sun.COM s32
2229353SSamuel.Tu@Sun.COM ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
2239353SSamuel.Tu@Sun.COM {
2249353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
2259353SSamuel.Tu@Sun.COM 	    (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
2269353SSamuel.Tu@Sun.COM }
2279353SSamuel.Tu@Sun.COM 
2289353SSamuel.Tu@Sun.COM /*
2299353SSamuel.Tu@Sun.COM  * ixgbe_set_san_mac_addr - Write a SAN MAC address
2309353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2319353SSamuel.Tu@Sun.COM  * @san_mac_addr: SAN MAC address
2329353SSamuel.Tu@Sun.COM  *
2339353SSamuel.Tu@Sun.COM  * Writes A SAN MAC address to the EEPROM.
2349353SSamuel.Tu@Sun.COM  */
2359353SSamuel.Tu@Sun.COM s32
2369353SSamuel.Tu@Sun.COM ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
2379353SSamuel.Tu@Sun.COM {
2389353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
2399353SSamuel.Tu@Sun.COM 	    (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
2409353SSamuel.Tu@Sun.COM }
2419353SSamuel.Tu@Sun.COM 
2429353SSamuel.Tu@Sun.COM /*
2439353SSamuel.Tu@Sun.COM  * ixgbe_get_device_caps - Get additional device capabilities
2449353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
2459353SSamuel.Tu@Sun.COM  * @device_caps: the EEPROM word for device capabilities
2469353SSamuel.Tu@Sun.COM  *
2479353SSamuel.Tu@Sun.COM  * Reads the extra device capabilities from the EEPROM
2489353SSamuel.Tu@Sun.COM  */
2499353SSamuel.Tu@Sun.COM s32
2509353SSamuel.Tu@Sun.COM ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
2519353SSamuel.Tu@Sun.COM {
2529353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
2539353SSamuel.Tu@Sun.COM 	    (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
2549353SSamuel.Tu@Sun.COM }
2559353SSamuel.Tu@Sun.COM 
2569353SSamuel.Tu@Sun.COM /*
2576621Sbt150084  * ixgbe_get_bus_info - Set PCI bus info
2586621Sbt150084  * @hw: pointer to hardware structure
2596621Sbt150084  *
2606621Sbt150084  * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
2616621Sbt150084  */
2626621Sbt150084 s32
2636621Sbt150084 ixgbe_get_bus_info(struct ixgbe_hw *hw)
2646621Sbt150084 {
2656621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
2666621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
2676621Sbt150084 }
2686621Sbt150084 
2696621Sbt150084 /*
2706621Sbt150084  * ixgbe_get_num_of_tx_queues - Get Tx queues
2716621Sbt150084  * @hw: pointer to hardware structure
2726621Sbt150084  *
2736621Sbt150084  * Returns the number of transmit queues for the given adapter.
2746621Sbt150084  */
2756621Sbt150084 u32
2766621Sbt150084 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
2776621Sbt150084 {
2786621Sbt150084 	return (hw->mac.max_tx_queues);
2796621Sbt150084 }
2806621Sbt150084 
2816621Sbt150084 /*
2826621Sbt150084  * ixgbe_get_num_of_rx_queues - Get Rx queues
2836621Sbt150084  * @hw: pointer to hardware structure
2846621Sbt150084  *
2856621Sbt150084  * Returns the number of receive queues for the given adapter.
2866621Sbt150084  */
2876621Sbt150084 u32
2886621Sbt150084 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
2896621Sbt150084 {
2906621Sbt150084 	return (hw->mac.max_rx_queues);
2916621Sbt150084 }
2926621Sbt150084 
2936621Sbt150084 /*
2946621Sbt150084  * ixgbe_stop_adapter - Disable Rx/Tx units
2956621Sbt150084  * @hw: pointer to hardware structure
2966621Sbt150084  *
2976621Sbt150084  * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
2986621Sbt150084  * disables transmit and receive units. The adapter_stopped flag is used by
2996621Sbt150084  * the shared code and drivers to determine if the adapter is in a stopped
3006621Sbt150084  * state and should not touch the hardware.
3016621Sbt150084  */
3026621Sbt150084 s32
3036621Sbt150084 ixgbe_stop_adapter(struct ixgbe_hw *hw)
3046621Sbt150084 {
3056621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
3066621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
3076621Sbt150084 }
3086621Sbt150084 
3096621Sbt150084 /*
3106621Sbt150084  * ixgbe_read_pba_num - Reads part number from EEPROM
3116621Sbt150084  * @hw: pointer to hardware structure
3126621Sbt150084  * @pba_num: stores the part number from the EEPROM
3136621Sbt150084  *
3146621Sbt150084  * Reads the part number from the EEPROM.
3156621Sbt150084  */
3166621Sbt150084 s32
3176621Sbt150084 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
3186621Sbt150084 {
3196621Sbt150084 	return (ixgbe_read_pba_num_generic(hw, pba_num));
3206621Sbt150084 }
3216621Sbt150084 
3226621Sbt150084 /*
3236621Sbt150084  * ixgbe_identify_phy - Get PHY type
3246621Sbt150084  * @hw: pointer to hardware structure
3256621Sbt150084  *
3266621Sbt150084  * Determines the physical layer module found on the current adapter.
3276621Sbt150084  */
3286621Sbt150084 s32
3296621Sbt150084 ixgbe_identify_phy(struct ixgbe_hw *hw)
3306621Sbt150084 {
3316621Sbt150084 	s32 status = IXGBE_SUCCESS;
3326621Sbt150084 
3336621Sbt150084 	if (hw->phy.type == ixgbe_phy_unknown) {
3346621Sbt150084 		status = ixgbe_call_func(hw,
3356621Sbt150084 		    hw->phy.ops.identify,
3366621Sbt150084 		    (hw),
3376621Sbt150084 		    IXGBE_NOT_IMPLEMENTED);
3386621Sbt150084 	}
3396621Sbt150084 
3406621Sbt150084 	return (status);
3416621Sbt150084 }
3426621Sbt150084 
3436621Sbt150084 /*
3446621Sbt150084  * ixgbe_reset_phy - Perform a PHY reset
3456621Sbt150084  * @hw: pointer to hardware structure
3466621Sbt150084  */
3476621Sbt150084 s32
3486621Sbt150084 ixgbe_reset_phy(struct ixgbe_hw *hw)
3496621Sbt150084 {
3506621Sbt150084 	s32 status = IXGBE_SUCCESS;
3516621Sbt150084 
3526621Sbt150084 	if (hw->phy.type == ixgbe_phy_unknown) {
3536621Sbt150084 		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) {
3546621Sbt150084 			status = IXGBE_ERR_PHY;
3556621Sbt150084 		}
3566621Sbt150084 	}
3576621Sbt150084 
3586621Sbt150084 	if (status == IXGBE_SUCCESS) {
3596621Sbt150084 		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
3606621Sbt150084 		    IXGBE_NOT_IMPLEMENTED);
3616621Sbt150084 	}
3626621Sbt150084 	return (status);
3636621Sbt150084 }
3646621Sbt150084 
3656621Sbt150084 /*
3668490SPaul.Guo@Sun.COM  * ixgbe_get_phy_firmware_version -
3678490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
3688490SPaul.Guo@Sun.COM  * @firmware_version: pointer to firmware version
3698490SPaul.Guo@Sun.COM  */
3708490SPaul.Guo@Sun.COM s32
3718490SPaul.Guo@Sun.COM ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
3728490SPaul.Guo@Sun.COM {
3738490SPaul.Guo@Sun.COM 	s32 status = IXGBE_SUCCESS;
3748490SPaul.Guo@Sun.COM 
3758490SPaul.Guo@Sun.COM 	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
3768490SPaul.Guo@Sun.COM 	    (hw, firmware_version), IXGBE_NOT_IMPLEMENTED);
3778490SPaul.Guo@Sun.COM 	return (status);
3788490SPaul.Guo@Sun.COM }
3798490SPaul.Guo@Sun.COM 
3808490SPaul.Guo@Sun.COM /*
3816621Sbt150084  * ixgbe_read_phy_reg - Read PHY register
3826621Sbt150084  * @hw: pointer to hardware structure
3836621Sbt150084  * @reg_addr: 32 bit address of PHY register to read
3846621Sbt150084  * @phy_data: Pointer to read data from PHY register
3856621Sbt150084  *
3866621Sbt150084  * Reads a value from a specified PHY register
3876621Sbt150084  */
3886621Sbt150084 s32
3896621Sbt150084 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
3906621Sbt150084 	u16 *phy_data)
3916621Sbt150084 {
3929353SSamuel.Tu@Sun.COM 	if (hw->phy.id == 0)
3939353SSamuel.Tu@Sun.COM 		(void) ixgbe_identify_phy(hw);
3949353SSamuel.Tu@Sun.COM 
3956621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
3966621Sbt150084 	    device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
3976621Sbt150084 }
3986621Sbt150084 
3996621Sbt150084 /*
4006621Sbt150084  * ixgbe_write_phy_reg - Write PHY register
4016621Sbt150084  * @hw: pointer to hardware structure
4026621Sbt150084  * @reg_addr: 32 bit PHY register to write
4036621Sbt150084  * @phy_data: Data to write to the PHY register
4046621Sbt150084  *
4056621Sbt150084  * Writes a value to specified PHY register
4066621Sbt150084  */
4076621Sbt150084 s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
4086621Sbt150084     u16 phy_data)
4096621Sbt150084 {
4109353SSamuel.Tu@Sun.COM 	if (hw->phy.id == 0)
4119353SSamuel.Tu@Sun.COM 		(void) ixgbe_identify_phy(hw);
4129353SSamuel.Tu@Sun.COM 
4136621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
4146621Sbt150084 	    device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
4156621Sbt150084 }
4166621Sbt150084 
4176621Sbt150084 /*
4186621Sbt150084  * ixgbe_setup_phy_link - Restart PHY autoneg
4196621Sbt150084  * @hw: pointer to hardware structure
4206621Sbt150084  *
4216621Sbt150084  * Restart autonegotiation and PHY and waits for completion.
4226621Sbt150084  */
4236621Sbt150084 s32
4246621Sbt150084 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
4256621Sbt150084 {
4266621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
4276621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
4286621Sbt150084 }
4296621Sbt150084 
4306621Sbt150084 /*
4318490SPaul.Guo@Sun.COM  * ixgbe_check_phy_link - Determine link and speed status
4328490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
4338490SPaul.Guo@Sun.COM  *
4348490SPaul.Guo@Sun.COM  * Reads a PHY register to determine if link is up and the current speed for
4358490SPaul.Guo@Sun.COM  * the PHY.
4368490SPaul.Guo@Sun.COM  */
4378490SPaul.Guo@Sun.COM s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
4388490SPaul.Guo@Sun.COM     bool *link_up)
4398490SPaul.Guo@Sun.COM {
4408490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
4418490SPaul.Guo@Sun.COM 	    link_up), IXGBE_NOT_IMPLEMENTED);
4428490SPaul.Guo@Sun.COM }
4438490SPaul.Guo@Sun.COM 
4448490SPaul.Guo@Sun.COM /*
4456621Sbt150084  * ixgbe_setup_phy_link_speed - Set auto advertise
4466621Sbt150084  * @hw: pointer to hardware structure
4476621Sbt150084  * @speed: new link speed
4488490SPaul.Guo@Sun.COM  * @autoneg: true if autonegotiation enabled
4496621Sbt150084  *
4506621Sbt150084  * Sets the auto advertised capabilities
4516621Sbt150084  */
4526621Sbt150084 s32
4536621Sbt150084 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
4546621Sbt150084     bool autoneg,
4556621Sbt150084     bool autoneg_wait_to_complete)
4566621Sbt150084 {
4576621Sbt150084 	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
4586621Sbt150084 	    autoneg, autoneg_wait_to_complete),
4596621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
4606621Sbt150084 }
4616621Sbt150084 
4626621Sbt150084 /*
4636621Sbt150084  * ixgbe_setup_link - Configure link settings
4646621Sbt150084  * @hw: pointer to hardware structure
4656621Sbt150084  *
4666621Sbt150084  * Configures link settings based on values in the ixgbe_hw struct.
4676621Sbt150084  * Restarts the link.  Performs autonegotiation if needed.
4686621Sbt150084  */
4696621Sbt150084 s32
4706621Sbt150084 ixgbe_setup_link(struct ixgbe_hw *hw)
4716621Sbt150084 {
4726621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw),
4736621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
4746621Sbt150084 }
4756621Sbt150084 
4766621Sbt150084 /*
4776621Sbt150084  * ixgbe_check_link - Get link and speed status
4786621Sbt150084  * @hw: pointer to hardware structure
4796621Sbt150084  *
4806621Sbt150084  * Reads the links register to determine if link is up and the current speed
4816621Sbt150084  */
4826621Sbt150084 s32
4836621Sbt150084 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
4848490SPaul.Guo@Sun.COM     bool *link_up, bool link_up_wait_to_complete)
4856621Sbt150084 {
4866621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
4878490SPaul.Guo@Sun.COM 	    link_up, link_up_wait_to_complete), IXGBE_NOT_IMPLEMENTED);
4886621Sbt150084 }
4896621Sbt150084 
4906621Sbt150084 /*
4916621Sbt150084  * ixgbe_setup_link_speed - Set link speed
4926621Sbt150084  * @hw: pointer to hardware structure
4936621Sbt150084  * @speed: new link speed
4948490SPaul.Guo@Sun.COM  * @autoneg: true if autonegotiation enabled
4956621Sbt150084  *
4966621Sbt150084  * Set the link speed and restarts the link.
4976621Sbt150084  */
4986621Sbt150084 s32 ixgbe_setup_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
4996621Sbt150084     bool autoneg,
5006621Sbt150084     bool autoneg_wait_to_complete)
5016621Sbt150084 {
5026621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.setup_link_speed, (hw, speed,
5036621Sbt150084 	    autoneg, autoneg_wait_to_complete),
5046621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5056621Sbt150084 }
5066621Sbt150084 
5076621Sbt150084 /*
5086621Sbt150084  * ixgbe_get_link_capabilities - Returns link capabilities
5096621Sbt150084  * @hw: pointer to hardware structure
5106621Sbt150084  *
5116621Sbt150084  * Determines the link capabilities of the current configuration.
5126621Sbt150084  */
5136621Sbt150084 s32
5146621Sbt150084 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
5156621Sbt150084     bool *autoneg)
5166621Sbt150084 {
5176621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
5186621Sbt150084 	    speed, autoneg), IXGBE_NOT_IMPLEMENTED);
5196621Sbt150084 }
5206621Sbt150084 
5216621Sbt150084 /*
5226621Sbt150084  * ixgbe_led_on - Turn on LEDs
5236621Sbt150084  * @hw: pointer to hardware structure
5246621Sbt150084  * @index: led number to turn on
5256621Sbt150084  *
5266621Sbt150084  * Turns on the software controllable LEDs.
5276621Sbt150084  */
5286621Sbt150084 s32
5296621Sbt150084 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
5306621Sbt150084 {
5316621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
5326621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5336621Sbt150084 }
5346621Sbt150084 
5356621Sbt150084 /*
5366621Sbt150084  * ixgbe_led_off - Turn off LEDs
5376621Sbt150084  * @hw: pointer to hardware structure
5386621Sbt150084  * @index: led number to turn off
5396621Sbt150084  *
5406621Sbt150084  * Turns off the software controllable LEDs.
5416621Sbt150084  */
5426621Sbt150084 s32
5436621Sbt150084 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
5446621Sbt150084 {
5456621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
5466621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5476621Sbt150084 }
5486621Sbt150084 
5496621Sbt150084 /*
5506621Sbt150084  * ixgbe_blink_led_start - Blink LEDs
5516621Sbt150084  * @hw: pointer to hardware structure
5526621Sbt150084  * @index: led number to blink
5536621Sbt150084  *
5546621Sbt150084  * Blink LED based on index.
5556621Sbt150084  */
5566621Sbt150084 s32
5576621Sbt150084 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
5586621Sbt150084 {
5596621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
5606621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5616621Sbt150084 }
5626621Sbt150084 
5636621Sbt150084 /*
5646621Sbt150084  * ixgbe_blink_led_stop - Stop blinking LEDs
5656621Sbt150084  * @hw: pointer to hardware structure
5666621Sbt150084  *
5676621Sbt150084  * Stop blinking LED based on index.
5686621Sbt150084  */
5696621Sbt150084 s32
5706621Sbt150084 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
5716621Sbt150084 {
5726621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
5736621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5746621Sbt150084 }
5756621Sbt150084 
5766621Sbt150084 /*
5776621Sbt150084  * ixgbe_init_eeprom_params - Initialize EEPROM parameters
5786621Sbt150084  * @hw: pointer to hardware structure
5796621Sbt150084  *
5806621Sbt150084  * Initializes the EEPROM parameters ixgbe_eeprom_info within the
5816621Sbt150084  * ixgbe_hw struct in order to set up EEPROM access.
5826621Sbt150084  */
5836621Sbt150084 s32
5846621Sbt150084 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
5856621Sbt150084 {
5866621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
5876621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
5886621Sbt150084 }
5896621Sbt150084 
5906621Sbt150084 
5916621Sbt150084 /*
5926621Sbt150084  * ixgbe_write_eeprom - Write word to EEPROM
5936621Sbt150084  * @hw: pointer to hardware structure
5946621Sbt150084  * @offset: offset within the EEPROM to be written to
5956621Sbt150084  * @data: 16 bit word to be written to the EEPROM
5966621Sbt150084  *
5976621Sbt150084  * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
5986621Sbt150084  * called after this function, the EEPROM will most likely contain an
5996621Sbt150084  * invalid checksum.
6006621Sbt150084  */
6016621Sbt150084 s32
6026621Sbt150084 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
6036621Sbt150084 {
6046621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
6056621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6066621Sbt150084 }
6076621Sbt150084 
6086621Sbt150084 /*
6096621Sbt150084  * ixgbe_read_eeprom - Read word from EEPROM
6106621Sbt150084  * @hw: pointer to hardware structure
6116621Sbt150084  * @offset: offset within the EEPROM to be read
6126621Sbt150084  * @data: read 16 bit value from EEPROM
6136621Sbt150084  *
6146621Sbt150084  * Reads 16 bit value from EEPROM
6156621Sbt150084  */
6166621Sbt150084 s32
6176621Sbt150084 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
6186621Sbt150084 {
6196621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
6206621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6216621Sbt150084 }
6226621Sbt150084 
6236621Sbt150084 /*
6246621Sbt150084  * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
6256621Sbt150084  * @hw: pointer to hardware structure
6266621Sbt150084  * @checksum_val: calculated checksum
6276621Sbt150084  *
6286621Sbt150084  * Performs checksum calculation and validates the EEPROM checksum
6296621Sbt150084  */
6306621Sbt150084 s32
6316621Sbt150084 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
6326621Sbt150084 {
6336621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
6346621Sbt150084 	    (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
6356621Sbt150084 }
6366621Sbt150084 
6376621Sbt150084 /*
6386621Sbt150084  * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
6396621Sbt150084  * @hw: pointer to hardware structure
6406621Sbt150084  */
6416621Sbt150084 s32
6426621Sbt150084 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
6436621Sbt150084 {
6446621Sbt150084 	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
6456621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
6466621Sbt150084 }
6476621Sbt150084 
6486621Sbt150084 /*
6499353SSamuel.Tu@Sun.COM  * ixgbe_insert_mac_addr - Find a RAR for this mac address
6509353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
6519353SSamuel.Tu@Sun.COM  * @addr: Address to put into receive address register
6529353SSamuel.Tu@Sun.COM  * @vmdq: VMDq pool to assign
6539353SSamuel.Tu@Sun.COM  *
6549353SSamuel.Tu@Sun.COM  * Puts an ethernet address into a receive address register, or
6559353SSamuel.Tu@Sun.COM  * finds the rar that it is aleady in; adds to the pool list
6569353SSamuel.Tu@Sun.COM  */
6579353SSamuel.Tu@Sun.COM s32
6589353SSamuel.Tu@Sun.COM ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
6599353SSamuel.Tu@Sun.COM {
6609353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
6619353SSamuel.Tu@Sun.COM 	    (hw, addr, vmdq), IXGBE_NOT_IMPLEMENTED);
6629353SSamuel.Tu@Sun.COM }
6639353SSamuel.Tu@Sun.COM 
6649353SSamuel.Tu@Sun.COM /*
6656621Sbt150084  * ixgbe_set_rar - Set Rx address register
6666621Sbt150084  * @hw: pointer to hardware structure
6676621Sbt150084  * @index: Receive address register to write
6686621Sbt150084  * @addr: Address to put into receive address register
6696621Sbt150084  * @vmdq: VMDq "set"
6706621Sbt150084  * @enable_addr: set flag that address is active
6716621Sbt150084  *
6726621Sbt150084  * Puts an ethernet address into a receive address register.
6736621Sbt150084  */
6746621Sbt150084 s32
6756621Sbt150084 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
6766621Sbt150084     u32 enable_addr)
6776621Sbt150084 {
6786621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
6796621Sbt150084 	    enable_addr), IXGBE_NOT_IMPLEMENTED);
6806621Sbt150084 }
6816621Sbt150084 
6826621Sbt150084 /*
6838490SPaul.Guo@Sun.COM  * ixgbe_clear_rar - Clear Rx address register
6848490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
6858490SPaul.Guo@Sun.COM  * @index: Receive address register to write
6868490SPaul.Guo@Sun.COM  *
6878490SPaul.Guo@Sun.COM  * Puts an ethernet address into a receive address register.
6888490SPaul.Guo@Sun.COM  */
6898490SPaul.Guo@Sun.COM s32
6908490SPaul.Guo@Sun.COM ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
6918490SPaul.Guo@Sun.COM {
6928490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
6938490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
6948490SPaul.Guo@Sun.COM }
6958490SPaul.Guo@Sun.COM 
6968490SPaul.Guo@Sun.COM /*
6976621Sbt150084  * ixgbe_set_vmdq - Associate a VMDq index with a receive address
6986621Sbt150084  * @hw: pointer to hardware structure
6996621Sbt150084  * @rar: receive address register index to associate with VMDq index
7006621Sbt150084  * @vmdq: VMDq set or pool index
7016621Sbt150084  */
7026621Sbt150084 s32
7036621Sbt150084 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
7046621Sbt150084 {
7056621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
7066621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7076621Sbt150084 }
7086621Sbt150084 
7096621Sbt150084 /*
7108490SPaul.Guo@Sun.COM  * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
7118490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
7128490SPaul.Guo@Sun.COM  * @rar: receive address register index to disassociate with VMDq index
7138490SPaul.Guo@Sun.COM  * @vmdq: VMDq set or pool index
7148490SPaul.Guo@Sun.COM  */
7158490SPaul.Guo@Sun.COM s32
7168490SPaul.Guo@Sun.COM ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
7178490SPaul.Guo@Sun.COM {
7188490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
7198490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
7208490SPaul.Guo@Sun.COM }
7218490SPaul.Guo@Sun.COM 
7228490SPaul.Guo@Sun.COM /*
7236621Sbt150084  * ixgbe_init_rx_addrs - Initializes receive address filters.
7246621Sbt150084  * @hw: pointer to hardware structure
7256621Sbt150084  *
7266621Sbt150084  * Places the MAC address in receive address register 0 and clears the rest
7276621Sbt150084  * of the receive address registers. Clears the multicast table. Assumes
7286621Sbt150084  * the receiver is in reset when the routine is called.
7296621Sbt150084  */
7306621Sbt150084 s32
7316621Sbt150084 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
7326621Sbt150084 {
7336621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
7346621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7356621Sbt150084 }
7366621Sbt150084 
7376621Sbt150084 /*
7386621Sbt150084  * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
7396621Sbt150084  * @hw: pointer to hardware structure
7406621Sbt150084  */
7416621Sbt150084 u32
7426621Sbt150084 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
7436621Sbt150084 {
7446621Sbt150084 	return (hw->mac.num_rar_entries);
7456621Sbt150084 }
7466621Sbt150084 
7476621Sbt150084 /*
7486621Sbt150084  * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
7496621Sbt150084  * @hw: pointer to hardware structure
7506621Sbt150084  * @addr_list: the list of new multicast addresses
7516621Sbt150084  * @addr_count: number of addresses
7526621Sbt150084  * @func: iterator function to walk the multicast address list
7536621Sbt150084  *
7546621Sbt150084  * The given list replaces any existing list. Clears the secondary addrs from
7556621Sbt150084  * receive address registers. Uses unused receive address registers for the
7566621Sbt150084  * first secondary addresses, and falls back to promiscuous mode as needed.
7576621Sbt150084  */
7586621Sbt150084 s32
7596621Sbt150084 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
7606621Sbt150084     u32 addr_count, ixgbe_mc_addr_itr func)
7616621Sbt150084 {
7626621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
7636621Sbt150084 	    addr_list, addr_count, func),
7646621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7656621Sbt150084 }
7666621Sbt150084 
7676621Sbt150084 /*
7686621Sbt150084  * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
7696621Sbt150084  * @hw: pointer to hardware structure
7706621Sbt150084  * @mc_addr_list: the list of new multicast addresses
7716621Sbt150084  * @mc_addr_count: number of addresses
7726621Sbt150084  * @func: iterator function to walk the multicast address list
7736621Sbt150084  *
7746621Sbt150084  * The given list replaces any existing list. Clears the MC addrs from receive
7756621Sbt150084  * address registers and the multicast table. Uses unused receive address
7766621Sbt150084  * registers for the first multicast addresses, and hashes the rest into the
7776621Sbt150084  * multicast table.
7786621Sbt150084  */
7796621Sbt150084 s32
7806621Sbt150084 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
7816621Sbt150084     u32 mc_addr_count, ixgbe_mc_addr_itr func)
7826621Sbt150084 {
7836621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
7846621Sbt150084 	    mc_addr_list, mc_addr_count, func),
7856621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7866621Sbt150084 }
7876621Sbt150084 
7886621Sbt150084 /*
7896621Sbt150084  * ixgbe_enable_mc - Enable multicast address in RAR
7906621Sbt150084  * @hw: pointer to hardware structure
7916621Sbt150084  *
7926621Sbt150084  * Enables multicast address in RAR and the use of the multicast hash table.
7936621Sbt150084  */
7946621Sbt150084 s32
7956621Sbt150084 ixgbe_enable_mc(struct ixgbe_hw *hw)
7966621Sbt150084 {
7976621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
7986621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
7996621Sbt150084 }
8006621Sbt150084 
8016621Sbt150084 /*
8026621Sbt150084  * ixgbe_disable_mc - Disable multicast address in RAR
8036621Sbt150084  * @hw: pointer to hardware structure
8046621Sbt150084  *
8056621Sbt150084  * Disables multicast address in RAR and the use of the multicast hash table.
8066621Sbt150084  */
8076621Sbt150084 s32
8086621Sbt150084 ixgbe_disable_mc(struct ixgbe_hw *hw)
8096621Sbt150084 {
8106621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
8116621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8126621Sbt150084 }
8136621Sbt150084 
8146621Sbt150084 /*
8156621Sbt150084  * ixgbe_clear_vfta - Clear VLAN filter table
8166621Sbt150084  * @hw: pointer to hardware structure
8176621Sbt150084  *
8186621Sbt150084  * Clears the VLAN filer table, and the VMDq index associated with the filter
8196621Sbt150084  */
8206621Sbt150084 s32
8216621Sbt150084 ixgbe_clear_vfta(struct ixgbe_hw *hw)
8226621Sbt150084 {
8236621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
8246621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8256621Sbt150084 }
8266621Sbt150084 
8276621Sbt150084 /*
8286621Sbt150084  * ixgbe_set_vfta - Set VLAN filter table
8296621Sbt150084  * @hw: pointer to hardware structure
8306621Sbt150084  * @vlan: VLAN id to write to VLAN filter
8316621Sbt150084  * @vind: VMDq output index that maps queue to VLAN id in VFTA
8326621Sbt150084  * @vlan_on: boolean flag to turn on/off VLAN in VFTA
8336621Sbt150084  *
8346621Sbt150084  * Turn on/off specified VLAN in the VLAN filter table.
8356621Sbt150084  */
8366621Sbt150084 s32
8376621Sbt150084 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
8386621Sbt150084 {
8396621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
8406621Sbt150084 	    vlan_on), IXGBE_NOT_IMPLEMENTED);
8416621Sbt150084 }
8426621Sbt150084 
8436621Sbt150084 /*
8449353SSamuel.Tu@Sun.COM  * ixgbe_fc_enable - Enable flow control
8456621Sbt150084  * @hw: pointer to hardware structure
8466621Sbt150084  * @packetbuf_num: packet buffer number (0-7)
8476621Sbt150084  *
8486621Sbt150084  * Configures the flow control settings based on SW configuration.
8496621Sbt150084  */
8506621Sbt150084 s32
8519353SSamuel.Tu@Sun.COM ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
8526621Sbt150084 {
8539353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw, packetbuf_num),
8546621Sbt150084 	    IXGBE_NOT_IMPLEMENTED);
8556621Sbt150084 }
8566621Sbt150084 
8576621Sbt150084 /*
8586621Sbt150084  * ixgbe_read_analog_reg8 - Reads 8 bit analog register
8596621Sbt150084  * @hw: pointer to hardware structure
8606621Sbt150084  * @reg: analog register to read
8616621Sbt150084  * @val: read value
8626621Sbt150084  *
8636621Sbt150084  * Performs write operation to analog register specified.
8646621Sbt150084  */
8656621Sbt150084 s32
8666621Sbt150084 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
8676621Sbt150084 {
8686621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
8696621Sbt150084 	    val), IXGBE_NOT_IMPLEMENTED);
8706621Sbt150084 }
8716621Sbt150084 
8726621Sbt150084 /*
8736621Sbt150084  * ixgbe_write_analog_reg8 - Writes 8 bit analog register
8746621Sbt150084  * @hw: pointer to hardware structure
8756621Sbt150084  * @reg: analog register to write
8766621Sbt150084  * @val: value to write
8776621Sbt150084  *
8786621Sbt150084  * Performs write operation to Atlas analog register specified.
8796621Sbt150084  */
8806621Sbt150084 s32
8816621Sbt150084 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
8826621Sbt150084 {
8836621Sbt150084 	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
8846621Sbt150084 	    val), IXGBE_NOT_IMPLEMENTED);
8856621Sbt150084 }
8868490SPaul.Guo@Sun.COM 
8878490SPaul.Guo@Sun.COM /*
8888490SPaul.Guo@Sun.COM  * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
8898490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
8908490SPaul.Guo@Sun.COM  *
8918490SPaul.Guo@Sun.COM  * Initializes the Unicast Table Arrays to zero on device load.  This
8928490SPaul.Guo@Sun.COM  * is part of the Rx init addr execution path.
8938490SPaul.Guo@Sun.COM  */
8948490SPaul.Guo@Sun.COM s32
8958490SPaul.Guo@Sun.COM ixgbe_init_uta_tables(struct ixgbe_hw *hw)
8968490SPaul.Guo@Sun.COM {
8978490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
8988490SPaul.Guo@Sun.COM 	    IXGBE_NOT_IMPLEMENTED);
8998490SPaul.Guo@Sun.COM }
9008490SPaul.Guo@Sun.COM 
9018490SPaul.Guo@Sun.COM /*
9029353SSamuel.Tu@Sun.COM  * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
9039353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9049353SSamuel.Tu@Sun.COM  * @byte_offset: byte offset to read
9059353SSamuel.Tu@Sun.COM  * @data: value read
9069353SSamuel.Tu@Sun.COM  *
9079353SSamuel.Tu@Sun.COM  * Performs byte read operation to SFP module's EEPROM over I2C interface.
9089353SSamuel.Tu@Sun.COM  */
9099353SSamuel.Tu@Sun.COM s32
9109353SSamuel.Tu@Sun.COM ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
9119353SSamuel.Tu@Sun.COM     u8 *data)
9129353SSamuel.Tu@Sun.COM {
9139353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
9149353SSamuel.Tu@Sun.COM 	    dev_addr, data), IXGBE_NOT_IMPLEMENTED);
9159353SSamuel.Tu@Sun.COM }
9169353SSamuel.Tu@Sun.COM 
9179353SSamuel.Tu@Sun.COM /*
9189353SSamuel.Tu@Sun.COM  * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
9199353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9209353SSamuel.Tu@Sun.COM  * @byte_offset: byte offset to write
9219353SSamuel.Tu@Sun.COM  * @data: value to write
9229353SSamuel.Tu@Sun.COM  *
9239353SSamuel.Tu@Sun.COM  * Performs byte write operation to SFP module's EEPROM over I2C interface
9249353SSamuel.Tu@Sun.COM  * at a specified device address.
9259353SSamuel.Tu@Sun.COM  */
9269353SSamuel.Tu@Sun.COM s32
9279353SSamuel.Tu@Sun.COM ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
9289353SSamuel.Tu@Sun.COM     u8 data)
9299353SSamuel.Tu@Sun.COM {
9309353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte,
9319353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, dev_addr, data), IXGBE_NOT_IMPLEMENTED);
9329353SSamuel.Tu@Sun.COM }
9339353SSamuel.Tu@Sun.COM 
9349353SSamuel.Tu@Sun.COM /*
9359353SSamuel.Tu@Sun.COM  * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
9369353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9379353SSamuel.Tu@Sun.COM  * @byte_offset: EEPROM byte offset to write
9389353SSamuel.Tu@Sun.COM  * @eeprom_data: value to write
9399353SSamuel.Tu@Sun.COM  *
9409353SSamuel.Tu@Sun.COM  * Performs byte write operation to SFP module's EEPROM over I2C interface.
9419353SSamuel.Tu@Sun.COM  */
9429353SSamuel.Tu@Sun.COM s32
9439353SSamuel.Tu@Sun.COM ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 eeprom_data)
9449353SSamuel.Tu@Sun.COM {
9459353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
9469353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, eeprom_data), IXGBE_NOT_IMPLEMENTED);
9479353SSamuel.Tu@Sun.COM }
9489353SSamuel.Tu@Sun.COM 
9499353SSamuel.Tu@Sun.COM /*
9508490SPaul.Guo@Sun.COM  * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
9518490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
9528490SPaul.Guo@Sun.COM  * @byte_offset: EEPROM byte offset to read
9538490SPaul.Guo@Sun.COM  * @eeprom_data: value read
9548490SPaul.Guo@Sun.COM  *
9558490SPaul.Guo@Sun.COM  * Performs byte read operation to SFP module's EEPROM over I2C interface.
9568490SPaul.Guo@Sun.COM  */
9578490SPaul.Guo@Sun.COM s32
9588490SPaul.Guo@Sun.COM ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
9598490SPaul.Guo@Sun.COM {
9608490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
9619353SSamuel.Tu@Sun.COM 	    (hw, byte_offset, eeprom_data), IXGBE_NOT_IMPLEMENTED);
9628490SPaul.Guo@Sun.COM }
9638490SPaul.Guo@Sun.COM 
9648490SPaul.Guo@Sun.COM /*
9658490SPaul.Guo@Sun.COM  * ixgbe_get_supported_physical_layer - Returns physical layer type
9668490SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
9678490SPaul.Guo@Sun.COM  *
9688490SPaul.Guo@Sun.COM  * Determines physical layer capabilities of the current configuration.
9698490SPaul.Guo@Sun.COM  */
9709353SSamuel.Tu@Sun.COM u32
9718490SPaul.Guo@Sun.COM ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
9728490SPaul.Guo@Sun.COM {
9738490SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
9748490SPaul.Guo@Sun.COM 	    (hw), IXGBE_NOT_IMPLEMENTED);
9758490SPaul.Guo@Sun.COM }
9769353SSamuel.Tu@Sun.COM 
9779353SSamuel.Tu@Sun.COM /*
9789353SSamuel.Tu@Sun.COM  * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependant on device specifics
9799353SSamuel.Tu@Sun.COM  * @hw: pointer to hardware structure
9809353SSamuel.Tu@Sun.COM  * @regval: bitfield to write to the Rx DMA register
9819353SSamuel.Tu@Sun.COM  *
9829353SSamuel.Tu@Sun.COM  * Enables the Rx DMA unit of the device.
9839353SSamuel.Tu@Sun.COM  */
9849353SSamuel.Tu@Sun.COM s32
9859353SSamuel.Tu@Sun.COM ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
9869353SSamuel.Tu@Sun.COM {
9879353SSamuel.Tu@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
9889353SSamuel.Tu@Sun.COM 	    (hw, regval), IXGBE_NOT_IMPLEMENTED);
9899353SSamuel.Tu@Sun.COM }
990*10305SPaul.Guo@Sun.COM 
991*10305SPaul.Guo@Sun.COM /*
992*10305SPaul.Guo@Sun.COM  * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
993*10305SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
994*10305SPaul.Guo@Sun.COM  * @mask: Mask to specify which semaphore to acquire
995*10305SPaul.Guo@Sun.COM  *
996*10305SPaul.Guo@Sun.COM  * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
997*10305SPaul.Guo@Sun.COM  * function (CSR, PHY0, PHY1, EEPROM, Flash)
998*10305SPaul.Guo@Sun.COM  */
999*10305SPaul.Guo@Sun.COM s32
1000*10305SPaul.Guo@Sun.COM ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1001*10305SPaul.Guo@Sun.COM {
1002*10305SPaul.Guo@Sun.COM 	return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1003*10305SPaul.Guo@Sun.COM 	    (hw, mask), IXGBE_NOT_IMPLEMENTED);
1004*10305SPaul.Guo@Sun.COM }
1005*10305SPaul.Guo@Sun.COM 
1006*10305SPaul.Guo@Sun.COM /*
1007*10305SPaul.Guo@Sun.COM  * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1008*10305SPaul.Guo@Sun.COM  * @hw: pointer to hardware structure
1009*10305SPaul.Guo@Sun.COM  * @mask: Mask to specify which semaphore to release
1010*10305SPaul.Guo@Sun.COM  *
1011*10305SPaul.Guo@Sun.COM  * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1012*10305SPaul.Guo@Sun.COM  * function (CSR, PHY0, PHY1, EEPROM, Flash)
1013*10305SPaul.Guo@Sun.COM  */
1014*10305SPaul.Guo@Sun.COM void
1015*10305SPaul.Guo@Sun.COM ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask)
1016*10305SPaul.Guo@Sun.COM {
1017*10305SPaul.Guo@Sun.COM 	if (hw->mac.ops.release_swfw_sync)
1018*10305SPaul.Guo@Sun.COM 		hw->mac.ops.release_swfw_sync(hw, mask);
1019*10305SPaul.Guo@Sun.COM }
1020