summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_init.c
diff options
context:
space:
mode:
authorGeoff Lywood2010-05-28 05:08:28 +0200
committerMichael Brown2010-06-02 16:15:29 +0200
commit62149deb116516bb0d70b756bfc4f5b4669034da (patch)
treeb8adc9a047202f1cebc15f244da2c36d75a05ba0 /src/interface/efi/efi_init.c
parent[qib7322] Fix whitespace errors (diff)
downloadipxe-62149deb116516bb0d70b756bfc4f5b4669034da.tar.gz
ipxe-62149deb116516bb0d70b756bfc4f5b4669034da.tar.xz
ipxe-62149deb116516bb0d70b756bfc4f5b4669034da.zip
[efi] Add the "snpnet" driver
Add a new network driver that consumes the EFI Simple Network Protocol. Also add a bus driver that can find the Simple Network Protocol that iPXE was loaded from; the resulting behavior is similar to the "undionly" driver for BIOS systems. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_init.c')
-rw-r--r--src/interface/efi/efi_init.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c
index ed659932..029bc06f 100644
--- a/src/interface/efi/efi_init.c
+++ b/src/interface/efi/efi_init.c
@@ -20,14 +20,22 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <ipxe/efi/efi.h>
+#include <ipxe/efi/Protocol/LoadedImage.h>
#include <ipxe/uuid.h>
/** Image handle passed to entry point */
EFI_HANDLE efi_image_handle;
+/** Loaded image protocol for this image */
+EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image;
+
/** System table passed to entry point */
EFI_SYSTEM_TABLE *efi_systab;
+/** EFI loaded image protocol GUID */
+static EFI_GUID efi_loaded_image_protocol_guid
+ = EFI_LOADED_IMAGE_PROTOCOL_GUID;
+
/**
* Look up EFI configuration table
*
@@ -59,6 +67,7 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
struct efi_protocol *prot;
struct efi_config_table *tab;
EFI_STATUS efirc;
+ void *loaded_image;
/* Store image handle and system table pointer for future use */
efi_image_handle = image_handle;
@@ -80,8 +89,20 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
}
DBGC ( systab, "EFI handle %p systab %p\n", image_handle, systab );
- /* Look up used protocols */
bs = systab->BootServices;
+ efirc = bs->OpenProtocol ( image_handle,
+ &efi_loaded_image_protocol_guid,
+ &loaded_image, image_handle, NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ if ( efirc ) {
+ DBGC ( systab, "Could not get loaded image protocol" );
+ return efirc;
+ }
+
+ efi_loaded_image = loaded_image;
+ DBG ( "Image base address = %p\n", efi_loaded_image->ImageBase );
+
+ /* Look up used protocols */
for_each_table_entry ( prot, EFI_PROTOCOLS ) {
if ( ( efirc = bs->LocateProtocol ( &prot->u.guid, NULL,
prot->protocol ) ) == 0 ) {