]> git.sur5r.net Git - u-boot/blobdiff - cmd/bootefi.c
efi_loader: consistently use efi_handle_t for handles
[u-boot] / cmd / bootefi.c
index 0915192bbb7368a9ee82db200c15e62df0f64d02..97a4f269ae997ae8c0a1d88f3e2b0b34bec7173c 100644 (file)
@@ -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;
@@ -218,6 +218,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
                efi_install_configuration_table(&fdt_guid, NULL);
        }
 
+       /* Transfer environment variable bootargs as load options */
+       set_load_options(&loaded_image_info, "bootargs");
        /* Load the EFI payload */
        entry = efi_load_pe(efi, &loaded_image_info);
        if (!entry) {
@@ -252,7 +254,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
                dcache_disable();       /* flush cache before switch to EL2 */
 
                /* Move into EL2 and keep running there */
-               armv8_switch_to_el2((ulong)entry, (ulong)&loaded_image_info,
+               armv8_switch_to_el2((ulong)entry,
+                                   (ulong)&loaded_image_info_obj.handle,
                                    (ulong)&systab, 0, (ulong)efi_run_in_el2,
                                    ES_TO_AARCH64);
 
@@ -261,7 +264,7 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
        }
 #endif
 
-       ret = efi_do_enter(&loaded_image_info, &systab, entry);
+       ret = efi_do_enter(loaded_image_info_obj.handle, &systab, entry);
 
 exit:
        /* image has returned, loaded-image obj goes *poof*: */
@@ -348,7 +351,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                /* Transfer environment variable efi_selftest as load options */
                set_load_options(&loaded_image_info, "efi_selftest");
                /* Execute the test */
-               r = efi_selftest(&loaded_image_info, &systab);
+               r = efi_selftest(loaded_image_info_obj.handle, &systab);
                efi_restore_gd();
                free(loaded_image_info.load_options);
                list_del(&loaded_image_info_obj.link);
@@ -434,6 +437,8 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
                int part;
 
                desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
+               if (!desc)
+                       return;
                part = parse_partnum(devnr);
 
                bootefi_device_path = efi_dp_from_part(desc, part);