summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/Kconfig2
-rw-r--r--lib/efi_loader/efi_fdt.c3
-rw-r--r--lib/efi_loader/efi_helper.c2
-rw-r--r--lib/efi_loader/efi_memory.c33
-rw-r--r--lib/smbios.c9
5 files changed, 26 insertions, 23 deletions
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 38e64af2531..1179c31bb13 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -220,6 +220,7 @@ config EFI_CAPSULE_ON_DISK
config EFI_IGNORE_OSINDICATIONS
bool "Ignore OsIndications for CapsuleUpdate on-disk"
depends on EFI_CAPSULE_ON_DISK
+ default y if !EFI_RT_VOLATILE_STORE
help
There are boards where U-Boot does not support SetVariable at runtime.
Select this option if you want to use the capsule-on-disk feature
@@ -486,6 +487,7 @@ config EFI_ECPT
config EFI_EBBR_2_1_CONFORMANCE
bool "Add the EBBRv2.1 conformance entry to the ECPT table"
+ depends on BOOTMETH_EFI_BOOTMGR
depends on EFI_ECPT
depends on EFI_LOADER_HII
depends on EFI_RISCV_BOOT_PROTOCOL || !RISCV
diff --git a/lib/efi_loader/efi_fdt.c b/lib/efi_loader/efi_fdt.c
index 4ccf2055be3..c5ecade3aeb 100644
--- a/lib/efi_loader/efi_fdt.c
+++ b/lib/efi_loader/efi_fdt.c
@@ -43,6 +43,9 @@ int efi_get_distro_fdt_name(char *fname, int size, int seq)
case 2:
prefix = "/dtb/current";
break;
+ case 3:
+ prefix = "/dtbs";
+ break;
default:
return log_msg_ret("pref", -EINVAL);
}
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 348612c3dad..65d2116381a 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -133,7 +133,7 @@ efi_status_t efi_load_option_dp_join(struct efi_device_path **dp,
*dp = efi_dp_concat(tmp_dp, fdt_dp, *dp_size);
efi_free_pool(tmp_dp);
- if (!dp)
+ if (!*dp)
return EFI_OUT_OF_RESOURCES;
*dp_size += efi_dp_size(fdt_dp) + sizeof(END);
}
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 12cf23fa3fa..c6f1dd09456 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -127,7 +127,7 @@ static uint64_t desc_get_end(struct efi_mem_desc *desc)
*/
static void efi_mem_sort(void)
{
- struct list_head *lhandle;
+ struct efi_mem_list *lmem;
struct efi_mem_list *prevmem = NULL;
bool merge_again = true;
@@ -136,19 +136,18 @@ static void efi_mem_sort(void)
/* Now merge entries that can be merged */
while (merge_again) {
merge_again = false;
- list_for_each(lhandle, &efi_mem) {
- struct efi_mem_list *lmem;
- struct efi_mem_desc *prev = &prevmem->desc;
+ list_for_each_entry(lmem, &efi_mem, link) {
+ struct efi_mem_desc *prev;
struct efi_mem_desc *cur;
uint64_t pages;
- lmem = list_entry(lhandle, struct efi_mem_list, link);
if (!prevmem) {
prevmem = lmem;
continue;
}
cur = &lmem->desc;
+ prev = &prevmem->desc;
if ((desc_get_end(cur) == prev->physical_start) &&
(prev->type == cur->type) &&
@@ -268,7 +267,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
int memory_type,
bool overlap_only_ram)
{
- struct list_head *lhandle;
+ struct efi_mem_list *lmem;
struct efi_mem_list *newlist;
bool carve_again;
uint64_t carved_pages = 0;
@@ -308,11 +307,9 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
/* Add our new map */
do {
carve_again = false;
- list_for_each(lhandle, &efi_mem) {
- struct efi_mem_list *lmem;
+ list_for_each_entry(lmem, &efi_mem, link) {
s64 r;
- lmem = list_entry(lhandle, struct efi_mem_list, link);
r = efi_mem_carve_out(lmem, &newlist->desc,
overlap_only_ram);
switch (r) {
@@ -444,7 +441,7 @@ static efi_status_t efi_check_allocated(u64 addr, bool must_be_allocated)
*/
static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr)
{
- struct list_head *lhandle;
+ struct efi_mem_list *lmem;
/*
* Prealign input max address, so we simplify our matching
@@ -452,9 +449,7 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr)
*/
max_addr &= ~EFI_PAGE_MASK;
- list_for_each(lhandle, &efi_mem) {
- struct efi_mem_list *lmem = list_entry(lhandle,
- struct efi_mem_list, link);
+ list_for_each_entry(lmem, &efi_mem, link) {
struct efi_mem_desc *desc = &lmem->desc;
uint64_t desc_len = desc->num_pages << EFI_PAGE_SHIFT;
uint64_t desc_end = desc->physical_start + desc_len;
@@ -742,9 +737,9 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
efi_uintn_t *descriptor_size,
uint32_t *descriptor_version)
{
+ size_t map_entries;
efi_uintn_t map_size = 0;
- int map_entries = 0;
- struct list_head *lhandle;
+ struct efi_mem_list *lmem;
efi_uintn_t provided_map_size;
if (!memory_map_size)
@@ -752,8 +747,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
provided_map_size = *memory_map_size;
- list_for_each(lhandle, &efi_mem)
- map_entries++;
+ map_entries = list_count_nodes(&efi_mem);
map_size = map_entries * sizeof(struct efi_mem_desc);
@@ -774,10 +768,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
/* Copy list into array */
/* Return the list in ascending order */
memory_map = &memory_map[map_entries - 1];
- list_for_each(lhandle, &efi_mem) {
- struct efi_mem_list *lmem;
-
- lmem = list_entry(lhandle, struct efi_mem_list, link);
+ list_for_each_entry(lmem, &efi_mem, link) {
*memory_map = lmem->desc;
memory_map--;
}
diff --git a/lib/smbios.c b/lib/smbios.c
index 4126466e34a..7c24ea129eb 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -22,6 +22,7 @@
#include <cpu.h>
#include <dm/uclass-internal.h>
#endif
+#include <linux/sizes.h>
/* Safeguard for checking that U_BOOT_VERSION_NUM macros are compatible with U_BOOT_DMI */
#if U_BOOT_VERSION_NUM < 2000 || U_BOOT_VERSION_NUM > 2099 || \
@@ -348,7 +349,13 @@ static int smbios_write_type0(ulong *current, int handle,
#endif
t->bios_release_date = smbios_add_prop(ctx, NULL, U_BOOT_DMI_DATE);
#ifdef CONFIG_ROM_SIZE
- t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1;
+ if (CONFIG_ROM_SIZE < SZ_16M) {
+ t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1;
+ } else {
+ /* CONFIG_ROM_SIZE < 8 GiB */
+ t->bios_rom_size = 0xff;
+ t->extended_bios_rom_size = CONFIG_ROM_SIZE >> 20;
+ }
#endif
t->bios_characteristics = BIOS_CHARACTERISTICS_PCI_SUPPORTED |
BIOS_CHARACTERISTICS_SELECTABLE_BOOT |