From 2074f70064b5860db0d273ad3d050e87764c08e5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 11 Jan 2018 08:16:09 +0100 Subject: efi_loader: consistently use efi_handle_t for handles We should consistently use the efi_handle_t typedef when referring to handles. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Signed-off-by: Alexander Graf --- cmd/bootefi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/bootefi.c') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 78ff109835d..97a4f269ae9 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -122,8 +122,8 @@ static void *copy_fdt(void *fdt) } static efi_status_t efi_do_enter( - void *image_handle, struct efi_system_table *st, - asmlinkage ulong (*entry)(void *image_handle, + efi_handle_t image_handle, struct efi_system_table *st, + asmlinkage ulong (*entry)(efi_handle_t image_handle, struct efi_system_table *st)) { efi_status_t ret = EFI_LOAD_ERROR; @@ -136,8 +136,8 @@ static efi_status_t efi_do_enter( #ifdef CONFIG_ARM64 static efi_status_t efi_run_in_el2(asmlinkage ulong (*entry)( - void *image_handle, struct efi_system_table *st), - void *image_handle, struct efi_system_table *st) + efi_handle_t image_handle, struct efi_system_table *st), + efi_handle_t image_handle, struct efi_system_table *st) { /* Enable caches again */ dcache_enable(); @@ -159,7 +159,7 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt, struct efi_device_path *memdp = NULL; ulong ret; - ulong (*entry)(void *image_handle, struct efi_system_table *st) + ulong (*entry)(efi_handle_t image_handle, struct efi_system_table *st) asmlinkage; ulong fdt_pages, fdt_size, fdt_start, fdt_end; const efi_guid_t fdt_guid = EFI_FDT_GUID; -- cgit v1.2.3 From 17ff6f02f5ad64727e20b8ee4d751a942461ec76 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 18 Jan 2018 23:21:22 +0100 Subject: efi_loader: store DT in EFI_RUNTIME_SERVICES_DATA memory The device tree is needed at runtime. So we have to store it in EFI_RUNTIME_SERVICES_DATA memory. The UEFI spec recommends to store all configuration tables in EFI_RUNTIME_SERVICES_DATA memory. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- cmd/bootefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/bootefi.c') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 97a4f269ae9..a30259c4c12 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -103,11 +103,11 @@ static void *copy_fdt(void *fdt) /* Safe fdt location is at 128MB */ new_fdt_addr = fdt_ram_start + (128 * 1024 * 1024) + fdt_size; - if (efi_allocate_pages(1, EFI_BOOT_SERVICES_DATA, fdt_pages, + if (efi_allocate_pages(1, EFI_RUNTIME_SERVICES_DATA, fdt_pages, &new_fdt_addr) != EFI_SUCCESS) { /* If we can't put it there, put it somewhere */ new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size); - if (efi_allocate_pages(1, EFI_BOOT_SERVICES_DATA, fdt_pages, + if (efi_allocate_pages(1, EFI_RUNTIME_SERVICES_DATA, fdt_pages, &new_fdt_addr) != EFI_SUCCESS) { printf("ERROR: Failed to reserve space for FDT\n"); return NULL; -- cgit v1.2.3 From 05ef48a2484be4d1d232534b919c8e9b4bcfaecd Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 21 Jan 2018 19:29:30 +0100 Subject: efi_driver: EFI block driver This patch provides * a uclass for EFI drivers * a EFI driver for block devices For each EFI driver the uclass * creates a handle * adds the driver binding protocol The uclass provides the bind, start, and stop entry points for the driver binding protocol. In bind() and stop() it checks if the controller implements the protocol supported by the EFI driver. In the start() function it calls the bind() function of the EFI driver. In the stop() function it destroys the child controllers. The EFI block driver binds to controllers implementing the block io protocol. When the bind function of the EFI block driver is called it creates a new U-Boot block device. It installs child handles for all partitions and installs the simple file protocol on these. The read and write functions of the EFI block driver delegate calls to the controller that it is bound to. A usage example is as following: U-Boot loads the iPXE snp.efi executable. iPXE connects an iSCSI drive and exposes a handle with the block IO protocol. It calls ConnectController. Now the EFI block driver installs the partitions with the simple file protocol. iPXE uses the simple file protocol to load Grub or the Linux Kernel. Signed-off-by: Heinrich Schuchardt [agraf: add comment on calloc len] Signed-off-by: Alexander Graf --- cmd/bootefi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd/bootefi.c') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index a30259c4c12..51213c0293c 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -32,6 +32,9 @@ static void efi_init_obj_list(void) { efi_obj_list_initalized = 1; + /* Initialize EFI driver uclass */ + efi_driver_init(); + efi_console_register(); #ifdef CONFIG_PARTITIONS efi_disk_register(); -- cgit v1.2.3