31 */ 32 33#ifndef _SYS_EFX_MCDI_H 34#define _SYS_EFX_MCDI_H 35 36#include "efx.h" 37#include "efx_regs.h" 38#include "efx_regs_mcdi.h" 39 40#ifdef __cplusplus 41extern "C" { 42#endif 43 44/* 45 * A reboot/assertion causes the MCDI status word to be set after the 46 * command word is set or a REBOOT event is sent. If we notice a reboot 47 * via these mechanisms then wait 10ms for the status word to be set. 48 */ 49#define EFX_MCDI_STATUS_SLEEP_US 10000 50 51struct efx_mcdi_req_s { 52 boolean_t emr_quiet; 53 /* Inputs: Command #, input buffer and length */ 54 unsigned int emr_cmd; 55 uint8_t *emr_in_buf; 56 size_t emr_in_length; 57 /* Outputs: retcode, buffer, length, and length used*/ 58 int emr_rc; 59 uint8_t *emr_out_buf; 60 size_t emr_out_length; 61 size_t emr_out_length_used; 62 /* Internals: low level transport details */ 63 unsigned int emr_err_code; 64 unsigned int emr_err_arg; 65#if EFSYS_OPT_MCDI_PROXY_AUTH 66 uint32_t emr_proxy_handle; 67#endif 68}; 69 70typedef struct efx_mcdi_iface_s { 71 unsigned int emi_port; 72 unsigned int emi_seq; 73 efx_mcdi_req_t *emi_pending_req; 74 boolean_t emi_ev_cpl; 75 boolean_t emi_new_epoch; 76 int emi_aborted; 77 uint32_t emi_poll_cnt; 78 uint32_t emi_mc_reboot_status; 79} efx_mcdi_iface_t; 80 81extern void 82efx_mcdi_execute( 83 __in efx_nic_t *enp, 84 __inout efx_mcdi_req_t *emrp); 85 86extern void 87efx_mcdi_execute_quiet( 88 __in efx_nic_t *enp, 89 __inout efx_mcdi_req_t *emrp); 90 91 extern void 92efx_mcdi_read_response_header( 93 __in efx_nic_t *enp, 94 __inout efx_mcdi_req_t *emrp); 95 96extern void 97efx_mcdi_ev_cpl( 98 __in efx_nic_t *enp, 99 __in unsigned int seq, 100 __in unsigned int outlen, 101 __in int errcode); 102 103#if EFSYS_OPT_MCDI_PROXY_AUTH 104extern __checkReturn efx_rc_t 105efx_mcdi_get_proxy_handle( 106 __in efx_nic_t *enp, 107 __in efx_mcdi_req_t *emrp, 108 __out uint32_t *handlep); 109 110extern void 111efx_mcdi_ev_proxy_response( 112 __in efx_nic_t *enp, 113 __in unsigned int handle, 114 __in unsigned int status); 115#endif 116 117extern void 118efx_mcdi_ev_death( 119 __in efx_nic_t *enp, 120 __in int rc); 121 122extern __checkReturn efx_rc_t 123efx_mcdi_request_errcode( 124 __in unsigned int err); 125 126extern void 127efx_mcdi_raise_exception( 128 __in efx_nic_t *enp, 129 __in_opt efx_mcdi_req_t *emrp, 130 __in int rc); 131 132typedef enum efx_mcdi_boot_e { 133 EFX_MCDI_BOOT_PRIMARY, 134 EFX_MCDI_BOOT_SECONDARY, 135 EFX_MCDI_BOOT_ROM, 136} efx_mcdi_boot_t; 137 138extern __checkReturn efx_rc_t 139efx_mcdi_version( 140 __in efx_nic_t *enp, 141 __out_ecount_opt(4) uint16_t versionp[4], 142 __out_opt uint32_t *buildp, 143 __out_opt efx_mcdi_boot_t *statusp); 144 145extern __checkReturn efx_rc_t 146efx_mcdi_read_assertion( 147 __in efx_nic_t *enp); 148 149extern __checkReturn efx_rc_t 150efx_mcdi_exit_assertion_handler( 151 __in efx_nic_t *enp); 152 153extern __checkReturn efx_rc_t 154efx_mcdi_drv_attach( 155 __in efx_nic_t *enp, 156 __in boolean_t attach); 157 158extern __checkReturn efx_rc_t 159efx_mcdi_get_board_cfg( 160 __in efx_nic_t *enp, 161 __out_opt uint32_t *board_typep, 162 __out_opt efx_dword_t *capabilitiesp, 163 __out_ecount_opt(6) uint8_t mac_addrp[6]); 164 165extern __checkReturn efx_rc_t 166efx_mcdi_get_phy_cfg( 167 __in efx_nic_t *enp); 168 169extern __checkReturn efx_rc_t 170efx_mcdi_firmware_update_supported( 171 __in efx_nic_t *enp, 172 __out boolean_t *supportedp); 173 174extern __checkReturn efx_rc_t 175efx_mcdi_macaddr_change_supported( 176 __in efx_nic_t *enp, 177 __out boolean_t *supportedp); 178 179extern __checkReturn efx_rc_t 180efx_mcdi_link_control_supported( 181 __in efx_nic_t *enp, 182 __out boolean_t *supportedp); 183 184extern __checkReturn efx_rc_t 185efx_mcdi_mac_spoofing_supported( 186 __in efx_nic_t *enp, 187 __out boolean_t *supportedp); 188 189 190#if EFSYS_OPT_BIST 191#if EFSYS_OPT_HUNTINGTON 192extern __checkReturn efx_rc_t 193efx_mcdi_bist_enable_offline( 194 __in efx_nic_t *enp); 195#endif /* EFSYS_OPT_HUNTINGTON */ 196extern __checkReturn efx_rc_t 197efx_mcdi_bist_start( 198 __in efx_nic_t *enp, 199 __in efx_bist_type_t type); 200#endif /* EFSYS_OPT_BIST */ 201 202extern __checkReturn efx_rc_t 203efx_mcdi_get_resource_limits( 204 __in efx_nic_t *enp, 205 __out_opt uint32_t *nevqp, 206 __out_opt uint32_t *nrxqp, 207 __out_opt uint32_t *ntxqp); 208 209extern __checkReturn efx_rc_t 210efx_mcdi_log_ctrl( 211 __in efx_nic_t *enp); 212 213extern __checkReturn efx_rc_t 214efx_mcdi_mac_stats_clear( 215 __in efx_nic_t *enp); 216 217extern __checkReturn efx_rc_t 218efx_mcdi_mac_stats_upload( 219 __in efx_nic_t *enp, 220 __in efsys_mem_t *esmp); 221 222extern __checkReturn efx_rc_t 223efx_mcdi_mac_stats_periodic( 224 __in efx_nic_t *enp, 225 __in efsys_mem_t *esmp, 226 __in uint16_t period, 227 __in boolean_t events); 228 229 230#if EFSYS_OPT_LOOPBACK 231extern __checkReturn efx_rc_t 232efx_mcdi_get_loopback_modes( 233 __in efx_nic_t *enp); 234#endif /* EFSYS_OPT_LOOPBACK */ 235 236#define MCDI_IN(_emr, _type, _ofst) \ 237 ((_type *)((_emr).emr_in_buf + (_ofst))) 238 239#define MCDI_IN2(_emr, _type, _ofst) \ 240 MCDI_IN(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 241 242#define MCDI_IN_SET_BYTE(_emr, _ofst, _value) \ 243 EFX_POPULATE_BYTE_1(*MCDI_IN2(_emr, efx_byte_t, _ofst), \ 244 EFX_BYTE_0, _value) 245 246#define MCDI_IN_SET_WORD(_emr, _ofst, _value) \ 247 EFX_POPULATE_WORD_1(*MCDI_IN2(_emr, efx_word_t, _ofst), \ 248 EFX_WORD_0, _value) 249 250#define MCDI_IN_SET_DWORD(_emr, _ofst, _value) \ 251 EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 252 EFX_DWORD_0, _value) 253 254#define MCDI_IN_SET_DWORD_FIELD(_emr, _ofst, _field, _value) \ 255 EFX_SET_DWORD_FIELD(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 256 MC_CMD_ ## _field, _value) 257 258#define MCDI_IN_POPULATE_DWORD_1(_emr, _ofst, _field1, _value1) \ 259 EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 260 MC_CMD_ ## _field1, _value1) 261 262#define MCDI_IN_POPULATE_DWORD_2(_emr, _ofst, _field1, _value1, \ 263 _field2, _value2) \ 264 EFX_POPULATE_DWORD_2(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 265 MC_CMD_ ## _field1, _value1, \ 266 MC_CMD_ ## _field2, _value2) 267 268#define MCDI_IN_POPULATE_DWORD_3(_emr, _ofst, _field1, _value1, \ 269 _field2, _value2, _field3, _value3) \ 270 EFX_POPULATE_DWORD_3(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 271 MC_CMD_ ## _field1, _value1, \ 272 MC_CMD_ ## _field2, _value2, \ 273 MC_CMD_ ## _field3, _value3) 274 275#define MCDI_IN_POPULATE_DWORD_4(_emr, _ofst, _field1, _value1, \ 276 _field2, _value2, _field3, _value3, _field4, _value4) \ 277 EFX_POPULATE_DWORD_4(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 278 MC_CMD_ ## _field1, _value1, \ 279 MC_CMD_ ## _field2, _value2, \ 280 MC_CMD_ ## _field3, _value3, \ 281 MC_CMD_ ## _field4, _value4) 282 283#define MCDI_IN_POPULATE_DWORD_5(_emr, _ofst, _field1, _value1, \ 284 _field2, _value2, _field3, _value3, _field4, _value4, \ 285 _field5, _value5) \ 286 EFX_POPULATE_DWORD_5(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 287 MC_CMD_ ## _field1, _value1, \ 288 MC_CMD_ ## _field2, _value2, \ 289 MC_CMD_ ## _field3, _value3, \ 290 MC_CMD_ ## _field4, _value4, \ 291 MC_CMD_ ## _field5, _value5) 292 293#define MCDI_IN_POPULATE_DWORD_6(_emr, _ofst, _field1, _value1, \ 294 _field2, _value2, _field3, _value3, _field4, _value4, \ 295 _field5, _value5, _field6, _value6) \ 296 EFX_POPULATE_DWORD_6(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 297 MC_CMD_ ## _field1, _value1, \ 298 MC_CMD_ ## _field2, _value2, \ 299 MC_CMD_ ## _field3, _value3, \ 300 MC_CMD_ ## _field4, _value4, \ 301 MC_CMD_ ## _field5, _value5, \ 302 MC_CMD_ ## _field6, _value6) 303 304#define MCDI_IN_POPULATE_DWORD_7(_emr, _ofst, _field1, _value1, \ 305 _field2, _value2, _field3, _value3, _field4, _value4, \ 306 _field5, _value5, _field6, _value6, _field7, _value7) \ 307 EFX_POPULATE_DWORD_7(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 308 MC_CMD_ ## _field1, _value1, \ 309 MC_CMD_ ## _field2, _value2, \ 310 MC_CMD_ ## _field3, _value3, \ 311 MC_CMD_ ## _field4, _value4, \ 312 MC_CMD_ ## _field5, _value5, \ 313 MC_CMD_ ## _field6, _value6, \ 314 MC_CMD_ ## _field7, _value7) 315 316#define MCDI_IN_POPULATE_DWORD_8(_emr, _ofst, _field1, _value1, \ 317 _field2, _value2, _field3, _value3, _field4, _value4, \ 318 _field5, _value5, _field6, _value6, _field7, _value7, \ 319 _field8, _value8) \ 320 EFX_POPULATE_DWORD_8(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 321 MC_CMD_ ## _field1, _value1, \ 322 MC_CMD_ ## _field2, _value2, \ 323 MC_CMD_ ## _field3, _value3, \ 324 MC_CMD_ ## _field4, _value4, \ 325 MC_CMD_ ## _field5, _value5, \ 326 MC_CMD_ ## _field6, _value6, \ 327 MC_CMD_ ## _field7, _value7, \ 328 MC_CMD_ ## _field8, _value8) 329 330#define MCDI_IN_POPULATE_DWORD_9(_emr, _ofst, _field1, _value1, \ 331 _field2, _value2, _field3, _value3, _field4, _value4, \ 332 _field5, _value5, _field6, _value6, _field7, _value7, \ 333 _field8, _value8, _field9, _value9) \ 334 EFX_POPULATE_DWORD_9(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 335 MC_CMD_ ## _field1, _value1, \ 336 MC_CMD_ ## _field2, _value2, \ 337 MC_CMD_ ## _field3, _value3, \ 338 MC_CMD_ ## _field4, _value4, \ 339 MC_CMD_ ## _field5, _value5, \ 340 MC_CMD_ ## _field6, _value6, \ 341 MC_CMD_ ## _field7, _value7, \ 342 MC_CMD_ ## _field8, _value8, \ 343 MC_CMD_ ## _field9, _value9) 344 345#define MCDI_IN_POPULATE_DWORD_10(_emr, _ofst, _field1, _value1, \ 346 _field2, _value2, _field3, _value3, _field4, _value4, \ 347 _field5, _value5, _field6, _value6, _field7, _value7, \ 348 _field8, _value8, _field9, _value9, _field10, _value10) \ 349 EFX_POPULATE_DWORD_10(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 350 MC_CMD_ ## _field1, _value1, \ 351 MC_CMD_ ## _field2, _value2, \ 352 MC_CMD_ ## _field3, _value3, \ 353 MC_CMD_ ## _field4, _value4, \ 354 MC_CMD_ ## _field5, _value5, \ 355 MC_CMD_ ## _field6, _value6, \ 356 MC_CMD_ ## _field7, _value7, \ 357 MC_CMD_ ## _field8, _value8, \ 358 MC_CMD_ ## _field9, _value9, \ 359 MC_CMD_ ## _field10, _value10) 360 361#define MCDI_OUT(_emr, _type, _ofst) \ 362 ((_type *)((_emr).emr_out_buf + (_ofst))) 363 364#define MCDI_OUT2(_emr, _type, _ofst) \ 365 MCDI_OUT(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 366 367#define MCDI_OUT_BYTE(_emr, _ofst) \ 368 EFX_BYTE_FIELD(*MCDI_OUT2(_emr, efx_byte_t, _ofst), \ 369 EFX_BYTE_0) 370 371#define MCDI_OUT_WORD(_emr, _ofst) \ 372 EFX_WORD_FIELD(*MCDI_OUT2(_emr, efx_word_t, _ofst), \ 373 EFX_WORD_0) 374 375#define MCDI_OUT_DWORD(_emr, _ofst) \ 376 EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 377 EFX_DWORD_0) 378 379#define MCDI_OUT_DWORD_FIELD(_emr, _ofst, _field) \ 380 EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 381 MC_CMD_ ## _field) 382 383#define MCDI_EV_FIELD(_eqp, _field) \ 384 EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field) 385 386#define MCDI_CMD_DWORD_FIELD(_edp, _field) \ 387 EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field) 388
| 31 */ 32 33#ifndef _SYS_EFX_MCDI_H 34#define _SYS_EFX_MCDI_H 35 36#include "efx.h" 37#include "efx_regs.h" 38#include "efx_regs_mcdi.h" 39 40#ifdef __cplusplus 41extern "C" { 42#endif 43 44/* 45 * A reboot/assertion causes the MCDI status word to be set after the 46 * command word is set or a REBOOT event is sent. If we notice a reboot 47 * via these mechanisms then wait 10ms for the status word to be set. 48 */ 49#define EFX_MCDI_STATUS_SLEEP_US 10000 50 51struct efx_mcdi_req_s { 52 boolean_t emr_quiet; 53 /* Inputs: Command #, input buffer and length */ 54 unsigned int emr_cmd; 55 uint8_t *emr_in_buf; 56 size_t emr_in_length; 57 /* Outputs: retcode, buffer, length, and length used*/ 58 int emr_rc; 59 uint8_t *emr_out_buf; 60 size_t emr_out_length; 61 size_t emr_out_length_used; 62 /* Internals: low level transport details */ 63 unsigned int emr_err_code; 64 unsigned int emr_err_arg; 65#if EFSYS_OPT_MCDI_PROXY_AUTH 66 uint32_t emr_proxy_handle; 67#endif 68}; 69 70typedef struct efx_mcdi_iface_s { 71 unsigned int emi_port; 72 unsigned int emi_seq; 73 efx_mcdi_req_t *emi_pending_req; 74 boolean_t emi_ev_cpl; 75 boolean_t emi_new_epoch; 76 int emi_aborted; 77 uint32_t emi_poll_cnt; 78 uint32_t emi_mc_reboot_status; 79} efx_mcdi_iface_t; 80 81extern void 82efx_mcdi_execute( 83 __in efx_nic_t *enp, 84 __inout efx_mcdi_req_t *emrp); 85 86extern void 87efx_mcdi_execute_quiet( 88 __in efx_nic_t *enp, 89 __inout efx_mcdi_req_t *emrp); 90 91 extern void 92efx_mcdi_read_response_header( 93 __in efx_nic_t *enp, 94 __inout efx_mcdi_req_t *emrp); 95 96extern void 97efx_mcdi_ev_cpl( 98 __in efx_nic_t *enp, 99 __in unsigned int seq, 100 __in unsigned int outlen, 101 __in int errcode); 102 103#if EFSYS_OPT_MCDI_PROXY_AUTH 104extern __checkReturn efx_rc_t 105efx_mcdi_get_proxy_handle( 106 __in efx_nic_t *enp, 107 __in efx_mcdi_req_t *emrp, 108 __out uint32_t *handlep); 109 110extern void 111efx_mcdi_ev_proxy_response( 112 __in efx_nic_t *enp, 113 __in unsigned int handle, 114 __in unsigned int status); 115#endif 116 117extern void 118efx_mcdi_ev_death( 119 __in efx_nic_t *enp, 120 __in int rc); 121 122extern __checkReturn efx_rc_t 123efx_mcdi_request_errcode( 124 __in unsigned int err); 125 126extern void 127efx_mcdi_raise_exception( 128 __in efx_nic_t *enp, 129 __in_opt efx_mcdi_req_t *emrp, 130 __in int rc); 131 132typedef enum efx_mcdi_boot_e { 133 EFX_MCDI_BOOT_PRIMARY, 134 EFX_MCDI_BOOT_SECONDARY, 135 EFX_MCDI_BOOT_ROM, 136} efx_mcdi_boot_t; 137 138extern __checkReturn efx_rc_t 139efx_mcdi_version( 140 __in efx_nic_t *enp, 141 __out_ecount_opt(4) uint16_t versionp[4], 142 __out_opt uint32_t *buildp, 143 __out_opt efx_mcdi_boot_t *statusp); 144 145extern __checkReturn efx_rc_t 146efx_mcdi_read_assertion( 147 __in efx_nic_t *enp); 148 149extern __checkReturn efx_rc_t 150efx_mcdi_exit_assertion_handler( 151 __in efx_nic_t *enp); 152 153extern __checkReturn efx_rc_t 154efx_mcdi_drv_attach( 155 __in efx_nic_t *enp, 156 __in boolean_t attach); 157 158extern __checkReturn efx_rc_t 159efx_mcdi_get_board_cfg( 160 __in efx_nic_t *enp, 161 __out_opt uint32_t *board_typep, 162 __out_opt efx_dword_t *capabilitiesp, 163 __out_ecount_opt(6) uint8_t mac_addrp[6]); 164 165extern __checkReturn efx_rc_t 166efx_mcdi_get_phy_cfg( 167 __in efx_nic_t *enp); 168 169extern __checkReturn efx_rc_t 170efx_mcdi_firmware_update_supported( 171 __in efx_nic_t *enp, 172 __out boolean_t *supportedp); 173 174extern __checkReturn efx_rc_t 175efx_mcdi_macaddr_change_supported( 176 __in efx_nic_t *enp, 177 __out boolean_t *supportedp); 178 179extern __checkReturn efx_rc_t 180efx_mcdi_link_control_supported( 181 __in efx_nic_t *enp, 182 __out boolean_t *supportedp); 183 184extern __checkReturn efx_rc_t 185efx_mcdi_mac_spoofing_supported( 186 __in efx_nic_t *enp, 187 __out boolean_t *supportedp); 188 189 190#if EFSYS_OPT_BIST 191#if EFSYS_OPT_HUNTINGTON 192extern __checkReturn efx_rc_t 193efx_mcdi_bist_enable_offline( 194 __in efx_nic_t *enp); 195#endif /* EFSYS_OPT_HUNTINGTON */ 196extern __checkReturn efx_rc_t 197efx_mcdi_bist_start( 198 __in efx_nic_t *enp, 199 __in efx_bist_type_t type); 200#endif /* EFSYS_OPT_BIST */ 201 202extern __checkReturn efx_rc_t 203efx_mcdi_get_resource_limits( 204 __in efx_nic_t *enp, 205 __out_opt uint32_t *nevqp, 206 __out_opt uint32_t *nrxqp, 207 __out_opt uint32_t *ntxqp); 208 209extern __checkReturn efx_rc_t 210efx_mcdi_log_ctrl( 211 __in efx_nic_t *enp); 212 213extern __checkReturn efx_rc_t 214efx_mcdi_mac_stats_clear( 215 __in efx_nic_t *enp); 216 217extern __checkReturn efx_rc_t 218efx_mcdi_mac_stats_upload( 219 __in efx_nic_t *enp, 220 __in efsys_mem_t *esmp); 221 222extern __checkReturn efx_rc_t 223efx_mcdi_mac_stats_periodic( 224 __in efx_nic_t *enp, 225 __in efsys_mem_t *esmp, 226 __in uint16_t period, 227 __in boolean_t events); 228 229 230#if EFSYS_OPT_LOOPBACK 231extern __checkReturn efx_rc_t 232efx_mcdi_get_loopback_modes( 233 __in efx_nic_t *enp); 234#endif /* EFSYS_OPT_LOOPBACK */ 235 236#define MCDI_IN(_emr, _type, _ofst) \ 237 ((_type *)((_emr).emr_in_buf + (_ofst))) 238 239#define MCDI_IN2(_emr, _type, _ofst) \ 240 MCDI_IN(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 241 242#define MCDI_IN_SET_BYTE(_emr, _ofst, _value) \ 243 EFX_POPULATE_BYTE_1(*MCDI_IN2(_emr, efx_byte_t, _ofst), \ 244 EFX_BYTE_0, _value) 245 246#define MCDI_IN_SET_WORD(_emr, _ofst, _value) \ 247 EFX_POPULATE_WORD_1(*MCDI_IN2(_emr, efx_word_t, _ofst), \ 248 EFX_WORD_0, _value) 249 250#define MCDI_IN_SET_DWORD(_emr, _ofst, _value) \ 251 EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 252 EFX_DWORD_0, _value) 253 254#define MCDI_IN_SET_DWORD_FIELD(_emr, _ofst, _field, _value) \ 255 EFX_SET_DWORD_FIELD(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 256 MC_CMD_ ## _field, _value) 257 258#define MCDI_IN_POPULATE_DWORD_1(_emr, _ofst, _field1, _value1) \ 259 EFX_POPULATE_DWORD_1(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 260 MC_CMD_ ## _field1, _value1) 261 262#define MCDI_IN_POPULATE_DWORD_2(_emr, _ofst, _field1, _value1, \ 263 _field2, _value2) \ 264 EFX_POPULATE_DWORD_2(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 265 MC_CMD_ ## _field1, _value1, \ 266 MC_CMD_ ## _field2, _value2) 267 268#define MCDI_IN_POPULATE_DWORD_3(_emr, _ofst, _field1, _value1, \ 269 _field2, _value2, _field3, _value3) \ 270 EFX_POPULATE_DWORD_3(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 271 MC_CMD_ ## _field1, _value1, \ 272 MC_CMD_ ## _field2, _value2, \ 273 MC_CMD_ ## _field3, _value3) 274 275#define MCDI_IN_POPULATE_DWORD_4(_emr, _ofst, _field1, _value1, \ 276 _field2, _value2, _field3, _value3, _field4, _value4) \ 277 EFX_POPULATE_DWORD_4(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 278 MC_CMD_ ## _field1, _value1, \ 279 MC_CMD_ ## _field2, _value2, \ 280 MC_CMD_ ## _field3, _value3, \ 281 MC_CMD_ ## _field4, _value4) 282 283#define MCDI_IN_POPULATE_DWORD_5(_emr, _ofst, _field1, _value1, \ 284 _field2, _value2, _field3, _value3, _field4, _value4, \ 285 _field5, _value5) \ 286 EFX_POPULATE_DWORD_5(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 287 MC_CMD_ ## _field1, _value1, \ 288 MC_CMD_ ## _field2, _value2, \ 289 MC_CMD_ ## _field3, _value3, \ 290 MC_CMD_ ## _field4, _value4, \ 291 MC_CMD_ ## _field5, _value5) 292 293#define MCDI_IN_POPULATE_DWORD_6(_emr, _ofst, _field1, _value1, \ 294 _field2, _value2, _field3, _value3, _field4, _value4, \ 295 _field5, _value5, _field6, _value6) \ 296 EFX_POPULATE_DWORD_6(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 297 MC_CMD_ ## _field1, _value1, \ 298 MC_CMD_ ## _field2, _value2, \ 299 MC_CMD_ ## _field3, _value3, \ 300 MC_CMD_ ## _field4, _value4, \ 301 MC_CMD_ ## _field5, _value5, \ 302 MC_CMD_ ## _field6, _value6) 303 304#define MCDI_IN_POPULATE_DWORD_7(_emr, _ofst, _field1, _value1, \ 305 _field2, _value2, _field3, _value3, _field4, _value4, \ 306 _field5, _value5, _field6, _value6, _field7, _value7) \ 307 EFX_POPULATE_DWORD_7(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 308 MC_CMD_ ## _field1, _value1, \ 309 MC_CMD_ ## _field2, _value2, \ 310 MC_CMD_ ## _field3, _value3, \ 311 MC_CMD_ ## _field4, _value4, \ 312 MC_CMD_ ## _field5, _value5, \ 313 MC_CMD_ ## _field6, _value6, \ 314 MC_CMD_ ## _field7, _value7) 315 316#define MCDI_IN_POPULATE_DWORD_8(_emr, _ofst, _field1, _value1, \ 317 _field2, _value2, _field3, _value3, _field4, _value4, \ 318 _field5, _value5, _field6, _value6, _field7, _value7, \ 319 _field8, _value8) \ 320 EFX_POPULATE_DWORD_8(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 321 MC_CMD_ ## _field1, _value1, \ 322 MC_CMD_ ## _field2, _value2, \ 323 MC_CMD_ ## _field3, _value3, \ 324 MC_CMD_ ## _field4, _value4, \ 325 MC_CMD_ ## _field5, _value5, \ 326 MC_CMD_ ## _field6, _value6, \ 327 MC_CMD_ ## _field7, _value7, \ 328 MC_CMD_ ## _field8, _value8) 329 330#define MCDI_IN_POPULATE_DWORD_9(_emr, _ofst, _field1, _value1, \ 331 _field2, _value2, _field3, _value3, _field4, _value4, \ 332 _field5, _value5, _field6, _value6, _field7, _value7, \ 333 _field8, _value8, _field9, _value9) \ 334 EFX_POPULATE_DWORD_9(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 335 MC_CMD_ ## _field1, _value1, \ 336 MC_CMD_ ## _field2, _value2, \ 337 MC_CMD_ ## _field3, _value3, \ 338 MC_CMD_ ## _field4, _value4, \ 339 MC_CMD_ ## _field5, _value5, \ 340 MC_CMD_ ## _field6, _value6, \ 341 MC_CMD_ ## _field7, _value7, \ 342 MC_CMD_ ## _field8, _value8, \ 343 MC_CMD_ ## _field9, _value9) 344 345#define MCDI_IN_POPULATE_DWORD_10(_emr, _ofst, _field1, _value1, \ 346 _field2, _value2, _field3, _value3, _field4, _value4, \ 347 _field5, _value5, _field6, _value6, _field7, _value7, \ 348 _field8, _value8, _field9, _value9, _field10, _value10) \ 349 EFX_POPULATE_DWORD_10(*MCDI_IN2(_emr, efx_dword_t, _ofst), \ 350 MC_CMD_ ## _field1, _value1, \ 351 MC_CMD_ ## _field2, _value2, \ 352 MC_CMD_ ## _field3, _value3, \ 353 MC_CMD_ ## _field4, _value4, \ 354 MC_CMD_ ## _field5, _value5, \ 355 MC_CMD_ ## _field6, _value6, \ 356 MC_CMD_ ## _field7, _value7, \ 357 MC_CMD_ ## _field8, _value8, \ 358 MC_CMD_ ## _field9, _value9, \ 359 MC_CMD_ ## _field10, _value10) 360 361#define MCDI_OUT(_emr, _type, _ofst) \ 362 ((_type *)((_emr).emr_out_buf + (_ofst))) 363 364#define MCDI_OUT2(_emr, _type, _ofst) \ 365 MCDI_OUT(_emr, _type, MC_CMD_ ## _ofst ## _OFST) 366 367#define MCDI_OUT_BYTE(_emr, _ofst) \ 368 EFX_BYTE_FIELD(*MCDI_OUT2(_emr, efx_byte_t, _ofst), \ 369 EFX_BYTE_0) 370 371#define MCDI_OUT_WORD(_emr, _ofst) \ 372 EFX_WORD_FIELD(*MCDI_OUT2(_emr, efx_word_t, _ofst), \ 373 EFX_WORD_0) 374 375#define MCDI_OUT_DWORD(_emr, _ofst) \ 376 EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 377 EFX_DWORD_0) 378 379#define MCDI_OUT_DWORD_FIELD(_emr, _ofst, _field) \ 380 EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \ 381 MC_CMD_ ## _field) 382 383#define MCDI_EV_FIELD(_eqp, _field) \ 384 EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field) 385 386#define MCDI_CMD_DWORD_FIELD(_edp, _field) \ 387 EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field) 388
|