summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_download.c
diff options
context:
space:
mode:
authorMichael Brown2013-03-13 23:36:32 +0100
committerMichael Brown2013-03-13 23:42:16 +0100
commitfc87adb46c1395b09302085e9d15fcd8ab3c31fe (patch)
tree35043eb05fce1aca8e26bc72aecb666779c45d10 /src/interface/efi/efi_download.c
parent[efi] Add last_opened_snpdev() (diff)
downloadipxe-fc87adb46c1395b09302085e9d15fcd8ab3c31fe.tar.gz
ipxe-fc87adb46c1395b09302085e9d15fcd8ab3c31fe.tar.xz
ipxe-fc87adb46c1395b09302085e9d15fcd8ab3c31fe.zip
[efi] Expose downloaded images via EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
Expose iPXE's images as a UEFI file system, allowing the booted image to access all images downloaded by iPXE. This functionality is complementary to the custom iPXE download protocol. The iPXE download protocol allows a booted image to utilise iPXE to download arbitrary URIs, but requires the booted image to specifically support the custom iPXE download protocol. The new functionality limits the booted image to accessing only files that were already downloaded by iPXE (e.g. as part of a script), but can work with any generic UEFI image (e.g. the UEFI shell). Both protocols are provided simultaneously, and are attached to the SNP device handle. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_download.c')
-rw-r--r--src/interface/efi/efi_download.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/interface/efi/efi_download.c b/src/interface/efi/efi_download.c
index 250946e2..7b19ad3a 100644
--- a/src/interface/efi/efi_download.c
+++ b/src/interface/efi/efi_download.c
@@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/iobuf.h>
#include <ipxe/xfer.h>
#include <ipxe/efi/efi.h>
-#include <ipxe/efi/ipxe_download.h>
+#include <ipxe/efi/efi_download.h>
/** iPXE download protocol GUID */
static EFI_GUID ipxe_download_protocol_guid
@@ -187,47 +187,39 @@ static IPXE_DOWNLOAD_PROTOCOL ipxe_download_protocol_interface = {
};
/**
- * Create a new device handle with a iPXE download protocol attached to it.
+ * Install iPXE download protocol
*
- * @v device_handle Newly created device handle (output)
+ * @v handle EFI handle
* @ret rc Return status code
*/
-int efi_download_install ( EFI_HANDLE *device_handle ) {
+int efi_download_install ( EFI_HANDLE *handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_STATUS efirc;
- EFI_HANDLE handle = NULL;
- if (efi_loaded_image->DeviceHandle) { /* TODO: ensure handle is the NIC (maybe efi_image has a better way to indicate the handle doing SNP?) */
- handle = efi_loaded_image->DeviceHandle;
- }
- DBG ( "Installing ipxe protocol interface (%p)... ",
- &ipxe_download_protocol_interface );
efirc = bs->InstallMultipleProtocolInterfaces (
- &handle,
+ handle,
&ipxe_download_protocol_guid,
&ipxe_download_protocol_interface,
NULL );
if ( efirc ) {
- DBG ( "failed (%s)\n", efi_strerror ( efirc ) );
+ DBG ( "Could not install download protocol: %s\n",
+ efi_strerror ( efirc ) );
return EFIRC_TO_RC ( efirc );
}
- DBG ( "success (%p)\n", handle );
- *device_handle = handle;
return 0;
}
/**
- * Remove the iPXE download protocol from the given handle, and if nothing
- * else is attached, destroy the handle.
+ * Uninstall iPXE download protocol
*
- * @v device_handle EFI device handle to remove from
+ * @v handle EFI handle
*/
-void efi_download_uninstall ( EFI_HANDLE device_handle ) {
+void efi_download_uninstall ( EFI_HANDLE handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
bs->UninstallMultipleProtocolInterfaces (
- device_handle,
- ipxe_download_protocol_guid,
- ipxe_download_protocol_interface );
+ handle,
+ &ipxe_download_protocol_guid,
+ &ipxe_download_protocol_interface, NULL );
}