diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-08-16 17:59:37 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-08-16 19:29:01 +0100 |
commit | 04879352c4f5fbb4f1aeaf9b644c2b8408847894 (patch) | |
tree | db897077270657d263f8866eb7bec29fb77fcad7 | |
parent | 491c075f7f3ce3e7d58e969d8fcd0af1e102e515 (diff) | |
download | ipxe-04879352c4f5fbb4f1aeaf9b644c2b8408847894.tar.gz |
[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>
-rw-r--r-- | src/drivers/net/intelxlvf.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/drivers/net/intelxlvf.c b/src/drivers/net/intelxlvf.c index 79245b46f..e30d8c6db 100644 --- a/src/drivers/net/intelxlvf.c +++ b/src/drivers/net/intelxlvf.c @@ -103,24 +103,14 @@ static int intelxlvf_reset_wait_active ( struct intelxl_nic *intelxl ) { } /** - * Reset hardware via admin queue + * Wait for reset to complete * * @v intelxl Intel device * @ret rc Return status code */ -static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { - struct intelxlvf_admin_descriptor *cmd; +static int intelxlvf_reset_wait ( struct intelxl_nic *intelxl ) { int rc; - /* Populate descriptor */ - cmd = intelxlvf_admin_command_descriptor ( intelxl ); - cmd->opcode = cpu_to_le16 ( INTELXLVF_ADMIN_SEND_TO_PF ); - cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_RESET ); - - /* Issue command */ - if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 ) - goto err_command; - /* Wait for minimum reset time */ mdelay ( INTELXLVF_RESET_DELAY_MS ); @@ -135,10 +125,35 @@ static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { err_active: err_teardown: intelxl_reopen_admin ( intelxl ); - err_command: return rc; } +/** + * Reset hardware via admin queue + * + * @v intelxl Intel device + * @ret rc Return status code + */ +static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) { + struct intelxlvf_admin_descriptor *cmd; + int rc; + + /* Populate descriptor */ + cmd = intelxlvf_admin_command_descriptor ( intelxl ); + cmd->opcode = cpu_to_le16 ( INTELXLVF_ADMIN_SEND_TO_PF ); + cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_RESET ); + + /* Issue command */ + if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 ) + return rc; + + /* Wait for reset to complete */ + if ( ( rc = intelxlvf_reset_wait ( intelxl ) ) != 0 ) + return rc; + + return 0; +} + /****************************************************************************** * * Admin queue |