1e948693eSPhilip Paeps /*- 2*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*718cf2ccSPedro 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 605f5c71ccSAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 615f5c71ccSAndrew Rybchenko #include "ef10_impl.h" 625f5c71ccSAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 635f5c71ccSAndrew Rybchenko 64e948693eSPhilip Paeps #ifdef __cplusplus 65e948693eSPhilip Paeps extern "C" { 66e948693eSPhilip Paeps #endif 67e948693eSPhilip Paeps 68e948693eSPhilip Paeps #define EFX_MOD_MCDI 0x00000001 69e948693eSPhilip Paeps #define EFX_MOD_PROBE 0x00000002 70e948693eSPhilip Paeps #define EFX_MOD_NVRAM 0x00000004 71e948693eSPhilip Paeps #define EFX_MOD_VPD 0x00000008 72e948693eSPhilip Paeps #define EFX_MOD_NIC 0x00000010 73e948693eSPhilip Paeps #define EFX_MOD_INTR 0x00000020 74e948693eSPhilip Paeps #define EFX_MOD_EV 0x00000040 75e948693eSPhilip Paeps #define EFX_MOD_RX 0x00000080 76e948693eSPhilip Paeps #define EFX_MOD_TX 0x00000100 77e948693eSPhilip Paeps #define EFX_MOD_PORT 0x00000200 78e948693eSPhilip Paeps #define EFX_MOD_MON 0x00000400 79e948693eSPhilip Paeps #define EFX_MOD_FILTER 0x00001000 80908ecfc6SAndrew Rybchenko #define EFX_MOD_LIC 0x00002000 81e948693eSPhilip Paeps 820c909247SAndrew Rybchenko #define EFX_RESET_PHY 0x00000001 830c909247SAndrew Rybchenko #define EFX_RESET_RXQ_ERR 0x00000002 840c909247SAndrew Rybchenko #define EFX_RESET_TXQ_ERR 0x00000004 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, 99a3fe009aSAndrew Rybchenko uint32_t, uint32_t, 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_poll)(efx_nic_t *, efx_link_mode_t *); 184460cb568SAndrew Rybchenko efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *); 185460cb568SAndrew Rybchenko efx_rc_t (*emo_addr_set)(efx_nic_t *); 18608c5af79SAndrew Rybchenko efx_rc_t (*emo_pdu_set)(efx_nic_t *); 187d8484af2SAndrew Rybchenko efx_rc_t (*emo_pdu_get)(efx_nic_t *, size_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 19858a72cb2SAndrew Rybchenko efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t); 199460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); 200460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, 201e948693eSPhilip Paeps uint16_t, boolean_t); 202460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 203e948693eSPhilip Paeps efsys_stat_t *, uint32_t *); 204e948693eSPhilip Paeps #endif /* EFSYS_OPT_MAC_STATS */ 205e948693eSPhilip Paeps } efx_mac_ops_t; 206e948693eSPhilip Paeps 207e948693eSPhilip Paeps typedef struct efx_phy_ops_s { 208460cb568SAndrew Rybchenko efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */ 209460cb568SAndrew Rybchenko efx_rc_t (*epo_reset)(efx_nic_t *); 210460cb568SAndrew Rybchenko efx_rc_t (*epo_reconfigure)(efx_nic_t *); 211460cb568SAndrew Rybchenko efx_rc_t (*epo_verify)(efx_nic_t *); 212460cb568SAndrew Rybchenko efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *); 213e948693eSPhilip Paeps #if EFSYS_OPT_PHY_STATS 214460cb568SAndrew Rybchenko efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *, 215e948693eSPhilip Paeps uint32_t *); 216e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_STATS */ 2173c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 218460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *); 219460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t); 220460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t, 2213c838a9fSAndrew Rybchenko efx_bist_result_t *, uint32_t *, 222e948693eSPhilip Paeps unsigned long *, size_t); 2233c838a9fSAndrew Rybchenko void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t); 2243c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_BIST */ 225e948693eSPhilip Paeps } efx_phy_ops_t; 226e948693eSPhilip Paeps 2273c838a9fSAndrew Rybchenko #if EFSYS_OPT_FILTER 2283c838a9fSAndrew Rybchenko typedef struct efx_filter_ops_s { 229460cb568SAndrew Rybchenko efx_rc_t (*efo_init)(efx_nic_t *); 2303c838a9fSAndrew Rybchenko void (*efo_fini)(efx_nic_t *); 231460cb568SAndrew Rybchenko efx_rc_t (*efo_restore)(efx_nic_t *); 232460cb568SAndrew Rybchenko efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *, 2333c838a9fSAndrew Rybchenko boolean_t may_replace); 234460cb568SAndrew Rybchenko efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *); 23563492ab8SAndrew Rybchenko efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, 23663492ab8SAndrew Rybchenko size_t, size_t *); 237460cb568SAndrew Rybchenko efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t, 2383c838a9fSAndrew Rybchenko boolean_t, boolean_t, boolean_t, 23947cb5106SAndrew Rybchenko uint8_t const *, uint32_t); 2403c838a9fSAndrew Rybchenko } efx_filter_ops_t; 2413c838a9fSAndrew Rybchenko 242460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 2433c838a9fSAndrew Rybchenko efx_filter_reconfigure( 2443c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 2453c838a9fSAndrew Rybchenko __in_ecount(6) uint8_t const *mac_addr, 2463c838a9fSAndrew Rybchenko __in boolean_t all_unicst, 2473c838a9fSAndrew Rybchenko __in boolean_t mulcst, 2483c838a9fSAndrew Rybchenko __in boolean_t all_mulcst, 2493c838a9fSAndrew Rybchenko __in boolean_t brdcst, 2503c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 25147cb5106SAndrew Rybchenko __in uint32_t count); 2523c838a9fSAndrew Rybchenko 2533c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_FILTER */ 2543c838a9fSAndrew Rybchenko 2553c838a9fSAndrew Rybchenko 256e948693eSPhilip Paeps typedef struct efx_port_s { 257e948693eSPhilip Paeps efx_mac_type_t ep_mac_type; 258e948693eSPhilip Paeps uint32_t ep_phy_type; 259e948693eSPhilip Paeps uint8_t ep_port; 260e948693eSPhilip Paeps uint32_t ep_mac_pdu; 261e948693eSPhilip Paeps uint8_t ep_mac_addr[6]; 262e948693eSPhilip Paeps efx_link_mode_t ep_link_mode; 2633c838a9fSAndrew Rybchenko boolean_t ep_all_unicst; 2643c838a9fSAndrew Rybchenko boolean_t ep_mulcst; 2653c838a9fSAndrew Rybchenko boolean_t ep_all_mulcst; 266e948693eSPhilip Paeps boolean_t ep_brdcst; 267e948693eSPhilip Paeps unsigned int ep_fcntl; 268e948693eSPhilip Paeps boolean_t ep_fcntl_autoneg; 269e948693eSPhilip Paeps efx_oword_t ep_multicst_hash[2]; 2703c838a9fSAndrew Rybchenko uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN * 2713c838a9fSAndrew Rybchenko EFX_MAC_MULTICAST_LIST_MAX]; 2723c838a9fSAndrew Rybchenko uint32_t ep_mulcst_addr_count; 273e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 274e948693eSPhilip Paeps efx_loopback_type_t ep_loopback_type; 275e948693eSPhilip Paeps efx_link_mode_t ep_loopback_link_mode; 276e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 277e948693eSPhilip Paeps #if EFSYS_OPT_PHY_FLAGS 278e948693eSPhilip Paeps uint32_t ep_phy_flags; 279e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_FLAGS */ 280e948693eSPhilip Paeps #if EFSYS_OPT_PHY_LED_CONTROL 281e948693eSPhilip Paeps efx_phy_led_mode_t ep_phy_led_mode; 282e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_LED_CONTROL */ 283e948693eSPhilip Paeps efx_phy_media_type_t ep_fixed_port_type; 284e948693eSPhilip Paeps efx_phy_media_type_t ep_module_type; 285e948693eSPhilip Paeps uint32_t ep_adv_cap_mask; 286e948693eSPhilip Paeps uint32_t ep_lp_cap_mask; 287e948693eSPhilip Paeps uint32_t ep_default_adv_cap_mask; 288e948693eSPhilip Paeps uint32_t ep_phy_cap_mask; 289e948693eSPhilip Paeps boolean_t ep_mac_drain; 290e948693eSPhilip Paeps boolean_t ep_mac_stats_pending; 2913c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 2923c838a9fSAndrew Rybchenko efx_bist_type_t ep_current_bist; 293e948693eSPhilip Paeps #endif 294ec831f7fSAndrew Rybchenko const efx_mac_ops_t *ep_emop; 295ec831f7fSAndrew Rybchenko const efx_phy_ops_t *ep_epop; 296e948693eSPhilip Paeps } efx_port_t; 297e948693eSPhilip Paeps 298e948693eSPhilip Paeps typedef struct efx_mon_ops_s { 299e948693eSPhilip Paeps #if EFSYS_OPT_MON_STATS 300460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 301e948693eSPhilip Paeps efx_mon_stat_value_t *); 302e948693eSPhilip Paeps #endif /* EFSYS_OPT_MON_STATS */ 303e948693eSPhilip Paeps } efx_mon_ops_t; 304e948693eSPhilip Paeps 305e948693eSPhilip Paeps typedef struct efx_mon_s { 306e948693eSPhilip Paeps efx_mon_type_t em_type; 307ec831f7fSAndrew Rybchenko const efx_mon_ops_t *em_emop; 308e948693eSPhilip Paeps } efx_mon_t; 309e948693eSPhilip Paeps 3103c838a9fSAndrew Rybchenko typedef struct efx_intr_ops_s { 311460cb568SAndrew Rybchenko efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *); 3123c838a9fSAndrew Rybchenko void (*eio_enable)(efx_nic_t *); 3133c838a9fSAndrew Rybchenko void (*eio_disable)(efx_nic_t *); 3143c838a9fSAndrew Rybchenko void (*eio_disable_unlocked)(efx_nic_t *); 315460cb568SAndrew Rybchenko efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int); 3160c24a07eSAndrew Rybchenko void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *); 3170c24a07eSAndrew Rybchenko void (*eio_status_message)(efx_nic_t *, unsigned int, 3180c24a07eSAndrew Rybchenko boolean_t *); 3190c24a07eSAndrew Rybchenko void (*eio_fatal)(efx_nic_t *); 3203c838a9fSAndrew Rybchenko void (*eio_fini)(efx_nic_t *); 3213c838a9fSAndrew Rybchenko } efx_intr_ops_t; 3223c838a9fSAndrew Rybchenko 323e948693eSPhilip Paeps typedef struct efx_intr_s { 324ec831f7fSAndrew Rybchenko const efx_intr_ops_t *ei_eiop; 325e948693eSPhilip Paeps efsys_mem_t *ei_esmp; 3263c838a9fSAndrew Rybchenko efx_intr_type_t ei_type; 327e948693eSPhilip Paeps unsigned int ei_level; 328e948693eSPhilip Paeps } efx_intr_t; 329e948693eSPhilip Paeps 330e948693eSPhilip Paeps typedef struct efx_nic_ops_s { 331460cb568SAndrew Rybchenko efx_rc_t (*eno_probe)(efx_nic_t *); 332cfa023ebSAndrew Rybchenko efx_rc_t (*eno_board_cfg)(efx_nic_t *); 333460cb568SAndrew Rybchenko efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*); 334460cb568SAndrew Rybchenko efx_rc_t (*eno_reset)(efx_nic_t *); 335460cb568SAndrew Rybchenko efx_rc_t (*eno_init)(efx_nic_t *); 336460cb568SAndrew Rybchenko efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *); 337460cb568SAndrew Rybchenko efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t, 3383c838a9fSAndrew Rybchenko uint32_t *, size_t *); 339e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 340460cb568SAndrew Rybchenko efx_rc_t (*eno_register_test)(efx_nic_t *); 341e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 342e948693eSPhilip Paeps void (*eno_fini)(efx_nic_t *); 343e948693eSPhilip Paeps void (*eno_unprobe)(efx_nic_t *); 344e948693eSPhilip Paeps } efx_nic_ops_t; 345e948693eSPhilip Paeps 3469ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_LIMIT_TARGET 347e948693eSPhilip Paeps #define EFX_TXQ_LIMIT_TARGET 259 3489ab060a7SAndrew Rybchenko #endif 3499ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_LIMIT_TARGET 35075ba9e1eSAndrew Rybchenko #define EFX_RXQ_LIMIT_TARGET 512 3519ab060a7SAndrew Rybchenko #endif 3529ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_DC_SIZE 3539ab060a7SAndrew Rybchenko #define EFX_TXQ_DC_SIZE 1 /* 16 descriptors */ 3549ab060a7SAndrew Rybchenko #endif 3559ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_DC_SIZE 3569ab060a7SAndrew Rybchenko #define EFX_RXQ_DC_SIZE 3 /* 64 descriptors */ 3579ab060a7SAndrew Rybchenko #endif 358e948693eSPhilip Paeps 359e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 360e948693eSPhilip Paeps 361f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_spec_s { 362f7aa4b3dSAndrew Rybchenko uint8_t sfs_type; 363f7aa4b3dSAndrew Rybchenko uint32_t sfs_flags; 364f7aa4b3dSAndrew Rybchenko uint32_t sfs_dmaq_id; 365f7aa4b3dSAndrew Rybchenko uint32_t sfs_dword[3]; 366f7aa4b3dSAndrew Rybchenko } siena_filter_spec_t; 3673c838a9fSAndrew Rybchenko 368f7aa4b3dSAndrew Rybchenko typedef enum siena_filter_type_e { 369f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 370f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */ 371f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */ 372f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */ 373f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */ 374f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */ 375e948693eSPhilip Paeps 376f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 377f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */ 378f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */ 379f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */ 380f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */ 381f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */ 382e948693eSPhilip Paeps 383f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_NTYPES 384f7aa4b3dSAndrew Rybchenko } siena_filter_type_t; 385e948693eSPhilip Paeps 386f7aa4b3dSAndrew Rybchenko typedef enum siena_filter_tbl_id_e { 387f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_RX_IP = 0, 388f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_RX_MAC, 389f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_TX_IP, 390f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_TBL_TX_MAC, 391f7aa4b3dSAndrew Rybchenko EFX_SIENA_FILTER_NTBLS 392f7aa4b3dSAndrew Rybchenko } siena_filter_tbl_id_t; 393e948693eSPhilip Paeps 394f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_tbl_s { 395f7aa4b3dSAndrew Rybchenko int sft_size; /* number of entries */ 396f7aa4b3dSAndrew Rybchenko int sft_used; /* active count */ 397f7aa4b3dSAndrew Rybchenko uint32_t *sft_bitmap; /* active bitmap */ 398f7aa4b3dSAndrew Rybchenko siena_filter_spec_t *sft_spec; /* array of saved specs */ 399f7aa4b3dSAndrew Rybchenko } siena_filter_tbl_t; 400e948693eSPhilip Paeps 401f7aa4b3dSAndrew Rybchenko typedef struct siena_filter_s { 402f7aa4b3dSAndrew Rybchenko siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS]; 403f7aa4b3dSAndrew Rybchenko unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES]; 404f7aa4b3dSAndrew Rybchenko } siena_filter_t; 405e948693eSPhilip Paeps 406e948693eSPhilip Paeps typedef struct efx_filter_s { 407e75412c9SAndrew Rybchenko #if EFSYS_OPT_SIENA 408f7aa4b3dSAndrew Rybchenko siena_filter_t *ef_siena_filter; 409e75412c9SAndrew Rybchenko #endif /* EFSYS_OPT_SIENA */ 4101289fe72SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD 4111289fe72SAndrew Rybchenko ef10_filter_table_t *ef_ef10_filter_table; 4121289fe72SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ 413e948693eSPhilip Paeps } efx_filter_t; 414e948693eSPhilip Paeps 415e948693eSPhilip Paeps extern void 4161c159dbfSAndrew Rybchenko siena_filter_tbl_clear( 417e948693eSPhilip Paeps __in efx_nic_t *enp, 418f7aa4b3dSAndrew Rybchenko __in siena_filter_tbl_id_t tbl); 419e948693eSPhilip Paeps 420e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 421e948693eSPhilip Paeps 4223c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 4233c838a9fSAndrew Rybchenko 4243c838a9fSAndrew Rybchenko typedef struct efx_mcdi_ops_s { 425460cb568SAndrew Rybchenko efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *); 426fd7501bfSAndrew Rybchenko void (*emco_send_request)(efx_nic_t *, void *, size_t, 427fd7501bfSAndrew Rybchenko void *, size_t); 428460cb568SAndrew Rybchenko efx_rc_t (*emco_poll_reboot)(efx_nic_t *); 429548ebee5SAndrew Rybchenko boolean_t (*emco_poll_response)(efx_nic_t *); 430548ebee5SAndrew Rybchenko void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); 4313c838a9fSAndrew Rybchenko void (*emco_fini)(efx_nic_t *); 4328a4fcbd4SAndrew Rybchenko efx_rc_t (*emco_feature_supported)(efx_nic_t *, 4338a4fcbd4SAndrew Rybchenko efx_mcdi_feature_id_t, boolean_t *); 4348a4fcbd4SAndrew Rybchenko void (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *, 4358a4fcbd4SAndrew Rybchenko uint32_t *); 4363c838a9fSAndrew Rybchenko } efx_mcdi_ops_t; 4373c838a9fSAndrew Rybchenko 4383c838a9fSAndrew Rybchenko typedef struct efx_mcdi_s { 439ec831f7fSAndrew Rybchenko const efx_mcdi_ops_t *em_emcop; 4403c838a9fSAndrew Rybchenko const efx_mcdi_transport_t *em_emtp; 4413c838a9fSAndrew Rybchenko efx_mcdi_iface_t em_emip; 4423c838a9fSAndrew Rybchenko } efx_mcdi_t; 4433c838a9fSAndrew Rybchenko 4443c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 4453c838a9fSAndrew Rybchenko 446e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 447e948693eSPhilip Paeps typedef struct efx_nvram_ops_s { 448e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 449460cb568SAndrew Rybchenko efx_rc_t (*envo_test)(efx_nic_t *); 450e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 451bce88e31SAndrew Rybchenko efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, 452bce88e31SAndrew Rybchenko uint32_t *); 45356bd83b0SAndrew Rybchenko efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *); 4545d846e87SAndrew Rybchenko efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *); 4550afdf29cSAndrew Rybchenko efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t, 4560afdf29cSAndrew Rybchenko unsigned int, caddr_t, size_t); 457b60ff840SAndrew Rybchenko efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t, 458b60ff840SAndrew Rybchenko unsigned int, size_t); 459134c4c4aSAndrew Rybchenko efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t, 460134c4c4aSAndrew Rybchenko unsigned int, caddr_t, size_t); 461e9c123a5SAndrew Rybchenko efx_rc_t (*envo_partn_rw_finish)(efx_nic_t *, uint32_t); 46292187119SAndrew Rybchenko efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t, 46392187119SAndrew Rybchenko uint32_t *, uint16_t *); 4646d0b856cSAndrew Rybchenko efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t, 4656d0b856cSAndrew Rybchenko uint16_t *); 4665abce2b9SAndrew Rybchenko efx_rc_t (*envo_buffer_validate)(efx_nic_t *, uint32_t, 4675abce2b9SAndrew Rybchenko caddr_t, size_t); 468e948693eSPhilip Paeps } efx_nvram_ops_t; 469e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 470e948693eSPhilip Paeps 471e948693eSPhilip Paeps #if EFSYS_OPT_VPD 472e948693eSPhilip Paeps typedef struct efx_vpd_ops_s { 473460cb568SAndrew Rybchenko efx_rc_t (*evpdo_init)(efx_nic_t *); 474460cb568SAndrew Rybchenko efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *); 475460cb568SAndrew Rybchenko efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t); 476460cb568SAndrew Rybchenko efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t); 477460cb568SAndrew Rybchenko efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t); 478460cb568SAndrew Rybchenko efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t, 479460cb568SAndrew Rybchenko efx_vpd_value_t *); 480460cb568SAndrew Rybchenko efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t, 481460cb568SAndrew Rybchenko efx_vpd_value_t *); 482460cb568SAndrew Rybchenko efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t, 483460cb568SAndrew Rybchenko efx_vpd_value_t *, unsigned int *); 484460cb568SAndrew Rybchenko efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t); 485e948693eSPhilip Paeps void (*evpdo_fini)(efx_nic_t *); 486e948693eSPhilip Paeps } efx_vpd_ops_t; 487e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 488e948693eSPhilip Paeps 4893c838a9fSAndrew Rybchenko #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM 4903c838a9fSAndrew Rybchenko 491460cb568SAndrew Rybchenko __checkReturn efx_rc_t 4923c838a9fSAndrew Rybchenko efx_mcdi_nvram_partitions( 4933c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 4943c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 4953c838a9fSAndrew Rybchenko __in size_t size, 4963c838a9fSAndrew Rybchenko __out unsigned int *npartnp); 4973c838a9fSAndrew Rybchenko 498460cb568SAndrew Rybchenko __checkReturn efx_rc_t 4993c838a9fSAndrew Rybchenko efx_mcdi_nvram_metadata( 5003c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5013c838a9fSAndrew Rybchenko __in uint32_t partn, 5023c838a9fSAndrew Rybchenko __out uint32_t *subtypep, 5033c838a9fSAndrew Rybchenko __out_ecount(4) uint16_t version[4], 5043c838a9fSAndrew Rybchenko __out_bcount_opt(size) char *descp, 5053c838a9fSAndrew Rybchenko __in size_t size); 5063c838a9fSAndrew Rybchenko 507460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5083c838a9fSAndrew Rybchenko efx_mcdi_nvram_info( 5093c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5103c838a9fSAndrew Rybchenko __in uint32_t partn, 5113c838a9fSAndrew Rybchenko __out_opt size_t *sizep, 5123c838a9fSAndrew Rybchenko __out_opt uint32_t *addressp, 5139cb71b16SAndrew Rybchenko __out_opt uint32_t *erase_sizep, 5149cb71b16SAndrew Rybchenko __out_opt uint32_t *write_sizep); 5153c838a9fSAndrew Rybchenko 516460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5173c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_start( 5183c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5193c838a9fSAndrew Rybchenko __in uint32_t partn); 5203c838a9fSAndrew Rybchenko 521460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5223c838a9fSAndrew Rybchenko efx_mcdi_nvram_read( 5233c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5243c838a9fSAndrew Rybchenko __in uint32_t partn, 5253c838a9fSAndrew Rybchenko __in uint32_t offset, 5263c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5279ad7e03fSAndrew Rybchenko __in size_t size, 5289ad7e03fSAndrew Rybchenko __in uint32_t mode); 5293c838a9fSAndrew Rybchenko 530460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5313c838a9fSAndrew Rybchenko efx_mcdi_nvram_erase( 5323c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5333c838a9fSAndrew Rybchenko __in uint32_t partn, 5343c838a9fSAndrew Rybchenko __in uint32_t offset, 5353c838a9fSAndrew Rybchenko __in size_t size); 5363c838a9fSAndrew Rybchenko 537460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5383c838a9fSAndrew Rybchenko efx_mcdi_nvram_write( 5393c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5403c838a9fSAndrew Rybchenko __in uint32_t partn, 5413c838a9fSAndrew Rybchenko __in uint32_t offset, 5423c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5433c838a9fSAndrew Rybchenko __in size_t size); 5443c838a9fSAndrew Rybchenko 545460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5463c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_finish( 5473c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5483c838a9fSAndrew Rybchenko __in uint32_t partn, 549e9c123a5SAndrew Rybchenko __in boolean_t reboot, 550e9c123a5SAndrew Rybchenko __out_opt uint32_t *resultp); 5513c838a9fSAndrew Rybchenko 5523c838a9fSAndrew Rybchenko #if EFSYS_OPT_DIAG 5533c838a9fSAndrew Rybchenko 554460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5553c838a9fSAndrew Rybchenko efx_mcdi_nvram_test( 5563c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5573c838a9fSAndrew Rybchenko __in uint32_t partn); 5583c838a9fSAndrew Rybchenko 5593c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_DIAG */ 5603c838a9fSAndrew Rybchenko 5613c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ 5623c838a9fSAndrew Rybchenko 5630c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 5640c848230SAndrew Rybchenko 5650c848230SAndrew Rybchenko typedef struct efx_lic_ops_s { 5660c848230SAndrew Rybchenko efx_rc_t (*elo_update_licenses)(efx_nic_t *); 5670c848230SAndrew Rybchenko efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *); 5680c848230SAndrew Rybchenko efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *); 5690c848230SAndrew Rybchenko efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *, 5700c848230SAndrew Rybchenko size_t *, uint8_t *); 571fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_find_start) 572fc3a62cfSAndrew Rybchenko (efx_nic_t *, caddr_t, size_t, uint32_t *); 573fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t, 574fc3a62cfSAndrew Rybchenko uint32_t, uint32_t *); 575fc3a62cfSAndrew Rybchenko boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t, 576fc3a62cfSAndrew Rybchenko uint32_t, uint32_t *, uint32_t *); 577fc3a62cfSAndrew Rybchenko boolean_t (*elo_validate_key)(efx_nic_t *, 578fc3a62cfSAndrew Rybchenko caddr_t, uint32_t); 579fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_read_key)(efx_nic_t *, 580fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, uint32_t, 581fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t *); 582fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_write_key)(efx_nic_t *, 583fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, 584fc3a62cfSAndrew Rybchenko caddr_t, uint32_t, uint32_t *); 585fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_delete_key)(efx_nic_t *, 586fc3a62cfSAndrew Rybchenko caddr_t, size_t, uint32_t, 587fc3a62cfSAndrew Rybchenko uint32_t, uint32_t, uint32_t *); 588fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_create_partition)(efx_nic_t *, 589fc3a62cfSAndrew Rybchenko caddr_t, size_t); 590fc3a62cfSAndrew Rybchenko efx_rc_t (*elo_finish_partition)(efx_nic_t *, 591fc3a62cfSAndrew Rybchenko caddr_t, size_t); 5920c848230SAndrew Rybchenko } efx_lic_ops_t; 5930c848230SAndrew Rybchenko 5940c848230SAndrew Rybchenko #endif 5950c848230SAndrew Rybchenko 5963c838a9fSAndrew Rybchenko typedef struct efx_drv_cfg_s { 5973c838a9fSAndrew Rybchenko uint32_t edc_min_vi_count; 5983c838a9fSAndrew Rybchenko uint32_t edc_max_vi_count; 5993c838a9fSAndrew Rybchenko 6003c838a9fSAndrew Rybchenko uint32_t edc_max_piobuf_count; 6013c838a9fSAndrew Rybchenko uint32_t edc_pio_alloc_size; 6023c838a9fSAndrew Rybchenko } efx_drv_cfg_t; 6033c838a9fSAndrew Rybchenko 604e948693eSPhilip Paeps struct efx_nic_s { 605e948693eSPhilip Paeps uint32_t en_magic; 606e948693eSPhilip Paeps efx_family_t en_family; 607e948693eSPhilip Paeps uint32_t en_features; 608e948693eSPhilip Paeps efsys_identifier_t *en_esip; 609e948693eSPhilip Paeps efsys_lock_t *en_eslp; 610e948693eSPhilip Paeps efsys_bar_t *en_esbp; 611e948693eSPhilip Paeps unsigned int en_mod_flags; 612e948693eSPhilip Paeps unsigned int en_reset_flags; 613e948693eSPhilip Paeps efx_nic_cfg_t en_nic_cfg; 6143c838a9fSAndrew Rybchenko efx_drv_cfg_t en_drv_cfg; 615e948693eSPhilip Paeps efx_port_t en_port; 616e948693eSPhilip Paeps efx_mon_t en_mon; 617e948693eSPhilip Paeps efx_intr_t en_intr; 618e948693eSPhilip Paeps uint32_t en_ev_qcount; 619e948693eSPhilip Paeps uint32_t en_rx_qcount; 620e948693eSPhilip Paeps uint32_t en_tx_qcount; 621ec831f7fSAndrew Rybchenko const efx_nic_ops_t *en_enop; 622ec831f7fSAndrew Rybchenko const efx_ev_ops_t *en_eevop; 623ec831f7fSAndrew Rybchenko const efx_tx_ops_t *en_etxop; 624ec831f7fSAndrew Rybchenko const efx_rx_ops_t *en_erxop; 625e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 626e948693eSPhilip Paeps efx_filter_t en_filter; 627ec831f7fSAndrew Rybchenko const efx_filter_ops_t *en_efop; 628e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 6293c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 6303c838a9fSAndrew Rybchenko efx_mcdi_t en_mcdi; 6313c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 632e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 633e948693eSPhilip Paeps efx_nvram_type_t en_nvram_locked; 634ec831f7fSAndrew Rybchenko const efx_nvram_ops_t *en_envop; 635e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 636e948693eSPhilip Paeps #if EFSYS_OPT_VPD 637ec831f7fSAndrew Rybchenko const efx_vpd_ops_t *en_evpdop; 638e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6393c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 6403c838a9fSAndrew Rybchenko efx_rx_hash_support_t en_hash_support; 6413c838a9fSAndrew Rybchenko efx_rx_scale_support_t en_rss_support; 6423c838a9fSAndrew Rybchenko uint32_t en_rss_context; 6433c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 6443c838a9fSAndrew Rybchenko uint32_t en_vport_id; 6450c848230SAndrew Rybchenko #if EFSYS_OPT_LICENSING 646ec831f7fSAndrew Rybchenko const efx_lic_ops_t *en_elop; 6475df3232cSAndrew Rybchenko boolean_t en_licensing_supported; 6480c848230SAndrew Rybchenko #endif 649e948693eSPhilip Paeps union { 650e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 651e948693eSPhilip Paeps struct { 652e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 653e948693eSPhilip Paeps unsigned int enu_partn_mask; 654e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 655e948693eSPhilip Paeps #if EFSYS_OPT_VPD 656e948693eSPhilip Paeps caddr_t enu_svpd; 657e948693eSPhilip Paeps size_t enu_svpd_length; 658e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6593c838a9fSAndrew Rybchenko int enu_unused; 660e948693eSPhilip Paeps } siena; 661e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 662e7119ad9SAndrew Rybchenko int enu_unused; 663e948693eSPhilip Paeps } en_u; 664e7119ad9SAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 665e7119ad9SAndrew Rybchenko union en_arch { 666e7119ad9SAndrew Rybchenko struct { 667e7119ad9SAndrew Rybchenko int ena_vi_base; 668e7119ad9SAndrew Rybchenko int ena_vi_count; 669426f453bSAndrew Rybchenko int ena_vi_shift; 670e7119ad9SAndrew Rybchenko #if EFSYS_OPT_VPD 671e7119ad9SAndrew Rybchenko caddr_t ena_svpd; 672e7119ad9SAndrew Rybchenko size_t ena_svpd_length; 673e7119ad9SAndrew Rybchenko #endif /* EFSYS_OPT_VPD */ 674e7119ad9SAndrew Rybchenko efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS]; 675e7119ad9SAndrew Rybchenko uint32_t ena_piobuf_count; 676e7119ad9SAndrew Rybchenko uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS]; 677e7119ad9SAndrew Rybchenko uint32_t ena_pio_write_vi_base; 678e7119ad9SAndrew Rybchenko /* Memory BAR mapping regions */ 679e7119ad9SAndrew Rybchenko uint32_t ena_uc_mem_map_offset; 680e7119ad9SAndrew Rybchenko size_t ena_uc_mem_map_size; 681e7119ad9SAndrew Rybchenko uint32_t ena_wc_mem_map_offset; 682e7119ad9SAndrew Rybchenko size_t ena_wc_mem_map_size; 683e7119ad9SAndrew Rybchenko } ef10; 684e7119ad9SAndrew Rybchenko } en_arch; 685e7119ad9SAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 686e948693eSPhilip Paeps }; 687e948693eSPhilip Paeps 688e948693eSPhilip Paeps 689e948693eSPhilip Paeps #define EFX_NIC_MAGIC 0x02121996 690e948693eSPhilip Paeps 691e948693eSPhilip Paeps typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *, 692e948693eSPhilip Paeps const efx_ev_callbacks_t *, void *); 693e948693eSPhilip Paeps 6943c838a9fSAndrew Rybchenko typedef struct efx_evq_rxq_state_s { 6953c838a9fSAndrew Rybchenko unsigned int eers_rx_read_ptr; 6963c838a9fSAndrew Rybchenko unsigned int eers_rx_mask; 6973c838a9fSAndrew Rybchenko } efx_evq_rxq_state_t; 6983c838a9fSAndrew Rybchenko 699e948693eSPhilip Paeps struct efx_evq_s { 700e948693eSPhilip Paeps uint32_t ee_magic; 701e948693eSPhilip Paeps efx_nic_t *ee_enp; 702e948693eSPhilip Paeps unsigned int ee_index; 703e948693eSPhilip Paeps unsigned int ee_mask; 704e948693eSPhilip Paeps efsys_mem_t *ee_esmp; 705e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 706e948693eSPhilip Paeps uint32_t ee_stat[EV_NQSTATS]; 707e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 7083c838a9fSAndrew Rybchenko 7093c838a9fSAndrew Rybchenko efx_ev_handler_t ee_rx; 7103c838a9fSAndrew Rybchenko efx_ev_handler_t ee_tx; 7113c838a9fSAndrew Rybchenko efx_ev_handler_t ee_driver; 7123c838a9fSAndrew Rybchenko efx_ev_handler_t ee_global; 7133c838a9fSAndrew Rybchenko efx_ev_handler_t ee_drv_gen; 7143c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 7153c838a9fSAndrew Rybchenko efx_ev_handler_t ee_mcdi; 7163c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 7173c838a9fSAndrew Rybchenko 7183c838a9fSAndrew Rybchenko efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS]; 71982d2a148SAndrew Rybchenko 72082d2a148SAndrew Rybchenko uint32_t ee_flags; 721e948693eSPhilip Paeps }; 722e948693eSPhilip Paeps 723e948693eSPhilip Paeps #define EFX_EVQ_MAGIC 0x08081997 724e948693eSPhilip Paeps 725af9078c3SAndrew Rybchenko #define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */ 726e948693eSPhilip Paeps 727e948693eSPhilip Paeps struct efx_rxq_s { 728e948693eSPhilip Paeps uint32_t er_magic; 729e948693eSPhilip Paeps efx_nic_t *er_enp; 7303c838a9fSAndrew Rybchenko efx_evq_t *er_eep; 731e948693eSPhilip Paeps unsigned int er_index; 7323c838a9fSAndrew Rybchenko unsigned int er_label; 733e948693eSPhilip Paeps unsigned int er_mask; 734e948693eSPhilip Paeps efsys_mem_t *er_esmp; 735e948693eSPhilip Paeps }; 736e948693eSPhilip Paeps 737e948693eSPhilip Paeps #define EFX_RXQ_MAGIC 0x15022005 738e948693eSPhilip Paeps 739e948693eSPhilip Paeps struct efx_txq_s { 740e948693eSPhilip Paeps uint32_t et_magic; 741e948693eSPhilip Paeps efx_nic_t *et_enp; 742e948693eSPhilip Paeps unsigned int et_index; 743e948693eSPhilip Paeps unsigned int et_mask; 744e948693eSPhilip Paeps efsys_mem_t *et_esmp; 7453c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 7463c838a9fSAndrew Rybchenko uint32_t et_pio_bufnum; 7473c838a9fSAndrew Rybchenko uint32_t et_pio_blknum; 7483c838a9fSAndrew Rybchenko uint32_t et_pio_write_offset; 7493c838a9fSAndrew Rybchenko uint32_t et_pio_offset; 7503c838a9fSAndrew Rybchenko size_t et_pio_size; 7513c838a9fSAndrew Rybchenko #endif 752e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 753e948693eSPhilip Paeps uint32_t et_stat[TX_NQSTATS]; 754e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 755e948693eSPhilip Paeps }; 756e948693eSPhilip Paeps 757e948693eSPhilip Paeps #define EFX_TXQ_MAGIC 0x05092005 758e948693eSPhilip Paeps 759e948693eSPhilip Paeps #define EFX_MAC_ADDR_COPY(_dst, _src) \ 760e948693eSPhilip Paeps do { \ 761e948693eSPhilip Paeps (_dst)[0] = (_src)[0]; \ 762e948693eSPhilip Paeps (_dst)[1] = (_src)[1]; \ 763e948693eSPhilip Paeps (_dst)[2] = (_src)[2]; \ 764e948693eSPhilip Paeps (_dst)[3] = (_src)[3]; \ 765e948693eSPhilip Paeps (_dst)[4] = (_src)[4]; \ 766e948693eSPhilip Paeps (_dst)[5] = (_src)[5]; \ 767e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 768e948693eSPhilip Paeps } while (B_FALSE) 769e948693eSPhilip Paeps 7703c838a9fSAndrew Rybchenko #define EFX_MAC_BROADCAST_ADDR_SET(_dst) \ 7713c838a9fSAndrew Rybchenko do { \ 7723c838a9fSAndrew Rybchenko uint16_t *_d = (uint16_t *)(_dst); \ 7733c838a9fSAndrew Rybchenko _d[0] = 0xffff; \ 7743c838a9fSAndrew Rybchenko _d[1] = 0xffff; \ 7753c838a9fSAndrew Rybchenko _d[2] = 0xffff; \ 7763c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 7773c838a9fSAndrew Rybchenko } while (B_FALSE) 7783c838a9fSAndrew Rybchenko 779e948693eSPhilip Paeps #if EFSYS_OPT_CHECK_REG 780e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) \ 781e948693eSPhilip Paeps do { \ 7823c838a9fSAndrew Rybchenko const char *name = #_reg; \ 783e948693eSPhilip Paeps char min = name[4]; \ 784e948693eSPhilip Paeps char max = name[5]; \ 785e948693eSPhilip Paeps char rev; \ 786e948693eSPhilip Paeps \ 787e948693eSPhilip Paeps switch ((_enp)->en_family) { \ 788e948693eSPhilip Paeps case EFX_FAMILY_SIENA: \ 789e948693eSPhilip Paeps rev = 'C'; \ 790e948693eSPhilip Paeps break; \ 791e948693eSPhilip Paeps \ 7923c838a9fSAndrew Rybchenko case EFX_FAMILY_HUNTINGTON: \ 7933c838a9fSAndrew Rybchenko rev = 'D'; \ 7943c838a9fSAndrew Rybchenko break; \ 7953c838a9fSAndrew Rybchenko \ 79634f6ea29SAndrew Rybchenko case EFX_FAMILY_MEDFORD: \ 79734f6ea29SAndrew Rybchenko rev = 'E'; \ 79834f6ea29SAndrew Rybchenko break; \ 79934f6ea29SAndrew Rybchenko \ 800e948693eSPhilip Paeps default: \ 801e948693eSPhilip Paeps rev = '?'; \ 802e948693eSPhilip Paeps break; \ 803e948693eSPhilip Paeps } \ 804e948693eSPhilip Paeps \ 805e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, >=, min); \ 806e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, <=, max); \ 807e948693eSPhilip Paeps \ 808e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 809e948693eSPhilip Paeps } while (B_FALSE) 810e948693eSPhilip Paeps #else 811e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) do { \ 812e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 813e948693eSPhilip Paeps } while (B_FALSE) 814e948693eSPhilip Paeps #endif 815e948693eSPhilip Paeps 816e948693eSPhilip Paeps #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \ 817e948693eSPhilip Paeps do { \ 818e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 819e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \ 820e948693eSPhilip Paeps (_edp), (_lock)); \ 821e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \ 822e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 823e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 824e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 825e948693eSPhilip Paeps } while (B_FALSE) 826e948693eSPhilip Paeps 827e948693eSPhilip Paeps #define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \ 828e948693eSPhilip Paeps do { \ 829e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 830e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \ 831e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 832e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 833e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \ 834e948693eSPhilip Paeps (_edp), (_lock)); \ 835e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 836e948693eSPhilip Paeps } while (B_FALSE) 837e948693eSPhilip Paeps 838e948693eSPhilip Paeps #define EFX_BAR_READQ(_enp, _reg, _eqp) \ 839e948693eSPhilip Paeps do { \ 840e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 841e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \ 842e948693eSPhilip Paeps (_eqp)); \ 843e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \ 844e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 845e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 846e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 847e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 848e948693eSPhilip Paeps } while (B_FALSE) 849e948693eSPhilip Paeps 850e948693eSPhilip Paeps #define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \ 851e948693eSPhilip Paeps do { \ 852e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 853e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \ 854e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 855e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 856e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 857e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \ 858e948693eSPhilip Paeps (_eqp)); \ 859e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 860e948693eSPhilip Paeps } while (B_FALSE) 861e948693eSPhilip Paeps 862e948693eSPhilip Paeps #define EFX_BAR_READO(_enp, _reg, _eop) \ 863e948693eSPhilip Paeps do { \ 864e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 865e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \ 866e948693eSPhilip Paeps (_eop), B_TRUE); \ 867e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \ 868e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 869e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 870e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 871e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 872e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 873e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 874e948693eSPhilip Paeps } while (B_FALSE) 875e948693eSPhilip Paeps 876e948693eSPhilip Paeps #define EFX_BAR_WRITEO(_enp, _reg, _eop) \ 877e948693eSPhilip Paeps do { \ 878e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 879e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \ 880e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 881e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 882e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 883e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 884e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 885e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \ 886e948693eSPhilip Paeps (_eop), B_TRUE); \ 887e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 888e948693eSPhilip Paeps } while (B_FALSE) 889e948693eSPhilip Paeps 890e948693eSPhilip Paeps #define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \ 891e948693eSPhilip Paeps do { \ 892e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 893e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, \ 894e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 895e948693eSPhilip Paeps (_edp), (_lock)); \ 896e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \ 897e948693eSPhilip Paeps uint32_t, (_index), \ 898e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 899e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 900e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 901e948693eSPhilip Paeps } while (B_FALSE) 902e948693eSPhilip Paeps 903e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \ 904e948693eSPhilip Paeps do { \ 905e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 906e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 907e948693eSPhilip Paeps uint32_t, (_index), \ 908e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 909e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 910e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 911e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 912e948693eSPhilip Paeps (_edp), (_lock)); \ 913e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 914e948693eSPhilip Paeps } while (B_FALSE) 915e948693eSPhilip Paeps 9163c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITED2(_enp, _reg, _index, _edp, _lock) \ 9173c838a9fSAndrew Rybchenko do { \ 9183c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 9193c838a9fSAndrew Rybchenko EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 9203c838a9fSAndrew Rybchenko uint32_t, (_index), \ 9213c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 9223c838a9fSAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 9233c838a9fSAndrew Rybchenko EFSYS_BAR_WRITED((_enp)->en_esbp, \ 9243c838a9fSAndrew Rybchenko (_reg ## _OFST + \ 9253c838a9fSAndrew Rybchenko (2 * sizeof (efx_dword_t)) + \ 9263c838a9fSAndrew Rybchenko ((_index) * _reg ## _STEP)), \ 9273c838a9fSAndrew Rybchenko (_edp), (_lock)); \ 9283c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 9293c838a9fSAndrew Rybchenko } while (B_FALSE) 9303c838a9fSAndrew Rybchenko 931e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \ 932e948693eSPhilip Paeps do { \ 933e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 934e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 935e948693eSPhilip Paeps uint32_t, (_index), \ 936e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 937e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 938e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 939e948693eSPhilip Paeps (_reg ## _OFST + \ 940e948693eSPhilip Paeps (3 * sizeof (efx_dword_t)) + \ 941e948693eSPhilip Paeps ((_index) * _reg ## _STEP)), \ 942e948693eSPhilip Paeps (_edp), (_lock)); \ 943e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 944e948693eSPhilip Paeps } while (B_FALSE) 945e948693eSPhilip Paeps 946e948693eSPhilip Paeps #define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \ 947e948693eSPhilip Paeps do { \ 948e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 949e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, \ 950e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 951e948693eSPhilip Paeps (_eqp)); \ 952e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \ 953e948693eSPhilip Paeps uint32_t, (_index), \ 954e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 955e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 956e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 957e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 958e948693eSPhilip Paeps } while (B_FALSE) 959e948693eSPhilip Paeps 960e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \ 961e948693eSPhilip Paeps do { \ 962e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 963e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \ 964e948693eSPhilip Paeps uint32_t, (_index), \ 965e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 966e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 967e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 968e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, \ 969e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 970e948693eSPhilip Paeps (_eqp)); \ 971e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 972e948693eSPhilip Paeps } while (B_FALSE) 973e948693eSPhilip Paeps 9743c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \ 975e948693eSPhilip Paeps do { \ 976e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 977e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, \ 978e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 9793c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 980e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \ 981e948693eSPhilip Paeps uint32_t, (_index), \ 982e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 983e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 984e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 985e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 986e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 987e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 988e948693eSPhilip Paeps } while (B_FALSE) 989e948693eSPhilip Paeps 9903c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \ 991e948693eSPhilip Paeps do { \ 992e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 993e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \ 994e948693eSPhilip Paeps uint32_t, (_index), \ 995e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 996e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 997e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 998e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 999e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 1000e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, \ 1001e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10023c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 10033c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10043c838a9fSAndrew Rybchenko } while (B_FALSE) 10053c838a9fSAndrew Rybchenko 10063c838a9fSAndrew Rybchenko /* 10073c838a9fSAndrew Rybchenko * Allow drivers to perform optimised 128-bit doorbell writes. 10083c838a9fSAndrew Rybchenko * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are 10093c838a9fSAndrew Rybchenko * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid 10103c838a9fSAndrew Rybchenko * the need for locking in the host, and are the only ones known to be safe to 10113c838a9fSAndrew Rybchenko * use 128-bites write with. 10123c838a9fSAndrew Rybchenko */ 10133c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \ 10143c838a9fSAndrew Rybchenko do { \ 10153c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 10163c838a9fSAndrew Rybchenko EFSYS_PROBE7(efx_bar_tbl_doorbell_writeo, \ 10173c838a9fSAndrew Rybchenko const char *, \ 10183c838a9fSAndrew Rybchenko #_reg, \ 10193c838a9fSAndrew Rybchenko uint32_t, (_index), \ 10203c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 10213c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[3], \ 10223c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[2], \ 10233c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[1], \ 10243c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[0]); \ 10253c838a9fSAndrew Rybchenko EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \ 10263c838a9fSAndrew Rybchenko (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10273c838a9fSAndrew Rybchenko (_eop)); \ 10283c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10293c838a9fSAndrew Rybchenko } while (B_FALSE) 10303c838a9fSAndrew Rybchenko 10313c838a9fSAndrew Rybchenko #define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \ 10323c838a9fSAndrew Rybchenko do { \ 10333c838a9fSAndrew Rybchenko unsigned int _new = (_wptr); \ 10343c838a9fSAndrew Rybchenko unsigned int _old = (_owptr); \ 10353c838a9fSAndrew Rybchenko \ 10363c838a9fSAndrew Rybchenko if ((_new) >= (_old)) \ 10373c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10383c838a9fSAndrew Rybchenko (_old) * sizeof (efx_desc_t), \ 10393c838a9fSAndrew Rybchenko ((_new) - (_old)) * sizeof (efx_desc_t)); \ 10403c838a9fSAndrew Rybchenko else \ 10413c838a9fSAndrew Rybchenko /* \ 10423c838a9fSAndrew Rybchenko * It is cheaper to sync entire map than sync \ 10433c838a9fSAndrew Rybchenko * two parts especially when offset/size are \ 10443c838a9fSAndrew Rybchenko * ignored and entire map is synced in any case.\ 10453c838a9fSAndrew Rybchenko */ \ 10463c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10473c838a9fSAndrew Rybchenko 0, \ 10483c838a9fSAndrew Rybchenko (_entries) * sizeof (efx_desc_t)); \ 1049e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1050e948693eSPhilip Paeps } while (B_FALSE) 1051e948693eSPhilip Paeps 1052460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 10533c838a9fSAndrew Rybchenko efx_nic_biu_test( 10543c838a9fSAndrew Rybchenko __in efx_nic_t *enp); 10553c838a9fSAndrew Rybchenko 1056460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1057e948693eSPhilip Paeps efx_mac_select( 1058e948693eSPhilip Paeps __in efx_nic_t *enp); 1059e948693eSPhilip Paeps 10603c838a9fSAndrew Rybchenko extern void 10613c838a9fSAndrew Rybchenko efx_mac_multicast_hash_compute( 10623c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 10633c838a9fSAndrew Rybchenko __in int count, 10643c838a9fSAndrew Rybchenko __out efx_oword_t *hash_low, 10653c838a9fSAndrew Rybchenko __out efx_oword_t *hash_high); 10663c838a9fSAndrew Rybchenko 1067460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1068e948693eSPhilip Paeps efx_phy_probe( 1069e948693eSPhilip Paeps __in efx_nic_t *enp); 1070e948693eSPhilip Paeps 1071e948693eSPhilip Paeps extern void 1072e948693eSPhilip Paeps efx_phy_unprobe( 1073e948693eSPhilip Paeps __in efx_nic_t *enp); 1074e948693eSPhilip Paeps 1075e948693eSPhilip Paeps #if EFSYS_OPT_VPD 1076e948693eSPhilip Paeps 1077e948693eSPhilip Paeps /* VPD utility functions */ 1078e948693eSPhilip Paeps 1079460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1080e948693eSPhilip Paeps efx_vpd_hunk_length( 1081e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1082e948693eSPhilip Paeps __in size_t size, 1083e948693eSPhilip Paeps __out size_t *lengthp); 1084e948693eSPhilip Paeps 1085460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1086e948693eSPhilip Paeps efx_vpd_hunk_verify( 1087e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1088e948693eSPhilip Paeps __in size_t size, 1089e948693eSPhilip Paeps __out_opt boolean_t *cksummedp); 1090e948693eSPhilip Paeps 1091460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1092e948693eSPhilip Paeps efx_vpd_hunk_reinit( 10933c838a9fSAndrew Rybchenko __in_bcount(size) caddr_t data, 1094e948693eSPhilip Paeps __in size_t size, 1095e948693eSPhilip Paeps __in boolean_t wantpid); 1096e948693eSPhilip Paeps 1097460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1098e948693eSPhilip Paeps efx_vpd_hunk_get( 1099e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1100e948693eSPhilip Paeps __in size_t size, 1101e948693eSPhilip Paeps __in efx_vpd_tag_t tag, 1102e948693eSPhilip Paeps __in efx_vpd_keyword_t keyword, 1103e948693eSPhilip Paeps __out unsigned int *payloadp, 1104e948693eSPhilip Paeps __out uint8_t *paylenp); 1105e948693eSPhilip Paeps 1106460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1107e948693eSPhilip Paeps efx_vpd_hunk_next( 1108e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1109e948693eSPhilip Paeps __in size_t size, 1110e948693eSPhilip Paeps __out efx_vpd_tag_t *tagp, 1111e948693eSPhilip Paeps __out efx_vpd_keyword_t *keyword, 111286ec4b85SAndrew Rybchenko __out_opt unsigned int *payloadp, 1113e948693eSPhilip Paeps __out_opt uint8_t *paylenp, 1114e948693eSPhilip Paeps __inout unsigned int *contp); 1115e948693eSPhilip Paeps 1116460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1117e948693eSPhilip Paeps efx_vpd_hunk_set( 1118e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1119e948693eSPhilip Paeps __in size_t size, 1120e948693eSPhilip Paeps __in efx_vpd_value_t *evvp); 1121e948693eSPhilip Paeps 1122e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 1123e948693eSPhilip Paeps 1124e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 1125e948693eSPhilip Paeps 11263c838a9fSAndrew Rybchenko extern efx_sram_pattern_fn_t __efx_sram_pattern_fns[]; 1127e948693eSPhilip Paeps 1128e948693eSPhilip Paeps typedef struct efx_register_set_s { 1129e948693eSPhilip Paeps unsigned int address; 1130e948693eSPhilip Paeps unsigned int step; 1131e948693eSPhilip Paeps unsigned int rows; 1132e948693eSPhilip Paeps efx_oword_t mask; 1133e948693eSPhilip Paeps } efx_register_set_t; 1134e948693eSPhilip Paeps 1135460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1136e948693eSPhilip Paeps efx_nic_test_registers( 1137e948693eSPhilip Paeps __in efx_nic_t *enp, 1138e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1139e948693eSPhilip Paeps __in size_t count); 1140e948693eSPhilip Paeps 1141460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1142e948693eSPhilip Paeps efx_nic_test_tables( 1143e948693eSPhilip Paeps __in efx_nic_t *enp, 1144e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1145e948693eSPhilip Paeps __in efx_pattern_type_t pattern, 1146e948693eSPhilip Paeps __in size_t count); 1147e948693eSPhilip Paeps 1148e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 1149e948693eSPhilip Paeps 11503c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 11513c838a9fSAndrew Rybchenko 1152460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11533c838a9fSAndrew Rybchenko efx_mcdi_set_workaround( 11543c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11553c838a9fSAndrew Rybchenko __in uint32_t type, 11563c838a9fSAndrew Rybchenko __in boolean_t enabled, 11573c838a9fSAndrew Rybchenko __out_opt uint32_t *flagsp); 11583c838a9fSAndrew Rybchenko 1159460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11603c838a9fSAndrew Rybchenko efx_mcdi_get_workarounds( 11613c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11623c838a9fSAndrew Rybchenko __out_opt uint32_t *implementedp, 11633c838a9fSAndrew Rybchenko __out_opt uint32_t *enabledp); 11643c838a9fSAndrew Rybchenko 11653c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 11663c838a9fSAndrew Rybchenko 116758a72cb2SAndrew Rybchenko #if EFSYS_OPT_MAC_STATS 116858a72cb2SAndrew Rybchenko 116958a72cb2SAndrew Rybchenko /* 117058a72cb2SAndrew Rybchenko * Closed range of stats (i.e. the first and the last are included). 117158a72cb2SAndrew Rybchenko * The last must be greater or equal (if the range is one item only) to 117258a72cb2SAndrew Rybchenko * the first. 117358a72cb2SAndrew Rybchenko */ 117458a72cb2SAndrew Rybchenko struct efx_mac_stats_range { 117558a72cb2SAndrew Rybchenko efx_mac_stat_t first; 117658a72cb2SAndrew Rybchenko efx_mac_stat_t last; 117758a72cb2SAndrew Rybchenko }; 117858a72cb2SAndrew Rybchenko 117958a72cb2SAndrew Rybchenko extern efx_rc_t 118058a72cb2SAndrew Rybchenko efx_mac_stats_mask_add_ranges( 118158a72cb2SAndrew Rybchenko __inout_bcount(mask_size) uint32_t *maskp, 118258a72cb2SAndrew Rybchenko __in size_t mask_size, 118358a72cb2SAndrew Rybchenko __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, 118458a72cb2SAndrew Rybchenko __in unsigned int rng_count); 118558a72cb2SAndrew Rybchenko 118658a72cb2SAndrew Rybchenko #endif /* EFSYS_OPT_MAC_STATS */ 118758a72cb2SAndrew Rybchenko 1188e948693eSPhilip Paeps #ifdef __cplusplus 1189e948693eSPhilip Paeps } 1190e948693eSPhilip Paeps #endif 1191e948693eSPhilip Paeps 1192e948693eSPhilip Paeps #endif /* _SYS_EFX_IMPL_H */ 1193