summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/Kconfig19
-rw-r--r--lib/efi_loader/efi_bootbin.c7
-rw-r--r--lib/efi_loader/efi_bootmgr.c7
-rw-r--r--lib/efi_loader/efi_console.c10
-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_loader/efi_setup.c2
-rw-r--r--lib/efi_loader/efi_var_sf.c5
9 files changed, 47 insertions, 57 deletions
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index b5f81e0ff53..4cb13ae7c8a 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -102,8 +102,7 @@ config EFI_SET_TIME
can be used by an EFI application to adjust the real time clock.
config EFI_HAVE_RUNTIME_RESET
- # bool "Reset runtime service is available"
- bool
+ bool "Reset runtime service"
default y
depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
SANDBOX || SYSRESET_SBI || SYSRESET_X86
@@ -517,7 +516,7 @@ config EFI_RISCV_BOOT_PROTOCOL
config EFI_IP4_CONFIG2_PROTOCOL
bool "EFI_IP4_CONFIG2_PROTOCOL support"
default y if ARCH_QEMU || SANDBOX
- depends on NET || NET_LWIP
+ depends on NET
help
Provides an implementation of the EFI_IP4_CONFIG2_PROTOCOL, this
protocol can be used to set and get the current ip address and
@@ -576,6 +575,17 @@ config EFI_EBBR_2_1_CONFORMANCE
help
Enabling this option adds the EBBRv2.1 conformance entry to the ECPT UEFI table.
+config EFI_CONSOLE_DISABLE_ANSI
+ bool "Disable ANSI escape sequence queries for console size"
+ help
+ Select this option to disable ANSI escape sequence queries for
+ detecting serial console size. When enabled,
+ efi_setup_console_size() will not send ANSI escape sequences to
+ the terminal and will use default 25x80 dimensions instead.
+ This is useful for platforms where the serial console cannot
+ properly handle ANSI queries, causing boot delays or garbled
+ output.
+
config EFI_SCROLL_ON_CLEAR_SCREEN
bool "Avoid overwriting previous output on clear screen"
help
@@ -599,7 +609,8 @@ config EFI_BOOTMGR
config EFI_HTTP_BOOT
bool "EFI HTTP Boot support"
- depends on NET || NET_LWIP
+ depends on NET
+ depends on CMDLINE
select CMD_NET
select CMD_DHCP
select CMD_DNS
diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
index b394f0d60ce..12db8f517c7 100644
--- a/lib/efi_loader/efi_bootbin.c
+++ b/lib/efi_loader/efi_bootbin.c
@@ -224,11 +224,8 @@ static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- return -1;
- }
+ if (ret != EFI_SUCCESS)
+ return ret;
ret = efi_install_fdt(fdt);
if (ret != EFI_SUCCESS)
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index a687f4d8e85..8c9a9b5eb56 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -1310,11 +1310,8 @@ efi_status_t efi_bootmgr_run(void *fdt)
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- return CMD_RET_FAILURE;
- }
+ if (ret != EFI_SUCCESS)
+ return ret;
ret = efi_bootmgr_load(&handle, &load_options);
if (ret != EFI_SUCCESS) {
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 068d1a0a7b7..8d076058280 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -9,6 +9,7 @@
#include <ansi.h>
#include <charset.h>
+#include <console.h>
#include <efi_device_path.h>
#include <malloc.h>
#include <time.h>
@@ -299,8 +300,7 @@ static int query_console_serial(int *rows, int *cols)
int n[2];
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
/*
* Not all terminals understand CSI [18t for querying the console size.
@@ -365,6 +365,9 @@ void efi_setup_console_size(void)
int rows = 25, cols = 80;
int ret = -ENODEV;
+ if (IS_ENABLED(CONFIG_EFI_CONSOLE_DISABLE_ANSI))
+ efi_console_set_ansi(false);
+
if (IS_ENABLED(CONFIG_VIDEO))
ret = query_vidconsole(&rows, &cols);
if (ret) {
@@ -957,8 +960,7 @@ static void efi_cin_check(void)
*/
static void efi_cin_empty_buffer(void)
{
- while (tstc())
- getchar();
+ console_flush_stdin();
key_available = false;
}
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_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index f06cf49e443..f302bb62ab9 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -392,5 +392,7 @@ efi_status_t efi_init_obj_list(void)
ret = efi_start_obj_list();
out:
efi_obj_list_initialized = ret;
+ if (ret != EFI_SUCCESS)
+ log_err("Cannot initialize UEFI sub-system\n");
return ret;
}
diff --git a/lib/efi_loader/efi_var_sf.c b/lib/efi_loader/efi_var_sf.c
index 6eae8d46464..b84ec8e67dc 100644
--- a/lib/efi_loader/efi_var_sf.c
+++ b/lib/efi_loader/efi_var_sf.c
@@ -98,11 +98,8 @@ efi_status_t efi_var_from_storage(void)
goto error;
}
- if (efi_var_restore(buf, false) != EFI_SUCCESS) {
+ if (efi_var_restore(buf, false) != EFI_SUCCESS)
log_err("No valid EFI variables in SPI Flash\n");
- ret = EFI_DEVICE_ERROR;
- goto error;
- }
ret = EFI_SUCCESS;
error: