summaryrefslogtreecommitdiff
path: root/lib/efi_selftest/efi_selftest_snp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efi_selftest/efi_selftest_snp.c')
-rw-r--r--lib/efi_selftest/efi_selftest_snp.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c
index 807b8657b9..9797ecaf42 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -228,6 +228,26 @@ static int setup(const efi_handle_t handle,
efi_st_error("WaitForPacket event missing\n");
return EFI_ST_FAILURE;
}
+ if (net->mode->state == EFI_NETWORK_INITIALIZED) {
+ /*
+ * Shut down network adapter.
+ */
+ ret = net->shutdown(net);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("Failed to shut down network adapter\n");
+ return EFI_ST_FAILURE;
+ }
+ }
+ if (net->mode->state == EFI_NETWORK_STARTED) {
+ /*
+ * Stop network adapter.
+ */
+ ret = net->stop(net);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("Failed to stop network adapter\n");
+ return EFI_ST_FAILURE;
+ }
+ }
/*
* Start network adapter.
*/
@@ -236,6 +256,10 @@ static int setup(const efi_handle_t handle,
efi_st_error("Failed to start network adapter\n");
return EFI_ST_FAILURE;
}
+ if (net->mode->state != EFI_NETWORK_STARTED) {
+ efi_st_error("Failed to start network adapter\n");
+ return EFI_ST_FAILURE;
+ }
/*
* Initialize network adapter.
*/
@@ -244,6 +268,10 @@ static int setup(const efi_handle_t handle,
efi_st_error("Failed to initialize network adapter\n");
return EFI_ST_FAILURE;
}
+ if (net->mode->state != EFI_NETWORK_INITIALIZED) {
+ efi_st_error("Failed to initialize network adapter\n");
+ return EFI_ST_FAILURE;
+ }
return EFI_ST_SUCCESS;
}
@@ -412,21 +440,29 @@ static int teardown(void)
}
if (net) {
/*
- * Stop network adapter.
+ * Shut down network adapter.
*/
- ret = net->stop(net);
+ ret = net->shutdown(net);
if (ret != EFI_SUCCESS) {
- efi_st_error("Failed to stop network adapter\n");
+ efi_st_error("Failed to shut down network adapter\n");
exit_status = EFI_ST_FAILURE;
}
+ if (net->mode->state != EFI_NETWORK_STARTED) {
+ efi_st_error("Failed to shutdown network adapter\n");
+ return EFI_ST_FAILURE;
+ }
/*
- * Shut down network adapter.
+ * Stop network adapter.
*/
- ret = net->shutdown(net);
+ ret = net->stop(net);
if (ret != EFI_SUCCESS) {
- efi_st_error("Failed to shut down network adapter\n");
+ efi_st_error("Failed to stop network adapter\n");
exit_status = EFI_ST_FAILURE;
}
+ if (net->mode->state != EFI_NETWORK_STOPPED) {
+ efi_st_error("Failed to stop network adapter\n");
+ return EFI_ST_FAILURE;
+ }
}
return exit_status;