2011-11-16 17:11:13 +00:00
|
|
|
/*-
|
2017-11-27 14:52:40 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
*
|
2016-05-24 12:16:57 +00:00
|
|
|
* Copyright (c) 2007-2016 Solarflare Communications Inc.
|
2015-05-25 08:34:55 +00:00
|
|
|
* All rights reserved.
|
2011-11-16 17:11:13 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
2015-05-25 08:34:55 +00:00
|
|
|
* modification, are permitted provided that the following conditions are met:
|
2011-11-16 17:11:13 +00:00
|
|
|
*
|
2015-05-25 08:34:55 +00:00
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* The views and conclusions contained in the software and documentation are
|
|
|
|
* those of the authors and should not be interpreted as representing official
|
|
|
|
* policies, either expressed or implied, of the FreeBSD Project.
|
2011-11-28 17:19:05 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
2011-11-16 17:11:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SYS_EFX_IMPL_H
|
|
|
|
#define _SYS_EFX_IMPL_H
|
|
|
|
|
|
|
|
#include "efx.h"
|
|
|
|
#include "efx_regs.h"
|
2015-05-25 08:34:55 +00:00
|
|
|
#include "efx_regs_ef10.h"
|
|
|
|
|
|
|
|
/* FIXME: Add definition for driver generated software events */
|
|
|
|
#ifndef ESE_DZ_EV_CODE_DRV_GEN_EV
|
|
|
|
#define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV
|
|
|
|
#endif
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
|
|
|
|
#if EFSYS_OPT_SIENA
|
|
|
|
#include "siena_impl.h"
|
|
|
|
#endif /* EFSYS_OPT_SIENA */
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_HUNTINGTON
|
|
|
|
#include "hunt_impl.h"
|
|
|
|
#endif /* EFSYS_OPT_HUNTINGTON */
|
|
|
|
|
2016-01-12 08:32:53 +00:00
|
|
|
#if EFSYS_OPT_MEDFORD
|
|
|
|
#include "medford_impl.h"
|
|
|
|
#endif /* EFSYS_OPT_MEDFORD */
|
|
|
|
|
2018-11-27 12:14:16 +00:00
|
|
|
#if EFSYS_OPT_MEDFORD2
|
|
|
|
#include "medford2_impl.h"
|
|
|
|
#endif /* EFSYS_OPT_MEDFORD2 */
|
|
|
|
|
|
|
|
#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
|
2016-01-12 08:32:53 +00:00
|
|
|
#include "ef10_impl.h"
|
2018-11-27 12:14:16 +00:00
|
|
|
#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) */
|
2016-01-12 08:32:53 +00:00
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_MOD_MCDI 0x00000001
|
|
|
|
#define EFX_MOD_PROBE 0x00000002
|
|
|
|
#define EFX_MOD_NVRAM 0x00000004
|
|
|
|
#define EFX_MOD_VPD 0x00000008
|
|
|
|
#define EFX_MOD_NIC 0x00000010
|
|
|
|
#define EFX_MOD_INTR 0x00000020
|
|
|
|
#define EFX_MOD_EV 0x00000040
|
|
|
|
#define EFX_MOD_RX 0x00000080
|
|
|
|
#define EFX_MOD_TX 0x00000100
|
|
|
|
#define EFX_MOD_PORT 0x00000200
|
|
|
|
#define EFX_MOD_MON 0x00000400
|
|
|
|
#define EFX_MOD_FILTER 0x00001000
|
2016-05-10 07:40:03 +00:00
|
|
|
#define EFX_MOD_LIC 0x00002000
|
2018-11-26 06:20:13 +00:00
|
|
|
#define EFX_MOD_TUNNEL 0x00004000
|
2015-05-25 08:34:55 +00:00
|
|
|
|
2016-05-14 06:14:28 +00:00
|
|
|
#define EFX_RESET_PHY 0x00000001
|
|
|
|
#define EFX_RESET_RXQ_ERR 0x00000002
|
|
|
|
#define EFX_RESET_TXQ_ERR 0x00000004
|
2011-11-16 17:11:13 +00:00
|
|
|
|
|
|
|
typedef enum efx_mac_type_e {
|
|
|
|
EFX_MAC_INVALID = 0,
|
|
|
|
EFX_MAC_SIENA,
|
2015-05-25 08:34:55 +00:00
|
|
|
EFX_MAC_HUNTINGTON,
|
2016-01-15 15:17:44 +00:00
|
|
|
EFX_MAC_MEDFORD,
|
2018-11-27 12:20:46 +00:00
|
|
|
EFX_MAC_MEDFORD2,
|
2011-11-16 17:11:13 +00:00
|
|
|
EFX_MAC_NTYPES
|
|
|
|
} efx_mac_type_t;
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_ev_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eevo_init)(efx_nic_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*eevo_fini)(efx_nic_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int,
|
2015-05-25 08:34:55 +00:00
|
|
|
efsys_mem_t *, size_t, uint32_t,
|
2016-12-28 17:45:52 +00:00
|
|
|
uint32_t, uint32_t, efx_evq_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*eevo_qdestroy)(efx_evq_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*eevo_qpost)(efx_evq_t *, uint16_t);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eevo_qmoderate)(efx_evq_t *, unsigned int);
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_QSTATS
|
|
|
|
void (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *);
|
|
|
|
#endif
|
|
|
|
} efx_ev_ops_t;
|
|
|
|
|
|
|
|
typedef struct efx_tx_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_init)(efx_nic_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*etxo_fini)(efx_nic_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qcreate)(efx_nic_t *,
|
2015-05-25 08:34:55 +00:00
|
|
|
unsigned int, unsigned int,
|
|
|
|
efsys_mem_t *, size_t,
|
|
|
|
uint32_t, uint16_t,
|
|
|
|
efx_evq_t *, efx_txq_t *,
|
|
|
|
unsigned int *);
|
|
|
|
void (*etxo_qdestroy)(efx_txq_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qpost)(efx_txq_t *, efx_buffer_t *,
|
2015-05-25 08:34:55 +00:00
|
|
|
unsigned int, unsigned int,
|
|
|
|
unsigned int *);
|
|
|
|
void (*etxo_qpush)(efx_txq_t *, unsigned int, unsigned int);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qpace)(efx_txq_t *, unsigned int);
|
|
|
|
efx_rc_t (*etxo_qflush)(efx_txq_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*etxo_qenable)(efx_txq_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qpio_enable)(efx_txq_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*etxo_qpio_disable)(efx_txq_t *);
|
2016-12-28 11:25:17 +00:00
|
|
|
efx_rc_t (*etxo_qpio_write)(efx_txq_t *, uint8_t *, size_t,
|
2015-05-25 08:34:55 +00:00
|
|
|
size_t);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int,
|
2015-05-25 08:34:55 +00:00
|
|
|
unsigned int *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*etxo_qdesc_post)(efx_txq_t *, efx_desc_t *,
|
2015-05-25 08:34:55 +00:00
|
|
|
unsigned int, unsigned int,
|
|
|
|
unsigned int *);
|
|
|
|
void (*etxo_qdesc_dma_create)(efx_txq_t *, efsys_dma_addr_t,
|
|
|
|
size_t, boolean_t,
|
|
|
|
efx_desc_t *);
|
|
|
|
void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t,
|
|
|
|
uint32_t, uint8_t,
|
|
|
|
efx_desc_t *);
|
2016-01-14 09:05:51 +00:00
|
|
|
void (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
|
2018-11-28 09:25:43 +00:00
|
|
|
uint16_t, uint32_t, uint16_t,
|
2016-01-14 09:05:51 +00:00
|
|
|
efx_desc_t *, int);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
|
|
|
|
efx_desc_t *);
|
2018-11-27 12:23:01 +00:00
|
|
|
void (*etxo_qdesc_checksum_create)(efx_txq_t *, uint16_t,
|
|
|
|
efx_desc_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_QSTATS
|
|
|
|
void (*etxo_qstats_update)(efx_txq_t *,
|
|
|
|
efsys_stat_t *);
|
|
|
|
#endif
|
|
|
|
} efx_tx_ops_t;
|
|
|
|
|
2018-11-29 06:45:15 +00:00
|
|
|
typedef union efx_rxq_type_data_u {
|
|
|
|
/* Dummy member to have non-empty union if no options are enabled */
|
|
|
|
uint32_t ertd_dummy;
|
|
|
|
#if EFSYS_OPT_RX_PACKED_STREAM
|
|
|
|
struct {
|
|
|
|
uint32_t eps_buf_size;
|
|
|
|
} ertd_packed_stream;
|
|
|
|
#endif
|
2018-11-29 06:45:38 +00:00
|
|
|
#if EFSYS_OPT_RX_ES_SUPER_BUFFER
|
|
|
|
struct {
|
|
|
|
uint32_t eessb_bufs_per_desc;
|
|
|
|
uint32_t eessb_max_dma_len;
|
|
|
|
uint32_t eessb_buf_stride;
|
|
|
|
uint32_t eessb_hol_block_timeout;
|
|
|
|
} ertd_es_super_buffer;
|
|
|
|
#endif
|
2018-11-29 06:45:15 +00:00
|
|
|
} efx_rxq_type_data_t;
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_rx_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*erxo_init)(efx_nic_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*erxo_fini)(efx_nic_t *);
|
|
|
|
#if EFSYS_OPT_RX_SCATTER
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int);
|
2015-05-25 08:34:55 +00:00
|
|
|
#endif
|
|
|
|
#if EFSYS_OPT_RX_SCALE
|
2018-11-23 09:15:32 +00:00
|
|
|
efx_rc_t (*erxo_scale_context_alloc)(efx_nic_t *,
|
|
|
|
efx_rx_scale_context_type_t,
|
|
|
|
uint32_t, uint32_t *);
|
|
|
|
efx_rc_t (*erxo_scale_context_free)(efx_nic_t *, uint32_t);
|
2018-11-23 09:15:44 +00:00
|
|
|
efx_rc_t (*erxo_scale_mode_set)(efx_nic_t *, uint32_t,
|
|
|
|
efx_rx_hash_alg_t,
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_rx_hash_type_t, boolean_t);
|
2018-11-23 09:15:44 +00:00
|
|
|
efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint32_t,
|
|
|
|
uint8_t *, size_t);
|
|
|
|
efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, uint32_t,
|
|
|
|
unsigned int *, size_t);
|
2016-01-13 06:40:00 +00:00
|
|
|
uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t,
|
|
|
|
uint8_t *);
|
|
|
|
#endif /* EFSYS_OPT_RX_SCALE */
|
|
|
|
efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *,
|
|
|
|
uint16_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t,
|
|
|
|
unsigned int, unsigned int,
|
|
|
|
unsigned int);
|
|
|
|
void (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *);
|
2018-11-22 14:31:35 +00:00
|
|
|
#if EFSYS_OPT_RX_PACKED_STREAM
|
|
|
|
void (*erxo_qpush_ps_credits)(efx_rxq_t *);
|
|
|
|
uint8_t * (*erxo_qps_packet_info)(efx_rxq_t *, uint8_t *,
|
|
|
|
uint32_t, uint32_t,
|
|
|
|
uint16_t *, uint32_t *, uint32_t *);
|
|
|
|
#endif
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*erxo_qflush)(efx_rxq_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*erxo_qenable)(efx_rxq_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
|
2018-11-29 06:45:15 +00:00
|
|
|
unsigned int, efx_rxq_type_t,
|
|
|
|
const efx_rxq_type_data_t *,
|
2015-05-25 08:34:55 +00:00
|
|
|
efsys_mem_t *, size_t, uint32_t,
|
2018-11-24 18:13:07 +00:00
|
|
|
unsigned int,
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_evq_t *, efx_rxq_t *);
|
|
|
|
void (*erxo_qdestroy)(efx_rxq_t *);
|
|
|
|
} efx_rx_ops_t;
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
typedef struct efx_mac_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *);
|
|
|
|
efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *);
|
|
|
|
efx_rc_t (*emo_addr_set)(efx_nic_t *);
|
2016-01-18 06:19:28 +00:00
|
|
|
efx_rc_t (*emo_pdu_set)(efx_nic_t *);
|
2016-05-17 06:25:00 +00:00
|
|
|
efx_rc_t (*emo_pdu_get)(efx_nic_t *, size_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_reconfigure)(efx_nic_t *);
|
|
|
|
efx_rc_t (*emo_multicast_list_set)(efx_nic_t *);
|
|
|
|
efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *,
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_rxq_t *, boolean_t);
|
|
|
|
void (*emo_filter_default_rxq_clear)(efx_nic_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_LOOPBACK
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t,
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_loopback_type_t);
|
|
|
|
#endif /* EFSYS_OPT_LOOPBACK */
|
|
|
|
#if EFSYS_OPT_MAC_STATS
|
2016-12-29 06:54:40 +00:00
|
|
|
efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t);
|
2018-11-23 07:26:37 +00:00
|
|
|
efx_rc_t (*emo_stats_clear)(efx_nic_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *);
|
|
|
|
efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *,
|
2011-11-16 17:11:13 +00:00
|
|
|
uint16_t, boolean_t);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
|
2011-11-16 17:11:13 +00:00
|
|
|
efsys_stat_t *, uint32_t *);
|
|
|
|
#endif /* EFSYS_OPT_MAC_STATS */
|
|
|
|
} efx_mac_ops_t;
|
|
|
|
|
|
|
|
typedef struct efx_phy_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*epo_power)(efx_nic_t *, boolean_t); /* optional */
|
|
|
|
efx_rc_t (*epo_reset)(efx_nic_t *);
|
|
|
|
efx_rc_t (*epo_reconfigure)(efx_nic_t *);
|
|
|
|
efx_rc_t (*epo_verify)(efx_nic_t *);
|
|
|
|
efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_PHY_STATS
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
|
2011-11-16 17:11:13 +00:00
|
|
|
uint32_t *);
|
|
|
|
#endif /* EFSYS_OPT_PHY_STATS */
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_BIST
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *);
|
|
|
|
efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t);
|
|
|
|
efx_rc_t (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t,
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_bist_result_t *, uint32_t *,
|
2011-11-16 17:11:13 +00:00
|
|
|
unsigned long *, size_t);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t);
|
|
|
|
#endif /* EFSYS_OPT_BIST */
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_phy_ops_t;
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_FILTER
|
|
|
|
typedef struct efx_filter_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*efo_init)(efx_nic_t *);
|
|
|
|
void (*efo_fini)(efx_nic_t *);
|
|
|
|
efx_rc_t (*efo_restore)(efx_nic_t *);
|
|
|
|
efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *,
|
|
|
|
boolean_t may_replace);
|
|
|
|
efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *);
|
2016-12-30 12:02:16 +00:00
|
|
|
efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *,
|
|
|
|
size_t, size_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
|
2015-05-25 08:34:55 +00:00
|
|
|
boolean_t, boolean_t, boolean_t,
|
2016-05-11 06:28:08 +00:00
|
|
|
uint8_t const *, uint32_t);
|
2015-05-25 08:34:55 +00:00
|
|
|
} efx_filter_ops_t;
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_filter_reconfigure(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in_ecount(6) uint8_t const *mac_addr,
|
|
|
|
__in boolean_t all_unicst,
|
|
|
|
__in boolean_t mulcst,
|
|
|
|
__in boolean_t all_mulcst,
|
|
|
|
__in boolean_t brdcst,
|
|
|
|
__in_ecount(6*count) uint8_t const *addrs,
|
2016-05-11 06:28:08 +00:00
|
|
|
__in uint32_t count);
|
2015-05-25 08:34:55 +00:00
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_FILTER */
|
|
|
|
|
2018-11-26 06:20:13 +00:00
|
|
|
#if EFSYS_OPT_TUNNEL
|
|
|
|
typedef struct efx_tunnel_ops_s {
|
|
|
|
boolean_t (*eto_udp_encap_supported)(efx_nic_t *);
|
|
|
|
efx_rc_t (*eto_reconfigure)(efx_nic_t *);
|
|
|
|
} efx_tunnel_ops_t;
|
|
|
|
#endif /* EFSYS_OPT_TUNNEL */
|
2015-05-25 08:34:55 +00:00
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
typedef struct efx_port_s {
|
|
|
|
efx_mac_type_t ep_mac_type;
|
2016-12-28 11:01:01 +00:00
|
|
|
uint32_t ep_phy_type;
|
2011-11-16 17:11:13 +00:00
|
|
|
uint8_t ep_port;
|
|
|
|
uint32_t ep_mac_pdu;
|
|
|
|
uint8_t ep_mac_addr[6];
|
|
|
|
efx_link_mode_t ep_link_mode;
|
2015-05-25 08:34:55 +00:00
|
|
|
boolean_t ep_all_unicst;
|
|
|
|
boolean_t ep_mulcst;
|
|
|
|
boolean_t ep_all_mulcst;
|
2011-11-16 17:11:13 +00:00
|
|
|
boolean_t ep_brdcst;
|
|
|
|
unsigned int ep_fcntl;
|
|
|
|
boolean_t ep_fcntl_autoneg;
|
|
|
|
efx_oword_t ep_multicst_hash[2];
|
2015-05-25 08:34:55 +00:00
|
|
|
uint8_t ep_mulcst_addr_list[EFX_MAC_ADDR_LEN *
|
|
|
|
EFX_MAC_MULTICAST_LIST_MAX];
|
|
|
|
uint32_t ep_mulcst_addr_count;
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_LOOPBACK
|
|
|
|
efx_loopback_type_t ep_loopback_type;
|
|
|
|
efx_link_mode_t ep_loopback_link_mode;
|
|
|
|
#endif /* EFSYS_OPT_LOOPBACK */
|
|
|
|
#if EFSYS_OPT_PHY_FLAGS
|
|
|
|
uint32_t ep_phy_flags;
|
|
|
|
#endif /* EFSYS_OPT_PHY_FLAGS */
|
|
|
|
#if EFSYS_OPT_PHY_LED_CONTROL
|
|
|
|
efx_phy_led_mode_t ep_phy_led_mode;
|
|
|
|
#endif /* EFSYS_OPT_PHY_LED_CONTROL */
|
|
|
|
efx_phy_media_type_t ep_fixed_port_type;
|
|
|
|
efx_phy_media_type_t ep_module_type;
|
|
|
|
uint32_t ep_adv_cap_mask;
|
|
|
|
uint32_t ep_lp_cap_mask;
|
|
|
|
uint32_t ep_default_adv_cap_mask;
|
|
|
|
uint32_t ep_phy_cap_mask;
|
|
|
|
boolean_t ep_mac_drain;
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_BIST
|
|
|
|
efx_bist_type_t ep_current_bist;
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_mac_ops_t *ep_emop;
|
|
|
|
const efx_phy_ops_t *ep_epop;
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_port_t;
|
|
|
|
|
|
|
|
typedef struct efx_mon_ops_s {
|
|
|
|
#if EFSYS_OPT_MON_STATS
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
|
|
|
|
efx_mon_stat_value_t *);
|
2018-11-30 07:04:25 +00:00
|
|
|
efx_rc_t (*emo_limits_update)(efx_nic_t *,
|
|
|
|
efx_mon_stat_limits_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_MON_STATS */
|
|
|
|
} efx_mon_ops_t;
|
|
|
|
|
|
|
|
typedef struct efx_mon_s {
|
2016-05-12 06:19:06 +00:00
|
|
|
efx_mon_type_t em_type;
|
|
|
|
const efx_mon_ops_t *em_emop;
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_mon_t;
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_intr_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eio_init)(efx_nic_t *, efx_intr_type_t, efsys_mem_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*eio_enable)(efx_nic_t *);
|
|
|
|
void (*eio_disable)(efx_nic_t *);
|
|
|
|
void (*eio_disable_unlocked)(efx_nic_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int);
|
2016-01-12 15:28:59 +00:00
|
|
|
void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *);
|
|
|
|
void (*eio_status_message)(efx_nic_t *, unsigned int,
|
|
|
|
boolean_t *);
|
|
|
|
void (*eio_fatal)(efx_nic_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*eio_fini)(efx_nic_t *);
|
|
|
|
} efx_intr_ops_t;
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
typedef struct efx_intr_s {
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_intr_ops_t *ei_eiop;
|
|
|
|
efsys_mem_t *ei_esmp;
|
|
|
|
efx_intr_type_t ei_type;
|
|
|
|
unsigned int ei_level;
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_intr_t;
|
|
|
|
|
|
|
|
typedef struct efx_nic_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eno_probe)(efx_nic_t *);
|
2016-01-14 08:59:38 +00:00
|
|
|
efx_rc_t (*eno_board_cfg)(efx_nic_t *);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*);
|
|
|
|
efx_rc_t (*eno_reset)(efx_nic_t *);
|
|
|
|
efx_rc_t (*eno_init)(efx_nic_t *);
|
|
|
|
efx_rc_t (*eno_get_vi_pool)(efx_nic_t *, uint32_t *);
|
|
|
|
efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t,
|
2015-05-25 08:34:55 +00:00
|
|
|
uint32_t *, size_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_DIAG
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*eno_register_test)(efx_nic_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_DIAG */
|
2015-11-29 05:42:49 +00:00
|
|
|
void (*eno_fini)(efx_nic_t *);
|
|
|
|
void (*eno_unprobe)(efx_nic_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_nic_ops_t;
|
|
|
|
|
2015-02-21 06:28:31 +00:00
|
|
|
#ifndef EFX_TXQ_LIMIT_TARGET
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_TXQ_LIMIT_TARGET 259
|
2015-02-21 06:28:31 +00:00
|
|
|
#endif
|
|
|
|
#ifndef EFX_RXQ_LIMIT_TARGET
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_RXQ_LIMIT_TARGET 512
|
2015-02-21 06:28:31 +00:00
|
|
|
#endif
|
2018-11-24 15:23:58 +00:00
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
|
|
|
|
#if EFSYS_OPT_FILTER
|
|
|
|
|
2018-11-27 12:14:05 +00:00
|
|
|
#if EFSYS_OPT_SIENA
|
|
|
|
|
2016-05-14 05:59:18 +00:00
|
|
|
typedef struct siena_filter_spec_s {
|
|
|
|
uint8_t sfs_type;
|
|
|
|
uint32_t sfs_flags;
|
|
|
|
uint32_t sfs_dmaq_id;
|
|
|
|
uint32_t sfs_dword[3];
|
|
|
|
} siena_filter_spec_t;
|
|
|
|
|
|
|
|
typedef enum siena_filter_type_e {
|
|
|
|
EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
|
|
|
EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */
|
|
|
|
EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
|
|
|
|
EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */
|
|
|
|
EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
|
|
|
|
EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
|
|
|
|
|
|
|
|
EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
|
|
|
EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
|
|
|
|
EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
|
|
|
EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */
|
|
|
|
EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */
|
|
|
|
EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */
|
|
|
|
|
|
|
|
EFX_SIENA_FILTER_NTYPES
|
|
|
|
} siena_filter_type_t;
|
|
|
|
|
|
|
|
typedef enum siena_filter_tbl_id_e {
|
|
|
|
EFX_SIENA_FILTER_TBL_RX_IP = 0,
|
|
|
|
EFX_SIENA_FILTER_TBL_RX_MAC,
|
|
|
|
EFX_SIENA_FILTER_TBL_TX_IP,
|
|
|
|
EFX_SIENA_FILTER_TBL_TX_MAC,
|
|
|
|
EFX_SIENA_FILTER_NTBLS
|
|
|
|
} siena_filter_tbl_id_t;
|
|
|
|
|
|
|
|
typedef struct siena_filter_tbl_s {
|
|
|
|
int sft_size; /* number of entries */
|
|
|
|
int sft_used; /* active count */
|
|
|
|
uint32_t *sft_bitmap; /* active bitmap */
|
|
|
|
siena_filter_spec_t *sft_spec; /* array of saved specs */
|
|
|
|
} siena_filter_tbl_t;
|
|
|
|
|
|
|
|
typedef struct siena_filter_s {
|
|
|
|
siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS];
|
|
|
|
unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES];
|
|
|
|
} siena_filter_t;
|
2011-11-16 17:11:13 +00:00
|
|
|
|
2018-11-27 12:14:05 +00:00
|
|
|
#endif /* EFSYS_OPT_SIENA */
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
typedef struct efx_filter_s {
|
2016-05-10 07:01:06 +00:00
|
|
|
#if EFSYS_OPT_SIENA
|
2016-05-14 05:59:18 +00:00
|
|
|
siena_filter_t *ef_siena_filter;
|
2016-05-10 07:01:06 +00:00
|
|
|
#endif /* EFSYS_OPT_SIENA */
|
2018-11-27 12:14:16 +00:00
|
|
|
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
|
2016-01-12 15:24:13 +00:00
|
|
|
ef10_filter_table_t *ef_ef10_filter_table;
|
2018-11-27 12:14:16 +00:00
|
|
|
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_filter_t;
|
|
|
|
|
2018-11-27 12:14:05 +00:00
|
|
|
#if EFSYS_OPT_SIENA
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
extern void
|
2016-05-13 07:17:38 +00:00
|
|
|
siena_filter_tbl_clear(
|
2011-11-16 17:11:13 +00:00
|
|
|
__in efx_nic_t *enp,
|
2016-05-14 05:59:18 +00:00
|
|
|
__in siena_filter_tbl_id_t tbl);
|
2011-11-16 17:11:13 +00:00
|
|
|
|
2018-11-27 12:14:05 +00:00
|
|
|
#endif /* EFSYS_OPT_SIENA */
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_FILTER */
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_MCDI
|
|
|
|
|
2018-11-26 06:20:13 +00:00
|
|
|
#define EFX_TUNNEL_MAXNENTRIES (16)
|
|
|
|
|
|
|
|
#if EFSYS_OPT_TUNNEL
|
|
|
|
|
|
|
|
typedef struct efx_tunnel_udp_entry_s {
|
|
|
|
uint16_t etue_port; /* host/cpu-endian */
|
|
|
|
uint16_t etue_protocol;
|
|
|
|
} efx_tunnel_udp_entry_t;
|
|
|
|
|
|
|
|
typedef struct efx_tunnel_cfg_s {
|
|
|
|
efx_tunnel_udp_entry_t etc_udp_entries[EFX_TUNNEL_MAXNENTRIES];
|
|
|
|
unsigned int etc_udp_entries_num;
|
|
|
|
} efx_tunnel_cfg_t;
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_TUNNEL */
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_mcdi_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
|
2016-01-14 09:00:35 +00:00
|
|
|
void (*emco_send_request)(efx_nic_t *, void *, size_t,
|
|
|
|
void *, size_t);
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*emco_poll_reboot)(efx_nic_t *);
|
2015-12-11 07:20:33 +00:00
|
|
|
boolean_t (*emco_poll_response)(efx_nic_t *);
|
|
|
|
void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t);
|
2015-05-25 08:34:55 +00:00
|
|
|
void (*emco_fini)(efx_nic_t *);
|
2016-12-30 11:56:12 +00:00
|
|
|
efx_rc_t (*emco_feature_supported)(efx_nic_t *,
|
|
|
|
efx_mcdi_feature_id_t, boolean_t *);
|
|
|
|
void (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *,
|
|
|
|
uint32_t *);
|
2015-05-25 08:34:55 +00:00
|
|
|
} efx_mcdi_ops_t;
|
|
|
|
|
|
|
|
typedef struct efx_mcdi_s {
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_mcdi_ops_t *em_emcop;
|
2015-05-25 08:34:55 +00:00
|
|
|
const efx_mcdi_transport_t *em_emtp;
|
|
|
|
efx_mcdi_iface_t em_emip;
|
|
|
|
} efx_mcdi_t;
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_MCDI */
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_NVRAM
|
2018-11-23 10:21:06 +00:00
|
|
|
|
|
|
|
/* Invalid partition ID for en_nvram_partn_locked field of efx_nc_t */
|
|
|
|
#define EFX_NVRAM_PARTN_INVALID (0xffffffffu)
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
typedef struct efx_nvram_ops_s {
|
|
|
|
#if EFSYS_OPT_DIAG
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*envo_test)(efx_nic_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_DIAG */
|
2016-01-13 06:44:05 +00:00
|
|
|
efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
|
|
|
|
uint32_t *);
|
2016-01-14 09:01:53 +00:00
|
|
|
efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
|
2016-01-15 06:28:58 +00:00
|
|
|
efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *);
|
2016-01-15 15:19:18 +00:00
|
|
|
efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t,
|
|
|
|
unsigned int, caddr_t, size_t);
|
2018-11-23 10:21:36 +00:00
|
|
|
efx_rc_t (*envo_partn_read_backup)(efx_nic_t *, uint32_t,
|
|
|
|
unsigned int, caddr_t, size_t);
|
2016-01-17 05:12:37 +00:00
|
|
|
efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t,
|
|
|
|
unsigned int, size_t);
|
2016-01-18 06:13:09 +00:00
|
|
|
efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t,
|
|
|
|
unsigned int, caddr_t, size_t);
|
2018-11-23 10:20:20 +00:00
|
|
|
efx_rc_t (*envo_partn_rw_finish)(efx_nic_t *, uint32_t,
|
|
|
|
uint32_t *);
|
2016-01-18 06:16:51 +00:00
|
|
|
efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t,
|
|
|
|
uint32_t *, uint16_t *);
|
2016-01-18 06:18:01 +00:00
|
|
|
efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t,
|
|
|
|
uint16_t *);
|
2016-05-10 06:51:20 +00:00
|
|
|
efx_rc_t (*envo_buffer_validate)(efx_nic_t *, uint32_t,
|
|
|
|
caddr_t, size_t);
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_nvram_ops_t;
|
|
|
|
#endif /* EFSYS_OPT_NVRAM */
|
|
|
|
|
|
|
|
#if EFSYS_OPT_VPD
|
|
|
|
typedef struct efx_vpd_ops_s {
|
2015-11-29 05:42:49 +00:00
|
|
|
efx_rc_t (*evpdo_init)(efx_nic_t *);
|
|
|
|
efx_rc_t (*evpdo_size)(efx_nic_t *, size_t *);
|
|
|
|
efx_rc_t (*evpdo_read)(efx_nic_t *, caddr_t, size_t);
|
|
|
|
efx_rc_t (*evpdo_verify)(efx_nic_t *, caddr_t, size_t);
|
|
|
|
efx_rc_t (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t);
|
|
|
|
efx_rc_t (*evpdo_get)(efx_nic_t *, caddr_t, size_t,
|
|
|
|
efx_vpd_value_t *);
|
|
|
|
efx_rc_t (*evpdo_set)(efx_nic_t *, caddr_t, size_t,
|
|
|
|
efx_vpd_value_t *);
|
|
|
|
efx_rc_t (*evpdo_next)(efx_nic_t *, caddr_t, size_t,
|
|
|
|
efx_vpd_value_t *, unsigned int *);
|
|
|
|
efx_rc_t (*evpdo_write)(efx_nic_t *, caddr_t, size_t);
|
|
|
|
void (*evpdo_fini)(efx_nic_t *);
|
2011-11-16 17:11:13 +00:00
|
|
|
} efx_vpd_ops_t;
|
|
|
|
#endif /* EFSYS_OPT_VPD */
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_partitions(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__out_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__out unsigned int *npartnp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_metadata(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
|
|
|
__out uint32_t *subtypep,
|
|
|
|
__out_ecount(4) uint16_t version[4],
|
|
|
|
__out_bcount_opt(size) char *descp,
|
|
|
|
__in size_t size);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_info(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
|
|
|
__out_opt size_t *sizep,
|
|
|
|
__out_opt uint32_t *addressp,
|
2015-12-04 06:51:37 +00:00
|
|
|
__out_opt uint32_t *erase_sizep,
|
|
|
|
__out_opt uint32_t *write_sizep);
|
2015-05-25 08:34:55 +00:00
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_update_start(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_read(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
|
|
|
__in uint32_t offset,
|
|
|
|
__out_bcount(size) caddr_t data,
|
sfxge: select whether to read current or backup partition in Medford A/B scheme
The dynamic config on Medford is stored using two partitions in flash, and at
any time one is the 'current' partition, used to provide the active config,
and the other 'backup' partition is used for writes. This means that there
are two potential partitions that can be used to service reads, and which is
required can depend on, for example, whether the read is to get the current
contents or to verify a write.
When the partition write lock is held, the default behaviour is to read from
the backup partition, which was wrong for most reads in the common code which
require the current partition. This change allows the current partition to be
read whilst the write lock is held.
There is one read in Manftest which needs the backup partition.
ef10_nvram_partn_read_mode() is created to avoid changing
ef10_nvram_partn_read() which shares a prototype with the equivalent Falcon
and Siena methods.
MC_CMD_NVRAM_READ_IN_V2 adds an extra field, but firmware which doesn't support
it just ignores it.
Submitted by: Mark Spender <mspender at solarflare.com>
Sponsored by: Solarflare Communications, Inc.
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D4974
2016-01-19 06:03:44 +00:00
|
|
|
__in size_t size,
|
|
|
|
__in uint32_t mode);
|
2015-05-25 08:34:55 +00:00
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_erase(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
|
|
|
__in uint32_t offset,
|
|
|
|
__in size_t size);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_write(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
|
|
|
__in uint32_t offset,
|
2018-11-29 06:47:19 +00:00
|
|
|
__in_bcount(size) caddr_t data,
|
2015-05-25 08:34:55 +00:00
|
|
|
__in size_t size);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_update_finish(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn,
|
2016-12-29 08:28:42 +00:00
|
|
|
__in boolean_t reboot,
|
2018-11-23 10:20:20 +00:00
|
|
|
__out_opt uint32_t *verify_resultp);
|
2015-05-25 08:34:55 +00:00
|
|
|
|
|
|
|
#if EFSYS_OPT_DIAG
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
__checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_nvram_test(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t partn);
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_DIAG */
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
|
|
|
|
|
2016-01-14 09:19:28 +00:00
|
|
|
#if EFSYS_OPT_LICENSING
|
|
|
|
|
|
|
|
typedef struct efx_lic_ops_s {
|
|
|
|
efx_rc_t (*elo_update_licenses)(efx_nic_t *);
|
|
|
|
efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
|
|
|
|
efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
|
|
|
|
efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
|
|
|
|
size_t *, uint8_t *);
|
2016-05-16 06:17:56 +00:00
|
|
|
efx_rc_t (*elo_find_start)
|
|
|
|
(efx_nic_t *, caddr_t, size_t, uint32_t *);
|
|
|
|
efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t,
|
2016-12-28 10:45:14 +00:00
|
|
|
uint32_t, uint32_t *);
|
2016-05-16 06:17:56 +00:00
|
|
|
boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t,
|
|
|
|
uint32_t, uint32_t *, uint32_t *);
|
|
|
|
boolean_t (*elo_validate_key)(efx_nic_t *,
|
|
|
|
caddr_t, uint32_t);
|
|
|
|
efx_rc_t (*elo_read_key)(efx_nic_t *,
|
|
|
|
caddr_t, size_t, uint32_t, uint32_t,
|
|
|
|
caddr_t, size_t, uint32_t *);
|
|
|
|
efx_rc_t (*elo_write_key)(efx_nic_t *,
|
|
|
|
caddr_t, size_t, uint32_t,
|
|
|
|
caddr_t, uint32_t, uint32_t *);
|
|
|
|
efx_rc_t (*elo_delete_key)(efx_nic_t *,
|
|
|
|
caddr_t, size_t, uint32_t,
|
|
|
|
uint32_t, uint32_t, uint32_t *);
|
|
|
|
efx_rc_t (*elo_create_partition)(efx_nic_t *,
|
|
|
|
caddr_t, size_t);
|
|
|
|
efx_rc_t (*elo_finish_partition)(efx_nic_t *,
|
|
|
|
caddr_t, size_t);
|
2016-01-14 09:19:28 +00:00
|
|
|
} efx_lic_ops_t;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_drv_cfg_s {
|
|
|
|
uint32_t edc_min_vi_count;
|
|
|
|
uint32_t edc_max_vi_count;
|
|
|
|
|
|
|
|
uint32_t edc_max_piobuf_count;
|
|
|
|
uint32_t edc_pio_alloc_size;
|
|
|
|
} efx_drv_cfg_t;
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
struct efx_nic_s {
|
|
|
|
uint32_t en_magic;
|
|
|
|
efx_family_t en_family;
|
|
|
|
uint32_t en_features;
|
|
|
|
efsys_identifier_t *en_esip;
|
|
|
|
efsys_lock_t *en_eslp;
|
2016-12-28 11:01:01 +00:00
|
|
|
efsys_bar_t *en_esbp;
|
2011-11-16 17:11:13 +00:00
|
|
|
unsigned int en_mod_flags;
|
|
|
|
unsigned int en_reset_flags;
|
|
|
|
efx_nic_cfg_t en_nic_cfg;
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_drv_cfg_t en_drv_cfg;
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_port_t en_port;
|
|
|
|
efx_mon_t en_mon;
|
|
|
|
efx_intr_t en_intr;
|
|
|
|
uint32_t en_ev_qcount;
|
|
|
|
uint32_t en_rx_qcount;
|
|
|
|
uint32_t en_tx_qcount;
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_nic_ops_t *en_enop;
|
|
|
|
const efx_ev_ops_t *en_eevop;
|
|
|
|
const efx_tx_ops_t *en_etxop;
|
|
|
|
const efx_rx_ops_t *en_erxop;
|
2018-11-29 06:43:00 +00:00
|
|
|
efx_fw_variant_t efv;
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_FILTER
|
|
|
|
efx_filter_t en_filter;
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_filter_ops_t *en_efop;
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_FILTER */
|
2018-11-26 06:20:13 +00:00
|
|
|
#if EFSYS_OPT_TUNNEL
|
|
|
|
efx_tunnel_cfg_t en_tunnel_cfg;
|
|
|
|
const efx_tunnel_ops_t *en_etop;
|
|
|
|
#endif /* EFSYS_OPT_TUNNEL */
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_MCDI
|
|
|
|
efx_mcdi_t en_mcdi;
|
|
|
|
#endif /* EFSYS_OPT_MCDI */
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_NVRAM
|
2018-11-23 10:21:06 +00:00
|
|
|
uint32_t en_nvram_partn_locked;
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_nvram_ops_t *en_envop;
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_NVRAM */
|
|
|
|
#if EFSYS_OPT_VPD
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_vpd_ops_t *en_evpdop;
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif /* EFSYS_OPT_VPD */
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_RX_SCALE
|
2018-11-23 09:15:20 +00:00
|
|
|
efx_rx_hash_support_t en_hash_support;
|
|
|
|
efx_rx_scale_context_type_t en_rss_context_type;
|
|
|
|
uint32_t en_rss_context;
|
2015-05-25 08:34:55 +00:00
|
|
|
#endif /* EFSYS_OPT_RX_SCALE */
|
|
|
|
uint32_t en_vport_id;
|
2016-01-14 09:19:28 +00:00
|
|
|
#if EFSYS_OPT_LICENSING
|
2016-05-12 06:19:06 +00:00
|
|
|
const efx_lic_ops_t *en_elop;
|
2016-05-17 06:23:50 +00:00
|
|
|
boolean_t en_licensing_supported;
|
2016-01-14 09:19:28 +00:00
|
|
|
#endif
|
2011-11-16 17:11:13 +00:00
|
|
|
union {
|
|
|
|
#if EFSYS_OPT_SIENA
|
|
|
|
struct {
|
|
|
|
#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
|
|
|
|
unsigned int enu_partn_mask;
|
|
|
|
#endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
|
|
|
|
#if EFSYS_OPT_VPD
|
|
|
|
caddr_t enu_svpd;
|
|
|
|
size_t enu_svpd_length;
|
|
|
|
#endif /* EFSYS_OPT_VPD */
|
2015-05-25 08:34:55 +00:00
|
|
|
int enu_unused;
|
2011-11-16 17:11:13 +00:00
|
|
|
} siena;
|
|
|
|
#endif /* EFSYS_OPT_SIENA */
|
2016-01-12 13:26:04 +00:00
|
|
|
int enu_unused;
|
|
|
|
} en_u;
|
2018-11-27 12:14:16 +00:00
|
|
|
#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
|
2016-01-12 13:26:04 +00:00
|
|
|
union en_arch {
|
2015-05-25 08:34:55 +00:00
|
|
|
struct {
|
2016-01-12 13:26:04 +00:00
|
|
|
int ena_vi_base;
|
|
|
|
int ena_vi_count;
|
2016-01-13 06:41:39 +00:00
|
|
|
int ena_vi_shift;
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_VPD
|
2016-01-12 13:26:04 +00:00
|
|
|
caddr_t ena_svpd;
|
|
|
|
size_t ena_svpd_length;
|
2015-05-25 08:34:55 +00:00
|
|
|
#endif /* EFSYS_OPT_VPD */
|
2016-01-12 13:26:04 +00:00
|
|
|
efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS];
|
|
|
|
uint32_t ena_piobuf_count;
|
|
|
|
uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS];
|
|
|
|
uint32_t ena_pio_write_vi_base;
|
2015-05-25 08:34:55 +00:00
|
|
|
/* Memory BAR mapping regions */
|
2016-01-12 13:26:04 +00:00
|
|
|
uint32_t ena_uc_mem_map_offset;
|
|
|
|
size_t ena_uc_mem_map_size;
|
|
|
|
uint32_t ena_wc_mem_map_offset;
|
|
|
|
size_t ena_wc_mem_map_size;
|
|
|
|
} ef10;
|
|
|
|
} en_arch;
|
2018-11-27 12:14:16 +00:00
|
|
|
#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2) */
|
2011-11-16 17:11:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define EFX_NIC_MAGIC 0x02121996
|
|
|
|
|
|
|
|
typedef boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *,
|
|
|
|
const efx_ev_callbacks_t *, void *);
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
typedef struct efx_evq_rxq_state_s {
|
|
|
|
unsigned int eers_rx_read_ptr;
|
|
|
|
unsigned int eers_rx_mask;
|
2018-11-29 06:45:38 +00:00
|
|
|
#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
|
2018-11-22 14:31:35 +00:00
|
|
|
unsigned int eers_rx_stream_npackets;
|
|
|
|
boolean_t eers_rx_packed_stream;
|
2018-11-29 06:45:38 +00:00
|
|
|
#endif
|
|
|
|
#if EFSYS_OPT_RX_PACKED_STREAM
|
2018-11-22 14:31:35 +00:00
|
|
|
unsigned int eers_rx_packed_stream_credits;
|
|
|
|
#endif
|
2015-05-25 08:34:55 +00:00
|
|
|
} efx_evq_rxq_state_t;
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
struct efx_evq_s {
|
|
|
|
uint32_t ee_magic;
|
|
|
|
efx_nic_t *ee_enp;
|
|
|
|
unsigned int ee_index;
|
|
|
|
unsigned int ee_mask;
|
|
|
|
efsys_mem_t *ee_esmp;
|
|
|
|
#if EFSYS_OPT_QSTATS
|
|
|
|
uint32_t ee_stat[EV_NQSTATS];
|
|
|
|
#endif /* EFSYS_OPT_QSTATS */
|
2015-05-25 08:34:55 +00:00
|
|
|
|
|
|
|
efx_ev_handler_t ee_rx;
|
|
|
|
efx_ev_handler_t ee_tx;
|
|
|
|
efx_ev_handler_t ee_driver;
|
|
|
|
efx_ev_handler_t ee_global;
|
|
|
|
efx_ev_handler_t ee_drv_gen;
|
|
|
|
#if EFSYS_OPT_MCDI
|
|
|
|
efx_ev_handler_t ee_mcdi;
|
|
|
|
#endif /* EFSYS_OPT_MCDI */
|
|
|
|
|
|
|
|
efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS];
|
2016-12-30 11:54:27 +00:00
|
|
|
|
|
|
|
uint32_t ee_flags;
|
2011-11-16 17:11:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define EFX_EVQ_MAGIC 0x08081997
|
|
|
|
|
2015-02-22 19:13:52 +00:00
|
|
|
#define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */
|
2011-11-16 17:11:13 +00:00
|
|
|
|
|
|
|
struct efx_rxq_s {
|
|
|
|
uint32_t er_magic;
|
|
|
|
efx_nic_t *er_enp;
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_evq_t *er_eep;
|
2011-11-16 17:11:13 +00:00
|
|
|
unsigned int er_index;
|
2015-05-25 08:34:55 +00:00
|
|
|
unsigned int er_label;
|
2011-11-16 17:11:13 +00:00
|
|
|
unsigned int er_mask;
|
|
|
|
efsys_mem_t *er_esmp;
|
2018-11-23 11:39:02 +00:00
|
|
|
efx_evq_rxq_state_t *er_ev_qstate;
|
2011-11-16 17:11:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define EFX_RXQ_MAGIC 0x15022005
|
|
|
|
|
|
|
|
struct efx_txq_s {
|
|
|
|
uint32_t et_magic;
|
|
|
|
efx_nic_t *et_enp;
|
|
|
|
unsigned int et_index;
|
|
|
|
unsigned int et_mask;
|
|
|
|
efsys_mem_t *et_esmp;
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_HUNTINGTON
|
|
|
|
uint32_t et_pio_bufnum;
|
|
|
|
uint32_t et_pio_blknum;
|
|
|
|
uint32_t et_pio_write_offset;
|
|
|
|
uint32_t et_pio_offset;
|
|
|
|
size_t et_pio_size;
|
|
|
|
#endif
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_QSTATS
|
|
|
|
uint32_t et_stat[TX_NQSTATS];
|
|
|
|
#endif /* EFSYS_OPT_QSTATS */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define EFX_TXQ_MAGIC 0x05092005
|
|
|
|
|
|
|
|
#define EFX_MAC_ADDR_COPY(_dst, _src) \
|
|
|
|
do { \
|
|
|
|
(_dst)[0] = (_src)[0]; \
|
|
|
|
(_dst)[1] = (_src)[1]; \
|
|
|
|
(_dst)[2] = (_src)[2]; \
|
|
|
|
(_dst)[3] = (_src)[3]; \
|
|
|
|
(_dst)[4] = (_src)[4]; \
|
|
|
|
(_dst)[5] = (_src)[5]; \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_MAC_BROADCAST_ADDR_SET(_dst) \
|
|
|
|
do { \
|
|
|
|
uint16_t *_d = (uint16_t *)(_dst); \
|
|
|
|
_d[0] = 0xffff; \
|
|
|
|
_d[1] = 0xffff; \
|
|
|
|
_d[2] = 0xffff; \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#if EFSYS_OPT_CHECK_REG
|
|
|
|
#define EFX_CHECK_REG(_enp, _reg) \
|
|
|
|
do { \
|
2015-05-25 08:34:55 +00:00
|
|
|
const char *name = #_reg; \
|
2011-11-16 17:11:13 +00:00
|
|
|
char min = name[4]; \
|
|
|
|
char max = name[5]; \
|
|
|
|
char rev; \
|
|
|
|
\
|
|
|
|
switch ((_enp)->en_family) { \
|
|
|
|
case EFX_FAMILY_SIENA: \
|
|
|
|
rev = 'C'; \
|
|
|
|
break; \
|
|
|
|
\
|
2015-05-25 08:34:55 +00:00
|
|
|
case EFX_FAMILY_HUNTINGTON: \
|
|
|
|
rev = 'D'; \
|
|
|
|
break; \
|
|
|
|
\
|
2016-01-12 06:32:56 +00:00
|
|
|
case EFX_FAMILY_MEDFORD: \
|
|
|
|
rev = 'E'; \
|
|
|
|
break; \
|
|
|
|
\
|
2018-11-27 12:14:16 +00:00
|
|
|
case EFX_FAMILY_MEDFORD2: \
|
|
|
|
rev = 'F'; \
|
|
|
|
break; \
|
|
|
|
\
|
2011-11-16 17:11:13 +00:00
|
|
|
default: \
|
|
|
|
rev = '?'; \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
EFSYS_ASSERT3S(rev, >=, min); \
|
|
|
|
EFSYS_ASSERT3S(rev, <=, max); \
|
|
|
|
\
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
#else
|
|
|
|
#define EFX_CHECK_REG(_enp, _reg) do { \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
2016-12-28 11:25:17 +00:00
|
|
|
} while (B_FALSE)
|
2011-11-16 17:11:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EFX_BAR_READD(_enp, _reg, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
EFSYS_PROBE3(efx_bar_readd, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_WRITED(_enp, _reg, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE3(efx_bar_writed, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_READQ(_enp, _reg, _eqp) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READQ((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_eqp)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_readq, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eqp)->eq_u32[1], \
|
|
|
|
uint32_t, (_eqp)->eq_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_WRITEQ(_enp, _reg, _eqp) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_writeq, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eqp)->eq_u32[1], \
|
|
|
|
uint32_t, (_eqp)->eq_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITEQ((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_eqp)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_READO(_enp, _reg, _eop) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READO((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_eop), B_TRUE); \
|
|
|
|
EFSYS_PROBE6(efx_bar_reado, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eop)->eo_u32[3], \
|
|
|
|
uint32_t, (_eop)->eo_u32[2], \
|
|
|
|
uint32_t, (_eop)->eo_u32[1], \
|
|
|
|
uint32_t, (_eop)->eo_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_WRITEO(_enp, _reg, _eop) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE6(efx_bar_writeo, const char *, #_reg, \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eop)->eo_u32[3], \
|
|
|
|
uint32_t, (_eop)->eo_u32[2], \
|
|
|
|
uint32_t, (_eop)->eo_u32[1], \
|
|
|
|
uint32_t, (_eop)->eo_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITEO((_enp)->en_esbp, _reg ## _OFST, \
|
|
|
|
(_eop), B_TRUE); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2018-11-27 12:22:37 +00:00
|
|
|
/*
|
|
|
|
* Accessors for memory BAR non-VI tables.
|
|
|
|
*
|
|
|
|
* Code used on EF10 *must* use EFX_BAR_VI_*() macros for per-VI registers,
|
|
|
|
* to ensure the correct runtime VI window size is used on Medford2.
|
|
|
|
*
|
|
|
|
* Siena-only code may continue using EFX_BAR_TBL_*() macros for VI registers.
|
|
|
|
*/
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#define EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READD((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_tbl_readd, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_TBL_WRITED(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITED((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITED((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + \
|
2016-12-28 11:04:36 +00:00
|
|
|
(3 * sizeof (efx_dword_t)) + \
|
2011-11-16 17:11:13 +00:00
|
|
|
((_index) * _reg ## _STEP)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_TBL_READQ(_enp, _reg, _index, _eqp) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READQ((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
|
|
|
(_eqp)); \
|
|
|
|
EFSYS_PROBE5(efx_bar_tbl_readq, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eqp)->eq_u32[1], \
|
|
|
|
uint32_t, (_eqp)->eq_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_TBL_WRITEQ(_enp, _reg, _index, _eqp) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE5(efx_bar_tbl_writeq, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eqp)->eq_u32[1], \
|
|
|
|
uint32_t, (_eqp)->eq_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITEQ((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
|
|
|
(_eqp)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_BAR_TBL_READO(_enp, _reg, _index, _eop, _lock) \
|
2011-11-16 17:11:13 +00:00
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READO((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
2015-05-25 08:34:55 +00:00
|
|
|
(_eop), (_lock)); \
|
2011-11-16 17:11:13 +00:00
|
|
|
EFSYS_PROBE7(efx_bar_tbl_reado, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eop)->eo_u32[3], \
|
|
|
|
uint32_t, (_eop)->eo_u32[2], \
|
|
|
|
uint32_t, (_eop)->eo_u32[1], \
|
|
|
|
uint32_t, (_eop)->eo_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#define EFX_BAR_TBL_WRITEO(_enp, _reg, _index, _eop, _lock) \
|
2011-11-16 17:11:13 +00:00
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE7(efx_bar_tbl_writeo, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eop)->eo_u32[3], \
|
|
|
|
uint32_t, (_eop)->eo_u32[2], \
|
|
|
|
uint32_t, (_eop)->eo_u32[1], \
|
|
|
|
uint32_t, (_eop)->eo_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITEO((_enp)->en_esbp, \
|
|
|
|
(_reg ## _OFST + ((_index) * _reg ## _STEP)), \
|
2015-05-25 08:34:55 +00:00
|
|
|
(_eop), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
/*
|
2018-11-27 12:22:37 +00:00
|
|
|
* Accessors for memory BAR per-VI registers.
|
|
|
|
*
|
|
|
|
* The VI window size is 8KB for Medford and all earlier controllers.
|
|
|
|
* For Medford2, the VI window size can be 8KB, 16KB or 64KB.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define EFX_BAR_VI_READD(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_BAR_READD((_enp)->en_esbp, \
|
|
|
|
((_reg ## _OFST) + \
|
|
|
|
((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_vi_readd, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_VI_WRITED(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITED((_enp)->en_esbp, \
|
|
|
|
((_reg ## _OFST) + \
|
|
|
|
((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_BAR_VI_WRITED2(_enp, _reg, _index, _edp, _lock) \
|
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
|
|
|
EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg, \
|
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_edp)->ed_u32[0]); \
|
|
|
|
EFSYS_BAR_WRITED((_enp)->en_esbp, \
|
|
|
|
((_reg ## _OFST) + \
|
|
|
|
(2 * sizeof (efx_dword_t)) + \
|
|
|
|
((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
|
|
|
|
(_edp), (_lock)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allow drivers to perform optimised 128-bit VI doorbell writes.
|
2015-05-25 08:34:55 +00:00
|
|
|
* The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
|
|
|
|
* special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid
|
|
|
|
* the need for locking in the host, and are the only ones known to be safe to
|
|
|
|
* use 128-bites write with.
|
|
|
|
*/
|
2018-11-27 12:22:37 +00:00
|
|
|
#define EFX_BAR_VI_DOORBELL_WRITEO(_enp, _reg, _index, _eop) \
|
2015-05-25 08:34:55 +00:00
|
|
|
do { \
|
|
|
|
EFX_CHECK_REG((_enp), (_reg)); \
|
2018-11-27 12:22:37 +00:00
|
|
|
EFSYS_PROBE7(efx_bar_vi_doorbell_writeo, \
|
2018-11-24 15:24:47 +00:00
|
|
|
const char *, #_reg, \
|
2015-05-25 08:34:55 +00:00
|
|
|
uint32_t, (_index), \
|
|
|
|
uint32_t, _reg ## _OFST, \
|
|
|
|
uint32_t, (_eop)->eo_u32[3], \
|
|
|
|
uint32_t, (_eop)->eo_u32[2], \
|
|
|
|
uint32_t, (_eop)->eo_u32[1], \
|
|
|
|
uint32_t, (_eop)->eo_u32[0]); \
|
|
|
|
EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp, \
|
2018-11-27 12:22:37 +00:00
|
|
|
(_reg ## _OFST + \
|
|
|
|
((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
|
2015-05-25 08:34:55 +00:00
|
|
|
(_eop)); \
|
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
|
|
|
#define EFX_DMA_SYNC_QUEUE_FOR_DEVICE(_esmp, _entries, _wptr, _owptr) \
|
|
|
|
do { \
|
|
|
|
unsigned int _new = (_wptr); \
|
|
|
|
unsigned int _old = (_owptr); \
|
|
|
|
\
|
|
|
|
if ((_new) >= (_old)) \
|
|
|
|
EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \
|
|
|
|
(_old) * sizeof (efx_desc_t), \
|
|
|
|
((_new) - (_old)) * sizeof (efx_desc_t)); \
|
|
|
|
else \
|
|
|
|
/* \
|
|
|
|
* It is cheaper to sync entire map than sync \
|
|
|
|
* two parts especially when offset/size are \
|
|
|
|
* ignored and entire map is synced in any case.\
|
|
|
|
*/ \
|
|
|
|
EFSYS_DMA_SYNC_FOR_DEVICE((_esmp), \
|
|
|
|
0, \
|
|
|
|
(_entries) * sizeof (efx_desc_t)); \
|
2011-11-16 17:11:13 +00:00
|
|
|
_NOTE(CONSTANTCONDITION) \
|
|
|
|
} while (B_FALSE)
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_mac_select(
|
|
|
|
__in efx_nic_t *enp);
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
extern void
|
|
|
|
efx_mac_multicast_hash_compute(
|
|
|
|
__in_ecount(6*count) uint8_t const *addrs,
|
|
|
|
__in int count,
|
|
|
|
__out efx_oword_t *hash_low,
|
|
|
|
__out efx_oword_t *hash_high);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_phy_probe(
|
|
|
|
__in efx_nic_t *enp);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
efx_phy_unprobe(
|
|
|
|
__in efx_nic_t *enp);
|
|
|
|
|
|
|
|
#if EFSYS_OPT_VPD
|
|
|
|
|
|
|
|
/* VPD utility functions */
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_length(
|
|
|
|
__in_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__out size_t *lengthp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_verify(
|
|
|
|
__in_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__out_opt boolean_t *cksummedp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_reinit(
|
2015-05-25 08:34:55 +00:00
|
|
|
__in_bcount(size) caddr_t data,
|
2011-11-16 17:11:13 +00:00
|
|
|
__in size_t size,
|
|
|
|
__in boolean_t wantpid);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_get(
|
|
|
|
__in_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__in efx_vpd_tag_t tag,
|
|
|
|
__in efx_vpd_keyword_t keyword,
|
|
|
|
__out unsigned int *payloadp,
|
|
|
|
__out uint8_t *paylenp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_next(
|
|
|
|
__in_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__out efx_vpd_tag_t *tagp,
|
|
|
|
__out efx_vpd_keyword_t *keyword,
|
2016-01-13 07:46:21 +00:00
|
|
|
__out_opt unsigned int *payloadp,
|
2011-11-16 17:11:13 +00:00
|
|
|
__out_opt uint8_t *paylenp,
|
|
|
|
__inout unsigned int *contp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2011-11-16 17:11:13 +00:00
|
|
|
efx_vpd_hunk_set(
|
|
|
|
__in_bcount(size) caddr_t data,
|
|
|
|
__in size_t size,
|
|
|
|
__in efx_vpd_value_t *evvp);
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_VPD */
|
|
|
|
|
2015-05-25 08:34:55 +00:00
|
|
|
#if EFSYS_OPT_MCDI
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_set_workaround(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__in uint32_t type,
|
|
|
|
__in boolean_t enabled,
|
|
|
|
__out_opt uint32_t *flagsp);
|
|
|
|
|
2015-11-29 05:42:49 +00:00
|
|
|
extern __checkReturn efx_rc_t
|
2015-05-25 08:34:55 +00:00
|
|
|
efx_mcdi_get_workarounds(
|
|
|
|
__in efx_nic_t *enp,
|
|
|
|
__out_opt uint32_t *implementedp,
|
|
|
|
__out_opt uint32_t *enabledp);
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_MCDI */
|
|
|
|
|
2016-12-29 06:54:40 +00:00
|
|
|
#if EFSYS_OPT_MAC_STATS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Closed range of stats (i.e. the first and the last are included).
|
|
|
|
* The last must be greater or equal (if the range is one item only) to
|
|
|
|
* the first.
|
|
|
|
*/
|
|
|
|
struct efx_mac_stats_range {
|
|
|
|
efx_mac_stat_t first;
|
|
|
|
efx_mac_stat_t last;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern efx_rc_t
|
|
|
|
efx_mac_stats_mask_add_ranges(
|
|
|
|
__inout_bcount(mask_size) uint32_t *maskp,
|
|
|
|
__in size_t mask_size,
|
|
|
|
__in_ecount(rng_count) const struct efx_mac_stats_range *rngp,
|
|
|
|
__in unsigned int rng_count);
|
|
|
|
|
|
|
|
#endif /* EFSYS_OPT_MAC_STATS */
|
|
|
|
|
2011-11-16 17:11:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _SYS_EFX_IMPL_H */
|