From 2ea957952362fe9238cbf3996c001f8bf3f04701 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 28 May 2025 10:03:14 -0600 Subject: efi: Rename the lib/efi directory This directory was created when U-Boot gained the ability to run as an EFI app in 2015. Since then the EFI-loader feature has been added. The code in lib/efi is not actually used by the loader, so the name is confusing. Rename the directory to efi_client to indicate that it includes files just for U-Boot being a client of EFI, i.e. the EFI app and stub. Signed-off-by: Simon Glass --- doc/develop/uefi/u-boot_on_efi.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/develop') diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index 245b4af1fa3..42e84c13049 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -113,7 +113,7 @@ implemented completely differently. EFI Application ~~~~~~~~~~~~~~~ For the application the whole of U-Boot is built as a shared library. The -efi_main() function is in lib/efi/efi_app.c. It sets up some basic EFI +efi_main() function is in lib/efi_client/efi_app.c. It sets up some basic EFI functions with efi_init(), sets up U-Boot global_data, allocates memory for U-Boot's malloc(), etc. and enters the normal init sequence (board_init_f() and board_init_r()). @@ -149,7 +149,7 @@ image (including device tree) into a small EFI stub application responsible for booting it. The stub application is built as a normal EFI application except that it has a lot of data attached to it. -The stub application is implemented in lib/efi/efi_stub.c. The efi_main() +The stub application is implemented in lib/efi_client/efi_stub.c. The efi_main() function is called by EFI. It is responsible for copying U-Boot from its original location into memory, disabling EFI boot services and starting U-Boot. U-Boot then starts as normal, relocates, starts all drivers, etc. @@ -192,7 +192,7 @@ careful to build the correct one so that your UEFI firmware can start it. Most UEFI images are 64-bit at present. The payload stub can be build as either 32- or 64-bits. Only a small amount -of code is built this way (see the extra- line in lib/efi/Makefile). +of code is built this way (see the extra- line in lib/efi_client/Makefile). Everything else is built as a normal U-Boot, so is always 32-bit on x86 at present. @@ -353,7 +353,7 @@ This work could be extended in a number of ways: Where is the code? ------------------ -lib/efi +lib/efi_client payload stub, application, support code. Mostly arch-neutral arch/x86/cpu/efi -- cgit v1.3.1 From 0029f2447bd4fac23d0ec6107c0b911c50c2c334 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 28 May 2025 10:03:15 -0600 Subject: efi: Rename CONFIG_EFI to CONFIG_EFI_CLIENT The generic name 'EFI' would be more useful for common EFI features. At present it just refers to the EFI app and stub, which is confusing. Rename it to EFI_CLIENT Signed-off-by: Simon Glass --- arch/x86/Kconfig | 6 +++--- arch/x86/cpu/Makefile | 2 +- arch/x86/cpu/efi/Kconfig | 2 +- arch/x86/cpu/x86_64/Makefile | 2 +- cmd/Makefile | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/efi-x86_payload32_defconfig | 2 +- configs/efi-x86_payload64_defconfig | 2 +- doc/develop/uefi/u-boot_on_efi.rst | 6 +++--- drivers/block/Kconfig | 2 +- include/init.h | 2 +- lib/Kconfig | 2 +- lib/Makefile | 2 +- lib/efi_client/Kconfig | 4 ++-- lib/uuid.c | 4 ++-- 16 files changed, 22 insertions(+), 22 deletions(-) (limited to 'doc/develop') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6ca0605466f..5aa134b6bcb 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -368,7 +368,7 @@ config USE_HOB config HAVE_FSP bool "Add an Firmware Support Package binary" - depends on !EFI + depends on !EFI_CLIENT select USE_HOB select HAS_ROM help @@ -517,7 +517,7 @@ config FSP_BROKEN_HOB config ENABLE_MRC_CACHE bool "Enable MRC cache" - depends on !EFI && !SYS_COREBOOT + depends on !EFI_CLIENT && !SYS_COREBOOT help Enable this feature to cause MRC data to be cached in NV storage to be used for speeding up boot time on future reboots and/or @@ -756,7 +756,7 @@ config HAVE_P2SB devices. menu "System tables" - depends on !EFI && !SYS_COREBOOT + depends on !EFI_CLIENT && !SYS_COREBOOT config GENERATE_PIRQ_TABLE bool "Generate a PIRQ table" diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index cc55c8fa39c..5150edb833f 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -47,7 +47,7 @@ obj-$(CONFIG_INTEL_BRASWELL) += braswell/ obj-$(CONFIG_INTEL_BROADWELL) += broadwell/ obj-$(CONFIG_SYS_COREBOOT) += coreboot/ obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/ -obj-$(CONFIG_EFI) += efi/ +obj-$(CONFIG_EFI_CLIENT) += efi/ obj-$(CONFIG_QEMU) += qemu/ obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/ obj-$(CONFIG_INTEL_QUARK) += quark/ diff --git a/arch/x86/cpu/efi/Kconfig b/arch/x86/cpu/efi/Kconfig index e0975d34d36..f5288013a8a 100644 --- a/arch/x86/cpu/efi/Kconfig +++ b/arch/x86/cpu/efi/Kconfig @@ -1,4 +1,4 @@ -if EFI +if EFI_CLIENT config SYS_CAR_ADDR hex diff --git a/arch/x86/cpu/x86_64/Makefile b/arch/x86/cpu/x86_64/Makefile index e929563b2c1..cb23c071aa3 100644 --- a/arch/x86/cpu/x86_64/Makefile +++ b/arch/x86/cpu/x86_64/Makefile @@ -5,6 +5,6 @@ obj-y += cpu.o interrupts.o setjmp.o -ifndef CONFIG_EFI +ifndef CONFIG_EFI_CLIENT obj-y += misc.o endif diff --git a/cmd/Makefile b/cmd/Makefile index e4ecf2e0493..12e948fd1b9 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -67,7 +67,7 @@ obj-$(CONFIG_CMD_EXTENSION) += extension_board.o obj-$(CONFIG_CMD_ECHO) += echo.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o obj-$(CONFIG_CMD_EEPROM) += eeprom.o -obj-$(CONFIG_EFI) += efi.o efi_common.o +obj-$(CONFIG_EFI_CLIENT) += efi.o efi_common.o obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o efi_common.o obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o ifdef CONFIG_CMD_EFICONFIG diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig index 71d1bbd956e..a06f1ccfe2a 100644 --- a/configs/efi-x86_app32_defconfig +++ b/configs/efi-x86_app32_defconfig @@ -7,7 +7,7 @@ CONFIG_DEBUG_UART_CLOCK=0 CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_APP32=y CONFIG_DEBUG_UART=y -CONFIG_EFI=y +CONFIG_EFI_CLIENT=y CONFIG_FIT=y # CONFIG_BOOTSTD is not set CONFIG_SHOW_BOOT_PROGRESS=y diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 9f7b53d0106..9bcf5162b50 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -8,7 +8,7 @@ CONFIG_X86_RUN_64BIT=y CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_APP64=y CONFIG_DEBUG_UART=y -CONFIG_EFI=y +CONFIG_EFI_CLIENT=y CONFIG_EFI_APP_64BIT=y CONFIG_FIT=y # CONFIG_BOOTSTD is not set diff --git a/configs/efi-x86_payload32_defconfig b/configs/efi-x86_payload32_defconfig index e9c5ddf12ad..ce9b7ff939d 100644 --- a/configs/efi-x86_payload32_defconfig +++ b/configs/efi-x86_payload32_defconfig @@ -5,7 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload" CONFIG_PRE_CON_BUF_ADDR=0x100000 CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_PAYLOAD=y -CONFIG_EFI=y +CONFIG_EFI_CLIENT=y CONFIG_EFI_STUB=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig index b82e10dc3a1..6ce00189886 100644 --- a/configs/efi-x86_payload64_defconfig +++ b/configs/efi-x86_payload64_defconfig @@ -5,7 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload" CONFIG_PRE_CON_BUF_ADDR=0x100000 CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_PAYLOAD=y -CONFIG_EFI=y +CONFIG_EFI_CLIENT=y CONFIG_EFI_STUB=y CONFIG_EFI_STUB_64BIT=y CONFIG_FIT=y diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index 42e84c13049..9068894e408 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -45,7 +45,7 @@ First choose a board that has EFI support and obtain an EFI implementation for that board. It will be either 32-bit or 64-bit. Alternatively, you can opt for using QEMU [1] and the OVMF [2], as detailed below. -To build U-Boot as an EFI application, enable CONFIG_EFI and CONFIG_EFI_APP. +To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and CONFIG_EFI_APP. The efi-x86_app32 and efi-x86_app64 configs are set up for this. Just build U-Boot as normal, e.g.:: @@ -53,7 +53,7 @@ U-Boot as normal, e.g.:: make To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), enable -CONFIG_EFI, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or +CONFIG_EFI_CLIENT, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or CONFIG_EFI_STUB_64BIT. The efi-x86_payload configs (efi-x86_payload32_defconfig and efi-x86_payload32_defconfig) are set up for this. Then build U-Boot as normal, e.g.:: @@ -121,7 +121,7 @@ and board_init_r()). Since U-Boot limits its memory access to the allocated regions very little special code is needed. The CONFIG_EFI_APP option controls a few things that need to change so 'git grep CONFIG_EFI_APP' may be instructive. -The CONFIG_EFI option controls more general EFI adjustments. +The CONFIG_EFI_CLIENT option controls more general EFI adjustments. The only available driver is the serial driver. This calls back into EFI 'boot services' to send and receive characters. Although it is implemented diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 750b0bd2082..c6c148ebd17 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -96,7 +96,7 @@ config TPL_BLOCK_CACHE config EFI_MEDIA bool "Support EFI media drivers" - default y if EFI || SANDBOX + default y if EFI_CLIENT || SANDBOX select BLK help Enable this to support media devices on top of UEFI. This enables diff --git a/include/init.h b/include/init.h index 2c10171359c..1e375da4893 100644 --- a/include/init.h +++ b/include/init.h @@ -18,7 +18,7 @@ * In case of the EFI app the UEFI firmware provides the low-level * initialisation. */ -#ifdef CONFIG_EFI +#ifdef CONFIG_EFI_CLIENT #define ll_boot_init() false #else #include diff --git a/lib/Kconfig b/lib/Kconfig index 6a89f797bef..fbc9de90669 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1096,7 +1096,7 @@ config VPL_OF_LIBFDT_ASSUME_MASK unsafe execution. See FDT_ASSUME_PERFECT, etc. in libfdt_internal.h menu "System tables" - depends on (!EFI && !SYS_COREBOOT) || (ARM && EFI_LOADER) + depends on (!EFI_CLIENT && !SYS_COREBOOT) || (ARM && EFI_LOADER) config BLOBLIST_TABLES bool "Put tables in a bloblist" diff --git a/lib/Makefile b/lib/Makefile index 1dd738a7cd1..2643bfc867c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -5,7 +5,7 @@ ifndef CONFIG_XPL_BUILD -obj-$(CONFIG_EFI) += efi_client/ +obj-$(CONFIG_EFI_CLIENT) += efi_client/ obj-$(CONFIG_EFI_LOADER) += efi_driver/ obj-$(CONFIG_EFI_LOADER) += efi_loader/ obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ diff --git a/lib/efi_client/Kconfig b/lib/efi_client/Kconfig index 81ed3e66b34..ec413639bfe 100644 --- a/lib/efi_client/Kconfig +++ b/lib/efi_client/Kconfig @@ -1,7 +1,7 @@ menu "U-Boot as UEFI application" depends on X86 -config EFI +config EFI_CLIENT bool "Support running U-Boot from EFI" depends on X86 imply X86_TSC_READ_BASE @@ -13,7 +13,7 @@ config EFI choice prompt "Select EFI mode to use" - depends on X86 && EFI + depends on X86 && EFI_CLIENT config EFI_APP bool "Support running as an EFI application" diff --git a/lib/uuid.c b/lib/uuid.c index a1c88b9a622..8d99b540d9f 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -94,7 +94,7 @@ static const struct { "system", "EFI System Partition", PARTITION_SYSTEM_GUID, }, -#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI) +#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT) { NULL, "Device Path", PARTITION_SYSTEM_GUID, @@ -281,7 +281,7 @@ static const struct { EFI_CERT_TYPE_PKCS7_GUID, }, #endif -#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI) +#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT) { "EFI_LZMA_COMPRESSED", NULL, EFI_LZMA_COMPRESSED }, { "EFI_DXE_SERVICES", NULL, EFI_DXE_SERVICES }, { "EFI_HOB_LIST", NULL, EFI_HOB_LIST }, -- cgit v1.3.1 From 81ce639e61c990e4d3b88cc975bf552e8b509090 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 28 May 2025 10:03:16 -0600 Subject: efi: Create a new CONFIG_EFI Create a Kconfig which indicates that EFI functionality is in use, either as a client (EFI app / stub) or provider (EFI loader). This will make it easier to share code between these two parts of U-Boot Signed-off-by: Simon Glass --- doc/develop/uefi/u-boot_on_efi.rst | 6 +++--- lib/efi/Kconfig | 12 ++++++++++++ lib/efi_client/Kconfig | 1 + lib/efi_loader/Kconfig | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 lib/efi/Kconfig (limited to 'doc/develop') diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index 9068894e408..177e887ebd9 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -45,9 +45,9 @@ First choose a board that has EFI support and obtain an EFI implementation for that board. It will be either 32-bit or 64-bit. Alternatively, you can opt for using QEMU [1] and the OVMF [2], as detailed below. -To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and CONFIG_EFI_APP. -The efi-x86_app32 and efi-x86_app64 configs are set up for this. Just build -U-Boot as normal, e.g.:: +To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and +CONFIG_EFI_APP. The efi-x86_app32 and efi-x86_app64 configs are set up for +this. Just build U-Boot as normal, e.g.:: make efi-x86_app32_defconfig make diff --git a/lib/efi/Kconfig b/lib/efi/Kconfig new file mode 100644 index 00000000000..fc6d5b6d6c2 --- /dev/null +++ b/lib/efi/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright 2025 Simon Glass +# + +config EFI + bool + help + Indicates that EFI functionality is enabled, either via EFI_CLIENT or + EFI_LOADER + + This is used to provide libraries shared by both. diff --git a/lib/efi_client/Kconfig b/lib/efi_client/Kconfig index ec413639bfe..723c98d2a75 100644 --- a/lib/efi_client/Kconfig +++ b/lib/efi_client/Kconfig @@ -5,6 +5,7 @@ config EFI_CLIENT bool "Support running U-Boot from EFI" depends on X86 imply X86_TSC_READ_BASE + select EFI help U-Boot can be started from EFI on certain platforms. This allows EFI to perform most of the system init and then jump to U-Boot for diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 250b9469134..c2aa88f59fb 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -16,6 +16,7 @@ config EFI_LOADER depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT depends on !EFI_APP default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8 + select EFI select CHARSET # We need to send DM events, dynamically, in the EFI block driver select DM_EVENT @@ -597,4 +598,6 @@ endif source "lib/efi_client/Kconfig" +source "lib/efi/Kconfig" + endmenu -- cgit v1.3.1