[PATCH] efi_loader: move asm/setjmp.h to efi_loader.h

In the commit c982874e930d ("efi_loader: refactor efi_setup_loaded_image()"), setjmp-related definitions were moved to efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer refererenced in efi_api.h.
This also fixes some error when efi_api.h will be included in mkeficapsule.c.
On the other hand, a tweak will be necessary in common/main.c as some architectures have no setjmp support.
Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org --- common/main.c | 6 ++++++ include/efi_api.h | 4 ---- include/efi_loader.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/common/main.c b/common/main.c index ae5bcdb32f8b..a41c57c26611 100644 --- a/common/main.c +++ b/common/main.c @@ -16,7 +16,13 @@ #include <init.h> #include <net.h> #include <version.h> +#ifdef CONFIG_EFI_LOADER +/* + * Unfortunately, efi_loader requires setjmp.h, but there are + * some architectures which have no support for setjmp. + */ #include <efi_loader.h> +#endif
static void run_preboot_environment_command(void) { diff --git a/include/efi_api.h b/include/efi_api.h index 18a1adf02390..e854a8b3a112 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -20,10 +20,6 @@ #include <charset.h> #include <pe.h>
-#ifdef CONFIG_EFI_LOADER -#include <asm/setjmp.h> -#endif - /* UEFI spec version 2.8 */ #define EFI_SPECIFICATION_VERSION (2 << 16 | 80)
diff --git a/include/efi_loader.h b/include/efi_loader.h index de1a496a9726..6994a951bc19 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -15,6 +15,7 @@ #include <efi_api.h> #include <image.h> #include <pe.h> +#include <asm/setjmp.h>
struct blk_desc;

On 5/10/21 10:21 AM, AKASHI Takahiro wrote:
In the commit c982874e930d ("efi_loader: refactor efi_setup_loaded_image()"), setjmp-related definitions were moved to efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer refererenced in efi_api.h.
This also fixes some error when efi_api.h will be included in mkeficapsule.c.
On the other hand, a tweak will be necessary in common/main.c as some architectures have no setjmp support.
Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org
common/main.c | 6 ++++++ include/efi_api.h | 4 ---- include/efi_loader.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/common/main.c b/common/main.c index ae5bcdb32f8b..a41c57c26611 100644 --- a/common/main.c +++ b/common/main.c @@ -16,7 +16,13 @@ #include <init.h> #include <net.h> #include <version.h> +#ifdef CONFIG_EFI_LOADER +/*
- Unfortunately, efi_loader requires setjmp.h, but there are
- some architectures which have no support for setjmp.
- */ #include <efi_loader.h>
Your patch results in build failures for qemu_mips64_defconfig like:
In file included from cmd/load.c:14: include/efi_loader.h:18:10: fatal error: asm/setjmp.h: No such file or directory 18 | #include <asm/setjmp.h> | ^~~~~~~~~~~~~~
If there is a problem with mkeficapsule, you can fix it there.
Best regards
Heinrich
+#endif
static void run_preboot_environment_command(void) { diff --git a/include/efi_api.h b/include/efi_api.h index 18a1adf02390..e854a8b3a112 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -20,10 +20,6 @@ #include <charset.h> #include <pe.h>
-#ifdef CONFIG_EFI_LOADER -#include <asm/setjmp.h> -#endif
- /* UEFI spec version 2.8 */ #define EFI_SPECIFICATION_VERSION (2 << 16 | 80)
diff --git a/include/efi_loader.h b/include/efi_loader.h index de1a496a9726..6994a951bc19 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -15,6 +15,7 @@ #include <efi_api.h> #include <image.h> #include <pe.h> +#include <asm/setjmp.h>
struct blk_desc;

On Thu, May 20, 2021 at 04:48:23AM +0200, Heinrich Schuchardt wrote:
On 5/10/21 10:21 AM, AKASHI Takahiro wrote:
In the commit c982874e930d ("efi_loader: refactor efi_setup_loaded_image()"), setjmp-related definitions were moved to efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer refererenced in efi_api.h.
This also fixes some error when efi_api.h will be included in mkeficapsule.c.
On the other hand, a tweak will be necessary in common/main.c as some architectures have no setjmp support.
Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org
common/main.c | 6 ++++++ include/efi_api.h | 4 ---- include/efi_loader.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/common/main.c b/common/main.c index ae5bcdb32f8b..a41c57c26611 100644 --- a/common/main.c +++ b/common/main.c @@ -16,7 +16,13 @@ #include <init.h> #include <net.h> #include <version.h> +#ifdef CONFIG_EFI_LOADER +/*
- Unfortunately, efi_loader requires setjmp.h, but there are
- some architectures which have no support for setjmp.
- */ #include <efi_loader.h>
Your patch results in build failures for qemu_mips64_defconfig like:
In file included from cmd/load.c:14: include/efi_loader.h:18:10: fatal error: asm/setjmp.h: No such file or directory 18 | #include <asm/setjmp.h> | ^~~~~~~~~~~~~~
If there is a problem with mkeficapsule, you can fix it there.
My whole intent is to remove asm/setjmp.h from efi_api.h as it doesn't make sense to include it there.
In efi_loader.h, we need asm/setjmp.h only for the definition of struct jmp_buf_data. We can remove the include file here by adding "struct jmp_buf_data;" line.
Will repost the patch.
-Takahiro Akashi
Best regards
Heinrich
+#endif
static void run_preboot_environment_command(void) { diff --git a/include/efi_api.h b/include/efi_api.h index 18a1adf02390..e854a8b3a112 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -20,10 +20,6 @@ #include <charset.h> #include <pe.h>
-#ifdef CONFIG_EFI_LOADER -#include <asm/setjmp.h> -#endif
- /* UEFI spec version 2.8 */ #define EFI_SPECIFICATION_VERSION (2 << 16 | 80)
diff --git a/include/efi_loader.h b/include/efi_loader.h index de1a496a9726..6994a951bc19 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -15,6 +15,7 @@ #include <efi_api.h> #include <image.h> #include <pe.h> +#include <asm/setjmp.h>
struct blk_desc;
participants (2)
-
AKASHI Takahiro
-
Heinrich Schuchardt