1e948693eSPhilip Paeps /*- 2718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3718cf2ccSPedro F. Giffuni * 4929c7febSAndrew Rybchenko * Copyright (c) 2007-2016 Solarflare Communications Inc. 53c838a9fSAndrew Rybchenko * All rights reserved. 6e948693eSPhilip Paeps * 7e948693eSPhilip Paeps * Redistribution and use in source and binary forms, with or without 83c838a9fSAndrew Rybchenko * modification, are permitted provided that the following conditions are met: 9e948693eSPhilip Paeps * 103c838a9fSAndrew Rybchenko * 1. Redistributions of source code must retain the above copyright notice, 113c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer. 123c838a9fSAndrew Rybchenko * 2. Redistributions in binary form must reproduce the above copyright notice, 133c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer in the documentation 143c838a9fSAndrew Rybchenko * and/or other materials provided with the distribution. 153c838a9fSAndrew Rybchenko * 163c838a9fSAndrew Rybchenko * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 173c838a9fSAndrew Rybchenko * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 183c838a9fSAndrew Rybchenko * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 193c838a9fSAndrew Rybchenko * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 203c838a9fSAndrew Rybchenko * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 213c838a9fSAndrew Rybchenko * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 223c838a9fSAndrew Rybchenko * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 233c838a9fSAndrew Rybchenko * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 243c838a9fSAndrew Rybchenko * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 253c838a9fSAndrew Rybchenko * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 263c838a9fSAndrew Rybchenko * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 273c838a9fSAndrew Rybchenko * 283c838a9fSAndrew Rybchenko * The views and conclusions contained in the software and documentation are 293c838a9fSAndrew Rybchenko * those of the authors and should not be interpreted as representing official 303c838a9fSAndrew Rybchenko * policies, either expressed or implied, of the FreeBSD Project. 315dee87d7SPhilip Paeps * 325dee87d7SPhilip Paeps * $FreeBSD$ 33e948693eSPhilip Paeps */ 34e948693eSPhilip Paeps 35e948693eSPhilip Paeps #ifndef _SYS_EFX_IMPL_H 36e948693eSPhilip Paeps #define _SYS_EFX_IMPL_H 37e948693eSPhilip Paeps 38e948693eSPhilip Paeps #include "efx.h" 39e948693eSPhilip Paeps #include "efx_regs.h" 403c838a9fSAndrew Rybchenko #include "efx_regs_ef10.h" 413c838a9fSAndrew Rybchenko 423c838a9fSAndrew Rybchenko /* FIXME: Add definition for driver generated software events */ 433c838a9fSAndrew Rybchenko #ifndef ESE_DZ_EV_CODE_DRV_GEN_EV 443c838a9fSAndrew Rybchenko #define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV 453c838a9fSAndrew Rybchenko #endif 463c838a9fSAndrew Rybchenko 47e948693eSPhilip Paeps 48e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 49e948693eSPhilip Paeps #include "siena_impl.h" 50e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 51e948693eSPhilip Paeps 523c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 533c838a9fSAndrew Rybchenko #include "hunt_impl.h" 543c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON */ 553c838a9fSAndrew Rybchenko 565f5c71ccSAndrew Rybchenko #if EFSYS_OPT_MEDFORD 575f5c71ccSAndrew Rybchenko #include "medford_impl.h" 585f5c71ccSAndrew Rybchenko #endif /* EFSYS_OPT_MEDFORD */ 595f5c71ccSAndrew Rybchenko 60ae64ac93SAndrew Rybchenko #if EFSYS_OPT_MEDFORD2 61ae64ac93SAndrew Rybchenko #include "medford2_impl.h" 62ae64ac93SAndrew Rybchenko #endif /* EFSYS_OPT_MEDFORD2 */ 63ae64ac93SAndrew Rybchenko 64ae64ac93SAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) 655f5c71ccSAndrew Rybchenko #include "ef10_impl.h" 66ae64ac93SAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) */ 675f5c71ccSAndrew Rybchenko 68e948693eSPhilip Paeps #ifdef __cplusplus 69e948693eSPhilip Paeps extern "C" { 70e948693eSPhilip Paeps #endif 71e948693eSPhilip Paeps 72e948693eSPhilip Paeps #define EFX_MOD_MCDI 0x00000001 73e948693eSPhilip Paeps #define EFX_MOD_PROBE 0x00000002 74e948693eSPhilip Paeps #define EFX_MOD_NVRAM 0x00000004 75e948693eSPhilip Paeps #define EFX_MOD_VPD 0x00000008 76e948693eSPhilip Paeps #define EFX_MOD_NIC 0x00000010 77e948693eSPhilip Paeps #define EFX_MOD_INTR 0x00000020 78e948693eSPhilip Paeps #define EFX_MOD_EV 0x00000040 79e948693eSPhilip Paeps #define EFX_MOD_RX 0x00000080 80e948693eSPhilip Paeps #define EFX_MOD_TX 0x00000100 81e948693eSPhilip Paeps #define EFX_MOD_PORT 0x00000200 82e948693eSPhilip Paeps #define EFX_MOD_MON 0x00000400 83e948693eSPhilip Paeps #define EFX_MOD_FILTER 0x00001000 84908ecfc6SAndrew Rybchenko #define EFX_MOD_LIC 0x00002000 85fdbe38cfSAndrew Rybchenko #define EFX_MOD_TUNNEL 0x00004000 86e948693eSPhilip Paeps 870c909247SAndrew Rybchenko #define EFX_RESET_PHY 0x00000001 880c909247SAndrew Rybchenko #define EFX_RESET_RXQ_ERR 0x00000002 890c909247SAndrew Rybchenko #define EFX_RESET_TXQ_ERR 0x00000004 90e948693eSPhilip Paeps 91e948693eSPhilip Paeps typedef enum efx_mac_type_e { 92e948693eSPhilip Paeps EFX_MAC_INVALID = 0, 93e948693eSPhilip Paeps EFX_MAC_SIENA, 943c838a9fSAndrew Rybchenko EFX_MAC_HUNTINGTON, 95c15d6d21SAndrew Rybchenko EFX_MAC_MEDFORD, 96cbc3f94fSAndrew Rybchenko EFX_MAC_MEDFORD2, 97e948693eSPhilip Paeps EFX_MAC_NTYPES 98e948693eSPhilip Paeps } efx_mac_type_t; 99e948693eSPhilip Paeps 1003c838a9fSAndrew Rybchenko typedef struct efx_ev_ops_s { 101460cb568SAndrew Rybchenko efx_rc_t (*eevo_init)(efx_nic_t *); 1023c838a9fSAndrew Rybchenko void (*eevo_fini)(efx_nic_t *); 103460cb568SAndrew Rybchenko efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int, 1043c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 105a3fe009aSAndrew Rybchenko uint32_t, uint32_t, efx_evq_t *); 1063c838a9fSAndrew Rybchenko void (*eevo_qdestroy)(efx_evq_t *); 107460cb568SAndrew Rybchenko efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int); 1083c838a9fSAndrew Rybchenko void (*eevo_qpost)(efx_evq_t *, uint16_t); 109460cb568SAndrew Rybchenko efx_rc_t (*eevo_qmoderate)(efx_evq_t *, unsigned int); 1103c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1113c838a9fSAndrew Rybchenko void (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *); 1123c838a9fSAndrew Rybchenko #endif 1133c838a9fSAndrew Rybchenko } efx_ev_ops_t; 1143c838a9fSAndrew Rybchenko 1153c838a9fSAndrew Rybchenko typedef struct efx_tx_ops_s { 116460cb568SAndrew Rybchenko efx_rc_t (*etxo_init)(efx_nic_t *); 1173c838a9fSAndrew Rybchenko void (*etxo_fini)(efx_nic_t *); 118460cb568SAndrew Rybchenko efx_rc_t (*etxo_qcreate)(efx_nic_t *, 1193c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1203c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, 1213c838a9fSAndrew Rybchenko uint32_t, uint16_t, 1223c838a9fSAndrew Rybchenko efx_evq_t *, efx_txq_t *, 1233c838a9fSAndrew Rybchenko unsigned int *); 1243c838a9fSAndrew Rybchenko void (*etxo_qdestroy)(efx_txq_t *); 125460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpost)(efx_txq_t *, efx_buffer_t *, 1263c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1273c838a9fSAndrew Rybchenko unsigned int *); 1283c838a9fSAndrew Rybchenko void (*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int); 129460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpace)(efx_txq_t *, unsigned int); 130460cb568SAndrew Rybchenko efx_rc_t (*etxo_qflush)(efx_txq_t *); 1313c838a9fSAndrew Rybchenko void (*etxo_qenable)(efx_txq_t *); 132460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_enable)(efx_txq_t *); 1333c838a9fSAndrew Rybchenko void (*etxo_qpio_disable)(efx_txq_t *); 134460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_write)(efx_txq_t *, uint8_t *, size_t, 1353c838a9fSAndrew Rybchenko size_t); 136460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int, 1373c838a9fSAndrew Rybchenko unsigned int *); 138460cb568SAndrew Rybchenko efx_rc_t (*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *, 1393c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1403c838a9fSAndrew Rybchenko unsigned int *); 1413c838a9fSAndrew Rybchenko void (*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t, 1423c838a9fSAndrew Rybchenko size_t, boolean_t, 1433c838a9fSAndrew Rybchenko efx_desc_t *); 1443c838a9fSAndrew Rybchenko void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t, 1453c838a9fSAndrew Rybchenko uint32_t, uint8_t, 1463c838a9fSAndrew Rybchenko efx_desc_t *); 1474ab49369SAndrew Rybchenko void (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t, 1484142e8cfSAndrew Rybchenko uint16_t, uint32_t, uint16_t, 1494ab49369SAndrew Rybchenko efx_desc_t *, int); 1503c838a9fSAndrew Rybchenko void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t, 1513c838a9fSAndrew Rybchenko efx_desc_t *); 1524effeb9eSAndrew Rybchenko void (*etxo_qdesc_checksum_create)(efx_txq_t *, uint16_t, 1534effeb9eSAndrew Rybchenko efx_desc_t *); 1543c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1553c838a9fSAndrew Rybchenko void (*etxo_qstats_update)(efx_txq_t *, 1563c838a9fSAndrew Rybchenko efsys_stat_t *); 1573c838a9fSAndrew Rybchenko #endif 1583c838a9fSAndrew Rybchenko } efx_tx_ops_t; 1593c838a9fSAndrew Rybchenko 1603c838a9fSAndrew Rybchenko typedef struct efx_rx_ops_s { 161460cb568SAndrew Rybchenko efx_rc_t (*erxo_init)(efx_nic_t *); 1623c838a9fSAndrew Rybchenko void (*erxo_fini)(efx_nic_t *); 1633c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCATTER 164460cb568SAndrew Rybchenko efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int); 1653c838a9fSAndrew Rybchenko #endif 1663c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 167e6d55a0bSAndrew Rybchenko efx_rc_t (*erxo_scale_context_alloc)(efx_nic_t *, 168e6d55a0bSAndrew Rybchenko efx_rx_scale_context_type_t, 169e6d55a0bSAndrew Rybchenko uint32_t, uint32_t *); 170e6d55a0bSAndrew Rybchenko efx_rc_t (*erxo_scale_context_free)(efx_nic_t *, uint32_t); 17182af879cSAndrew Rybchenko efx_rc_t (*erxo_scale_mode_set)(efx_nic_t *, uint32_t, 17282af879cSAndrew Rybchenko efx_rx_hash_alg_t, 1733c838a9fSAndrew Rybchenko efx_rx_hash_type_t, boolean_t); 17482af879cSAndrew Rybchenko efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint32_t, 17582af879cSAndrew Rybchenko uint8_t *, size_t); 17682af879cSAndrew Rybchenko efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, uint32_t, 17782af879cSAndrew Rybchenko unsigned int *, size_t); 1780badfd72SAndrew Rybchenko uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t, 1790badfd72SAndrew Rybchenko uint8_t *); 1800badfd72SAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 1810badfd72SAndrew Rybchenko efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *, 1820badfd72SAndrew Rybchenko uint16_t *); 1833c838a9fSAndrew Rybchenko void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t, 1843c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1853c838a9fSAndrew Rybchenko unsigned int); 1863c838a9fSAndrew Rybchenko void (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *); 1878e0c4827SAndrew Rybchenko #if EFSYS_OPT_RX_PACKED_STREAM 1888e0c4827SAndrew Rybchenko void (*erxo_qpush_ps_credits)(efx_rxq_t *); 1898e0c4827SAndrew Rybchenko uint8_t * (*erxo_qps_packet_info)(efx_rxq_t *, uint8_t *, 1908e0c4827SAndrew Rybchenko uint32_t, uint32_t, 1918e0c4827SAndrew Rybchenko uint16_t *, uint32_t *, uint32_t *); 1928e0c4827SAndrew Rybchenko #endif 193460cb568SAndrew Rybchenko efx_rc_t (*erxo_qflush)(efx_rxq_t *); 1943c838a9fSAndrew Rybchenko void (*erxo_qenable)(efx_rxq_t *); 195460cb568SAndrew Rybchenko efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int, 196074cfb5cSAndrew Rybchenko unsigned int, efx_rxq_type_t, uint32_t, 1973c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 1989445d1c5SAndrew Rybchenko unsigned int, 1993c838a9fSAndrew Rybchenko efx_evq_t *, efx_rxq_t *); 2003c838a9fSAndrew Rybchenko void (*erxo_qdestroy)(efx_rxq_t *); 2013c838a9fSAndrew Rybchenko } efx_rx_ops_t; 2023c838a9fSAndrew Rybchenko 203e948693eSPhilip Paeps typedef struct efx_mac_ops_s { 204460cb568SAndrew Rybchenko efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *); 205460cb568SAndrew Rybchenko efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *); 206460cb568SAndrew Rybchenko efx_rc_t (*emo_addr_set)(efx_nic_t *); 20708c5af79SAndrew Rybchenko efx_rc_t (*emo_pdu_set)(efx_nic_t *); 208d8484af2SAndrew Rybchenko efx_rc_t (*emo_pdu_get)(efx_nic_t *, size_t *); 209460cb568SAndrew Rybchenko efx_rc_t (*emo_reconfigure)(efx_nic_t *); 210460cb568SAndrew Rybchenko efx_rc_t (*emo_multicast_list_set)(efx_nic_t *); 211460cb568SAndrew Rybchenko efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *, 2123c838a9fSAndrew Rybchenko efx_rxq_t *, boolean_t); 2133c838a9fSAndrew Rybchenko void (*emo_filter_default_rxq_clear)(efx_nic_t *); 214e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 215460cb568SAndrew Rybchenko efx_rc_t (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t, 216e948693eSPhilip Paeps efx_loopback_type_t); 217e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 218e948693eSPhilip Paeps #if EFSYS_OPT_MAC_STATS 21958a72cb2SAndrew Rybchenko efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t); 22031e518b4SAndrew Rybchenko efx_rc_t (*emo_stats_clear)(efx_nic_t *); 221460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); 222460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, 223e948693eSPhilip Paeps uint16_t, boolean_t); 224460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 225e948693eSPhilip Paeps efsys_stat_t *, uint32_t *); 226e948693eSPhilip Paeps #endif /* EFSYS_OPT_MAC_STATS */ 227e948693eSPhilip Paeps } efx_mac_ops_t; 228e948693eSPhilip Paeps 229e948693eSPhilip Paeps typedef struct efx_phy_ops_s { 230460cb568SAndrew Rybchenko efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */ 231460cb568SAndrew Rybchenko efx_rc_t (*epo_reset)(efx_nic_t *); 232460cb568SAndrew Rybchenko efx_rc_t (*epo_reconfigure)(efx_nic_t *); 233460cb568SAndrew Rybchenko efx_rc_t (*epo_verify)(efx_nic_t *); 234460cb568SAndrew Rybchenko efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *); 235e948693eSPhilip Paeps #if EFSYS_OPT_PHY_STATS 236460cb568SAndrew Rybchenko efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *, 237e948693eSPhilip Paeps uint32_t *); 238e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_STATS */ 2393c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 240460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *); 241460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t); 242460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t, 2433c838a9fSAndrew Rybchenko efx_bist_result_t *, uint32_t *, 244e948693eSPhilip Paeps unsigned long *, size_t); 2453c838a9fSAndrew Rybchenko void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t); 2463c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_BIST */ 247e948693eSPhilip Paeps } efx_phy_ops_t; 248e948693eSPhilip Paeps 2493c838a9fSAndrew Rybchenko #if EFSYS_OPT_FILTER 2503c838a9fSAndrew Rybchenko typedef struct efx_filter_ops_s { 251460cb568SAndrew Rybchenko efx_rc_t (*efo_init)(efx_nic_t *); 2523c838a9fSAndrew Rybchenko void (*efo_fini)(efx_nic_t *); 253460cb568SAndrew Rybchenko efx_rc_t (*efo_restore)(efx_nic_t *); 254460cb568SAndrew Rybchenko efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *, 2553c838a9fSAndrew Rybchenko boolean_t may_replace); 256460cb568SAndrew Rybchenko efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *); 25763492ab8SAndrew Rybchenko efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, 25863492ab8SAndrew Rybchenko size_t, size_t *); 259460cb568SAndrew Rybchenko efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t, 2603c838a9fSAndrew Rybchenko boolean_t, boolean_t, boolean_t, 26147cb5106SAndrew Rybchenko uint8_t const *, uint32_t); 2623c838a9fSAndrew Rybchenko } efx_filter_ops_t; 2633c838a9fSAndrew Rybchenko 264460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 2653c838a9fSAndrew Rybchenko efx_filter_reconfigure( 2663c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 2673c838a9fSAndrew Rybchenko __in_ecount(6) uint8_t const *mac_addr, 2683c838a9fSAndrew Rybchenko __in boolean_t all_unicst, 2693c838a9fSAndrew Rybchenko __in boolean_t mulcst, 2703c838a9fSAndrew Rybchenko __in boolean_t all_mulcst, 2713c838a9fSAndrew Rybchenko __in boolean_t brdcst, 2723c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 27347cb5106SAndrew Rybchenko __in uint32_t count); 2743c838a9fSAndrew Rybchenko 2753c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_FILTER */ 2763c838a9fSAndrew Rybchenko 277fdbe38cfSAndrew Rybchenko #if EFSYS_OPT_TUNNEL 278fdbe38cfSAndrew Rybchenko typedef struct efx_tunnel_ops_s { 279fdbe38cfSAndrew Rybchenko boolean_t (*eto_udp_encap_supported)(efx_nic_t *); 280fdbe38cfSAndrew Rybchenko efx_rc_t (*eto_reconfigure)(efx_nic_t *); 281fdbe38cfSAndrew Rybchenko } efx_tunnel_ops_t; 282fdbe38cfSAndrew Rybchenko #endif /* EFSYS_OPT_TUNNEL */ 2833c838a9fSAndrew Rybchenko 284e948693eSPhilip Paeps typedef struct efx_port_s { 285e948693eSPhilip Paeps efx_mac_type_t ep_mac_type; 286e948693eSPhilip Paeps uint32_t ep_phy_type; 287e948693eSPhilip Paeps uint8_t ep_port; 288e948693eSPhilip Paeps uint32_t ep_mac_pdu; 289e948693eSPhilip Paeps uint8_t ep_mac_addr[6]; 290e948693eSPhilip Paeps efx_link_mode_t ep_link_mode; 2913c838a9fSAndrew Rybchenko boolean_t ep_all_unicst; 2923c838a9fSAndrew Rybchenko boolean_t ep_mulcst; 2933c838a9fSAndrew Rybchenko boolean_t ep_all_mulcst; 294e948693eSPhilip Paeps boolean_t ep_brdcst; 295e948693eSPhilip Paeps unsigned int ep_fcntl; 296e948693eSPhilip Paeps boolean_t ep_fcntl_autoneg; 297e948693eSPhilip Paeps efx_oword_t ep_multicst_hash[2]; 2983c838a9fSAndrew Rybchenko uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN * 2993c838a9fSAndrew Rybchenko EFX_MAC_MULTICAST_LIST_MAX]; 3003c838a9fSAndrew Rybchenko uint32_t ep_mulcst_addr_count; 301e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 302e948693eSPhilip Paeps efx_loopback_type_t ep_loopback_type; 303e948693eSPhilip Paeps efx_link_mode_t ep_loopback_link_mode; 304e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 305e948693eSPhilip Paeps #if EFSYS_OPT_PHY_FLAGS 306e948693eSPhilip Paeps uint32_t ep_phy_flags; 307e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_FLAGS */ 308e948693eSPhilip Paeps #if EFSYS_OPT_PHY_LED_CONTROL 309e948693eSPhilip Paeps efx_phy_led_mode_t ep_phy_led_mode; 310e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_LED_CONTROL */ 311e948693eSPhilip Paeps efx_phy_media_type_t ep_fixed_port_type; 312e948693eSPhilip Paeps efx_phy_media_type_t ep_module_type; 313e948693eSPhilip Paeps uint32_t ep_adv_cap_mask; 314e948693eSPhilip Paeps uint32_t ep_lp_cap_mask; 315e948693eSPhilip Paeps uint32_t ep_default_adv_cap_mask; 316e948693eSPhilip Paeps uint32_t ep_phy_cap_mask; 317e948693eSPhilip Paeps boolean_t ep_mac_drain; 3183c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 3193c838a9fSAndrew Rybchenko efx_bist_type_t ep_current_bist; 320e948693eSPhilip Paeps #endif 321ec831f7fSAndrew Rybchenko const efx_mac_ops_t *ep_emop; 322ec831f7fSAndrew Rybchenko const efx_phy_ops_t *ep_epop; 323e948693eSPhilip Paeps } efx_port_t; 324e948693eSPhilip Paeps 325e948693eSPhilip Paeps typedef struct efx_mon_ops_s { 326e948693eSPhilip Paeps #if EFSYS_OPT_MON_STATS 327460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 328e948693eSPhilip Paeps efx_mon_stat_value_t *); 329e948693eSPhilip Paeps #endif /* EFSYS_OPT_MON_STATS */ 330e948693eSPhilip Paeps } efx_mon_ops_t; 331e948693eSPhilip Paeps 332e948693eSPhilip Paeps typedef struct efx_mon_s { 333e948693eSPhilip Paeps efx_mon_type_t em_type; 334ec831f7fSAndrew Rybchenko const efx_mon_ops_t *em_emop; 335e948693eSPhilip Paeps } efx_mon_t; 336e948693eSPhilip Paeps 3373c838a9fSAndrew Rybchenko typedef struct efx_intr_ops_s { 338460cb568SAndrew Rybchenko efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *); 3393c838a9fSAndrew Rybchenko void (*eio_enable)(efx_nic_t *); 3403c838a9fSAndrew Rybchenko void (*eio_disable)(efx_nic_t *); 3413c838a9fSAndrew Rybchenko void (*eio_disable_unlocked)(efx_nic_t *); 342460cb568SAndrew Rybchenko efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int); 3430c24a07eSAndrew Rybchenko void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *); 3440c24a07eSAndrew Rybchenko void (*eio_status_message)(efx_nic_t *, unsigned int, 3450c24a07eSAndrew Rybchenko boolean_t *); 3460c24a07eSAndrew Rybchenko void (*eio_fatal)(efx_nic_t *); 3473c838a9fSAndrew Rybchenko void (*eio_fini)(efx_nic_t *); 3483c838a9fSAndrew Rybchenko } efx_intr_ops_t; 3493c838a9fSAndrew Rybchenko 350e948693eSPhilip Paeps typedef struct efx_intr_s { 351ec831f7fSAndrew Rybchenko const efx_intr_ops_t *ei_eiop; 352e948693eSPhilip Paeps efsys_mem_t *ei_esmp; 3533c838a9fSAndrew Rybchenko efx_intr_type_t ei_type; 354e948693eSPhilip Paeps unsigned int ei_level; 355e948693eSPhilip Paeps } efx_intr_t; 356e948693eSPhilip Paeps 357e948693eSPhilip Paeps typedef struct efx_nic_ops_s { 358460cb568SAndrew Rybchenko efx_rc_t (*eno_probe)(efx_nic_t *); 359cfa023ebSAndrew Rybchenko efx_rc_t (*eno_board_cfg)(efx_nic_t *); 360460cb568SAndrew Rybchenko efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*); 361460cb568SAndrew Rybchenko efx_rc_t (*eno_reset)(efx_nic_t *); 362460cb568SAndrew Rybchenko efx_rc_t (*eno_init)(efx_nic_t *); 363460cb568SAndrew Rybchenko efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *); 364460cb568SAndrew Rybchenko efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t, 3653c838a9fSAndrew Rybchenko uint32_t *, size_t *); 366e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 367460cb568SAndrew Rybchenko efx_rc_t (*eno_register_test)(efx_nic_t *); 368e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 369e948693eSPhilip Paeps void (*eno_fini)(efx_nic_t *); 370e948693eSPhilip Paeps void (*eno_unprobe)(efx_nic_t *); 371e948693eSPhilip Paeps } efx_nic_ops_t; 372e948693eSPhilip Paeps 3739ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_LIMIT_TARGET 374e948693eSPhilip Paeps #define EFX_TXQ_LIMIT_TARGET 259 3759ab060a7SAndrew Rybchenko #endif 3769ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_LIMIT_TARGET 37775ba9e1eSAndrew Rybchenko #define EFX_RXQ_LIMIT_TARGET 512 3789ab060a7SAndrew Rybchenko #endif 3792d99dff8SAndrew Rybchenko 380e948693eSPhilip Paeps 381e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 382e948693eSPhilip Paeps 383553455eaSAndrew Rybchenko #if EFSYS_OPT_SIENA 384553455eaSAndrew Rybchenko 385f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_spec_s { 386f7aa4b3dSAndrew Rybchenko uint8_t sfs_type; 387f7aa4b3dSAndrew Rybchenko uint32_t sfs_flags; 388f7aa4b3dSAndrew Rybchenko uint32_t sfs_dmaq_id; 389f7aa4b3dSAndrew Rybchenko uint32_t sfs_dword[3]; 390f7aa4b3dSAndrew Rybchenko } siena_filter_spec_t; 3913c838a9fSAndrew Rybchenko 392f7aa4b3dSAndrew Rybchenko typedef enum siena_filter_type_e { 393f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 394f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */ 395f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */ 396f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */ 397f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */ 398f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */ 399e948693eSPhilip Paeps 400f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 401f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */ 402f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */ 403f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */ 404f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */ 405f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */ 406e948693eSPhilip Paeps 407f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_NTYPES 408f7aa4b3dSAndrew Rybchenko } siena_filter_type_t; 409e948693eSPhilip Paeps 410f7aa4b3dSAndrew Rybchenko typedef enum siena_filter_tbl_id_e { 411f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_RX_IP = 0, 412f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_RX_MAC, 413f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_TX_IP, 414f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_TX_MAC, 415f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_NTBLS 416f7aa4b3dSAndrew Rybchenko } siena_filter_tbl_id_t; 417e948693eSPhilip Paeps 418f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_tbl_s { 419f7aa4b3dSAndrew Rybchenko int sft_size; /* number of entries */ 420f7aa4b3dSAndrew Rybchenko int sft_used; /* active count */ 421f7aa4b3dSAndrew Rybchenko uint32_t *sft_bitmap; /* active bitmap */ 422f7aa4b3dSAndrew Rybchenko siena_filter_spec_t *sft_spec; /* array of saved specs */ 423f7aa4b3dSAndrew Rybchenko } siena_filter_tbl_t; 424e948693eSPhilip Paeps 425f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_s { 426f7aa4b3dSAndrew Rybchenko siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS]; 427f7aa4b3dSAndrew Rybchenko unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES]; 428f7aa4b3dSAndrew Rybchenko } siena_filter_t; 429e948693eSPhilip Paeps 430553455eaSAndrew Rybchenko #endif /* EFSYS_OPT_SIENA */ 431553455eaSAndrew Rybchenko 432e948693eSPhilip Paeps typedef struct efx_filter_s { 433e75412c9SAndrew Rybchenko #if EFSYS_OPT_SIENA 434f7aa4b3dSAndrew Rybchenko siena_filter_t *ef_siena_filter; 435e75412c9SAndrew Rybchenko #endif /* EFSYS_OPT_SIENA */ 436ae64ac93SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 4371289fe72SAndrew Rybchenko ef10_filter_table_t *ef_ef10_filter_table; 438ae64ac93SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ 439e948693eSPhilip Paeps } efx_filter_t; 440e948693eSPhilip Paeps 441553455eaSAndrew Rybchenko #if EFSYS_OPT_SIENA 442553455eaSAndrew Rybchenko 443e948693eSPhilip Paeps extern void 4441c159dbfSAndrew Rybchenko siena_filter_tbl_clear( 445e948693eSPhilip Paeps __in efx_nic_t *enp, 446f7aa4b3dSAndrew Rybchenko __in siena_filter_tbl_id_t tbl); 447e948693eSPhilip Paeps 448553455eaSAndrew Rybchenko #endif /* EFSYS_OPT_SIENA */ 449553455eaSAndrew Rybchenko 450e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 451e948693eSPhilip Paeps 4523c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 4533c838a9fSAndrew Rybchenko 454fdbe38cfSAndrew Rybchenko #define EFX_TUNNEL_MAXNENTRIES (16) 455fdbe38cfSAndrew Rybchenko 456fdbe38cfSAndrew Rybchenko #if EFSYS_OPT_TUNNEL 457fdbe38cfSAndrew Rybchenko 458fdbe38cfSAndrew Rybchenko typedef struct efx_tunnel_udp_entry_s { 459fdbe38cfSAndrew Rybchenko uint16_t etue_port; /* host/cpu-endian */ 460fdbe38cfSAndrew Rybchenko uint16_t etue_protocol; 461fdbe38cfSAndrew Rybchenko } efx_tunnel_udp_entry_t; 462fdbe38cfSAndrew Rybchenko 463fdbe38cfSAndrew Rybchenko typedef struct efx_tunnel_cfg_s { 464fdbe38cfSAndrew Rybchenko efx_tunnel_udp_entry_t etc_udp_entries[EFX_TUNNEL_MAXNENTRIES]; 465fdbe38cfSAndrew Rybchenko unsigned int etc_udp_entries_num; 466fdbe38cfSAndrew Rybchenko } efx_tunnel_cfg_t; 467fdbe38cfSAndrew Rybchenko 468fdbe38cfSAndrew Rybchenko #endif /* EFSYS_OPT_TUNNEL */ 469fdbe38cfSAndrew Rybchenko 4703c838a9fSAndrew Rybchenko typedef struct efx_mcdi_ops_s { 471460cb568SAndrew Rybchenko efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *); 472fd7501bfSAndrew Rybchenko void (*emco_send_request)(efx_nic_t *, void *, size_t, 473fd7501bfSAndrew Rybchenko void *, size_t); 474460cb568SAndrew Rybchenko efx_rc_t (*emco_poll_reboot)(efx_nic_t *); 475548ebee5SAndrew Rybchenko boolean_t (*emco_poll_response)(efx_nic_t *); 476548ebee5SAndrew Rybchenko void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); 4773c838a9fSAndrew Rybchenko void (*emco_fini)(efx_nic_t *); 4788a4fcbd4SAndrew Rybchenko efx_rc_t (*emco_feature_supported)(efx_nic_t *, 4798a4fcbd4SAndrew Rybchenko efx_mcdi_feature_id_t, boolean_t *); 4808a4fcbd4SAndrew Rybchenko void (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *, 4818a4fcbd4SAndrew Rybchenko uint32_t *); 4823c838a9fSAndrew Rybchenko } efx_mcdi_ops_t; 4833c838a9fSAndrew Rybchenko 4843c838a9fSAndrew Rybchenko typedef struct efx_mcdi_s { 485ec831f7fSAndrew Rybchenko const efx_mcdi_ops_t *em_emcop; 4863c838a9fSAndrew Rybchenko const efx_mcdi_transport_t *em_emtp; 4873c838a9fSAndrew Rybchenko efx_mcdi_iface_t em_emip; 4883c838a9fSAndrew Rybchenko } efx_mcdi_t; 4893c838a9fSAndrew Rybchenko 4903c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 4913c838a9fSAndrew Rybchenko 492e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 4933d670ff5SAndrew Rybchenko 4943d670ff5SAndrew Rybchenko /* Invalid partition ID for en_nvram_partn_locked field of efx_nc_t */ 4953d670ff5SAndrew Rybchenko #define EFX_NVRAM_PARTN_INVALID (0xffffffffu) 4963d670ff5SAndrew Rybchenko 497e948693eSPhilip Paeps typedef struct efx_nvram_ops_s { 498e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 499460cb568SAndrew Rybchenko efx_rc_t (*envo_test)(efx_nic_t *); 500e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 501bce88e31SAndrew Rybchenko efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, 502bce88e31SAndrew Rybchenko uint32_t *); 50356bd83b0SAndrew Rybchenko efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *); 5045d846e87SAndrew Rybchenko efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *); 5050afdf29cSAndrew Rybchenko efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t, 5060afdf29cSAndrew Rybchenko unsigned int, caddr_t, size_t); 507ede1a3edSAndrew Rybchenko efx_rc_t (*envo_partn_read_backup)(efx_nic_t *, uint32_t, 508ede1a3edSAndrew Rybchenko unsigned int, caddr_t, size_t); 509b60ff840SAndrew Rybchenko efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t, 510b60ff840SAndrew Rybchenko unsigned int, size_t); 511134c4c4aSAndrew Rybchenko efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t, 512134c4c4aSAndrew Rybchenko unsigned int, caddr_t, size_t); 513a21b2f20SAndrew Rybchenko efx_rc_t (*envo_partn_rw_finish)(efx_nic_t *, uint32_t, 514a21b2f20SAndrew Rybchenko uint32_t *); 51592187119SAndrew Rybchenko efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t, 51692187119SAndrew Rybchenko uint32_t *, uint16_t *); 5176d0b856cSAndrew Rybchenko efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t, 5186d0b856cSAndrew Rybchenko uint16_t *); 5195abce2b9SAndrew Rybchenko efx_rc_t (*envo_buffer_validate)(efx_nic_t *, uint32_t, 5205abce2b9SAndrew Rybchenko caddr_t, size_t); 521e948693eSPhilip Paeps } efx_nvram_ops_t; 522e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 523e948693eSPhilip Paeps 524e948693eSPhilip Paeps #if EFSYS_OPT_VPD 525e948693eSPhilip Paeps typedef struct efx_vpd_ops_s { 526460cb568SAndrew Rybchenko efx_rc_t (*evpdo_init)(efx_nic_t *); 527460cb568SAndrew Rybchenko efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *); 528460cb568SAndrew Rybchenko efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t); 529460cb568SAndrew Rybchenko efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t); 530460cb568SAndrew Rybchenko efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t); 531460cb568SAndrew Rybchenko efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t, 532460cb568SAndrew Rybchenko efx_vpd_value_t *); 533460cb568SAndrew Rybchenko efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t, 534460cb568SAndrew Rybchenko efx_vpd_value_t *); 535460cb568SAndrew Rybchenko efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t, 536460cb568SAndrew Rybchenko efx_vpd_value_t *, unsigned int *); 537460cb568SAndrew Rybchenko efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t); 538e948693eSPhilip Paeps void (*evpdo_fini)(efx_nic_t *); 539e948693eSPhilip Paeps } efx_vpd_ops_t; 540e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 541e948693eSPhilip Paeps 5423c838a9fSAndrew Rybchenko #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM 5433c838a9fSAndrew Rybchenko 544460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5453c838a9fSAndrew Rybchenko efx_mcdi_nvram_partitions( 5463c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5473c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5483c838a9fSAndrew Rybchenko __in size_t size, 5493c838a9fSAndrew Rybchenko __out unsigned int *npartnp); 5503c838a9fSAndrew Rybchenko 551460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5523c838a9fSAndrew Rybchenko efx_mcdi_nvram_metadata( 5533c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5543c838a9fSAndrew Rybchenko __in uint32_t partn, 5553c838a9fSAndrew Rybchenko __out uint32_t *subtypep, 5563c838a9fSAndrew Rybchenko __out_ecount(4) uint16_t version[4], 5573c838a9fSAndrew Rybchenko __out_bcount_opt(size) char *descp, 5583c838a9fSAndrew Rybchenko __in size_t size); 5593c838a9fSAndrew Rybchenko 560460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5613c838a9fSAndrew Rybchenko efx_mcdi_nvram_info( 5623c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5633c838a9fSAndrew Rybchenko __in uint32_t partn, 5643c838a9fSAndrew Rybchenko __out_opt size_t *sizep, 5653c838a9fSAndrew Rybchenko __out_opt uint32_t *addressp, 5669cb71b16SAndrew Rybchenko __out_opt uint32_t *erase_sizep, 5679cb71b16SAndrew Rybchenko __out_opt uint32_t *write_sizep); 5683c838a9fSAndrew Rybchenko 569460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5703c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_start( 5713c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5723c838a9fSAndrew Rybchenko __in uint32_t partn); 5733c838a9fSAndrew Rybchenko 574460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5753c838a9fSAndrew Rybchenko efx_mcdi_nvram_read( 5763c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5773c838a9fSAndrew Rybchenko __in uint32_t partn, 5783c838a9fSAndrew Rybchenko __in uint32_t offset, 5793c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5809ad7e03fSAndrew Rybchenko __in size_t size, 5819ad7e03fSAndrew Rybchenko __in uint32_t mode); 5823c838a9fSAndrew Rybchenko 583460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5843c838a9fSAndrew Rybchenko efx_mcdi_nvram_erase( 5853c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5863c838a9fSAndrew Rybchenko __in uint32_t partn, 5873c838a9fSAndrew Rybchenko __in uint32_t offset, 5883c838a9fSAndrew Rybchenko __in size_t size); 5893c838a9fSAndrew Rybchenko 590460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5913c838a9fSAndrew Rybchenko efx_mcdi_nvram_write( 5923c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5933c838a9fSAndrew Rybchenko __in uint32_t partn, 5943c838a9fSAndrew Rybchenko __in uint32_t offset, 5953c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5963c838a9fSAndrew Rybchenko __in size_t size); 5973c838a9fSAndrew Rybchenko 598460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5993c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_finish( 6003c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 6013c838a9fSAndrew Rybchenko __in uint32_t partn, 602e9c123a5SAndrew Rybchenko __in boolean_t reboot, 603a21b2f20SAndrew Rybchenko __out_opt uint32_t *verify_resultp); 6043c838a9fSAndrew Rybchenko 6053c838a9fSAndrew Rybchenko #if EFSYS_OPT_DIAG 6063c838a9fSAndrew Rybchenko 607460cb568SAndrew Rybchenko __checkReturn efx_rc_t 6083c838a9fSAndrew Rybchenko efx_mcdi_nvram_test( 6093c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 6103c838a9fSAndrew Rybchenko __in uint32_t partn); 6113c838a9fSAndrew Rybchenko 6123c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_DIAG */ 6133c838a9fSAndrew Rybchenko 6143c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ 6153c838a9fSAndrew Rybchenko 6160c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 6170c848230SAndrew Rybchenko 6180c848230SAndrew Rybchenko typedef struct efx_lic_ops_s { 6190c848230SAndrew Rybchenko efx_rc_t (*elo_update_licenses)(efx_nic_t *); 6200c848230SAndrew Rybchenko efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *); 6210c848230SAndrew Rybchenko efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *); 6220c848230SAndrew Rybchenko efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *, 6230c848230SAndrew Rybchenko size_t *, uint8_t *); 624fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_find_start) 625fc3a62cfSAndrew Rybchenko (efx_nic_t *, caddr_t, size_t, uint32_t *); 626fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t, 627fc3a62cfSAndrew Rybchenko uint32_t, uint32_t *); 628fc3a62cfSAndrew Rybchenko boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t, 629fc3a62cfSAndrew Rybchenko uint32_t, uint32_t *, uint32_t *); 630fc3a62cfSAndrew Rybchenko boolean_t (*elo_validate_key)(efx_nic_t *, 631fc3a62cfSAndrew Rybchenko caddr_t, uint32_t); 632fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_read_key)(efx_nic_t *, 633fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, uint32_t, 634fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t *); 635fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_write_key)(efx_nic_t *, 636fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, 637fc3a62cfSAndrew Rybchenko caddr_t, uint32_t, uint32_t *); 638fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_delete_key)(efx_nic_t *, 639fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, 640fc3a62cfSAndrew Rybchenko uint32_t, uint32_t, uint32_t *); 641fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_create_partition)(efx_nic_t *, 642fc3a62cfSAndrew Rybchenko caddr_t, size_t); 643fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_finish_partition)(efx_nic_t *, 644fc3a62cfSAndrew Rybchenko caddr_t, size_t); 6450c848230SAndrew Rybchenko } efx_lic_ops_t; 6460c848230SAndrew Rybchenko 6470c848230SAndrew Rybchenko #endif 6480c848230SAndrew Rybchenko 6493c838a9fSAndrew Rybchenko typedef struct efx_drv_cfg_s { 6503c838a9fSAndrew Rybchenko uint32_t edc_min_vi_count; 6513c838a9fSAndrew Rybchenko uint32_t edc_max_vi_count; 6523c838a9fSAndrew Rybchenko 6533c838a9fSAndrew Rybchenko uint32_t edc_max_piobuf_count; 6543c838a9fSAndrew Rybchenko uint32_t edc_pio_alloc_size; 6553c838a9fSAndrew Rybchenko } efx_drv_cfg_t; 6563c838a9fSAndrew Rybchenko 657e948693eSPhilip Paeps struct efx_nic_s { 658e948693eSPhilip Paeps uint32_t en_magic; 659e948693eSPhilip Paeps efx_family_t en_family; 660e948693eSPhilip Paeps uint32_t en_features; 661e948693eSPhilip Paeps efsys_identifier_t *en_esip; 662e948693eSPhilip Paeps efsys_lock_t *en_eslp; 663e948693eSPhilip Paeps efsys_bar_t *en_esbp; 664e948693eSPhilip Paeps unsigned int en_mod_flags; 665e948693eSPhilip Paeps unsigned int en_reset_flags; 666e948693eSPhilip Paeps efx_nic_cfg_t en_nic_cfg; 6673c838a9fSAndrew Rybchenko efx_drv_cfg_t en_drv_cfg; 668e948693eSPhilip Paeps efx_port_t en_port; 669e948693eSPhilip Paeps efx_mon_t en_mon; 670e948693eSPhilip Paeps efx_intr_t en_intr; 671e948693eSPhilip Paeps uint32_t en_ev_qcount; 672e948693eSPhilip Paeps uint32_t en_rx_qcount; 673e948693eSPhilip Paeps uint32_t en_tx_qcount; 674ec831f7fSAndrew Rybchenko const efx_nic_ops_t *en_enop; 675ec831f7fSAndrew Rybchenko const efx_ev_ops_t *en_eevop; 676ec831f7fSAndrew Rybchenko const efx_tx_ops_t *en_etxop; 677ec831f7fSAndrew Rybchenko const efx_rx_ops_t *en_erxop; 678*87a67e18SAndrew Rybchenko efx_fw_variant_t efv; 679e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 680e948693eSPhilip Paeps efx_filter_t en_filter; 681ec831f7fSAndrew Rybchenko const efx_filter_ops_t *en_efop; 682e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 683fdbe38cfSAndrew Rybchenko #if EFSYS_OPT_TUNNEL 684fdbe38cfSAndrew Rybchenko efx_tunnel_cfg_t en_tunnel_cfg; 685fdbe38cfSAndrew Rybchenko const efx_tunnel_ops_t *en_etop; 686fdbe38cfSAndrew Rybchenko #endif /* EFSYS_OPT_TUNNEL */ 6873c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 6883c838a9fSAndrew Rybchenko efx_mcdi_t en_mcdi; 6893c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 690e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 6913d670ff5SAndrew Rybchenko uint32_t en_nvram_partn_locked; 692ec831f7fSAndrew Rybchenko const efx_nvram_ops_t *en_envop; 693e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 694e948693eSPhilip Paeps #if EFSYS_OPT_VPD 695ec831f7fSAndrew Rybchenko const efx_vpd_ops_t *en_evpdop; 696e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6973c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 6983c838a9fSAndrew Rybchenko efx_rx_hash_support_t en_hash_support; 69939023729SAndrew Rybchenko efx_rx_scale_context_type_t en_rss_context_type; 7003c838a9fSAndrew Rybchenko uint32_t en_rss_context; 7013c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 7023c838a9fSAndrew Rybchenko uint32_t en_vport_id; 7030c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 704ec831f7fSAndrew Rybchenko const efx_lic_ops_t *en_elop; 7055df3232cSAndrew Rybchenko boolean_t en_licensing_supported; 7060c848230SAndrew Rybchenko #endif 707e948693eSPhilip Paeps union { 708e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 709e948693eSPhilip Paeps struct { 710e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 711e948693eSPhilip Paeps unsigned int enu_partn_mask; 712e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 713e948693eSPhilip Paeps #if EFSYS_OPT_VPD 714e948693eSPhilip Paeps caddr_t enu_svpd; 715e948693eSPhilip Paeps size_t enu_svpd_length; 716e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 7173c838a9fSAndrew Rybchenko int enu_unused; 718e948693eSPhilip Paeps } siena; 719e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 720e7119ad9SAndrew Rybchenko int enu_unused; 721e948693eSPhilip Paeps } en_u; 722ae64ac93SAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) 723e7119ad9SAndrew Rybchenko union en_arch { 724e7119ad9SAndrew Rybchenko struct { 725e7119ad9SAndrew Rybchenko int ena_vi_base; 726e7119ad9SAndrew Rybchenko int ena_vi_count; 727426f453bSAndrew Rybchenko int ena_vi_shift; 728e7119ad9SAndrew Rybchenko #if EFSYS_OPT_VPD 729e7119ad9SAndrew Rybchenko caddr_t ena_svpd; 730e7119ad9SAndrew Rybchenko size_t ena_svpd_length; 731e7119ad9SAndrew Rybchenko #endif /* EFSYS_OPT_VPD */ 732e7119ad9SAndrew Rybchenko efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS]; 733e7119ad9SAndrew Rybchenko uint32_t ena_piobuf_count; 734e7119ad9SAndrew Rybchenko uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS]; 735e7119ad9SAndrew Rybchenko uint32_t ena_pio_write_vi_base; 736e7119ad9SAndrew Rybchenko /* Memory BAR mapping regions */ 737e7119ad9SAndrew Rybchenko uint32_t ena_uc_mem_map_offset; 738e7119ad9SAndrew Rybchenko size_t ena_uc_mem_map_size; 739e7119ad9SAndrew Rybchenko uint32_t ena_wc_mem_map_offset; 740e7119ad9SAndrew Rybchenko size_t ena_wc_mem_map_size; 741e7119ad9SAndrew Rybchenko } ef10; 742e7119ad9SAndrew Rybchenko } en_arch; 743ae64ac93SAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) */ 744e948693eSPhilip Paeps }; 745e948693eSPhilip Paeps 746e948693eSPhilip Paeps 747e948693eSPhilip Paeps #define EFX_NIC_MAGIC 0x02121996 748e948693eSPhilip Paeps 749e948693eSPhilip Paeps typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *, 750e948693eSPhilip Paeps const efx_ev_callbacks_t *, void *); 751e948693eSPhilip Paeps 7523c838a9fSAndrew Rybchenko typedef struct efx_evq_rxq_state_s { 7533c838a9fSAndrew Rybchenko unsigned int eers_rx_read_ptr; 7543c838a9fSAndrew Rybchenko unsigned int eers_rx_mask; 7558e0c4827SAndrew Rybchenko #if EFSYS_OPT_RX_PACKED_STREAM 7568e0c4827SAndrew Rybchenko unsigned int eers_rx_stream_npackets; 7578e0c4827SAndrew Rybchenko boolean_t eers_rx_packed_stream; 7588e0c4827SAndrew Rybchenko unsigned int eers_rx_packed_stream_credits; 7598e0c4827SAndrew Rybchenko #endif 7603c838a9fSAndrew Rybchenko } efx_evq_rxq_state_t; 7613c838a9fSAndrew Rybchenko 762e948693eSPhilip Paeps struct efx_evq_s { 763e948693eSPhilip Paeps uint32_t ee_magic; 764e948693eSPhilip Paeps efx_nic_t *ee_enp; 765e948693eSPhilip Paeps unsigned int ee_index; 766e948693eSPhilip Paeps unsigned int ee_mask; 767e948693eSPhilip Paeps efsys_mem_t *ee_esmp; 768e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 769e948693eSPhilip Paeps uint32_t ee_stat[EV_NQSTATS]; 770e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 7713c838a9fSAndrew Rybchenko 7723c838a9fSAndrew Rybchenko efx_ev_handler_t ee_rx; 7733c838a9fSAndrew Rybchenko efx_ev_handler_t ee_tx; 7743c838a9fSAndrew Rybchenko efx_ev_handler_t ee_driver; 7753c838a9fSAndrew Rybchenko efx_ev_handler_t ee_global; 7763c838a9fSAndrew Rybchenko efx_ev_handler_t ee_drv_gen; 7773c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 7783c838a9fSAndrew Rybchenko efx_ev_handler_t ee_mcdi; 7793c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 7803c838a9fSAndrew Rybchenko 7813c838a9fSAndrew Rybchenko efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS]; 78282d2a148SAndrew Rybchenko 78382d2a148SAndrew Rybchenko uint32_t ee_flags; 784e948693eSPhilip Paeps }; 785e948693eSPhilip Paeps 786e948693eSPhilip Paeps #define EFX_EVQ_MAGIC 0x08081997 787e948693eSPhilip Paeps 788af9078c3SAndrew Rybchenko #define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */ 789e948693eSPhilip Paeps 790e948693eSPhilip Paeps struct efx_rxq_s { 791e948693eSPhilip Paeps uint32_t er_magic; 792e948693eSPhilip Paeps efx_nic_t *er_enp; 7933c838a9fSAndrew Rybchenko efx_evq_t *er_eep; 794e948693eSPhilip Paeps unsigned int er_index; 7953c838a9fSAndrew Rybchenko unsigned int er_label; 796e948693eSPhilip Paeps unsigned int er_mask; 797e948693eSPhilip Paeps efsys_mem_t *er_esmp; 7985fb80fd4SAndrew Rybchenko efx_evq_rxq_state_t *er_ev_qstate; 799e948693eSPhilip Paeps }; 800e948693eSPhilip Paeps 801e948693eSPhilip Paeps #define EFX_RXQ_MAGIC 0x15022005 802e948693eSPhilip Paeps 803e948693eSPhilip Paeps struct efx_txq_s { 804e948693eSPhilip Paeps uint32_t et_magic; 805e948693eSPhilip Paeps efx_nic_t *et_enp; 806e948693eSPhilip Paeps unsigned int et_index; 807e948693eSPhilip Paeps unsigned int et_mask; 808e948693eSPhilip Paeps efsys_mem_t *et_esmp; 8093c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 8103c838a9fSAndrew Rybchenko uint32_t et_pio_bufnum; 8113c838a9fSAndrew Rybchenko uint32_t et_pio_blknum; 8123c838a9fSAndrew Rybchenko uint32_t et_pio_write_offset; 8133c838a9fSAndrew Rybchenko uint32_t et_pio_offset; 8143c838a9fSAndrew Rybchenko size_t et_pio_size; 8153c838a9fSAndrew Rybchenko #endif 816e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 817e948693eSPhilip Paeps uint32_t et_stat[TX_NQSTATS]; 818e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 819e948693eSPhilip Paeps }; 820e948693eSPhilip Paeps 821e948693eSPhilip Paeps #define EFX_TXQ_MAGIC 0x05092005 822e948693eSPhilip Paeps 823e948693eSPhilip Paeps #define EFX_MAC_ADDR_COPY(_dst, _src) \ 824e948693eSPhilip Paeps do { \ 825e948693eSPhilip Paeps (_dst)[0] = (_src)[0]; \ 826e948693eSPhilip Paeps (_dst)[1] = (_src)[1]; \ 827e948693eSPhilip Paeps (_dst)[2] = (_src)[2]; \ 828e948693eSPhilip Paeps (_dst)[3] = (_src)[3]; \ 829e948693eSPhilip Paeps (_dst)[4] = (_src)[4]; \ 830e948693eSPhilip Paeps (_dst)[5] = (_src)[5]; \ 831e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 832e948693eSPhilip Paeps } while (B_FALSE) 833e948693eSPhilip Paeps 8343c838a9fSAndrew Rybchenko #define EFX_MAC_BROADCAST_ADDR_SET(_dst) \ 8353c838a9fSAndrew Rybchenko do { \ 8363c838a9fSAndrew Rybchenko uint16_t *_d = (uint16_t *)(_dst); \ 8373c838a9fSAndrew Rybchenko _d[0] = 0xffff; \ 8383c838a9fSAndrew Rybchenko _d[1] = 0xffff; \ 8393c838a9fSAndrew Rybchenko _d[2] = 0xffff; \ 8403c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 8413c838a9fSAndrew Rybchenko } while (B_FALSE) 8423c838a9fSAndrew Rybchenko 843e948693eSPhilip Paeps #if EFSYS_OPT_CHECK_REG 844e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) \ 845e948693eSPhilip Paeps do { \ 8463c838a9fSAndrew Rybchenko const char *name = #_reg; \ 847e948693eSPhilip Paeps char min = name[4]; \ 848e948693eSPhilip Paeps char max = name[5]; \ 849e948693eSPhilip Paeps char rev; \ 850e948693eSPhilip Paeps \ 851e948693eSPhilip Paeps switch ((_enp)->en_family) { \ 852e948693eSPhilip Paeps case EFX_FAMILY_SIENA: \ 853e948693eSPhilip Paeps rev = 'C'; \ 854e948693eSPhilip Paeps break; \ 855e948693eSPhilip Paeps \ 8563c838a9fSAndrew Rybchenko case EFX_FAMILY_HUNTINGTON: \ 8573c838a9fSAndrew Rybchenko rev = 'D'; \ 8583c838a9fSAndrew Rybchenko break; \ 8593c838a9fSAndrew Rybchenko \ 86034f6ea29SAndrew Rybchenko case EFX_FAMILY_MEDFORD: \ 86134f6ea29SAndrew Rybchenko rev = 'E'; \ 86234f6ea29SAndrew Rybchenko break; \ 86334f6ea29SAndrew Rybchenko \ 864ae64ac93SAndrew Rybchenko case EFX_FAMILY_MEDFORD2: \ 865ae64ac93SAndrew Rybchenko rev = 'F'; \ 866ae64ac93SAndrew Rybchenko break; \ 867ae64ac93SAndrew Rybchenko \ 868e948693eSPhilip Paeps default: \ 869e948693eSPhilip Paeps rev = '?'; \ 870e948693eSPhilip Paeps break; \ 871e948693eSPhilip Paeps } \ 872e948693eSPhilip Paeps \ 873e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, >=, min); \ 874e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, <=, max); \ 875e948693eSPhilip Paeps \ 876e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 877e948693eSPhilip Paeps } while (B_FALSE) 878e948693eSPhilip Paeps #else 879e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) do { \ 880e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 881e948693eSPhilip Paeps } while (B_FALSE) 882e948693eSPhilip Paeps #endif 883e948693eSPhilip Paeps 884e948693eSPhilip Paeps #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \ 885e948693eSPhilip Paeps do { \ 886e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 887e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \ 888e948693eSPhilip Paeps (_edp), (_lock)); \ 889e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \ 890e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 891e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 892e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 893e948693eSPhilip Paeps } while (B_FALSE) 894e948693eSPhilip Paeps 895e948693eSPhilip Paeps #define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \ 896e948693eSPhilip Paeps do { \ 897e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 898e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \ 899e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 900e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 901e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \ 902e948693eSPhilip Paeps (_edp), (_lock)); \ 903e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 904e948693eSPhilip Paeps } while (B_FALSE) 905e948693eSPhilip Paeps 906e948693eSPhilip Paeps #define EFX_BAR_READQ(_enp, _reg, _eqp) \ 907e948693eSPhilip Paeps do { \ 908e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 909e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \ 910e948693eSPhilip Paeps (_eqp)); \ 911e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \ 912e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 913e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 914e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 915e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 916e948693eSPhilip Paeps } while (B_FALSE) 917e948693eSPhilip Paeps 918e948693eSPhilip Paeps #define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \ 919e948693eSPhilip Paeps do { \ 920e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 921e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \ 922e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 923e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 924e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 925e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \ 926e948693eSPhilip Paeps (_eqp)); \ 927e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 928e948693eSPhilip Paeps } while (B_FALSE) 929e948693eSPhilip Paeps 930e948693eSPhilip Paeps #define EFX_BAR_READO(_enp, _reg, _eop) \ 931e948693eSPhilip Paeps do { \ 932e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 933e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \ 934e948693eSPhilip Paeps (_eop), B_TRUE); \ 935e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \ 936e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 937e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 938e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 939e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 940e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 941e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 942e948693eSPhilip Paeps } while (B_FALSE) 943e948693eSPhilip Paeps 944e948693eSPhilip Paeps #define EFX_BAR_WRITEO(_enp, _reg, _eop) \ 945e948693eSPhilip Paeps do { \ 946e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 947e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \ 948e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 949e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 950e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 951e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 952e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 953e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \ 954e948693eSPhilip Paeps (_eop), B_TRUE); \ 955e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 956e948693eSPhilip Paeps } while (B_FALSE) 957e948693eSPhilip Paeps 958c63c8369SAndrew Rybchenko /* 959c63c8369SAndrew Rybchenko * Accessors for memory BAR non-VI tables. 960c63c8369SAndrew Rybchenko * 961c63c8369SAndrew Rybchenko * Code used on EF10 *must* use EFX_BAR_VI_*() macros for per-VI registers, 962c63c8369SAndrew Rybchenko * to ensure the correct runtime VI window size is used on Medford2. 963c63c8369SAndrew Rybchenko * 964c63c8369SAndrew Rybchenko * Siena-only code may continue using EFX_BAR_TBL_*() macros for VI registers. 965c63c8369SAndrew Rybchenko */ 966c63c8369SAndrew Rybchenko 967e948693eSPhilip Paeps #define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \ 968e948693eSPhilip Paeps do { \ 969e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 970e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, \ 971e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 972e948693eSPhilip Paeps (_edp), (_lock)); \ 973e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \ 974e948693eSPhilip Paeps uint32_t, (_index), \ 975e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 976e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 977e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 978e948693eSPhilip Paeps } while (B_FALSE) 979e948693eSPhilip Paeps 980e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \ 981e948693eSPhilip Paeps do { \ 982e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 983e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 984e948693eSPhilip Paeps uint32_t, (_index), \ 985e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 986e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 987e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 988e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 989e948693eSPhilip Paeps (_edp), (_lock)); \ 990e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 991e948693eSPhilip Paeps } while (B_FALSE) 992e948693eSPhilip Paeps 993e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \ 994e948693eSPhilip Paeps do { \ 995e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 996e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 997e948693eSPhilip Paeps uint32_t, (_index), \ 998e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 999e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 1000e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 1001e948693eSPhilip Paeps (_reg ## _OFST + \ 1002e948693eSPhilip Paeps (3 * sizeof (efx_dword_t)) + \ 1003e948693eSPhilip Paeps ((_index) * _reg ## _STEP)), \ 1004e948693eSPhilip Paeps (_edp), (_lock)); \ 1005e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1006e948693eSPhilip Paeps } while (B_FALSE) 1007e948693eSPhilip Paeps 1008e948693eSPhilip Paeps #define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \ 1009e948693eSPhilip Paeps do { \ 1010e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 1011e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, \ 1012e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 1013e948693eSPhilip Paeps (_eqp)); \ 1014e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \ 1015e948693eSPhilip Paeps uint32_t, (_index), \ 1016e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 1017e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 1018e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 1019e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1020e948693eSPhilip Paeps } while (B_FALSE) 1021e948693eSPhilip Paeps 1022e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \ 1023e948693eSPhilip Paeps do { \ 1024e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 1025e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \ 1026e948693eSPhilip Paeps uint32_t, (_index), \ 1027e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 1028e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 1029e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 1030e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, \ 1031e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 1032e948693eSPhilip Paeps (_eqp)); \ 1033e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1034e948693eSPhilip Paeps } while (B_FALSE) 1035e948693eSPhilip Paeps 10363c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \ 1037e948693eSPhilip Paeps do { \ 1038e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 1039e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, \ 1040e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10413c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 1042e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \ 1043e948693eSPhilip Paeps uint32_t, (_index), \ 1044e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 1045e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 1046e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 1047e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 1048e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 1049e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1050e948693eSPhilip Paeps } while (B_FALSE) 1051e948693eSPhilip Paeps 10523c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \ 1053e948693eSPhilip Paeps do { \ 1054e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 1055e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \ 1056e948693eSPhilip Paeps uint32_t, (_index), \ 1057e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 1058e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 1059e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 1060e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 1061e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 1062e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, \ 1063e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10643c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 10653c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10663c838a9fSAndrew Rybchenko } while (B_FALSE) 10673c838a9fSAndrew Rybchenko 10683c838a9fSAndrew Rybchenko /* 1069c63c8369SAndrew Rybchenko * Accessors for memory BAR per-VI registers. 1070c63c8369SAndrew Rybchenko * 1071c63c8369SAndrew Rybchenko * The VI window size is 8KB for Medford and all earlier controllers. 1072c63c8369SAndrew Rybchenko * For Medford2, the VI window size can be 8KB, 16KB or 64KB. 1073c63c8369SAndrew Rybchenko */ 1074c63c8369SAndrew Rybchenko 1075c63c8369SAndrew Rybchenko #define EFX_BAR_VI_READD(_enp, _reg, _index, _edp, _lock) \ 1076c63c8369SAndrew Rybchenko do { \ 1077c63c8369SAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 1078c63c8369SAndrew Rybchenko EFSYS_BAR_READD((_enp)->en_esbp, \ 1079c63c8369SAndrew Rybchenko ((_reg ## _OFST) + \ 1080c63c8369SAndrew Rybchenko ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \ 1081c63c8369SAndrew Rybchenko (_edp), (_lock)); \ 1082c63c8369SAndrew Rybchenko EFSYS_PROBE4(efx_bar_vi_readd, const char *, #_reg, \ 1083c63c8369SAndrew Rybchenko uint32_t, (_index), \ 1084c63c8369SAndrew Rybchenko uint32_t, _reg ## _OFST, \ 1085c63c8369SAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 1086c63c8369SAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 1087c63c8369SAndrew Rybchenko } while (B_FALSE) 1088c63c8369SAndrew Rybchenko 1089c63c8369SAndrew Rybchenko #define EFX_BAR_VI_WRITED(_enp, _reg, _index, _edp, _lock) \ 1090c63c8369SAndrew Rybchenko do { \ 1091c63c8369SAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 1092c63c8369SAndrew Rybchenko EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \ 1093c63c8369SAndrew Rybchenko uint32_t, (_index), \ 1094c63c8369SAndrew Rybchenko uint32_t, _reg ## _OFST, \ 1095c63c8369SAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 1096c63c8369SAndrew Rybchenko EFSYS_BAR_WRITED((_enp)->en_esbp, \ 1097c63c8369SAndrew Rybchenko ((_reg ## _OFST) + \ 1098c63c8369SAndrew Rybchenko ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \ 1099c63c8369SAndrew Rybchenko (_edp), (_lock)); \ 1100c63c8369SAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 1101c63c8369SAndrew Rybchenko } while (B_FALSE) 1102c63c8369SAndrew Rybchenko 1103c63c8369SAndrew Rybchenko #define EFX_BAR_VI_WRITED2(_enp, _reg, _index, _edp, _lock) \ 1104c63c8369SAndrew Rybchenko do { \ 1105c63c8369SAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 1106c63c8369SAndrew Rybchenko EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \ 1107c63c8369SAndrew Rybchenko uint32_t, (_index), \ 1108c63c8369SAndrew Rybchenko uint32_t, _reg ## _OFST, \ 1109c63c8369SAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 1110c63c8369SAndrew Rybchenko EFSYS_BAR_WRITED((_enp)->en_esbp, \ 1111c63c8369SAndrew Rybchenko ((_reg ## _OFST) + \ 1112c63c8369SAndrew Rybchenko (2 * sizeof (efx_dword_t)) + \ 1113c63c8369SAndrew Rybchenko ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \ 1114c63c8369SAndrew Rybchenko (_edp), (_lock)); \ 1115c63c8369SAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 1116c63c8369SAndrew Rybchenko } while (B_FALSE) 1117c63c8369SAndrew Rybchenko 1118c63c8369SAndrew Rybchenko /* 1119c63c8369SAndrew Rybchenko * Allow drivers to perform optimised 128-bit VI doorbell writes. 11203c838a9fSAndrew Rybchenko * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are 11213c838a9fSAndrew Rybchenko * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid 11223c838a9fSAndrew Rybchenko * the need for locking in the host, and are the only ones known to be safe to 11233c838a9fSAndrew Rybchenko * use 128-bites write with. 11243c838a9fSAndrew Rybchenko */ 1125c63c8369SAndrew Rybchenko #define EFX_BAR_VI_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \ 11263c838a9fSAndrew Rybchenko do { \ 11273c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 1128c63c8369SAndrew Rybchenko EFSYS_PROBE7(efx_bar_vi_doorbell_writeo, \ 112995c45bd0SAndrew Rybchenko const char *, #_reg, \ 11303c838a9fSAndrew Rybchenko uint32_t, (_index), \ 11313c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 11323c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[3], \ 11333c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[2], \ 11343c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[1], \ 11353c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[0]); \ 11363c838a9fSAndrew Rybchenko EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \ 1137c63c8369SAndrew Rybchenko (_reg ## _OFST + \ 1138c63c8369SAndrew Rybchenko ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \ 11393c838a9fSAndrew Rybchenko (_eop)); \ 11403c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 11413c838a9fSAndrew Rybchenko } while (B_FALSE) 11423c838a9fSAndrew Rybchenko 11433c838a9fSAndrew Rybchenko #define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \ 11443c838a9fSAndrew Rybchenko do { \ 11453c838a9fSAndrew Rybchenko unsigned int _new = (_wptr); \ 11463c838a9fSAndrew Rybchenko unsigned int _old = (_owptr); \ 11473c838a9fSAndrew Rybchenko \ 11483c838a9fSAndrew Rybchenko if ((_new) >= (_old)) \ 11493c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 11503c838a9fSAndrew Rybchenko (_old) * sizeof (efx_desc_t), \ 11513c838a9fSAndrew Rybchenko ((_new) - (_old)) * sizeof (efx_desc_t)); \ 11523c838a9fSAndrew Rybchenko else \ 11533c838a9fSAndrew Rybchenko /* \ 11543c838a9fSAndrew Rybchenko * It is cheaper to sync entire map than sync \ 11553c838a9fSAndrew Rybchenko * two parts especially when offset/size are \ 11563c838a9fSAndrew Rybchenko * ignored and entire map is synced in any case.\ 11573c838a9fSAndrew Rybchenko */ \ 11583c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 11593c838a9fSAndrew Rybchenko 0, \ 11603c838a9fSAndrew Rybchenko (_entries) * sizeof (efx_desc_t)); \ 1161e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1162e948693eSPhilip Paeps } while (B_FALSE) 1163e948693eSPhilip Paeps 1164460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1165e948693eSPhilip Paeps efx_mac_select( 1166e948693eSPhilip Paeps __in efx_nic_t *enp); 1167e948693eSPhilip Paeps 11683c838a9fSAndrew Rybchenko extern void 11693c838a9fSAndrew Rybchenko efx_mac_multicast_hash_compute( 11703c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 11713c838a9fSAndrew Rybchenko __in int count, 11723c838a9fSAndrew Rybchenko __out efx_oword_t *hash_low, 11733c838a9fSAndrew Rybchenko __out efx_oword_t *hash_high); 11743c838a9fSAndrew Rybchenko 1175460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1176e948693eSPhilip Paeps efx_phy_probe( 1177e948693eSPhilip Paeps __in efx_nic_t *enp); 1178e948693eSPhilip Paeps 1179e948693eSPhilip Paeps extern void 1180e948693eSPhilip Paeps efx_phy_unprobe( 1181e948693eSPhilip Paeps __in efx_nic_t *enp); 1182e948693eSPhilip Paeps 1183e948693eSPhilip Paeps #if EFSYS_OPT_VPD 1184e948693eSPhilip Paeps 1185e948693eSPhilip Paeps /* VPD utility functions */ 1186e948693eSPhilip Paeps 1187460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1188e948693eSPhilip Paeps efx_vpd_hunk_length( 1189e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1190e948693eSPhilip Paeps __in size_t size, 1191e948693eSPhilip Paeps __out size_t *lengthp); 1192e948693eSPhilip Paeps 1193460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1194e948693eSPhilip Paeps efx_vpd_hunk_verify( 1195e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1196e948693eSPhilip Paeps __in size_t size, 1197e948693eSPhilip Paeps __out_opt boolean_t *cksummedp); 1198e948693eSPhilip Paeps 1199460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1200e948693eSPhilip Paeps efx_vpd_hunk_reinit( 12013c838a9fSAndrew Rybchenko __in_bcount(size) caddr_t data, 1202e948693eSPhilip Paeps __in size_t size, 1203e948693eSPhilip Paeps __in boolean_t wantpid); 1204e948693eSPhilip Paeps 1205460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1206e948693eSPhilip Paeps efx_vpd_hunk_get( 1207e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1208e948693eSPhilip Paeps __in size_t size, 1209e948693eSPhilip Paeps __in efx_vpd_tag_t tag, 1210e948693eSPhilip Paeps __in efx_vpd_keyword_t keyword, 1211e948693eSPhilip Paeps __out unsigned int *payloadp, 1212e948693eSPhilip Paeps __out uint8_t *paylenp); 1213e948693eSPhilip Paeps 1214460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1215e948693eSPhilip Paeps efx_vpd_hunk_next( 1216e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1217e948693eSPhilip Paeps __in size_t size, 1218e948693eSPhilip Paeps __out efx_vpd_tag_t *tagp, 1219e948693eSPhilip Paeps __out efx_vpd_keyword_t *keyword, 122086ec4b85SAndrew Rybchenko __out_opt unsigned int *payloadp, 1221e948693eSPhilip Paeps __out_opt uint8_t *paylenp, 1222e948693eSPhilip Paeps __inout unsigned int *contp); 1223e948693eSPhilip Paeps 1224460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1225e948693eSPhilip Paeps efx_vpd_hunk_set( 1226e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1227e948693eSPhilip Paeps __in size_t size, 1228e948693eSPhilip Paeps __in efx_vpd_value_t *evvp); 1229e948693eSPhilip Paeps 1230e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 1231e948693eSPhilip Paeps 12323c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 12333c838a9fSAndrew Rybchenko 1234460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 12353c838a9fSAndrew Rybchenko efx_mcdi_set_workaround( 12363c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 12373c838a9fSAndrew Rybchenko __in uint32_t type, 12383c838a9fSAndrew Rybchenko __in boolean_t enabled, 12393c838a9fSAndrew Rybchenko __out_opt uint32_t *flagsp); 12403c838a9fSAndrew Rybchenko 1241460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 12423c838a9fSAndrew Rybchenko efx_mcdi_get_workarounds( 12433c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 12443c838a9fSAndrew Rybchenko __out_opt uint32_t *implementedp, 12453c838a9fSAndrew Rybchenko __out_opt uint32_t *enabledp); 12463c838a9fSAndrew Rybchenko 12473c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 12483c838a9fSAndrew Rybchenko 124958a72cb2SAndrew Rybchenko #if EFSYS_OPT_MAC_STATS 125058a72cb2SAndrew Rybchenko 125158a72cb2SAndrew Rybchenko /* 125258a72cb2SAndrew Rybchenko * Closed range of stats (i.e. the first and the last are included). 125358a72cb2SAndrew Rybchenko * The last must be greater or equal (if the range is one item only) to 125458a72cb2SAndrew Rybchenko * the first. 125558a72cb2SAndrew Rybchenko */ 125658a72cb2SAndrew Rybchenko struct efx_mac_stats_range { 125758a72cb2SAndrew Rybchenko efx_mac_stat_t first; 125858a72cb2SAndrew Rybchenko efx_mac_stat_t last; 125958a72cb2SAndrew Rybchenko }; 126058a72cb2SAndrew Rybchenko 126158a72cb2SAndrew Rybchenko extern efx_rc_t 126258a72cb2SAndrew Rybchenko efx_mac_stats_mask_add_ranges( 126358a72cb2SAndrew Rybchenko __inout_bcount(mask_size) uint32_t *maskp, 126458a72cb2SAndrew Rybchenko __in size_t mask_size, 126558a72cb2SAndrew Rybchenko __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, 126658a72cb2SAndrew Rybchenko __in unsigned int rng_count); 126758a72cb2SAndrew Rybchenko 126858a72cb2SAndrew Rybchenko #endif /* EFSYS_OPT_MAC_STATS */ 126958a72cb2SAndrew Rybchenko 1270e948693eSPhilip Paeps #ifdef __cplusplus 1271e948693eSPhilip Paeps } 1272e948693eSPhilip Paeps #endif 1273e948693eSPhilip Paeps 1274e948693eSPhilip Paeps #endif /* _SYS_EFX_IMPL_H */ 1275