1*49ef7e06SGarrett D'Amore /*
2*49ef7e06SGarrett D'Amore  * Copyright (c) 2012-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 
35*49ef7e06SGarrett D'Amore #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
36*49ef7e06SGarrett D'Amore 
37*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI
38*49ef7e06SGarrett D'Amore 
39*49ef7e06SGarrett D'Amore #ifndef WITH_MCDI_V2
40*49ef7e06SGarrett D'Amore #error "WITH_MCDI_V2 required for EF10 MCDIv2 commands."
41*49ef7e06SGarrett D'Amore #endif
42*49ef7e06SGarrett D'Amore 
43*49ef7e06SGarrett D'Amore 
44*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
ef10_mcdi_init(__in efx_nic_t * enp,__in const efx_mcdi_transport_t * emtp)45*49ef7e06SGarrett D'Amore ef10_mcdi_init(
46*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
47*49ef7e06SGarrett D'Amore 	__in		const efx_mcdi_transport_t *emtp)
48*49ef7e06SGarrett D'Amore {
49*49ef7e06SGarrett D'Amore 	efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
50*49ef7e06SGarrett D'Amore 	efsys_mem_t *esmp = emtp->emt_dma_mem;
51*49ef7e06SGarrett D'Amore 	efx_dword_t dword;
52*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
53*49ef7e06SGarrett D'Amore 
54*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
55*49ef7e06SGarrett D'Amore 		    enp->en_family == EFX_FAMILY_MEDFORD);
56*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(enp->en_features & EFX_FEATURE_MCDI_DMA);
57*49ef7e06SGarrett D'Amore 
58*49ef7e06SGarrett D'Amore 	/*
59*49ef7e06SGarrett D'Amore 	 * All EF10 firmware supports MCDIv2 and MCDIv1.
60*49ef7e06SGarrett D'Amore 	 * Medford BootROM supports MCDIv2 and MCDIv1.
61*49ef7e06SGarrett D'Amore 	 * Huntington BootROM supports MCDIv1 only.
62*49ef7e06SGarrett D'Amore 	 */
63*49ef7e06SGarrett D'Amore 	emip->emi_max_version = 2;
64*49ef7e06SGarrett D'Amore 
65*49ef7e06SGarrett D'Amore 	/* A host DMA buffer is required for EF10 MCDI */
66*49ef7e06SGarrett D'Amore 	if (esmp == NULL) {
67*49ef7e06SGarrett D'Amore 		rc = EINVAL;
68*49ef7e06SGarrett D'Amore 		goto fail1;
69*49ef7e06SGarrett D'Amore 	}
70*49ef7e06SGarrett D'Amore 
71*49ef7e06SGarrett D'Amore 	/*
72*49ef7e06SGarrett D'Amore 	 * Ensure that the MC doorbell is in a known state before issuing MCDI
73*49ef7e06SGarrett D'Amore 	 * commands. The recovery algorithm requires that the MC command buffer
74*49ef7e06SGarrett D'Amore 	 * must be 256 byte aligned. See bug24769.
75*49ef7e06SGarrett D'Amore 	 */
76*49ef7e06SGarrett D'Amore 	if ((EFSYS_MEM_ADDR(esmp) & 0xFF) != 0) {
77*49ef7e06SGarrett D'Amore 		rc = EINVAL;
78*49ef7e06SGarrett D'Amore 		goto fail2;
79*49ef7e06SGarrett D'Amore 	}
80*49ef7e06SGarrett D'Amore 	EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 1);
81*49ef7e06SGarrett D'Amore 	EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE);
82*49ef7e06SGarrett D'Amore 
83*49ef7e06SGarrett D'Amore 	/* Save initial MC reboot status */
84*49ef7e06SGarrett D'Amore 	(void) ef10_mcdi_poll_reboot(enp);
85*49ef7e06SGarrett D'Amore 
86*49ef7e06SGarrett D'Amore 	/* Start a new epoch (allow fresh MCDI requests to succeed) */
87*49ef7e06SGarrett D'Amore 	efx_mcdi_new_epoch(enp);
88*49ef7e06SGarrett D'Amore 
89*49ef7e06SGarrett D'Amore 	return (0);
90*49ef7e06SGarrett D'Amore 
91*49ef7e06SGarrett D'Amore fail2:
92*49ef7e06SGarrett D'Amore 	EFSYS_PROBE(fail2);
93*49ef7e06SGarrett D'Amore fail1:
94*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
95*49ef7e06SGarrett D'Amore 
96*49ef7e06SGarrett D'Amore 	return (rc);
97*49ef7e06SGarrett D'Amore }
98*49ef7e06SGarrett D'Amore 
99*49ef7e06SGarrett D'Amore 			void
ef10_mcdi_fini(__in efx_nic_t * enp)100*49ef7e06SGarrett D'Amore ef10_mcdi_fini(
101*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp)
102*49ef7e06SGarrett D'Amore {
103*49ef7e06SGarrett D'Amore 	efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
104*49ef7e06SGarrett D'Amore 
105*49ef7e06SGarrett D'Amore 	emip->emi_new_epoch = B_FALSE;
106*49ef7e06SGarrett D'Amore }
107*49ef7e06SGarrett D'Amore 
108*49ef7e06SGarrett D'Amore 			void
ef10_mcdi_send_request(__in efx_nic_t * enp,__in void * hdrp,__in size_t hdr_len,__in void * sdup,__in size_t sdu_len)109*49ef7e06SGarrett D'Amore ef10_mcdi_send_request(
110*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
111*49ef7e06SGarrett D'Amore 	__in		void *hdrp,
112*49ef7e06SGarrett D'Amore 	__in		size_t hdr_len,
113*49ef7e06SGarrett D'Amore 	__in		void *sdup,
114*49ef7e06SGarrett D'Amore 	__in		size_t sdu_len)
115*49ef7e06SGarrett D'Amore {
116*49ef7e06SGarrett D'Amore 	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
117*49ef7e06SGarrett D'Amore 	efsys_mem_t *esmp = emtp->emt_dma_mem;
118*49ef7e06SGarrett D'Amore 	efx_dword_t dword;
119*49ef7e06SGarrett D'Amore 	unsigned int pos;
120*49ef7e06SGarrett D'Amore 
121*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
122*49ef7e06SGarrett D'Amore 		    enp->en_family == EFX_FAMILY_MEDFORD);
123*49ef7e06SGarrett D'Amore 
124*49ef7e06SGarrett D'Amore 	/* Write the header */
125*49ef7e06SGarrett D'Amore 	for (pos = 0; pos < hdr_len; pos += sizeof (efx_dword_t)) {
126*49ef7e06SGarrett D'Amore 		dword = *(efx_dword_t *)((uint8_t *)hdrp + pos);
127*49ef7e06SGarrett D'Amore 		EFSYS_MEM_WRITED(esmp, pos, &dword);
128*49ef7e06SGarrett D'Amore 	}
129*49ef7e06SGarrett D'Amore 
130*49ef7e06SGarrett D'Amore 	/* Write the payload */
131*49ef7e06SGarrett D'Amore 	for (pos = 0; pos < sdu_len; pos += sizeof (efx_dword_t)) {
132*49ef7e06SGarrett D'Amore 		dword = *(efx_dword_t *)((uint8_t *)sdup + pos);
133*49ef7e06SGarrett D'Amore 		EFSYS_MEM_WRITED(esmp, hdr_len + pos, &dword);
134*49ef7e06SGarrett D'Amore 	}
135*49ef7e06SGarrett D'Amore 
136*49ef7e06SGarrett D'Amore 	/* Guarantee ordering of memory (MCDI request) and PIO (MC doorbell) */
137*49ef7e06SGarrett D'Amore 	EFSYS_DMA_SYNC_FOR_DEVICE(esmp, 0, hdr_len + sdu_len);
138*49ef7e06SGarrett D'Amore 	EFSYS_PIO_WRITE_BARRIER();
139*49ef7e06SGarrett D'Amore 
140*49ef7e06SGarrett D'Amore 	/* Ring the doorbell to post the command DMA address to the MC */
141*49ef7e06SGarrett D'Amore 	EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0,
142*49ef7e06SGarrett D'Amore 	    EFSYS_MEM_ADDR(esmp) >> 32);
143*49ef7e06SGarrett D'Amore 	EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE);
144*49ef7e06SGarrett D'Amore 
145*49ef7e06SGarrett D'Amore 	EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0,
146*49ef7e06SGarrett D'Amore 	    EFSYS_MEM_ADDR(esmp) & 0xffffffff);
147*49ef7e06SGarrett D'Amore 	EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE);
148*49ef7e06SGarrett D'Amore }
149*49ef7e06SGarrett D'Amore 
150*49ef7e06SGarrett D'Amore 	__checkReturn	boolean_t
ef10_mcdi_poll_response(__in efx_nic_t * enp)151*49ef7e06SGarrett D'Amore ef10_mcdi_poll_response(
152*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp)
153*49ef7e06SGarrett D'Amore {
154*49ef7e06SGarrett D'Amore 	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
155*49ef7e06SGarrett D'Amore 	efsys_mem_t *esmp = emtp->emt_dma_mem;
156*49ef7e06SGarrett D'Amore 	efx_dword_t hdr;
157*49ef7e06SGarrett D'Amore 
158*49ef7e06SGarrett D'Amore 	EFSYS_MEM_READD(esmp, 0, &hdr);
159*49ef7e06SGarrett D'Amore 	return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE);
160*49ef7e06SGarrett D'Amore }
161*49ef7e06SGarrett D'Amore 
162*49ef7e06SGarrett D'Amore 			void
ef10_mcdi_read_response(__in efx_nic_t * enp,__out_bcount (length)void * bufferp,__in size_t offset,__in size_t length)163*49ef7e06SGarrett D'Amore ef10_mcdi_read_response(
164*49ef7e06SGarrett D'Amore 	__in			efx_nic_t *enp,
165*49ef7e06SGarrett D'Amore 	__out_bcount(length)	void *bufferp,
166*49ef7e06SGarrett D'Amore 	__in			size_t offset,
167*49ef7e06SGarrett D'Amore 	__in			size_t length)
168*49ef7e06SGarrett D'Amore {
169*49ef7e06SGarrett D'Amore 	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
170*49ef7e06SGarrett D'Amore 	efsys_mem_t *esmp = emtp->emt_dma_mem;
171*49ef7e06SGarrett D'Amore 	unsigned int pos;
172*49ef7e06SGarrett D'Amore 	efx_dword_t data;
173*49ef7e06SGarrett D'Amore 
174*49ef7e06SGarrett D'Amore 	for (pos = 0; pos < length; pos += sizeof (efx_dword_t)) {
175*49ef7e06SGarrett D'Amore 		EFSYS_MEM_READD(esmp, offset + pos, &data);
176*49ef7e06SGarrett D'Amore 		(void) memcpy((uint8_t *)bufferp + pos, &data,
177*49ef7e06SGarrett D'Amore 		    MIN(sizeof (data), length - pos));
178*49ef7e06SGarrett D'Amore 	}
179*49ef7e06SGarrett D'Amore }
180*49ef7e06SGarrett D'Amore 
181*49ef7e06SGarrett D'Amore 			efx_rc_t
ef10_mcdi_poll_reboot(__in efx_nic_t * enp)182*49ef7e06SGarrett D'Amore ef10_mcdi_poll_reboot(
183*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp)
184*49ef7e06SGarrett D'Amore {
185*49ef7e06SGarrett D'Amore 	efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
186*49ef7e06SGarrett D'Amore 	efx_dword_t dword;
187*49ef7e06SGarrett D'Amore 	uint32_t old_status;
188*49ef7e06SGarrett D'Amore 	uint32_t new_status;
189*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
190*49ef7e06SGarrett D'Amore 
191*49ef7e06SGarrett D'Amore 	old_status = emip->emi_mc_reboot_status;
192*49ef7e06SGarrett D'Amore 
193*49ef7e06SGarrett D'Amore 	/* Update MC reboot status word */
194*49ef7e06SGarrett D'Amore 	EFX_BAR_TBL_READD(enp, ER_DZ_BIU_MC_SFT_STATUS_REG, 0, &dword, B_FALSE);
195*49ef7e06SGarrett D'Amore 	new_status = dword.ed_u32[0];
196*49ef7e06SGarrett D'Amore 
197*49ef7e06SGarrett D'Amore 	/* MC has rebooted if the value has changed */
198*49ef7e06SGarrett D'Amore 	if (new_status != old_status) {
199*49ef7e06SGarrett D'Amore 		emip->emi_mc_reboot_status = new_status;
200*49ef7e06SGarrett D'Amore 
201*49ef7e06SGarrett D'Amore 		/*
202*49ef7e06SGarrett D'Amore 		 * FIXME: Ignore detected MC REBOOT for now.
203*49ef7e06SGarrett D'Amore 		 *
204*49ef7e06SGarrett D'Amore 		 * The Siena support for checking for MC reboot from status
205*49ef7e06SGarrett D'Amore 		 * flags is broken - see comments in siena_mcdi_poll_reboot().
206*49ef7e06SGarrett D'Amore 		 * As the generic MCDI code is shared the EF10 reboot
207*49ef7e06SGarrett D'Amore 		 * detection suffers similar problems.
208*49ef7e06SGarrett D'Amore 		 *
209*49ef7e06SGarrett D'Amore 		 * Do not report an error when the boot status changes until
210*49ef7e06SGarrett D'Amore 		 * this can be handled by common code drivers (and reworked to
211*49ef7e06SGarrett D'Amore 		 * support Siena too).
212*49ef7e06SGarrett D'Amore 		 */
213*49ef7e06SGarrett D'Amore 		_NOTE(CONSTANTCONDITION)
214*49ef7e06SGarrett D'Amore 		if (B_FALSE) {
215*49ef7e06SGarrett D'Amore 			rc = EIO;
216*49ef7e06SGarrett D'Amore 			goto fail1;
217*49ef7e06SGarrett D'Amore 		}
218*49ef7e06SGarrett D'Amore 	}
219*49ef7e06SGarrett D'Amore 
220*49ef7e06SGarrett D'Amore 	return (0);
221*49ef7e06SGarrett D'Amore 
222*49ef7e06SGarrett D'Amore fail1:
223*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
224*49ef7e06SGarrett D'Amore 
225*49ef7e06SGarrett D'Amore 	return (rc);
226*49ef7e06SGarrett D'Amore }
227*49ef7e06SGarrett D'Amore 
228*49ef7e06SGarrett D'Amore 	__checkReturn	efx_rc_t
ef10_mcdi_feature_supported(__in efx_nic_t * enp,__in efx_mcdi_feature_id_t id,__out boolean_t * supportedp)229*49ef7e06SGarrett D'Amore ef10_mcdi_feature_supported(
230*49ef7e06SGarrett D'Amore 	__in		efx_nic_t *enp,
231*49ef7e06SGarrett D'Amore 	__in		efx_mcdi_feature_id_t id,
232*49ef7e06SGarrett D'Amore 	__out		boolean_t *supportedp)
233*49ef7e06SGarrett D'Amore {
234*49ef7e06SGarrett D'Amore 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
235*49ef7e06SGarrett D'Amore 	uint32_t privilege_mask = encp->enc_privilege_mask;
236*49ef7e06SGarrett D'Amore 	efx_rc_t rc;
237*49ef7e06SGarrett D'Amore 
238*49ef7e06SGarrett D'Amore 	EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
239*49ef7e06SGarrett D'Amore 		    enp->en_family == EFX_FAMILY_MEDFORD);
240*49ef7e06SGarrett D'Amore 
241*49ef7e06SGarrett D'Amore 	/*
242*49ef7e06SGarrett D'Amore 	 * Use privilege mask state at MCDI attach.
243*49ef7e06SGarrett D'Amore 	 */
244*49ef7e06SGarrett D'Amore 
245*49ef7e06SGarrett D'Amore 	switch (id) {
246*49ef7e06SGarrett D'Amore 	case EFX_MCDI_FEATURE_FW_UPDATE:
247*49ef7e06SGarrett D'Amore 		/*
248*49ef7e06SGarrett D'Amore 		 * Admin privilege must be used prior to introduction of
249*49ef7e06SGarrett D'Amore 		 * specific flag.
250*49ef7e06SGarrett D'Amore 		 */
251*49ef7e06SGarrett D'Amore 		*supportedp =
252*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
253*49ef7e06SGarrett D'Amore 		break;
254*49ef7e06SGarrett D'Amore 	case EFX_MCDI_FEATURE_LINK_CONTROL:
255*49ef7e06SGarrett D'Amore 		/*
256*49ef7e06SGarrett D'Amore 		 * Admin privilege used prior to introduction of
257*49ef7e06SGarrett D'Amore 		 * specific flag.
258*49ef7e06SGarrett D'Amore 		 */
259*49ef7e06SGarrett D'Amore 		*supportedp =
260*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, LINK) ||
261*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
262*49ef7e06SGarrett D'Amore 		break;
263*49ef7e06SGarrett D'Amore 	case EFX_MCDI_FEATURE_MACADDR_CHANGE:
264*49ef7e06SGarrett D'Amore 		/*
265*49ef7e06SGarrett D'Amore 		 * Admin privilege must be used prior to introduction of
266*49ef7e06SGarrett D'Amore 		 * mac spoofing privilege (at v4.6), which is used up to
267*49ef7e06SGarrett D'Amore 		 * introduction of change mac spoofing privilege (at v4.7)
268*49ef7e06SGarrett D'Amore 		 */
269*49ef7e06SGarrett D'Amore 		*supportedp =
270*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, CHANGE_MAC) ||
271*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
272*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
273*49ef7e06SGarrett D'Amore 		break;
274*49ef7e06SGarrett D'Amore 	case EFX_MCDI_FEATURE_MAC_SPOOFING:
275*49ef7e06SGarrett D'Amore 		/*
276*49ef7e06SGarrett D'Amore 		 * Admin privilege must be used prior to introduction of
277*49ef7e06SGarrett D'Amore 		 * mac spoofing privilege (at v4.6), which is used up to
278*49ef7e06SGarrett D'Amore 		 * introduction of mac spoofing TX privilege (at v4.7)
279*49ef7e06SGarrett D'Amore 		 */
280*49ef7e06SGarrett D'Amore 		*supportedp =
281*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING_TX) ||
282*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
283*49ef7e06SGarrett D'Amore 		    EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
284*49ef7e06SGarrett D'Amore 		break;
285*49ef7e06SGarrett D'Amore 	default:
286*49ef7e06SGarrett D'Amore 		rc = ENOTSUP;
287*49ef7e06SGarrett D'Amore 		goto fail1;
288*49ef7e06SGarrett D'Amore 	}
289*49ef7e06SGarrett D'Amore 
290*49ef7e06SGarrett D'Amore 	return (0);
291*49ef7e06SGarrett D'Amore 
292*49ef7e06SGarrett D'Amore fail1:
293*49ef7e06SGarrett D'Amore 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
294*49ef7e06SGarrett D'Amore 
295*49ef7e06SGarrett D'Amore 	return (rc);
296*49ef7e06SGarrett D'Amore }
297*49ef7e06SGarrett D'Amore 
298*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_MCDI */
299*49ef7e06SGarrett D'Amore 
300*49ef7e06SGarrett D'Amore #endif	/* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
301