cc0025060388c61ca5b9eab23cf6e4e1e2df3693
[dpdk.git] / drivers / net / sfc / base / ef10_phy.c
1 /*
2  * Copyright (c) 2012-2016 Solarflare Communications Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * The views and conclusions contained in the software and documentation are
27  * those of the authors and should not be interpreted as representing official
28  * policies, either expressed or implied, of the FreeBSD Project.
29  */
30
31 #include "efx.h"
32 #include "efx_impl.h"
33
34 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
35
36 static                  void
37 mcdi_phy_decode_cap(
38         __in            uint32_t mcdi_cap,
39         __out           uint32_t *maskp)
40 {
41         uint32_t mask;
42
43         mask = 0;
44         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
45                 mask |= (1 << EFX_PHY_CAP_10HDX);
46         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
47                 mask |= (1 << EFX_PHY_CAP_10FDX);
48         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
49                 mask |= (1 << EFX_PHY_CAP_100HDX);
50         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
51                 mask |= (1 << EFX_PHY_CAP_100FDX);
52         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
53                 mask |= (1 << EFX_PHY_CAP_1000HDX);
54         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
55                 mask |= (1 << EFX_PHY_CAP_1000FDX);
56         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
57                 mask |= (1 << EFX_PHY_CAP_10000FDX);
58         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
59                 mask |= (1 << EFX_PHY_CAP_40000FDX);
60         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
61                 mask |= (1 << EFX_PHY_CAP_PAUSE);
62         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
63                 mask |= (1 << EFX_PHY_CAP_ASYM);
64         if (mcdi_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
65                 mask |= (1 << EFX_PHY_CAP_AN);
66
67         *maskp = mask;
68 }
69
70 static                  void
71 mcdi_phy_decode_link_mode(
72         __in            efx_nic_t *enp,
73         __in            uint32_t link_flags,
74         __in            unsigned int speed,
75         __in            unsigned int fcntl,
76         __out           efx_link_mode_t *link_modep,
77         __out           unsigned int *fcntlp)
78 {
79         boolean_t fd = !!(link_flags &
80                     (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
81         boolean_t up = !!(link_flags &
82                     (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
83
84         _NOTE(ARGUNUSED(enp))
85
86         if (!up)
87                 *link_modep = EFX_LINK_DOWN;
88         else if (speed == 40000 && fd)
89                 *link_modep = EFX_LINK_40000FDX;
90         else if (speed == 10000 && fd)
91                 *link_modep = EFX_LINK_10000FDX;
92         else if (speed == 1000)
93                 *link_modep = fd ? EFX_LINK_1000FDX : EFX_LINK_1000HDX;
94         else if (speed == 100)
95                 *link_modep = fd ? EFX_LINK_100FDX : EFX_LINK_100HDX;
96         else if (speed == 10)
97                 *link_modep = fd ? EFX_LINK_10FDX : EFX_LINK_10HDX;
98         else
99                 *link_modep = EFX_LINK_UNKNOWN;
100
101         if (fcntl == MC_CMD_FCNTL_OFF)
102                 *fcntlp = 0;
103         else if (fcntl == MC_CMD_FCNTL_RESPOND)
104                 *fcntlp = EFX_FCNTL_RESPOND;
105         else if (fcntl == MC_CMD_FCNTL_GENERATE)
106                 *fcntlp = EFX_FCNTL_GENERATE;
107         else if (fcntl == MC_CMD_FCNTL_BIDIR)
108                 *fcntlp = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
109         else {
110                 EFSYS_PROBE1(mc_pcol_error, int, fcntl);
111                 *fcntlp = 0;
112         }
113 }
114
115
116                         void
117 ef10_phy_link_ev(
118         __in            efx_nic_t *enp,
119         __in            efx_qword_t *eqp,
120         __out           efx_link_mode_t *link_modep)
121 {
122         efx_port_t *epp = &(enp->en_port);
123         unsigned int link_flags;
124         unsigned int speed;
125         unsigned int fcntl;
126         efx_link_mode_t link_mode;
127         uint32_t lp_cap_mask;
128
129         /*
130          * Convert the LINKCHANGE speed enumeration into mbit/s, in the
131          * same way as GET_LINK encodes the speed
132          */
133         switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
134         case MCDI_EVENT_LINKCHANGE_SPEED_100M:
135                 speed = 100;
136                 break;
137         case MCDI_EVENT_LINKCHANGE_SPEED_1G:
138                 speed = 1000;
139                 break;
140         case MCDI_EVENT_LINKCHANGE_SPEED_10G:
141                 speed = 10000;
142                 break;
143         case MCDI_EVENT_LINKCHANGE_SPEED_40G:
144                 speed = 40000;
145                 break;
146         default:
147                 speed = 0;
148                 break;
149         }
150
151         link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
152         mcdi_phy_decode_link_mode(enp, link_flags, speed,
153                                     MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
154                                     &link_mode, &fcntl);
155         mcdi_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
156                             &lp_cap_mask);
157
158         /*
159          * It's safe to update ep_lp_cap_mask without the driver's port lock
160          * because presumably any concurrently running efx_port_poll() is
161          * only going to arrive at the same value.
162          *
163          * ep_fcntl has two meanings. It's either the link common fcntl
164          * (if the PHY supports AN), or it's the forced link state. If
165          * the former, it's safe to update the value for the same reason as
166          * for ep_lp_cap_mask. If the latter, then just ignore the value,
167          * because we can race with efx_mac_fcntl_set().
168          */
169         epp->ep_lp_cap_mask = lp_cap_mask;
170         epp->ep_fcntl = fcntl;
171
172         *link_modep = link_mode;
173 }
174
175         __checkReturn   efx_rc_t
176 ef10_phy_power(
177         __in            efx_nic_t *enp,
178         __in            boolean_t power)
179 {
180         efx_rc_t rc;
181
182         if (!power)
183                 return (0);
184
185         /* Check if the PHY is a zombie */
186         if ((rc = ef10_phy_verify(enp)) != 0)
187                 goto fail1;
188
189         enp->en_reset_flags |= EFX_RESET_PHY;
190
191         return (0);
192
193 fail1:
194         EFSYS_PROBE1(fail1, efx_rc_t, rc);
195
196         return (rc);
197 }
198
199         __checkReturn   efx_rc_t
200 ef10_phy_get_link(
201         __in            efx_nic_t *enp,
202         __out           ef10_link_state_t *elsp)
203 {
204         efx_mcdi_req_t req;
205         uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
206                             MC_CMD_GET_LINK_OUT_LEN)];
207         efx_rc_t rc;
208
209         (void) memset(payload, 0, sizeof (payload));
210         req.emr_cmd = MC_CMD_GET_LINK;
211         req.emr_in_buf = payload;
212         req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
213         req.emr_out_buf = payload;
214         req.emr_out_length = MC_CMD_GET_LINK_OUT_LEN;
215
216         efx_mcdi_execute(enp, &req);
217
218         if (req.emr_rc != 0) {
219                 rc = req.emr_rc;
220                 goto fail1;
221         }
222
223         if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_LEN) {
224                 rc = EMSGSIZE;
225                 goto fail2;
226         }
227
228         mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP),
229                             &elsp->els_adv_cap_mask);
230         mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP),
231                             &elsp->els_lp_cap_mask);
232
233         mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS),
234                             MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED),
235                             MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL),
236                             &elsp->els_link_mode, &elsp->els_fcntl);
237
238         elsp->els_mac_up = MCDI_OUT_DWORD(req, GET_LINK_OUT_MAC_FAULT) == 0;
239
240         return (0);
241
242 fail2:
243         EFSYS_PROBE(fail2);
244 fail1:
245         EFSYS_PROBE1(fail1, efx_rc_t, rc);
246
247         return (rc);
248 }
249
250         __checkReturn   efx_rc_t
251 ef10_phy_reconfigure(
252         __in            efx_nic_t *enp)
253 {
254         efx_port_t *epp = &(enp->en_port);
255         efx_mcdi_req_t req;
256         uint8_t payload[MAX(MC_CMD_SET_LINK_IN_LEN,
257                             MC_CMD_SET_LINK_OUT_LEN)];
258         uint32_t cap_mask;
259         unsigned int led_mode;
260         unsigned int speed;
261         boolean_t supported;
262         efx_rc_t rc;
263
264         if ((rc = efx_mcdi_link_control_supported(enp, &supported)) != 0)
265                 goto fail1;
266         if (supported == B_FALSE)
267                 goto out;
268
269         (void) memset(payload, 0, sizeof (payload));
270         req.emr_cmd = MC_CMD_SET_LINK;
271         req.emr_in_buf = payload;
272         req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
273         req.emr_out_buf = payload;
274         req.emr_out_length = MC_CMD_SET_LINK_OUT_LEN;
275
276         cap_mask = epp->ep_adv_cap_mask;
277         MCDI_IN_POPULATE_DWORD_10(req, SET_LINK_IN_CAP,
278                 PHY_CAP_10HDX, (cap_mask >> EFX_PHY_CAP_10HDX) & 0x1,
279                 PHY_CAP_10FDX, (cap_mask >> EFX_PHY_CAP_10FDX) & 0x1,
280                 PHY_CAP_100HDX, (cap_mask >> EFX_PHY_CAP_100HDX) & 0x1,
281                 PHY_CAP_100FDX, (cap_mask >> EFX_PHY_CAP_100FDX) & 0x1,
282                 PHY_CAP_1000HDX, (cap_mask >> EFX_PHY_CAP_1000HDX) & 0x1,
283                 PHY_CAP_1000FDX, (cap_mask >> EFX_PHY_CAP_1000FDX) & 0x1,
284                 PHY_CAP_10000FDX, (cap_mask >> EFX_PHY_CAP_10000FDX) & 0x1,
285                 PHY_CAP_PAUSE, (cap_mask >> EFX_PHY_CAP_PAUSE) & 0x1,
286                 PHY_CAP_ASYM, (cap_mask >> EFX_PHY_CAP_ASYM) & 0x1,
287                 PHY_CAP_AN, (cap_mask >> EFX_PHY_CAP_AN) & 0x1);
288         /* Too many fields for for POPULATE macros, so insert this afterwards */
289         MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
290             PHY_CAP_40000FDX, (cap_mask >> EFX_PHY_CAP_40000FDX) & 0x1);
291
292         MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE, MC_CMD_LOOPBACK_NONE);
293         speed = 0;
294         MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_SPEED, speed);
295
296 #if EFSYS_OPT_PHY_FLAGS
297         MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, epp->ep_phy_flags);
298 #else
299         MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, 0);
300 #endif  /* EFSYS_OPT_PHY_FLAGS */
301
302         efx_mcdi_execute(enp, &req);
303
304         if (req.emr_rc != 0) {
305                 rc = req.emr_rc;
306                 goto fail2;
307         }
308
309         /* And set the blink mode */
310         (void) memset(payload, 0, sizeof (payload));
311         req.emr_cmd = MC_CMD_SET_ID_LED;
312         req.emr_in_buf = payload;
313         req.emr_in_length = MC_CMD_SET_ID_LED_IN_LEN;
314         req.emr_out_buf = payload;
315         req.emr_out_length = MC_CMD_SET_ID_LED_OUT_LEN;
316
317 #if EFSYS_OPT_PHY_LED_CONTROL
318         switch (epp->ep_phy_led_mode) {
319         case EFX_PHY_LED_DEFAULT:
320                 led_mode = MC_CMD_LED_DEFAULT;
321                 break;
322         case EFX_PHY_LED_OFF:
323                 led_mode = MC_CMD_LED_OFF;
324                 break;
325         case EFX_PHY_LED_ON:
326                 led_mode = MC_CMD_LED_ON;
327                 break;
328         default:
329                 EFSYS_ASSERT(0);
330                 led_mode = MC_CMD_LED_DEFAULT;
331         }
332
333         MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, led_mode);
334 #else
335         MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, MC_CMD_LED_DEFAULT);
336 #endif  /* EFSYS_OPT_PHY_LED_CONTROL */
337
338         efx_mcdi_execute(enp, &req);
339
340         if (req.emr_rc != 0) {
341                 rc = req.emr_rc;
342                 goto fail3;
343         }
344 out:
345         return (0);
346
347 fail3:
348         EFSYS_PROBE(fail3);
349 fail2:
350         EFSYS_PROBE(fail2);
351 fail1:
352         EFSYS_PROBE1(fail1, efx_rc_t, rc);
353
354         return (rc);
355 }
356
357         __checkReturn   efx_rc_t
358 ef10_phy_verify(
359         __in            efx_nic_t *enp)
360 {
361         efx_mcdi_req_t req;
362         uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
363                             MC_CMD_GET_PHY_STATE_OUT_LEN)];
364         uint32_t state;
365         efx_rc_t rc;
366
367         (void) memset(payload, 0, sizeof (payload));
368         req.emr_cmd = MC_CMD_GET_PHY_STATE;
369         req.emr_in_buf = payload;
370         req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
371         req.emr_out_buf = payload;
372         req.emr_out_length = MC_CMD_GET_PHY_STATE_OUT_LEN;
373
374         efx_mcdi_execute(enp, &req);
375
376         if (req.emr_rc != 0) {
377                 rc = req.emr_rc;
378                 goto fail1;
379         }
380
381         if (req.emr_out_length_used < MC_CMD_GET_PHY_STATE_OUT_LEN) {
382                 rc = EMSGSIZE;
383                 goto fail2;
384         }
385
386         state = MCDI_OUT_DWORD(req, GET_PHY_STATE_OUT_STATE);
387         if (state != MC_CMD_PHY_STATE_OK) {
388                 if (state != MC_CMD_PHY_STATE_ZOMBIE)
389                         EFSYS_PROBE1(mc_pcol_error, int, state);
390                 rc = ENOTACTIVE;
391                 goto fail3;
392         }
393
394         return (0);
395
396 fail3:
397         EFSYS_PROBE(fail3);
398 fail2:
399         EFSYS_PROBE(fail2);
400 fail1:
401         EFSYS_PROBE1(fail1, efx_rc_t, rc);
402
403         return (rc);
404 }
405
406         __checkReturn   efx_rc_t
407 ef10_phy_oui_get(
408         __in            efx_nic_t *enp,
409         __out           uint32_t *ouip)
410 {
411         _NOTE(ARGUNUSED(enp, ouip))
412
413         return (ENOTSUP);
414 }
415
416 #if EFSYS_OPT_PHY_STATS
417
418         __checkReturn                           efx_rc_t
419 ef10_phy_stats_update(
420         __in                                    efx_nic_t *enp,
421         __in                                    efsys_mem_t *esmp,
422         __inout_ecount(EFX_PHY_NSTATS)          uint32_t *stat)
423 {
424         /* TBD: no stats support in firmware yet */
425         _NOTE(ARGUNUSED(enp, esmp))
426         memset(stat, 0, EFX_PHY_NSTATS * sizeof (*stat));
427
428         return (0);
429 }
430
431 #endif  /* EFSYS_OPT_PHY_STATS */
432
433 #if EFSYS_OPT_BIST
434
435         __checkReturn           efx_rc_t
436 ef10_bist_enable_offline(
437         __in                    efx_nic_t *enp)
438 {
439         efx_rc_t rc;
440
441         if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0)
442                 goto fail1;
443
444         return (0);
445
446 fail1:
447         EFSYS_PROBE1(fail1, efx_rc_t, rc);
448
449         return (rc);
450 }
451
452         __checkReturn           efx_rc_t
453 ef10_bist_start(
454         __in                    efx_nic_t *enp,
455         __in                    efx_bist_type_t type)
456 {
457         efx_rc_t rc;
458
459         if ((rc = efx_mcdi_bist_start(enp, type)) != 0)
460                 goto fail1;
461
462         return (0);
463
464 fail1:
465         EFSYS_PROBE1(fail1, efx_rc_t, rc);
466
467         return (rc);
468 }
469
470         __checkReturn           efx_rc_t
471 ef10_bist_poll(
472         __in                    efx_nic_t *enp,
473         __in                    efx_bist_type_t type,
474         __out                   efx_bist_result_t *resultp,
475         __out_opt __drv_when(count > 0, __notnull)
476         uint32_t *value_maskp,
477         __out_ecount_opt(count) __drv_when(count > 0, __notnull)
478         unsigned long *valuesp,
479         __in                    size_t count)
480 {
481         efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
482         efx_mcdi_req_t req;
483         uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
484                             MCDI_CTL_SDU_LEN_MAX)];
485         uint32_t value_mask = 0;
486         uint32_t result;
487         efx_rc_t rc;
488
489         _NOTE(ARGUNUSED(type))
490
491         (void) memset(payload, 0, sizeof (payload));
492         req.emr_cmd = MC_CMD_POLL_BIST;
493         req.emr_in_buf = payload;
494         req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
495         req.emr_out_buf = payload;
496         req.emr_out_length = MCDI_CTL_SDU_LEN_MAX;
497
498         efx_mcdi_execute(enp, &req);
499
500         if (req.emr_rc != 0) {
501                 rc = req.emr_rc;
502                 goto fail1;
503         }
504
505         if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) {
506                 rc = EMSGSIZE;
507                 goto fail2;
508         }
509
510         if (count > 0)
511                 (void) memset(valuesp, '\0', count * sizeof (unsigned long));
512
513         result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT);
514
515         if (result == MC_CMD_POLL_BIST_FAILED &&
516             req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN &&
517             count > EFX_BIST_MEM_ECC_FATAL) {
518                 if (valuesp != NULL) {
519                         valuesp[EFX_BIST_MEM_TEST] =
520                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST);
521                         valuesp[EFX_BIST_MEM_ADDR] =
522                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR);
523                         valuesp[EFX_BIST_MEM_BUS] =
524                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_BUS);
525                         valuesp[EFX_BIST_MEM_EXPECT] =
526                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT);
527                         valuesp[EFX_BIST_MEM_ACTUAL] =
528                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL);
529                         valuesp[EFX_BIST_MEM_ECC] =
530                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC);
531                         valuesp[EFX_BIST_MEM_ECC_PARITY] =
532                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY);
533                         valuesp[EFX_BIST_MEM_ECC_FATAL] =
534                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL);
535                 }
536                 value_mask |= (1 << EFX_BIST_MEM_TEST) |
537                     (1 << EFX_BIST_MEM_ADDR) |
538                     (1 << EFX_BIST_MEM_BUS) |
539                     (1 << EFX_BIST_MEM_EXPECT) |
540                     (1 << EFX_BIST_MEM_ACTUAL) |
541                     (1 << EFX_BIST_MEM_ECC) |
542                     (1 << EFX_BIST_MEM_ECC_PARITY) |
543                     (1 << EFX_BIST_MEM_ECC_FATAL);
544         } else if (result == MC_CMD_POLL_BIST_FAILED &&
545             encp->enc_phy_type == EFX_PHY_XFI_FARMI &&
546             req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN &&
547             count > EFX_BIST_FAULT_CODE) {
548                 if (valuesp != NULL)
549                         valuesp[EFX_BIST_FAULT_CODE] =
550                             MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST);
551                 value_mask |= 1 << EFX_BIST_FAULT_CODE;
552         }
553
554         if (value_maskp != NULL)
555                 *value_maskp = value_mask;
556
557         EFSYS_ASSERT(resultp != NULL);
558         if (result == MC_CMD_POLL_BIST_RUNNING)
559                 *resultp = EFX_BIST_RESULT_RUNNING;
560         else if (result == MC_CMD_POLL_BIST_PASSED)
561                 *resultp = EFX_BIST_RESULT_PASSED;
562         else
563                 *resultp = EFX_BIST_RESULT_FAILED;
564
565         return (0);
566
567 fail2:
568         EFSYS_PROBE(fail2);
569 fail1:
570         EFSYS_PROBE1(fail1, efx_rc_t, rc);
571
572         return (rc);
573 }
574
575                         void
576 ef10_bist_stop(
577         __in            efx_nic_t *enp,
578         __in            efx_bist_type_t type)
579 {
580         /* There is no way to stop BIST on EF10. */
581         _NOTE(ARGUNUSED(enp, type))
582 }
583
584 #endif  /* EFSYS_OPT_BIST */
585
586 #endif  /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */