Skip to contentSkip to conversation

x86: efi: Fixes and enhancements to application and payload support

PATCH New Bin Meng 5 participants 71 messages Jun 10, 2018 – Jun 12, 2018

Subsystems (3)
lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover x86: efi: Fixes and enhancements to application and payload support

Unfortunately the EFI x86 application and payload support have been broken for quite a while. This series addresses various bug fixes, plus several enhancements like toolchain compatibility (eg: kernel.org i386-linux-gcc), introduction of generic EFI payload which can run on any x86 board, and a EFI framebuffer driver for the payload.

This series is available at u-boot-x86/efi-working for testing.

Bin Meng (16):
x86: doc: Fix reference to EFI doc in U-Boot
x86: Conditionally build the pinctrl_ich6 driver
x86: efi: app: Fix broken EFI application
x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload
stub codes
efi: Fix efi_uintn_t for 64-bit EFI payload
x86: efi: Refactor the directory of EFI app and payload support
x86: efi: payload: Add arch_cpu_init()
x86: efi: payload: Minor clean up on error message output
x86: Add generic EFI payload support
x86: Drop QEMU-specific EFI payload support
x86: baytrail: Drop EFI-specific test logics
efi: stub: Pass EFI GOP information to U-Boot payload
dm: video: Add an EFI framebuffer driver
x86: efi: payload: Add EFI framebuffer driver support
x86: Rename efi-x86 target to efi-x86_app
x86: efi: app: Display correct CPU info during boot

Christian Gmeiner (2):
dm: pci: Make ranges dt property optional
dm: pci: Use a 1:1 mapping for bus <-> phy addresses

 arch/x86/Kconfig                                   |   9 +-
 arch/x86/cpu/Makefile                              |   5 +-
 arch/x86/cpu/baytrail/Kconfig                      |   7 +-
 arch/x86/cpu/baytrail/valleyview.c                 |   3 -
 arch/x86/{lib => cpu}/efi/Kconfig                  |   0
 arch/x86/cpu/efi/Makefile                          |   9 +-
 arch/x86/cpu/efi/{efi.c => app.c}                  |   2 +-
 arch/x86/{lib => cpu}/efi/car.S                    |   0
 arch/x86/{lib/efi/efi.c => cpu/efi/payload.c}      |  11 +-
 arch/x86/cpu/intel_common/Makefile                 |   2 +-
 arch/x86/cpu/ivybridge/Kconfig                     |   1 +
 arch/x86/cpu/qemu/Makefile                         |   2 -
 arch/x86/cpu/qemu/qemu.c                           |   4 -
 arch/x86/dts/Makefile                              |   3 +-
 arch/x86/dts/{efi.dts => efi-x86_app.dts}          |   4 +-
 arch/x86/dts/efi-x86_payload.dts                   |  40 ++++++
 arch/x86/lib/Makefile                              |   7 +-
 arch/x86/lib/efi/Makefile                          |   7 -
 board/advantech/som-db5800-som-6867/Kconfig        |   5 +-
 board/congatec/conga-qeval20-qa3-e3845/Kconfig     |   5 +-
 board/dfi/dfi-bt700/Kconfig                        |   5 +-
 board/efi/Kconfig                                  |  15 ++-
 board/efi/{efi-x86 => efi-x86_app}/Kconfig         |   6 +-
 board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS     |   0
 board/efi/{efi-x86 => efi-x86_app}/Makefile        |   2 +-
 board/efi/{efi-x86/efi.c => efi-x86_app/app.c}     |   0
 board/efi/efi-x86_payload/Kconfig                  |  39 ++++++
 board/efi/efi-x86_payload/MAINTAINERS              |   7 +
 board/efi/efi-x86_payload/Makefile                 |   5 +
 board/efi/efi-x86_payload/start.S                  |   8 ++
 board/emulation/qemu-x86/Kconfig                   |   6 +-
 board/intel/minnowmax/Kconfig                      |   5 +-
 .../{efi-x86_defconfig => efi-x86_app_defconfig}   |  12 +-
 ...oad32_defconfig => efi-x86_payload32_defconfig} |  24 +---
 ...oad64_defconfig => efi-x86_payload64_defconfig} |  24 +---
 doc/README.x86                                     |   2 +-
 drivers/pci/pci-uclass.c                           |  33 +++--
 drivers/video/Kconfig                              |   9 ++
 drivers/video/Makefile                             |   1 +
 drivers/video/efi.c                                | 146 +++++++++++++++++++++
 include/configs/{efi-x86.h => efi-x86_app.h}       |   0
 include/configs/efi-x86_payload.h                  |  32 +++++
 include/efi.h                                      |  35 +++++
 include/efi_api.h                                  |   4 +
 lib/efi/Makefile                                   |   6 +-
 lib/efi/efi_stub.c                                 |  23 +++-
 46 files changed, 454 insertions(+), 121 deletions(-)
 rename arch/x86/{lib => cpu}/efi/Kconfig (100%)
 rename arch/x86/cpu/efi/{efi.c => app.c} (92%)
 rename arch/x86/{lib => cpu}/efi/car.S (100%)
 rename arch/x86/{lib/efi/efi.c => cpu/efi/payload.c} (97%)
 rename arch/x86/dts/{efi.dts => efi-x86_app.dts} (82%)
 create mode 100644 arch/x86/dts/efi-x86_payload.dts
 delete mode 100644 arch/x86/lib/efi/Makefile
 rename board/efi/{efi-x86 => efi-x86_app}/Kconfig (64%)
 rename board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS (100%)
 rename board/efi/{efi-x86 => efi-x86_app}/Makefile (82%)
 rename board/efi/{efi-x86/efi.c => efi-x86_app/app.c} (100%)
 create mode 100644 board/efi/efi-x86_payload/Kconfig
 create mode 100644 board/efi/efi-x86_payload/MAINTAINERS
 create mode 100644 board/efi/efi-x86_payload/Makefile
 create mode 100644 board/efi/efi-x86_payload/start.S
 rename configs/{efi-x86_defconfig => efi-x86_app_defconfig} (83%)
 rename configs/{qemu-x86_efi_payload32_defconfig => efi-x86_payload32_defconfig} (61%)
 rename configs/{qemu-x86_efi_payload64_defconfig => efi-x86_payload64_defconfig} (62%)
 create mode 100644 drivers/video/efi.c
 rename include/configs/{efi-x86.h => efi-x86_app.h} (100%)
 create mode 100644 include/configs/efi-x86_payload.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/18 x86: doc: Fix reference to EFI doc in U-Boot

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two separate documents"), the original README.efi was renamed to README.u-boot_on_efi, but x86 doc still refers to the old one.

---

 doc/README.x86 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/README.x86 +1 -1
index 78664c3..865a965 100644
@@ -1139,7 +1139,7 @@ application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot
 provides an EFI environment to the kernel (i.e. replaces UEFI completely but
 provides the same EFI run-time services) is not currently supported on x86.
 
-See README.efi for details of EFI support in U-Boot.
+See README.u-boot_on_efi for details of EFI support in U-Boot.
 
 64-bit Support
 --------------
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/18 x86: doc: Fix reference to EFI doc in U-Boot

Quoted 15 lines · Bin Meng

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two separate documents"), the original README.efi was renamed to README.u-boot_on_efi, but x86 doc still refers to the old one.

---

 doc/README.x86 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/README.x86 +0 -0
index 78664c3..865a965 100644

doc/README.x86 application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot · line 1142

Quoted 5 lines
doc/README.x86 +1 -1
@@ -1139,7 +1139,7 @@ application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot
 provides an EFI environment to the kernel (i.e. replaces UEFI completely but
 provides the same EFI run-time services) is not currently supported on x86.
 
-See README.efi for details of EFI support in U-Boot.
+See  for details of EFI support in U-Boot.

Thanks for updating the references.

The chapter "EFI Support" refers both to running U-Boot as an EFI payload as well as using U-Boot as an EFI platform. So both doc/README.u-boot_on_efi and doc/README.uefi should be referenced.

But I would prefer if you could also move the sentences concerning EFI that has spilled over into "64-bit Support" into the "EFI Support" chapter.

Best regards

Heinrich

Quoted 4 lines
doc/README.x86 +0 -0
 64-bit Support
 --------------
 
author
#3 lore raw

PATCH 1/18 x86: doc: Fix reference to EFI doc in U-Boot

Hi Heinrich,

Quoted 19 lines · Heinrich Schuchardt
Quoted 18 lines · Bin Meng

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two separate documents"), the original README.efi was renamed to README.u-boot_on_efi, but x86 doc still refers to the old one.

---

 doc/README.x86 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/README.x86 +0 -0
index 78664c3..865a965 100644
@@ -1139,7 +1139,7 @@ application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot
 provides an EFI environment to the kernel (i.e. replaces UEFI completely but
 provides the same EFI run-time services) is not currently supported on x86.
 
Quoted 9 lines

doc/README.x86 application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot · line 1142

Quoted 2 lines
doc/README.x86 +1 -1
-See README.efi for details of EFI support in U-Boot.
+See  for details of EFI support in U-Boot.

Thanks for updating the references.

The chapter "EFI Support" refers both to running U-Boot as an EFI payload as well as using U-Boot as an EFI platform. So both doc/README.u-boot_on_efi and doc/README.uefi should be referenced.

OK, will do in v2. One question: the doc says: CONFIG_EFI_LOADER option is not currently supported on x86. Is this still the case, or outdated? (I haven't tried the EFI loader on x86 or ARM yet)

Quoted 3 lines

But I would prefer if you could also move the sentences concerning EFI that has spilled over into "64-bit Support" into the "EFI Support" chapter.

Sure.

Regards,
Bin

#4 lore raw

PATCH 1/18 x86: doc: Fix reference to EFI doc in U-Boot

Quoted 27 lines · Bin Meng

Hi Heinrich,

Quoted 24 lines · Heinrich Schuchardt
Quoted 15 lines · Bin Meng

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two separate documents"), the original README.efi was renamed to README.u-boot_on_efi, but x86 doc still refers to the old one.

---

 doc/README.x86 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/README.x86 +0 -0
index 78664c3..865a965 100644

doc/README.x86 application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot · line 1142

Quoted 5 lines
doc/README.x86 +1 -1
@@ -1139,7 +1139,7 @@ application, with CONFIG_EFI_APP. The CONFIG_EFI_LOADER option, where U-Booot
 provides an EFI environment to the kernel (i.e. replaces UEFI completely but
 provides the same EFI run-time services) is not currently supported on x86.
 
-See README.efi for details of EFI support in U-Boot.
+See  for details of EFI support in U-Boot.

Thanks for updating the references.

Quoted 8 lines
Quoted 4 lines

The chapter "EFI Support" refers both to running U-Boot as an EFI payload as well as using U-Boot as an EFI platform. So both doc/README.u-boot_on_efi and doc/README.uefi should be referenced.

OK, will do in v2. One question: the doc says: CONFIG_EFI_LOADER option is not currently supported on x86. Is this still the case, or outdated? (I haven't tried the EFI loader on x86 or ARM yet)

qemu-x86_defconfig has CONFIG_EFI_LOADER enabled by default. bootefi selftest is successful.

But loading Linux fails by trying to use video memory as normal memory.

E.g. memory reservations according to e820 table are missing.

Patch https://patchwork.ozlabs.org/patch/860400/ is not sufficient to resolve the issue.

I lack the knowledge which memory regions have to be reserved on the platform.

Best regards

Heinrich

Quoted 10 lines
Quoted 4 lines

But I would prefer if you could also move the sentences concerning EFI that has spilled over into "64-bit Support" into the "EFI Support" chapter.

Sure.

Regards,
Bin

author
#5 lore raw

PATCH 2/18 x86: Conditionally build the pinctrl_ich6 driver

In reply to Bin Meng

The pinctrl_ich6 driver is currently unconditionally built for all x86 boards. Let's use a Kconfig option to control the build.

---

 arch/x86/Kconfig               | 6 ++++++
 arch/x86/cpu/baytrail/Kconfig  | 1 +
 arch/x86/cpu/ivybridge/Kconfig | 1 +
 arch/x86/lib/Makefile          | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)
arch/x86/Kconfig +6 -0
index c145799..460aed6 100644
@@ -744,6 +744,12 @@ config I8259_PIC
 	  slave) interrupt controllers. Include this to have U-Boot set up
 	  the interrupt correctly.
 
+config PINCTRL_ICH6
+	bool
+	help
+	  Intel ICH6 compatible chipset pinctrl driver. It needs to work
+	  together with the ICH6 compatible gpio driver.
+
 config I8254_TIMER
 	bool
 	default y
arch/x86/cpu/baytrail/Kconfig +1 -0
index ac58b03..022a9f2 100644
@@ -12,6 +12,7 @@ config INTEL_BAYTRAIL
 	imply AHCI_PCI
 	imply ICH_SPI
 	imply INTEL_ICH6_GPIO
+	imply PINCTRL_ICH6
 	imply MMC
 	imply MMC_PCI
 	imply MMC_SDHCI
arch/x86/cpu/ivybridge/Kconfig +1 -0
index e31c33c..ea25ff3 100644
@@ -13,6 +13,7 @@ config NORTHBRIDGE_INTEL_IVYBRIDGE
 	imply AHCI_PCI
 	imply ICH_SPI
 	imply INTEL_ICH6_GPIO
+	imply PINCTRL_ICH6
 	imply SCSI
 	imply SCSI_AHCI
 	imply SPI_FLASH
arch/x86/lib/Makefile +1 -1
index 51d451f..2adb236 100644
@@ -24,7 +24,7 @@ obj-$(CONFIG_ENABLE_MRC_CACHE) += mrccache.o
 obj-y	+= northbridge-uclass.o
 obj-$(CONFIG_I8259_PIC) += i8259.o
 obj-$(CONFIG_I8254_TIMER) += i8254.o
