1*49ef7e06SGarrett D'Amore /*
2*49ef7e06SGarrett D'Amore  * Copyright (c) 2009-2015 Solarflare Communications Inc.
3*49ef7e06SGarrett D'Amore  * All rights reserved.
4*49ef7e06SGarrett D'Amore  *
5*49ef7e06SGarrett D'Amore  * Redistribution and use in source and binary forms, with or without
6*49ef7e06SGarrett D'Amore  * modification, are permitted provided that the following conditions are met:
7*49ef7e06SGarrett D'Amore  *
8*49ef7e06SGarrett D'Amore  * 1. Redistributions of source code must retain the above copyright notice,
9*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer.
10*49ef7e06SGarrett D'Amore  * 2. Redistributions in binary form must reproduce the above copyright notice,
11*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer in the documentation
12*49ef7e06SGarrett D'Amore  *    and/or other materials provided with the distribution.
13*49ef7e06SGarrett D'Amore  *
14*49ef7e06SGarrett D'Amore  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15*49ef7e06SGarrett D'Amore  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16*49ef7e06SGarrett D'Amore  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*49ef7e06SGarrett D'Amore  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18*49ef7e06SGarrett D'Amore  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19*49ef7e06SGarrett D'Amore  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20*49ef7e06SGarrett D'Amore  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21*49ef7e06SGarrett D'Amore  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22*49ef7e06SGarrett D'Amore  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23*49ef7e06SGarrett D'Amore  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24*49ef7e06SGarrett D'Amore  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*49ef7e06SGarrett D'Amore  *
26*49ef7e06SGarrett D'Amore  * The views and conclusions contained in the software and documentation are
27*49ef7e06SGarrett D'Amore  * those of the authors and should not be interpreted as representing official
28*49ef7e06SGarrett D'Amore  * policies, either expressed or implied, of the FreeBSD Project.
29*49ef7e06SGarrett D'Amore  */
30*49ef7e06SGarrett D'Amore 
31*49ef7e06SGarrett D'Amore #include "efx.h"
32*49ef7e06SGarrett D'Amore #include "efx_impl.h"
33*49ef7e06SGarrett D'Amore 
34*49ef7e06SGarrett D'Amore #if EFSYS_OPT_SIENA
35*49ef7e06SGarrett D'Amore 
36*49ef7e06SGarrett D'Amore static			void
siena_phy_decode_cap(__in uint32_t mcdi_cap,__out uint32_t * maskp)37*49ef7e06SGarrett D'Amore siena_phy_decode_cap(
38*49ef7e06SGarrett D'Amore 	__in		uint32_t mcdi_cap,
39*49ef7e06SGarrett D'Amore 	__out		uint32_t *maskp)
40*49ef7e06SGarrett D'Amore {
41*49ef7e06SGarrett D'Amore 	uint32_t mask;
42*49ef7e06SGarrett D'Amore 
43*49ef7e06SGarrett D'Amore 	mask = 0;
44*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
45*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_10HDX);
46*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
47*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_10FDX);
48*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
49*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_100HDX);
50*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
51*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_100FDX);
52*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
53*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_1000HDX);
54*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
55*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_1000FDX);
56*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
57*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_10000FDX);
58*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
59*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_PAUSE);
60*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
61*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_ASYM);
62*49ef7e06SGarrett D'Amore 	if (mcdi_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
63*49ef7e06SGarrett D'Amore 		mask |= (1 << EFX_PHY_CAP_AN);
64*49ef7e06SGarrett D'Amore 
65*49ef7e06SGarrett D'Amore 	*maskp = mask;
66*49ef7e06SGarrett D'Amore }
67*49ef7e06SGarrett D'Amore 
68*49ef7e06SGarrett D'Amore static			void
siena_phy_decode_link_mode(__in efx_nic_t * enp,__in uint32_t link_flags,__in unsigned int speed,__in unsigned int fcntl,__out efx_link_mode_t * link_modep,__out unsigned int * fcntlp)69*49ef7e06SGarrett D'Amore siena_phy_decode_link_mode(
70*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
71*49ef7e06SGarrett D'Amore 	__in		uint32_t link_flags,
72*49ef7e06SGarrett D'Amore 	__in		unsigned int speed,
73*49ef7e06SGarrett D'Amore 	__in		unsigned int fcntl,
74*49ef7e06SGarrett D'Amore 	__out		efx_link_mode_t *link_modep,
75*49ef7e06SGarrett D'Amore 	__out		unsigned int *fcntlp)
76*49ef7e06SGarrett D'Amore {
77*49ef7e06SGarrett D'Amore 	boolean_t fd = !!(link_flags &
78*49ef7e06SGarrett D'Amore 		    (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
79*49ef7e06SGarrett D'Amore 	boolean_t up = !!(link_flags &
80*49ef7e06SGarrett D'Amore 		    (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
81*49ef7e06SGarrett D'Amore 
82*49ef7e06SGarrett D'Amore 	_NOTE(ARGUNUSED(enp))
83*49ef7e06SGarrett D'Amore 
84*49ef7e06SGarrett D'Amore 	if (!up)
85*49ef7e06SGarrett D'Amore 		*link_modep = EFX_LINK_DOWN;
86*49ef7e06SGarrett D'Amore 	else if (speed == 10000 && fd)
87*49ef7e06SGarrett D'Amore 		*link_modep = EFX_LINK_10000FDX;
88*49ef7e06SGarrett D'Amore 	else if (speed == 1000)
89*49ef7e06SGarrett D'Amore 		*link_modep = fd ? EFX_LINK_1000FDX : EFX_LINK_1000HDX;
90*49ef7e06SGarrett D'Amore 	else if (speed == 100)
91*49ef7e06SGarrett D'Amore 		*link_modep = fd ? EFX_LINK_100FDX : EFX_LINK_100HDX;
92*49ef7e06SGarrett D'Amore 	else if (speed == 10)
93*49ef7e06SGarrett D'Amore 		*link_modep = fd ? EFX_LINK_10FDX : EFX_LINK_10HDX;
94*49ef7e06SGarrett D'Amore 	else
95*49ef7e06SGarrett D'Amore 		*link_modep = EFX_LINK_UNKNOWN;
96*49ef7e06SGarrett D'Amore 
97*49ef7e06SGarrett D'Amore 	if (fcntl == MC_CMD_FCNTL_OFF)
98*49ef7e06SGarrett D'Amore 		*fcntlp = 0;
99*49ef7e06SGarrett D'Amore 	else if (fcntl == MC_CMD_FCNTL_RESPOND)
100*49ef7e06SGarrett D'Amore 		*fcntlp = EFX_FCNTL_RESPOND;
101*49ef7e06SGarrett D'Amore 	else if (fcntl == MC_CMD_FCNTL_BIDIR)
102*49ef7e06SGarrett D'Amore 		*fcntlp = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
103*49ef7e06SGarrett D'Amore 	else {
104*49ef7e06SGarrett D'Amore 		EFSYS_PROBE1(mc_pcol_error, int, fcntl);
105*49ef7e06SGarrett D'Amore 		*fcntlp = 0;
106*49ef7e06SGarrett D'Amore 	}
107*49ef7e06SGarrett D'Amore }
108*49ef7e06SGarrett D'Amore 
109*49ef7e06SGarrett D'Amore 			void
siena_phy_link_ev(__in efx_nic_t * enp,__in efx_qword_t * eqp,__out efx_link_mode_t * link_modep)110*49ef7e06SGarrett D'Amore siena_phy_link_ev(
111*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
112*49ef7e06SGarrett D'Amore 	__in		efx_qword_t *eqp,
113*49ef7e06SGarrett D'Amore 	__out		efx_link_mode_t *link_modep)
114*49ef7e06SGarrett D'Amore {
115*49ef7e06SGarrett D'Amore 	efx_port_t *epp = &(enp->en_port);
116*49ef7e06SGarrett D'Amore 	unsigned int link_flags;
117*49ef7e06SGarrett D'Amore 	unsigned int speed;
118*49ef7e06SGarrett D'Amore 	unsigned int fcntl;
119*49ef7e06SGarrett D'Amore 	efx_link_mode_t link_mode;
120*49ef7e06SGarrett D'Amore 	uint32_t lp_cap_mask;
121*49ef7e06SGarrett D'Amore 
122*49ef7e06SGarrett D'Amore 	/*
123*49ef7e06SGarrett D'Amore 	 * Convert the LINKCHANGE speed enumeration into mbit/s, in the
124*49ef7e06SGarrett D'Amore 	 * same way as GET_LINK encodes the speed
125*49ef7e06SGarrett D'Amore 	 */
126*49ef7e06SGarrett D'Amore 	switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
127*49ef7e06SGarrett D'Amore 	case MCDI_EVENT_LINKCHANGE_SPEED_100M:
128*49ef7e06SGarrett D'Amore 		speed = 100;
129*49ef7e06SGarrett D'Amore 		break;
130*49ef7e06SGarrett D'Amore 	case MCDI_EVENT_LINKCHANGE_SPEED_1G:
131*49ef7e06SGarrett D'Amore 		speed = 1000;
132*49ef7e06SGarrett D'Amore 		break;
133*49ef7e06SGarrett D'Amore 	case MCDI_EVENT_LINKCHANGE_SPEED_10G:
134*49ef7e06SGarrett D'Amore 		speed = 10000;
135*49ef7e06SGarrett D'Amore 		break;
136*49ef7e06SGarrett D'Amore 	default:
137*49ef7e06SGarrett D'Amore 		speed = 0;
138*49ef7e06SGarrett D'Amore 		break;
139*49ef7e06SGarrett D'Amore 	}
140*49ef7e06SGarrett D'Amore 
141*49ef7e06SGarrett D'Amore 	link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
142*49ef7e06SGarrett D'Amore 	siena_phy_decode_link_mode(enp, link_flags, speed,
143*49ef7e06SGarrett D'Amore 				    MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
144*49ef7e06SGarrett D'Amore 				    &link_mode, &fcntl);
145*49ef7e06SGarrett D'Amore 	siena_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
146*49ef7e06SGarrett D'Amore 			    &lp_cap_mask);
147*49ef7e06SGarrett D'Amore 
148*49ef7e06SGarrett D'Amore 	/*
149*49ef7e06SGarrett D'Amore 	 * It's safe to update ep_lp_cap_mask without the driver's port lock
150*49ef7e06SGarrett D'Amore 	 * because presumably any concurrently running efx_port_poll() is
151*49ef7e06SGarrett D'Amore 	 * only going to arrive at the same value.
152*49ef7e06SGarrett D'Amore 	 *
153*49ef7e06SGarrett D'Amore 	 * ep_fcntl has two meanings. It's either the link common fcntl
154*49ef7e06SGarrett D'Amore 	 * (if the PHY supports AN), or it's the forced link state. If
155*49ef7e06SGarrett D'Amore 	 * the former, it's safe to update the value for the same reason as
156*49ef7e06SGarrett D'Amore 	 * for ep_lp_cap_mask. If the latter, then just ignore the value,
157*49ef7e06SGarrett D'Amore 	 * because we can race with efx_mac_fcntl_set().
158*49ef7e06SGarrett D'Amore 	 */
159*49ef7e06SGarrett D'Amore 	epp->ep_lp_cap_mask = lp_cap_mask;
160*49ef7e06SGarrett D'Amore 	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_AN))
161*49ef7e06SGarrett D'Amore 		epp->ep_fcntl = fcntl;
162*49ef7e06SGarrett D'Amore 
163*49ef7e06SGarrett D'Amore 	*link_modep = link_mode;
164*49ef7e06SGarrett D'Amore }
165*49ef7e06SGarrett D'Amore 
166*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
siena_phy_power(__in efx_nic_t * enp,__in boolean_t power)167*49ef7e06SGarrett D'Amore siena_phy_power(
168*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
169*49ef7e06SGarrett D'Amore 	__in		boolean_t power)
170*49ef7e06SGarrett D'Amore {
171*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
172*49ef7e06SGarrett D'Amore 
173*49ef7e06SGarrett D'Amore 	if (!power)
174*49ef7e06SGarrett D'Amore 		return (0);
175*49ef7e06SGarrett D'Amore 
176*49ef7e06SGarrett D'Amore 	/* Check if the PHY is a zombie */
177*49ef7e06SGarrett D'Amore 	if ((rc = siena_phy_verify(enp)) != 0)
178*49ef7e06SGarrett D'Amore 		goto fail1;
179*49ef7e06SGarrett D'Amore 
180*49ef7e06SGarrett D'Amore 	enp->en_reset_flags |= EFX_RESET_PHY;
181*49ef7e06SGarrett D'Amore 
182*49ef7e06SGarrett D'Amore 	return (0);
183*49ef7e06SGarrett D'Amore 
184*49ef7e06SGarrett D'Amore fail1:
185*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
186*49ef7e06SGarrett D'Amore 
187*49ef7e06SGarrett D'Amore 	return (rc);
188*49ef7e06SGarrett D'Amore }
189*49ef7e06SGarrett D'Amore 
190*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
siena_phy_get_link(__in efx_nic_t * enp,__out siena_link_state_t * slsp)191*49ef7e06SGarrett D'Amore siena_phy_get_link(
192*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
193*49ef7e06SGarrett D'Amore 	__out		siena_link_state_t *slsp)
194*49ef7e06SGarrett D'Amore {
195*49ef7e06SGarrett D'Amore 	efx_mcdi_req_t req;
196*49ef7e06SGarrett D'Amore 	uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
197*49ef7e06SGarrett D'Amore 			    MC_CMD_GET_LINK_OUT_LEN)];
198*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
199*49ef7e06SGarrett D'Amore 
200*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
201*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_GET_LINK;
202*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
203*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
204*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
205*49ef7e06SGarrett D'Amore 	req.emr_out_length = MC_CMD_GET_LINK_OUT_LEN;
206*49ef7e06SGarrett D'Amore 
207*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
208*49ef7e06SGarrett D'Amore 
209*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
210*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
211*49ef7e06SGarrett D'Amore 		goto fail1;
212*49ef7e06SGarrett D'Amore 	}
213*49ef7e06SGarrett D'Amore 
214*49ef7e06SGarrett D'Amore 	if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_LEN) {
215*49ef7e06SGarrett D'Amore 		rc = EMSGSIZE;
216*49ef7e06SGarrett D'Amore 		goto fail2;
217*49ef7e06SGarrett D'Amore 	}
218*49ef7e06SGarrett D'Amore 
219*49ef7e06SGarrett D'Amore 	siena_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP),
220*49ef7e06SGarrett D'Amore 			    &slsp->sls_adv_cap_mask);
221*49ef7e06SGarrett D'Amore 	siena_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP),
222*49ef7e06SGarrett D'Amore 			    &slsp->sls_lp_cap_mask);
223*49ef7e06SGarrett D'Amore 
224*49ef7e06SGarrett D'Amore 	siena_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS),
225*49ef7e06SGarrett D'Amore 			    MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED),
226*49ef7e06SGarrett D'Amore 			    MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL),
227*49ef7e06SGarrett D'Amore 			    &slsp->sls_link_mode, &slsp->sls_fcntl);
228*49ef7e06SGarrett D'Amore 
229*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LOOPBACK
230*49ef7e06SGarrett D'Amore 	/* Assert the MC_CMD_LOOPBACK and EFX_LOOPBACK namespace agree */
231*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_NONE == EFX_LOOPBACK_OFF);
232*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_DATA == EFX_LOOPBACK_DATA);
233*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMAC == EFX_LOOPBACK_GMAC);
234*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGMII == EFX_LOOPBACK_XGMII);
235*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGXS == EFX_LOOPBACK_XGXS);
236*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI == EFX_LOOPBACK_XAUI);
237*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII == EFX_LOOPBACK_GMII);
238*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII == EFX_LOOPBACK_SGMII);
239*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGBR == EFX_LOOPBACK_XGBR);
240*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI == EFX_LOOPBACK_XFI);
241*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI_FAR == EFX_LOOPBACK_XAUI_FAR);
242*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII_FAR == EFX_LOOPBACK_GMII_FAR);
243*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII_FAR == EFX_LOOPBACK_SGMII_FAR);
244*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI_FAR == EFX_LOOPBACK_XFI_FAR);
245*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GPHY == EFX_LOOPBACK_GPHY);
246*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PHYXS == EFX_LOOPBACK_PHY_XS);
247*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PCS == EFX_LOOPBACK_PCS);
248*49ef7e06SGarrett D'Amore 	EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PMAPMD == EFX_LOOPBACK_PMA_PMD);
249*49ef7e06SGarrett D'Amore 
250*49ef7e06SGarrett D'Amore 	slsp->sls_loopback = MCDI_OUT_DWORD(req, GET_LINK_OUT_LOOPBACK_MODE);
251*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_LOOPBACK */
252*49ef7e06SGarrett D'Amore 
253*49ef7e06SGarrett D'Amore 	slsp->sls_mac_up = MCDI_OUT_DWORD(req, GET_LINK_OUT_MAC_FAULT) == 0;
254*49ef7e06SGarrett D'Amore 
255*49ef7e06SGarrett D'Amore 	return (0);
256*49ef7e06SGarrett D'Amore 
257*49ef7e06SGarrett D'Amore fail2:
258*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail2);
259*49ef7e06SGarrett D'Amore fail1:
260*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
261*49ef7e06SGarrett D'Amore 
262*49ef7e06SGarrett D'Amore 	return (rc);
263*49ef7e06SGarrett D'Amore }
264*49ef7e06SGarrett D'Amore 
265*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
siena_phy_reconfigure(__in efx_nic_t * enp)266*49ef7e06SGarrett D'Amore siena_phy_reconfigure(
267*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp)
268*49ef7e06SGarrett D'Amore {
269*49ef7e06SGarrett D'Amore 	efx_port_t *epp = &(enp->en_port);
270*49ef7e06SGarrett D'Amore 	efx_mcdi_req_t req;
271*49ef7e06SGarrett D'Amore 	uint8_t payload[MAX(MAX(MC_CMD_SET_ID_LED_IN_LEN,
272*49ef7e06SGarrett D'Amore 				MC_CMD_SET_ID_LED_OUT_LEN),
273*49ef7e06SGarrett D'Amore 			    MAX(MC_CMD_SET_LINK_IN_LEN,
274*49ef7e06SGarrett D'Amore 				MC_CMD_SET_LINK_OUT_LEN))];
275*49ef7e06SGarrett D'Amore 	uint32_t cap_mask;
276*49ef7e06SGarrett D'Amore 	unsigned int led_mode;
277*49ef7e06SGarrett D'Amore 	unsigned int speed;
278*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
279*49ef7e06SGarrett D'Amore 
280*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
281*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_SET_LINK;
282*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
283*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
284*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
285*49ef7e06SGarrett D'Amore 	req.emr_out_length = MC_CMD_SET_LINK_OUT_LEN;
286*49ef7e06SGarrett D'Amore 
287*49ef7e06SGarrett D'Amore 	cap_mask = epp->ep_adv_cap_mask;
288*49ef7e06SGarrett D'Amore 	MCDI_IN_POPULATE_DWORD_10(req, SET_LINK_IN_CAP,
289*49ef7e06SGarrett D'Amore 		PHY_CAP_10HDX, (cap_mask >> EFX_PHY_CAP_10HDX) & 0x1,
290*49ef7e06SGarrett D'Amore 		PHY_CAP_10FDX, (cap_mask >> EFX_PHY_CAP_10FDX) & 0x1,
291*49ef7e06SGarrett D'Amore 		PHY_CAP_100HDX, (cap_mask >> EFX_PHY_CAP_100HDX) & 0x1,
292*49ef7e06SGarrett D'Amore 		PHY_CAP_100FDX, (cap_mask >> EFX_PHY_CAP_100FDX) & 0x1,
293*49ef7e06SGarrett D'Amore 		PHY_CAP_1000HDX, (cap_mask >> EFX_PHY_CAP_1000HDX) & 0x1,
294*49ef7e06SGarrett D'Amore 		PHY_CAP_1000FDX, (cap_mask >> EFX_PHY_CAP_1000FDX) & 0x1,
295*49ef7e06SGarrett D'Amore 		PHY_CAP_10000FDX, (cap_mask >> EFX_PHY_CAP_10000FDX) & 0x1,
296*49ef7e06SGarrett D'Amore 		PHY_CAP_PAUSE, (cap_mask >> EFX_PHY_CAP_PAUSE) & 0x1,
297*49ef7e06SGarrett D'Amore 		PHY_CAP_ASYM, (cap_mask >> EFX_PHY_CAP_ASYM) & 0x1,
298*49ef7e06SGarrett D'Amore 		PHY_CAP_AN, (cap_mask >> EFX_PHY_CAP_AN) & 0x1);
299*49ef7e06SGarrett D'Amore 
300*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LOOPBACK
301*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE,
302*49ef7e06SGarrett D'Amore 		    epp->ep_loopback_type);
303*49ef7e06SGarrett D'Amore 	switch (epp->ep_loopback_link_mode) {
304*49ef7e06SGarrett D'Amore 	case EFX_LINK_100FDX:
305*49ef7e06SGarrett D'Amore 		speed = 100;
306*49ef7e06SGarrett D'Amore 		break;
307*49ef7e06SGarrett D'Amore 	case EFX_LINK_1000FDX:
308*49ef7e06SGarrett D'Amore 		speed = 1000;
309*49ef7e06SGarrett D'Amore 		break;
310*49ef7e06SGarrett D'Amore 	case EFX_LINK_10000FDX:
311*49ef7e06SGarrett D'Amore 		speed = 10000;
312*49ef7e06SGarrett D'Amore 		break;
313*49ef7e06SGarrett D'Amore 	default:
314*49ef7e06SGarrett D'Amore 		speed = 0;
315*49ef7e06SGarrett D'Amore 	}
316*49ef7e06SGarrett D'Amore #else
317*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE, MC_CMD_LOOPBACK_NONE);
318*49ef7e06SGarrett D'Amore 	speed = 0;
319*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_LOOPBACK */
320*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_SPEED, speed);
321*49ef7e06SGarrett D'Amore 
322*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_FLAGS
323*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, epp->ep_phy_flags);
324*49ef7e06SGarrett D'Amore #else
325*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, 0);
326*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_FLAGS */
327*49ef7e06SGarrett D'Amore 
328*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
329*49ef7e06SGarrett D'Amore 
330*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
331*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
332*49ef7e06SGarrett D'Amore 		goto fail1;
333*49ef7e06SGarrett D'Amore 	}
334*49ef7e06SGarrett D'Amore 
335*49ef7e06SGarrett D'Amore 	/* And set the blink mode */
336*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
337*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_SET_ID_LED;
338*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
339*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_SET_ID_LED_IN_LEN;
340*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
341*49ef7e06SGarrett D'Amore 	req.emr_out_length = MC_CMD_SET_ID_LED_OUT_LEN;
342*49ef7e06SGarrett D'Amore 
343*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_LED_CONTROL
344*49ef7e06SGarrett D'Amore 	switch (epp->ep_phy_led_mode) {
345*49ef7e06SGarrett D'Amore 	case EFX_PHY_LED_DEFAULT:
346*49ef7e06SGarrett D'Amore 		led_mode = MC_CMD_LED_DEFAULT;
347*49ef7e06SGarrett D'Amore 		break;
348*49ef7e06SGarrett D'Amore 	case EFX_PHY_LED_OFF:
349*49ef7e06SGarrett D'Amore 		led_mode = MC_CMD_LED_OFF;
350*49ef7e06SGarrett D'Amore 		break;
351*49ef7e06SGarrett D'Amore 	case EFX_PHY_LED_ON:
352*49ef7e06SGarrett D'Amore 		led_mode = MC_CMD_LED_ON;
353*49ef7e06SGarrett D'Amore 		break;
354*49ef7e06SGarrett D'Amore 	default:
355*49ef7e06SGarrett D'Amore 		EFSYS_ASSERT(0);
356*49ef7e06SGarrett D'Amore 		led_mode = MC_CMD_LED_DEFAULT;
357*49ef7e06SGarrett D'Amore 	}
358*49ef7e06SGarrett D'Amore 
359*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, led_mode);
360*49ef7e06SGarrett D'Amore #else
361*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, MC_CMD_LED_DEFAULT);
362*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_LED_CONTROL */
363*49ef7e06SGarrett D'Amore 
364*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
365*49ef7e06SGarrett D'Amore 
366*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
367*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
368*49ef7e06SGarrett D'Amore 		goto fail2;
369*49ef7e06SGarrett D'Amore 	}
370*49ef7e06SGarrett D'Amore 
371*49ef7e06SGarrett D'Amore 	return (0);
372*49ef7e06SGarrett D'Amore 
373*49ef7e06SGarrett D'Amore fail2:
374*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail2);
375*49ef7e06SGarrett D'Amore fail1:
376*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
377*49ef7e06SGarrett D'Amore 
378*49ef7e06SGarrett D'Amore 	return (rc);
379*49ef7e06SGarrett D'Amore }
380*49ef7e06SGarrett D'Amore 
381*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
siena_phy_verify(__in efx_nic_t * enp)382*49ef7e06SGarrett D'Amore siena_phy_verify(
383*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp)
384*49ef7e06SGarrett D'Amore {
385*49ef7e06SGarrett D'Amore 	efx_mcdi_req_t req;
386*49ef7e06SGarrett D'Amore 	uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
387*49ef7e06SGarrett D'Amore 			    MC_CMD_GET_PHY_STATE_OUT_LEN)];
388*49ef7e06SGarrett D'Amore 	uint32_t state;
389*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
390*49ef7e06SGarrett D'Amore 
391*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
392*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_GET_PHY_STATE;
393*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
394*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
395*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
396*49ef7e06SGarrett D'Amore 	req.emr_out_length = MC_CMD_GET_PHY_STATE_OUT_LEN;
397*49ef7e06SGarrett D'Amore 
398*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
399*49ef7e06SGarrett D'Amore 
400*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
401*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
402*49ef7e06SGarrett D'Amore 		goto fail1;
403*49ef7e06SGarrett D'Amore 	}
404*49ef7e06SGarrett D'Amore 
405*49ef7e06SGarrett D'Amore 	if (req.emr_out_length_used < MC_CMD_GET_PHY_STATE_OUT_LEN) {
406*49ef7e06SGarrett D'Amore 		rc = EMSGSIZE;
407*49ef7e06SGarrett D'Amore 		goto fail2;
408*49ef7e06SGarrett D'Amore 	}
409*49ef7e06SGarrett D'Amore 
410*49ef7e06SGarrett D'Amore 	state = MCDI_OUT_DWORD(req, GET_PHY_STATE_OUT_STATE);
411*49ef7e06SGarrett D'Amore 	if (state != MC_CMD_PHY_STATE_OK) {
412*49ef7e06SGarrett D'Amore 		if (state != MC_CMD_PHY_STATE_ZOMBIE)
413*49ef7e06SGarrett D'Amore 			EFSYS_PROBE1(mc_pcol_error, int, state);
414*49ef7e06SGarrett D'Amore 		rc = ENOTACTIVE;
415*49ef7e06SGarrett D'Amore 		goto fail3;
416*49ef7e06SGarrett D'Amore 	}
417*49ef7e06SGarrett D'Amore 
418*49ef7e06SGarrett D'Amore 	return (0);
419*49ef7e06SGarrett D'Amore 
420*49ef7e06SGarrett D'Amore fail3:
421*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail3);
422*49ef7e06SGarrett D'Amore fail2:
423*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail2);
424*49ef7e06SGarrett D'Amore fail1:
425*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
426*49ef7e06SGarrett D'Amore 
427*49ef7e06SGarrett D'Amore 	return (rc);
428*49ef7e06SGarrett D'Amore }
429*49ef7e06SGarrett D'Amore 
430*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
siena_phy_oui_get(__in efx_nic_t * enp,__out uint32_t * ouip)431*49ef7e06SGarrett D'Amore siena_phy_oui_get(
432*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
433*49ef7e06SGarrett D'Amore 	__out		uint32_t *ouip)
434*49ef7e06SGarrett D'Amore {
435*49ef7e06SGarrett D'Amore 	_NOTE(ARGUNUSED(enp, ouip))
436*49ef7e06SGarrett D'Amore 
437*49ef7e06SGarrett D'Amore 	return (ENOTSUP);
438*49ef7e06SGarrett D'Amore }
439*49ef7e06SGarrett D'Amore 
440*49ef7e06SGarrett D'Amore #if EFSYS_OPT_PHY_STATS
441*49ef7e06SGarrett D'Amore 
442*49ef7e06SGarrett D'Amore #define	SIENA_SIMPLE_STAT_SET(_vmask, _esmp, _smask, _stat,		\
443*49ef7e06SGarrett D'Amore 			    _mc_record, _efx_record)			\
444*49ef7e06SGarrett D'Amore 	if ((_vmask) & (1ULL << (_mc_record))) {			\
445*49ef7e06SGarrett D'Amore 		(_smask) |= (1ULL << (_efx_record));			\
446*49ef7e06SGarrett D'Amore 		if ((_stat) != NULL && !EFSYS_MEM_IS_NULL(_esmp)) {	\
447*49ef7e06SGarrett D'Amore 			efx_dword_t dword;				\
448*49ef7e06SGarrett D'Amore 			EFSYS_MEM_READD(_esmp, (_mc_record) * 4, &dword);\
449*49ef7e06SGarrett D'Amore 			(_stat)[_efx_record] =				\
450*49ef7e06SGarrett D'Amore 				EFX_DWORD_FIELD(dword, EFX_DWORD_0);	\
451*49ef7e06SGarrett D'Amore 		}							\
452*49ef7e06SGarrett D'Amore 	}
453*49ef7e06SGarrett D'Amore 
454*49ef7e06SGarrett D'Amore #define	SIENA_SIMPLE_STAT_SET2(_vmask, _esmp, _smask, _stat, _record)	\
455*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(_vmask, _esmp, _smask, _stat, 		\
456*49ef7e06SGarrett D'Amore 			    MC_CMD_ ## _record,				\
457*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_ ## _record)
458*49ef7e06SGarrett D'Amore 
459*49ef7e06SGarrett D'Amore 						void
siena_phy_decode_stats(__in efx_nic_t * enp,__in uint32_t vmask,__in_opt efsys_mem_t * esmp,__out_opt uint64_t * smaskp,__inout_ecount_opt (EFX_PHY_NSTATS)uint32_t * stat)460*49ef7e06SGarrett D'Amore siena_phy_decode_stats(
461*49ef7e06SGarrett D'Amore 	__in					efx_nic_t *enp,
462*49ef7e06SGarrett D'Amore 	__in					uint32_t vmask,
463*49ef7e06SGarrett D'Amore 	__in_opt				efsys_mem_t *esmp,
464*49ef7e06SGarrett D'Amore 	__out_opt				uint64_t *smaskp,
465*49ef7e06SGarrett D'Amore 	__inout_ecount_opt(EFX_PHY_NSTATS)	uint32_t *stat)
466*49ef7e06SGarrett D'Amore {
467*49ef7e06SGarrett D'Amore 	uint64_t smask = 0;
468*49ef7e06SGarrett D'Amore 
469*49ef7e06SGarrett D'Amore 	_NOTE(ARGUNUSED(enp))
470*49ef7e06SGarrett D'Amore 
471*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, OUI);
472*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PMA_PMD_LINK_UP);
473*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PMA_PMD_RX_FAULT);
474*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PMA_PMD_TX_FAULT);
475*49ef7e06SGarrett D'Amore 
476*49ef7e06SGarrett D'Amore 	if (vmask & (1 << MC_CMD_PMA_PMD_SIGNAL)) {
477*49ef7e06SGarrett D'Amore 		smask |=   ((1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_A) |
478*49ef7e06SGarrett D'Amore 			    (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_B) |
479*49ef7e06SGarrett D'Amore 			    (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_C) |
480*49ef7e06SGarrett D'Amore 			    (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_D));
481*49ef7e06SGarrett D'Amore 		if (stat != NULL && esmp != NULL && !EFSYS_MEM_IS_NULL(esmp)) {
482*49ef7e06SGarrett D'Amore 			efx_dword_t dword;
483*49ef7e06SGarrett D'Amore 			uint32_t sig;
484*49ef7e06SGarrett D'Amore 			EFSYS_MEM_READD(esmp, 4 * MC_CMD_PMA_PMD_SIGNAL,
485*49ef7e06SGarrett D'Amore 					&dword);
486*49ef7e06SGarrett D'Amore 			sig = EFX_DWORD_FIELD(dword, EFX_DWORD_0);
487*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PMA_PMD_SIGNAL_A] = (sig >> 1) & 1;
488*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PMA_PMD_SIGNAL_B] = (sig >> 2) & 1;
489*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PMA_PMD_SIGNAL_C] = (sig >> 3) & 1;
490*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PMA_PMD_SIGNAL_D] = (sig >> 4) & 1;
491*49ef7e06SGarrett D'Amore 		}
492*49ef7e06SGarrett D'Amore 	}
493*49ef7e06SGarrett D'Amore 
494*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PMA_PMD_SNR_A,
495*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_SNR_A);
496*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PMA_PMD_SNR_B,
497*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_SNR_B);
498*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PMA_PMD_SNR_C,
499*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_SNR_C);
500*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PMA_PMD_SNR_D,
501*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_SNR_D);
502*49ef7e06SGarrett D'Amore 
503*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PCS_LINK_UP);
504*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PCS_RX_FAULT);
505*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PCS_TX_FAULT);
506*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PCS_BER);
507*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, PCS_BLOCK_ERRORS);
508*49ef7e06SGarrett D'Amore 
509*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PHYXS_LINK_UP,
510*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_PHY_XS_LINK_UP);
511*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PHYXS_RX_FAULT,
512*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_PHY_XS_RX_FAULT);
513*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PHYXS_TX_FAULT,
514*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_PHY_XS_TX_FAULT);
515*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_PHYXS_ALIGN,
516*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_PHY_XS_ALIGN);
517*49ef7e06SGarrett D'Amore 
518*49ef7e06SGarrett D'Amore 	if (vmask & (1 << MC_CMD_PHYXS_SYNC)) {
519*49ef7e06SGarrett D'Amore 		smask |=   ((1 << EFX_PHY_STAT_PHY_XS_SYNC_A) |
520*49ef7e06SGarrett D'Amore 			    (1 << EFX_PHY_STAT_PHY_XS_SYNC_B) |
521*49ef7e06SGarrett D'Amore 			    (1 << EFX_PHY_STAT_PHY_XS_SYNC_C) |
522*49ef7e06SGarrett D'Amore 			    (1 << EFX_PHY_STAT_PHY_XS_SYNC_D));
523*49ef7e06SGarrett D'Amore 		if (stat != NULL && !EFSYS_MEM_IS_NULL(esmp)) {
524*49ef7e06SGarrett D'Amore 			efx_dword_t dword;
525*49ef7e06SGarrett D'Amore 			uint32_t sync;
526*49ef7e06SGarrett D'Amore 			EFSYS_MEM_READD(esmp, 4 * MC_CMD_PHYXS_SYNC, &dword);
527*49ef7e06SGarrett D'Amore 			sync = EFX_DWORD_FIELD(dword, EFX_DWORD_0);
528*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PHY_XS_SYNC_A] = (sync >> 0) & 1;
529*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PHY_XS_SYNC_B] = (sync >> 1) & 1;
530*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PHY_XS_SYNC_C] = (sync >> 2) & 1;
531*49ef7e06SGarrett D'Amore 			stat[EFX_PHY_STAT_PHY_XS_SYNC_D] = (sync >> 3) & 1;
532*49ef7e06SGarrett D'Amore 		}
533*49ef7e06SGarrett D'Amore 	}
534*49ef7e06SGarrett D'Amore 
535*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, AN_LINK_UP);
536*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET2(vmask, esmp, smask, stat, AN_COMPLETE);
537*49ef7e06SGarrett D'Amore 
538*49ef7e06SGarrett D'Amore 	SIENA_SIMPLE_STAT_SET(vmask, esmp, smask, stat, MC_CMD_CL22_LINK_UP,
539*49ef7e06SGarrett D'Amore 			    EFX_PHY_STAT_CL22EXT_LINK_UP);
540*49ef7e06SGarrett D'Amore 
541*49ef7e06SGarrett D'Amore 	if (smaskp != NULL)
542*49ef7e06SGarrett D'Amore 		*smaskp = smask;
543*49ef7e06SGarrett D'Amore }
544*49ef7e06SGarrett D'Amore 
545*49ef7e06SGarrett D'Amore 	__checkReturn				efx_rc_t
siena_phy_stats_update(__in efx_nic_t * enp,__in efsys_mem_t * esmp,__inout_ecount (EFX_PHY_NSTATS)uint32_t * stat)546*49ef7e06SGarrett D'Amore siena_phy_stats_update(
547*49ef7e06SGarrett D'Amore 	__in					efx_nic_t *enp,
548*49ef7e06SGarrett D'Amore 	__in					efsys_mem_t *esmp,
549*49ef7e06SGarrett D'Amore 	__inout_ecount(EFX_PHY_NSTATS)		uint32_t *stat)
550*49ef7e06SGarrett D'Amore {
551*49ef7e06SGarrett D'Amore 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
552*49ef7e06SGarrett D'Amore 	uint32_t vmask = encp->enc_mcdi_phy_stat_mask;
553*49ef7e06SGarrett D'Amore 	uint64_t smask;
554*49ef7e06SGarrett D'Amore 	efx_mcdi_req_t req;
555*49ef7e06SGarrett D'Amore 	uint8_t payload[MAX(MC_CMD_PHY_STATS_IN_LEN,
556*49ef7e06SGarrett D'Amore 			    MC_CMD_PHY_STATS_OUT_DMA_LEN)];
557*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
558*49ef7e06SGarrett D'Amore 
559*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
560*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_PHY_STATS;
561*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
562*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_PHY_STATS_IN_LEN;
563*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
564*49ef7e06SGarrett D'Amore 	req.emr_out_length = MC_CMD_PHY_STATS_OUT_DMA_LEN;
565*49ef7e06SGarrett D'Amore 
566*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, PHY_STATS_IN_DMA_ADDR_LO,
567*49ef7e06SGarrett D'Amore 			    EFSYS_MEM_ADDR(esmp) & 0xffffffff);
568*49ef7e06SGarrett D'Amore 	MCDI_IN_SET_DWORD(req, PHY_STATS_IN_DMA_ADDR_HI,
569*49ef7e06SGarrett D'Amore 			    EFSYS_MEM_ADDR(esmp) >> 32);
570*49ef7e06SGarrett D'Amore 
571*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
572*49ef7e06SGarrett D'Amore 
573*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
574*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
575*49ef7e06SGarrett D'Amore 		goto fail1;
576*49ef7e06SGarrett D'Amore 	}
577*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT3U(req.emr_out_length, ==, MC_CMD_PHY_STATS_OUT_DMA_LEN);
578*49ef7e06SGarrett D'Amore 
579*49ef7e06SGarrett D'Amore 	siena_phy_decode_stats(enp, vmask, esmp, &smask, stat);
580*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(smask == encp->enc_phy_stat_mask);
581*49ef7e06SGarrett D'Amore 
582*49ef7e06SGarrett D'Amore 	return (0);
583*49ef7e06SGarrett D'Amore 
584*49ef7e06SGarrett D'Amore fail1:
585*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
586*49ef7e06SGarrett D'Amore 
587*49ef7e06SGarrett D'Amore 	return (0);
588*49ef7e06SGarrett D'Amore }
589*49ef7e06SGarrett D'Amore 
590*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_PHY_STATS */
591*49ef7e06SGarrett D'Amore 
592*49ef7e06SGarrett D'Amore #if EFSYS_OPT_BIST
593*49ef7e06SGarrett D'Amore 
594*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
siena_phy_bist_start(__in efx_nic_t * enp,__in efx_bist_type_t type)595*49ef7e06SGarrett D'Amore siena_phy_bist_start(
596*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
597*49ef7e06SGarrett D'Amore 	__in			efx_bist_type_t type)
598*49ef7e06SGarrett D'Amore {
599*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
600*49ef7e06SGarrett D'Amore 
601*49ef7e06SGarrett D'Amore 	if ((rc = efx_mcdi_bist_start(enp, type)) != 0)
602*49ef7e06SGarrett D'Amore 		goto fail1;
603*49ef7e06SGarrett D'Amore 
604*49ef7e06SGarrett D'Amore 	return (0);
605*49ef7e06SGarrett D'Amore 
606*49ef7e06SGarrett D'Amore fail1:
607*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
608*49ef7e06SGarrett D'Amore 
609*49ef7e06SGarrett D'Amore 	return (rc);
610*49ef7e06SGarrett D'Amore }
611*49ef7e06SGarrett D'Amore 
612*49ef7e06SGarrett D'Amore static	__checkReturn		unsigned long
siena_phy_sft9001_bist_status(__in uint16_t code)613*49ef7e06SGarrett D'Amore siena_phy_sft9001_bist_status(
614*49ef7e06SGarrett D'Amore 	__in			uint16_t code)
615*49ef7e06SGarrett D'Amore {
616*49ef7e06SGarrett D'Amore 	switch (code) {
617*49ef7e06SGarrett D'Amore 	case MC_CMD_POLL_BIST_SFT9001_PAIR_BUSY:
618*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_BUSY);
619*49ef7e06SGarrett D'Amore 	case MC_CMD_POLL_BIST_SFT9001_INTER_PAIR_SHORT:
620*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_INTERPAIRSHORT);
621*49ef7e06SGarrett D'Amore 	case MC_CMD_POLL_BIST_SFT9001_INTRA_PAIR_SHORT:
622*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_INTRAPAIRSHORT);
623*49ef7e06SGarrett D'Amore 	case MC_CMD_POLL_BIST_SFT9001_PAIR_OPEN:
624*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_OPEN);
625*49ef7e06SGarrett D'Amore 	case MC_CMD_POLL_BIST_SFT9001_PAIR_OK:
626*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_OK);
627*49ef7e06SGarrett D'Amore 	default:
628*49ef7e06SGarrett D'Amore 		return (EFX_PHY_CABLE_STATUS_INVALID);
629*49ef7e06SGarrett D'Amore 	}
630*49ef7e06SGarrett D'Amore }
631*49ef7e06SGarrett D'Amore 
632*49ef7e06SGarrett D'Amore 	__checkReturn		efx_rc_t
633*49ef7e06SGarrett D'Amore siena_phy_bist_poll(
634*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
635*49ef7e06SGarrett D'Amore 	__in			efx_bist_type_t type,
636*49ef7e06SGarrett D'Amore 	__out			efx_bist_result_t *resultp,
637*49ef7e06SGarrett D'Amore 	__out_opt __drv_when(count > 0, __notnull)
638*49ef7e06SGarrett D'Amore 	uint32_t *value_maskp,
639*49ef7e06SGarrett D'Amore 	__out_ecount_opt(count)	__drv_when(count > 0, __notnull)
640*49ef7e06SGarrett D'Amore 	unsigned long *valuesp,
641*49ef7e06SGarrett D'Amore 	__in			size_t count)
642*49ef7e06SGarrett D'Amore {
643*49ef7e06SGarrett D'Amore 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
644*49ef7e06SGarrett D'Amore 	uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
645*49ef7e06SGarrett D'Amore 			    MCDI_CTL_SDU_LEN_MAX)];
646*49ef7e06SGarrett D'Amore 	uint32_t value_mask = 0;
647*49ef7e06SGarrett D'Amore 	efx_mcdi_req_t req;
648*49ef7e06SGarrett D'Amore 	uint32_t result;
649*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
650*49ef7e06SGarrett D'Amore 
651*49ef7e06SGarrett D'Amore 	(void) memset(payload, 0, sizeof (payload));
652*49ef7e06SGarrett D'Amore 	req.emr_cmd = MC_CMD_POLL_BIST;
653*49ef7e06SGarrett D'Amore 	req.emr_in_buf = payload;
654*49ef7e06SGarrett D'Amore 	req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
655*49ef7e06SGarrett D'Amore 	req.emr_out_buf = payload;
656*49ef7e06SGarrett D'Amore 	req.emr_out_length = MCDI_CTL_SDU_LEN_MAX;
657*49ef7e06SGarrett D'Amore 
658*49ef7e06SGarrett D'Amore 	efx_mcdi_execute(enp, &req);
659*49ef7e06SGarrett D'Amore 
660*49ef7e06SGarrett D'Amore 	if (req.emr_rc != 0) {
661*49ef7e06SGarrett D'Amore 		rc = req.emr_rc;
662*49ef7e06SGarrett D'Amore 		goto fail1;
663*49ef7e06SGarrett D'Amore 	}
664*49ef7e06SGarrett D'Amore 
665*49ef7e06SGarrett D'Amore 	if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) {
666*49ef7e06SGarrett D'Amore 		rc = EMSGSIZE;
667*49ef7e06SGarrett D'Amore 		goto fail2;
668*49ef7e06SGarrett D'Amore 	}
669*49ef7e06SGarrett D'Amore 
670*49ef7e06SGarrett D'Amore 	if (count > 0)
671*49ef7e06SGarrett D'Amore 		(void) memset(valuesp, '\0', count * sizeof (unsigned long));
672*49ef7e06SGarrett D'Amore 
673*49ef7e06SGarrett D'Amore 	result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT);
674*49ef7e06SGarrett D'Amore 
675*49ef7e06SGarrett D'Amore 	/* Extract PHY specific results */
676*49ef7e06SGarrett D'Amore 	if (result == MC_CMD_POLL_BIST_PASSED &&
677*49ef7e06SGarrett D'Amore 	    encp->enc_phy_type == EFX_PHY_SFT9001B &&
678*49ef7e06SGarrett D'Amore 	    req.emr_out_length_used >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN &&
679*49ef7e06SGarrett D'Amore 	    (type == EFX_BIST_TYPE_PHY_CABLE_SHORT ||
680*49ef7e06SGarrett D'Amore 	    type == EFX_BIST_TYPE_PHY_CABLE_LONG)) {
681*49ef7e06SGarrett D'Amore 		uint16_t word;
682*49ef7e06SGarrett D'Amore 
683*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_LENGTH_A) {
684*49ef7e06SGarrett D'Amore 			if (valuesp != NULL)
685*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_LENGTH_A] =
686*49ef7e06SGarrett D'Amore 				    MCDI_OUT_DWORD(req,
687*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A);
688*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_LENGTH_A);
689*49ef7e06SGarrett D'Amore 		}
690*49ef7e06SGarrett D'Amore 
691*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_LENGTH_B) {
692*49ef7e06SGarrett D'Amore 			if (valuesp != NULL)
693*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_LENGTH_B] =
694*49ef7e06SGarrett D'Amore 				    MCDI_OUT_DWORD(req,
695*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_LENGTH_B);
696*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_LENGTH_B);
697*49ef7e06SGarrett D'Amore 		}
698*49ef7e06SGarrett D'Amore 
699*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_LENGTH_C) {
700*49ef7e06SGarrett D'Amore 			if (valuesp != NULL)
701*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_LENGTH_C] =
702*49ef7e06SGarrett D'Amore 				    MCDI_OUT_DWORD(req,
703*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_LENGTH_C);
704*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_LENGTH_C);
705*49ef7e06SGarrett D'Amore 		}
706*49ef7e06SGarrett D'Amore 
707*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_LENGTH_D) {
708*49ef7e06SGarrett D'Amore 			if (valuesp != NULL)
709*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_LENGTH_D] =
710*49ef7e06SGarrett D'Amore 				    MCDI_OUT_DWORD(req,
711*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_LENGTH_D);
712*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_LENGTH_D);
713*49ef7e06SGarrett D'Amore 		}
714*49ef7e06SGarrett D'Amore 
715*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_STATUS_A) {
716*49ef7e06SGarrett D'Amore 			if (valuesp != NULL) {
717*49ef7e06SGarrett D'Amore 				word = MCDI_OUT_WORD(req,
718*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_STATUS_A);
719*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_STATUS_A] =
720*49ef7e06SGarrett D'Amore 				    siena_phy_sft9001_bist_status(word);
721*49ef7e06SGarrett D'Amore 			}
722*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_STATUS_A);
723*49ef7e06SGarrett D'Amore 		}
724*49ef7e06SGarrett D'Amore 
725*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_STATUS_B) {
726*49ef7e06SGarrett D'Amore 			if (valuesp != NULL) {
727*49ef7e06SGarrett D'Amore 				word = MCDI_OUT_WORD(req,
728*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_STATUS_B);
729*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_STATUS_B] =
730*49ef7e06SGarrett D'Amore 				    siena_phy_sft9001_bist_status(word);
731*49ef7e06SGarrett D'Amore 			}
732*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_STATUS_B);
733*49ef7e06SGarrett D'Amore 		}
734*49ef7e06SGarrett D'Amore 
735*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_STATUS_C) {
736*49ef7e06SGarrett D'Amore 			if (valuesp != NULL) {
737*49ef7e06SGarrett D'Amore 				word = MCDI_OUT_WORD(req,
738*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_STATUS_C);
739*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_STATUS_C] =
740*49ef7e06SGarrett D'Amore 				    siena_phy_sft9001_bist_status(word);
741*49ef7e06SGarrett D'Amore 			}
742*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_STATUS_C);
743*49ef7e06SGarrett D'Amore 		}
744*49ef7e06SGarrett D'Amore 
745*49ef7e06SGarrett D'Amore 		if (count > EFX_BIST_PHY_CABLE_STATUS_D) {
746*49ef7e06SGarrett D'Amore 			if (valuesp != NULL) {
747*49ef7e06SGarrett D'Amore 				word = MCDI_OUT_WORD(req,
748*49ef7e06SGarrett D'Amore 				    POLL_BIST_OUT_SFT9001_CABLE_STATUS_D);
749*49ef7e06SGarrett D'Amore 				valuesp[EFX_BIST_PHY_CABLE_STATUS_D] =
750*49ef7e06SGarrett D'Amore 				    siena_phy_sft9001_bist_status(word);
751*49ef7e06SGarrett D'Amore 			}
752*49ef7e06SGarrett D'Amore 			value_mask |= (1 << EFX_BIST_PHY_CABLE_STATUS_D);
753*49ef7e06SGarrett D'Amore 		}
754*49ef7e06SGarrett D'Amore 
755*49ef7e06SGarrett D'Amore 	} else if (result == MC_CMD_POLL_BIST_FAILED &&
756*49ef7e06SGarrett D'Amore 		    encp->enc_phy_type == EFX_PHY_QLX111V &&
757*49ef7e06SGarrett D'Amore 		    req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN &&
758*49ef7e06SGarrett D'Amore 		    count > EFX_BIST_FAULT_CODE) {
759*49ef7e06SGarrett D'Amore 		if (valuesp != NULL)
760*49ef7e06SGarrett D'Amore 			valuesp[EFX_BIST_FAULT_CODE] =
761*49ef7e06SGarrett D'Amore 			    MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST);
762*49ef7e06SGarrett D'Amore 		value_mask |= 1 << EFX_BIST_FAULT_CODE;
763*49ef7e06SGarrett D'Amore 	}
764*49ef7e06SGarrett D'Amore 
765*49ef7e06SGarrett D'Amore 	if (value_maskp != NULL)
766*49ef7e06SGarrett D'Amore 		*value_maskp = value_mask;
767*49ef7e06SGarrett D'Amore 
768*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(resultp != NULL);
769*49ef7e06SGarrett D'Amore 	if (result == MC_CMD_POLL_BIST_RUNNING)
770*49ef7e06SGarrett D'Amore 		*resultp = EFX_BIST_RESULT_RUNNING;
771*49ef7e06SGarrett D'Amore 	else if (result == MC_CMD_POLL_BIST_PASSED)
772*49ef7e06SGarrett D'Amore 		*resultp = EFX_BIST_RESULT_PASSED;
773*49ef7e06SGarrett D'Amore 	else
774*49ef7e06SGarrett D'Amore 		*resultp = EFX_BIST_RESULT_FAILED;
775*49ef7e06SGarrett D'Amore 
776*49ef7e06SGarrett D'Amore 	return (0);
777*49ef7e06SGarrett D'Amore 
778*49ef7e06SGarrett D'Amore fail2:
779*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail2);
780*49ef7e06SGarrett D'Amore fail1:
781*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
782*49ef7e06SGarrett D'Amore 
783*49ef7e06SGarrett D'Amore 	return (rc);
784*49ef7e06SGarrett D'Amore }
785*49ef7e06SGarrett D'Amore 
786*49ef7e06SGarrett D'Amore 			void
siena_phy_bist_stop(__in efx_nic_t * enp,__in efx_bist_type_t type)787*49ef7e06SGarrett D'Amore siena_phy_bist_stop(
788*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
789*49ef7e06SGarrett D'Amore 	__in		efx_bist_type_t type)
790*49ef7e06SGarrett D'Amore {
791*49ef7e06SGarrett D'Amore 	/* There is no way to stop BIST on Siena */
792*49ef7e06SGarrett D'Amore 	_NOTE(ARGUNUSED(enp, type))
793*49ef7e06SGarrett D'Amore }
794*49ef7e06SGarrett D'Amore 
795*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_BIST */
796*49ef7e06SGarrett D'Amore 
797*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_SIENA */
798