summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-05-06 08:45:57 -0600
committerTom Rini <[email protected]>2026-05-06 08:45:57 -0600
commit8399b039b038e72ff51640c61dd762f3368306f5 (patch)
tree7e867e3b37c9ddc9837c3417b1362d3bd84c247e
parent980f8a4589626ca2b9c6c5f74eefe72f4b5606c6 (diff)
parentb1c28ad5fafd95c183b26165e498354db41b755b (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
-rw-r--r--include/efi_config.h4
-rw-r--r--include/lmb.h30
-rw-r--r--lib/efi_loader/efi_device_path.c4
-rw-r--r--lib/efi_loader/efi_dt_fixup.c3
-rw-r--r--lib/efi_loader/efi_memory.c47
-rw-r--r--lib/efi_selftest/efi_selftest_memory.c21
6 files changed, 56 insertions, 53 deletions
diff --git a/include/efi_config.h b/include/efi_config.h
index 23211e799fc..bff77a5f961 100644
--- a/include/efi_config.h
+++ b/include/efi_config.h
@@ -24,7 +24,7 @@ typedef efi_status_t (*eficonfig_entry_func)(void *data);
*
* @num: menu entry index
* @title: title of entry
- * @key: unique key
+ * @key: unique key, takes a number up to EFICONFIG_ENTRY_NUM_MAX - 1
* @efi_menu: pointer to the menu structure
* @func: callback function to be called when this entry is selected
* @data: data to be passed to the callback function, caller must free() this pointer
@@ -33,7 +33,7 @@ typedef efi_status_t (*eficonfig_entry_func)(void *data);
struct eficonfig_entry {
u32 num;
char *title;
- char key[3];
+ char key[11];
struct efimenu *efi_menu;
eficonfig_entry_func func;
void *data;
diff --git a/include/lmb.h b/include/lmb.h
index 5d5f037ccb9..ed472e9ef2e 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -19,16 +19,36 @@
#define LMB_ALIST_INITIAL_SIZE 4
/**
- * DOC: Memory region attribute flags.
+ * define LMB_NONE - no special request
*
- * %LMB_NONE: No special request
- * %LMB_NOMAP: Don't add to MMU configuration
- * %LMB_NOOVERWRITE: The memory region cannot be overwritten/re-reserved
- * %LMB_NONOTIFY: Do not notify other modules of changes to this memory region
+ * LMB Memory region attribute flag to indicate that there are no special
+ * requests for this region. Normally used as a placeholder value.
*/
#define LMB_NONE 0
+
+/**
+ * define LMB_NOMAP - do not add to MMU configuration
+ *
+ * LMB Memory region attribute flag to indicate that the region will not be
+ * mapped by LMB. Normally used for reserved regions.
+ */
#define LMB_NOMAP BIT(1)
+
+/**
+ * define LMB_NOOVERWRITE - do not overwrite/re-reserve
+ *
+ * LMB Memory region attribute flag to indicate that the region will not be
+ * overwritten or re-reserved. Normally used for reserved regions.
+ */
#define LMB_NOOVERWRITE BIT(2)
+
+/**
+ * define LMB_NONOTIFY - do not notify other modules of changes
+ *
+ * LMB Memory region attribute flag to indicate that the region will not notify
+ * downstream allocators (currently just the EFI allocator) of changes to this
+ * region through lmb_map_update_notify().
+ */
#define LMB_NONOTIFY BIT(3)
/**
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;
+ list_for_each_entry_safe(curmem, nextmem, &efi_mem, link) {
+ struct efi_mem_desc *cur;
+ struct efi_mem_desc *next;
- if (!prevmem) {
- prevmem = lmem;
- continue;
- }
+ /* Exit when we've got nothing to compare with */
+ if (&nextmem->link == &efi_mem)
+ break;
- 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);
-
- 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;
}