Skip to contentSkip to conversation

x86: efi: payload: Make EFI payload build again

PATCH New Bin Meng 2 participants 8 messages Aug 25, 2016 – Aug 30, 2016 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/3 x86: efi: payload: Make EFI payload build again

Since commit 73c5c39 "Makefile: Drop unnecessary -dtb suffixes", EFI payload does not build anymore. This fixes the build.

---

Changes in v2: None

 include/efi.h      | 2 +-
 lib/efi/efi_stub.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
include/efi.h +1 -1
index 1dbc3b7..21921f1 100644
@@ -278,7 +278,7 @@ struct efi_priv {
 extern char image_base[];
 
 /* Start and end of U-Boot image (for payload) */
-extern char _binary_u_boot_dtb_bin_start[], _binary_u_boot_dtb_bin_end[];
+extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[];
 
 /**
  * efi_get_sys_table() - Get access to the main EFI system table
lib/efi/efi_stub.c +3 -3
index 8b4bb4e..1814960 100644
@@ -354,9 +354,9 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	/* The EFI UART won't work now, switch to a debug one */
 	use_uart = true;
 
-	memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_dtb_bin_start,
-	       (ulong)_binary_u_boot_dtb_bin_end -
-	       (ulong)_binary_u_boot_dtb_bin_start);
+	memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_bin_start,
+	       (ulong)_binary_u_boot_bin_end -
+	       (ulong)_binary_u_boot_bin_start);
 
 #ifdef DEBUG
 	puts("EFI table at ");
Signature · 1 line
2.9.2
author
#2 lore raw

PATCH v2 2/3 x86: efi: Fix EFI 64-bit payload build warnings

