[U-Boot] [PATCH v2 0/5] efi_loader: make more protocols customizable

The development target for the UEFI sub-system is EBBR compliance. We have already implemented some further protocols to enable running the UEFI Shell and the UEFI SCT test suite.
As some boards are severly memory constrained make some of these extras customizable.
Change the working of the EFI_LOADER and EFI_LOADER_HII config option.
Give the Kconfig menu more structure using if/endif.
v2 put the patches into a series add device path to text protocol configuration reword Kconfig menu entries
Heinrich Schuchardt (5): efi_loader: observe CONFIG_EFI_LOADER_HII efi_loader: format Kconfig efi_loader: reword the EFI_LOADER config option efi_loader: make Unicode collation protocol customizable efi_loader: make device path to text protocol customizable
cmd/Kconfig | 1 + lib/efi_loader/Kconfig | 69 ++++++++++++++++++++++------------ lib/efi_loader/Makefile | 6 +-- lib/efi_loader/efi_root_node.c | 4 ++ lib/efi_selftest/Makefile | 5 ++- lib/vsprintf.c | 4 +- 6 files changed, 58 insertions(+), 31 deletions(-)
-- 2.20.1

If EFI_LOADER_HII is not set, do not unnecessarily compile files for HII protocols.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 no change --- lib/efi_loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 4e90a35896..e6bbe43154 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -24,7 +24,7 @@ obj-y += efi_device_path.o obj-y += efi_device_path_to_text.o obj-y += efi_device_path_utilities.o obj-y += efi_file.o -obj-y += efi_hii.o efi_hii_config.o +obj-$(CONFIG_EFI_LOADER_HII) += efi_hii.o efi_hii_config.o obj-y += efi_image_loader.o obj-y += efi_memory.o obj-y += efi_root_node.o -- 2.20.1

Use if/endif for dependencies to give structure to the configuration menu.
Sort important settings to the top.
Abbreviate the short description of EFI_LOADER_HII.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 change the brief description for EFI_LOADER_HII --- lib/efi_loader/Kconfig | 43 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 50b050159c..03b082750f 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -16,9 +16,21 @@ config EFI_LOADER interfaces to a loaded EFI application, enabling it to reuse U-Boot's device drivers.
+if EFI_LOADER + +config EFI_LOADER_HII + bool "HII protocols" + default y + help + The Human Interface Infrastructure is a complicated framework that + allows UEFI applications to draw fancy menus and hook strings using + a translation framework. + + U-Boot implements enough of its features to be able to run the UEFI + Shell, but not more than that. + config EFI_UNICODE_CAPITALIZATION bool "Support Unicode capitalization" - depends on EFI_LOADER default y help Select this option to enable correct handling of the capitalization of @@ -26,33 +38,22 @@ config EFI_UNICODE_CAPITALIZATION set, only the the correct handling of the letters of the codepage used by the FAT file system is ensured.
-config EFI_PLATFORM_LANG_CODES - string "Language codes supported by firmware" - depends on EFI_LOADER - default "en-US" - help - This value is used to initialize the PlatformLangCodes variable. Its - value is a semicolon (;) separated list of language codes in native - RFC 4646 format, e.g. "en-US;de-DE". The first language code is used - to initialize the PlatformLang variable. - config EFI_LOADER_BOUNCE_BUFFER bool "EFI Applications use bounce buffers for DMA operations" - depends on EFI_LOADER && ARM64 + depends on ARM64 default n help Some hardware does not support DMA to full 64bit addresses. For this hardware we can create a bounce buffer so that payloads don't have to worry about platform details.
-config EFI_LOADER_HII - bool "Expose HII protocols to EFI applications" - depends on EFI_LOADER - default y +config EFI_PLATFORM_LANG_CODES + string "Language codes supported by firmware" + default "en-US" help - The Human Interface Infrastructure is a complicated framework that - allows UEFI applications to draw fancy menus and hook strings using - a translation framework. + This value is used to initialize the PlatformLangCodes variable. Its + value is a semicolon (;) separated list of language codes in native + RFC 4646 format, e.g. "en-US;de-DE". The first language code is used + to initialize the PlatformLang variable.
- U-Boot implements enough of its features to be able to run the UEFI - Shell, but not more than that. +endif -- 2.20.1

No need to mention U-Boot in brief description. Fix several typos, mention iPXE.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 new patch --- lib/efi_loader/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 03b082750f..2b7ac6855f 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -1,5 +1,5 @@ config EFI_LOADER - bool "Support running EFI Applications in U-Boot" + bool "Support running UEFI applications" depends on (ARM || X86 || RISCV || SANDBOX) && OF_LIBFDT # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT @@ -11,10 +11,10 @@ config EFI_LOADER select REGEX imply CFB_CONSOLE_ANSI help - Select this option if you want to run EFI applications (like grub2) - on top of U-Boot. If this option is enabled, U-Boot will expose EFI - interfaces to a loaded EFI application, enabling it to reuse U-Boot's - device drivers. + Select this option if you want to run UEFI applications (like GNU + GRUB or iPXE) on top of U-Boot. If this option is enabled, U-Boot + will expose the UEFI API to a loaded application, enabling it to + reuse U-Boot's device drivers.
if EFI_LOADER
-- 2.20.1

