ef10_mcdi.c (291677) | ef10_mcdi.c (291928) |
---|---|
1/*- 2 * Copyright (c) 2012-2015 Solarflare Communications Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 15 unchanged lines hidden (view full) --- 24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * The views and conclusions contained in the software and documentation are 27 * those of the authors and should not be interpreted as representing official 28 * policies, either expressed or implied, of the FreeBSD Project. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012-2015 Solarflare Communications Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 15 unchanged lines hidden (view full) --- 24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * The views and conclusions contained in the software and documentation are 27 * those of the authors and should not be interpreted as representing official 28 * policies, either expressed or implied, of the FreeBSD Project. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/hunt_mcdi.c 291677 2015-12-03 07:13:13Z arybchik $"); | 32__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/hunt_mcdi.c 291928 2015-12-07 07:22:21Z arybchik $"); |
33 34#include "efsys.h" 35#include "efx.h" 36#include "efx_impl.h" 37 38 39#if EFSYS_OPT_HUNTINGTON 40 --- 228 unchanged lines hidden (view full) --- 269 emtp->emt_logger(emtp->emt_context, 270 EFX_LOG_MCDI_RESPONSE, 271 &hdr, offset, 272 emrp->emr_out_buf, emrp->emr_out_length_used); 273 } 274#endif /* EFSYS_OPT_MCDI_LOGGING */ 275} 276 | 33 34#include "efsys.h" 35#include "efx.h" 36#include "efx_impl.h" 37 38 39#if EFSYS_OPT_HUNTINGTON 40 --- 228 unchanged lines hidden (view full) --- 269 emtp->emt_logger(emtp->emt_context, 270 EFX_LOG_MCDI_RESPONSE, 271 &hdr, offset, 272 emrp->emr_out_buf, emrp->emr_out_length_used); 273 } 274#endif /* EFSYS_OPT_MCDI_LOGGING */ 275} 276 |
277static __checkReturn boolean_t 278hunt_mcdi_poll_response( 279 __in efx_nic_t *enp) 280{ 281 const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; 282 efsys_mem_t *esmp = emtp->emt_dma_mem; 283 efx_dword_t hdr; 284 285 EFSYS_MEM_READD(esmp, 0, &hdr); 286 return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE); 287} 288 |
|
277 __checkReturn boolean_t 278hunt_mcdi_request_poll( 279 __in efx_nic_t *enp) 280{ 281 efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); 282 const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; 283 efsys_mem_t *esmp = emtp->emt_dma_mem; 284 efx_mcdi_req_t *emrp; --- 11 unchanged lines hidden (view full) --- 296 EFSYS_LOCK(enp->en_eslp, state); 297 298 EFSYS_ASSERT(emip->emi_pending_req != NULL); 299 EFSYS_ASSERT(!emip->emi_ev_cpl); 300 emrp = emip->emi_pending_req; 301 302 offset = 0; 303 | 289 __checkReturn boolean_t 290hunt_mcdi_request_poll( 291 __in efx_nic_t *enp) 292{ 293 efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); 294 const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; 295 efsys_mem_t *esmp = emtp->emt_dma_mem; 296 efx_mcdi_req_t *emrp; --- 11 unchanged lines hidden (view full) --- 308 EFSYS_LOCK(enp->en_eslp, state); 309 310 EFSYS_ASSERT(emip->emi_pending_req != NULL); 311 EFSYS_ASSERT(!emip->emi_ev_cpl); 312 emrp = emip->emi_pending_req; 313 314 offset = 0; 315 |
304 /* Read the command header */ 305 EFSYS_MEM_READD(esmp, offset, &hdr[0]); 306 offset += sizeof (efx_dword_t); 307 if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_RESPONSE) == 0) { | 316 /* Check if a response is available */ 317 if (hunt_mcdi_poll_response(enp) == B_FALSE) { |
308 EFSYS_UNLOCK(enp->en_eslp, state); 309 return (B_FALSE); 310 } | 318 EFSYS_UNLOCK(enp->en_eslp, state); 319 return (B_FALSE); 320 } |
321 322 /* Read the response header */ 323 EFSYS_MEM_READD(esmp, offset, &hdr[0]); 324 offset += sizeof (efx_dword_t); |
|
311 if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) { 312 EFSYS_MEM_READD(esmp, offset, &hdr[1]); 313 offset += sizeof (efx_dword_t); 314 315 cmd = EFX_DWORD_FIELD(hdr[1], MC_CMD_V2_EXTN_IN_EXTENDED_CMD); 316 length = EFX_DWORD_FIELD(hdr[1], MC_CMD_V2_EXTN_IN_ACTUAL_LEN); 317 } else { 318 cmd = EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE); --- 206 unchanged lines hidden --- | 325 if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) { 326 EFSYS_MEM_READD(esmp, offset, &hdr[1]); 327 offset += sizeof (efx_dword_t); 328 329 cmd = EFX_DWORD_FIELD(hdr[1], MC_CMD_V2_EXTN_IN_EXTENDED_CMD); 330 length = EFX_DWORD_FIELD(hdr[1], MC_CMD_V2_EXTN_IN_ACTUAL_LEN); 331 } else { 332 cmd = EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE); --- 206 unchanged lines hidden --- |