sfxge: [2/6] rework MCDI response polling
Required to support MCDI proxy authorization. Submitted by: Andy Moreton <amoreton at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4418
This commit is contained in:
parent
3edad19717
commit
06af9686c1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291928
@ -52,9 +52,9 @@ static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
|
||||
siena_mcdi_fini, /* emco_fini */
|
||||
siena_mcdi_fw_update_supported, /* emco_fw_update_supported */
|
||||
siena_mcdi_macaddr_change_supported,
|
||||
/* emco_macaddr_change_supported */
|
||||
/* emco_macaddr_change_supported */
|
||||
siena_mcdi_link_control_supported,
|
||||
/* emco_link_control_supported */
|
||||
/* emco_link_control_supported */
|
||||
};
|
||||
|
||||
#endif /* EFSYS_OPT_SIENA */
|
||||
@ -70,9 +70,9 @@ static efx_mcdi_ops_t __efx_mcdi_hunt_ops = {
|
||||
hunt_mcdi_fini, /* emco_fini */
|
||||
hunt_mcdi_fw_update_supported, /* emco_fw_update_supported */
|
||||
hunt_mcdi_macaddr_change_supported,
|
||||
/* emco_macaddr_change_supported */
|
||||
/* emco_macaddr_change_supported */
|
||||
hunt_mcdi_link_control_supported,
|
||||
/* emco_link_control_supported */
|
||||
/* emco_link_control_supported */
|
||||
};
|
||||
|
||||
#endif /* EFSYS_OPT_HUNTINGTON */
|
||||
|
@ -274,6 +274,18 @@ hunt_mcdi_request_copyout(
|
||||
#endif /* EFSYS_OPT_MCDI_LOGGING */
|
||||
}
|
||||
|
||||
static __checkReturn boolean_t
|
||||
hunt_mcdi_poll_response(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
|
||||
efsys_mem_t *esmp = emtp->emt_dma_mem;
|
||||
efx_dword_t hdr;
|
||||
|
||||
EFSYS_MEM_READD(esmp, 0, &hdr);
|
||||
return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE);
|
||||
}
|
||||
|
||||
__checkReturn boolean_t
|
||||
hunt_mcdi_request_poll(
|
||||
__in efx_nic_t *enp)
|
||||
@ -301,13 +313,15 @@ hunt_mcdi_request_poll(
|
||||
|
||||
offset = 0;
|
||||
|
||||
/* Read the command header */
|
||||
EFSYS_MEM_READD(esmp, offset, &hdr[0]);
|
||||
offset += sizeof (efx_dword_t);
|
||||
if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_RESPONSE) == 0) {
|
||||
/* Check if a response is available */
|
||||
if (hunt_mcdi_poll_response(enp) == B_FALSE) {
|
||||
EFSYS_UNLOCK(enp->en_eslp, state);
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/* Read the response header */
|
||||
EFSYS_MEM_READD(esmp, offset, &hdr[0]);
|
||||
offset += sizeof (efx_dword_t);
|
||||
if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) {
|
||||
EFSYS_MEM_READD(esmp, offset, &hdr[1]);
|
||||
offset += sizeof (efx_dword_t);
|
||||
|
@ -191,6 +191,21 @@ siena_mcdi_poll_reboot(
|
||||
#endif
|
||||
}
|
||||
|
||||
static __checkReturn boolean_t
|
||||
siena_mcdi_poll_response(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
|
||||
efx_dword_t hdr;
|
||||
unsigned int pdur;
|
||||
|
||||
EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2);
|
||||
pdur = SIENA_MCDI_PDU(emip);
|
||||
|
||||
EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
|
||||
return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE);
|
||||
}
|
||||
|
||||
__checkReturn boolean_t
|
||||
siena_mcdi_request_poll(
|
||||
__in efx_nic_t *enp)
|
||||
@ -229,13 +244,15 @@ siena_mcdi_request_poll(
|
||||
EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2);
|
||||
pdur = SIENA_MCDI_PDU(emip);
|
||||
|
||||
/* Read the command header */
|
||||
EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
|
||||
if (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) == 0) {
|
||||
/* Check if a response is available */
|
||||
if (siena_mcdi_poll_response(enp) == B_FALSE) {
|
||||
EFSYS_UNLOCK(enp->en_eslp, state);
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/* Read the response header */
|
||||
EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
|
||||
|
||||
/* Request complete */
|
||||
emip->emi_pending_req = NULL;
|
||||
seq = (emip->emi_seq - 1) & EFX_MASK32(MCDI_HEADER_SEQ);
|
||||
|
Loading…
Reference in New Issue
Block a user