There are lots of warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

  	if (!(word & (~0ul << 32))) {
			^

In fact, U-Boot itself as EFI payload is running in 32-bit mode. So BITS_PER_LONG needs to still be 32, but EFI status codes are 64-bit when booting from 64-bit EFI. Introduce EFI_BITS_PER_LONG to bridge those status codes with U-Boot's BITS_PER_LONG.

---

Changes in v2:
- Rework the patch to fix 64-bit payload boot issue

 arch/x86/include/asm/types.h |  4 ----
 include/efi.h                | 32 ++++++++++++++++++++------------
 2 files changed, 20 insertions(+), 16 deletions(-)
arch/x86/include/asm/types.h +0 -4
index 766617f..880dcb4 100644
@@ -44,11 +44,7 @@ typedef __INT64_TYPE__ s64;
 typedef __UINT64_TYPE__ u64;
 #endif
 
-#ifdef CONFIG_EFI_STUB_64BIT
-#define BITS_PER_LONG 64
-#else
 #define BITS_PER_LONG 32
-#endif
 /* Dma addresses are 32-bits wide.  */
 
 typedef u32 dma_addr_t;
include/efi.h +20 -12
index 21921f1..83de2d4 100644
@@ -27,19 +27,27 @@
 
 struct efi_device_path;
 
+#define EFI_BITS_PER_LONG	BITS_PER_LONG
+
+/* With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64 */
+#ifdef CONFIG_EFI_STUB_64BIT
+#undef EFI_BITS_PER_LONG
+#define EFI_BITS_PER_LONG	64
+#endif
+
 #define EFI_SUCCESS		0
-#define EFI_LOAD_ERROR		(1 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_INVALID_PARAMETER	(2 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_UNSUPPORTED		(3 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_BAD_BUFFER_SIZE	(4 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_BUFFER_TOO_SMALL	(5 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_NOT_READY		(6 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_DEVICE_ERROR	(7 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_WRITE_PROTECTED	(8 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_OUT_OF_RESOURCES	(9 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_NOT_FOUND		(14 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_ACCESS_DENIED	(15 | (1UL << (BITS_PER_LONG - 1)))
-#define EFI_SECURITY_VIOLATION	(26 | (1UL << (BITS_PER_LONG - 1)))
+#define EFI_LOAD_ERROR		(1 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_INVALID_PARAMETER	(2 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_UNSUPPORTED		(3 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_BAD_BUFFER_SIZE	(4 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_BUFFER_TOO_SMALL	(5 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_NOT_READY		(6 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_DEVICE_ERROR	(7 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_WRITE_PROTECTED	(8 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_OUT_OF_RESOURCES	(9 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_NOT_FOUND		(14 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_ACCESS_DENIED	(15 | (1UL << (EFI_BITS_PER_LONG - 1)))
+#define EFI_SECURITY_VIOLATION	(26 | (1UL << (EFI_BITS_PER_LONG - 1)))
 
 typedef unsigned long efi_status_t;
 typedef u64 efi_physical_addr_t;
Signature · 1 line
2.9.2
author
#6 lore raw

PATCH v2 3/3 x86: qemu: efi: Add two boards for EFI 32-bit and 64-bit payload

In reply to Bin Meng

This introduces two board defconfig files for generating EFI 32-bit and 64-bit payloads, to run on QEMU x86 target.

With these in place, hopefully buildman will catch any build error with EFI payload support on x86.

---

Changes in v2:
- Add maintainter entry for the two boards

 board/emulation/qemu-x86/MAINTAINERS     |  2 ++
 configs/qemu-x86_efi_payload32_defconfig | 48 +++++++++++++++++++++++++++++++
 configs/qemu-x86_efi_payload64_defconfig | 49 ++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 configs/qemu-x86_efi_payload32_defconfig
 create mode 100644 configs/qemu-x86_efi_payload64_defconfig
board/emulation/qemu-x86/MAINTAINERS +2 -0
index ea4dd19..54dc2c5 100644
@@ -4,3 +4,5 @@ S:	Maintained
 F:	board/emulation/qemu-x86/
 F:	include/configs/qemu-x86.h
 F:	configs/qemu-x86_defconfig
+F:	configs/qemu-x86_efi_payload32_defconfig
+F:	configs/qemu-x86_efi_payload64_defconfig
configs/qemu-x86_efi_payload32_defconfig new file +48 -0

48 lines not on this page · raw message

configs/qemu-x86_efi_payload64_defconfig new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.9.2
author
#3 lore raw

PATCH v2 2/3 x86: efi: Fix EFI 64-bit payload build warnings

In reply to Bin Meng

Hi Simon,

Quoted 14 lines · Bin Meng

There are lots of warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

        if (!(word & (~0ul << 32))) {
                        ^

In fact, U-Boot itself as EFI payload is running in 32-bit mode. So BITS_PER_LONG needs to still be 32, but EFI status codes are 64-bit when booting from 64-bit EFI. Introduce EFI_BITS_PER_LONG to bridge those status codes with U-Boot's BITS_PER_LONG.

Quoted 9 lines

---

Changes in v2:
- Rework the patch to fix 64-bit payload boot issue

 arch/x86/include/asm/types.h |  4 ----
 include/efi.h                | 32 ++++++++++++++++++++------------
 2 files changed, 20 insertions(+), 16 deletions(-)

Please have a look at this.

Regards,
Bin

#4 lore raw

PATCH v2 2/3 x86: efi: Fix EFI 64-bit payload build warnings

In reply to Bin Meng
Quoted 14 lines · Bin Meng

There are lots of warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

        if (!(word & (~0ul << 32))) {
                        ^

In fact, U-Boot itself as EFI payload is running in 32-bit mode. So BITS_PER_LONG needs to still be 32, but EFI status codes are 64-bit when booting from 64-bit EFI. Introduce EFI_BITS_PER_LONG to bridge those status codes with U-Boot's BITS_PER_LONG.

Quoted 8 lines

---

Changes in v2:
- Rework the patch to fix 64-bit payload boot issue

 arch/x86/include/asm/types.h |  4 ----
 include/efi.h                | 32 ++++++++++++++++++++------------
 2 files changed, 20 insertions(+), 16 deletions(-)
author
#1 lore raw

PATCH v2 1/3 x86: efi: payload: Make EFI payload build again

In reply to Bin Meng
Quoted 5 lines · Bin Meng

Since commit 73c5c39 "Makefile: Drop unnecessary -dtb suffixes", EFI payload does not build anymore. This fixes the build.

Quoted 8 lines

---

Changes in v2: None

 include/efi.h      | 2 +-
 lib/efi/efi_stub.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

applied to u-boot-x86, thanks!

author
#5 lore raw

PATCH v2 2/3 x86: efi: Fix EFI 64-bit payload build warnings

In reply to Simon Glass
Quoted 17 lines · Simon Glass
Quoted 16 lines · Bin Meng

There are lots of warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

        if (!(word & (~0ul << 32))) {
                        ^

In fact, U-Boot itself as EFI payload is running in 32-bit mode. So BITS_PER_LONG needs to still be 32, but EFI status codes are 64-bit when booting from 64-bit EFI. Introduce EFI_BITS_PER_LONG to bridge those status codes with U-Boot's BITS_PER_LONG.

---

Quoted 8 lines
Quoted 6 lines

Changes in v2:
- Rework the patch to fix 64-bit payload boot issue

 arch/x86/include/asm/types.h |  4 ----
 include/efi.h                | 32 ++++++++++++++++++++------------
 2 files changed, 20 insertions(+), 16 deletions(-)

applied to u-boot-x86, thanks!

author
#7 lore raw

PATCH v2 3/3 x86: qemu: efi: Add two boards for EFI 32-bit and 64-bit payload

In reply to Bin Meng
Quoted 14 lines · Bin Meng

This introduces two board defconfig files for generating EFI 32-bit and 64-bit payloads, to run on QEMU x86 target.

With these in place, hopefully buildman will catch any build error with EFI payload support on x86.

---

Changes in v2:
- Add maintainter entry for the two boards

Quoted 7 lines
 board/emulation/qemu-x86/MAINTAINERS     |  2 ++
 configs/qemu-x86_efi_payload32_defconfig | 48 +++++++++++++++++++++++++++++++
 configs/qemu-x86_efi_payload64_defconfig | 49 ++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 configs/qemu-x86_efi_payload32_defconfig
 create mode 100644 configs/qemu-x86_efi_payload64_defconfig

applied to u-boot-x86, thanks!