49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Copyright (c) 2007-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'Amorestatic const efx_phy_ops_t __efx_phy_siena_ops = {
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore siena_phy_reconfigure, /* epo_reconfigure */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore siena_phy_stats_update, /* epo_stats_update */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_PHY_STATS */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_BIST */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_SIENA */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amorestatic const efx_phy_ops_t __efx_phy_ef10_ops = {
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore ef10_phy_stats_update, /* epo_stats_update */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_PHY_STATS */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore /* FIXME: Are these BIST methods appropriate for Medford? */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore hunt_bist_enable_offline, /* epo_bist_enable_offline */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_BIST */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore /* Hook in operations structure */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_SIENA */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_HUNTINGTON */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_MEDFORD */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(mode, <, EFX_PHY_LED_NMODES);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_PHY_LED_CONTROL */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore /* Reconfigure for robustness */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * We may have an inconsistent view of our advertised speed
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * capabilities.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if (epp->ep_module_type != EFX_PHY_MEDIA_INVALID)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = efx_mcdi_phy_module_get_info(enp, dev_addr,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/* START MKCONFIG GENERATED PhyStatNamesBlock d5f79b4bc2c050fe */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_link_up",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_tx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_a",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_b",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_c",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_d",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_link_up",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_rx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_tx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_block_errors",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_link_up",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_rx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_tx_fault",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_align",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_sync_a",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_sync_b",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_sync_c",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "phy_xs_sync_d",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "an_link_up",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "an_local_rx_ok",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "an_remote_rx_ok",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "cl22ext_link_up",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_signal_a",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_signal_b",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_signal_c",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_signal_d",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "an_complete",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_major",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_minor",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pma_pmd_rev_micro",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_version_0",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_version_1",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_version_2",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_version_3",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_build_yy",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_build_mm",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_fw_build_dd",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore "pcs_op_mode",
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/* END MKCONFIG GENERATED PhyStatNamesBlock */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_NAMES */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore return (epop->epo_stats_update(enp, esmp, stat));
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_PHY_STATS */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if (epop->epo_bist_enable_offline == NULL) {
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = epop->epo_bist_enable_offline(enp)) != 0)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, !=, EFX_BIST_TYPE_UNKNOWN);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, <, EFX_BIST_TYPE_NTYPES);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(epp->ep_current_bist, ==, EFX_BIST_TYPE_UNKNOWN);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = epop->epo_bist_start(enp, type)) != 0)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore __out_ecount_opt(count) unsigned long *valuesp,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, !=, EFX_BIST_TYPE_UNKNOWN);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, <, EFX_BIST_TYPE_NTYPES);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(epp->ep_current_bist, ==, type);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore if ((rc = epop->epo_bist_poll(enp, type, resultp, value_maskp,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, !=, EFX_BIST_TYPE_UNKNOWN);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(type, <, EFX_BIST_TYPE_NTYPES);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore EFSYS_ASSERT3U(epp->ep_current_bist, ==, type);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore epp->ep_current_bist = EFX_BIST_TYPE_UNKNOWN;
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* EFSYS_OPT_BIST */