summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/prefix/efiprefix.c
diff options
context:
space:
mode:
authorMichael Brown2014-07-30 15:21:10 +0200
committerMichael Brown2014-07-30 15:27:07 +0200
commitdc18fd76488476c8bd5b70ba228576d328280670 (patch)
tree367cbb53850d4379742d465ced0a08918abe5fbd /src/arch/x86/prefix/efiprefix.c
parent[xen] Add support for Xen netfront virtual NICs (diff)
downloadipxe-dc18fd76488476c8bd5b70ba228576d328280670.tar.gz
ipxe-dc18fd76488476c8bd5b70ba228576d328280670.tar.xz
ipxe-dc18fd76488476c8bd5b70ba228576d328280670.zip
[efi] Default to releasing network devices for use via SNP
We currently treat network devices as available for use via the SNP API only if RX queue processing has been frozen. (This is similar in spirit to the way that RX queue processing is frozen for the network device currently exposed via the PXE API.) The default state of a freshly created network device is for the RX queue to not be frozen, and thus to be unavailable for use via SNP. This causes problems when devices are added through code paths other than _efidrv_start() (which explicitly releases devices for use via SNP). We don't actually need to freeze RX queue processing, since calls via the SNP API will always use netdev_poll() rather than net_poll(), and so will never trigger the RX queue processing code path anyway. We can therefore simplify the code to use a single global flag to indicate whether network devices are claimed for use by iPXE or available for use via SNP. Using a global flag allows the default state for dynamically created network devices to behave sensibly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/prefix/efiprefix.c')
-rw-r--r--src/arch/x86/prefix/efiprefix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c
index a0347680..b0bf99c6 100644
--- a/src/arch/x86/prefix/efiprefix.c
+++ b/src/arch/x86/prefix/efiprefix.c
@@ -24,6 +24,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/device.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
+#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_autoboot.h>
/**
@@ -45,6 +46,9 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
/* Record autoboot device (if any) */
efi_set_autoboot();
+ /* Claim SNP devices for use by iPXE */
+ efi_snp_claim();
+
/* Call to main() */
if ( ( rc = main() ) != 0 ) {
efirc = EFIRC ( rc );
@@ -52,6 +56,7 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
}
err_main:
+ efi_snp_release();
efi_loaded_image->Unload ( image_handle );
efi_driver_reconnect_all();
err_init: