From dc18fd76488476c8bd5b70ba228576d328280670 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 30 Jul 2014 14:21:10 +0100 Subject: [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 --- src/arch/x86/prefix/efidrvprefix.c | 4 ---- src/arch/x86/prefix/efiprefix.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/arch') diff --git a/src/arch/x86/prefix/efidrvprefix.c b/src/arch/x86/prefix/efidrvprefix.c index 280e33535..3daefd00a 100644 --- a/src/arch/x86/prefix/efidrvprefix.c +++ b/src/arch/x86/prefix/efidrvprefix.c @@ -22,7 +22,6 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include -#include /** * EFI entry point @@ -43,8 +42,5 @@ EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle, initialise(); startup(); - /* Release network devices for use via SNP */ - efi_snp_release(); - return 0; } diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c index a0347680c..b0bf99c65 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 #include #include +#include #include /** @@ -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: -- cgit v1.2.3-55-g7522