-obj-y	+= pinctrl_ich6.o
+obj-$(CONFIG_PINCTRL_ICH6) += pinctrl_ich6.o
 obj-y	+= pirq_routing.o
 obj-y	+= relocate.o
 obj-y += physmem.o
Signature · 1 line
2.7.4
#6 lore raw

PATCH 2/18 x86: Conditionally build the pinctrl_ich6 driver

Quoted 11 lines · Bin Meng

The pinctrl_ich6 driver is currently unconditionally built for all x86 boards. Let's use a Kconfig option to control the build.

---

 arch/x86/Kconfig               | 6 ++++++
 arch/x86/cpu/baytrail/Kconfig  | 1 +
 arch/x86/cpu/ivybridge/Kconfig | 1 +
 arch/x86/lib/Makefile          | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)
author
#7 lore raw

PATCH 2/18 x86: Conditionally build the pinctrl_ich6 driver

Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

The pinctrl_ich6 driver is currently unconditionally built for all x86 boards. Let's use a Kconfig option to control the build.

---

Quoted 7 lines
Quoted 5 lines
 arch/x86/Kconfig               | 6 ++++++
 arch/x86/cpu/baytrail/Kconfig  | 1 +
 arch/x86/cpu/ivybridge/Kconfig | 1 +
 arch/x86/lib/Makefile          | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#8 lore raw

PATCH 3/18 x86: efi: app: Fix broken EFI application

In reply to Bin Meng

The EFI application does not boot currently. It's due to the call to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain during the build process if some symbols are not found. GCC will simply put these symbols into the .plt section and expect dynamic loader to fix these up.

While we are here, remove some commands and drivers that are not needed at present.

---

 configs/efi-x86_defconfig | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
configs/efi-x86_defconfig +2 -6
index 4cf5554..741a169 100644
@@ -11,12 +11,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTM is not set
-CONFIG_CMD_GPIO=y
 CONFIG_CMD_PART=y
-CONFIG_CMD_SF=y
 # CONFIG_CMD_SF_TEST is not set
-CONFIG_CMD_SPI=y
-CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT2=y
@@ -28,12 +24,12 @@ CONFIG_MAC_PARTITION=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_OF_EMBED=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 # CONFIG_DM_ETH is not set
 CONFIG_DEBUG_EFI_CONSOLE=y
 CONFIG_DEBUG_UART_BASE=0
 CONFIG_DEBUG_UART_CLOCK=0
-CONFIG_SPI=y
-CONFIG_ICH_SPI=y
 # CONFIG_REGEX is not set
 CONFIG_EFI=y
 # CONFIG_EFI_LOADER is not set
Signature · 1 line
2.7.4
#9 lore raw

PATCH 3/18 x86: efi: app: Fix broken EFI application

Quoted 9 lines · Bin Meng

The EFI application does not boot currently. It's due to the call to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain during the build process if some symbols are not found. GCC will simply put these symbols into the .plt section and expect dynamic loader to fix these up.

Quoted 9 lines

While we are here, remove some commands and drivers that are not needed at present.

---

 configs/efi-x86_defconfig | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
author
#10 lore raw

PATCH 3/18 x86: efi: app: Fix broken EFI application

Quoted 13 lines · Simon Glass
Quoted 12 lines · Bin Meng

The EFI application does not boot currently. It's due to the call to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain during the build process if some symbols are not found. GCC will simply put these symbols into the .plt section and expect dynamic loader to fix these up.

While we are here, remove some commands and drivers that are not needed at present.

Quoted 8 lines
Quoted 6 lines

---

 configs/efi-x86_defconfig | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

applied to u-boot-x86, thanks!

#11 lore raw

PATCH 3/18 x86: efi: app: Fix broken EFI application

In reply to Bin Meng
Quoted 11 lines · Bin Meng

The EFI application does not boot currently. It's due to the call to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain during the build process if some symbols are not found. GCC will simply put these symbols into the .plt section and expect dynamic loader to fix these up.

While we are here, remove some commands and drivers that are not needed at present.

This patch is not applicable to master:

Applying: x86: efi: app: Fix broken EFI application
error: patch failed: configs/efi-x86_defconfig:28
error: configs/efi-x86_defconfig: patch does not apply

Please, rebase.

Best regards

Heinrich

Quoted 40 lines

---

 configs/efi-x86_defconfig | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
configs/efi-x86_defconfig +2 -6
index 4cf5554..741a169 100644
@@ -11,12 +11,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTM is not set
-CONFIG_CMD_GPIO=y
 CONFIG_CMD_PART=y
-CONFIG_CMD_SF=y
 # CONFIG_CMD_SF_TEST is not set
-CONFIG_CMD_SPI=y
-CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT2=y
@@ -28,12 +24,12 @@ CONFIG_MAC_PARTITION=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_OF_EMBED=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 # CONFIG_DM_ETH is not set
 CONFIG_DEBUG_EFI_CONSOLE=y
 CONFIG_DEBUG_UART_BASE=0
 CONFIG_DEBUG_UART_CLOCK=0
-CONFIG_SPI=y
-CONFIG_ICH_SPI=y
 # CONFIG_REGEX is not set
 CONFIG_EFI=y
 # CONFIG_EFI_LOADER is not set
author
#12 lore raw

PATCH 3/18 x86: efi: app: Fix broken EFI application

Hi Heinrich,

Quoted 13 lines · Heinrich Schuchardt
Quoted 11 lines · Bin Meng

The EFI application does not boot currently. It's due to the call to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain during the build process if some symbols are not found. GCC will simply put these symbols into the .plt section and expect dynamic loader to fix these up.

While we are here, remove some commands and drivers that are not needed at present.

Quoted 8 lines

This patch is not applicable to master:

Applying: x86: efi: app: Fix broken EFI application
error: patch failed: configs/efi-x86_defconfig:28
error: configs/efi-x86_defconfig: patch does not apply

Please, rebase.

Will do in v2. But if you want some testing, please use u-boot-x86/efi-working branch. Thanks!

Regards,
Bin

author
#13 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

In reply to Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

---

 arch/x86/cpu/Makefile | 3 ++-
 arch/x86/lib/Makefile | 4 ++--
 lib/efi/Makefile      | 6 ++++--
 3 files changed, 8 insertions(+), 5 deletions(-)
arch/x86/cpu/Makefile +2 -1
index d5a17d0..af9e26c 100644
@@ -18,7 +18,8 @@ obj-y	+= cpu.o cpu_x86.o
 ifndef CONFIG_$(SPL_)X86_64
 AFLAGS_REMOVE_call32.o := -mregparm=3 \
 	$(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
-AFLAGS_call32.o := -fpic -fshort-wchar
+AFLAGS_call32.o := -fpic -fshort-wchar \
+	$(if $(CONFIG_EFI_STUB_64BIT),-m64)
 
 extra-y += call32.o
 endif
arch/x86/lib/Makefile +2 -2
index 2adb236..112ac3d 100644
@@ -58,10 +58,10 @@ CFLAGS_reloc_ia32_efi.o += -fpic -fshort-wchar
 
 # When building for 64-bit we must remove the i386-specific flags
 CFLAGS_REMOVE_reloc_x86_64_efi.o += -mregparm=3 -march=i386 -m32
-CFLAGS_reloc_x86_64_efi.o += -fpic -fshort-wchar
+CFLAGS_reloc_x86_64_efi.o += -fpic -fshort-wchar -m64
 
 AFLAGS_REMOVE_crt0_x86_64_efi.o += -mregparm=3 -march=i386 -m32
-AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar
+AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar -m64
 
 extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o
 extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
lib/efi/Makefile +4 -2
index 18d081a..f1a3929 100644
@@ -7,9 +7,11 @@ obj-$(CONFIG_EFI_STUB) += efi_info.o
 
 CFLAGS_REMOVE_efi_stub.o := -mregparm=3 \
 	$(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
-CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB
+CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB \
+	$(if $(CONFIG_EFI_STUB_64BIT),-m64)
 CFLAGS_REMOVE_efi.o := -mregparm=3 \
 	$(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
-CFLAGS_efi.o := -fpic -fshort-wchar -DEFI_STUB
+CFLAGS_efi.o := -fpic -fshort-wchar -DEFI_STUB \
+	$(if $(CONFIG_EFI_STUB_64BIT),-m64)
 
 extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o
Signature · 1 line
2.7.4
#14 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Quoted 7 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Is there any sane reason to keep the split between EFI and U-Boot long size alive? The x86_64 U-Boot port is getting along reasonably well from what I can tell and 32bit UEFI implementations on 64-bit hosts are dying out.

So can't we just remove all of that cruft altogether instead and just have x86_64 U-Boot with 64bit EFI stub and i386 U-Boot with 32bit EFI stub as only combinations?

That would dramatically simplify the code.

Alex

author
#15 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Quoted 9 lines · Alexander Graf
Quoted 6 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Quoted 7 lines
Quoted 1 line

Is there any sane reason to keep the split between EFI and U-Boot long size alive? The x86_64 U-Boot port is getting along reasonably well from what I can tell and 32bit UEFI implementations on 64-bit hosts are dying out.

I think you are mixing two type of things. U-Boot building as 32-bit or 64-bit is one thing. How to build U-Boot is another thing. This patch was to address the build.

Quoted 4 lines

So can't we just remove all of that cruft altogether instead and just have x86_64 U-Boot with 64bit EFI stub and i386 U-Boot with 32bit EFI stub as only combinations?

Some day once U-Boot x86_64 support is mature, we can consider that. Even if we only support 64-bit U-Boot as the 64-bit EFI payload, that does not mean i386-linux-gcc cannot be used. '-m64' is required to pass to such toolchain to cross-compile 64-bit codes correctly.

Quoted 2 lines

That would dramatically simplify the code.

Regards,
Bin

#16 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Quoted 27 lines · Bin Meng
Quoted 9 lines · Alexander Graf
Quoted 6 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Quoted 7 lines
Quoted 1 line

Is there any sane reason to keep the split between EFI and U-Boot long size alive? The x86_64 U-Boot port is getting along reasonably well from what I can tell and 32bit UEFI implementations on 64-bit hosts are dying out.

I think you are mixing two type of things. U-Boot building as 32-bit or 64-bit is one thing. How to build U-Boot is another thing. This patch was to address the build.

Quoted 4 lines

So can't we just remove all of that cruft altogether instead and just have x86_64 U-Boot with 64bit EFI stub and i386 U-Boot with 32bit EFI stub as only combinations?

Quoted 4 lines

Some day once U-Boot x86_64 support is mature, we can consider that. Even if we only support 64-bit U-Boot as the 64-bit EFI payload, that does not mean i386-linux-gcc cannot be used. '-m64' is required to pass to such toolchain to cross-compile 64-bit codes correctly.

Yes, but then all of this would be unconditional for the full code base and not depend on CONFIG_EFI_STUB_64BIT at all :).

I'm just wary that the efi payload code is quite hard to follow with all the combinations of 32/64 payload/u-boot bitnesses.

Alex

author
#17 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Hi Alex,

Quoted 30 lines · Alexander Graf
Quoted 27 lines · Bin Meng
Quoted 9 lines · Alexander Graf
Quoted 6 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Quoted 7 lines
Quoted 1 line

Is there any sane reason to keep the split between EFI and U-Boot long size alive? The x86_64 U-Boot port is getting along reasonably well from what I can tell and 32bit UEFI implementations on 64-bit hosts are dying out.

I think you are mixing two type of things. U-Boot building as 32-bit or 64-bit is one thing. How to build U-Boot is another thing. This patch was to address the build.

Quoted 4 lines

So can't we just remove all of that cruft altogether instead and just have x86_64 U-Boot with 64bit EFI stub and i386 U-Boot with 32bit EFI stub as only combinations?

Quoted 8 lines
Quoted 4 lines

Some day once U-Boot x86_64 support is mature, we can consider that. Even if we only support 64-bit U-Boot as the 64-bit EFI payload, that does not mean i386-linux-gcc cannot be used. '-m64' is required to pass to such toolchain to cross-compile 64-bit codes correctly.

Yes, but then all of this would be unconditional for the full code base and not depend on CONFIG_EFI_STUB_64BIT at all :).

No, it is not unconditional. The '-m64' flag will only be added when compiling efi_stub.c if CONFIG_EFI_STUB_64BIT is on. See below.

CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB \
       $(if $(CONFIG_EFI_STUB_64BIT),-m64)
Quoted 2 lines

I'm just wary that the efi payload code is quite hard to follow with all the combinations of 32/64 payload/u-boot bitnesses.

Yes, but not that bad. Still manageable :)

Regards,
Bin

#18 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

In reply to Bin Meng
Quoted 6 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Quoted 8 lines

---

 arch/x86/cpu/Makefile | 3 ++-
 arch/x86/lib/Makefile | 4 ++--
 lib/efi/Makefile      | 6 ++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

Nice to get this working with an i386 compiler!

author
#19 lore raw

PATCH 4/18 x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Quoted 16 lines · Simon Glass
Quoted 6 lines · Bin Meng

Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes.

Quoted 8 lines

---

 arch/x86/cpu/Makefile | 3 ++-
 arch/x86/lib/Makefile | 4 ++--
 lib/efi/Makefile      | 6 ++++--
 3 files changed, 8 insertions(+), 5 deletions(-)
Quoted 3 lines

Nice to get this working with an i386 compiler!

applied to u-boot-x86, thanks!

author
#20 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

