From 68bd3456689bceecba23707b9b73d63b2a501f53 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 31 Jul 2024 10:13:04 +0200 Subject: [PATCH 1/5] efi_loader: use list_count_nodes() in efi_protocols_per_handle() Simplify the code by using the list_count_nodes() function. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index eedc5f39549..4f52284b4c6 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2509,16 +2509,12 @@ static efi_status_t EFIAPI efi_protocols_per_handle( return EFI_EXIT(EFI_INVALID_PARAMETER); *protocol_buffer = NULL; - *protocol_buffer_count = 0; efiobj = efi_search_obj(handle); if (!efiobj) return EFI_EXIT(EFI_INVALID_PARAMETER); - /* Count protocols */ - list_for_each(protocol_handle, &efiobj->protocols) { - ++*protocol_buffer_count; - } + *protocol_buffer_count = list_count_nodes(&efiobj->protocols); /* Copy GUIDs */ if (*protocol_buffer_count) { From 751e5bfdb531aa3093e02d616a4f0bce701e8b50 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 7 Aug 2024 00:11:38 +0200 Subject: [PATCH 2/5] efi_loader: correct description of efi_get_distro_fdt_name Use the correct function name. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_fdt.c b/lib/efi_loader/efi_fdt.c index c5ecade3aeb..f882622fdad 100644 --- a/lib/efi_loader/efi_fdt.c +++ b/lib/efi_loader/efi_fdt.c @@ -14,7 +14,7 @@ #include /** - * distro_efi_get_fdt_name() - get the filename for reading the .dtb file + * efi_get_distro_fdt_name() - get the filename for reading the .dtb file * * @fname: buffer for filename * @size: buffer size From ed3ce65958ceb5a7045748e329f4e1dbef5e99e9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 7 Aug 2024 02:13:45 +0200 Subject: [PATCH 3/5] boot: set correct block device name in set_efi_bootdev() For SATA devices the class name is 'ahci' but the block device name is 'sata'. Use function blk_get_uclass_name() to retrieve the correct string. Signed-off-by: Heinrich Schuchardt Reviewed-by: Mattijs Korpershoek Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- boot/bootmeth_efi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 39232eb2e25..6b41c0999f1 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -100,11 +100,10 @@ static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow) if (last_slash) *last_slash = '\0'; - log_debug("setting bootdev %s, %s, %s, %p, %x\n", - dev_get_uclass_name(media_dev), devnum_str, bflow->fname, - bflow->buf, size); dev_name = device_get_uclass_id(media_dev) == UCLASS_MASS_STORAGE ? - "usb" : dev_get_uclass_name(media_dev); + "usb" : blk_get_uclass_name(device_get_uclass_id(media_dev)); + log_debug("setting bootdev %s, %s, %s, %p, %x\n", + dev_name, devnum_str, bflow->fname, bflow->buf, size); efi_set_bootdev(dev_name, devnum_str, bflow->fname, bflow->buf, size); } From 02214c8b9dd879ed31973e865a2968167a3a95f5 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Wed, 7 Aug 2024 16:00:09 +0300 Subject: [PATCH 4/5] configs: enable efidebug and EFI http boot on QEMU aarch64 EFI HTTP is a useful option to have by default and is working reliably on QEMU. Let's enable it by default, since we have no size limitations. While at it enable 'efidebug' as well, which is currently needed to configure the EFI HTTP boot options. Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- configs/qemu_arm64_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig index 7e166f43908..088ba39f18e 100644 --- a/configs/qemu_arm64_defconfig +++ b/configs/qemu_arm64_defconfig @@ -33,6 +33,7 @@ CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_DFU=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y +CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_TPM=y CONFIG_CMD_MTDPARTS=y CONFIG_ENV_IS_IN_FLASH=y @@ -68,3 +69,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_SEMIHOSTING=y CONFIG_TPM=y +CONFIG_EFI_HTTP_BOOT=y From 2956a84ba70176333743773c9a2bf0353add65c9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 2 Aug 2024 15:50:23 +0200 Subject: [PATCH 5/5] Makefile: don't use CFLAGS for environment text file We use KCPPFLAGS to let the user set flags when invoking the C precompiler. These should also be used when generating the environment text file. Reported-by: Dave Jones Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2861b4d1402..21aa068ca71 100644 --- a/Makefile +++ b/Makefile @@ -1839,7 +1839,7 @@ ENV_FILE := $(if $(ENV_SOURCE_FILE),$(ENV_FILE_CFG),$(wildcard $(ENV_FILE_BOARD) quiet_cmd_gen_envp = ENVP $@ cmd_gen_envp = \ if [ -s "$(ENV_FILE)" ]; then \ - $(CPP) -P $(CFLAGS) -x assembler-with-cpp -undef \ + $(CPP) -P $(cpp_flags) -x assembler-with-cpp -undef \ -D__ASSEMBLY__ \ -D__UBOOT_CONFIG__ \ -I . -I include -I $(srctree)/include \