net/sfc/base: import MCDI implementation
Implement interface to talk to NIC management CPU. Provide helpers to fill in MCDI requests, execute it and process received response. MCDI request is prepared in either PCI BAR mapped memory (SFN5xxx/SFN6xxx) or DMA-mapped memory (SFN7xxx/SFN8xxx) and, doorbell is pressed (memory-mapped register) to execute it. Events about MCDI completion are delivered to house-keeping event queue, but usage of these events is optional and MCDI buffer may be simply polled waiting for completion indication set. From Solarflare Communications Inc. Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
11358bf6f6
commit
6f619653b9
@ -182,6 +182,62 @@ efx_nic_check_pcie_link_speed(
|
||||
__in uint32_t pcie_link_gen,
|
||||
__out efx_pcie_link_performance_t *resultp);
|
||||
|
||||
#if EFSYS_OPT_MCDI
|
||||
|
||||
typedef struct efx_mcdi_req_s efx_mcdi_req_t;
|
||||
|
||||
typedef enum efx_mcdi_exception_e {
|
||||
EFX_MCDI_EXCEPTION_MC_REBOOT,
|
||||
EFX_MCDI_EXCEPTION_MC_BADASSERT,
|
||||
} efx_mcdi_exception_t;
|
||||
|
||||
typedef struct efx_mcdi_transport_s {
|
||||
void *emt_context;
|
||||
efsys_mem_t *emt_dma_mem;
|
||||
void (*emt_execute)(void *, efx_mcdi_req_t *);
|
||||
void (*emt_ev_cpl)(void *);
|
||||
void (*emt_exception)(void *, efx_mcdi_exception_t);
|
||||
} efx_mcdi_transport_t;
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_init(
|
||||
__in efx_nic_t *enp,
|
||||
__in const efx_mcdi_transport_t *mtp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_reboot(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
void
|
||||
efx_mcdi_new_epoch(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern void
|
||||
efx_mcdi_get_timeout(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mcdi_req_t *emrp,
|
||||
__out uint32_t *usec_timeoutp);
|
||||
|
||||
extern void
|
||||
efx_mcdi_request_start(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mcdi_req_t *emrp,
|
||||
__in boolean_t ev_cpl);
|
||||
|
||||
extern __checkReturn boolean_t
|
||||
efx_mcdi_request_poll(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn boolean_t
|
||||
efx_mcdi_request_abort(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern void
|
||||
efx_mcdi_fini(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
|
||||
/* INTR */
|
||||
|
||||
#define EFX_NINTR_SIENA 1024
|
||||
@ -507,6 +563,9 @@ typedef struct efx_nic_cfg_s {
|
||||
uint32_t enc_rx_prefix_size;
|
||||
uint32_t enc_rx_buf_align_start;
|
||||
uint32_t enc_rx_buf_align_end;
|
||||
#if EFSYS_OPT_MCDI
|
||||
uint8_t enc_mcdi_mdio_channel;
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
boolean_t enc_bug26807_workaround;
|
||||
boolean_t enc_bug35388_workaround;
|
||||
boolean_t enc_bug41750_workaround;
|
||||
|
@ -72,6 +72,11 @@
|
||||
# error "MAC_FALCON_XMAC is obsolete and is not supported."
|
||||
#endif
|
||||
|
||||
#if EFSYS_OPT_MCDI
|
||||
/* Support management controller messages */
|
||||
# error "MCDI requires SIENA or HUNTINGTON or MEDFORD"
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
|
||||
#ifdef EFSYS_OPT_MON_LM87
|
||||
# error "MON_LM87 is obsolete and is not supported."
|
||||
#endif
|
||||
|
@ -270,6 +270,10 @@ efx_ev_qpoll(
|
||||
EFX_STATIC_ASSERT(ESE_DZ_EV_CODE_DRIVER_EV == FSE_AZ_EV_CODE_DRIVER_EV);
|
||||
EFX_STATIC_ASSERT(ESE_DZ_EV_CODE_DRV_GEN_EV ==
|
||||
FSE_AZ_EV_CODE_DRV_GEN_EV);
|
||||
#if EFSYS_OPT_MCDI
|
||||
EFX_STATIC_ASSERT(ESE_DZ_EV_CODE_MCDI_EV ==
|
||||
FSE_AZ_EV_CODE_MCDI_EVRESPONSE);
|
||||
#endif
|
||||
|
||||
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
|
||||
EFSYS_ASSERT(countp != NULL);
|
||||
@ -318,6 +322,12 @@ efx_ev_qpoll(
|
||||
should_abort = eep->ee_drv_gen(eep,
|
||||
&(ev[index]), eecp, arg);
|
||||
break;
|
||||
#if EFSYS_OPT_MCDI
|
||||
case FSE_AZ_EV_CODE_MCDI_EVRESPONSE:
|
||||
should_abort = eep->ee_mcdi(eep,
|
||||
&(ev[index]), eecp, arg);
|
||||
break;
|
||||
#endif
|
||||
case FSE_AZ_EV_CODE_GLOBAL_EV:
|
||||
if (eep->ee_global) {
|
||||
should_abort = eep->ee_global(eep,
|
||||
|
@ -279,6 +279,30 @@ typedef struct efx_filter_s {
|
||||
|
||||
#endif /* EFSYS_OPT_FILTER */
|
||||
|
||||
#if EFSYS_OPT_MCDI
|
||||
|
||||
typedef struct efx_mcdi_ops_s {
|
||||
efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
|
||||
void (*emco_send_request)(efx_nic_t *, void *, size_t,
|
||||
void *, size_t);
|
||||
efx_rc_t (*emco_poll_reboot)(efx_nic_t *);
|
||||
boolean_t (*emco_poll_response)(efx_nic_t *);
|
||||
void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t);
|
||||
void (*emco_fini)(efx_nic_t *);
|
||||
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 *);
|
||||
} efx_mcdi_ops_t;
|
||||
|
||||
typedef struct efx_mcdi_s {
|
||||
const efx_mcdi_ops_t *em_emcop;
|
||||
const efx_mcdi_transport_t *em_emtp;
|
||||
efx_mcdi_iface_t em_emip;
|
||||
} efx_mcdi_t;
|
||||
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
|
||||
typedef struct efx_drv_cfg_s {
|
||||
uint32_t edc_min_vi_count;
|
||||
uint32_t edc_max_vi_count;
|
||||
@ -312,6 +336,9 @@ struct efx_nic_s {
|
||||
efx_filter_t en_filter;
|
||||
const efx_filter_ops_t *en_efop;
|
||||
#endif /* EFSYS_OPT_FILTER */
|
||||
#if EFSYS_OPT_MCDI
|
||||
efx_mcdi_t en_mcdi;
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
uint32_t en_vport_id;
|
||||
union {
|
||||
int enu_unused;
|
||||
@ -341,6 +368,9 @@ struct efx_evq_s {
|
||||
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];
|
||||
|
||||
@ -689,6 +719,23 @@ extern void
|
||||
efx_phy_unprobe(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
#if EFSYS_OPT_MCDI
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_set_workaround(
|
||||
__in efx_nic_t *enp,
|
||||
__in uint32_t type,
|
||||
__in boolean_t enabled,
|
||||
__out_opt uint32_t *flagsp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_get_workarounds(
|
||||
__in efx_nic_t *enp,
|
||||
__out_opt uint32_t *implementedp,
|
||||
__out_opt uint32_t *enabledp);
|
||||
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
1725
drivers/net/sfc/base/efx_mcdi.c
Normal file
1725
drivers/net/sfc/base/efx_mcdi.c
Normal file
File diff suppressed because it is too large
Load Diff
371
drivers/net/sfc/base/efx_mcdi.h
Normal file
371
drivers/net/sfc/base/efx_mcdi.h
Normal file
@ -0,0 +1,371 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2016 Solarflare Communications Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_EFX_MCDI_H
|
||||
#define _SYS_EFX_MCDI_H
|
||||
|
||||
#include "efx.h"
|
||||
#include "efx_regs_mcdi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A reboot/assertion causes the MCDI status word to be set after the
|
||||
* command word is set or a REBOOT event is sent. If we notice a reboot
|
||||
* via these mechanisms then wait 10ms for the status word to be set.
|
||||
*/
|
||||
#define EFX_MCDI_STATUS_SLEEP_US 10000
|
||||
|
||||
struct efx_mcdi_req_s {
|
||||
boolean_t emr_quiet;
|
||||
/* Inputs: Command #, input buffer and length */
|
||||
unsigned int emr_cmd;
|
||||
uint8_t *emr_in_buf;
|
||||
size_t emr_in_length;
|
||||
/* Outputs: retcode, buffer, length, and length used*/
|
||||
efx_rc_t emr_rc;
|
||||
uint8_t *emr_out_buf;
|
||||
size_t emr_out_length;
|
||||
size_t emr_out_length_used;
|
||||
/* Internals: low level transport details */
|
||||
unsigned int emr_err_code;
|
||||
unsigned int emr_err_arg;
|
||||
};
|
||||
|
||||
typedef struct efx_mcdi_iface_s {
|
||||
unsigned int emi_port;
|
||||
unsigned int emi_max_version;
|
||||
unsigned int emi_seq;
|
||||
efx_mcdi_req_t *emi_pending_req;
|
||||
boolean_t emi_ev_cpl;
|
||||
boolean_t emi_new_epoch;
|
||||
int emi_aborted;
|
||||
uint32_t emi_poll_cnt;
|
||||
uint32_t emi_mc_reboot_status;
|
||||
} efx_mcdi_iface_t;
|
||||
|
||||
extern void
|
||||
efx_mcdi_execute(
|
||||
__in efx_nic_t *enp,
|
||||
__inout efx_mcdi_req_t *emrp);
|
||||
|
||||
extern void
|
||||
efx_mcdi_execute_quiet(
|
||||
__in efx_nic_t *enp,
|
||||
__inout efx_mcdi_req_t *emrp);
|
||||
|
||||
extern void
|
||||
efx_mcdi_ev_cpl(
|
||||
__in efx_nic_t *enp,
|
||||
__in unsigned int seq,
|
||||
__in unsigned int outlen,
|
||||
__in int errcode);
|
||||
|
||||
extern void
|
||||
efx_mcdi_ev_death(
|
||||
__in efx_nic_t *enp,
|
||||
__in int rc);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_request_errcode(
|
||||
__in unsigned int err);
|
||||
|
||||
extern void
|
||||
efx_mcdi_raise_exception(
|
||||
__in efx_nic_t *enp,
|
||||
__in_opt efx_mcdi_req_t *emrp,
|
||||
__in int rc);
|
||||
|
||||
typedef enum efx_mcdi_boot_e {
|
||||
EFX_MCDI_BOOT_PRIMARY,
|
||||
EFX_MCDI_BOOT_SECONDARY,
|
||||
EFX_MCDI_BOOT_ROM,
|
||||
} efx_mcdi_boot_t;
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_version(
|
||||
__in efx_nic_t *enp,
|
||||
__out_ecount_opt(4) uint16_t versionp[4],
|
||||
__out_opt uint32_t *buildp,
|
||||
__out_opt efx_mcdi_boot_t *statusp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_read_assertion(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_exit_assertion_handler(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_drv_attach(
|
||||
__in efx_nic_t *enp,
|
||||
__in boolean_t attach);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_get_board_cfg(
|
||||
__in efx_nic_t *enp,
|
||||
__out_opt uint32_t *board_typep,
|
||||
__out_opt efx_dword_t *capabilitiesp,
|
||||
__out_ecount_opt(6) uint8_t mac_addrp[6]);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_get_phy_cfg(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_firmware_update_supported(
|
||||
__in efx_nic_t *enp,
|
||||
__out boolean_t *supportedp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_macaddr_change_supported(
|
||||
__in efx_nic_t *enp,
|
||||
__out boolean_t *supportedp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_link_control_supported(
|
||||
__in efx_nic_t *enp,
|
||||
__out boolean_t *supportedp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_mac_spoofing_supported(
|
||||
__in efx_nic_t *enp,
|
||||
__out boolean_t *supportedp);
|
||||
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_get_resource_limits(
|
||||
__in efx_nic_t *enp,
|
||||
__out_opt uint32_t *nevqp,
|
||||
__out_opt uint32_t *nrxqp,
|
||||
__out_opt uint32_t *ntxqp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_log_ctrl(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_mac_stats_clear(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_mac_stats_upload(
|
||||
__in efx_nic_t *enp,
|
||||
__in efsys_mem_t *esmp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_mac_stats_periodic(
|
||||
__in efx_nic_t *enp,
|
||||
__in efsys_mem_t *esmp,
|
||||
__in uint16_t period,
|
||||
__in boolean_t events);
|
||||
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mcdi_phy_module_get_info(
|
||||
__in efx_nic_t *enp,
|
||||
__in uint8_t dev_addr,
|
||||
__in uint8_t offset,
|
||||
__in uint8_t len,
|
||||
__out_bcount(len) uint8_t *data);
|
||||
|
||||
#define MCDI_IN(_emr, _type, _ofst) \
|
||||
((_type *)((_emr).emr_in_buf + (_ofst)))
|
||||
|
||||
#define MCDI_IN2(_emr, _type, _ofst) \
|
||||
MCDI_IN(_emr, _type, MC_CMD_ ## _ofst ## _OFST)
|
||||
|
||||
#define MCDI_IN_SET_BYTE(_emr, _ofst, _value) \
|
||||
EFX_POPULATE_BYTE_1(*MCDI_IN2(_emr, efx_byte_t, _ofst), \
|
||||
EFX_BYTE_0, _value)
|
||||
|
||||
#define MCDI_IN_SET_WORD(_emr, _ofst, _value) \
|
||||
EFX_POPULATE_WORD_1(*MCDI_IN2(_emr, efx_word_t, _ofst), \
|
||||
EFX_WORD_0, _value)
|
||||
|
||||
#define MCDI_IN_SET_DWORD(_emr, _ofst, _value) \
|
||||
EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
EFX_DWORD_0, _value)
|
||||
|
||||
#define MCDI_IN_SET_DWORD_FIELD(_emr, _ofst, _field, _value) \
|
||||
EFX_SET_DWORD_FIELD(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field, _value)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_1(_emr, _ofst, _field1, _value1) \
|
||||
EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_2(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2) \
|
||||
EFX_POPULATE_DWORD_2(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_3(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3) \
|
||||
EFX_POPULATE_DWORD_3(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_4(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4) \
|
||||
EFX_POPULATE_DWORD_4(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_5(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5) \
|
||||
EFX_POPULATE_DWORD_5(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_6(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5, _field6, _value6) \
|
||||
EFX_POPULATE_DWORD_6(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5, \
|
||||
MC_CMD_ ## _field6, _value6)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_7(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5, _field6, _value6, _field7, _value7) \
|
||||
EFX_POPULATE_DWORD_7(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5, \
|
||||
MC_CMD_ ## _field6, _value6, \
|
||||
MC_CMD_ ## _field7, _value7)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_8(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5, _field6, _value6, _field7, _value7, \
|
||||
_field8, _value8) \
|
||||
EFX_POPULATE_DWORD_8(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5, \
|
||||
MC_CMD_ ## _field6, _value6, \
|
||||
MC_CMD_ ## _field7, _value7, \
|
||||
MC_CMD_ ## _field8, _value8)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_9(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5, _field6, _value6, _field7, _value7, \
|
||||
_field8, _value8, _field9, _value9) \
|
||||
EFX_POPULATE_DWORD_9(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5, \
|
||||
MC_CMD_ ## _field6, _value6, \
|
||||
MC_CMD_ ## _field7, _value7, \
|
||||
MC_CMD_ ## _field8, _value8, \
|
||||
MC_CMD_ ## _field9, _value9)
|
||||
|
||||
#define MCDI_IN_POPULATE_DWORD_10(_emr, _ofst, _field1, _value1, \
|
||||
_field2, _value2, _field3, _value3, _field4, _value4, \
|
||||
_field5, _value5, _field6, _value6, _field7, _value7, \
|
||||
_field8, _value8, _field9, _value9, _field10, _value10) \
|
||||
EFX_POPULATE_DWORD_10(*MCDI_IN2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field1, _value1, \
|
||||
MC_CMD_ ## _field2, _value2, \
|
||||
MC_CMD_ ## _field3, _value3, \
|
||||
MC_CMD_ ## _field4, _value4, \
|
||||
MC_CMD_ ## _field5, _value5, \
|
||||
MC_CMD_ ## _field6, _value6, \
|
||||
MC_CMD_ ## _field7, _value7, \
|
||||
MC_CMD_ ## _field8, _value8, \
|
||||
MC_CMD_ ## _field9, _value9, \
|
||||
MC_CMD_ ## _field10, _value10)
|
||||
|
||||
#define MCDI_OUT(_emr, _type, _ofst) \
|
||||
((_type *)((_emr).emr_out_buf + (_ofst)))
|
||||
|
||||
#define MCDI_OUT2(_emr, _type, _ofst) \
|
||||
MCDI_OUT(_emr, _type, MC_CMD_ ## _ofst ## _OFST)
|
||||
|
||||
#define MCDI_OUT_BYTE(_emr, _ofst) \
|
||||
EFX_BYTE_FIELD(*MCDI_OUT2(_emr, efx_byte_t, _ofst), \
|
||||
EFX_BYTE_0)
|
||||
|
||||
#define MCDI_OUT_WORD(_emr, _ofst) \
|
||||
EFX_WORD_FIELD(*MCDI_OUT2(_emr, efx_word_t, _ofst), \
|
||||
EFX_WORD_0)
|
||||
|
||||
#define MCDI_OUT_DWORD(_emr, _ofst) \
|
||||
EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \
|
||||
EFX_DWORD_0)
|
||||
|
||||
#define MCDI_OUT_DWORD_FIELD(_emr, _ofst, _field) \
|
||||
EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \
|
||||
MC_CMD_ ## _field)
|
||||
|
||||
#define MCDI_EV_FIELD(_eqp, _field) \
|
||||
EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field)
|
||||
|
||||
#define MCDI_CMD_DWORD_FIELD(_edp, _field) \
|
||||
EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field)
|
||||
|
||||
#define EFX_MCDI_HAVE_PRIVILEGE(mask, priv) \
|
||||
(((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) == \
|
||||
(MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv))
|
||||
|
||||
typedef enum efx_mcdi_feature_id_e {
|
||||
EFX_MCDI_FEATURE_FW_UPDATE = 0,
|
||||
EFX_MCDI_FEATURE_LINK_CONTROL,
|
||||
EFX_MCDI_FEATURE_MACADDR_CHANGE,
|
||||
EFX_MCDI_FEATURE_MAC_SPOOFING,
|
||||
EFX_MCDI_FEATURE_NIDS
|
||||
} efx_mcdi_feature_id_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_EFX_MCDI_H */
|
@ -185,6 +185,9 @@ efx_nic_probe(
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
#if EFSYS_OPT_MCDI
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI);
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_PROBE));
|
||||
|
||||
enop = enp->en_enop;
|
||||
@ -364,6 +367,9 @@ efx_nic_unprobe(
|
||||
const efx_nic_ops_t *enop = enp->en_enop;
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
#if EFSYS_OPT_MCDI
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI);
|
||||
#endif /* EFSYS_OPT_MCDI */
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_NIC));
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_INTR));
|
||||
|
Loading…
Reference in New Issue
Block a user