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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmJr9IkACgkQxIHbvCwF
 GsSk1A/+OfrvC92hBSGk6WdyVAjdpkOZRJ2SghMaC7k1bA+Me8zj+8oKW78qqH5o
 5ylL4F68Cp0h8esFLaqXCj8Een2atmQzwOdj8MFqIZaLxjawTZ96P6dkFD27S6m9
 egUOM0fpiCDc5aLPU090adFXhst0bZoxgnss+UofHaAbGVTlKVfuvpG28wgUNNi5
 kbSj4Pu1DpQbTYHBvKFoIkKY7+isjuaIlhoQtMO8zfvXgqZuYJGcIml+JJHUJ6S1
 uqwxDEJSwZu6qKNMdmogPBrxM1HHjSg31JB/WMjsd0aSC0ud+3PeZNohvLY3tEei
 KUXW6hEyunKbme/sg7DXk1tkr8izd/paA/pyPpAcvFKPpWLBSBIJAxtbMkJCg8Zd
 pl5uSBUgfGRk9nf0F0+zxQCfdTffFKBRu/t0TGr+h1NZdMYi73CbiZ9vHJbJLuro
 cLN9hXwY+Ap0DialHrRqes4uqjHAIM7Tj3gEEx0+emukY0CT67uum2HtLHm+OzaD
 B5J8sOzEhJRCqBh3E4qap2Q4+weE2LVF4Nza7wchZGv5/LiPES3gGcdyZHpwKebl
 vPc09GnaQZp5hyejOh/1c8/tJCm/CFffwNzrYqbCsKqVSGOVxyYnPl4eelP13oHs
 6YYyZ3+h+JuFwQon51mGjPMVZCVz9ObOQMbBACpcInymhcy8bks=
 =IdkS
 -----END PGP SIGNATURE-----

Merge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

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
This commit is contained in:
Tom Rini 2022-04-29 14:04:08 -04:00
commit c70c0102af
5 changed files with 25 additions and 29 deletions

View File

@ -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
@ -792,9 +795,6 @@ static init_fnc_t init_sequence_r[] = {
#endif
#if defined(CONFIG_PRAM)
initr_mem,
#endif
#ifdef CONFIG_EFI_SETUP_EARLY
efi_init_early,
#endif
run_main_loop,
};

View File

@ -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) {

View File

@ -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;

View File

@ -99,13 +99,14 @@ 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 (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 always a block device (UCLASS_BLK) */
} else {
/* dev is a block device (UCLASS_BLK) */
struct blk_desc *desc;
desc = dev_get_uclass_plat(diskobj->dev);
@ -113,7 +114,7 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this,
n = blk_dread(desc, lba, blocks, buffer);
else
n = blk_dwrite(desc, lba, blocks, buffer);
#endif
}
/* We don't do interrupts, so check for timers cooperatively */
efi_timer_check();

View File

@ -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;