49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Copyright (c) 2012-2015 Solarflare Communications Inc.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * All rights reserved.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Redistribution and use in source and binary forms, with or without
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * modification, are permitted provided that the following conditions are met:
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * 1. Redistributions of source code must retain the above copyright notice,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * this list of conditions and the following disclaimer.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright notice,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * this list of conditions and the following disclaimer in the documentation
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * and/or other materials provided with the distribution.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * The views and conclusions contained in the software and documentation are
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * those of the authors and should not be interpreted as representing official
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * policies, either expressed or implied, of the FreeBSD Project.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = efx_mcdi_bist_start(enp, type)) != 0)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore __out_ecount_opt(count) __drv_when(count > 0, __notnull)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore unsigned long *valuesp,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore (void) memset(payload, 0, sizeof (payload));
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) {
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore (void) memset(valuesp, '\0', count * sizeof (unsigned long));
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN &&
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore } else if (result == MC_CMD_POLL_BIST_FAILED &&
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN &&
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore /* There is no way to stop BIST on Huntinton. */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_BIST */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_HUNTINGTON */