In reply to Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot, efi_uintn_t gets wrongly interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +4 -0
index 64c27e4..d1158de 100644
@@ -28,7 +28,11 @@ enum efi_timer_delay {
 	EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t
+#endif
 typedef uint16_t *efi_string_t;
 
 #define EVT_TIMER				0x80000000
Signature · 1 line
2.7.4
#21 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
 	EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

Could you, please, explain under which compiler settings size_t and unsigned long have a different number of bits?

Obviously we have the EFI API exposed by U-Boot which has the bitness of U-Boot.

If you want to consume an EFI API of another bitness I suggest that you create separate interface definitions.

Best regards

Heinrich Schuchardt

Quoted 5 lines
include/efi_api.h +1 -0
+#endif
 typedef uint16_t *efi_string_t;
 
 #define EVT_TIMER				0x80000000
author
#22 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Quoted 3 lines

Could you, please, explain under which compiler settings size_t and unsigned long have a different number of bits?

As mentioned above, the EFI stub codes (efi_stub.c) are built for 64-bit, which expects 'efi_uintn_t' to be 64-bit. However, it is defined as size_t, which in U-Boot 32, will be 'unsigned int' (see arch/x86/include/asm/posix_types.h) - the bug here!

Quoted 6 lines

Obviously we have the EFI API exposed by U-Boot which has the bitness of U-Boot.

If you want to consume an EFI API of another bitness I suggest that you create separate interface definitions.

Regards,
Bin

#23 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Quoted 50 lines · Bin Meng

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 8 lines
Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Currently you cannot build with EFI_LOADER=Y on 32 bit with a 64bit stub. See lib/efi_loader/Kconfig. The problem is with the build scripts for the stub using the same CONFIG variables as those used for other binaries.

To emulate what would happen with your change once we can build with EFI_LOADER=y and 64bit stub I made the following change:

include/efi_api.h +1 -1
@@ -28,7 +28,8 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };
 
-#define efi_uintn_t size_t
+#define efi_uintn_t unsigned long
 typedef uint16_t *efi_string_t;
 

And then I tried to build:
make qemu-x86_defconfig
make -j6

It gives me a bunch of errors like below.

^~~~~~~~~
include/efi_loader.h:31:8: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 13 has type ‘long unsigned int’ [-Wformat=]

  debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
        ^
include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
 #define pr_fmt(fmt) fmt
                     ^~~

