[PATCH v3 04/35] x86: Create a 32/64-bit selection for the app

Simon Glass sjg at chromium.org
Tue Oct 26 05:30:27 CEST 2021


Most EFI implementations use 64-bit but U-Boot only supports running as
a 32-bit app at present. While efi-x86_payload64 does boot from 64-bit
UEFI it immediately changes back to 32-bit before starting U-Boot.

In order to support a 64-bit U-Boot app, update the Kconfig to add an
option for 32/64 bit. Update the prompt for the existing option so it is
clear it relates to the stub. Move both up to just under the choice that
controls them, since this looks better and the menu.

Use CONFIG_EFI_APP in the Makefile instead of CONFIG_TARGET_EFI_APP,
since the latter is specific to a single target and we will have two.

Memory size is set to 32MB for now so that it can run on qemu without
increasing the default memory size. We may need to increase the default
later.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Update minimum RAM to 256MB!

Changes in v2:
- Expand the commit message to make things clearer

 arch/x86/cpu/intel_common/Makefile |  2 +-
 lib/efi/Kconfig                    | 34 +++++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/arch/x86/cpu/intel_common/Makefile b/arch/x86/cpu/intel_common/Makefile
index 8b9a810f66d..1dc17b45879 100644
--- a/arch/x86/cpu/intel_common/Makefile
+++ b/arch/x86/cpu/intel_common/Makefile
@@ -27,7 +27,7 @@ obj-y += fast_spi.o
 obj-y += lpc.o
 obj-y += lpss.o
 obj-$(CONFIG_$(SPL_)INTEL_GENERIC_WIFI) += generic_wifi.o
-ifndef CONFIG_TARGET_EFI_APP
+ifndef CONFIG_EFI_APP
 obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o
 ifndef CONFIG_$(SPL_)X86_64
 obj-y += microcode.o
diff --git a/lib/efi/Kconfig b/lib/efi/Kconfig
index 93b85644920..15ce99e1a74 100644
--- a/lib/efi/Kconfig
+++ b/lib/efi/Kconfig
@@ -26,18 +26,26 @@ config EFI_STUB
 
 endchoice
 
-config EFI_RAM_SIZE
-	hex "Amount of EFI RAM for U-Boot"
+choice
+	prompt "EFI app 32/64-bit selection"
 	depends on EFI_APP
-	default 0x2000000
 	help
-	  Set the amount of EFI RAM which is claimed by U-Boot for its own
-	  use. U-Boot allocates this from EFI on start-up (along with a few
-	  other smaller amounts) and it can never be increased after that.
-	  It is used as the RAM size in with U-Boot.
+	  EFI does not support mixing 32-bit and 64-bit modes. This is a
+	  significant problem because it means that you must build a stub with
+	  the correct type for EFI to load it correctly. If you are using
+	  32-bit EFI, select 32-bit here, else select 64-bit. Failure to do
+	  this may produce no error message - it just won't start!
+
+config EFI_APP_32BIT
+	bool "Produce an app for running with 32-bit EFI"
+
+config EFI_APP_64BIT
+	bool "Produce an app for running with 64-bit EFI"
+
+endchoice
 
 choice
-	prompt "EFI 32/64-bit selection"
+	prompt "EFI stub 32/64-bit selection"
 	depends on EFI_STUB
 	help
 	  EFI does not support mixing 32-bit and 64-bit modes. This is a
@@ -53,3 +61,13 @@ config EFI_STUB_64BIT
 	bool "Produce a stub for running with 64-bit EFI"
 
 endchoice
+
+config EFI_RAM_SIZE
+	hex "Amount of EFI RAM for U-Boot"
+	depends on EFI_APP
+	default 0x10000000
+	help
+	  Set the amount of EFI RAM which is claimed by U-Boot for its own
+	  use. U-Boot allocates this from EFI on start-up (along with a few
+	  other smaller amounts) and it can never be increased after that.
+	  It is used as the RAM size in with U-Boot.
-- 
2.33.0.1079.g6e70778dc9-goog



More information about the U-Boot mailing list