1e948693eSPhilip Paeps /*- 23c838a9fSAndrew Rybchenko * Copyright (c) 2007-2015 Solarflare Communications Inc. 33c838a9fSAndrew Rybchenko * All rights reserved. 4e948693eSPhilip Paeps * 5e948693eSPhilip Paeps * Redistribution and use in source and binary forms, with or without 63c838a9fSAndrew Rybchenko * modification, are permitted provided that the following conditions are met: 7e948693eSPhilip Paeps * 83c838a9fSAndrew Rybchenko * 1. Redistributions of source code must retain the above copyright notice, 93c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer. 103c838a9fSAndrew Rybchenko * 2. Redistributions in binary form must reproduce the above copyright notice, 113c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer in the documentation 123c838a9fSAndrew Rybchenko * and/or other materials provided with the distribution. 133c838a9fSAndrew Rybchenko * 143c838a9fSAndrew Rybchenko * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 153c838a9fSAndrew Rybchenko * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 163c838a9fSAndrew Rybchenko * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 173c838a9fSAndrew Rybchenko * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 183c838a9fSAndrew Rybchenko * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 193c838a9fSAndrew Rybchenko * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 203c838a9fSAndrew Rybchenko * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 213c838a9fSAndrew Rybchenko * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 223c838a9fSAndrew Rybchenko * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 233c838a9fSAndrew Rybchenko * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 243c838a9fSAndrew Rybchenko * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 253c838a9fSAndrew Rybchenko * 263c838a9fSAndrew Rybchenko * The views and conclusions contained in the software and documentation are 273c838a9fSAndrew Rybchenko * those of the authors and should not be interpreted as representing official 283c838a9fSAndrew Rybchenko * policies, either expressed or implied, of the FreeBSD Project. 295dee87d7SPhilip Paeps * 305dee87d7SPhilip Paeps * $FreeBSD$ 31e948693eSPhilip Paeps */ 32e948693eSPhilip Paeps 33e948693eSPhilip Paeps #ifndef _SYS_EFX_IMPL_H 34e948693eSPhilip Paeps #define _SYS_EFX_IMPL_H 35e948693eSPhilip Paeps 36e948693eSPhilip Paeps #include "efx.h" 37e948693eSPhilip Paeps #include "efx_regs.h" 383c838a9fSAndrew Rybchenko #include "efx_regs_ef10.h" 393c838a9fSAndrew Rybchenko 403c838a9fSAndrew Rybchenko /* FIXME: Add definition for driver generated software events */ 413c838a9fSAndrew Rybchenko #ifndef ESE_DZ_EV_CODE_DRV_GEN_EV 423c838a9fSAndrew Rybchenko #define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV 433c838a9fSAndrew Rybchenko #endif 443c838a9fSAndrew Rybchenko 45e948693eSPhilip Paeps 46e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 47e948693eSPhilip Paeps #include "siena_impl.h" 48e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 49e948693eSPhilip Paeps 503c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 513c838a9fSAndrew Rybchenko #include "hunt_impl.h" 523c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON */ 533c838a9fSAndrew Rybchenko 545f5c71ccSAndrew Rybchenko #if EFSYS_OPT_MEDFORD 555f5c71ccSAndrew Rybchenko #include "medford_impl.h" 565f5c71ccSAndrew Rybchenko #endif /* EFSYS_OPT_MEDFORD */ 575f5c71ccSAndrew Rybchenko 585f5c71ccSAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 595f5c71ccSAndrew Rybchenko #include "ef10_impl.h" 605f5c71ccSAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 615f5c71ccSAndrew Rybchenko 62e948693eSPhilip Paeps #ifdef __cplusplus 63e948693eSPhilip Paeps extern "C" { 64e948693eSPhilip Paeps #endif 65e948693eSPhilip Paeps 66e948693eSPhilip Paeps #define EFX_MOD_MCDI 0x00000001 67e948693eSPhilip Paeps #define EFX_MOD_PROBE 0x00000002 68e948693eSPhilip Paeps #define EFX_MOD_NVRAM 0x00000004 69e948693eSPhilip Paeps #define EFX_MOD_VPD 0x00000008 70e948693eSPhilip Paeps #define EFX_MOD_NIC 0x00000010 71e948693eSPhilip Paeps #define EFX_MOD_INTR 0x00000020 72e948693eSPhilip Paeps #define EFX_MOD_EV 0x00000040 73e948693eSPhilip Paeps #define EFX_MOD_RX 0x00000080 74e948693eSPhilip Paeps #define EFX_MOD_TX 0x00000100 75e948693eSPhilip Paeps #define EFX_MOD_PORT 0x00000200 76e948693eSPhilip Paeps #define EFX_MOD_MON 0x00000400 77e948693eSPhilip Paeps #define EFX_MOD_WOL 0x00000800 78e948693eSPhilip Paeps #define EFX_MOD_FILTER 0x00001000 79908ecfc6SAndrew Rybchenko #define EFX_MOD_LIC 0x00002000 80e948693eSPhilip Paeps 81e948693eSPhilip Paeps #define EFX_RESET_MAC 0x00000001 82e948693eSPhilip Paeps #define EFX_RESET_PHY 0x00000002 833c838a9fSAndrew Rybchenko #define EFX_RESET_RXQ_ERR 0x00000004 843c838a9fSAndrew Rybchenko #define EFX_RESET_TXQ_ERR 0x00000008 85e948693eSPhilip Paeps 86e948693eSPhilip Paeps typedef enum efx_mac_type_e { 87e948693eSPhilip Paeps EFX_MAC_INVALID = 0, 88e948693eSPhilip Paeps EFX_MAC_SIENA, 893c838a9fSAndrew Rybchenko EFX_MAC_HUNTINGTON, 90c15d6d21SAndrew Rybchenko EFX_MAC_MEDFORD, 91e948693eSPhilip Paeps EFX_MAC_NTYPES 92e948693eSPhilip Paeps } efx_mac_type_t; 93e948693eSPhilip Paeps 943c838a9fSAndrew Rybchenko typedef struct efx_ev_ops_s { 95460cb568SAndrew Rybchenko efx_rc_t (*eevo_init)(efx_nic_t *); 963c838a9fSAndrew Rybchenko void (*eevo_fini)(efx_nic_t *); 97460cb568SAndrew Rybchenko efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int, 983c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 993c838a9fSAndrew Rybchenko efx_evq_t *); 1003c838a9fSAndrew Rybchenko void (*eevo_qdestroy)(efx_evq_t *); 101460cb568SAndrew Rybchenko efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int); 1023c838a9fSAndrew Rybchenko void (*eevo_qpost)(efx_evq_t *, uint16_t); 103460cb568SAndrew Rybchenko efx_rc_t (*eevo_qmoderate)(efx_evq_t *, unsigned int); 1043c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1053c838a9fSAndrew Rybchenko void (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *); 1063c838a9fSAndrew Rybchenko #endif 1073c838a9fSAndrew Rybchenko } efx_ev_ops_t; 1083c838a9fSAndrew Rybchenko 1093c838a9fSAndrew Rybchenko typedef struct efx_tx_ops_s { 110460cb568SAndrew Rybchenko efx_rc_t (*etxo_init)(efx_nic_t *); 1113c838a9fSAndrew Rybchenko void (*etxo_fini)(efx_nic_t *); 112460cb568SAndrew Rybchenko efx_rc_t (*etxo_qcreate)(efx_nic_t *, 1133c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1143c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, 1153c838a9fSAndrew Rybchenko uint32_t, uint16_t, 1163c838a9fSAndrew Rybchenko efx_evq_t *, efx_txq_t *, 1173c838a9fSAndrew Rybchenko unsigned int *); 1183c838a9fSAndrew Rybchenko void (*etxo_qdestroy)(efx_txq_t *); 119460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpost)(efx_txq_t *, efx_buffer_t *, 1203c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1213c838a9fSAndrew Rybchenko unsigned int *); 1223c838a9fSAndrew Rybchenko void (*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int); 123460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpace)(efx_txq_t *, unsigned int); 124460cb568SAndrew Rybchenko efx_rc_t (*etxo_qflush)(efx_txq_t *); 1253c838a9fSAndrew Rybchenko void (*etxo_qenable)(efx_txq_t *); 126460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_enable)(efx_txq_t *); 1273c838a9fSAndrew Rybchenko void (*etxo_qpio_disable)(efx_txq_t *); 128460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_write)(efx_txq_t *,uint8_t *, size_t, 1293c838a9fSAndrew Rybchenko size_t); 130460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int, 1313c838a9fSAndrew Rybchenko unsigned int *); 132460cb568SAndrew Rybchenko efx_rc_t (*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *, 1333c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1343c838a9fSAndrew Rybchenko unsigned int *); 1353c838a9fSAndrew Rybchenko void (*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t, 1363c838a9fSAndrew Rybchenko size_t, boolean_t, 1373c838a9fSAndrew Rybchenko efx_desc_t *); 1383c838a9fSAndrew Rybchenko void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t, 1393c838a9fSAndrew Rybchenko uint32_t, uint8_t, 1403c838a9fSAndrew Rybchenko efx_desc_t *); 1414ab49369SAndrew Rybchenko void (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t, 1424ab49369SAndrew Rybchenko uint32_t, uint16_t, 1434ab49369SAndrew Rybchenko efx_desc_t *, int); 1443c838a9fSAndrew Rybchenko void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t, 1453c838a9fSAndrew Rybchenko efx_desc_t *); 1463c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1473c838a9fSAndrew Rybchenko void (*etxo_qstats_update)(efx_txq_t *, 1483c838a9fSAndrew Rybchenko efsys_stat_t *); 1493c838a9fSAndrew Rybchenko #endif 1503c838a9fSAndrew Rybchenko } efx_tx_ops_t; 1513c838a9fSAndrew Rybchenko 1523c838a9fSAndrew Rybchenko typedef struct efx_rx_ops_s { 153460cb568SAndrew Rybchenko efx_rc_t (*erxo_init)(efx_nic_t *); 1543c838a9fSAndrew Rybchenko void (*erxo_fini)(efx_nic_t *); 1553c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCATTER 156460cb568SAndrew Rybchenko efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int); 1573c838a9fSAndrew Rybchenko #endif 1583c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 159460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_mode_set)(efx_nic_t *, efx_rx_hash_alg_t, 1603c838a9fSAndrew Rybchenko efx_rx_hash_type_t, boolean_t); 161460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t); 162460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, unsigned int *, 1633c838a9fSAndrew Rybchenko size_t); 1640badfd72SAndrew Rybchenko uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t, 1650badfd72SAndrew Rybchenko uint8_t *); 1660badfd72SAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 1670badfd72SAndrew Rybchenko efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *, 1680badfd72SAndrew Rybchenko uint16_t *); 1693c838a9fSAndrew Rybchenko void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t, 1703c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1713c838a9fSAndrew Rybchenko unsigned int); 1723c838a9fSAndrew Rybchenko void (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *); 173460cb568SAndrew Rybchenko efx_rc_t (*erxo_qflush)(efx_rxq_t *); 1743c838a9fSAndrew Rybchenko void (*erxo_qenable)(efx_rxq_t *); 175460cb568SAndrew Rybchenko efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int, 1763c838a9fSAndrew Rybchenko unsigned int, efx_rxq_type_t, 1773c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 1783c838a9fSAndrew Rybchenko efx_evq_t *, efx_rxq_t *); 1793c838a9fSAndrew Rybchenko void (*erxo_qdestroy)(efx_rxq_t *); 1803c838a9fSAndrew Rybchenko } efx_rx_ops_t; 1813c838a9fSAndrew Rybchenko 182e948693eSPhilip Paeps typedef struct efx_mac_ops_s { 183460cb568SAndrew Rybchenko efx_rc_t (*emo_reset)(efx_nic_t *); /* optional */ 184460cb568SAndrew Rybchenko efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *); 185460cb568SAndrew Rybchenko efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *); 186460cb568SAndrew Rybchenko efx_rc_t (*emo_addr_set)(efx_nic_t *); 18708c5af79SAndrew Rybchenko efx_rc_t (*emo_pdu_set)(efx_nic_t *); 188460cb568SAndrew Rybchenko efx_rc_t (*emo_reconfigure)(efx_nic_t *); 189460cb568SAndrew Rybchenko efx_rc_t (*emo_multicast_list_set)(efx_nic_t *); 190460cb568SAndrew Rybchenko efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *, 1913c838a9fSAndrew Rybchenko efx_rxq_t *, boolean_t); 1923c838a9fSAndrew Rybchenko void (*emo_filter_default_rxq_clear)(efx_nic_t *); 193e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 194460cb568SAndrew Rybchenko efx_rc_t (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t, 195e948693eSPhilip Paeps efx_loopback_type_t); 196e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 197e948693eSPhilip Paeps #if EFSYS_OPT_MAC_STATS 198460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); 199460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, 200e948693eSPhilip Paeps uint16_t, boolean_t); 201460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 202e948693eSPhilip Paeps efsys_stat_t *, uint32_t *); 203e948693eSPhilip Paeps #endif /* EFSYS_OPT_MAC_STATS */ 204e948693eSPhilip Paeps } efx_mac_ops_t; 205e948693eSPhilip Paeps 206e948693eSPhilip Paeps typedef struct efx_phy_ops_s { 207460cb568SAndrew Rybchenko efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */ 208460cb568SAndrew Rybchenko efx_rc_t (*epo_reset)(efx_nic_t *); 209460cb568SAndrew Rybchenko efx_rc_t (*epo_reconfigure)(efx_nic_t *); 210460cb568SAndrew Rybchenko efx_rc_t (*epo_verify)(efx_nic_t *); 211460cb568SAndrew Rybchenko efx_rc_t (*epo_uplink_check)(efx_nic_t *, 212e948693eSPhilip Paeps boolean_t *); /* optional */ 213460cb568SAndrew Rybchenko efx_rc_t (*epo_downlink_check)(efx_nic_t *, efx_link_mode_t *, 214e948693eSPhilip Paeps unsigned int *, uint32_t *); 215460cb568SAndrew Rybchenko efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *); 216e948693eSPhilip Paeps #if EFSYS_OPT_PHY_STATS 217460cb568SAndrew Rybchenko efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *, 218e948693eSPhilip Paeps uint32_t *); 219e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_STATS */ 220e948693eSPhilip Paeps #if EFSYS_OPT_PHY_PROPS 221e948693eSPhilip Paeps #if EFSYS_OPT_NAMES 2223c838a9fSAndrew Rybchenko const char *(*epo_prop_name)(efx_nic_t *, unsigned int); 223e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_PROPS */ 224460cb568SAndrew Rybchenko efx_rc_t (*epo_prop_get)(efx_nic_t *, unsigned int, uint32_t, 225e948693eSPhilip Paeps uint32_t *); 226460cb568SAndrew Rybchenko efx_rc_t (*epo_prop_set)(efx_nic_t *, unsigned int, uint32_t); 227e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_PROPS */ 2283c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 229460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *); 230460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t); 231460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t, 2323c838a9fSAndrew Rybchenko efx_bist_result_t *, uint32_t *, 233e948693eSPhilip Paeps unsigned long *, size_t); 2343c838a9fSAndrew Rybchenko void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t); 2353c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_BIST */ 236e948693eSPhilip Paeps } efx_phy_ops_t; 237e948693eSPhilip Paeps 2383c838a9fSAndrew Rybchenko #if EFSYS_OPT_FILTER 2393c838a9fSAndrew Rybchenko typedef struct efx_filter_ops_s { 240460cb568SAndrew Rybchenko efx_rc_t (*efo_init)(efx_nic_t *); 2413c838a9fSAndrew Rybchenko void (*efo_fini)(efx_nic_t *); 242460cb568SAndrew Rybchenko efx_rc_t (*efo_restore)(efx_nic_t *); 243460cb568SAndrew Rybchenko efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *, 2443c838a9fSAndrew Rybchenko boolean_t may_replace); 245460cb568SAndrew Rybchenko efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *); 246460cb568SAndrew Rybchenko efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *); 247460cb568SAndrew Rybchenko efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t, 2483c838a9fSAndrew Rybchenko boolean_t, boolean_t, boolean_t, 24947cb5106SAndrew Rybchenko uint8_t const *, uint32_t); 2503c838a9fSAndrew Rybchenko } efx_filter_ops_t; 2513c838a9fSAndrew Rybchenko 252460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 2533c838a9fSAndrew Rybchenko efx_filter_reconfigure( 2543c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 2553c838a9fSAndrew Rybchenko __in_ecount(6) uint8_t const *mac_addr, 2563c838a9fSAndrew Rybchenko __in boolean_t all_unicst, 2573c838a9fSAndrew Rybchenko __in boolean_t mulcst, 2583c838a9fSAndrew Rybchenko __in boolean_t all_mulcst, 2593c838a9fSAndrew Rybchenko __in boolean_t brdcst, 2603c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 26147cb5106SAndrew Rybchenko __in uint32_t count); 2623c838a9fSAndrew Rybchenko 2633c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_FILTER */ 2643c838a9fSAndrew Rybchenko 2653c838a9fSAndrew Rybchenko 266e948693eSPhilip Paeps typedef struct efx_port_s { 267e948693eSPhilip Paeps efx_mac_type_t ep_mac_type; 268e948693eSPhilip Paeps uint32_t ep_phy_type; 269e948693eSPhilip Paeps uint8_t ep_port; 270e948693eSPhilip Paeps uint32_t ep_mac_pdu; 271e948693eSPhilip Paeps uint8_t ep_mac_addr[6]; 272e948693eSPhilip Paeps efx_link_mode_t ep_link_mode; 2733c838a9fSAndrew Rybchenko boolean_t ep_all_unicst; 2743c838a9fSAndrew Rybchenko boolean_t ep_mulcst; 2753c838a9fSAndrew Rybchenko boolean_t ep_all_mulcst; 276e948693eSPhilip Paeps boolean_t ep_brdcst; 277e948693eSPhilip Paeps unsigned int ep_fcntl; 278e948693eSPhilip Paeps boolean_t ep_fcntl_autoneg; 279e948693eSPhilip Paeps efx_oword_t ep_multicst_hash[2]; 2803c838a9fSAndrew Rybchenko uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN * 2813c838a9fSAndrew Rybchenko EFX_MAC_MULTICAST_LIST_MAX]; 2823c838a9fSAndrew Rybchenko uint32_t ep_mulcst_addr_count; 283e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 284e948693eSPhilip Paeps efx_loopback_type_t ep_loopback_type; 285e948693eSPhilip Paeps efx_link_mode_t ep_loopback_link_mode; 286e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 287e948693eSPhilip Paeps #if EFSYS_OPT_PHY_FLAGS 288e948693eSPhilip Paeps uint32_t ep_phy_flags; 289e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_FLAGS */ 290e948693eSPhilip Paeps #if EFSYS_OPT_PHY_LED_CONTROL 291e948693eSPhilip Paeps efx_phy_led_mode_t ep_phy_led_mode; 292e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_LED_CONTROL */ 293e948693eSPhilip Paeps efx_phy_media_type_t ep_fixed_port_type; 294e948693eSPhilip Paeps efx_phy_media_type_t ep_module_type; 295e948693eSPhilip Paeps uint32_t ep_adv_cap_mask; 296e948693eSPhilip Paeps uint32_t ep_lp_cap_mask; 297e948693eSPhilip Paeps uint32_t ep_default_adv_cap_mask; 298e948693eSPhilip Paeps uint32_t ep_phy_cap_mask; 299e948693eSPhilip Paeps boolean_t ep_mac_drain; 300e948693eSPhilip Paeps boolean_t ep_mac_stats_pending; 3013c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 3023c838a9fSAndrew Rybchenko efx_bist_type_t ep_current_bist; 303e948693eSPhilip Paeps #endif 304*ec831f7fSAndrew Rybchenko const efx_mac_ops_t *ep_emop; 305*ec831f7fSAndrew Rybchenko const efx_phy_ops_t *ep_epop; 306e948693eSPhilip Paeps } efx_port_t; 307e948693eSPhilip Paeps 308e948693eSPhilip Paeps typedef struct efx_mon_ops_s { 309460cb568SAndrew Rybchenko efx_rc_t (*emo_reset)(efx_nic_t *); 310460cb568SAndrew Rybchenko efx_rc_t (*emo_reconfigure)(efx_nic_t *); 311e948693eSPhilip Paeps #if EFSYS_OPT_MON_STATS 312460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 313e948693eSPhilip Paeps efx_mon_stat_value_t *); 314e948693eSPhilip Paeps #endif /* EFSYS_OPT_MON_STATS */ 315e948693eSPhilip Paeps } efx_mon_ops_t; 316e948693eSPhilip Paeps 317e948693eSPhilip Paeps typedef struct efx_mon_s { 318e948693eSPhilip Paeps efx_mon_type_t em_type; 319*ec831f7fSAndrew Rybchenko const efx_mon_ops_t *em_emop; 320e948693eSPhilip Paeps } efx_mon_t; 321e948693eSPhilip Paeps 3223c838a9fSAndrew Rybchenko typedef struct efx_intr_ops_s { 323460cb568SAndrew Rybchenko efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *); 3243c838a9fSAndrew Rybchenko void (*eio_enable)(efx_nic_t *); 3253c838a9fSAndrew Rybchenko void (*eio_disable)(efx_nic_t *); 3263c838a9fSAndrew Rybchenko void (*eio_disable_unlocked)(efx_nic_t *); 327460cb568SAndrew Rybchenko efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int); 3280c24a07eSAndrew Rybchenko void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *); 3290c24a07eSAndrew Rybchenko void (*eio_status_message)(efx_nic_t *, unsigned int, 3300c24a07eSAndrew Rybchenko boolean_t *); 3310c24a07eSAndrew Rybchenko void (*eio_fatal)(efx_nic_t *); 3323c838a9fSAndrew Rybchenko void (*eio_fini)(efx_nic_t *); 3333c838a9fSAndrew Rybchenko } efx_intr_ops_t; 3343c838a9fSAndrew Rybchenko 335e948693eSPhilip Paeps typedef struct efx_intr_s { 336*ec831f7fSAndrew Rybchenko const efx_intr_ops_t *ei_eiop; 337e948693eSPhilip Paeps efsys_mem_t *ei_esmp; 3383c838a9fSAndrew Rybchenko efx_intr_type_t ei_type; 339e948693eSPhilip Paeps unsigned int ei_level; 340e948693eSPhilip Paeps } efx_intr_t; 341e948693eSPhilip Paeps 342e948693eSPhilip Paeps typedef struct efx_nic_ops_s { 343460cb568SAndrew Rybchenko efx_rc_t (*eno_probe)(efx_nic_t *); 344cfa023ebSAndrew Rybchenko efx_rc_t (*eno_board_cfg)(efx_nic_t *); 345460cb568SAndrew Rybchenko efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*); 346460cb568SAndrew Rybchenko efx_rc_t (*eno_reset)(efx_nic_t *); 347460cb568SAndrew Rybchenko efx_rc_t (*eno_init)(efx_nic_t *); 348460cb568SAndrew Rybchenko efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *); 349460cb568SAndrew Rybchenko efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t, 3503c838a9fSAndrew Rybchenko uint32_t *, size_t *); 351e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 352460cb568SAndrew Rybchenko efx_rc_t (*eno_register_test)(efx_nic_t *); 353e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 354e948693eSPhilip Paeps void (*eno_fini)(efx_nic_t *); 355e948693eSPhilip Paeps void (*eno_unprobe)(efx_nic_t *); 356e948693eSPhilip Paeps } efx_nic_ops_t; 357e948693eSPhilip Paeps 3589ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_LIMIT_TARGET 359e948693eSPhilip Paeps #define EFX_TXQ_LIMIT_TARGET 259 3609ab060a7SAndrew Rybchenko #endif 3619ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_LIMIT_TARGET 36275ba9e1eSAndrew Rybchenko #define EFX_RXQ_LIMIT_TARGET 512 3639ab060a7SAndrew Rybchenko #endif 3649ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_DC_SIZE 3659ab060a7SAndrew Rybchenko #define EFX_TXQ_DC_SIZE 1 /* 16 descriptors */ 3669ab060a7SAndrew Rybchenko #endif 3679ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_DC_SIZE 3689ab060a7SAndrew Rybchenko #define EFX_RXQ_DC_SIZE 3 /* 64 descriptors */ 3699ab060a7SAndrew Rybchenko #endif 370e948693eSPhilip Paeps 371e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 372e948693eSPhilip Paeps 3733c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_spec_s { 3743c838a9fSAndrew Rybchenko uint8_t fsfs_type; 3753c838a9fSAndrew Rybchenko uint32_t fsfs_flags; 3763c838a9fSAndrew Rybchenko uint32_t fsfs_dmaq_id; 3773c838a9fSAndrew Rybchenko uint32_t fsfs_dword[3]; 3783c838a9fSAndrew Rybchenko } falconsiena_filter_spec_t; 3793c838a9fSAndrew Rybchenko 3803c838a9fSAndrew Rybchenko typedef enum falconsiena_filter_type_e { 3813c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_TCP_FULL, /* TCP/IPv4 4-tuple {dIP,dTCP,sIP,sTCP} */ 3823c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_TCP_WILD, /* TCP/IPv4 dest {dIP,dTCP, -, -} */ 3833c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_UDP_FULL, /* UDP/IPv4 4-tuple {dIP,dUDP,sIP,sUDP} */ 3843c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_UDP_WILD, /* UDP/IPv4 dest {dIP,dUDP, -, -} */ 385e948693eSPhilip Paeps 386e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 3873c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */ 3883c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */ 389e948693eSPhilip Paeps 3903c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 3913c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */ 3923c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */ 3933c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_UDP_WILD, /* UDP/IPv4 source (host, port) */ 394e948693eSPhilip Paeps 3953c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_MAC_FULL, /* Ethernet source (MAC address, VLAN ID) */ 3963c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_MAC_WILD, /* Ethernet source (MAC address) */ 397e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 398e948693eSPhilip Paeps 3993c838a9fSAndrew Rybchenko EFX_FS_FILTER_NTYPES 4003c838a9fSAndrew Rybchenko } falconsiena_filter_type_t; 401e948693eSPhilip Paeps 4023c838a9fSAndrew Rybchenko typedef enum falconsiena_filter_tbl_id_e { 4033c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_RX_IP = 0, 4043c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_RX_MAC, 4053c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_TX_IP, 4063c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_TX_MAC, 4073c838a9fSAndrew Rybchenko EFX_FS_FILTER_NTBLS 4083c838a9fSAndrew Rybchenko } falconsiena_filter_tbl_id_t; 409e948693eSPhilip Paeps 4103c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_tbl_s { 4113c838a9fSAndrew Rybchenko int fsft_size; /* number of entries */ 4123c838a9fSAndrew Rybchenko int fsft_used; /* active count */ 4133c838a9fSAndrew Rybchenko uint32_t *fsft_bitmap; /* active bitmap */ 4143c838a9fSAndrew Rybchenko falconsiena_filter_spec_t *fsft_spec; /* array of saved specs */ 4153c838a9fSAndrew Rybchenko } falconsiena_filter_tbl_t; 4163c838a9fSAndrew Rybchenko 4173c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_s { 4183c838a9fSAndrew Rybchenko falconsiena_filter_tbl_t fsf_tbl[EFX_FS_FILTER_NTBLS]; 4193c838a9fSAndrew Rybchenko unsigned int fsf_depth[EFX_FS_FILTER_NTYPES]; 4203c838a9fSAndrew Rybchenko } falconsiena_filter_t; 421e948693eSPhilip Paeps 422e948693eSPhilip Paeps typedef struct efx_filter_s { 423e75412c9SAndrew Rybchenko #if EFSYS_OPT_SIENA 4243c838a9fSAndrew Rybchenko falconsiena_filter_t *ef_falconsiena_filter; 425e75412c9SAndrew Rybchenko #endif /* EFSYS_OPT_SIENA */ 4261289fe72SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD 4271289fe72SAndrew Rybchenko ef10_filter_table_t *ef_ef10_filter_table; 4281289fe72SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ 429e948693eSPhilip Paeps } efx_filter_t; 430e948693eSPhilip Paeps 431e948693eSPhilip Paeps extern void 4323c838a9fSAndrew Rybchenko falconsiena_filter_tbl_clear( 433e948693eSPhilip Paeps __in efx_nic_t *enp, 4343c838a9fSAndrew Rybchenko __in falconsiena_filter_tbl_id_t tbl); 435e948693eSPhilip Paeps 436e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 437e948693eSPhilip Paeps 4383c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 4393c838a9fSAndrew Rybchenko 4403c838a9fSAndrew Rybchenko typedef struct efx_mcdi_ops_s { 441460cb568SAndrew Rybchenko efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *); 442fd7501bfSAndrew Rybchenko void (*emco_send_request)(efx_nic_t *, void *, size_t, 443fd7501bfSAndrew Rybchenko void *, size_t); 444460cb568SAndrew Rybchenko efx_rc_t (*emco_poll_reboot)(efx_nic_t *); 445548ebee5SAndrew Rybchenko boolean_t (*emco_poll_response)(efx_nic_t *); 446548ebee5SAndrew Rybchenko void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); 4473c838a9fSAndrew Rybchenko void (*emco_fini)(efx_nic_t *); 448af986c75SAndrew Rybchenko efx_rc_t (*emco_feature_supported)(efx_nic_t *, efx_mcdi_feature_id_t, boolean_t *); 4493c838a9fSAndrew Rybchenko } efx_mcdi_ops_t; 4503c838a9fSAndrew Rybchenko 4513c838a9fSAndrew Rybchenko typedef struct efx_mcdi_s { 452*ec831f7fSAndrew Rybchenko const efx_mcdi_ops_t *em_emcop; 4533c838a9fSAndrew Rybchenko const efx_mcdi_transport_t *em_emtp; 4543c838a9fSAndrew Rybchenko efx_mcdi_iface_t em_emip; 4553c838a9fSAndrew Rybchenko } efx_mcdi_t; 4563c838a9fSAndrew Rybchenko 4573c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 4583c838a9fSAndrew Rybchenko 459e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 460e948693eSPhilip Paeps typedef struct efx_nvram_ops_s { 461e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 462460cb568SAndrew Rybchenko efx_rc_t (*envo_test)(efx_nic_t *); 463e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 464bce88e31SAndrew Rybchenko efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, 465bce88e31SAndrew Rybchenko uint32_t *); 46656bd83b0SAndrew Rybchenko efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *); 4675d846e87SAndrew Rybchenko efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *); 4680afdf29cSAndrew Rybchenko efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t, 4690afdf29cSAndrew Rybchenko unsigned int, caddr_t, size_t); 470b60ff840SAndrew Rybchenko efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t, 471b60ff840SAndrew Rybchenko unsigned int, size_t); 472134c4c4aSAndrew Rybchenko efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t, 473134c4c4aSAndrew Rybchenko unsigned int, caddr_t, size_t); 474eb9703daSAndrew Rybchenko void (*envo_partn_rw_finish)(efx_nic_t *, uint32_t); 47592187119SAndrew Rybchenko efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t, 47692187119SAndrew Rybchenko uint32_t *, uint16_t *); 4776d0b856cSAndrew Rybchenko efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t, 4786d0b856cSAndrew Rybchenko uint16_t *); 4795abce2b9SAndrew Rybchenko efx_rc_t (*envo_buffer_validate)(efx_nic_t *, uint32_t, 4805abce2b9SAndrew Rybchenko caddr_t, size_t); 481e948693eSPhilip Paeps } efx_nvram_ops_t; 482e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 483e948693eSPhilip Paeps 4845abce2b9SAndrew Rybchenko extern __checkReturn efx_rc_t 4855abce2b9SAndrew Rybchenko efx_nvram_tlv_validate( 4865abce2b9SAndrew Rybchenko __in efx_nic_t *enp, 4875abce2b9SAndrew Rybchenko __in uint32_t partn, 4885abce2b9SAndrew Rybchenko __in_bcount(partn_size) caddr_t partn_data, 4895abce2b9SAndrew Rybchenko __in size_t partn_size); 4905abce2b9SAndrew Rybchenko 4915abce2b9SAndrew Rybchenko 492e948693eSPhilip Paeps #if EFSYS_OPT_VPD 493e948693eSPhilip Paeps typedef struct efx_vpd_ops_s { 494460cb568SAndrew Rybchenko efx_rc_t (*evpdo_init)(efx_nic_t *); 495460cb568SAndrew Rybchenko efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *); 496460cb568SAndrew Rybchenko efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t); 497460cb568SAndrew Rybchenko efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t); 498460cb568SAndrew Rybchenko efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t); 499460cb568SAndrew Rybchenko efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t, 500460cb568SAndrew Rybchenko efx_vpd_value_t *); 501460cb568SAndrew Rybchenko efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t, 502460cb568SAndrew Rybchenko efx_vpd_value_t *); 503460cb568SAndrew Rybchenko efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t, 504460cb568SAndrew Rybchenko efx_vpd_value_t *, unsigned int *); 505460cb568SAndrew Rybchenko efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t); 506e948693eSPhilip Paeps void (*evpdo_fini)(efx_nic_t *); 507e948693eSPhilip Paeps } efx_vpd_ops_t; 508e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 509e948693eSPhilip Paeps 5103c838a9fSAndrew Rybchenko #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM 5113c838a9fSAndrew Rybchenko 512460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5133c838a9fSAndrew Rybchenko efx_mcdi_nvram_partitions( 5143c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5153c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5163c838a9fSAndrew Rybchenko __in size_t size, 5173c838a9fSAndrew Rybchenko __out unsigned int *npartnp); 5183c838a9fSAndrew Rybchenko 519460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5203c838a9fSAndrew Rybchenko efx_mcdi_nvram_metadata( 5213c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5223c838a9fSAndrew Rybchenko __in uint32_t partn, 5233c838a9fSAndrew Rybchenko __out uint32_t *subtypep, 5243c838a9fSAndrew Rybchenko __out_ecount(4) uint16_t version[4], 5253c838a9fSAndrew Rybchenko __out_bcount_opt(size) char *descp, 5263c838a9fSAndrew Rybchenko __in size_t size); 5273c838a9fSAndrew Rybchenko 528460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5293c838a9fSAndrew Rybchenko efx_mcdi_nvram_info( 5303c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5313c838a9fSAndrew Rybchenko __in uint32_t partn, 5323c838a9fSAndrew Rybchenko __out_opt size_t *sizep, 5333c838a9fSAndrew Rybchenko __out_opt uint32_t *addressp, 5349cb71b16SAndrew Rybchenko __out_opt uint32_t *erase_sizep, 5359cb71b16SAndrew Rybchenko __out_opt uint32_t *write_sizep); 5363c838a9fSAndrew Rybchenko 537460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5383c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_start( 5393c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5403c838a9fSAndrew Rybchenko __in uint32_t partn); 5413c838a9fSAndrew Rybchenko 542460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5433c838a9fSAndrew Rybchenko efx_mcdi_nvram_read( 5443c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5453c838a9fSAndrew Rybchenko __in uint32_t partn, 5463c838a9fSAndrew Rybchenko __in uint32_t offset, 5473c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5489ad7e03fSAndrew Rybchenko __in size_t size, 5499ad7e03fSAndrew Rybchenko __in uint32_t mode); 5503c838a9fSAndrew Rybchenko 551460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5523c838a9fSAndrew Rybchenko efx_mcdi_nvram_erase( 5533c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5543c838a9fSAndrew Rybchenko __in uint32_t partn, 5553c838a9fSAndrew Rybchenko __in uint32_t offset, 5563c838a9fSAndrew Rybchenko __in size_t size); 5573c838a9fSAndrew Rybchenko 558460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5593c838a9fSAndrew Rybchenko efx_mcdi_nvram_write( 5603c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5613c838a9fSAndrew Rybchenko __in uint32_t partn, 5623c838a9fSAndrew Rybchenko __in uint32_t offset, 5633c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5643c838a9fSAndrew Rybchenko __in size_t size); 5653c838a9fSAndrew Rybchenko 566460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5673c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_finish( 5683c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5693c838a9fSAndrew Rybchenko __in uint32_t partn, 5703c838a9fSAndrew Rybchenko __in boolean_t reboot); 5713c838a9fSAndrew Rybchenko 5723c838a9fSAndrew Rybchenko #if EFSYS_OPT_DIAG 5733c838a9fSAndrew Rybchenko 574460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5753c838a9fSAndrew Rybchenko efx_mcdi_nvram_test( 5763c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5773c838a9fSAndrew Rybchenko __in uint32_t partn); 5783c838a9fSAndrew Rybchenko 5793c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_DIAG */ 5803c838a9fSAndrew Rybchenko 5813c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ 5823c838a9fSAndrew Rybchenko 5830c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 5840c848230SAndrew Rybchenko 5850c848230SAndrew Rybchenko typedef struct efx_lic_ops_s { 5860c848230SAndrew Rybchenko efx_rc_t (*elo_update_licenses)(efx_nic_t *); 5870c848230SAndrew Rybchenko efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *); 5880c848230SAndrew Rybchenko efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *); 5890c848230SAndrew Rybchenko efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *, 5900c848230SAndrew Rybchenko size_t *, uint8_t *); 5910c848230SAndrew Rybchenko } efx_lic_ops_t; 5920c848230SAndrew Rybchenko 5930c848230SAndrew Rybchenko #endif 5940c848230SAndrew Rybchenko 5953c838a9fSAndrew Rybchenko typedef struct efx_drv_cfg_s { 5963c838a9fSAndrew Rybchenko uint32_t edc_min_vi_count; 5973c838a9fSAndrew Rybchenko uint32_t edc_max_vi_count; 5983c838a9fSAndrew Rybchenko 5993c838a9fSAndrew Rybchenko uint32_t edc_max_piobuf_count; 6003c838a9fSAndrew Rybchenko uint32_t edc_pio_alloc_size; 6013c838a9fSAndrew Rybchenko } efx_drv_cfg_t; 6023c838a9fSAndrew Rybchenko 603e948693eSPhilip Paeps struct efx_nic_s { 604e948693eSPhilip Paeps uint32_t en_magic; 605e948693eSPhilip Paeps efx_family_t en_family; 606e948693eSPhilip Paeps uint32_t en_features; 607e948693eSPhilip Paeps efsys_identifier_t *en_esip; 608e948693eSPhilip Paeps efsys_lock_t *en_eslp; 609e948693eSPhilip Paeps efsys_bar_t *en_esbp; 610e948693eSPhilip Paeps unsigned int en_mod_flags; 611e948693eSPhilip Paeps unsigned int en_reset_flags; 612e948693eSPhilip Paeps efx_nic_cfg_t en_nic_cfg; 6133c838a9fSAndrew Rybchenko efx_drv_cfg_t en_drv_cfg; 614e948693eSPhilip Paeps efx_port_t en_port; 615e948693eSPhilip Paeps efx_mon_t en_mon; 616e948693eSPhilip Paeps efx_intr_t en_intr; 617e948693eSPhilip Paeps uint32_t en_ev_qcount; 618e948693eSPhilip Paeps uint32_t en_rx_qcount; 619e948693eSPhilip Paeps uint32_t en_tx_qcount; 620*ec831f7fSAndrew Rybchenko const efx_nic_ops_t *en_enop; 621*ec831f7fSAndrew Rybchenko const efx_ev_ops_t *en_eevop; 622*ec831f7fSAndrew Rybchenko const efx_tx_ops_t *en_etxop; 623*ec831f7fSAndrew Rybchenko const efx_rx_ops_t *en_erxop; 624e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 625e948693eSPhilip Paeps efx_filter_t en_filter; 626*ec831f7fSAndrew Rybchenko const efx_filter_ops_t *en_efop; 627e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 6283c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 6293c838a9fSAndrew Rybchenko efx_mcdi_t en_mcdi; 6303c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 631e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 632e948693eSPhilip Paeps efx_nvram_type_t en_nvram_locked; 633*ec831f7fSAndrew Rybchenko const efx_nvram_ops_t *en_envop; 634e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 635e948693eSPhilip Paeps #if EFSYS_OPT_VPD 636*ec831f7fSAndrew Rybchenko const efx_vpd_ops_t *en_evpdop; 637e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6383c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 6393c838a9fSAndrew Rybchenko efx_rx_hash_support_t en_hash_support; 6403c838a9fSAndrew Rybchenko efx_rx_scale_support_t en_rss_support; 6413c838a9fSAndrew Rybchenko uint32_t en_rss_context; 6423c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 6433c838a9fSAndrew Rybchenko uint32_t en_vport_id; 6440c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 645*ec831f7fSAndrew Rybchenko const efx_lic_ops_t *en_elop; 6460c848230SAndrew Rybchenko #endif 647e948693eSPhilip Paeps union { 648e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 649e948693eSPhilip Paeps struct { 650e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 651e948693eSPhilip Paeps unsigned int enu_partn_mask; 652e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 653e948693eSPhilip Paeps #if EFSYS_OPT_VPD 654e948693eSPhilip Paeps caddr_t enu_svpd; 655e948693eSPhilip Paeps size_t enu_svpd_length; 656e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6573c838a9fSAndrew Rybchenko int enu_unused; 658e948693eSPhilip Paeps } siena; 659e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 660e7119ad9SAndrew Rybchenko int enu_unused; 661e948693eSPhilip Paeps } en_u; 662e7119ad9SAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 663e7119ad9SAndrew Rybchenko union en_arch { 664e7119ad9SAndrew Rybchenko struct { 665e7119ad9SAndrew Rybchenko int ena_vi_base; 666e7119ad9SAndrew Rybchenko int ena_vi_count; 667426f453bSAndrew Rybchenko int ena_vi_shift; 668e7119ad9SAndrew Rybchenko #if EFSYS_OPT_VPD 669e7119ad9SAndrew Rybchenko caddr_t ena_svpd; 670e7119ad9SAndrew Rybchenko size_t ena_svpd_length; 671e7119ad9SAndrew Rybchenko #endif /* EFSYS_OPT_VPD */ 672e7119ad9SAndrew Rybchenko efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS]; 673e7119ad9SAndrew Rybchenko uint32_t ena_piobuf_count; 674e7119ad9SAndrew Rybchenko uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS]; 675e7119ad9SAndrew Rybchenko uint32_t ena_pio_write_vi_base; 676e7119ad9SAndrew Rybchenko /* Memory BAR mapping regions */ 677e7119ad9SAndrew Rybchenko uint32_t ena_uc_mem_map_offset; 678e7119ad9SAndrew Rybchenko size_t ena_uc_mem_map_size; 679e7119ad9SAndrew Rybchenko uint32_t ena_wc_mem_map_offset; 680e7119ad9SAndrew Rybchenko size_t ena_wc_mem_map_size; 681e7119ad9SAndrew Rybchenko } ef10; 682e7119ad9SAndrew Rybchenko } en_arch; 683e7119ad9SAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 684e948693eSPhilip Paeps }; 685e948693eSPhilip Paeps 686e948693eSPhilip Paeps 687e948693eSPhilip Paeps #define EFX_NIC_MAGIC 0x02121996 688e948693eSPhilip Paeps 689e948693eSPhilip Paeps typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *, 690e948693eSPhilip Paeps const efx_ev_callbacks_t *, void *); 691e948693eSPhilip Paeps 6923c838a9fSAndrew Rybchenko typedef struct efx_evq_rxq_state_s { 6933c838a9fSAndrew Rybchenko unsigned int eers_rx_read_ptr; 6943c838a9fSAndrew Rybchenko unsigned int eers_rx_mask; 6953c838a9fSAndrew Rybchenko } efx_evq_rxq_state_t; 6963c838a9fSAndrew Rybchenko 697e948693eSPhilip Paeps struct efx_evq_s { 698e948693eSPhilip Paeps uint32_t ee_magic; 699e948693eSPhilip Paeps efx_nic_t *ee_enp; 700e948693eSPhilip Paeps unsigned int ee_index; 701e948693eSPhilip Paeps unsigned int ee_mask; 702e948693eSPhilip Paeps efsys_mem_t *ee_esmp; 703e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 704e948693eSPhilip Paeps uint32_t ee_stat[EV_NQSTATS]; 705e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 7063c838a9fSAndrew Rybchenko 7073c838a9fSAndrew Rybchenko efx_ev_handler_t ee_rx; 7083c838a9fSAndrew Rybchenko efx_ev_handler_t ee_tx; 7093c838a9fSAndrew Rybchenko efx_ev_handler_t ee_driver; 7103c838a9fSAndrew Rybchenko efx_ev_handler_t ee_global; 7113c838a9fSAndrew Rybchenko efx_ev_handler_t ee_drv_gen; 7123c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 7133c838a9fSAndrew Rybchenko efx_ev_handler_t ee_mcdi; 7143c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 7153c838a9fSAndrew Rybchenko 7163c838a9fSAndrew Rybchenko efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS]; 717e948693eSPhilip Paeps }; 718e948693eSPhilip Paeps 719e948693eSPhilip Paeps #define EFX_EVQ_MAGIC 0x08081997 720e948693eSPhilip Paeps 721af9078c3SAndrew Rybchenko #define EFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */ 722af9078c3SAndrew Rybchenko #define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */ 723e948693eSPhilip Paeps 724e948693eSPhilip Paeps struct efx_rxq_s { 725e948693eSPhilip Paeps uint32_t er_magic; 726e948693eSPhilip Paeps efx_nic_t *er_enp; 7273c838a9fSAndrew Rybchenko efx_evq_t *er_eep; 728e948693eSPhilip Paeps unsigned int er_index; 7293c838a9fSAndrew Rybchenko unsigned int er_label; 730e948693eSPhilip Paeps unsigned int er_mask; 731e948693eSPhilip Paeps efsys_mem_t *er_esmp; 732e948693eSPhilip Paeps }; 733e948693eSPhilip Paeps 734e948693eSPhilip Paeps #define EFX_RXQ_MAGIC 0x15022005 735e948693eSPhilip Paeps 736e948693eSPhilip Paeps struct efx_txq_s { 737e948693eSPhilip Paeps uint32_t et_magic; 738e948693eSPhilip Paeps efx_nic_t *et_enp; 739e948693eSPhilip Paeps unsigned int et_index; 740e948693eSPhilip Paeps unsigned int et_mask; 741e948693eSPhilip Paeps efsys_mem_t *et_esmp; 7423c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 7433c838a9fSAndrew Rybchenko uint32_t et_pio_bufnum; 7443c838a9fSAndrew Rybchenko uint32_t et_pio_blknum; 7453c838a9fSAndrew Rybchenko uint32_t et_pio_write_offset; 7463c838a9fSAndrew Rybchenko uint32_t et_pio_offset; 7473c838a9fSAndrew Rybchenko size_t et_pio_size; 7483c838a9fSAndrew Rybchenko #endif 749e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 750e948693eSPhilip Paeps uint32_t et_stat[TX_NQSTATS]; 751e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 752e948693eSPhilip Paeps }; 753e948693eSPhilip Paeps 754e948693eSPhilip Paeps #define EFX_TXQ_MAGIC 0x05092005 755e948693eSPhilip Paeps 756e948693eSPhilip Paeps #define EFX_MAC_ADDR_COPY(_dst, _src) \ 757e948693eSPhilip Paeps do { \ 758e948693eSPhilip Paeps (_dst)[0] = (_src)[0]; \ 759e948693eSPhilip Paeps (_dst)[1] = (_src)[1]; \ 760e948693eSPhilip Paeps (_dst)[2] = (_src)[2]; \ 761e948693eSPhilip Paeps (_dst)[3] = (_src)[3]; \ 762e948693eSPhilip Paeps (_dst)[4] = (_src)[4]; \ 763e948693eSPhilip Paeps (_dst)[5] = (_src)[5]; \ 764e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 765e948693eSPhilip Paeps } while (B_FALSE) 766e948693eSPhilip Paeps 7673c838a9fSAndrew Rybchenko #define EFX_MAC_BROADCAST_ADDR_SET(_dst) \ 7683c838a9fSAndrew Rybchenko do { \ 7693c838a9fSAndrew Rybchenko uint16_t *_d = (uint16_t *)(_dst); \ 7703c838a9fSAndrew Rybchenko _d[0] = 0xffff; \ 7713c838a9fSAndrew Rybchenko _d[1] = 0xffff; \ 7723c838a9fSAndrew Rybchenko _d[2] = 0xffff; \ 7733c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 7743c838a9fSAndrew Rybchenko } while (B_FALSE) 7753c838a9fSAndrew Rybchenko 776e948693eSPhilip Paeps #if EFSYS_OPT_CHECK_REG 777e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) \ 778e948693eSPhilip Paeps do { \ 7793c838a9fSAndrew Rybchenko const char *name = #_reg; \ 780e948693eSPhilip Paeps char min = name[4]; \ 781e948693eSPhilip Paeps char max = name[5]; \ 782e948693eSPhilip Paeps char rev; \ 783e948693eSPhilip Paeps \ 784e948693eSPhilip Paeps switch ((_enp)->en_family) { \ 785e948693eSPhilip Paeps case EFX_FAMILY_SIENA: \ 786e948693eSPhilip Paeps rev = 'C'; \ 787e948693eSPhilip Paeps break; \ 788e948693eSPhilip Paeps \ 7893c838a9fSAndrew Rybchenko case EFX_FAMILY_HUNTINGTON: \ 7903c838a9fSAndrew Rybchenko rev = 'D'; \ 7913c838a9fSAndrew Rybchenko break; \ 7923c838a9fSAndrew Rybchenko \ 79334f6ea29SAndrew Rybchenko case EFX_FAMILY_MEDFORD: \ 79434f6ea29SAndrew Rybchenko rev = 'E'; \ 79534f6ea29SAndrew Rybchenko break; \ 79634f6ea29SAndrew Rybchenko \ 797e948693eSPhilip Paeps default: \ 798e948693eSPhilip Paeps rev = '?'; \ 799e948693eSPhilip Paeps break; \ 800e948693eSPhilip Paeps } \ 801e948693eSPhilip Paeps \ 802e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, >=, min); \ 803e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, <=, max); \ 804e948693eSPhilip Paeps \ 805e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 806e948693eSPhilip Paeps } while (B_FALSE) 807e948693eSPhilip Paeps #else 808e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) do { \ 809e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 810e948693eSPhilip Paeps } while(B_FALSE) 811e948693eSPhilip Paeps #endif 812e948693eSPhilip Paeps 813e948693eSPhilip Paeps #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \ 814e948693eSPhilip Paeps do { \ 815e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 816e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \ 817e948693eSPhilip Paeps (_edp), (_lock)); \ 818e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \ 819e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 820e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 821e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 822e948693eSPhilip Paeps } while (B_FALSE) 823e948693eSPhilip Paeps 824e948693eSPhilip Paeps #define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \ 825e948693eSPhilip Paeps do { \ 826e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 827e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \ 828e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 829e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 830e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \ 831e948693eSPhilip Paeps (_edp), (_lock)); \ 832e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 833e948693eSPhilip Paeps } while (B_FALSE) 834e948693eSPhilip Paeps 835e948693eSPhilip Paeps #define EFX_BAR_READQ(_enp, _reg, _eqp) \ 836e948693eSPhilip Paeps do { \ 837e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 838e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \ 839e948693eSPhilip Paeps (_eqp)); \ 840e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \ 841e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 842e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 843e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 844e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 845e948693eSPhilip Paeps } while (B_FALSE) 846e948693eSPhilip Paeps 847e948693eSPhilip Paeps #define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \ 848e948693eSPhilip Paeps do { \ 849e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 850e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \ 851e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 852e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 853e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 854e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \ 855e948693eSPhilip Paeps (_eqp)); \ 856e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 857e948693eSPhilip Paeps } while (B_FALSE) 858e948693eSPhilip Paeps 859e948693eSPhilip Paeps #define EFX_BAR_READO(_enp, _reg, _eop) \ 860e948693eSPhilip Paeps do { \ 861e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 862e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \ 863e948693eSPhilip Paeps (_eop), B_TRUE); \ 864e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \ 865e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 866e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 867e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 868e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 869e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 870e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 871e948693eSPhilip Paeps } while (B_FALSE) 872e948693eSPhilip Paeps 873e948693eSPhilip Paeps #define EFX_BAR_WRITEO(_enp, _reg, _eop) \ 874e948693eSPhilip Paeps do { \ 875e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 876e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \ 877e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 878e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 879e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 880e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 881e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 882e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \ 883e948693eSPhilip Paeps (_eop), B_TRUE); \ 884e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 885e948693eSPhilip Paeps } while (B_FALSE) 886e948693eSPhilip Paeps 887e948693eSPhilip Paeps #define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \ 888e948693eSPhilip Paeps do { \ 889e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 890e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, \ 891e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 892e948693eSPhilip Paeps (_edp), (_lock)); \ 893e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \ 894e948693eSPhilip Paeps uint32_t, (_index), \ 895e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 896e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 897e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 898e948693eSPhilip Paeps } while (B_FALSE) 899e948693eSPhilip Paeps 900e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \ 901e948693eSPhilip Paeps do { \ 902e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 903e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 904e948693eSPhilip Paeps uint32_t, (_index), \ 905e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 906e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 907e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 908e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 909e948693eSPhilip Paeps (_edp), (_lock)); \ 910e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 911e948693eSPhilip Paeps } while (B_FALSE) 912e948693eSPhilip Paeps 9133c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITED2(_enp, _reg, _index, _edp, _lock) \ 9143c838a9fSAndrew Rybchenko do { \ 9153c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 9163c838a9fSAndrew Rybchenko EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 9173c838a9fSAndrew Rybchenko uint32_t, (_index), \ 9183c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 9193c838a9fSAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 9203c838a9fSAndrew Rybchenko EFSYS_BAR_WRITED((_enp)->en_esbp, \ 9213c838a9fSAndrew Rybchenko (_reg ## _OFST + \ 9223c838a9fSAndrew Rybchenko (2 * sizeof (efx_dword_t)) + \ 9233c838a9fSAndrew Rybchenko ((_index) * _reg ## _STEP)), \ 9243c838a9fSAndrew Rybchenko (_edp), (_lock)); \ 9253c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 9263c838a9fSAndrew Rybchenko } while (B_FALSE) 9273c838a9fSAndrew Rybchenko 928e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \ 929e948693eSPhilip Paeps do { \ 930e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 931e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 932e948693eSPhilip Paeps uint32_t, (_index), \ 933e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 934e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 935e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 936e948693eSPhilip Paeps (_reg ## _OFST + \ 937e948693eSPhilip Paeps (3 * sizeof (efx_dword_t)) + \ 938e948693eSPhilip Paeps ((_index) * _reg ## _STEP)), \ 939e948693eSPhilip Paeps (_edp), (_lock)); \ 940e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 941e948693eSPhilip Paeps } while (B_FALSE) 942e948693eSPhilip Paeps 943e948693eSPhilip Paeps #define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \ 944e948693eSPhilip Paeps do { \ 945e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 946e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, \ 947e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 948e948693eSPhilip Paeps (_eqp)); \ 949e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \ 950e948693eSPhilip Paeps uint32_t, (_index), \ 951e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 952e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 953e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 954e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 955e948693eSPhilip Paeps } while (B_FALSE) 956e948693eSPhilip Paeps 957e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \ 958e948693eSPhilip Paeps do { \ 959e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 960e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \ 961e948693eSPhilip Paeps uint32_t, (_index), \ 962e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 963e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 964e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 965e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, \ 966e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 967e948693eSPhilip Paeps (_eqp)); \ 968e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 969e948693eSPhilip Paeps } while (B_FALSE) 970e948693eSPhilip Paeps 9713c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \ 972e948693eSPhilip Paeps do { \ 973e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 974e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, \ 975e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 9763c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 977e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \ 978e948693eSPhilip Paeps uint32_t, (_index), \ 979e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 980e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 981e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 982e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 983e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 984e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 985e948693eSPhilip Paeps } while (B_FALSE) 986e948693eSPhilip Paeps 9873c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \ 988e948693eSPhilip Paeps do { \ 989e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 990e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \ 991e948693eSPhilip Paeps uint32_t, (_index), \ 992e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 993e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 994e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 995e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 996e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 997e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, \ 998e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 9993c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 10003c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10013c838a9fSAndrew Rybchenko } while (B_FALSE) 10023c838a9fSAndrew Rybchenko 10033c838a9fSAndrew Rybchenko /* 10043c838a9fSAndrew Rybchenko * Allow drivers to perform optimised 128-bit doorbell writes. 10053c838a9fSAndrew Rybchenko * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are 10063c838a9fSAndrew Rybchenko * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid 10073c838a9fSAndrew Rybchenko * the need for locking in the host, and are the only ones known to be safe to 10083c838a9fSAndrew Rybchenko * use 128-bites write with. 10093c838a9fSAndrew Rybchenko */ 10103c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \ 10113c838a9fSAndrew Rybchenko do { \ 10123c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 10133c838a9fSAndrew Rybchenko EFSYS_PROBE7(efx_bar_tbl_doorbell_writeo, \ 10143c838a9fSAndrew Rybchenko const char *, \ 10153c838a9fSAndrew Rybchenko #_reg, \ 10163c838a9fSAndrew Rybchenko uint32_t, (_index), \ 10173c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 10183c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[3], \ 10193c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[2], \ 10203c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[1], \ 10213c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[0]); \ 10223c838a9fSAndrew Rybchenko EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \ 10233c838a9fSAndrew Rybchenko (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10243c838a9fSAndrew Rybchenko (_eop)); \ 10253c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10263c838a9fSAndrew Rybchenko } while (B_FALSE) 10273c838a9fSAndrew Rybchenko 10283c838a9fSAndrew Rybchenko #define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \ 10293c838a9fSAndrew Rybchenko do { \ 10303c838a9fSAndrew Rybchenko unsigned int _new = (_wptr); \ 10313c838a9fSAndrew Rybchenko unsigned int _old = (_owptr); \ 10323c838a9fSAndrew Rybchenko \ 10333c838a9fSAndrew Rybchenko if ((_new) >= (_old)) \ 10343c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10353c838a9fSAndrew Rybchenko (_old) * sizeof (efx_desc_t), \ 10363c838a9fSAndrew Rybchenko ((_new) - (_old)) * sizeof (efx_desc_t)); \ 10373c838a9fSAndrew Rybchenko else \ 10383c838a9fSAndrew Rybchenko /* \ 10393c838a9fSAndrew Rybchenko * It is cheaper to sync entire map than sync \ 10403c838a9fSAndrew Rybchenko * two parts especially when offset/size are \ 10413c838a9fSAndrew Rybchenko * ignored and entire map is synced in any case.\ 10423c838a9fSAndrew Rybchenko */ \ 10433c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10443c838a9fSAndrew Rybchenko 0, \ 10453c838a9fSAndrew Rybchenko (_entries) * sizeof (efx_desc_t)); \ 1046e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1047e948693eSPhilip Paeps } while (B_FALSE) 1048e948693eSPhilip Paeps 1049460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 10503c838a9fSAndrew Rybchenko efx_nic_biu_test( 10513c838a9fSAndrew Rybchenko __in efx_nic_t *enp); 10523c838a9fSAndrew Rybchenko 1053460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1054e948693eSPhilip Paeps efx_mac_select( 1055e948693eSPhilip Paeps __in efx_nic_t *enp); 1056e948693eSPhilip Paeps 10573c838a9fSAndrew Rybchenko extern void 10583c838a9fSAndrew Rybchenko efx_mac_multicast_hash_compute( 10593c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 10603c838a9fSAndrew Rybchenko __in int count, 10613c838a9fSAndrew Rybchenko __out efx_oword_t *hash_low, 10623c838a9fSAndrew Rybchenko __out efx_oword_t *hash_high); 10633c838a9fSAndrew Rybchenko 1064460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1065e948693eSPhilip Paeps efx_phy_probe( 1066e948693eSPhilip Paeps __in efx_nic_t *enp); 1067e948693eSPhilip Paeps 1068e948693eSPhilip Paeps extern void 1069e948693eSPhilip Paeps efx_phy_unprobe( 1070e948693eSPhilip Paeps __in efx_nic_t *enp); 1071e948693eSPhilip Paeps 1072e948693eSPhilip Paeps #if EFSYS_OPT_VPD 1073e948693eSPhilip Paeps 1074e948693eSPhilip Paeps /* VPD utility functions */ 1075e948693eSPhilip Paeps 1076460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1077e948693eSPhilip Paeps efx_vpd_hunk_length( 1078e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1079e948693eSPhilip Paeps __in size_t size, 1080e948693eSPhilip Paeps __out size_t *lengthp); 1081e948693eSPhilip Paeps 1082460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1083e948693eSPhilip Paeps efx_vpd_hunk_verify( 1084e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1085e948693eSPhilip Paeps __in size_t size, 1086e948693eSPhilip Paeps __out_opt boolean_t *cksummedp); 1087e948693eSPhilip Paeps 1088460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1089e948693eSPhilip Paeps efx_vpd_hunk_reinit( 10903c838a9fSAndrew Rybchenko __in_bcount(size) caddr_t data, 1091e948693eSPhilip Paeps __in size_t size, 1092e948693eSPhilip Paeps __in boolean_t wantpid); 1093e948693eSPhilip Paeps 1094460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1095e948693eSPhilip Paeps efx_vpd_hunk_get( 1096e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1097e948693eSPhilip Paeps __in size_t size, 1098e948693eSPhilip Paeps __in efx_vpd_tag_t tag, 1099e948693eSPhilip Paeps __in efx_vpd_keyword_t keyword, 1100e948693eSPhilip Paeps __out unsigned int *payloadp, 1101e948693eSPhilip Paeps __out uint8_t *paylenp); 1102e948693eSPhilip Paeps 1103460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1104e948693eSPhilip Paeps efx_vpd_hunk_next( 1105e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1106e948693eSPhilip Paeps __in size_t size, 1107e948693eSPhilip Paeps __out efx_vpd_tag_t *tagp, 1108e948693eSPhilip Paeps __out efx_vpd_keyword_t *keyword, 110986ec4b85SAndrew Rybchenko __out_opt unsigned int *payloadp, 1110e948693eSPhilip Paeps __out_opt uint8_t *paylenp, 1111e948693eSPhilip Paeps __inout unsigned int *contp); 1112e948693eSPhilip Paeps 1113460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1114e948693eSPhilip Paeps efx_vpd_hunk_set( 1115e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1116e948693eSPhilip Paeps __in size_t size, 1117e948693eSPhilip Paeps __in efx_vpd_value_t *evvp); 1118e948693eSPhilip Paeps 1119e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 1120e948693eSPhilip Paeps 1121e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 1122e948693eSPhilip Paeps 11233c838a9fSAndrew Rybchenko extern efx_sram_pattern_fn_t __efx_sram_pattern_fns[]; 1124e948693eSPhilip Paeps 1125e948693eSPhilip Paeps typedef struct efx_register_set_s { 1126e948693eSPhilip Paeps unsigned int address; 1127e948693eSPhilip Paeps unsigned int step; 1128e948693eSPhilip Paeps unsigned int rows; 1129e948693eSPhilip Paeps efx_oword_t mask; 1130e948693eSPhilip Paeps } efx_register_set_t; 1131e948693eSPhilip Paeps 1132460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1133e948693eSPhilip Paeps efx_nic_test_registers( 1134e948693eSPhilip Paeps __in efx_nic_t *enp, 1135e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1136e948693eSPhilip Paeps __in size_t count); 1137e948693eSPhilip Paeps 1138460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1139e948693eSPhilip Paeps efx_nic_test_tables( 1140e948693eSPhilip Paeps __in efx_nic_t *enp, 1141e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1142e948693eSPhilip Paeps __in efx_pattern_type_t pattern, 1143e948693eSPhilip Paeps __in size_t count); 1144e948693eSPhilip Paeps 1145e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 1146e948693eSPhilip Paeps 11473c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 11483c838a9fSAndrew Rybchenko 1149460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11503c838a9fSAndrew Rybchenko efx_mcdi_set_workaround( 11513c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11523c838a9fSAndrew Rybchenko __in uint32_t type, 11533c838a9fSAndrew Rybchenko __in boolean_t enabled, 11543c838a9fSAndrew Rybchenko __out_opt uint32_t *flagsp); 11553c838a9fSAndrew Rybchenko 1156460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11573c838a9fSAndrew Rybchenko efx_mcdi_get_workarounds( 11583c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11593c838a9fSAndrew Rybchenko __out_opt uint32_t *implementedp, 11603c838a9fSAndrew Rybchenko __out_opt uint32_t *enabledp); 11613c838a9fSAndrew Rybchenko 11623c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 11633c838a9fSAndrew Rybchenko 1164e948693eSPhilip Paeps #ifdef __cplusplus 1165e948693eSPhilip Paeps } 1166e948693eSPhilip Paeps #endif 1167e948693eSPhilip Paeps 1168e948693eSPhilip Paeps #endif /* _SYS_EFX_IMPL_H */ 1169