include/log.h:141:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~
include/efi_loader.h:31:2: note: in expansion of macro ‘debug’
debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
^~~~~
lib/efi_loader/efi_gop.c:333:2: note: in expansion of macro ‘EFI_ENTRY’
EFI_ENTRY("%p, %p, %u, %zu, %zu, %zu, %zu, %zu, %zu, %zu", this, ^~~~~~~~~
In file included from include/linux/bug.h:7:0,
from include/common.h:25,
from lib/efi_loader/efi_disk.c:8:
lib/efi_loader/efi_disk.c: In function ‘efi_disk_read_blocks’:
include/efi_loader.h:31:8: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 7 has type ‘long unsigned int’ [-Wformat=]

  debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
        ^
include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
 #define pr_fmt(fmt) fmt
                     ^~~

include/log.h:141:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~
include/efi_loader.h:31:2: note: in expansion of macro ‘debug’
debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
^~~~~
lib/efi_loader/efi_disk.c:114:2: note: in expansion of macro ‘EFI_ENTRY’
EFI_ENTRY("%p, %x, %" PRIx64 ", %zx, %p", this, media_id, lba, ^~~~~~~~~
lib/efi_loader/efi_disk.c: In function ‘efi_disk_write_blocks’:
include/efi_loader.h:31:8: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 7 has type ‘long unsigned int’ [-Wformat=]

  debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
        ^
include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
 #define pr_fmt(fmt) fmt
                     ^~~

include/log.h:141:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~
include/efi_loader.h:31:2: note: in expansion of macro ‘debug’
debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \

So, please, do not change the type of efi_uintn_t.

What is needed is using different types in lib/efi_loader/ and in the calls to the primary firmware if they have different bitness.

Best regards

Heinrich

Quoted 20 lines
Quoted 4 lines

Could you, please, explain under which compiler settings size_t and unsigned long have a different number of bits?

As mentioned above, the EFI stub codes (efi_stub.c) are built for 64-bit, which expects 'efi_uintn_t' to be 64-bit. However, it is defined as size_t, which in U-Boot 32, will be 'unsigned int' (see arch/x86/include/asm/posix_types.h) - the bug here!

Quoted 6 lines

Obviously we have the EFI API exposed by U-Boot which has the bitness of U-Boot.

If you want to consume an EFI API of another bitness I suggest that you create separate interface definitions.

Regards,
Bin

author
#24 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Hi Heinrich,

Quoted 71 lines · Heinrich Schuchardt
Quoted 50 lines · Bin Meng

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 8 lines
Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Currently you cannot build with EFI_LOADER=Y on 32 bit with a 64bit stub. See lib/efi_loader/Kconfig. The problem is with the build scripts for the stub using the same CONFIG variables as those used for other binaries.

To emulate what would happen with your change once we can build with EFI_LOADER=y and 64bit stub I made the following change:

include/efi_api.h enum efi_timer_delay { · line 33

Quoted 7 lines
include/efi_api.h +1 -1
@@ -28,7 +28,8 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };
 
-#define efi_uintn_t size_t
+#define efi_uintn_t unsigned long
 typedef uint16_t *efi_string_t;
 

I am not sure why do you unconditionally change efi_uintn_t? My patch has

#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)

to guard the change.

Quoted 4 lines

And then I tried to build:
make qemu-x86_defconfig
make -j6

I know. But my patch does not produce any build warnings on efi-x86_payload32_defconfig and efi-x86_payload64_defconfig, on u-boot-x86/efi-working branch.

Quoted 2 lines

It gives me a bunch of errors like below.

[snip]

Regards,
Bin

#25 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Quoted 77 lines · Bin Meng

Hi Heinrich,

Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Bin Meng

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 8 lines
Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Currently you cannot build with EFI_LOADER=Y on 32 bit with a 64bit stub. See lib/efi_loader/Kconfig. The problem is with the build scripts for the stub using the same CONFIG variables as those used for other binaries.

To emulate what would happen with your change once we can build with EFI_LOADER=y and 64bit stub I made the following change:

include/efi_api.h +0 -0
@@ -28,7 +28,8 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };
 
Quoted 8 lines

include/efi_api.h enum efi_timer_delay { · line 33

Quoted 4 lines
include/efi_api.h +1 -1
-#define efi_uintn_t size_t
+#define efi_uintn_t unsigned long
 typedef uint16_t *efi_string_t;
 

I am not sure why do you unconditionally change efi_uintn_t? My patch has

#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)

Currently it is not possible to enable CONFIG_EFI_STUB_64BIT and EFI_LOADER on 32bit U-Boot. Once we have removed this restriction in the build system your patch together with EFI_LOADER=y and CONFIG_EFI_STUB_64BIT=y will provoke all those errors. This is why I NAKed you patch.

Best regards

Heinrich

Quoted 20 lines

to guard the change.

Quoted 4 lines

And then I tried to build:
make qemu-x86_defconfig
make -j6

I know. But my patch does not produce any build warnings on efi-x86_payload32_defconfig and efi-x86_payload64_defconfig, on u-boot-x86/efi-working branch.

Quoted 2 lines

It gives me a bunch of errors like below.

[snip]

Regards,
Bin

author
#26 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Hi Heinrich,

Quoted 85 lines · Heinrich Schuchardt
Quoted 84 lines · Bin Meng

Hi Heinrich,

Quoted 71 lines · Heinrich Schuchardt
Quoted 50 lines · Bin Meng

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 8 lines
Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Currently you cannot build with EFI_LOADER=Y on 32 bit with a 64bit stub. See lib/efi_loader/Kconfig. The problem is with the build scripts for the stub using the same CONFIG variables as those used for other binaries.

To emulate what would happen with your change once we can build with EFI_LOADER=y and 64bit stub I made the following change:

include/efi_api.h enum efi_timer_delay { · line 33

Quoted 7 lines
include/efi_api.h +1 -1
@@ -28,7 +28,8 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };
 
-#define efi_uintn_t size_t
+#define efi_uintn_t unsigned long
 typedef uint16_t *efi_string_t;
 

I am not sure why do you unconditionally change efi_uintn_t? My patch has

Quoted 8 lines
Quoted 1 line

#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)

Currently it is not possible to enable CONFIG_EFI_STUB_64BIT and EFI_LOADER on 32bit U-Boot. Once we have removed this restriction in the build system your patch together with EFI_LOADER=y and CONFIG_EFI_STUB_64BIT=y will provoke all those errors. This is why I NAKed you patch.

I did the following to try to reproduce what you saw:

lib/efi_loader/Kconfig +0 -4
index d38780b..29e67b6 100644
@@ -3,10 +3,6 @@ config EFI_LOADER
        depends on (ARM || X86) && OF_LIBFDT
        # We do not support bootefi booting ARMv7 in non-secure mode
        depends on !ARMV7_NONSEC
-       # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB
-       depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT
-       # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
-       depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
        default y
        select LIB_UUID
        select HAVE_BLOCK_DEVICE

Then do a

$ make efi-x86_payload32_defconfig
$ make

It succeeded without any error

But doing:

$ make efi-x86_payload64_defconfig
$ make

Failed with a different error (no compiler warning were seen)

toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-ld.bfd: i386 architecture of input file `lib/efi_loader/helloworld.o' is incompatible with i386:x86-64 output scripts/Makefile.lib:407: recipe for target 'lib/efi_loader/helloworld_efi.so' failed

Switching to x86_64-linux-gcc, exposed the same error:

toolchains/gcc-7.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld.bfd: i386 architecture of input file `lib/efi_loader/helloworld.o' is incompatible with i386:x86-64 output

Regards,
Bin

#27 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Quoted 97 lines · Bin Meng

Hi Heinrich,

Quoted 93 lines · Heinrich Schuchardt
Quoted 77 lines · Bin Meng

Hi Heinrich,

Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Bin Meng

Hi Heinrich,

Quoted 11 lines · Heinrich Schuchardt
Quoted 4 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot

Above you say 64-bit payload and now you say 32-bit?

Why don't you compile U-Boot as 64-bit? How do you want to load a 64bit Linux EFI stub from an 32-bit EFI implementation in U-Boot?

U-Boot itself as the EFI pyaload is 32-bit. The EFI stub is 64-bit as it has to be loaded from the 64-bit EFI BIOS. Note in case you
misunderstand: the generated u-boot-payload.efi is 64-bit stub codes (for 64-bit EFI BIOS) or 32-bit stub codes (for 32-bit EFI BIOS) plus 32-bit U-Boot payload. The payload is always 32-bit as of today as U-Boot on x86 is mainly on 32-bit. 64-bit support, as you see from README.x86, is far from mature yet.

Quoted 26 lines
Quoted 16 lines

, efi_uintn_t gets wrongly
interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644

include/efi_api.h enum efi_timer_delay { · line 34

Quoted 7 lines
include/efi_api.h +3 -0
@@ -28,7 +28,11 @@ enum efi_timer_delay {
      EFI_TIMER_RELATIVE = 2
 };
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t

NAK

Quoted 8 lines
Quoted 3 lines

This change will create a lot of build warnings if EFI_STUB and EFI_LOADER are both configured.

I don't see any build warnings when building efi-x86_payload32 or efi-x86_payload64. I see both EFI_STUB and EFI_LOADER are enabled with these two targets. AFAIK, only x86 supports EFI_STUB currently. I don't know where you see a lot of build warnings.

Currently you cannot build with EFI_LOADER=Y on 32 bit with a 64bit stub. See lib/efi_loader/Kconfig. The problem is with the build scripts for the stub using the same CONFIG variables as those used for other binaries.

To emulate what would happen with your change once we can build with EFI_LOADER=y and 64bit stub I made the following change:

include/efi_api.h +0 -0
@@ -28,7 +28,8 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };
 
Quoted 8 lines

include/efi_api.h enum efi_timer_delay { · line 33

Quoted 4 lines
include/efi_api.h +1 -1
-#define efi_uintn_t size_t
+#define efi_uintn_t unsigned long
 typedef uint16_t *efi_string_t;
 

I am not sure why do you unconditionally change efi_uintn_t? My patch has

#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)

Currently it is not possible to enable CONFIG_EFI_STUB_64BIT and EFI_LOADER on 32bit U-Boot. Once we have removed this restriction in the build system your patch together with EFI_LOADER=y and CONFIG_EFI_STUB_64BIT=y will provoke all those errors. This is why I NAKed you patch.

My mistake was to confuse EFI_STUB and CONFIG_EFI_STUB.

EFI_STUB is only defined in lib/efi/Makefile when compiling lib/efi/efi.c and
lib/efi/efi_stub.c

These two files are compiled with -m64 when CONFIG_EFI_STUB_64BIT=y.

The problem should be fixed in
arch/x86/include/asm/posix_types.h

That way anybody using size_t in lib/efi/ can be sure that size_t has the same size as a pointer, cf:

lib/efi/efi_stub.c:92:
void *memcpy(void *dest, const void *src, size_t size) lib/efi/efi_stub.c:104:
void *memset(void *inptr, int ch, size_t size)

Quoted 29 lines

I did the following to try to reproduce what you saw:

lib/efi_loader/Kconfig +0 -4
index d38780b..29e67b6 100644
@@ -3,10 +3,6 @@ config EFI_LOADER
        depends on (ARM || X86) && OF_LIBFDT
        # We do not support bootefi booting ARMv7 in non-secure mode
        depends on !ARMV7_NONSEC
-       # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB
-       depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT
-       # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
-       depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
        default y
        select LIB_UUID
        select HAVE_BLOCK_DEVICE

Then do a

$ make efi-x86_payload32_defconfig
$ make

It succeeded without any error

But doing:

$ make efi-x86_payload64_defconfig
$ make
Quoted 7 lines

Failed with a different error (no compiler warning were seen)

toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-ld.bfd: i386 architecture of input file `lib/efi_loader/helloworld.o' is incompatible with i386:x86-64 output scripts/Makefile.lib:407: recipe for target 'lib/efi_loader/helloworld_efi.so' failed

This is due to using variable EFI_LDS, EFI_CRT0, and EFI_RELOC both when building the stub (64bit) and helloworld (32bit) (see arch/x86/config.mk).

To resolve the issue we would have to use different values for the stub and the other EFI payloads (helloworld and efi_selftest_miniapp_*).

Best regards

Heinrich

Quoted 10 lines

Switching to x86_64-linux-gcc, exposed the same error:

toolchains/gcc-7.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld.bfd: i386 architecture of input file `lib/efi_loader/helloworld.o' is incompatible with i386:x86-64 output

Regards,
Bin

author
#28 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

In reply to Bin Meng

Hi Alex,

Quoted 21 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot, efi_uintn_t gets wrongly interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644
@@ -28,7 +28,11 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };

include/efi_api.h enum efi_timer_delay {

Quoted 10 lines
include/efi_api.h +4 -1
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t
+#endif
 typedef uint16_t *efi_string_t;
 
 #define EVT_TIMER                              0x80000000
--

With your proposed changes to efi.h in [1], do you think we should also fix this by:

#ifdef __x86_64__
#define efi_uintn_t unsigned long
#else
#define efi_uintn_t size_t

[1] https://lists.denx.de/pipermail/u-boot/2018-June/331193.html

Regards,
Bin

#29 lore raw

PATCH 5/18 efi: Fix efi_uintn_t for 64-bit EFI payload

Quoted 38 lines · Bin Meng

Hi Alex,

Quoted 21 lines · Bin Meng

Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot, efi_uintn_t gets wrongly interpreted as int, but it should actually be long in a 64-bit EFI environment.

Fixes bb0bb91cf0aa ("efi_stub: Use efi_uintn_t")

---

 include/efi_api.h | 4 ++++
 1 file changed, 4 insertions(+)
include/efi_api.h +0 -0
index 64c27e4..d1158de 100644
@@ -28,7 +28,11 @@ enum efi_timer_delay {
        EFI_TIMER_RELATIVE = 2
 };

include/efi_api.h enum efi_timer_delay {

Quoted 10 lines
include/efi_api.h +4 -1
 
+#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
+#define efi_uintn_t unsigned long
+#else
 #define efi_uintn_t size_t
+#endif
 typedef uint16_t *efi_string_t;
 
 #define EVT_TIMER                              0x80000000
--

With your proposed changes to efi.h in [1], do you think we should also fix this by:

Quoted 4 lines

#ifdef __x86_64__
#define efi_uintn_t unsigned long
#else
#define efi_uintn_t size_t

Can't we just change the definition in arch/x86/include/asm/posix_types.h to adhere to __x86_64__ instead? Then the typedef would just simply always go to size_t.

Alex

author
#30 lore raw

PATCH 6/18 dm: pci: Make ranges dt property optional

In reply to Bin Meng

From: Christian Gmeiner <[email protected]>

If we use U-Boot as coreboot payload with a generic dts without any ranges specified we fail in pci pre_probe and our pci bus is not usable.

So convert decode_regions(..) into a void function and do the simple error handling there.

[bmeng: fixed 'u-boot' in the commit message and checkpatch warning]

---

 drivers/pci/pci-uclass.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/pci/pci-uclass.c +10 -13
index 1cd1e40..de4c71b 100644
@@ -810,8 +810,8 @@ error:
 	return ret;
 }
 
-static int decode_regions(struct pci_controller *hose, ofnode parent_node,
-			  ofnode node)
+static void decode_regions(struct pci_controller *hose, ofnode parent_node,
+			   ofnode node)
 {
 	int pci_addr_cells, addr_cells, size_cells;
 	int cells_per_record;
@@ -820,8 +820,11 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	int i;
 
 	prop = ofnode_get_property(node, "ranges", &len);
-	if (!prop)
-		return -EINVAL;
+	if (!prop) {
+		debug("%s: Cannot decode regions\n", __func__);
+		return;
+	}
+
 	pci_addr_cells = ofnode_read_simple_addr_cells(node);
 	addr_cells = ofnode_read_simple_addr_cells(parent_node);
 	size_cells = ofnode_read_simple_size_cells(node);
@@ -883,7 +886,7 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	bd_t *bd = gd->bd;
 
 	if (!bd)
-		return 0;
+		return;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
 		if (bd->bi_dram[i].size) {
@@ -908,13 +911,12 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 			base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 #endif
 
-	return 0;
+	return;
 }
 
 static int pci_uclass_pre_probe(struct udevice *bus)
 {
 	struct pci_controller *hose;
-	int ret;
 
 	debug("%s, bus=%d/%s, parent=%s\n", __func__, bus->seq, bus->name,
 	      bus->parent->name);
@@ -923,12 +925,7 @@ static int pci_uclass_pre_probe(struct udevice *bus)
 	/* For bridges, use the top-level PCI controller */
 	if (!device_is_on_pci_bus(bus)) {
 		hose->ctlr = bus;
-		ret = decode_regions(hose, dev_ofnode(bus->parent),
-				     dev_ofnode(bus));
-		if (ret) {
-			debug("%s: Cannot decode regions\n", __func__);
-			return ret;
-		}
+		decode_regions(hose, dev_ofnode(bus->parent), dev_ofnode(bus));
 	} else {
 		struct pci_controller *parent_hose;
 
Signature · 1 line
2.7.4
#31 lore raw

PATCH 6/18 dm: pci: Make ranges dt property optional

Quoted 14 lines · Bin Meng

From: Christian Gmeiner <[email protected]>

If we use U-Boot as coreboot payload with a generic dts without any ranges specified we fail in pci pre_probe and our pci bus is not usable.

So convert decode_regions(..) into a void function and do the simple error handling there.

[bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
Quoted 4 lines

---

 drivers/pci/pci-uclass.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
author
#32 lore raw

PATCH 6/18 dm: pci: Make ranges dt property optional

Quoted 15 lines · Simon Glass
Quoted 14 lines · Bin Meng

From: Christian Gmeiner <[email protected]>

If we use U-Boot as coreboot payload with a generic dts without any ranges specified we fail in pci pre_probe and our pci bus is not usable.

So convert decode_regions(..) into a void function and do the simple error handling there.

[bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
Quoted 6 lines
Quoted 4 lines

---

 drivers/pci/pci-uclass.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

applied to u-boot-x86, thanks!

author
#33 lore raw

PATCH 7/18 dm: pci: Use a 1:1 mapping for bus <-> phy addresses

In reply to Bin Meng

From: Christian Gmeiner <[email protected]>

If U-Boot gets used as coreboot payload all pci resources got assigned by coreboot. If a dts without any pci ranges gets used the dm is not able to access pci device memory. To get things working make use of a 1:1 mapping for bus <-> phy addresses.

This change makes it possible to get the e1000 U-Boot driver working on a sandybridge device where U-Boot is used as coreboot payload.

[bmeng: fixed 'u-boot' in the commit message]

---

 drivers/pci/pci-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/pci/pci-uclass.c +10 -0
index de4c71b..46e9c71 100644
@@ -1182,6 +1182,11 @@ static int _dm_pci_bus_to_phys(struct udevice *ctlr,
 	struct pci_region *res;
 	int i;
 
+	if (hose->region_count == 0) {
+		*pa = bus_addr;
+		return 0;
+	}
+
 	for (i = 0; i < hose->region_count; i++) {
 		res = &hose->regions[i];
 
@@ -1245,6 +1250,11 @@ int _dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
 	ctlr = pci_get_controller(dev);
 	hose = dev_get_uclass_priv(ctlr);
 
+	if (hose->region_count == 0) {
+		*ba = phys_addr;
+		return 0;
+	}
+
 	for (i = 0; i < hose->region_count; i++) {
 		res = &hose->regions[i];
 
Signature · 1 line
2.7.4
#34 lore raw

PATCH 7/18 dm: pci: Use a 1:1 mapping for bus <-> phy addresses

Quoted 16 lines · Bin Meng

From: Christian Gmeiner <[email protected]>

If U-Boot gets used as coreboot payload all pci resources got assigned by coreboot. If a dts without any pci ranges gets used the dm is not able to access pci device memory. To get things working make use of a 1:1 mapping for bus <-> phy addresses.

This change makes it possible to get the e1000 U-Boot driver working on a sandybridge device where U-Boot is used as coreboot payload.

[bmeng: fixed 'u-boot' in the commit message]
Quoted 4 lines

---

 drivers/pci/pci-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
author
#35 lore raw

PATCH 7/18 dm: pci: Use a 1:1 mapping for bus <-> phy addresses

Quoted 17 lines · Simon Glass
Quoted 16 lines · Bin Meng

From: Christian Gmeiner <[email protected]>

If U-Boot gets used as coreboot payload all pci resources got assigned by coreboot. If a dts without any pci ranges gets used the dm is not able to access pci device memory. To get things working make use of a 1:1 mapping for bus <-> phy addresses.

This change makes it possible to get the e1000 U-Boot driver working on a sandybridge device where U-Boot is used as coreboot payload.

[bmeng: fixed 'u-boot' in the commit message]
Quoted 6 lines
Quoted 4 lines

---

 drivers/pci/pci-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

applied to u-boot-x86, thanks!

author
#36 lore raw

PATCH 8/18 x86: efi: Refactor the directory of EFI app and payload support

In reply to Bin Meng

At present the EFI application and payload support codes in the x86 directory is distributed in a hybrid way. For example, the Kconfig options for both app and payload are in arch/x86/lib/efi/Kconfig, but the source codes in the same directory get built only for CONFIG_EFI_STUB.

This refactors the codes by consolidating all the EFI support codes into arch/x86/cpu/efi, just like other x86 targets.

---

 arch/x86/Kconfig                              | 3 +--
 arch/x86/cpu/Makefile                         | 2 +-
 arch/x86/{lib => cpu}/efi/Kconfig             | 0
 arch/x86/cpu/efi/Makefile                     | 7 +++++++
 arch/x86/{lib => cpu}/efi/car.S               | 0
 arch/x86/{lib/efi/efi.c => cpu/efi/payload.c} | 0
 arch/x86/lib/Makefile                         | 1 -
 arch/x86/lib/efi/Makefile                     | 7 -------
 8 files changed, 9 insertions(+), 11 deletions(-)
 rename arch/x86/{lib => cpu}/efi/Kconfig (100%)
 rename arch/x86/{lib => cpu}/efi/car.S (100%)
 rename arch/x86/{lib/efi/efi.c => cpu/efi/payload.c} (100%)
 delete mode 100644 arch/x86/lib/efi/Makefile
arch/x86/Kconfig +1 -2
index 460aed6..43fa30b 100644
@@ -112,6 +112,7 @@ source "arch/x86/cpu/braswell/Kconfig"
 source "arch/x86/cpu/broadwell/Kconfig"
 source "arch/x86/cpu/coreboot/Kconfig"
 source "arch/x86/cpu/ivybridge/Kconfig"
+source "arch/x86/cpu/efi/Kconfig"
 source "arch/x86/cpu/qemu/Kconfig"
 source "arch/x86/cpu/quark/Kconfig"
 source "arch/x86/cpu/queensbay/Kconfig"
@@ -781,6 +782,4 @@ config HIGH_TABLE_SIZE
 	  Increse it if the default size does not fit the board's needs.
 	  This is most likely due to a large ACPI DSDT table is used.
 
-source "arch/x86/lib/efi/Kconfig"
-
 endmenu
arch/x86/cpu/Makefile +1 -1
index af9e26c..f862d8c 100644
@@ -29,7 +29,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
 obj-$(CONFIG_INTEL_BRASWELL) += braswell/
 obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
 obj-$(CONFIG_SYS_COREBOOT) += coreboot/
-obj-$(CONFIG_EFI_APP) += efi/
+obj-$(CONFIG_EFI) += efi/
 obj-$(CONFIG_QEMU) += qemu/
 obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
 obj-$(CONFIG_INTEL_QUARK) += quark/
arch/x86/cpu/efi/Kconfig renamed from arch/x86/lib/efi/Kconfig +0 -0
similarity index 100%
rename from arch/x86/lib/efi/Kconfig
rename to arch/x86/cpu/efi/Kconfig
arch/x86/cpu/efi/Makefile +7 -0
index 06d0480..32c2dde 100644
@@ -2,5 +2,12 @@
 #
 # Copyright (c) 2015 Google, Inc
 
+ifdef CONFIG_EFI_APP
 obj-y += efi.o
 obj-y += sdram.o
+endif
+
+ifdef CONFIG_EFI_STUB
+obj-y += car.o
+obj-y += payload.o
+endif
arch/x86/cpu/efi/car.S renamed from arch/x86/lib/efi/car.S +0 -0
similarity index 100%
rename from arch/x86/lib/efi/car.S
rename to arch/x86/cpu/efi/car.S
arch/x86/cpu/efi/payload.c renamed from arch/x86/lib/efi/efi.c +0 -0
similarity index 100%
rename from arch/x86/lib/efi/efi.c
rename to arch/x86/cpu/efi/payload.c
arch/x86/lib/Makefile +0 -1
index 112ac3d..ba83ce2 100644
@@ -14,7 +14,6 @@ endif
 obj-y	+= cmd_boot.o
 obj-$(CONFIG_SEABIOS) += coreboot_table.o
 obj-y	+= early_cmos.o
-obj-$(CONFIG_EFI) += efi/
 obj-y	+= e820.o
 obj-y	+= init_helpers.o
 obj-y	+= interrupts.o
arch/x86/lib/efi/Makefile deleted +0 -7
deleted file mode 100644
index f6c6523..0000000
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2002-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-
-obj-$(CONFIG_EFI_STUB) += car.o
-obj-$(CONFIG_EFI_STUB) += efi.o
Signature · 1 line
2.7.4
#37 lore raw

PATCH 8/18 x86: efi: Refactor the directory of EFI app and payload support

Quoted 12 lines · Bin Meng

At present the EFI application and payload support codes in the x86 directory is distributed in a hybrid way. For example, the Kconfig options for both app and payload are in arch/x86/lib/efi/Kconfig, but the source codes in the same directory get built only for CONFIG_EFI_STUB.

This refactors the codes by consolidating all the EFI support codes into arch/x86/cpu/efi, just like other x86 targets.

---

Quoted 13 lines
 arch/x86/Kconfig                              | 3 +--
 arch/x86/cpu/Makefile                         | 2 +-
 arch/x86/{lib => cpu}/efi/Kconfig             | 0
 arch/x86/cpu/efi/Makefile                     | 7 +++++++
 arch/x86/{lib => cpu}/efi/car.S               | 0
 arch/x86/{lib/efi/efi.c => cpu/efi/payload.c} | 0
 arch/x86/lib/Makefile                         | 1 -
 arch/x86/lib/efi/Makefile                     | 7 -------
 8 files changed, 9 insertions(+), 11 deletions(-)
 rename arch/x86/{lib => cpu}/efi/Kconfig (100%)
 rename arch/x86/{lib => cpu}/efi/car.S (100%)
 rename arch/x86/{lib/efi/efi.c => cpu/efi/payload.c} (100%)
 delete mode 100644 arch/x86/lib/efi/Makefile
author
#38 lore raw

PATCH 9/18 x86: efi: payload: Add arch_cpu_init()

In reply to Bin Meng

This adds arch_cpu_init() to the payload codes, in preparation for supporting a generic efi payload.

---

 arch/x86/cpu/efi/payload.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/cpu/efi/payload.c +8 -3
index 81fb8b5..9fd9f57 100644
@@ -5,11 +5,9 @@
  */
 
 #include <common.h>
-#include <debug_uart.h>
 #include <efi.h>
 #include <errno.h>
-#include <linux/err.h>
-#include <linux/types.h>
+#include <asm/post.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -126,6 +124,13 @@ int dram_init_banksize(void)
 	return 0;
 }
 
+int arch_cpu_init(void)
+{
+	post_code(POST_CPU_INIT);
+
+	return x86_cpu_init_f();
+}
+
 int checkcpu(void)
 {
 	return 0;
Signature · 1 line
2.7.4
author
#40 lore raw

PATCH 10/18 x86: efi: payload: Minor clean up on error message output

In reply to Bin Meng

If GetMemoryMap() fails, we really want to know EFI_BITS_PER_LONG instead of BITS_PER_LONG. A space and LF are added in places where error message is output to improve readability.

---

 lib/efi/efi_stub.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
lib/efi/efi_stub.c +5 -3
index 3138739..09023a2 100644
@@ -281,7 +281,8 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 
 	ret = efi_init(priv, "Payload", image, sys_table);
 	if (ret) {
-		printhex2(ret); puts(" efi_init() failed\n");
+		printhex2(ret);
+		puts(" efi_init() failed\n");
 		return ret;
 	}
 	global_priv = priv;
@@ -294,7 +295,8 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	size = 0;
 	ret = boot->get_memory_map(&size, NULL, &key, &desc_size, &version);
 	if (ret != EFI_BUFFER_TOO_SMALL) {
-		printhex2(BITS_PER_LONG);
+		printhex2(EFI_BITS_PER_LONG);
+		putc(' ');
 		printhex2(ret);
 		puts(" No memory map\n");
 		return ret;
@@ -303,7 +305,7 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	desc = efi_malloc(priv, size, &ret);
 	if (!desc) {
 		printhex2(ret);
-		puts(" No memory for memory descriptor: ");
+		puts(" No memory for memory descriptor\n");
 		return ret;
 	}
 	ret = setup_info_table(priv, size + 128);
Signature · 1 line
2.7.4
#41 lore raw

PATCH 10/18 x86: efi: payload: Minor clean up on error message output

Quoted 9 lines · Bin Meng

If GetMemoryMap() fails, we really want to know EFI_BITS_PER_LONG instead of BITS_PER_LONG. A space and LF are added in places where error message is output to improve readability.

---

 lib/efi/efi_stub.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
author
#42 lore raw

PATCH 10/18 x86: efi: payload: Minor clean up on error message output

Quoted 5 lines · Simon Glass
Quoted 4 lines · Bin Meng

If GetMemoryMap() fails, we really want to know EFI_BITS_PER_LONG instead of BITS_PER_LONG. A space and LF are added in places where error message is output to improve readability.

Quoted 7 lines
Quoted 5 lines

---

 lib/efi/efi_stub.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

applied to u-boot-x86, thanks!

author
#43 lore raw

PATCH 11/18 x86: Add generic EFI payload support

In reply to Bin Meng

It is possible to create a generic EFI payload for all x86 boards. The payload is configured to include as many generic drivers as possible. All stuff that touches low-level initialization are not allowed as such is the EFI BIOS's responsibility. Platform specific drivers (like gpio, spi, etc) are not included.

---

 arch/x86/dts/Makefile                 |  1 +
 arch/x86/dts/efi-x86_payload.dts      | 36 +++++++++++++++++++++++++++++++++
 board/efi/Kconfig                     |  9 +++++++++
 board/efi/efi-x86_payload/Kconfig     | 38 +++++++++++++++++++++++++++++++++++
 board/efi/efi-x86_payload/MAINTAINERS |  7 +++++++
 board/efi/efi-x86_payload/Makefile    |  5 +++++
 board/efi/efi-x86_payload/start.S     |  8 ++++++++
 configs/efi-x86_payload32_defconfig   | 35 ++++++++++++++++++++++++++++++++
 configs/efi-x86_payload64_defconfig   | 36 +++++++++++++++++++++++++++++++++
 include/configs/efi-x86_payload.h     | 32 +++++++++++++++++++++++++++++
 10 files changed, 207 insertions(+)
 create mode 100644 arch/x86/dts/efi-x86_payload.dts
 create mode 100644 board/efi/efi-x86_payload/Kconfig
 create mode 100644 board/efi/efi-x86_payload/MAINTAINERS
 create mode 100644 board/efi/efi-x86_payload/Makefile
 create mode 100644 board/efi/efi-x86_payload/start.S
 create mode 100644 configs/efi-x86_payload32_defconfig
 create mode 100644 configs/efi-x86_payload64_defconfig
 create mode 100644 include/configs/efi-x86_payload.h
arch/x86/dts/Makefile +1 -0
index 7379774..9872c04 100644
@@ -11,6 +11,7 @@ dtb-y += bayleybay.dtb \
 	dfi-bt700-q7x-151.dtb \
 	edison.dtb \
 	efi.dtb \
+	efi-x86_payload.dtb \
 	galileo.dtb \
 	minnowmax.dtb \
 	qemu-x86_i440fx.dtb \
arch/x86/dts/efi-x86_payload.dts new file +36 -0
new file mode 100644
index 0000000..137bde5
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ *
+ * Generic EFI payload device tree for x86 targets
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+/include/ "serial.dtsi"
+/include/ "keyboard.dtsi"
+/include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
+
+/ {
+	model = "EFI x86 Payload";
+	compatible = "efi,x86-payload";
+
+	aliases {
+		serial0 = &serial;
+	};
+
+	config {
+		silent_console = <0>;
+	};
+
+	chosen {
+		stdout-path = "/serial";
+	};
+
+	pci {
+		compatible = "pci-x86";
+		u-boot,dm-pre-reloc;
+	};
+};
board/efi/Kconfig +9 -0
index 6f86a48..d37f6ff 100644
@@ -12,8 +12,17 @@ config TARGET_EFI
 	  takes over once the RAM, video and CPU are fully running.
 	  U-Boot is loaded as an application from EFI.
 
+config TARGET_EFI_PAYLOAD
+	bool "efi payload"
+	help
+	  This target is used for running U-Boot on top of EFI. In
+	  this case EFI does the early initialisation, and U-Boot
+	  takes over once the RAM, video and CPU are fully running.
+	  U-Boot is loaded as a payload from EFI.
+
 endchoice
 
 source "board/efi/efi-x86/Kconfig"
+source "board/efi/efi-x86_payload/Kconfig"
 
 endif
board/efi/efi-x86_payload/Kconfig new file +38 -0
new file mode 100644
index 0000000..dcf4de8
@@ -0,0 +1,38 @@
+if TARGET_EFI_PAYLOAD
+
+config SYS_BOARD
+	default "efi-x86_payload"
+
+config SYS_VENDOR
+	default "efi"
+
+config SYS_SOC
+	default "efi"
+
+config SYS_CONFIG_NAME
+	default "efi-x86_payload"
+
+config SYS_TEXT_BASE
+	default 0x00200000
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	imply SYS_NS16550
+	imply SCSI
+	imply SCSI_AHCI
+	imply AHCI_PCI
+	imply MMC
+	imply MMC_PCI
+	imply MMC_SDHCI
+	imply MMC_SDHCI_SDMA
+	imply USB
+	imply USB_EHCI_HCD
+	imply USB_XHCI_HCD
+	imply USB_STORAGE
+	imply USB_KEYBOARD
+	imply E1000
+	imply ETH_DESIGNWARE
+	imply PCH_GBE
+	imply RTL8169
+
+endif
board/efi/efi-x86_payload/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..abf3a15
@@ -0,0 +1,7 @@
+EFI-X86_PAYLOAD BOARD
+M:	Bin Meng <[email protected]>
+S:	Maintained
+F:	board/efi/efi-x86_payload/
+F:	include/configs/efi-x86_payload.h
+F:	configs/efi-x86_payload32_defconfig
+F:	configs/efi-x86_payload64_defconfig
board/efi/efi-x86_payload/Makefile new file +5 -0
new file mode 100644
index 0000000..6982340
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2018, Bin Meng <[email protected]>
+
+obj-y	+= start.o
board/efi/efi-x86_payload/start.S new file +8 -0
new file mode 100644
index 0000000..f7eaa7c
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+.globl early_board_init
+early_board_init:
+	jmp	early_board_init_ret
configs/efi-x86_payload32_defconfig new file +35 -0
new file mode 100644
index 0000000..7f0cab0
@@ -0,0 +1,35 @@
+CONFIG_X86=y
+CONFIG_VENDOR_EFI=y
+CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
+CONFIG_TARGET_EFI_PAYLOAD=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_IDE=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MAC_PARTITION=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+# CONFIG_PCI_PNP is not set
+CONFIG_EFI=y
+CONFIG_EFI_STUB=y
configs/efi-x86_payload64_defconfig new file +36 -0
new file mode 100644
index 0000000..8d7f3f0
@@ -0,0 +1,36 @@
+CONFIG_X86=y
+CONFIG_VENDOR_EFI=y
+CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
+CONFIG_TARGET_EFI_PAYLOAD=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_IDE=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MAC_PARTITION=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+# CONFIG_PCI_PNP is not set
+CONFIG_EFI=y
+CONFIG_EFI_STUB=y
+CONFIG_EFI_STUB_64BIT=y
include/configs/efi-x86_payload.h new file +32 -0
new file mode 100644
index 0000000..9c62fd2
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+/*
+ * board/config.h - configuration options, board specific
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <configs/x86-common.h>
+
+#define CONFIG_SYS_MONITOR_LEN		(1 << 20)
+
+#define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
+					"stdout=serial,vidconsole\0" \
+					"stderr=serial,vidconsole\0"
+
+/* ATA/IDE support */
+#define CONFIG_SYS_IDE_MAXBUS		2
+#define CONFIG_SYS_IDE_MAXDEVICE	4
+#define CONFIG_SYS_ATA_BASE_ADDR	0
+#define CONFIG_SYS_ATA_DATA_OFFSET	0
+#define CONFIG_SYS_ATA_REG_OFFSET	0
+#define CONFIG_SYS_ATA_ALT_OFFSET	0
+#define CONFIG_SYS_ATA_IDE0_OFFSET	0x1f0
+#define CONFIG_SYS_ATA_IDE1_OFFSET	0x170
+#define CONFIG_ATAPI
+
+#endif	/* __CONFIG_H */
Signature · 1 line
2.7.4
#44 lore raw

PATCH 11/18 x86: Add generic EFI payload support

Quoted 20 lines · Bin Meng

It is possible to create a generic EFI payload for all x86 boards. The payload is configured to include as many generic drivers as possible. All stuff that touches low-level initialization are not allowed as such is the EFI BIOS's responsibility. Platform specific drivers (like gpio, spi, etc) are not included.

---

 arch/x86/dts/Makefile                 |  1 +
 arch/x86/dts/efi-x86_payload.dts      | 36 +++++++++++++++++++++++++++++++++
 board/efi/Kconfig                     |  9 +++++++++
 board/efi/efi-x86_payload/Kconfig     | 38 +++++++++++++++++++++++++++++++++++
 board/efi/efi-x86_payload/MAINTAINERS |  7 +++++++
 board/efi/efi-x86_payload/Makefile    |  5 +++++
 board/efi/efi-x86_payload/start.S     |  8 ++++++++
 configs/efi-x86_payload32_defconfig   | 35 ++++++++++++++++++++++++++++++++
 configs/efi-x86_payload64_defconfig   | 36 +++++++++++++++++++++++++++++++++
 include/configs/efi-x86_payload.h     | 32 +++++++++++++++++++++++++++++
 10 files changed, 207 insertions(+)
Quoted 8 lines
 create mode 100644 arch/x86/dts/efi-x86_payload.dts
 create mode 100644 board/efi/efi-x86_payload/Kconfig
 create mode 100644 board/efi/efi-x86_payload/MAINTAINERS
 create mode 100644 board/efi/efi-x86_payload/Makefile
 create mode 100644 board/efi/efi-x86_payload/start.S
 create mode 100644 configs/efi-x86_payload32_defconfig
 create mode 100644 configs/efi-x86_payload64_defconfig
 create mode 100644 include/configs/efi-x86_payload.h
author
#45 lore raw

PATCH 12/18 x86: Drop QEMU-specific EFI payload support

In reply to Bin Meng

Now that we have generic EFI payload support for all x86 boards, drop the QEMU-specific one.

---

 arch/x86/cpu/qemu/Makefile               |  2 --
 arch/x86/cpu/qemu/qemu.c                 |  4 ---
 board/emulation/qemu-x86/Kconfig         |  6 ++--
 configs/qemu-x86_efi_payload32_defconfig | 47 -------------------------------
 configs/qemu-x86_efi_payload64_defconfig | 48 --------------------------------
 5 files changed, 3 insertions(+), 104 deletions(-)
 delete mode 100644 configs/qemu-x86_efi_payload32_defconfig
 delete mode 100644 configs/qemu-x86_efi_payload64_defconfig
arch/x86/cpu/qemu/Makefile +0 -2
index e5ea925..1761244 100644
@@ -2,8 +2,6 @@
 #
 # Copyright (C) 2015, Bin Meng <[email protected]>
 
-ifndef CONFIG_EFI_STUB
 obj-y += car.o dram.o
-endif
 obj-y += qemu.o
 obj-$(CONFIG_QFW) += cpu.o e820.o
arch/x86/cpu/qemu/qemu.c +0 -4
index 1fdb11c..ca4b3f0 100644
@@ -143,10 +143,6 @@ int arch_cpu_init(void)
 
 	return x86_cpu_init_f();
 }
-#endif
-
-#if !CONFIG_IS_ENABLED(EFI_STUB) && \
-	!CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
 
 int checkcpu(void)
 {
board/emulation/qemu-x86/Kconfig +3 -3
index a593f8c..41a27dd 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "qemu-x86"
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB && !SUPPORT_SPL
-	default 0x01110000 if EFI_STUB || SUPPORT_SPL
+	default 0xfff00000 if !SUPPORT_SPL
+	default 0x01110000 if SUPPORT_SPL
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR if !EFI_STUB
+	select X86_RESET_VECTOR
 	select QEMU
 	select BOARD_ROMSIZE_KB_1024
 
configs/qemu-x86_efi_payload32_defconfig deleted +0 -47

47 lines not on this page · raw message

configs/qemu-x86_efi_payload64_defconfig deleted +0 -48

48 lines not on this page · raw message

Signature · 1 line
2.7.4
#46 lore raw

PATCH 12/18 x86: Drop QEMU-specific EFI payload support

Quoted 6 lines · Bin Meng

Now that we have generic EFI payload support for all x86 boards, drop the QEMU-specific one.

---

Quoted 8 lines
 arch/x86/cpu/qemu/Makefile               |  2 --
 arch/x86/cpu/qemu/qemu.c                 |  4 ---
 board/emulation/qemu-x86/Kconfig         |  6 ++--
 configs/qemu-x86_efi_payload32_defconfig | 47 -------------------------------
 configs/qemu-x86_efi_payload64_defconfig | 48 --------------------------------
 5 files changed, 3 insertions(+), 104 deletions(-)
 delete mode 100644 configs/qemu-x86_efi_payload32_defconfig
 delete mode 100644 configs/qemu-x86_efi_payload64_defconfig
author
#47 lore raw

PATCH 13/18 x86: baytrail: Drop EFI-specific test logics

In reply to Bin Meng

Now that we have generic EFI payload support, drop EFI-specific test logics in BayTrail Kconfig and codes, and all BayTrail boards too.

---

 arch/x86/cpu/baytrail/Kconfig                  | 6 +++---
 arch/x86/cpu/baytrail/valleyview.c             | 3 ---
 board/advantech/som-db5800-som-6867/Kconfig    | 5 ++---
 board/congatec/conga-qeval20-qa3-e3845/Kconfig | 5 ++---
 board/dfi/dfi-bt700/Kconfig                    | 5 ++---
 board/intel/minnowmax/Kconfig                  | 5 ++---
 6 files changed, 11 insertions(+), 18 deletions(-)
arch/x86/cpu/baytrail/Kconfig +3 -3
index 022a9f2..d2c3473 100644
@@ -4,10 +4,10 @@
 
 config INTEL_BAYTRAIL
 	bool
-	select HAVE_FSP if !EFI
-	select ARCH_MISC_INIT if !EFI
+	select HAVE_FSP
+	select ARCH_MISC_INIT
 	select CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED
-	imply HAVE_INTEL_ME if !EFI
+	imply HAVE_INTEL_ME
 	imply ENABLE_MRC_CACHE
 	imply AHCI_PCI
 	imply ICH_SPI
arch/x86/cpu/baytrail/valleyview.c +0 -3
index 3194f8c..b7d481a 100644
@@ -17,7 +17,6 @@
 #define BYT_TRIG_LVL		BIT(24)
 #define BYT_TRIG_POS		BIT(25)
 
-#ifndef CONFIG_EFI_APP
 int arch_cpu_init(void)
 {
 	post_code(POST_CPU_INIT);
@@ -57,8 +56,6 @@ int arch_misc_init(void)
 	return 0;
 }
 
-#endif
-
 void reset_cpu(ulong addr)
 {
 	/* cold reset */
board/advantech/som-db5800-som-6867/Kconfig +2 -3
index fac562a..35d58fc 100644
@@ -13,12 +13,11 @@ config SYS_CONFIG_NAME
 	default "som-db5800-som-6867"
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB
-	default 0x01110000 if EFI_STUB
+	default 0xfff00000
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR if !EFI_STUB
+	select X86_RESET_VECTOR
 	select INTEL_BAYTRAIL
 	select BOARD_ROMSIZE_KB_8192
 	select BOARD_EARLY_INIT_F
board/congatec/conga-qeval20-qa3-e3845/Kconfig +2 -3
index 9e44413..6469250 100644
@@ -12,12 +12,11 @@ config SYS_CONFIG_NAME
 	default "theadorable-x86-conga-qa3-e3845" if TARGET_THEADORABLE_X86_CONGA_QA3_E3845
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB
-	default 0x01110000 if EFI_STUB
+	default 0xfff00000
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR if !EFI_STUB
+	select X86_RESET_VECTOR
 	select INTEL_BAYTRAIL
 	select BOARD_ROMSIZE_KB_8192
 	select BOARD_EARLY_INIT_F
board/dfi/dfi-bt700/Kconfig +2 -3
index f92f50a..50c7b2a 100644
@@ -12,12 +12,11 @@ config SYS_CONFIG_NAME
 	default "theadorable-x86-dfi-bt700" if TARGET_THEADORABLE_X86_DFI_BT700
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB
-	default 0x01110000 if EFI_STUB
+	default 0xfff00000
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR if !EFI_STUB
+	select X86_RESET_VECTOR
 	select INTEL_BAYTRAIL
 	select BOARD_ROMSIZE_KB_8192
 	select BOARD_EARLY_INIT_F
board/intel/minnowmax/Kconfig +2 -3
index a8668e4..543468c 100644
@@ -13,12 +13,11 @@ config SYS_CONFIG_NAME
 	default "minnowmax"
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB
-	default 0x01110000 if EFI_STUB
+	default 0xfff00000
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR if !EFI_STUB
+	select X86_RESET_VECTOR
 	select INTEL_BAYTRAIL
 	select BOARD_ROMSIZE_KB_8192
 	select SPI_FLASH_STMICRO
Signature · 1 line
2.7.4
#48 lore raw

PATCH 13/18 x86: baytrail: Drop EFI-specific test logics

Quoted 6 lines · Bin Meng

Now that we have generic EFI payload support, drop EFI-specific test logics in BayTrail Kconfig and codes, and all BayTrail boards too.

---

Quoted 7 lines
 arch/x86/cpu/baytrail/Kconfig                  | 6 +++---
 arch/x86/cpu/baytrail/valleyview.c             | 3 ---
 board/advantech/som-db5800-som-6867/Kconfig    | 5 ++---
 board/congatec/conga-qeval20-qa3-e3845/Kconfig | 5 ++---
 board/dfi/dfi-bt700/Kconfig                    | 5 ++---
 board/intel/minnowmax/Kconfig                  | 5 ++---
 6 files changed, 11 insertions(+), 18 deletions(-)
author
#49 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

In reply to Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

---

 include/efi.h      | 35 +++++++++++++++++++++++++++++++++++
 lib/efi/efi_stub.c | 15 +++++++++++++++
 2 files changed, 50 insertions(+)
include/efi.h +35 -0
index 98bddba..e08a913 100644
@@ -242,6 +242,7 @@ struct efi_open_protocol_info_entry {
 enum efi_entry_t {
 	EFIET_END,	/* Signals this is the last (empty) entry */
 	EFIET_MEMORY_MAP,
+	EFIET_GOP_MODE,
 
 	/* Number of entries */
 	EFIET_MEMORY_COUNT,
@@ -298,6 +299,40 @@ struct efi_entry_memmap {
 	struct efi_mem_desc desc[];
 };
 
+/**
+ * struct efi_entry_gopmode - a GOP mode table passed to U-Boot
+ *
+ * @fb_base:	EFI's framebuffer base address
+ * @fb_size:	EFI's framebuffer size
+ * @info_size:	GOP mode info structure size
+ * @info:	Start address of the GOP mode info structure
+ */
+struct efi_entry_gopmode {
+	efi_physical_addr_t fb_base;
+	/*
+	 * Not like the ones in 'struct efi_gop_mode' which are 'unsigned
+	 * long', @fb_size and @info_size have to be 'u64' here. As the EFI
+	 * stub codes may have different bit size from the U-Boot payload,
+	 * using 'long' will cause mismatch between the producer (stub) and
+	 * the consumer (payload).
+	 */
+	u64 fb_size;
+	u64 info_size;
+	/*
+	 * We cannot directly use 'struct efi_gop_mode_info info[]' here as
+	 * it causes compiler to complain: array type has incomplete element
+	 * type 'struct efi_gop_mode_info'.
+	 */
+	struct /* efi_gop_mode_info */ {
+		u32 version;
+		u32 width;
+		u32 height;
+		u32 pixel_format;
+		u32 pixel_bitmask[4];
+		u32 pixels_per_scanline;
+	} info[];
+};
+
 static inline struct efi_mem_desc *efi_get_next_mem_desc(
 		struct efi_entry_memmap *map, struct efi_mem_desc *desc)
 {
lib/efi/efi_stub.c +15 -0
index 09023a2..4819373 100644
@@ -274,6 +274,9 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	struct efi_boot_services *boot = sys_table->boottime;
 	struct efi_mem_desc *desc;
 	struct efi_entry_memmap map;
+	struct efi_gop *gop;
+	struct efi_entry_gopmode mode;
+	efi_guid_t efi_gop_guid = EFI_GOP_GUID;
 	efi_uintn_t key, desc_size, size;
 	efi_status_t ret;
 	u32 version;
@@ -312,6 +315,18 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	if (ret)
 		return ret;
 
+	ret = boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop);
+	if (ret) {
+		puts(" GOP unavailable\n");
+	} else {
+		mode.fb_base = gop->mode->fb_base;
+		mode.fb_size = gop->mode->fb_size;
+		mode.info_size = gop->mode->info_size;
+		add_entry_addr(priv, EFIET_GOP_MODE, &mode, sizeof(mode),
+			       gop->mode->info,
+			       sizeof(struct efi_gop_mode_info));
+	}
+
 	ret = boot->get_memory_map(&size, desc, &key, &desc_size, &version);
 	if (ret) {
 		printhex2(ret);
Signature · 1 line
2.7.4
#50 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Quoted 5 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

Alex

author
#51 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Quoted 12 lines · Alexander Graf
Quoted 5 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Regards,
Bin

#52 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Quoted 8 lines · Bin Meng
Quoted 7 lines · Alexander Graf
Quoted 4 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Interesting. Is there a particular reason you're not preserving boot services?

It might be quite handy to reuse UEFI block interfaces for example. It might also be useful to preserve (parts of?) the memory map so we don't overwrite random SMM code for example.

Maybe I misunderstand the purpose of the UEFI U-Boot support though ;).

Alex

author
#53 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Hi Alex,

Quoted 17 lines · Alexander Graf
Quoted 14 lines · Bin Meng
Quoted 12 lines · Alexander Graf
Quoted 5 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

Quoted 6 lines
Quoted 2 lines

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Interesting. Is there a particular reason you're not preserving boot services?

This is EFI payload support with CONFIG_EFI_STUB. Preserving boot services is EFI application, with CONFIG_EFI_APP. For example, see serial_efi.c which is the serial driver that uses EFI's boot services to output characters on the serial port.

Quoted 5 lines

It might be quite handy to reuse UEFI block interfaces for example. It might also be useful to preserve (parts of?) the memory map so we don't overwrite random SMM code for example.

Maybe I misunderstand the purpose of the UEFI U-Boot support though ;).

Looks there is some misunderstanding around the EFI payload support.

Regards,
Bin

#54 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Quoted 18 lines · Bin Meng

Hi Alex,

Quoted 15 lines · Alexander Graf
Quoted 13 lines · Bin Meng
Quoted 10 lines · Alexander Graf
Quoted 5 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Quoted 7 lines
Quoted 3 lines

Interesting. Is there a particular reason you're not preserving boot services?

This is EFI payload support with CONFIG_EFI_STUB. Preserving boot services is EFI application, with CONFIG_EFI_APP. For example, see serial_efi.c which is the serial driver that uses EFI's boot services to output characters on the serial port.

Oh, I see. That makes sense now.

Do people actually need CONFIG_EFI_STUB then?

Quoted 7 lines
Quoted 6 lines

It might be quite handy to reuse UEFI block interfaces for example. It might also be useful to preserve (parts of?) the memory map so we don't overwrite random SMM code for example.

Maybe I misunderstand the purpose of the UEFI U-Boot support though ;).

Looks there is some misunderstanding around the EFI payload support.

Yes, I have to admit that I never really cared enough about it to read its documentation though :).

Alex

author
#55 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Hi Alex,

Quoted 35 lines · Alexander Graf
Quoted 25 lines · Bin Meng

Hi Alex,

Quoted 21 lines · Alexander Graf
Quoted 17 lines · Bin Meng
Quoted 4 lines · Alexander Graf
Quoted 1 line · Bin Meng
Quoted 9 lines
Quoted 5 lines

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Quoted 7 lines
Quoted 3 lines

Interesting. Is there a particular reason you're not preserving boot services?

This is EFI payload support with CONFIG_EFI_STUB. Preserving boot services is EFI application, with CONFIG_EFI_APP. For example, see serial_efi.c which is the serial driver that uses EFI's boot services to output characters on the serial port.

Quoted 3 lines

Oh, I see. That makes sense now.

Do people actually need CONFIG_EFI_STUB then?

I think you wanted to say: Do people actually need CONFIG_EFI_APP then? CONFIG_EFI_STUB is more useful than CONFIG_EFI_APP. The application support is very limited.

As the README.u-boot_on_efi says:

Running U-Boot on EFI is useful in several situations:

- You have EFI running on a board but U-Boot does not natively support it fully yet. You can boot into U-Boot from EFI and use that until U-Boot is fully ported

- You need to use an EFI implementation (e.g. UEFI) because your vendor requires it in order to provide support

- You plan to use coreboot to boot into U-Boot but coreboot support does not currently exist for your platform. In the meantime you can use U-Boot on EFI and then move to U-Boot on coreboot when ready

- You use EFI but want to experiment with a simpler alternative like U-Boot

Right now, I have one Intel SkyLake board, and before I get a native U-Boot up and running as the 1st stage bootloader on this board, I can run U-Boot as the EFI payload to experiment something, which is very handy.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

It might be quite handy to reuse UEFI block interfaces for example. It might also be useful to preserve (parts of?) the memory map so we don't overwrite random SMM code for example.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Maybe I misunderstand the purpose of the UEFI U-Boot support though ;).

Looks there is some misunderstanding around the EFI payload support.

Yes, I have to admit that I never really cared enough about it to read its documentation though :).

Yep, this sometimes confuses people :)

Regards,
Bin

#56 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Quoted 52 lines · Bin Meng

Hi Alex,

Quoted 22 lines · Alexander Graf
Quoted 21 lines · Bin Meng

Hi Alex,

Quoted 18 lines · Alexander Graf
Quoted 7 lines · Bin Meng
Quoted 6 lines · Alexander Graf
Quoted 4 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Interesting. Is there a particular reason you're not preserving boot services?

Quoted 8 lines
Quoted 4 lines

This is EFI payload support with CONFIG_EFI_STUB. Preserving boot services is EFI application, with CONFIG_EFI_APP. For example, see serial_efi.c which is the serial driver that uses EFI's boot services to output characters on the serial port.

Oh, I see. That makes sense now.

Do people actually need CONFIG_EFI_STUB then?

I think you wanted to say: Do people actually need CONFIG_EFI_APP then? CONFIG_EFI_STUB is more useful than CONFIG_EFI_APP. The application support is very limited.

As the README.u-boot_on_efi says:

Running U-Boot on EFI is useful in several situations:

- You have EFI running on a board but U-Boot does not natively support it fully yet. You can boot into U-Boot from EFI and use that until U-Boot is fully ported

- You need to use an EFI implementation (e.g. UEFI) because your vendor requires it in order to provide support

- You plan to use coreboot to boot into U-Boot but coreboot support does not currently exist for your platform. In the meantime you can use U-Boot on EFI and then move to U-Boot on coreboot when ready

Quoted 6 lines

- You use EFI but want to experiment with a simpler alternative like U-Boot

Right now, I have one Intel SkyLake board, and before I get a native U-Boot up and running as the 1st stage bootloader on this board, I can run U-Boot as the EFI payload to experiment something, which is very handy.

Oh, I see. So it's mostly used as bringup aid. In that case I agree that the stub bit makes a lot of sense.

The one thing that really bites us with the stub and different bitness is when you want to use efi_api.h again from within U-Boot. The obvious example is a 32bit U-Boot built as 64bit payload, allowing 32bit UEFI applications to run inside.

Do you think we could just agree on efi.h to not consume any stub config options and just determine things from its build environment instead? That way it automatically adapts according to the -m32/-m64 build flag for the stub and we would not need to worry about the stub in generic code.

Something like the patch below? If yes, I'll resend it with proper indentation :).

Alex

include/efi.h +0 -1
index 98bddbac1a..5e1e8ac78c 100644
@@ -19,12 +19,12 @@
  #include <linux/string.h>
  #include <linux/types.h>
 
-#if CONFIG_EFI_STUB_64BIT || (!defined(CONFIG_EFI_STUB) && 

defined(__x86_64__))
-/* EFI uses the Microsoft ABI which is not the default for GCC */ +/* EFI on x86_64 uses the Microsoft ABI which is not the default for GCC */ +#ifdef __x86_64__
 #define EFIAPI __attribute__((ms_abi))
 #else
 #define EFIAPI asmlinkage
-#endif
+#endif /* __x86_64__ */

 struct efi_device_path;

@@ -32,16 +32,7 @@ typedef struct {
     u8 b[16];
 } efi_guid_t;

-#define EFI_BITS_PER_LONG    BITS_PER_LONG
-
-/*
- * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set
- * in lib/efi/Makefile, when building the stub.
- */
-#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB) -#undef EFI_BITS_PER_LONG
-#define EFI_BITS_PER_LONG    64
-#endif
+#define EFI_BITS_PER_LONG    (sizeof(long) * 8)

 /* Bit mask for EFI status code with error */ #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1))

author
#57 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

Hi Alex,

Quoted 81 lines · Alexander Graf
Quoted 63 lines · Bin Meng

Hi Alex,

Quoted 36 lines · Alexander Graf
Quoted 25 lines · Bin Meng

Hi Alex,

Quoted 21 lines · Alexander Graf
Quoted 17 lines · Bin Meng
Quoted 4 lines · Alexander Graf
Quoted 1 line · Bin Meng
Quoted 9 lines
Quoted 5 lines

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Why can't the FB drive determine all of this on its own and just fail probe if no GOP protocol can be found?

It cannot. Once U-Boot payload is running, the boot services are gone. There is no way to determine the GOP protocol.

Quoted 7 lines
Quoted 3 lines

Interesting. Is there a particular reason you're not preserving boot services?

This is EFI payload support with CONFIG_EFI_STUB. Preserving boot services is EFI application, with CONFIG_EFI_APP. For example, see serial_efi.c which is the serial driver that uses EFI's boot services to output characters on the serial port.

Quoted 3 lines

Oh, I see. That makes sense now.

Do people actually need CONFIG_EFI_STUB then?

I think you wanted to say: Do people actually need CONFIG_EFI_APP then? CONFIG_EFI_STUB is more useful than CONFIG_EFI_APP. The application support is very limited.

As the README.u-boot_on_efi says:

Running U-Boot on EFI is useful in several situations:

- You have EFI running on a board but U-Boot does not natively support it fully yet. You can boot into U-Boot from EFI and use that until U-Boot is fully ported

- You need to use an EFI implementation (e.g. UEFI) because your vendor requires it in order to provide support

- You plan to use coreboot to boot into U-Boot but coreboot support does not currently exist for your platform. In the meantime you can use U-Boot on EFI and then move to U-Boot on coreboot when ready

Quoted 7 lines

- You use EFI but want to experiment with a simpler alternative like U-Boot

Right now, I have one Intel SkyLake board, and before I get a native U-Boot up and running as the 1st stage bootloader on this board, I can run U-Boot as the EFI payload to experiment something, which is very handy.

Oh, I see. So it's mostly used as bringup aid. In that case I agree that the stub bit makes a lot of sense.

The one thing that really bites us with the stub and different bitness is when you want to use efi_api.h again from within U-Boot. The obvious example is a 32bit U-Boot built as 64bit payload, allowing 32bit UEFI applications to run inside.

Quoted 5 lines

Do you think we could just agree on efi.h to not consume any stub config options and just determine things from its build environment instead? That way it automatically adapts according to the -m32/-m64 build flag for the stub and we would not need to worry about the stub in generic code.

Great, this way is smarter!

Quoted 3 lines

Something like the patch below? If yes, I'll resend it with proper indentation :).

Yes, and I belive we will also need remove -DEFI_STUB in lib/efi/Makefile.

Quoted 31 lines
include/efi.h +3 -7
index 98bddbac1a..5e1e8ac78c 100644
@@ -19,12 +19,12 @@
 #include <linux/string.h>
 #include <linux/types.h>
 
-#if CONFIG_EFI_STUB_64BIT || (!defined(CONFIG_EFI_STUB) &&
 defined(__x86_64__))
-/* EFI uses the Microsoft ABI which is not the default for GCC */
+/* EFI on x86_64 uses the Microsoft ABI which is not the default for GCC */
+#ifdef __x86_64__
 #define EFIAPI __attribute__((ms_abi))
 #else
 #define EFIAPI asmlinkage
-#endif
+#endif /* __x86_64__ */
 
 struct efi_device_path;
@@ -32,16 +32,7 @@ typedef struct {
     u8 b[16];
 } efi_guid_t;
 
-#define EFI_BITS_PER_LONG    BITS_PER_LONG
-
-/*
- * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set

include/efi.h typedef struct { · line 38

Quoted 10 lines
include/efi.h +1 -6
- * in lib/efi/Makefile, when building the stub.
- */
-#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB)
-#undef EFI_BITS_PER_LONG
-#define EFI_BITS_PER_LONG    64
-#endif
+#define EFI_BITS_PER_LONG    (sizeof(long) * 8)
 
 /* Bit mask for EFI status code with error */
 #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1))

Regards,
Bin

#58 lore raw

PATCH 14/18 efi: stub: Pass EFI GOP information to U-Boot payload

In reply to Bin Meng

Hi,

Quoted 10 lines · Bin Meng

If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

---

 include/efi.h      | 35 +++++++++++++++++++++++++++++++++++
 lib/efi/efi_stub.c | 15 +++++++++++++++
 2 files changed, 50 insertions(+)

Note (for Alex) that the stub can use boot services but the payload (U-Boot itself) cannot.

It is a different mode from U-Boot as an EFI application.

- Simon

author
#59 lore raw

PATCH 15/18 dm: video: Add an EFI framebuffer driver

In reply to Bin Meng

This adds a DM video driver for U-Boot as the EFI payload. The driver makes use of all necessary information from the passed EFI GOP info to create a linear framebuffer device, as if it were initialized by U-Boot itself.

---

 drivers/video/Kconfig  |   9 +++
 drivers/video/Makefile |   1 +
 drivers/video/efi.c    | 146 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 156 insertions(+)
 create mode 100644 drivers/video/efi.c
drivers/video/Kconfig +9 -0
index 4c4d286..5ee9032 100644
@@ -156,6 +156,15 @@ config VIDEO_COREBOOT
 	  coreboot already. This can in principle be used with any platform
 	  that coreboot supports.
 
+config VIDEO_EFI
+	bool "Enable EFI framebuffer driver support"
+	depends on EFI_STUB
+	help
+	  Turn on this option to enable a framebuffeer driver when U-Boot is
+	  loaded as a payload (see README.u-boot_on_efi) by an EFI BIOS where
+	  the graphics device is configured by the EFI BIOS already. This can
+	  in principle be used with any platform that has an EFI BIOS.
+
 config VIDEO_VESA
 	bool "Enable VESA video driver support"
 	default n
drivers/video/Makefile +1 -0
index cf7ad28..7c89c67 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_LD9040) += ld9040.o
 obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
 obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o
+obj-$(CONFIG_VIDEO_EFI) += efi.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
drivers/video/efi.c new file +146 -0

146 lines not on this page · raw message

Signature · 1 line
2.7.4
#60 lore raw

PATCH 15/18 dm: video: Add an EFI framebuffer driver

Hi Bin,

Quoted 6 lines · On Sun, 10 Jun 2018 06:25:14 -0700 Bin Meng bmeng.cn at gmail.com wrote:

This adds a DM video driver for U-Boot as the EFI payload. The driver makes use of all necessary information from the passed EFI GOP info to create a linear framebuffer device, as if it were initialized by U-Boot itself.

--
Anatolij

author
#61 lore raw

PATCH 16/18 x86: efi: payload: Add EFI framebuffer driver support

In reply to Bin Meng

This turns on the EFI framebuffer driver support so that a graphics console can be of additional help.

---

 arch/x86/dts/efi-x86_payload.dts  | 4 ++++
 board/efi/efi-x86_payload/Kconfig | 1 +
 2 files changed, 5 insertions(+)
arch/x86/dts/efi-x86_payload.dts +4 -0
index 137bde5..148b587 100644
@@ -33,4 +33,8 @@
 		compatible = "pci-x86";
 		u-boot,dm-pre-reloc;
 	};
+
+	efi-fb {
+		compatible = "efi-fb";
+	};
 };
board/efi/efi-x86_payload/Kconfig +1 -0
index dcf4de8..b6e57b9 100644
@@ -30,6 +30,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply USB_XHCI_HCD
 	imply USB_STORAGE
 	imply USB_KEYBOARD
+	imply VIDEO_EFI
 	imply E1000
 	imply ETH_DESIGNWARE
 	imply PCH_GBE
Signature · 1 line
2.7.4
#62 lore raw

PATCH 16/18 x86: efi: payload: Add EFI framebuffer driver support

Quoted 9 lines · Bin Meng

This turns on the EFI framebuffer driver support so that a graphics console can be of additional help.

---

 arch/x86/dts/efi-x86_payload.dts  | 4 ++++
 board/efi/efi-x86_payload/Kconfig | 1 +
 2 files changed, 5 insertions(+)
author
#63 lore raw

PATCH 17/18 x86: Rename efi-x86 target to efi-x86_app

In reply to Bin Meng

To avoid confusion, let's rename the efi-x86 target to efi-x86_app.

---

 arch/x86/cpu/efi/Makefile                            | 2 +-
 arch/x86/cpu/efi/{efi.c => app.c}                    | 0
 arch/x86/cpu/intel_common/Makefile                   | 2 +-
 arch/x86/dts/Makefile                                | 2 +-
 arch/x86/dts/{efi.dts => efi-x86_app.dts}            | 4 ++--
 board/efi/Kconfig                                    | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/Kconfig           | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS       | 0
 board/efi/{efi-x86 => efi-x86_app}/Makefile          | 2 +-
 board/efi/{efi-x86/efi.c => efi-x86_app/app.c}       | 0
 configs/{efi-x86_defconfig => efi-x86_app_defconfig} | 4 ++--
 include/configs/{efi-x86.h => efi-x86_app.h}         | 0
 12 files changed, 14 insertions(+), 14 deletions(-)
 rename arch/x86/cpu/efi/{efi.c => app.c} (100%)
 rename arch/x86/dts/{efi.dts => efi-x86_app.dts} (82%)
 rename board/efi/{efi-x86 => efi-x86_app}/Kconfig (64%)
 rename board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS (100%)
 rename board/efi/{efi-x86 => efi-x86_app}/Makefile (82%)
 rename board/efi/{efi-x86/efi.c => efi-x86_app/app.c} (100%)
 rename configs/{efi-x86_defconfig => efi-x86_app_defconfig} (92%)
 rename include/configs/{efi-x86.h => efi-x86_app.h} (100%)
arch/x86/cpu/efi/Makefile +1 -1
index 32c2dde..9716a4e 100644
@@ -3,7 +3,7 @@
 # Copyright (c) 2015 Google, Inc
 
 ifdef CONFIG_EFI_APP
-obj-y += efi.o
+obj-y += app.o
 obj-y += sdram.o
 endif
 
arch/x86/cpu/efi/app.c renamed from arch/x86/cpu/efi/efi.c +0 -0
similarity index 100%
rename from arch/x86/cpu/efi/efi.c
rename to arch/x86/cpu/efi/app.c
arch/x86/cpu/intel_common/Makefile +1 -1
index c0fcf0c..bf798c2 100644
@@ -10,7 +10,7 @@ obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += mrc.o
 endif
 obj-y += cpu.o
 obj-y += lpc.o
-ifndef CONFIG_TARGET_EFI
+ifndef CONFIG_TARGET_EFI_APP
 obj-y += microcode.o
 endif
 obj-y += pch.o
arch/x86/dts/Makefile +1 -1
index 9872c04..37e4fdc 100644
@@ -10,7 +10,7 @@ dtb-y += bayleybay.dtb \
 	crownbay.dtb \
 	dfi-bt700-q7x-151.dtb \
 	edison.dtb \
-	efi.dtb \
+	efi-x86_app.dtb \
 	efi-x86_payload.dtb \
 	galileo.dtb \
 	minnowmax.dtb \
arch/x86/dts/efi-x86_app.dts renamed from arch/x86/dts/efi.dts +2 -2
similarity index 82%
rename from arch/x86/dts/efi.dts
rename to arch/x86/dts/efi-x86_app.dts
index 62ae96a..e70e351 100644
@@ -9,8 +9,8 @@
 /include/ "tsc_timer.dtsi"
 
 / {
-	model = "EFI";
-	compatible = "efi,app";
+	model = "EFI x86 Application";
+	compatible = "efi,x86-app";
 
 	chosen {
 		stdout-path = &serial;
board/efi/Kconfig +3 -3
index d37f6ff..291bd2c 100644
@@ -4,8 +4,8 @@ choice
 	prompt "Mainboard model"
 	optional
 
-config TARGET_EFI
-	bool "efi"
+config TARGET_EFI_APP
+	bool "efi application"
 	help
 	  This target is used for running U-Boot on top of EFI. In
 	  this case EFI does the early initialisation, and U-Boot
@@ -22,7 +22,7 @@ config TARGET_EFI_PAYLOAD
 
 endchoice
 
-source "board/efi/efi-x86/Kconfig"
+source "board/efi/efi-x86_app/Kconfig"
 source "board/efi/efi-x86_payload/Kconfig"
 
 endif
board/efi/efi-x86_app/Kconfig renamed from board/efi/efi-x86/Kconfig +3 -3
similarity index 64%
rename from board/efi/efi-x86/Kconfig
rename to board/efi/efi-x86_app/Kconfig
index fa609ba..ae87bf3 100644
@@ -1,7 +1,7 @@
-if TARGET_EFI
+if TARGET_EFI_APP
 
 config SYS_BOARD
-	default "efi-x86"
+	default "efi-x86_app"
 
 config SYS_VENDOR
 	default "efi"
@@ -10,6 +10,6 @@ config SYS_SOC
 	default "efi"
 
 config SYS_CONFIG_NAME
-	default "efi-x86"
+	default "efi-x86_app"
 
 endif
board/efi/efi-x86_app/MAINTAINERS renamed from board/efi/efi-x86/MAINTAINERS +0 -0
similarity index 100%
rename from board/efi/efi-x86/MAINTAINERS
rename to board/efi/efi-x86_app/MAINTAINERS
board/efi/efi-x86_app/Makefile renamed from board/efi/efi-x86/Makefile +1 -1
similarity index 82%
rename from board/efi/efi-x86/Makefile
rename to board/efi/efi-x86_app/Makefile
index 2097283..cb48d1c 100644
@@ -2,4 +2,4 @@
 #
 # Copyright (c) 2015 Google, Inc
 
-obj-y	+= efi.o
+obj-y	+= app.o
board/efi/efi-x86_app/app.c renamed from board/efi/efi-x86/efi.c +0 -0
similarity index 100%
rename from board/efi/efi-x86/efi.c
rename to board/efi/efi-x86_app/app.c
configs/efi-x86_app_defconfig renamed from configs/efi-x86_defconfig +2 -2
similarity index 92%
rename from configs/efi-x86_defconfig
rename to configs/efi-x86_app_defconfig
index 741a169..4088dae 100644
@@ -1,7 +1,7 @@
 CONFIG_X86=y
 CONFIG_VENDOR_EFI=y
-CONFIG_DEFAULT_DEVICE_TREE="efi"
-CONFIG_TARGET_EFI=y
+CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app"
+CONFIG_TARGET_EFI_APP=y
 CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_USE_BOOTARGS=y
include/configs/efi-x86_app.h renamed from include/configs/efi-x86.h +0 -0
similarity index 100%
rename from include/configs/efi-x86.h
rename to include/configs/efi-x86_app.h
Signature · 1 line
2.7.4
#64 lore raw

PATCH 17/18 x86: Rename efi-x86 target to efi-x86_app

Quoted 18 lines · Bin Meng

To avoid confusion, let's rename the efi-x86 target to efi-x86_app.

---

 arch/x86/cpu/efi/Makefile                            | 2 +-
 arch/x86/cpu/efi/{efi.c => app.c}                    | 0
 arch/x86/cpu/intel_common/Makefile                   | 2 +-
 arch/x86/dts/Makefile                                | 2 +-
 arch/x86/dts/{efi.dts => efi-x86_app.dts}            | 4 ++--
 board/efi/Kconfig                                    | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/Kconfig           | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS       | 0
 board/efi/{efi-x86 => efi-x86_app}/Makefile          | 2 +-
 board/efi/{efi-x86/efi.c => efi-x86_app/app.c}       | 0
 configs/{efi-x86_defconfig => efi-x86_app_defconfig} | 4 ++--
 include/configs/{efi-x86.h => efi-x86_app.h}         | 0
 12 files changed, 14 insertions(+), 14 deletions(-)
Quoted 9 lines
 rename arch/x86/cpu/efi/{efi.c => app.c} (100%)
 rename arch/x86/dts/{efi.dts => efi-x86_app.dts} (82%)
 rename board/efi/{efi-x86 => efi-x86_app}/Kconfig (64%)
 rename board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS (100%)
 rename board/efi/{efi-x86 => efi-x86_app}/Makefile (82%)
 rename board/efi/{efi-x86/efi.c => efi-x86_app/app.c} (100%)
 rename configs/{efi-x86_defconfig => efi-x86_app_defconfig} (92%)
 rename include/configs/{efi-x86.h => efi-x86_app.h} (100%)

Is a docs update needed too?

author
#65 lore raw

PATCH 17/18 x86: Rename efi-x86 target to efi-x86_app

Hi Simon,

Quoted 29 lines · Simon Glass
Quoted 18 lines · Bin Meng

To avoid confusion, let's rename the efi-x86 target to efi-x86_app.

---

 arch/x86/cpu/efi/Makefile                            | 2 +-
 arch/x86/cpu/efi/{efi.c => app.c}                    | 0
 arch/x86/cpu/intel_common/Makefile                   | 2 +-
 arch/x86/dts/Makefile                                | 2 +-
 arch/x86/dts/{efi.dts => efi-x86_app.dts}            | 4 ++--
 board/efi/Kconfig                                    | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/Kconfig           | 6 +++---
 board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS       | 0
 board/efi/{efi-x86 => efi-x86_app}/Makefile          | 2 +-
 board/efi/{efi-x86/efi.c => efi-x86_app/app.c}       | 0
 configs/{efi-x86_defconfig => efi-x86_app_defconfig} | 4 ++--
 include/configs/{efi-x86.h => efi-x86_app.h}         | 0
 12 files changed, 14 insertions(+), 14 deletions(-)
Quoted 9 lines
 rename arch/x86/cpu/efi/{efi.c => app.c} (100%)
 rename arch/x86/dts/{efi.dts => efi-x86_app.dts} (82%)
 rename board/efi/{efi-x86 => efi-x86_app}/Kconfig (64%)
 rename board/efi/{efi-x86 => efi-x86_app}/MAINTAINERS (100%)
 rename board/efi/{efi-x86 => efi-x86_app}/Makefile (82%)
 rename board/efi/{efi-x86/efi.c => efi-x86_app/app.c} (100%)
 rename configs/{efi-x86_defconfig => efi-x86_app_defconfig} (92%)
 rename include/configs/{efi-x86.h => efi-x86_app.h} (100%)
Quoted 3 lines

Is a docs update needed too?

Yes, will send v2 to include doc update.

Regards,
Bin

author
#66 lore raw

PATCH 18/18 x86: efi: app: Display correct CPU info during boot

In reply to Bin Meng

Currently when EFI application boots, it says:

CPU: x86_64, vendor <invalid cpu vendor>, device 0h

Fix this by calling x86_cpu_init_f() in arch_cpu_init().

---

 arch/x86/cpu/efi/app.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/efi/app.c +1 -1
index cda4fab..ba7c02b 100644
@@ -9,7 +9,7 @@
 
 int arch_cpu_init(void)
 {
-	return 0;
+	return x86_cpu_init_f();
 }
 
 int checkcpu(void)
Signature · 1 line
2.7.4
#67 lore raw

PATCH 18/18 x86: efi: app: Display correct CPU info during boot

Quoted 4 lines · Bin Meng

Currently when EFI application boots, it says:

CPU: x86_64, vendor <invalid cpu vendor>, device 0h

Quoted 8 lines

Fix this by calling x86_cpu_init_f() in arch_cpu_init().

---

 arch/x86/cpu/efi/app.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#68 lore raw

cover x86: efi: Fixes and enhancements to application and payload support

In reply to Bin Meng

Hi Bin,

Quoted 7 lines · Bin Meng

Unfortunately the EFI x86 application and payload support have been broken for quite a while. This series addresses various bug fixes, plus several enhancements like toolchain compatibility (eg: kernel.org i386-linux-gcc), introduction of generic EFI payload which can run on any x86 board, and a EFI framebuffer driver for the payload.

This series is available at u-boot-x86/efi-working for testing.

I wonder if it is possible to put qemu testing of the EFI stuff into travis?

Also, are the problems only with the i386 compiler, or are things truly broken everywhere?

Regards,
Simon

author
#69 lore raw

cover x86: efi: Fixes and enhancements to application and payload support

Hi Simon,

Quoted 9 lines · Simon Glass

Hi Bin,

Quoted 6 lines · Bin Meng

Unfortunately the EFI x86 application and payload support have been broken for quite a while. This series addresses various bug fixes, plus several enhancements like toolchain compatibility (eg: kernel.org i386-linux-gcc), introduction of generic EFI payload which can run on any x86 board, and a EFI framebuffer driver for the payload.

Quoted 3 lines
Quoted 1 line

This series is available at u-boot-x86/efi-working for testing.

I wonder if it is possible to put qemu testing of the EFI stuff into travis?

I will take a look.

Quoted 4 lines

Also, are the problems only with the i386 compiler, or are things truly broken everywhere?

Current mainline status of the EFI stuff is:

1. EFI application does not boot
2. EFI 32-bit payload boots fine
3. EFI 64-bit payload does not boot
4. i386-linux-gcc compiler does not build EFI 64-bit payload, but can build 32-bit payload and application
5. x86_64-linux-gcc compiler can build everything

Regards,
Bin

#70 lore raw

cover x86: efi: Fixes and enhancements to application and payload support

Hi Bin,

Quoted 24 lines · Bin Meng

Hi Simon,

Quoted 9 lines · Simon Glass

Hi Bin,

Quoted 6 lines · Bin Meng

Unfortunately the EFI x86 application and payload support have been broken for quite a while. This series addresses various bug fixes, plus several enhancements like toolchain compatibility (eg: kernel.org i386-linux-gcc), introduction of generic EFI payload which can run on any x86 board, and a EFI framebuffer driver for the payload.

Quoted 3 lines
Quoted 1 line

This series is available at u-boot-x86/efi-working for testing.

I wonder if it is possible to put qemu testing of the EFI stuff into travis?

I will take a look.

Quoted 4 lines

Also, are the problems only with the i386 compiler, or are things truly broken everywhere?

Quoted 8 lines

Current mainline status of the EFI stuff is:

1. EFI application does not boot
2. EFI 32-bit payload boots fine
3. EFI 64-bit payload does not boot
4. i386-linux-gcc compiler does not build EFI 64-bit payload, but can build 32-bit payload and application
5. x86_64-linux-gcc compiler can build everything

OK great, thank you.

Re (1) it seems a bit tricky since as you say it is a shared library. I suppose we could get a list of unresolved symbols and check them against a whitelist. Or statically link the efi app just for testing purposes.

Regards,
Simon