diff options
author | Tom Rini <trini@konsulko.com> | 2022-04-29 14:04:08 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-04-29 14:04:08 -0400 |
commit | c70c0102af5413cadde6bf90044cb75aefef0584 (patch) | |
tree | adf1fa2efb653261ce8eb1b8087bd5f28e4aa913 | |
parent | f7bd9e4936b6e36c2443b9b2ef761e7593511521 (diff) | |
parent | 5e847f7729b3cc34b572b4f59ee7d468b3b76ccc (diff) | |
download | u-boot-WIP/29Apr2022.zip u-boot-WIP/29Apr2022.tar.gz u-boot-WIP/29Apr2022.tar.bz2 |
Merge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efiWIP/29Apr2022
Pull request for efi-2022-07-rc2
UEFI:
* fix UEFI booting after integration of UEFI sub-system with driver model
* avoid random return values from devpath_is_partition()
* minor code clean ups
-rw-r--r-- | common/board_r.c | 6 | ||||
-rw-r--r-- | lib/efi/efi_app.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_bootmgr.c | 15 | ||||
-rw-r--r-- | lib/efi_loader/efi_disk.c | 29 | ||||
-rw-r--r-- | lib/efi_loader/efi_memory.c | 2 |
5 files changed, 25 insertions, 29 deletions
diff --git a/common/board_r.c b/common/board_r.c index ff17720..93c9c2e 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -693,6 +693,9 @@ static init_fnc_t init_sequence_r[] = { /* initialize higher level parts of CPU like time base and timers */ cpu_init_r, #endif +#ifdef CONFIG_EFI_SETUP_EARLY + efi_init_early, +#endif #ifdef CONFIG_CMD_NAND initr_nand, #endif @@ -793,9 +796,6 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_PRAM) initr_mem, #endif -#ifdef CONFIG_EFI_SETUP_EARLY - efi_init_early, -#endif run_main_loop, }; diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 1e5606c..2209410 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -190,7 +190,7 @@ static void free_memory(struct efi_priv *priv) static bool devpath_is_partition(const struct efi_device_path *path) { const struct efi_device_path *p; - bool was_part; + bool was_part = false; for (p = path; p->type != DEVICE_PATH_TYPE_END; p = (void *)p + p->length) { diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 8c04ecb..52bea4d 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -46,16 +46,12 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, void **load_options) { struct efi_load_option lo; - u16 varname[] = u"Boot0000"; - u16 hexmap[] = u"0123456789ABCDEF"; + u16 varname[9]; void *load_option; efi_uintn_t size; efi_status_t ret; - varname[4] = hexmap[(n & 0xf000) >> 12]; - varname[5] = hexmap[(n & 0x0f00) >> 8]; - varname[6] = hexmap[(n & 0x00f0) >> 4]; - varname[7] = hexmap[(n & 0x000f) >> 0]; + efi_create_indexed_name(varname, sizeof(varname), "Boot", n); load_option = efi_get_var(varname, &efi_global_variable_guid, &size); if (!load_option) @@ -70,8 +66,8 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, if (lo.attributes & LOAD_OPTION_ACTIVE) { u32 attributes; - log_debug("%s: trying to load \"%ls\" from %pD\n", - __func__, lo.label, lo.file_path); + log_debug("trying to load \"%ls\" from %pD\n", lo.label, + lo.file_path); ret = EFI_CALL(efi_load_image(true, efi_root, lo.file_path, NULL, 0, handle)); @@ -187,8 +183,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) num = size / sizeof(uint16_t); for (i = 0; i < num; i++) { - log_debug("%s trying to load Boot%04X\n", __func__, - bootorder[i]); + log_debug("trying to load Boot%04X\n", bootorder[i]); ret = try_load_entry(bootorder[i], handle, load_options); if (ret == EFI_SUCCESS) break; diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 8fb5b23..f5b462f 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -99,21 +99,22 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, if (buffer_size & (blksz - 1)) return EFI_BAD_BUFFER_SIZE; -#if CONFIG_IS_ENABLED(PARTITIONS) - if (direction == EFI_DISK_READ) - n = dev_read(diskobj->dev, lba, blocks, buffer); - else - n = dev_write(diskobj->dev, lba, blocks, buffer); -#else - /* dev is always a block device (UCLASS_BLK) */ - struct blk_desc *desc; + if (CONFIG_IS_ENABLED(PARTITIONS) && + device_get_uclass_id(diskobj->dev) == UCLASS_PARTITION) { + if (direction == EFI_DISK_READ) + n = dev_read(diskobj->dev, lba, blocks, buffer); + else + n = dev_write(diskobj->dev, lba, blocks, buffer); + } else { + /* dev is a block device (UCLASS_BLK) */ + struct blk_desc *desc; - desc = dev_get_uclass_plat(diskobj->dev); - if (direction == EFI_DISK_READ) - n = blk_dread(desc, lba, blocks, buffer); - else - n = blk_dwrite(desc, lba, blocks, buffer); -#endif + desc = dev_get_uclass_plat(diskobj->dev); + if (direction == EFI_DISK_READ) + n = blk_dread(desc, lba, blocks, buffer); + else + n = blk_dwrite(desc, lba, blocks, buffer); + } /* We don't do interrupts, so check for timers cooperatively */ efi_timer_check(); diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 1c51a3f..e048a54 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -771,7 +771,7 @@ efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end, /* ram_top is before this region, reserve all */ efi_add_memory_map_pg(ram_start, pages, EFI_BOOT_SERVICES_DATA, true); - } else if ((ram_top >= ram_start) && (ram_top < ram_end)) { + } else if (ram_top < ram_end) { /* ram_top is inside this region, reserve parts */ pages = (ram_end - ram_top) >> EFI_PAGE_SHIFT; |