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
This commit is contained in:
Tom Rini
2026-05-06 08:45:57 -06:00
6 changed files with 56 additions and 53 deletions

View File

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

View File

@@ -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)
/**

View File

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

View File

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

View File

@@ -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;
cur = &curmem->desc;
next = &nextmem->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;
}
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);
}
}
}

View File

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