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 "efsys.h" 37e948693eSPhilip Paeps #include "efx.h" 38e948693eSPhilip Paeps #include "efx_regs.h" 393c838a9fSAndrew Rybchenko #include "efx_regs_ef10.h" 403c838a9fSAndrew Rybchenko 413c838a9fSAndrew Rybchenko /* FIXME: Add definition for driver generated software events */ 423c838a9fSAndrew Rybchenko #ifndef ESE_DZ_EV_CODE_DRV_GEN_EV 433c838a9fSAndrew Rybchenko #define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV 443c838a9fSAndrew Rybchenko #endif 453c838a9fSAndrew Rybchenko 463c838a9fSAndrew Rybchenko #include "efx_check.h" 473c838a9fSAndrew Rybchenko 48e948693eSPhilip Paeps 49e948693eSPhilip Paeps #if EFSYS_OPT_FALCON 50e948693eSPhilip Paeps #include "falcon_impl.h" 51e948693eSPhilip Paeps #endif /* EFSYS_OPT_FALCON */ 52e948693eSPhilip Paeps 53e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 54e948693eSPhilip Paeps #include "siena_impl.h" 55e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 56e948693eSPhilip Paeps 573c838a9fSAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON 583c838a9fSAndrew Rybchenko #include "hunt_impl.h" 593c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON */ 603c838a9fSAndrew Rybchenko 615f5c71ccSAndrew Rybchenko #if EFSYS_OPT_MEDFORD 625f5c71ccSAndrew Rybchenko #include "medford_impl.h" 635f5c71ccSAndrew Rybchenko #endif /* EFSYS_OPT_MEDFORD */ 645f5c71ccSAndrew Rybchenko 655f5c71ccSAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 665f5c71ccSAndrew Rybchenko #include "ef10_impl.h" 675f5c71ccSAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 685f5c71ccSAndrew Rybchenko 69e948693eSPhilip Paeps #ifdef __cplusplus 70e948693eSPhilip Paeps extern "C" { 71e948693eSPhilip Paeps #endif 72e948693eSPhilip Paeps 73e948693eSPhilip Paeps #define EFX_MOD_MCDI 0x00000001 74e948693eSPhilip Paeps #define EFX_MOD_PROBE 0x00000002 75e948693eSPhilip Paeps #define EFX_MOD_NVRAM 0x00000004 76e948693eSPhilip Paeps #define EFX_MOD_VPD 0x00000008 77e948693eSPhilip Paeps #define EFX_MOD_NIC 0x00000010 78e948693eSPhilip Paeps #define EFX_MOD_INTR 0x00000020 79e948693eSPhilip Paeps #define EFX_MOD_EV 0x00000040 80e948693eSPhilip Paeps #define EFX_MOD_RX 0x00000080 81e948693eSPhilip Paeps #define EFX_MOD_TX 0x00000100 82e948693eSPhilip Paeps #define EFX_MOD_PORT 0x00000200 83e948693eSPhilip Paeps #define EFX_MOD_MON 0x00000400 84e948693eSPhilip Paeps #define EFX_MOD_WOL 0x00000800 85e948693eSPhilip Paeps #define EFX_MOD_FILTER 0x00001000 863c838a9fSAndrew Rybchenko #define EFX_MOD_PKTFILTER 0x00002000 87e948693eSPhilip Paeps 88e948693eSPhilip Paeps #define EFX_RESET_MAC 0x00000001 89e948693eSPhilip Paeps #define EFX_RESET_PHY 0x00000002 903c838a9fSAndrew Rybchenko #define EFX_RESET_RXQ_ERR 0x00000004 913c838a9fSAndrew Rybchenko #define EFX_RESET_TXQ_ERR 0x00000008 92e948693eSPhilip Paeps 93e948693eSPhilip Paeps typedef enum efx_mac_type_e { 94e948693eSPhilip Paeps EFX_MAC_INVALID = 0, 95e948693eSPhilip Paeps EFX_MAC_FALCON_GMAC, 96e948693eSPhilip Paeps EFX_MAC_FALCON_XMAC, 97e948693eSPhilip Paeps EFX_MAC_SIENA, 983c838a9fSAndrew Rybchenko EFX_MAC_HUNTINGTON, 99e948693eSPhilip Paeps EFX_MAC_NTYPES 100e948693eSPhilip Paeps } efx_mac_type_t; 101e948693eSPhilip Paeps 1023c838a9fSAndrew Rybchenko typedef struct efx_ev_ops_s { 103460cb568SAndrew Rybchenko efx_rc_t (*eevo_init)(efx_nic_t *); 1043c838a9fSAndrew Rybchenko void (*eevo_fini)(efx_nic_t *); 105460cb568SAndrew Rybchenko efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int, 1063c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 1073c838a9fSAndrew Rybchenko efx_evq_t *); 1083c838a9fSAndrew Rybchenko void (*eevo_qdestroy)(efx_evq_t *); 109460cb568SAndrew Rybchenko efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int); 1103c838a9fSAndrew Rybchenko void (*eevo_qpost)(efx_evq_t *, uint16_t); 111460cb568SAndrew Rybchenko efx_rc_t (*eevo_qmoderate)(efx_evq_t *, unsigned int); 1123c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1133c838a9fSAndrew Rybchenko void (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *); 1143c838a9fSAndrew Rybchenko #endif 1153c838a9fSAndrew Rybchenko } efx_ev_ops_t; 1163c838a9fSAndrew Rybchenko 1173c838a9fSAndrew Rybchenko typedef struct efx_tx_ops_s { 118460cb568SAndrew Rybchenko efx_rc_t (*etxo_init)(efx_nic_t *); 1193c838a9fSAndrew Rybchenko void (*etxo_fini)(efx_nic_t *); 120460cb568SAndrew Rybchenko efx_rc_t (*etxo_qcreate)(efx_nic_t *, 1213c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1223c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, 1233c838a9fSAndrew Rybchenko uint32_t, uint16_t, 1243c838a9fSAndrew Rybchenko efx_evq_t *, efx_txq_t *, 1253c838a9fSAndrew Rybchenko unsigned int *); 1263c838a9fSAndrew Rybchenko void (*etxo_qdestroy)(efx_txq_t *); 127460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpost)(efx_txq_t *, efx_buffer_t *, 1283c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1293c838a9fSAndrew Rybchenko unsigned int *); 1303c838a9fSAndrew Rybchenko void (*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int); 131460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpace)(efx_txq_t *, unsigned int); 132460cb568SAndrew Rybchenko efx_rc_t (*etxo_qflush)(efx_txq_t *); 1333c838a9fSAndrew Rybchenko void (*etxo_qenable)(efx_txq_t *); 134460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_enable)(efx_txq_t *); 1353c838a9fSAndrew Rybchenko void (*etxo_qpio_disable)(efx_txq_t *); 136460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_write)(efx_txq_t *,uint8_t *, size_t, 1373c838a9fSAndrew Rybchenko size_t); 138460cb568SAndrew Rybchenko efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int, 1393c838a9fSAndrew Rybchenko unsigned int *); 140460cb568SAndrew Rybchenko efx_rc_t (*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *, 1413c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1423c838a9fSAndrew Rybchenko unsigned int *); 1433c838a9fSAndrew Rybchenko void (*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t, 1443c838a9fSAndrew Rybchenko size_t, boolean_t, 1453c838a9fSAndrew Rybchenko efx_desc_t *); 1463c838a9fSAndrew Rybchenko void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t, 1473c838a9fSAndrew Rybchenko uint32_t, uint8_t, 1483c838a9fSAndrew Rybchenko efx_desc_t *); 1493c838a9fSAndrew Rybchenko void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t, 1503c838a9fSAndrew Rybchenko efx_desc_t *); 1513c838a9fSAndrew Rybchenko #if EFSYS_OPT_QSTATS 1523c838a9fSAndrew Rybchenko void (*etxo_qstats_update)(efx_txq_t *, 1533c838a9fSAndrew Rybchenko efsys_stat_t *); 1543c838a9fSAndrew Rybchenko #endif 1553c838a9fSAndrew Rybchenko } efx_tx_ops_t; 1563c838a9fSAndrew Rybchenko 1573c838a9fSAndrew Rybchenko typedef struct efx_rx_ops_s { 158460cb568SAndrew Rybchenko efx_rc_t (*erxo_init)(efx_nic_t *); 1593c838a9fSAndrew Rybchenko void (*erxo_fini)(efx_nic_t *); 1603c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_HDR_SPLIT 161460cb568SAndrew Rybchenko efx_rc_t (*erxo_hdr_split_enable)(efx_nic_t *, unsigned int, 1623c838a9fSAndrew Rybchenko unsigned int); 1633c838a9fSAndrew Rybchenko #endif 1643c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCATTER 165460cb568SAndrew Rybchenko efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int); 1663c838a9fSAndrew Rybchenko #endif 1673c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 168460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_mode_set)(efx_nic_t *, efx_rx_hash_alg_t, 1693c838a9fSAndrew Rybchenko efx_rx_hash_type_t, boolean_t); 170460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t); 171460cb568SAndrew Rybchenko efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, unsigned int *, 1723c838a9fSAndrew Rybchenko size_t); 1733c838a9fSAndrew Rybchenko #endif 1743c838a9fSAndrew Rybchenko void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t, 1753c838a9fSAndrew Rybchenko unsigned int, unsigned int, 1763c838a9fSAndrew Rybchenko unsigned int); 1773c838a9fSAndrew Rybchenko void (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *); 178460cb568SAndrew Rybchenko efx_rc_t (*erxo_qflush)(efx_rxq_t *); 1793c838a9fSAndrew Rybchenko void (*erxo_qenable)(efx_rxq_t *); 180460cb568SAndrew Rybchenko efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int, 1813c838a9fSAndrew Rybchenko unsigned int, efx_rxq_type_t, 1823c838a9fSAndrew Rybchenko efsys_mem_t *, size_t, uint32_t, 1833c838a9fSAndrew Rybchenko efx_evq_t *, efx_rxq_t *); 1843c838a9fSAndrew Rybchenko void (*erxo_qdestroy)(efx_rxq_t *); 1853c838a9fSAndrew Rybchenko } efx_rx_ops_t; 1863c838a9fSAndrew Rybchenko 187e948693eSPhilip Paeps typedef struct efx_mac_ops_s { 188460cb568SAndrew Rybchenko efx_rc_t (*emo_reset)(efx_nic_t *); /* optional */ 189460cb568SAndrew Rybchenko efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *); 190460cb568SAndrew Rybchenko efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *); 191460cb568SAndrew Rybchenko efx_rc_t (*emo_addr_set)(efx_nic_t *); 192460cb568SAndrew Rybchenko efx_rc_t (*emo_reconfigure)(efx_nic_t *); 193460cb568SAndrew Rybchenko efx_rc_t (*emo_multicast_list_set)(efx_nic_t *); 194460cb568SAndrew Rybchenko efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *, 1953c838a9fSAndrew Rybchenko efx_rxq_t *, boolean_t); 1963c838a9fSAndrew Rybchenko void (*emo_filter_default_rxq_clear)(efx_nic_t *); 197e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 198460cb568SAndrew Rybchenko efx_rc_t (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t, 199e948693eSPhilip Paeps efx_loopback_type_t); 200e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 201e948693eSPhilip Paeps #if EFSYS_OPT_MAC_STATS 202460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); 203460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, 204e948693eSPhilip Paeps uint16_t, boolean_t); 205460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 206e948693eSPhilip Paeps efsys_stat_t *, uint32_t *); 207e948693eSPhilip Paeps #endif /* EFSYS_OPT_MAC_STATS */ 208e948693eSPhilip Paeps } efx_mac_ops_t; 209e948693eSPhilip Paeps 210e948693eSPhilip Paeps typedef struct efx_phy_ops_s { 211460cb568SAndrew Rybchenko efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */ 212460cb568SAndrew Rybchenko efx_rc_t (*epo_reset)(efx_nic_t *); 213460cb568SAndrew Rybchenko efx_rc_t (*epo_reconfigure)(efx_nic_t *); 214460cb568SAndrew Rybchenko efx_rc_t (*epo_verify)(efx_nic_t *); 215460cb568SAndrew Rybchenko efx_rc_t (*epo_uplink_check)(efx_nic_t *, 216e948693eSPhilip Paeps boolean_t *); /* optional */ 217460cb568SAndrew Rybchenko efx_rc_t (*epo_downlink_check)(efx_nic_t *, efx_link_mode_t *, 218e948693eSPhilip Paeps unsigned int *, uint32_t *); 219460cb568SAndrew Rybchenko efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *); 220e948693eSPhilip Paeps #if EFSYS_OPT_PHY_STATS 221460cb568SAndrew Rybchenko efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *, 222e948693eSPhilip Paeps uint32_t *); 223e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_STATS */ 224e948693eSPhilip Paeps #if EFSYS_OPT_PHY_PROPS 225e948693eSPhilip Paeps #if EFSYS_OPT_NAMES 2263c838a9fSAndrew Rybchenko const char *(*epo_prop_name)(efx_nic_t *, unsigned int); 227e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_PROPS */ 228460cb568SAndrew Rybchenko efx_rc_t (*epo_prop_get)(efx_nic_t *, unsigned int, uint32_t, 229e948693eSPhilip Paeps uint32_t *); 230460cb568SAndrew Rybchenko efx_rc_t (*epo_prop_set)(efx_nic_t *, unsigned int, uint32_t); 231e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_PROPS */ 2323c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 233460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *); 234460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t); 235460cb568SAndrew Rybchenko efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t, 2363c838a9fSAndrew Rybchenko efx_bist_result_t *, uint32_t *, 237e948693eSPhilip Paeps unsigned long *, size_t); 2383c838a9fSAndrew Rybchenko void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t); 2393c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_BIST */ 240e948693eSPhilip Paeps } efx_phy_ops_t; 241e948693eSPhilip Paeps 2423c838a9fSAndrew Rybchenko #if EFSYS_OPT_FILTER 2433c838a9fSAndrew Rybchenko typedef struct efx_filter_ops_s { 244460cb568SAndrew Rybchenko efx_rc_t (*efo_init)(efx_nic_t *); 2453c838a9fSAndrew Rybchenko void (*efo_fini)(efx_nic_t *); 246460cb568SAndrew Rybchenko efx_rc_t (*efo_restore)(efx_nic_t *); 247460cb568SAndrew Rybchenko efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *, 2483c838a9fSAndrew Rybchenko boolean_t may_replace); 249460cb568SAndrew Rybchenko efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *); 250460cb568SAndrew Rybchenko efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *); 251460cb568SAndrew Rybchenko efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t, 2523c838a9fSAndrew Rybchenko boolean_t, boolean_t, boolean_t, 2533c838a9fSAndrew Rybchenko uint8_t const *, int); 2543c838a9fSAndrew Rybchenko } efx_filter_ops_t; 2553c838a9fSAndrew Rybchenko 256460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 2573c838a9fSAndrew Rybchenko efx_filter_reconfigure( 2583c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 2593c838a9fSAndrew Rybchenko __in_ecount(6) uint8_t const *mac_addr, 2603c838a9fSAndrew Rybchenko __in boolean_t all_unicst, 2613c838a9fSAndrew Rybchenko __in boolean_t mulcst, 2623c838a9fSAndrew Rybchenko __in boolean_t all_mulcst, 2633c838a9fSAndrew Rybchenko __in boolean_t brdcst, 2643c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 2653c838a9fSAndrew Rybchenko __in int count); 2663c838a9fSAndrew Rybchenko 2673c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_FILTER */ 2683c838a9fSAndrew Rybchenko 2693c838a9fSAndrew Rybchenko 270e948693eSPhilip Paeps typedef struct efx_port_s { 271e948693eSPhilip Paeps efx_mac_type_t ep_mac_type; 272e948693eSPhilip Paeps uint32_t ep_phy_type; 273e948693eSPhilip Paeps uint8_t ep_port; 274e948693eSPhilip Paeps uint32_t ep_mac_pdu; 275e948693eSPhilip Paeps uint8_t ep_mac_addr[6]; 276e948693eSPhilip Paeps efx_link_mode_t ep_link_mode; 2773c838a9fSAndrew Rybchenko boolean_t ep_all_unicst; 2783c838a9fSAndrew Rybchenko boolean_t ep_mulcst; 2793c838a9fSAndrew Rybchenko boolean_t ep_all_mulcst; 280e948693eSPhilip Paeps boolean_t ep_brdcst; 281e948693eSPhilip Paeps unsigned int ep_fcntl; 282e948693eSPhilip Paeps boolean_t ep_fcntl_autoneg; 283e948693eSPhilip Paeps efx_oword_t ep_multicst_hash[2]; 2843c838a9fSAndrew Rybchenko uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN * 2853c838a9fSAndrew Rybchenko EFX_MAC_MULTICAST_LIST_MAX]; 2863c838a9fSAndrew Rybchenko uint32_t ep_mulcst_addr_count; 287e948693eSPhilip Paeps #if EFSYS_OPT_LOOPBACK 288e948693eSPhilip Paeps efx_loopback_type_t ep_loopback_type; 289e948693eSPhilip Paeps efx_link_mode_t ep_loopback_link_mode; 290e948693eSPhilip Paeps #endif /* EFSYS_OPT_LOOPBACK */ 291e948693eSPhilip Paeps #if EFSYS_OPT_PHY_FLAGS 292e948693eSPhilip Paeps uint32_t ep_phy_flags; 293e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_FLAGS */ 294e948693eSPhilip Paeps #if EFSYS_OPT_PHY_LED_CONTROL 295e948693eSPhilip Paeps efx_phy_led_mode_t ep_phy_led_mode; 296e948693eSPhilip Paeps #endif /* EFSYS_OPT_PHY_LED_CONTROL */ 297e948693eSPhilip Paeps efx_phy_media_type_t ep_fixed_port_type; 298e948693eSPhilip Paeps efx_phy_media_type_t ep_module_type; 299e948693eSPhilip Paeps uint32_t ep_adv_cap_mask; 300e948693eSPhilip Paeps uint32_t ep_lp_cap_mask; 301e948693eSPhilip Paeps uint32_t ep_default_adv_cap_mask; 302e948693eSPhilip Paeps uint32_t ep_phy_cap_mask; 303e948693eSPhilip Paeps #if EFSYS_OPT_PHY_TXC43128 || EFSYS_OPT_PHY_QT2025C 304e948693eSPhilip Paeps union { 305e948693eSPhilip Paeps struct { 306e948693eSPhilip Paeps unsigned int bug10934_count; 307e948693eSPhilip Paeps } ep_txc43128; 308e948693eSPhilip Paeps struct { 309e948693eSPhilip Paeps unsigned int bug17190_count; 310e948693eSPhilip Paeps } ep_qt2025c; 311e948693eSPhilip Paeps }; 312e948693eSPhilip Paeps #endif 313e948693eSPhilip Paeps boolean_t ep_mac_poll_needed; /* falcon only */ 314e948693eSPhilip Paeps boolean_t ep_mac_up; /* falcon only */ 315e948693eSPhilip Paeps uint32_t ep_fwver; /* falcon only */ 316e948693eSPhilip Paeps boolean_t ep_mac_drain; 317e948693eSPhilip Paeps boolean_t ep_mac_stats_pending; 3183c838a9fSAndrew Rybchenko #if EFSYS_OPT_BIST 3193c838a9fSAndrew Rybchenko efx_bist_type_t ep_current_bist; 320e948693eSPhilip Paeps #endif 321e948693eSPhilip Paeps efx_mac_ops_t *ep_emop; 322e948693eSPhilip Paeps efx_phy_ops_t *ep_epop; 323e948693eSPhilip Paeps } efx_port_t; 324e948693eSPhilip Paeps 325e948693eSPhilip Paeps typedef struct efx_mon_ops_s { 326460cb568SAndrew Rybchenko efx_rc_t (*emo_reset)(efx_nic_t *); 327460cb568SAndrew Rybchenko efx_rc_t (*emo_reconfigure)(efx_nic_t *); 328e948693eSPhilip Paeps #if EFSYS_OPT_MON_STATS 329460cb568SAndrew Rybchenko efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *, 330e948693eSPhilip Paeps efx_mon_stat_value_t *); 331e948693eSPhilip Paeps #endif /* EFSYS_OPT_MON_STATS */ 332e948693eSPhilip Paeps } efx_mon_ops_t; 333e948693eSPhilip Paeps 334e948693eSPhilip Paeps typedef struct efx_mon_s { 335e948693eSPhilip Paeps efx_mon_type_t em_type; 336e948693eSPhilip Paeps efx_mon_ops_t *em_emop; 337e948693eSPhilip Paeps } efx_mon_t; 338e948693eSPhilip Paeps 3393c838a9fSAndrew Rybchenko typedef struct efx_intr_ops_s { 340460cb568SAndrew Rybchenko efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *); 3413c838a9fSAndrew Rybchenko void (*eio_enable)(efx_nic_t *); 3423c838a9fSAndrew Rybchenko void (*eio_disable)(efx_nic_t *); 3433c838a9fSAndrew Rybchenko void (*eio_disable_unlocked)(efx_nic_t *); 344460cb568SAndrew Rybchenko efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int); 3453c838a9fSAndrew Rybchenko void (*eio_fini)(efx_nic_t *); 3463c838a9fSAndrew Rybchenko } efx_intr_ops_t; 3473c838a9fSAndrew Rybchenko 348e948693eSPhilip Paeps typedef struct efx_intr_s { 3493c838a9fSAndrew Rybchenko efx_intr_ops_t *ei_eiop; 350e948693eSPhilip Paeps efsys_mem_t *ei_esmp; 3513c838a9fSAndrew Rybchenko efx_intr_type_t ei_type; 352e948693eSPhilip Paeps unsigned int ei_level; 353e948693eSPhilip Paeps } efx_intr_t; 354e948693eSPhilip Paeps 355e948693eSPhilip Paeps typedef struct efx_nic_ops_s { 356460cb568SAndrew Rybchenko efx_rc_t (*eno_probe)(efx_nic_t *); 357460cb568SAndrew Rybchenko efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*); 358460cb568SAndrew Rybchenko efx_rc_t (*eno_reset)(efx_nic_t *); 359460cb568SAndrew Rybchenko efx_rc_t (*eno_init)(efx_nic_t *); 360460cb568SAndrew Rybchenko efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *); 361460cb568SAndrew Rybchenko efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t, 3623c838a9fSAndrew Rybchenko uint32_t *, size_t *); 363e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 364460cb568SAndrew Rybchenko efx_rc_t (*eno_sram_test)(efx_nic_t *, efx_sram_pattern_fn_t); 365460cb568SAndrew Rybchenko efx_rc_t (*eno_register_test)(efx_nic_t *); 366e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 367e948693eSPhilip Paeps void (*eno_fini)(efx_nic_t *); 368e948693eSPhilip Paeps void (*eno_unprobe)(efx_nic_t *); 369e948693eSPhilip Paeps } efx_nic_ops_t; 370e948693eSPhilip Paeps 3719ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_LIMIT_TARGET 372e948693eSPhilip Paeps #define EFX_TXQ_LIMIT_TARGET 259 3739ab060a7SAndrew Rybchenko #endif 3749ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_LIMIT_TARGET 37575ba9e1eSAndrew Rybchenko #define EFX_RXQ_LIMIT_TARGET 512 3769ab060a7SAndrew Rybchenko #endif 3779ab060a7SAndrew Rybchenko #ifndef EFX_TXQ_DC_SIZE 3789ab060a7SAndrew Rybchenko #define EFX_TXQ_DC_SIZE 1 /* 16 descriptors */ 3799ab060a7SAndrew Rybchenko #endif 3809ab060a7SAndrew Rybchenko #ifndef EFX_RXQ_DC_SIZE 3819ab060a7SAndrew Rybchenko #define EFX_RXQ_DC_SIZE 3 /* 64 descriptors */ 3829ab060a7SAndrew Rybchenko #endif 383e948693eSPhilip Paeps 384e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 385e948693eSPhilip Paeps 3863c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_spec_s { 3873c838a9fSAndrew Rybchenko uint8_t fsfs_type; 3883c838a9fSAndrew Rybchenko uint32_t fsfs_flags; 3893c838a9fSAndrew Rybchenko uint32_t fsfs_dmaq_id; 3903c838a9fSAndrew Rybchenko uint32_t fsfs_dword[3]; 3913c838a9fSAndrew Rybchenko } falconsiena_filter_spec_t; 3923c838a9fSAndrew Rybchenko 3933c838a9fSAndrew Rybchenko typedef enum falconsiena_filter_type_e { 3943c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_TCP_FULL, /* TCP/IPv4 4-tuple {dIP,dTCP,sIP,sTCP} */ 3953c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_TCP_WILD, /* TCP/IPv4 dest {dIP,dTCP, -, -} */ 3963c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_UDP_FULL, /* UDP/IPv4 4-tuple {dIP,dUDP,sIP,sUDP} */ 3973c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_UDP_WILD, /* UDP/IPv4 dest {dIP,dUDP, -, -} */ 398e948693eSPhilip Paeps 399e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 4003c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */ 4013c838a9fSAndrew Rybchenko EFX_FS_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */ 402e948693eSPhilip Paeps 4033c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */ 4043c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */ 4053c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */ 4063c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_UDP_WILD, /* UDP/IPv4 source (host, port) */ 407e948693eSPhilip Paeps 4083c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_MAC_FULL, /* Ethernet source (MAC address, VLAN ID) */ 4093c838a9fSAndrew Rybchenko EFX_FS_FILTER_TX_MAC_WILD, /* Ethernet source (MAC address) */ 410e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 411e948693eSPhilip Paeps 4123c838a9fSAndrew Rybchenko EFX_FS_FILTER_NTYPES 4133c838a9fSAndrew Rybchenko } falconsiena_filter_type_t; 414e948693eSPhilip Paeps 4153c838a9fSAndrew Rybchenko typedef enum falconsiena_filter_tbl_id_e { 4163c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_RX_IP = 0, 4173c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_RX_MAC, 4183c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_TX_IP, 4193c838a9fSAndrew Rybchenko EFX_FS_FILTER_TBL_TX_MAC, 4203c838a9fSAndrew Rybchenko EFX_FS_FILTER_NTBLS 4213c838a9fSAndrew Rybchenko } falconsiena_filter_tbl_id_t; 422e948693eSPhilip Paeps 4233c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_tbl_s { 4243c838a9fSAndrew Rybchenko int fsft_size; /* number of entries */ 4253c838a9fSAndrew Rybchenko int fsft_used; /* active count */ 4263c838a9fSAndrew Rybchenko uint32_t *fsft_bitmap; /* active bitmap */ 4273c838a9fSAndrew Rybchenko falconsiena_filter_spec_t *fsft_spec; /* array of saved specs */ 4283c838a9fSAndrew Rybchenko } falconsiena_filter_tbl_t; 4293c838a9fSAndrew Rybchenko 4303c838a9fSAndrew Rybchenko typedef struct falconsiena_filter_s { 4313c838a9fSAndrew Rybchenko falconsiena_filter_tbl_t fsf_tbl[EFX_FS_FILTER_NTBLS]; 4323c838a9fSAndrew Rybchenko unsigned int fsf_depth[EFX_FS_FILTER_NTYPES]; 4333c838a9fSAndrew Rybchenko } falconsiena_filter_t; 434e948693eSPhilip Paeps 435e948693eSPhilip Paeps typedef struct efx_filter_s { 4363c838a9fSAndrew Rybchenko #if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA 4373c838a9fSAndrew Rybchenko falconsiena_filter_t *ef_falconsiena_filter; 4383c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */ 439*1289fe72SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD 440*1289fe72SAndrew Rybchenko ef10_filter_table_t *ef_ef10_filter_table; 441*1289fe72SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ 442e948693eSPhilip Paeps } efx_filter_t; 443e948693eSPhilip Paeps 444e948693eSPhilip Paeps extern void 4453c838a9fSAndrew Rybchenko falconsiena_filter_tbl_clear( 446e948693eSPhilip Paeps __in efx_nic_t *enp, 4473c838a9fSAndrew Rybchenko __in falconsiena_filter_tbl_id_t tbl); 448e948693eSPhilip Paeps 449e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 450e948693eSPhilip Paeps 4513c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 4523c838a9fSAndrew Rybchenko 4533c838a9fSAndrew Rybchenko typedef struct efx_mcdi_ops_s { 454460cb568SAndrew Rybchenko efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *); 4553c838a9fSAndrew Rybchenko void (*emco_request_copyin)(efx_nic_t *, efx_mcdi_req_t *, 4563c838a9fSAndrew Rybchenko unsigned int, boolean_t, boolean_t); 4573c838a9fSAndrew Rybchenko void (*emco_request_copyout)(efx_nic_t *, efx_mcdi_req_t *); 458460cb568SAndrew Rybchenko efx_rc_t (*emco_poll_reboot)(efx_nic_t *); 459548ebee5SAndrew Rybchenko boolean_t (*emco_poll_response)(efx_nic_t *); 460548ebee5SAndrew Rybchenko void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); 4613c838a9fSAndrew Rybchenko void (*emco_fini)(efx_nic_t *); 462af986c75SAndrew Rybchenko efx_rc_t (*emco_feature_supported)(efx_nic_t *, efx_mcdi_feature_id_t, boolean_t *); 4633c838a9fSAndrew Rybchenko } efx_mcdi_ops_t; 4643c838a9fSAndrew Rybchenko 4653c838a9fSAndrew Rybchenko typedef struct efx_mcdi_s { 4663c838a9fSAndrew Rybchenko efx_mcdi_ops_t *em_emcop; 4673c838a9fSAndrew Rybchenko const efx_mcdi_transport_t *em_emtp; 4683c838a9fSAndrew Rybchenko efx_mcdi_iface_t em_emip; 4693c838a9fSAndrew Rybchenko } efx_mcdi_t; 4703c838a9fSAndrew Rybchenko 4713c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 4723c838a9fSAndrew Rybchenko 473e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 474e948693eSPhilip Paeps typedef struct efx_nvram_ops_s { 475e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 476460cb568SAndrew Rybchenko efx_rc_t (*envo_test)(efx_nic_t *); 477e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 478460cb568SAndrew Rybchenko efx_rc_t (*envo_size)(efx_nic_t *, efx_nvram_type_t, size_t *); 479460cb568SAndrew Rybchenko efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t, 480e948693eSPhilip Paeps uint32_t *, uint16_t *); 481460cb568SAndrew Rybchenko efx_rc_t (*envo_rw_start)(efx_nic_t *, efx_nvram_type_t, size_t *); 482460cb568SAndrew Rybchenko efx_rc_t (*envo_read_chunk)(efx_nic_t *, efx_nvram_type_t, 483e948693eSPhilip Paeps unsigned int, caddr_t, size_t); 484460cb568SAndrew Rybchenko efx_rc_t (*envo_erase)(efx_nic_t *, efx_nvram_type_t); 485460cb568SAndrew Rybchenko efx_rc_t (*envo_write_chunk)(efx_nic_t *, efx_nvram_type_t, 486e948693eSPhilip Paeps unsigned int, caddr_t, size_t); 487e948693eSPhilip Paeps void (*envo_rw_finish)(efx_nic_t *, efx_nvram_type_t); 488460cb568SAndrew Rybchenko efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t, 489460cb568SAndrew Rybchenko uint16_t *); 490e948693eSPhilip Paeps 491e948693eSPhilip Paeps } efx_nvram_ops_t; 492e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 493e948693eSPhilip Paeps 494e948693eSPhilip Paeps #if EFSYS_OPT_VPD 495e948693eSPhilip Paeps typedef struct efx_vpd_ops_s { 496460cb568SAndrew Rybchenko efx_rc_t (*evpdo_init)(efx_nic_t *); 497460cb568SAndrew Rybchenko efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *); 498460cb568SAndrew Rybchenko efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t); 499460cb568SAndrew Rybchenko efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t); 500460cb568SAndrew Rybchenko efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t); 501460cb568SAndrew Rybchenko efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t, 502460cb568SAndrew Rybchenko efx_vpd_value_t *); 503460cb568SAndrew Rybchenko efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t, 504460cb568SAndrew Rybchenko efx_vpd_value_t *); 505460cb568SAndrew Rybchenko efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t, 506460cb568SAndrew Rybchenko efx_vpd_value_t *, unsigned int *); 507460cb568SAndrew Rybchenko efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t); 508e948693eSPhilip Paeps void (*evpdo_fini)(efx_nic_t *); 509e948693eSPhilip Paeps } efx_vpd_ops_t; 510e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 511e948693eSPhilip Paeps 5123c838a9fSAndrew Rybchenko #if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM 5133c838a9fSAndrew Rybchenko 514460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5153c838a9fSAndrew Rybchenko efx_mcdi_nvram_partitions( 5163c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5173c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5183c838a9fSAndrew Rybchenko __in size_t size, 5193c838a9fSAndrew Rybchenko __out unsigned int *npartnp); 5203c838a9fSAndrew Rybchenko 521460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5223c838a9fSAndrew Rybchenko efx_mcdi_nvram_metadata( 5233c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5243c838a9fSAndrew Rybchenko __in uint32_t partn, 5253c838a9fSAndrew Rybchenko __out uint32_t *subtypep, 5263c838a9fSAndrew Rybchenko __out_ecount(4) uint16_t version[4], 5273c838a9fSAndrew Rybchenko __out_bcount_opt(size) char *descp, 5283c838a9fSAndrew Rybchenko __in size_t size); 5293c838a9fSAndrew Rybchenko 530460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5313c838a9fSAndrew Rybchenko efx_mcdi_nvram_info( 5323c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5333c838a9fSAndrew Rybchenko __in uint32_t partn, 5343c838a9fSAndrew Rybchenko __out_opt size_t *sizep, 5353c838a9fSAndrew Rybchenko __out_opt uint32_t *addressp, 5369cb71b16SAndrew Rybchenko __out_opt uint32_t *erase_sizep, 5379cb71b16SAndrew Rybchenko __out_opt uint32_t *write_sizep); 5383c838a9fSAndrew Rybchenko 539460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5403c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_start( 5413c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5423c838a9fSAndrew Rybchenko __in uint32_t partn); 5433c838a9fSAndrew Rybchenko 544460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5453c838a9fSAndrew Rybchenko efx_mcdi_nvram_read( 5463c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5473c838a9fSAndrew Rybchenko __in uint32_t partn, 5483c838a9fSAndrew Rybchenko __in uint32_t offset, 5493c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5503c838a9fSAndrew Rybchenko __in size_t size); 5513c838a9fSAndrew Rybchenko 552460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5533c838a9fSAndrew Rybchenko efx_mcdi_nvram_erase( 5543c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5553c838a9fSAndrew Rybchenko __in uint32_t partn, 5563c838a9fSAndrew Rybchenko __in uint32_t offset, 5573c838a9fSAndrew Rybchenko __in size_t size); 5583c838a9fSAndrew Rybchenko 559460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5603c838a9fSAndrew Rybchenko efx_mcdi_nvram_write( 5613c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5623c838a9fSAndrew Rybchenko __in uint32_t partn, 5633c838a9fSAndrew Rybchenko __in uint32_t offset, 5643c838a9fSAndrew Rybchenko __out_bcount(size) caddr_t data, 5653c838a9fSAndrew Rybchenko __in size_t size); 5663c838a9fSAndrew Rybchenko 567460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5683c838a9fSAndrew Rybchenko efx_mcdi_nvram_update_finish( 5693c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5703c838a9fSAndrew Rybchenko __in uint32_t partn, 5713c838a9fSAndrew Rybchenko __in boolean_t reboot); 5723c838a9fSAndrew Rybchenko 5733c838a9fSAndrew Rybchenko #if EFSYS_OPT_DIAG 5743c838a9fSAndrew Rybchenko 575460cb568SAndrew Rybchenko __checkReturn efx_rc_t 5763c838a9fSAndrew Rybchenko efx_mcdi_nvram_test( 5773c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 5783c838a9fSAndrew Rybchenko __in uint32_t partn); 5793c838a9fSAndrew Rybchenko 5803c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_DIAG */ 5813c838a9fSAndrew Rybchenko 5823c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ 5833c838a9fSAndrew Rybchenko 5843c838a9fSAndrew Rybchenko typedef struct efx_drv_cfg_s { 5853c838a9fSAndrew Rybchenko uint32_t edc_min_vi_count; 5863c838a9fSAndrew Rybchenko uint32_t edc_max_vi_count; 5873c838a9fSAndrew Rybchenko 5883c838a9fSAndrew Rybchenko uint32_t edc_max_piobuf_count; 5893c838a9fSAndrew Rybchenko uint32_t edc_pio_alloc_size; 5903c838a9fSAndrew Rybchenko } efx_drv_cfg_t; 5913c838a9fSAndrew Rybchenko 592e948693eSPhilip Paeps struct efx_nic_s { 593e948693eSPhilip Paeps uint32_t en_magic; 594e948693eSPhilip Paeps efx_family_t en_family; 595e948693eSPhilip Paeps uint32_t en_features; 596e948693eSPhilip Paeps efsys_identifier_t *en_esip; 597e948693eSPhilip Paeps efsys_lock_t *en_eslp; 598e948693eSPhilip Paeps efsys_bar_t *en_esbp; 599e948693eSPhilip Paeps unsigned int en_mod_flags; 600e948693eSPhilip Paeps unsigned int en_reset_flags; 601e948693eSPhilip Paeps efx_nic_cfg_t en_nic_cfg; 6023c838a9fSAndrew Rybchenko efx_drv_cfg_t en_drv_cfg; 603e948693eSPhilip Paeps efx_port_t en_port; 604e948693eSPhilip Paeps efx_mon_t en_mon; 605e948693eSPhilip Paeps efx_intr_t en_intr; 606e948693eSPhilip Paeps uint32_t en_ev_qcount; 607e948693eSPhilip Paeps uint32_t en_rx_qcount; 608e948693eSPhilip Paeps uint32_t en_tx_qcount; 609e948693eSPhilip Paeps efx_nic_ops_t *en_enop; 6103c838a9fSAndrew Rybchenko efx_ev_ops_t *en_eevop; 6113c838a9fSAndrew Rybchenko efx_tx_ops_t *en_etxop; 6123c838a9fSAndrew Rybchenko efx_rx_ops_t *en_erxop; 613e948693eSPhilip Paeps #if EFSYS_OPT_FILTER 614e948693eSPhilip Paeps efx_filter_t en_filter; 6153c838a9fSAndrew Rybchenko efx_filter_ops_t *en_efop; 616e948693eSPhilip Paeps #endif /* EFSYS_OPT_FILTER */ 6173c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 6183c838a9fSAndrew Rybchenko efx_mcdi_t en_mcdi; 6193c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 620e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM 621e948693eSPhilip Paeps efx_nvram_type_t en_nvram_locked; 622e948693eSPhilip Paeps efx_nvram_ops_t *en_envop; 623e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM */ 624e948693eSPhilip Paeps #if EFSYS_OPT_VPD 625e948693eSPhilip Paeps efx_vpd_ops_t *en_evpdop; 626e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6273c838a9fSAndrew Rybchenko #if EFSYS_OPT_RX_SCALE 6283c838a9fSAndrew Rybchenko efx_rx_hash_support_t en_hash_support; 6293c838a9fSAndrew Rybchenko efx_rx_scale_support_t en_rss_support; 6303c838a9fSAndrew Rybchenko uint32_t en_rss_context; 6313c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_RX_SCALE */ 6323c838a9fSAndrew Rybchenko uint32_t en_vport_id; 633e948693eSPhilip Paeps union { 634e948693eSPhilip Paeps #if EFSYS_OPT_FALCON 635e948693eSPhilip Paeps struct { 636e948693eSPhilip Paeps falcon_spi_dev_t enu_fsd[FALCON_SPI_NTYPES]; 637e948693eSPhilip Paeps falcon_i2c_t enu_fip; 638e948693eSPhilip Paeps boolean_t enu_i2c_locked; 639e948693eSPhilip Paeps #if EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE 640e948693eSPhilip Paeps const uint8_t *enu_forced_cfg; 641e948693eSPhilip Paeps #endif /* EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE */ 642e948693eSPhilip Paeps uint8_t enu_mon_devid; 643e948693eSPhilip Paeps #if EFSYS_OPT_PCIE_TUNE 644e948693eSPhilip Paeps unsigned int enu_nlanes; 645e948693eSPhilip Paeps #endif /* EFSYS_OPT_PCIE_TUNE */ 646e948693eSPhilip Paeps uint16_t enu_board_rev; 647e948693eSPhilip Paeps boolean_t enu_internal_sram; 648e948693eSPhilip Paeps uint8_t enu_sram_num_bank; 649e948693eSPhilip Paeps uint8_t enu_sram_bank_size; 650e948693eSPhilip Paeps } falcon; 651e948693eSPhilip Paeps #endif /* EFSYS_OPT_FALCON */ 652e948693eSPhilip Paeps #if EFSYS_OPT_SIENA 653e948693eSPhilip Paeps struct { 654e948693eSPhilip Paeps #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 655e948693eSPhilip Paeps unsigned int enu_partn_mask; 656e948693eSPhilip Paeps #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 657e948693eSPhilip Paeps #if EFSYS_OPT_VPD 658e948693eSPhilip Paeps caddr_t enu_svpd; 659e948693eSPhilip Paeps size_t enu_svpd_length; 660e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 6613c838a9fSAndrew Rybchenko int enu_unused; 662e948693eSPhilip Paeps } siena; 663e948693eSPhilip Paeps #endif /* EFSYS_OPT_SIENA */ 664e7119ad9SAndrew Rybchenko int enu_unused; 665e948693eSPhilip Paeps } en_u; 666e7119ad9SAndrew Rybchenko #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) 667e7119ad9SAndrew Rybchenko union en_arch { 668e7119ad9SAndrew Rybchenko struct { 669e7119ad9SAndrew Rybchenko int ena_vi_base; 670e7119ad9SAndrew Rybchenko int ena_vi_count; 671e7119ad9SAndrew Rybchenko #if EFSYS_OPT_VPD 672e7119ad9SAndrew Rybchenko caddr_t ena_svpd; 673e7119ad9SAndrew Rybchenko size_t ena_svpd_length; 674e7119ad9SAndrew Rybchenko #endif /* EFSYS_OPT_VPD */ 675e7119ad9SAndrew Rybchenko efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS]; 676e7119ad9SAndrew Rybchenko uint32_t ena_piobuf_count; 677e7119ad9SAndrew Rybchenko uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS]; 678e7119ad9SAndrew Rybchenko uint32_t ena_pio_write_vi_base; 679e7119ad9SAndrew Rybchenko /* Memory BAR mapping regions */ 680e7119ad9SAndrew Rybchenko uint32_t ena_uc_mem_map_offset; 681e7119ad9SAndrew Rybchenko size_t ena_uc_mem_map_size; 682e7119ad9SAndrew Rybchenko uint32_t ena_wc_mem_map_offset; 683e7119ad9SAndrew Rybchenko size_t ena_wc_mem_map_size; 684e7119ad9SAndrew Rybchenko } ef10; 685e7119ad9SAndrew Rybchenko } en_arch; 686e7119ad9SAndrew Rybchenko #endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ 687e948693eSPhilip Paeps }; 688e948693eSPhilip Paeps 689e948693eSPhilip Paeps 690e948693eSPhilip Paeps #define EFX_NIC_MAGIC 0x02121996 691e948693eSPhilip Paeps 692e948693eSPhilip Paeps typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *, 693e948693eSPhilip Paeps const efx_ev_callbacks_t *, void *); 694e948693eSPhilip Paeps 6953c838a9fSAndrew Rybchenko typedef struct efx_evq_rxq_state_s { 6963c838a9fSAndrew Rybchenko unsigned int eers_rx_read_ptr; 6973c838a9fSAndrew Rybchenko unsigned int eers_rx_mask; 6983c838a9fSAndrew Rybchenko } efx_evq_rxq_state_t; 6993c838a9fSAndrew Rybchenko 700e948693eSPhilip Paeps struct efx_evq_s { 701e948693eSPhilip Paeps uint32_t ee_magic; 702e948693eSPhilip Paeps efx_nic_t *ee_enp; 703e948693eSPhilip Paeps unsigned int ee_index; 704e948693eSPhilip Paeps unsigned int ee_mask; 705e948693eSPhilip Paeps efsys_mem_t *ee_esmp; 706e948693eSPhilip Paeps #if EFSYS_OPT_QSTATS 707e948693eSPhilip Paeps uint32_t ee_stat[EV_NQSTATS]; 708e948693eSPhilip Paeps #endif /* EFSYS_OPT_QSTATS */ 7093c838a9fSAndrew Rybchenko 7103c838a9fSAndrew Rybchenko efx_ev_handler_t ee_rx; 7113c838a9fSAndrew Rybchenko efx_ev_handler_t ee_tx; 7123c838a9fSAndrew Rybchenko efx_ev_handler_t ee_driver; 7133c838a9fSAndrew Rybchenko efx_ev_handler_t ee_global; 7143c838a9fSAndrew Rybchenko efx_ev_handler_t ee_drv_gen; 7153c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 7163c838a9fSAndrew Rybchenko efx_ev_handler_t ee_mcdi; 7173c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 7183c838a9fSAndrew Rybchenko 7193c838a9fSAndrew Rybchenko efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS]; 720e948693eSPhilip Paeps }; 721e948693eSPhilip Paeps 722e948693eSPhilip Paeps #define EFX_EVQ_MAGIC 0x08081997 723e948693eSPhilip Paeps 724af9078c3SAndrew Rybchenko #define EFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */ 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_FALCON: \ 789e948693eSPhilip Paeps rev = 'B'; \ 790e948693eSPhilip Paeps break; \ 791e948693eSPhilip Paeps \ 792e948693eSPhilip Paeps case EFX_FAMILY_SIENA: \ 793e948693eSPhilip Paeps rev = 'C'; \ 794e948693eSPhilip Paeps break; \ 795e948693eSPhilip Paeps \ 7963c838a9fSAndrew Rybchenko case EFX_FAMILY_HUNTINGTON: \ 7973c838a9fSAndrew Rybchenko rev = 'D'; \ 7983c838a9fSAndrew Rybchenko break; \ 7993c838a9fSAndrew Rybchenko \ 80034f6ea29SAndrew Rybchenko case EFX_FAMILY_MEDFORD: \ 80134f6ea29SAndrew Rybchenko rev = 'E'; \ 80234f6ea29SAndrew Rybchenko break; \ 80334f6ea29SAndrew Rybchenko \ 804e948693eSPhilip Paeps default: \ 805e948693eSPhilip Paeps rev = '?'; \ 806e948693eSPhilip Paeps break; \ 807e948693eSPhilip Paeps } \ 808e948693eSPhilip Paeps \ 809e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, >=, min); \ 810e948693eSPhilip Paeps EFSYS_ASSERT3S(rev, <=, max); \ 811e948693eSPhilip Paeps \ 812e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 813e948693eSPhilip Paeps } while (B_FALSE) 814e948693eSPhilip Paeps #else 815e948693eSPhilip Paeps #define EFX_CHECK_REG(_enp, _reg) do { \ 816e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 817e948693eSPhilip Paeps } while(B_FALSE) 818e948693eSPhilip Paeps #endif 819e948693eSPhilip Paeps 820e948693eSPhilip Paeps #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \ 821e948693eSPhilip Paeps do { \ 822e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 823e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \ 824e948693eSPhilip Paeps (_edp), (_lock)); \ 825e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \ 826e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 827e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 828e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 829e948693eSPhilip Paeps } while (B_FALSE) 830e948693eSPhilip Paeps 831e948693eSPhilip Paeps #define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \ 832e948693eSPhilip Paeps do { \ 833e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 834e948693eSPhilip Paeps EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \ 835e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 836e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 837e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \ 838e948693eSPhilip Paeps (_edp), (_lock)); \ 839e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 840e948693eSPhilip Paeps } while (B_FALSE) 841e948693eSPhilip Paeps 842e948693eSPhilip Paeps #define EFX_BAR_READQ(_enp, _reg, _eqp) \ 843e948693eSPhilip Paeps do { \ 844e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 845e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \ 846e948693eSPhilip Paeps (_eqp)); \ 847e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \ 848e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 849e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 850e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 851e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 852e948693eSPhilip Paeps } while (B_FALSE) 853e948693eSPhilip Paeps 854e948693eSPhilip Paeps #define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \ 855e948693eSPhilip Paeps do { \ 856e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 857e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \ 858e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 859e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 860e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 861e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \ 862e948693eSPhilip Paeps (_eqp)); \ 863e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 864e948693eSPhilip Paeps } while (B_FALSE) 865e948693eSPhilip Paeps 866e948693eSPhilip Paeps #define EFX_BAR_READO(_enp, _reg, _eop) \ 867e948693eSPhilip Paeps do { \ 868e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 869e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \ 870e948693eSPhilip Paeps (_eop), B_TRUE); \ 871e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \ 872e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 873e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 874e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 875e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 876e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 877e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 878e948693eSPhilip Paeps } while (B_FALSE) 879e948693eSPhilip Paeps 880e948693eSPhilip Paeps #define EFX_BAR_WRITEO(_enp, _reg, _eop) \ 881e948693eSPhilip Paeps do { \ 882e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 883e948693eSPhilip Paeps EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \ 884e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 885e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 886e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 887e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 888e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 889e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \ 890e948693eSPhilip Paeps (_eop), B_TRUE); \ 891e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 892e948693eSPhilip Paeps } while (B_FALSE) 893e948693eSPhilip Paeps 894e948693eSPhilip Paeps #define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \ 895e948693eSPhilip Paeps do { \ 896e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 897e948693eSPhilip Paeps EFSYS_BAR_READD((_enp)->en_esbp, \ 898e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 899e948693eSPhilip Paeps (_edp), (_lock)); \ 900e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \ 901e948693eSPhilip Paeps uint32_t, (_index), \ 902e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 903e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 904e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 905e948693eSPhilip Paeps } while (B_FALSE) 906e948693eSPhilip Paeps 907e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \ 908e948693eSPhilip Paeps do { \ 909e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 910e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 911e948693eSPhilip Paeps uint32_t, (_index), \ 912e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 913e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 914e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 915e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 916e948693eSPhilip Paeps (_edp), (_lock)); \ 917e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 918e948693eSPhilip Paeps } while (B_FALSE) 919e948693eSPhilip Paeps 9203c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITED2(_enp, _reg, _index, _edp, _lock) \ 9213c838a9fSAndrew Rybchenko do { \ 9223c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 9233c838a9fSAndrew Rybchenko EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 9243c838a9fSAndrew Rybchenko uint32_t, (_index), \ 9253c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 9263c838a9fSAndrew Rybchenko uint32_t, (_edp)->ed_u32[0]); \ 9273c838a9fSAndrew Rybchenko EFSYS_BAR_WRITED((_enp)->en_esbp, \ 9283c838a9fSAndrew Rybchenko (_reg ## _OFST + \ 9293c838a9fSAndrew Rybchenko (2 * sizeof (efx_dword_t)) + \ 9303c838a9fSAndrew Rybchenko ((_index) * _reg ## _STEP)), \ 9313c838a9fSAndrew Rybchenko (_edp), (_lock)); \ 9323c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 9333c838a9fSAndrew Rybchenko } while (B_FALSE) 9343c838a9fSAndrew Rybchenko 935e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \ 936e948693eSPhilip Paeps do { \ 937e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 938e948693eSPhilip Paeps EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \ 939e948693eSPhilip Paeps uint32_t, (_index), \ 940e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 941e948693eSPhilip Paeps uint32_t, (_edp)->ed_u32[0]); \ 942e948693eSPhilip Paeps EFSYS_BAR_WRITED((_enp)->en_esbp, \ 943e948693eSPhilip Paeps (_reg ## _OFST + \ 944e948693eSPhilip Paeps (3 * sizeof (efx_dword_t)) + \ 945e948693eSPhilip Paeps ((_index) * _reg ## _STEP)), \ 946e948693eSPhilip Paeps (_edp), (_lock)); \ 947e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 948e948693eSPhilip Paeps } while (B_FALSE) 949e948693eSPhilip Paeps 950e948693eSPhilip Paeps #define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \ 951e948693eSPhilip Paeps do { \ 952e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 953e948693eSPhilip Paeps EFSYS_BAR_READQ((_enp)->en_esbp, \ 954e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 955e948693eSPhilip Paeps (_eqp)); \ 956e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \ 957e948693eSPhilip Paeps uint32_t, (_index), \ 958e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 959e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 960e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 961e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 962e948693eSPhilip Paeps } while (B_FALSE) 963e948693eSPhilip Paeps 964e948693eSPhilip Paeps #define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \ 965e948693eSPhilip Paeps do { \ 966e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 967e948693eSPhilip Paeps EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \ 968e948693eSPhilip Paeps uint32_t, (_index), \ 969e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 970e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[1], \ 971e948693eSPhilip Paeps uint32_t, (_eqp)->eq_u32[0]); \ 972e948693eSPhilip Paeps EFSYS_BAR_WRITEQ((_enp)->en_esbp, \ 973e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 974e948693eSPhilip Paeps (_eqp)); \ 975e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 976e948693eSPhilip Paeps } while (B_FALSE) 977e948693eSPhilip Paeps 9783c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \ 979e948693eSPhilip Paeps do { \ 980e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 981e948693eSPhilip Paeps EFSYS_BAR_READO((_enp)->en_esbp, \ 982e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 9833c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 984e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \ 985e948693eSPhilip Paeps uint32_t, (_index), \ 986e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 987e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 988e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 989e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 990e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 991e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 992e948693eSPhilip Paeps } while (B_FALSE) 993e948693eSPhilip Paeps 9943c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \ 995e948693eSPhilip Paeps do { \ 996e948693eSPhilip Paeps EFX_CHECK_REG((_enp), (_reg)); \ 997e948693eSPhilip Paeps EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \ 998e948693eSPhilip Paeps uint32_t, (_index), \ 999e948693eSPhilip Paeps uint32_t, _reg ## _OFST, \ 1000e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[3], \ 1001e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[2], \ 1002e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[1], \ 1003e948693eSPhilip Paeps uint32_t, (_eop)->eo_u32[0]); \ 1004e948693eSPhilip Paeps EFSYS_BAR_WRITEO((_enp)->en_esbp, \ 1005e948693eSPhilip Paeps (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10063c838a9fSAndrew Rybchenko (_eop), (_lock)); \ 10073c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10083c838a9fSAndrew Rybchenko } while (B_FALSE) 10093c838a9fSAndrew Rybchenko 10103c838a9fSAndrew Rybchenko /* 10113c838a9fSAndrew Rybchenko * Allow drivers to perform optimised 128-bit doorbell writes. 10123c838a9fSAndrew Rybchenko * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are 10133c838a9fSAndrew Rybchenko * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid 10143c838a9fSAndrew Rybchenko * the need for locking in the host, and are the only ones known to be safe to 10153c838a9fSAndrew Rybchenko * use 128-bites write with. 10163c838a9fSAndrew Rybchenko */ 10173c838a9fSAndrew Rybchenko #define EFX_BAR_TBL_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \ 10183c838a9fSAndrew Rybchenko do { \ 10193c838a9fSAndrew Rybchenko EFX_CHECK_REG((_enp), (_reg)); \ 10203c838a9fSAndrew Rybchenko EFSYS_PROBE7(efx_bar_tbl_doorbell_writeo, \ 10213c838a9fSAndrew Rybchenko const char *, \ 10223c838a9fSAndrew Rybchenko #_reg, \ 10233c838a9fSAndrew Rybchenko uint32_t, (_index), \ 10243c838a9fSAndrew Rybchenko uint32_t, _reg ## _OFST, \ 10253c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[3], \ 10263c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[2], \ 10273c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[1], \ 10283c838a9fSAndrew Rybchenko uint32_t, (_eop)->eo_u32[0]); \ 10293c838a9fSAndrew Rybchenko EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \ 10303c838a9fSAndrew Rybchenko (_reg ## _OFST + ((_index) * _reg ## _STEP)), \ 10313c838a9fSAndrew Rybchenko (_eop)); \ 10323c838a9fSAndrew Rybchenko _NOTE(CONSTANTCONDITION) \ 10333c838a9fSAndrew Rybchenko } while (B_FALSE) 10343c838a9fSAndrew Rybchenko 10353c838a9fSAndrew Rybchenko #define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \ 10363c838a9fSAndrew Rybchenko do { \ 10373c838a9fSAndrew Rybchenko unsigned int _new = (_wptr); \ 10383c838a9fSAndrew Rybchenko unsigned int _old = (_owptr); \ 10393c838a9fSAndrew Rybchenko \ 10403c838a9fSAndrew Rybchenko if ((_new) >= (_old)) \ 10413c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10423c838a9fSAndrew Rybchenko (_old) * sizeof (efx_desc_t), \ 10433c838a9fSAndrew Rybchenko ((_new) - (_old)) * sizeof (efx_desc_t)); \ 10443c838a9fSAndrew Rybchenko else \ 10453c838a9fSAndrew Rybchenko /* \ 10463c838a9fSAndrew Rybchenko * It is cheaper to sync entire map than sync \ 10473c838a9fSAndrew Rybchenko * two parts especially when offset/size are \ 10483c838a9fSAndrew Rybchenko * ignored and entire map is synced in any case.\ 10493c838a9fSAndrew Rybchenko */ \ 10503c838a9fSAndrew Rybchenko EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \ 10513c838a9fSAndrew Rybchenko 0, \ 10523c838a9fSAndrew Rybchenko (_entries) * sizeof (efx_desc_t)); \ 1053e948693eSPhilip Paeps _NOTE(CONSTANTCONDITION) \ 1054e948693eSPhilip Paeps } while (B_FALSE) 1055e948693eSPhilip Paeps 1056460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 10573c838a9fSAndrew Rybchenko efx_nic_biu_test( 10583c838a9fSAndrew Rybchenko __in efx_nic_t *enp); 10593c838a9fSAndrew Rybchenko 1060460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1061e948693eSPhilip Paeps efx_mac_select( 1062e948693eSPhilip Paeps __in efx_nic_t *enp); 1063e948693eSPhilip Paeps 10643c838a9fSAndrew Rybchenko extern void 10653c838a9fSAndrew Rybchenko efx_mac_multicast_hash_compute( 10663c838a9fSAndrew Rybchenko __in_ecount(6*count) uint8_t const *addrs, 10673c838a9fSAndrew Rybchenko __in int count, 10683c838a9fSAndrew Rybchenko __out efx_oword_t *hash_low, 10693c838a9fSAndrew Rybchenko __out efx_oword_t *hash_high); 10703c838a9fSAndrew Rybchenko 1071460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1072e948693eSPhilip Paeps efx_phy_probe( 1073e948693eSPhilip Paeps __in efx_nic_t *enp); 1074e948693eSPhilip Paeps 1075e948693eSPhilip Paeps extern void 1076e948693eSPhilip Paeps efx_phy_unprobe( 1077e948693eSPhilip Paeps __in efx_nic_t *enp); 1078e948693eSPhilip Paeps 1079e948693eSPhilip Paeps #if EFSYS_OPT_VPD 1080e948693eSPhilip Paeps 1081e948693eSPhilip Paeps /* VPD utility functions */ 1082e948693eSPhilip Paeps 1083460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1084e948693eSPhilip Paeps efx_vpd_hunk_length( 1085e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1086e948693eSPhilip Paeps __in size_t size, 1087e948693eSPhilip Paeps __out size_t *lengthp); 1088e948693eSPhilip Paeps 1089460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1090e948693eSPhilip Paeps efx_vpd_hunk_verify( 1091e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1092e948693eSPhilip Paeps __in size_t size, 1093e948693eSPhilip Paeps __out_opt boolean_t *cksummedp); 1094e948693eSPhilip Paeps 1095460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1096e948693eSPhilip Paeps efx_vpd_hunk_reinit( 10973c838a9fSAndrew Rybchenko __in_bcount(size) caddr_t data, 1098e948693eSPhilip Paeps __in size_t size, 1099e948693eSPhilip Paeps __in boolean_t wantpid); 1100e948693eSPhilip Paeps 1101460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1102e948693eSPhilip Paeps efx_vpd_hunk_get( 1103e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1104e948693eSPhilip Paeps __in size_t size, 1105e948693eSPhilip Paeps __in efx_vpd_tag_t tag, 1106e948693eSPhilip Paeps __in efx_vpd_keyword_t keyword, 1107e948693eSPhilip Paeps __out unsigned int *payloadp, 1108e948693eSPhilip Paeps __out uint8_t *paylenp); 1109e948693eSPhilip Paeps 1110460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1111e948693eSPhilip Paeps efx_vpd_hunk_next( 1112e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1113e948693eSPhilip Paeps __in size_t size, 1114e948693eSPhilip Paeps __out efx_vpd_tag_t *tagp, 1115e948693eSPhilip Paeps __out efx_vpd_keyword_t *keyword, 1116e948693eSPhilip Paeps __out_bcount_opt(*paylenp) unsigned int *payloadp, 1117e948693eSPhilip Paeps __out_opt uint8_t *paylenp, 1118e948693eSPhilip Paeps __inout unsigned int *contp); 1119e948693eSPhilip Paeps 1120460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1121e948693eSPhilip Paeps efx_vpd_hunk_set( 1122e948693eSPhilip Paeps __in_bcount(size) caddr_t data, 1123e948693eSPhilip Paeps __in size_t size, 1124e948693eSPhilip Paeps __in efx_vpd_value_t *evvp); 1125e948693eSPhilip Paeps 1126e948693eSPhilip Paeps #endif /* EFSYS_OPT_VPD */ 1127e948693eSPhilip Paeps 1128e948693eSPhilip Paeps #if EFSYS_OPT_DIAG 1129e948693eSPhilip Paeps 11303c838a9fSAndrew Rybchenko extern efx_sram_pattern_fn_t __efx_sram_pattern_fns[]; 1131e948693eSPhilip Paeps 1132e948693eSPhilip Paeps typedef struct efx_register_set_s { 1133e948693eSPhilip Paeps unsigned int address; 1134e948693eSPhilip Paeps unsigned int step; 1135e948693eSPhilip Paeps unsigned int rows; 1136e948693eSPhilip Paeps efx_oword_t mask; 1137e948693eSPhilip Paeps } efx_register_set_t; 1138e948693eSPhilip Paeps 1139460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1140e948693eSPhilip Paeps efx_nic_test_registers( 1141e948693eSPhilip Paeps __in efx_nic_t *enp, 1142e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1143e948693eSPhilip Paeps __in size_t count); 1144e948693eSPhilip Paeps 1145460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 1146e948693eSPhilip Paeps efx_nic_test_tables( 1147e948693eSPhilip Paeps __in efx_nic_t *enp, 1148e948693eSPhilip Paeps __in efx_register_set_t *rsp, 1149e948693eSPhilip Paeps __in efx_pattern_type_t pattern, 1150e948693eSPhilip Paeps __in size_t count); 1151e948693eSPhilip Paeps 1152e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */ 1153e948693eSPhilip Paeps 11543c838a9fSAndrew Rybchenko #if EFSYS_OPT_MCDI 11553c838a9fSAndrew Rybchenko 1156460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11573c838a9fSAndrew Rybchenko efx_mcdi_set_workaround( 11583c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11593c838a9fSAndrew Rybchenko __in uint32_t type, 11603c838a9fSAndrew Rybchenko __in boolean_t enabled, 11613c838a9fSAndrew Rybchenko __out_opt uint32_t *flagsp); 11623c838a9fSAndrew Rybchenko 1163460cb568SAndrew Rybchenko extern __checkReturn efx_rc_t 11643c838a9fSAndrew Rybchenko efx_mcdi_get_workarounds( 11653c838a9fSAndrew Rybchenko __in efx_nic_t *enp, 11663c838a9fSAndrew Rybchenko __out_opt uint32_t *implementedp, 11673c838a9fSAndrew Rybchenko __out_opt uint32_t *enabledp); 11683c838a9fSAndrew Rybchenko 11693c838a9fSAndrew Rybchenko #endif /* EFSYS_OPT_MCDI */ 11703c838a9fSAndrew Rybchenko 1171e948693eSPhilip Paeps #ifdef __cplusplus 1172e948693eSPhilip Paeps } 1173e948693eSPhilip Paeps #endif 1174e948693eSPhilip Paeps 1175e948693eSPhilip Paeps #endif /* _SYS_EFX_IMPL_H */ 1176