1*49ef7e06SGarrett D'Amore /* 2*49ef7e06SGarrett D'Amore * Copyright (c) 2009-2015 Solarflare Communications Inc. 3*49ef7e06SGarrett D'Amore * All rights reserved. 4*49ef7e06SGarrett D'Amore * 5*49ef7e06SGarrett D'Amore * Redistribution and use in source and binary forms, with or without 6*49ef7e06SGarrett D'Amore * modification, are permitted provided that the following conditions are met: 7*49ef7e06SGarrett D'Amore * 8*49ef7e06SGarrett D'Amore * 1. Redistributions of source code must retain the above copyright notice, 9*49ef7e06SGarrett D'Amore * this list of conditions and the following disclaimer. 10*49ef7e06SGarrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright notice, 11*49ef7e06SGarrett D'Amore * this list of conditions and the following disclaimer in the documentation 12*49ef7e06SGarrett D'Amore * and/or other materials provided with the distribution. 13*49ef7e06SGarrett D'Amore * 14*49ef7e06SGarrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15*49ef7e06SGarrett D'Amore * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16*49ef7e06SGarrett D'Amore * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17*49ef7e06SGarrett D'Amore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 18*49ef7e06SGarrett D'Amore * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19*49ef7e06SGarrett D'Amore * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20*49ef7e06SGarrett D'Amore * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21*49ef7e06SGarrett D'Amore * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22*49ef7e06SGarrett D'Amore * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23*49ef7e06SGarrett D'Amore * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24*49ef7e06SGarrett D'Amore * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25*49ef7e06SGarrett D'Amore * 26*49ef7e06SGarrett D'Amore * The views and conclusions contained in the software and documentation are 27*49ef7e06SGarrett D'Amore * those of the authors and should not be interpreted as representing official 28*49ef7e06SGarrett D'Amore * policies, either expressed or implied, of the FreeBSD Project. 29*49ef7e06SGarrett D'Amore */ 30*49ef7e06SGarrett D'Amore 31*49ef7e06SGarrett D'Amore #ifndef _SYS_EFX_MCDI_H 32*49ef7e06SGarrett D'Amore #define _SYS_EFX_MCDI_H 33*49ef7e06SGarrett D'Amore 34*49ef7e06SGarrett D'Amore #include "efx.h" 35*49ef7e06SGarrett D'Amore #include "efx_regs_mcdi.h" 36*49ef7e06SGarrett D'Amore 37*49ef7e06SGarrett D'Amore #ifdef __cplusplus 38*49ef7e06SGarrett D'Amore extern "C" { 39*49ef7e06SGarrett D'Amore #endif 40*49ef7e06SGarrett D'Amore 41*49ef7e06SGarrett D'Amore /* 42*49ef7e06SGarrett D'Amore * A reboot/assertion causes the MCDI status word to be set after the 43*49ef7e06SGarrett D'Amore * command word is set or a REBOOT event is sent. If we notice a reboot 44*49ef7e06SGarrett D'Amore * via these mechanisms then wait 10ms for the status word to be set. 45*49ef7e06SGarrett D'Amore */ 46*49ef7e06SGarrett D'Amore #define EFX_MCDI_STATUS_SLEEP_US 10000 47*49ef7e06SGarrett D'Amore 48*49ef7e06SGarrett D'Amore struct efx_mcdi_req_s { 49*49ef7e06SGarrett D'Amore boolean_t emr_quiet; 50*49ef7e06SGarrett D'Amore /* Inputs: Command #, input buffer and length */ 51*49ef7e06SGarrett D'Amore unsigned int emr_cmd; 52*49ef7e06SGarrett D'Amore uint8_t *emr_in_buf; 53*49ef7e06SGarrett D'Amore size_t emr_in_length; 54*49ef7e06SGarrett D'Amore /* Outputs: retcode, buffer, length, and length used*/ 55*49ef7e06SGarrett D'Amore efx_rc_t emr_rc; 56*49ef7e06SGarrett D'Amore uint8_t *emr_out_buf; 57*49ef7e06SGarrett D'Amore size_t emr_out_length; 58*49ef7e06SGarrett D'Amore size_t emr_out_length_used; 59*49ef7e06SGarrett D'Amore /* Internals: low level transport details */ 60*49ef7e06SGarrett D'Amore unsigned int emr_err_code; 61*49ef7e06SGarrett D'Amore unsigned int emr_err_arg; 62*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI_PROXY_AUTH 63*49ef7e06SGarrett D'Amore uint32_t emr_proxy_handle; 64*49ef7e06SGarrett D'Amore #endif 65*49ef7e06SGarrett D'Amore }; 66*49ef7e06SGarrett D'Amore 67*49ef7e06SGarrett D'Amore typedef struct efx_mcdi_iface_s { 68*49ef7e06SGarrett D'Amore unsigned int emi_port; 69*49ef7e06SGarrett D'Amore unsigned int emi_max_version; 70*49ef7e06SGarrett D'Amore unsigned int emi_seq; 71*49ef7e06SGarrett D'Amore efx_mcdi_req_t *emi_pending_req; 72*49ef7e06SGarrett D'Amore boolean_t emi_ev_cpl; 73*49ef7e06SGarrett D'Amore boolean_t emi_new_epoch; 74*49ef7e06SGarrett D'Amore int emi_aborted; 75*49ef7e06SGarrett D'Amore uint32_t emi_poll_cnt; 76*49ef7e06SGarrett D'Amore uint32_t emi_mc_reboot_status; 77*49ef7e06SGarrett D'Amore } efx_mcdi_iface_t; 78*49ef7e06SGarrett D'Amore 79*49ef7e06SGarrett D'Amore extern void 80*49ef7e06SGarrett D'Amore efx_mcdi_execute( 81*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 82*49ef7e06SGarrett D'Amore __inout efx_mcdi_req_t *emrp); 83*49ef7e06SGarrett D'Amore 84*49ef7e06SGarrett D'Amore extern void 85*49ef7e06SGarrett D'Amore efx_mcdi_execute_quiet( 86*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 87*49ef7e06SGarrett D'Amore __inout efx_mcdi_req_t *emrp); 88*49ef7e06SGarrett D'Amore 89*49ef7e06SGarrett D'Amore extern void 90*49ef7e06SGarrett D'Amore efx_mcdi_ev_cpl( 91*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 92*49ef7e06SGarrett D'Amore __in unsigned int seq, 93*49ef7e06SGarrett D'Amore __in unsigned int outlen, 94*49ef7e06SGarrett D'Amore __in int errcode); 95*49ef7e06SGarrett D'Amore 96*49ef7e06SGarrett D'Amore #if EFSYS_OPT_MCDI_PROXY_AUTH 97*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 98*49ef7e06SGarrett D'Amore efx_mcdi_get_proxy_handle( 99*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 100*49ef7e06SGarrett D'Amore __in efx_mcdi_req_t *emrp, 101*49ef7e06SGarrett D'Amore __out uint32_t *handlep); 102*49ef7e06SGarrett D'Amore 103*49ef7e06SGarrett D'Amore extern void 104*49ef7e06SGarrett D'Amore efx_mcdi_ev_proxy_response( 105*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 106*49ef7e06SGarrett D'Amore __in unsigned int handle, 107*49ef7e06SGarrett D'Amore __in unsigned int status); 108*49ef7e06SGarrett D'Amore #endif 109*49ef7e06SGarrett D'Amore 110*49ef7e06SGarrett D'Amore extern void 111*49ef7e06SGarrett D'Amore efx_mcdi_ev_death( 112*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 113*49ef7e06SGarrett D'Amore __in int rc); 114*49ef7e06SGarrett D'Amore 115*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 116*49ef7e06SGarrett D'Amore efx_mcdi_request_errcode( 117*49ef7e06SGarrett D'Amore __in unsigned int err); 118*49ef7e06SGarrett D'Amore 119*49ef7e06SGarrett D'Amore extern void 120*49ef7e06SGarrett D'Amore efx_mcdi_raise_exception( 121*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 122*49ef7e06SGarrett D'Amore __in_opt efx_mcdi_req_t *emrp, 123*49ef7e06SGarrett D'Amore __in int rc); 124*49ef7e06SGarrett D'Amore 125*49ef7e06SGarrett D'Amore typedef enum efx_mcdi_boot_e { 126*49ef7e06SGarrett D'Amore EFX_MCDI_BOOT_PRIMARY, 127*49ef7e06SGarrett D'Amore EFX_MCDI_BOOT_SECONDARY, 128*49ef7e06SGarrett D'Amore EFX_MCDI_BOOT_ROM, 129*49ef7e06SGarrett D'Amore } efx_mcdi_boot_t; 130*49ef7e06SGarrett D'Amore 131*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 132*49ef7e06SGarrett D'Amore efx_mcdi_version( 133*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 134*49ef7e06SGarrett D'Amore __out_ecount_opt(4) uint16_t versionp[4], 135*49ef7e06SGarrett D'Amore __out_opt uint32_t *buildp, 136*49ef7e06SGarrett D'Amore __out_opt efx_mcdi_boot_t *statusp); 137*49ef7e06SGarrett D'Amore 138*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 139*49ef7e06SGarrett D'Amore efx_mcdi_read_assertion( 140*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 141*49ef7e06SGarrett D'Amore 142*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 143*49ef7e06SGarrett D'Amore efx_mcdi_exit_assertion_handler( 144*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 145*49ef7e06SGarrett D'Amore 146*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 147*49ef7e06SGarrett D'Amore efx_mcdi_drv_attach( 148*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 149*49ef7e06SGarrett D'Amore __in boolean_t attach); 150*49ef7e06SGarrett D'Amore 151*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 152*49ef7e06SGarrett D'Amore efx_mcdi_get_board_cfg( 153*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 154*49ef7e06SGarrett D'Amore __out_opt uint32_t *board_typep, 155*49ef7e06SGarrett D'Amore __out_opt efx_dword_t *capabilitiesp, 156*49ef7e06SGarrett D'Amore __out_ecount_opt(6) uint8_t mac_addrp[6]); 157*49ef7e06SGarrett D'Amore 158*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 159*49ef7e06SGarrett D'Amore efx_mcdi_get_phy_cfg( 160*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 161*49ef7e06SGarrett D'Amore 162*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 163*49ef7e06SGarrett D'Amore efx_mcdi_firmware_update_supported( 164*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 165*49ef7e06SGarrett D'Amore __out boolean_t *supportedp); 166*49ef7e06SGarrett D'Amore 167*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 168*49ef7e06SGarrett D'Amore efx_mcdi_macaddr_change_supported( 169*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 170*49ef7e06SGarrett D'Amore __out boolean_t *supportedp); 171*49ef7e06SGarrett D'Amore 172*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 173*49ef7e06SGarrett D'Amore efx_mcdi_link_control_supported( 174*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 175*49ef7e06SGarrett D'Amore __out boolean_t *supportedp); 176*49ef7e06SGarrett D'Amore 177*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 178*49ef7e06SGarrett D'Amore efx_mcdi_mac_spoofing_supported( 179*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 180*49ef7e06SGarrett D'Amore __out boolean_t *supportedp); 181*49ef7e06SGarrett D'Amore 182*49ef7e06SGarrett D'Amore 183*49ef7e06SGarrett D'Amore #if EFSYS_OPT_BIST 184*49ef7e06SGarrett D'Amore #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD 185*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 186*49ef7e06SGarrett D'Amore efx_mcdi_bist_enable_offline( 187*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 188*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ 189*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 190*49ef7e06SGarrett D'Amore efx_mcdi_bist_start( 191*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 192*49ef7e06SGarrett D'Amore __in efx_bist_type_t type); 193*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_BIST */ 194*49ef7e06SGarrett D'Amore 195*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 196*49ef7e06SGarrett D'Amore efx_mcdi_get_resource_limits( 197*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 198*49ef7e06SGarrett D'Amore __out_opt uint32_t *nevqp, 199*49ef7e06SGarrett D'Amore __out_opt uint32_t *nrxqp, 200*49ef7e06SGarrett D'Amore __out_opt uint32_t *ntxqp); 201*49ef7e06SGarrett D'Amore 202*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 203*49ef7e06SGarrett D'Amore efx_mcdi_log_ctrl( 204*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 205*49ef7e06SGarrett D'Amore 206*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 207*49ef7e06SGarrett D'Amore efx_mcdi_mac_stats_clear( 208*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 209*49ef7e06SGarrett D'Amore 210*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 211*49ef7e06SGarrett D'Amore efx_mcdi_mac_stats_upload( 212*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 213*49ef7e06SGarrett D'Amore __in efsys_mem_t *esmp); 214*49ef7e06SGarrett D'Amore 215*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 216*49ef7e06SGarrett D'Amore efx_mcdi_mac_stats_periodic( 217*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 218*49ef7e06SGarrett D'Amore __in efsys_mem_t *esmp, 219*49ef7e06SGarrett D'Amore __in uint16_t period, 220*49ef7e06SGarrett D'Amore __in boolean_t events); 221*49ef7e06SGarrett D'Amore 222*49ef7e06SGarrett D'Amore 223*49ef7e06SGarrett D'Amore #if EFSYS_OPT_LOOPBACK 224*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 225*49ef7e06SGarrett D'Amore efx_mcdi_get_loopback_modes( 226*49ef7e06SGarrett D'Amore __in efx_nic_t *enp); 227*49ef7e06SGarrett D'Amore #endif /* EFSYS_OPT_LOOPBACK */ 228*49ef7e06SGarrett D'Amore 229*49ef7e06SGarrett D'Amore extern __checkReturn efx_rc_t 230*49ef7e06SGarrett D'Amore efx_mcdi_phy_module_get_info( 231*49ef7e06SGarrett D'Amore __in efx_nic_t *enp, 232*49ef7e06SGarrett D'Amore __in uint8_t dev_addr, 233*49ef7e06SGarrett D'Amore __in uint8_t offset, 234*49ef7e06SGarrett D'Amore __in uint8_t len, 235*49ef7e06SGarrett D'Amore __out_bcount(len) uint8_t *data); 236*49ef7e06SGarrett D'Amore 237*49ef7e06SGarrett D'Amore #define MCDI_IN(_emr, _type, _ofst) \ 238*49ef7e06SGarrett D'Amore ((_type *)((_emr).emr_in_buf + (_ofst))) 239*49ef7e06SGarrett D'Amore 240*49ef7e06SGarrett D'Amore #define MCDI_IN2(_emr, _type, _ofst) \ 241*49ef7e06SGarrett D'Amore MCDI_IN(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 242*49ef7e06SGarrett D'Amore 243*49ef7e06SGarrett D'Amore #define MCDI_IN_SET_BYTE(_emr, _ofst, _value) \ 244*49ef7e06SGarrett D'Amore EFX_POPULATE_BYTE_1(*MCDI_IN2(_emr, efx_byte_t, _ofst), \ 245*49ef7e06SGarrett D'Amore EFX_BYTE_0, _value) 246*49ef7e06SGarrett D'Amore 247*49ef7e06SGarrett D'Amore #define MCDI_IN_SET_WORD(_emr, _ofst, _value) \ 248*49ef7e06SGarrett D'Amore EFX_POPULATE_WORD_1(*MCDI_IN2(_emr, efx_word_t, _ofst), \ 249*49ef7e06SGarrett D'Amore EFX_WORD_0, _value) 250*49ef7e06SGarrett D'Amore 251*49ef7e06SGarrett D'Amore #define MCDI_IN_SET_DWORD(_emr, _ofst, _value) \ 252*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 253*49ef7e06SGarrett D'Amore EFX_DWORD_0, _value) 254*49ef7e06SGarrett D'Amore 255*49ef7e06SGarrett D'Amore #define MCDI_IN_SET_DWORD_FIELD(_emr, _ofst, _field, _value) \ 256*49ef7e06SGarrett D'Amore EFX_SET_DWORD_FIELD(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 257*49ef7e06SGarrett D'Amore MC_CMD_ ## _field, _value) 258*49ef7e06SGarrett D'Amore 259*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_1(_emr, _ofst, _field1, _value1) \ 260*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 261*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1) 262*49ef7e06SGarrett D'Amore 263*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_2(_emr, _ofst, _field1, _value1, \ 264*49ef7e06SGarrett D'Amore _field2, _value2) \ 265*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_2(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 266*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 267*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2) 268*49ef7e06SGarrett D'Amore 269*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_3(_emr, _ofst, _field1, _value1, \ 270*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3) \ 271*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_3(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 272*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 273*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 274*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3) 275*49ef7e06SGarrett D'Amore 276*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_4(_emr, _ofst, _field1, _value1, \ 277*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4) \ 278*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_4(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 279*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 280*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 281*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 282*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4) 283*49ef7e06SGarrett D'Amore 284*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_5(_emr, _ofst, _field1, _value1, \ 285*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 286*49ef7e06SGarrett D'Amore _field5, _value5) \ 287*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_5(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 288*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 289*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 290*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 291*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 292*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5) 293*49ef7e06SGarrett D'Amore 294*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_6(_emr, _ofst, _field1, _value1, \ 295*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 296*49ef7e06SGarrett D'Amore _field5, _value5, _field6, _value6) \ 297*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_6(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 298*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 299*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 300*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 301*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 302*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5, \ 303*49ef7e06SGarrett D'Amore MC_CMD_ ## _field6, _value6) 304*49ef7e06SGarrett D'Amore 305*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_7(_emr, _ofst, _field1, _value1, \ 306*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 307*49ef7e06SGarrett D'Amore _field5, _value5, _field6, _value6, _field7, _value7) \ 308*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_7(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 309*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 310*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 311*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 312*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 313*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5, \ 314*49ef7e06SGarrett D'Amore MC_CMD_ ## _field6, _value6, \ 315*49ef7e06SGarrett D'Amore MC_CMD_ ## _field7, _value7) 316*49ef7e06SGarrett D'Amore 317*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_8(_emr, _ofst, _field1, _value1, \ 318*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 319*49ef7e06SGarrett D'Amore _field5, _value5, _field6, _value6, _field7, _value7, \ 320*49ef7e06SGarrett D'Amore _field8, _value8) \ 321*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_8(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 322*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 323*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 324*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 325*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 326*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5, \ 327*49ef7e06SGarrett D'Amore MC_CMD_ ## _field6, _value6, \ 328*49ef7e06SGarrett D'Amore MC_CMD_ ## _field7, _value7, \ 329*49ef7e06SGarrett D'Amore MC_CMD_ ## _field8, _value8) 330*49ef7e06SGarrett D'Amore 331*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_9(_emr, _ofst, _field1, _value1, \ 332*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 333*49ef7e06SGarrett D'Amore _field5, _value5, _field6, _value6, _field7, _value7, \ 334*49ef7e06SGarrett D'Amore _field8, _value8, _field9, _value9) \ 335*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_9(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 336*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 337*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 338*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 339*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 340*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5, \ 341*49ef7e06SGarrett D'Amore MC_CMD_ ## _field6, _value6, \ 342*49ef7e06SGarrett D'Amore MC_CMD_ ## _field7, _value7, \ 343*49ef7e06SGarrett D'Amore MC_CMD_ ## _field8, _value8, \ 344*49ef7e06SGarrett D'Amore MC_CMD_ ## _field9, _value9) 345*49ef7e06SGarrett D'Amore 346*49ef7e06SGarrett D'Amore #define MCDI_IN_POPULATE_DWORD_10(_emr, _ofst, _field1, _value1, \ 347*49ef7e06SGarrett D'Amore _field2, _value2, _field3, _value3, _field4, _value4, \ 348*49ef7e06SGarrett D'Amore _field5, _value5, _field6, _value6, _field7, _value7, \ 349*49ef7e06SGarrett D'Amore _field8, _value8, _field9, _value9, _field10, _value10) \ 350*49ef7e06SGarrett D'Amore EFX_POPULATE_DWORD_10(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 351*49ef7e06SGarrett D'Amore MC_CMD_ ## _field1, _value1, \ 352*49ef7e06SGarrett D'Amore MC_CMD_ ## _field2, _value2, \ 353*49ef7e06SGarrett D'Amore MC_CMD_ ## _field3, _value3, \ 354*49ef7e06SGarrett D'Amore MC_CMD_ ## _field4, _value4, \ 355*49ef7e06SGarrett D'Amore MC_CMD_ ## _field5, _value5, \ 356*49ef7e06SGarrett D'Amore MC_CMD_ ## _field6, _value6, \ 357*49ef7e06SGarrett D'Amore MC_CMD_ ## _field7, _value7, \ 358*49ef7e06SGarrett D'Amore MC_CMD_ ## _field8, _value8, \ 359*49ef7e06SGarrett D'Amore MC_CMD_ ## _field9, _value9, \ 360*49ef7e06SGarrett D'Amore MC_CMD_ ## _field10, _value10) 361*49ef7e06SGarrett D'Amore 362*49ef7e06SGarrett D'Amore #define MCDI_OUT(_emr, _type, _ofst) \ 363*49ef7e06SGarrett D'Amore ((_type *)((_emr).emr_out_buf + (_ofst))) 364*49ef7e06SGarrett D'Amore 365*49ef7e06SGarrett D'Amore #define MCDI_OUT2(_emr, _type, _ofst) \ 366*49ef7e06SGarrett D'Amore MCDI_OUT(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 367*49ef7e06SGarrett D'Amore 368*49ef7e06SGarrett D'Amore #define MCDI_OUT_BYTE(_emr, _ofst) \ 369*49ef7e06SGarrett D'Amore EFX_BYTE_FIELD(*MCDI_OUT2(_emr, efx_byte_t, _ofst), \ 370*49ef7e06SGarrett D'Amore EFX_BYTE_0) 371*49ef7e06SGarrett D'Amore 372*49ef7e06SGarrett D'Amore #define MCDI_OUT_WORD(_emr, _ofst) \ 373*49ef7e06SGarrett D'Amore EFX_WORD_FIELD(*MCDI_OUT2(_emr, efx_word_t, _ofst), \ 374*49ef7e06SGarrett D'Amore EFX_WORD_0) 375*49ef7e06SGarrett D'Amore 376*49ef7e06SGarrett D'Amore #define MCDI_OUT_DWORD(_emr, _ofst) \ 377*49ef7e06SGarrett D'Amore EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 378*49ef7e06SGarrett D'Amore EFX_DWORD_0) 379*49ef7e06SGarrett D'Amore 380*49ef7e06SGarrett D'Amore #define MCDI_OUT_DWORD_FIELD(_emr, _ofst, _field) \ 381*49ef7e06SGarrett D'Amore EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 382*49ef7e06SGarrett D'Amore MC_CMD_ ## _field) 383*49ef7e06SGarrett D'Amore 384*49ef7e06SGarrett D'Amore #define MCDI_EV_FIELD(_eqp, _field) \ 385*49ef7e06SGarrett D'Amore EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field) 386*49ef7e06SGarrett D'Amore 387*49ef7e06SGarrett D'Amore #define MCDI_CMD_DWORD_FIELD(_edp, _field) \ 388*49ef7e06SGarrett D'Amore EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field) 389*49ef7e06SGarrett D'Amore 390*49ef7e06SGarrett D'Amore #define EFX_MCDI_HAVE_PRIVILEGE(mask, priv) \ 391*49ef7e06SGarrett D'Amore (((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) == \ 392*49ef7e06SGarrett D'Amore (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) 393*49ef7e06SGarrett D'Amore 394*49ef7e06SGarrett D'Amore typedef enum efx_mcdi_feature_id_e { 395*49ef7e06SGarrett D'Amore EFX_MCDI_FEATURE_FW_UPDATE = 0, 396*49ef7e06SGarrett D'Amore EFX_MCDI_FEATURE_LINK_CONTROL, 397*49ef7e06SGarrett D'Amore EFX_MCDI_FEATURE_MACADDR_CHANGE, 398*49ef7e06SGarrett D'Amore EFX_MCDI_FEATURE_MAC_SPOOFING, 399*49ef7e06SGarrett D'Amore EFX_MCDI_FEATURE_NIDS 400*49ef7e06SGarrett D'Amore } efx_mcdi_feature_id_t; 401*49ef7e06SGarrett D'Amore 402*49ef7e06SGarrett D'Amore #ifdef __cplusplus 403*49ef7e06SGarrett D'Amore } 404*49ef7e06SGarrett D'Amore #endif 405*49ef7e06SGarrett D'Amore 406*49ef7e06SGarrett D'Amore #endif /* _SYS_EFX_MCDI_H */ 407