[intelxl] Allow for admin commands that trigger a VF reset

The RESET_VF admin queue command does not complete via the usual
mechanism, but instead requires us to poll registers to wait for the
reset to take effect and then reopen the admin queue.

Allow for the existence of other admin queue commands that also
trigger a VF reset, by separating out the logic that waits for the
reset to complete.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/697/head^2
Michael Brown 2022-08-16 17:59:37 +01:00
parent 491c075f7f
commit 04879352c4
1 changed files with 31 additions and 16 deletions

View File

@ -102,6 +102,32 @@ static int intelxlvf_reset_wait_active ( struct intelxl_nic *intelxl ) {
return -ETIMEDOUT;
}
/**
* Wait for reset to complete
*
* @v intelxl Intel device
* @ret rc Return status code
*/
static int intelxlvf_reset_wait ( struct intelxl_nic *intelxl ) {
int rc;
/* Wait for minimum reset time */
mdelay ( INTELXLVF_RESET_DELAY_MS );
/* Wait for reset to take effect */
if ( ( rc = intelxlvf_reset_wait_teardown ( intelxl ) ) != 0 )
goto err_teardown;
/* Wait for virtual function to become active */
if ( ( rc = intelxlvf_reset_wait_active ( intelxl ) ) != 0 )
goto err_active;
err_active:
err_teardown:
intelxl_reopen_admin ( intelxl );
return rc;
}
/**
* Reset hardware via admin queue
*
@ -119,24 +145,13 @@ static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) {
/* Issue command */
if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 )
goto err_command;
return rc;
/* Wait for minimum reset time */
mdelay ( INTELXLVF_RESET_DELAY_MS );
/* Wait for reset to complete */
if ( ( rc = intelxlvf_reset_wait ( intelxl ) ) != 0 )
return rc;
/* Wait for reset to take effect */
if ( ( rc = intelxlvf_reset_wait_teardown ( intelxl ) ) != 0 )
goto err_teardown;
/* Wait for virtual function to become active */
if ( ( rc = intelxlvf_reset_wait_active ( intelxl ) ) != 0 )
goto err_active;
err_active:
err_teardown:
intelxl_reopen_admin ( intelxl );
err_command:
return rc;
return 0;
}
/******************************************************************************