diff mbox

[U-Boot,v2,20/47] efi: Avoid using non-existent text base

Message ID 1438356724-6561-21-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 31, 2015, 3:31 p.m. UTC
From: Ben Stoltz <stoltz@google.com>

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
- Reorder this patch to after CONFIG_EFI_APP is introduced

 common/board_f.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Bin Meng Aug. 2, 2015, 3:04 p.m. UTC | #1
On Fri, Jul 31, 2015 at 11:31 PM, Simon Glass <sjg@chromium.org> wrote:
> From: Ben Stoltz <stoltz@google.com>
>
> When U-Boot runs as an EFI application is does not have a definition of
> CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
> is done by EFI. U-Boot can be loaded at any address.
>
> This is similar to how sandbox works. Adjust the early board init to deal
> with this.
>
> Signed-off-by: Ben Stoltz <stoltz@google.com>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
> - Reorder this patch to after CONFIG_EFI_APP is introduced
>
>  common/board_f.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index 5e09c5f..c596083 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -144,7 +144,7 @@ static int init_baud_rate(void)
>
>  static int display_text_info(void)
>  {
> -#ifndef CONFIG_SANDBOX
> +#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
>         ulong bss_start, bss_end, text_base;
>
>         bss_start = (ulong)&__bss_start;
> @@ -267,7 +267,7 @@ static int setup_mon_len(void)
>  {
>  #if defined(__ARM__) || defined(__MICROBLAZE__)
>         gd->mon_len = (ulong)&__bss_end - (ulong)_start;
> -#elif defined(CONFIG_SANDBOX)
> +#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
>         gd->mon_len = (ulong)&_end - (ulong)_init;
>  #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
>         gd->mon_len = CONFIG_SYS_MONITOR_LEN;
> @@ -975,7 +975,8 @@ void board_init_f(ulong boot_flags)
>         if (initcall_run_list(init_sequence_f))
>                 hang();
>
> -#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
> +#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
> +               !defined(CONFIG_EFI_APP)
>         /* NOTREACHED - jump_to_copy() does not return */
>         hang();
>  #endif
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Aug. 2, 2015, 11:37 p.m. UTC | #2
On 2 August 2015 at 09:04, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Fri, Jul 31, 2015 at 11:31 PM, Simon Glass <sjg@chromium.org> wrote:
>> From: Ben Stoltz <stoltz@google.com>
>>
>> When U-Boot runs as an EFI application is does not have a definition of
>> CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
>> is done by EFI. U-Boot can be loaded at any address.
>>
>> This is similar to how sandbox works. Adjust the early board init to deal
>> with this.
>>
>> Signed-off-by: Ben Stoltz <stoltz@google.com>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2:
>> - Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
>> - Reorder this patch to after CONFIG_EFI_APP is introduced
>>
>>  common/board_f.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/board_f.c b/common/board_f.c
>> index 5e09c5f..c596083 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -144,7 +144,7 @@ static int init_baud_rate(void)
>>
>>  static int display_text_info(void)
>>  {
>> -#ifndef CONFIG_SANDBOX
>> +#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
>>         ulong bss_start, bss_end, text_base;
>>
>>         bss_start = (ulong)&__bss_start;
>> @@ -267,7 +267,7 @@ static int setup_mon_len(void)
>>  {
>>  #if defined(__ARM__) || defined(__MICROBLAZE__)
>>         gd->mon_len = (ulong)&__bss_end - (ulong)_start;
>> -#elif defined(CONFIG_SANDBOX)
>> +#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
>>         gd->mon_len = (ulong)&_end - (ulong)_init;
>>  #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
>>         gd->mon_len = CONFIG_SYS_MONITOR_LEN;
>> @@ -975,7 +975,8 @@ void board_init_f(ulong boot_flags)
>>         if (initcall_run_list(init_sequence_f))
>>                 hang();
>>
>> -#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
>> +#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
>> +               !defined(CONFIG_EFI_APP)
>>         /* NOTREACHED - jump_to_copy() does not return */
>>         hang();
>>  #endif
>> --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 5e09c5f..c596083 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -144,7 +144,7 @@  static int init_baud_rate(void)
 
 static int display_text_info(void)
 {
-#ifndef CONFIG_SANDBOX
+#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
 	ulong bss_start, bss_end, text_base;
 
 	bss_start = (ulong)&__bss_start;
@@ -267,7 +267,7 @@  static int setup_mon_len(void)
 {
 #if defined(__ARM__) || defined(__MICROBLAZE__)
 	gd->mon_len = (ulong)&__bss_end - (ulong)_start;
-#elif defined(CONFIG_SANDBOX)
+#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
 	gd->mon_len = (ulong)&_end - (ulong)_init;
 #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
 	gd->mon_len = CONFIG_SYS_MONITOR_LEN;
@@ -975,7 +975,8 @@  void board_init_f(ulong boot_flags)
 	if (initcall_run_list(init_sequence_f))
 		hang();
 
-#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
+#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
+		!defined(CONFIG_EFI_APP)
 	/* NOTREACHED - jump_to_copy() does not return */
 	hang();
 #endif