diff options
| author | Tom Rini <[email protected]> | 2026-05-06 08:45:57 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-05-06 08:45:57 -0600 |
| commit | 8399b039b038e72ff51640c61dd762f3368306f5 (patch) | |
| tree | 7e867e3b37c9ddc9837c3417b1362d3bd84c247e /lib | |
| parent | 980f8a4589626ca2b9c6c5f74eefe72f4b5606c6 (diff) | |
| parent | b1c28ad5fafd95c183b26165e498354db41b755b (diff) | |
Merge tag 'efi-2026-07-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2026-07-rc2-2
CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/29993
UEFI:
* initialize variables in efi_dp_from_http()
* cmd: eficonfig: adjust struct eficonfig_entry, field key
* efi_dt_fixup: use fdtdec_get_bool() for reading boolean no-map property
* efi_selftest_memory: check for duplicates first
* simplify efi_mem_sort() using list_for_each_entry_safe
Others:
* lmb: document allocation flags constants
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/efi_loader/efi_device_path.c | 4 | ||||
| -rw-r--r-- | lib/efi_loader/efi_dt_fixup.c | 3 | ||||
| -rw-r--r-- | lib/efi_loader/efi_memory.c | 47 | ||||
| -rw-r--r-- | lib/efi_selftest/efi_selftest_memory.c | 21 |
4 files changed, 29 insertions, 46 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index b3fb20b2501..9efb158f5dd 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -955,8 +955,8 @@ struct efi_device_path *efi_dp_from_http(const char *server, struct udevice *dev efi_uintn_t uridp_len; char *pos; char tmp[128]; - struct efi_ipv4_address ip; - struct efi_ipv4_address mask; + struct efi_ipv4_address ip = { .ip_addr = { 0, 0, 0, 0 } }; + struct efi_ipv4_address mask = { .ip_addr = { 0, 0, 0, 0 } }; if ((server && strlen("http://") + strlen(server) + 1 > sizeof(tmp)) || (!server && IS_ENABLED(CONFIG_NET_LWIP))) diff --git a/lib/efi_loader/efi_dt_fixup.c b/lib/efi_loader/efi_dt_fixup.c index 544e1aa9808..333711b9957 100644 --- a/lib/efi_loader/efi_dt_fixup.c +++ b/lib/efi_loader/efi_dt_fixup.c @@ -123,8 +123,7 @@ void efi_carve_out_dt_rsv(void *fdt) fdtdec_get_is_enabled(fdt, subnode)) { bool nomap; - nomap = !!fdt_getprop(fdt, subnode, "no-map", - NULL); + nomap = fdtdec_get_bool(fdt, subnode, "no-map"); efi_reserve_memory(fdt_addr, fdt_size, nomap); } subnode = fdt_next_subnode(fdt, subnode); diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index b77c2f980cc..046a2bb4641 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -128,44 +128,29 @@ static uint64_t desc_get_end(struct efi_mem_desc *desc) */ static void efi_mem_sort(void) { - struct efi_mem_list *lmem; - struct efi_mem_list *prevmem = NULL; - bool merge_again = true; + struct efi_mem_list *curmem, *nextmem = NULL; list_sort(NULL, &efi_mem, efi_mem_cmp); /* Now merge entries that can be merged */ - while (merge_again) { - merge_again = false; - list_for_each_entry(lmem, &efi_mem, link) { - struct efi_mem_desc *prev; - struct efi_mem_desc *cur; - uint64_t pages; - - if (!prevmem) { - prevmem = lmem; - continue; - } + list_for_each_entry_safe(curmem, nextmem, &efi_mem, link) { + struct efi_mem_desc *cur; + struct efi_mem_desc *next; - cur = &lmem->desc; - prev = &prevmem->desc; - - if ((desc_get_end(cur) == prev->physical_start) && - (prev->type == cur->type) && - (prev->attribute == cur->attribute)) { - /* There is an existing map before, reuse it */ - pages = cur->num_pages; - prev->num_pages += pages; - prev->physical_start -= pages << EFI_PAGE_SHIFT; - prev->virtual_start -= pages << EFI_PAGE_SHIFT; - list_del(&lmem->link); - free(lmem); + /* Exit when we've got nothing to compare with */ + if (&nextmem->link == &efi_mem) + break; - merge_again = true; - break; - } + cur = &curmem->desc; + next = &nextmem->desc; - prevmem = lmem; + if ((cur->physical_start == desc_get_end(next)) && + (cur->type == next->type) && + (cur->attribute == next->attribute)) { + /* There is another similar map coming up, reuse it */ + next->num_pages += cur->num_pages; + list_del(&curmem->link); + free(curmem); } } } diff --git a/lib/efi_selftest/efi_selftest_memory.c b/lib/efi_selftest/efi_selftest_memory.c index 4d32a280061..7320964c129 100644 --- a/lib/efi_selftest/efi_selftest_memory.c +++ b/lib/efi_selftest/efi_selftest_memory.c @@ -60,7 +60,7 @@ static int find_in_memory_map(efi_uintn_t map_size, u64 addr, int memory_type) { efi_uintn_t i; - bool found = false; + struct efi_mem_desc *match = NULL; for (i = 0; map_size; ++i, map_size -= desc_size) { struct efi_mem_desc *entry = &memory_map[i]; @@ -72,24 +72,23 @@ static int find_in_memory_map(efi_uintn_t map_size, if (addr >= entry->physical_start && addr < entry->physical_start + - (entry->num_pages << EFI_PAGE_SHIFT)) { - if (found) { + (entry->num_pages << EFI_PAGE_SHIFT)) { + if (match) { efi_st_error("Duplicate memory map entry\n"); return EFI_ST_FAILURE; } - found = true; - if (memory_type != entry->type) { - efi_st_error - ("Wrong memory type %d, expected %d\n", - entry->type, memory_type); - return EFI_ST_FAILURE; - } + match = entry; } } - if (!found) { + if (!match) { efi_st_error("Missing memory map entry\n"); return EFI_ST_FAILURE; } + if (memory_type != match->type) { + efi_st_error("Wrong memory type %d, expected %d\n", match->type, + memory_type); + return EFI_ST_FAILURE; + } return EFI_ST_SUCCESS; } |