The Unicode collation protocol is not needed for EBBR compliance. So let's make it a customizable option.
The Unicode capitalization table is only needed by this protocol. So let it depend on the Unicode collation protocol.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 abbreviate short Kconfig description --- lib/efi_loader/Kconfig | 11 +++++++++++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_root_node.c | 2 ++ lib/efi_selftest/Makefile | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 2b7ac6855f..3feb04a5ed 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -29,6 +29,15 @@ config EFI_LOADER_HII U-Boot implements enough of its features to be able to run the UEFI Shell, but not more than that.
+config EFI_UNICODE_COLLATION_PROTOCOL + bool "Unicode collation protocol" + default y + help + The Unicode collation protocol is used for lexical comparisons. It is + required to run the UEFI shell. + +if EFI_UNICODE_COLLATION_PROTOCOL + config EFI_UNICODE_CAPITALIZATION bool "Support Unicode capitalization" default y @@ -38,6 +47,8 @@ config EFI_UNICODE_CAPITALIZATION set, only the the correct handling of the letters of the codepage used by the FAT file system is ensured.
+endif + config EFI_LOADER_BOUNCE_BUFFER bool "EFI Applications use bounce buffers for DMA operations" depends on ARM64 diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index e6bbe43154..2b1ae61a3d 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -30,7 +30,7 @@ obj-y += efi_memory.o obj-y += efi_root_node.o obj-y += efi_runtime.o obj-y += efi_setup.o -obj-y += efi_unicode_collation.o +obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_unicode_collation.o obj-y += efi_variable.o obj-y += efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index 38514e0820..f36ca3456e 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -58,9 +58,11 @@ efi_status_t efi_root_node_register(void) /* Device path utilities protocol */ &efi_guid_device_path_utilities_protocol, (void *)&efi_device_path_utilities, +#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL) /* Unicode collation protocol */ &efi_guid_unicode_collation_protocol, (void *)&efi_unicode_collation_protocol, +#endif #if CONFIG_IS_ENABLED(EFI_LOADER_HII) /* HII string protocol */ &efi_guid_hii_string_protocol, diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index c69ad7a9c0..7fdf189c5c 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -34,11 +34,12 @@ efi_selftest_textinput.o \ efi_selftest_textinputex.o \ efi_selftest_textoutput.o \ efi_selftest_tpl.o \ -efi_selftest_unicode_collation.o \ efi_selftest_util.o \ efi_selftest_variables.o \ efi_selftest_watchdog.o
+obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_selftest_unicode_collation.o + obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o
-- 2.20.1

The device path to text protocol is not needed for EBBR compliance. So let's make it a customizable option.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 new patch --- cmd/Kconfig | 1 + lib/efi_loader/Kconfig | 7 +++++++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_root_node.c | 2 ++ lib/efi_selftest/Makefile | 2 +- lib/vsprintf.c | 4 +++- 6 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig index fd1beb0684..0d36da2a5c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1436,6 +1436,7 @@ config CMD_DISPLAY config CMD_EFIDEBUG bool "efidebug - display/configure UEFI environment" depends on EFI_LOADER + select EFI_DEVICE_PATH_TO_TEXT default n help Enable the 'efidebug' command which provides a subset of UEFI diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 3feb04a5ed..6501ee56aa 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -18,6 +18,13 @@ config EFI_LOADER
if EFI_LOADER
+config EFI_DEVICE_PATH_TO_TEXT + bool "Device path to text protocol" + default y + help + The device path to text protocol converts device nodes and paths to + human readable strings. + config EFI_LOADER_HII bool "HII protocols" default y diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 2b1ae61a3d..f3d6773bf6 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -21,7 +21,7 @@ obj-y += efi_bootmgr.o obj-y += efi_boottime.o obj-y += efi_console.o obj-y += efi_device_path.o -obj-y += efi_device_path_to_text.o +obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o obj-y += efi_device_path_utilities.o obj-y += efi_file.o obj-$(CONFIG_EFI_LOADER_HII) += efi_hii.o efi_hii_config.o diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index f36ca3456e..d8496cc3c2 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -52,9 +52,11 @@ efi_status_t efi_root_node_register(void) (&efi_root, /* Device path protocol */ &efi_guid_device_path, dp, +#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) /* Device path to text protocol */ &efi_guid_device_path_to_text_protocol, (void *)&efi_device_path_to_text, +#endif /* Device path utilities protocol */ &efi_guid_device_path_utilities_protocol, (void *)&efi_device_path_utilities, diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 7fdf189c5c..d0bebc7d0c 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -17,7 +17,6 @@ efi_selftest_config_table.o \ efi_selftest_controllers.o \ efi_selftest_console.o \ efi_selftest_crc32.o \ -efi_selftest_devicepath.o \ efi_selftest_devicepath_util.o \ efi_selftest_events.o \ efi_selftest_event_groups.o \ @@ -38,6 +37,7 @@ efi_selftest_util.o \ efi_selftest_variables.o \ efi_selftest_watchdog.o
+obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_selftest_unicode_collation.o
obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 3502b8088f..8bbbd48c54 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -296,6 +296,7 @@ static char *string16(char *buf, char *end, u16 *s, int field_width, return buf; }
+#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) static char *device_path_string(char *buf, char *end, void *dp, int field_width, int precision, int flags) { @@ -314,6 +315,7 @@ static char *device_path_string(char *buf, char *end, void *dp, int field_width, return buf; } #endif +#endif
#ifdef CONFIG_CMD_NET static char *mac_address_string(char *buf, char *end, u8 *addr, int field_width, @@ -451,7 +453,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
switch (*fmt) { /* Device paths only exist in the EFI context. */ -#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD) +#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD) case 'D': return device_path_string(buf, end, ptr, field_width, precision, flags); -- 2.20.1
participants (1)
-
Heinrich Schuchardt