diff mbox

[U-Boot,05/48] Add a way to skip relocation

Message ID 1437580180-6405-6-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 22, 2015, 3:48 p.m. UTC
When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

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

 common/board_f.c                  | 7 +++++++
 include/asm-generic/global_data.h | 1 +
 2 files changed, 8 insertions(+)

Comments

Bin Meng July 23, 2015, 3:41 a.m. UTC | #1
Hi Simon,

On Wed, Jul 22, 2015 at 11:48 PM, Simon Glass <sjg@chromium.org> wrote:
> When running U-Boot as an EFI application we cannot relocate since we do not
> have relocation information. U-Boot has already been relocated to a suitable
> address.
>
> Add a global_data flag to control skipping relocation.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/board_f.c                  | 7 +++++++
>  include/asm-generic/global_data.h | 1 +
>  2 files changed, 8 insertions(+)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index 21be26f..5e09c5f 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -664,6 +664,11 @@ static int reloc_fdt(void)
>
>  static int setup_reloc(void)
>  {
> +       if (gd->flags & GD_FLG_SKIP_RELOC) {
> +               debug("Skipping relocation due to flag\n");
> +               return 0;
> +       }
> +
>  #ifdef CONFIG_SYS_TEXT_BASE
>         gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
>  #ifdef CONFIG_M68K
> @@ -689,6 +694,8 @@ static int setup_reloc(void)
>
>  static int jump_to_copy(void)
>  {
> +       if (gd->flags & GD_FLG_SKIP_RELOC)
> +               return 0;
>         /*
>          * x86 is special, but in a nice way. It uses a trampoline which
>          * enables the dcache if possible.
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index db0550b..086ee96 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -116,5 +116,6 @@ typedef struct global_data {
>  #define GD_FLG_ENV_READY       0x00080 /* Env. imported into hash table   */
>  #define GD_FLG_SERIAL_READY    0x00100 /* Pre-reloc serial console ready  */
>  #define GD_FLG_FULL_MALLOC_INIT        0x00200 /* Full malloc() is ready          */
> +#define GD_FLG_SKIP_RELOC      0x00400 /* Don't relocate */
>
>  #endif /* __ASM_GENERIC_GBL_DATA_H */
> --

What about reloc_fdt() and do_elf_reloc_fixups()?

Regards,
Bin
Simon Glass July 31, 2015, 3:45 p.m. UTC | #2
Hi Bin,

On 22 July 2015 at 21:41, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Simon,
>
> On Wed, Jul 22, 2015 at 11:48 PM, Simon Glass <sjg@chromium.org> wrote:
>> When running U-Boot as an EFI application we cannot relocate since we do not
>> have relocation information. U-Boot has already been relocated to a suitable
>> address.
>>
>> Add a global_data flag to control skipping relocation.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  common/board_f.c                  | 7 +++++++
>>  include/asm-generic/global_data.h | 1 +
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/common/board_f.c b/common/board_f.c
>> index 21be26f..5e09c5f 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -664,6 +664,11 @@ static int reloc_fdt(void)
>>
>>  static int setup_reloc(void)
>>  {
>> +       if (gd->flags & GD_FLG_SKIP_RELOC) {
>> +               debug("Skipping relocation due to flag\n");
>> +               return 0;
>> +       }
>> +
>>  #ifdef CONFIG_SYS_TEXT_BASE
>>         gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
>>  #ifdef CONFIG_M68K
>> @@ -689,6 +694,8 @@ static int setup_reloc(void)
>>
>>  static int jump_to_copy(void)
>>  {
>> +       if (gd->flags & GD_FLG_SKIP_RELOC)
>> +               return 0;
>>         /*
>>          * x86 is special, but in a nice way. It uses a trampoline which
>>          * enables the dcache if possible.
>> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
>> index db0550b..086ee96 100644
>> --- a/include/asm-generic/global_data.h
>> +++ b/include/asm-generic/global_data.h
>> @@ -116,5 +116,6 @@ typedef struct global_data {
>>  #define GD_FLG_ENV_READY       0x00080 /* Env. imported into hash table   */
>>  #define GD_FLG_SERIAL_READY    0x00100 /* Pre-reloc serial console ready  */
>>  #define GD_FLG_FULL_MALLOC_INIT        0x00200 /* Full malloc() is ready          */
>> +#define GD_FLG_SKIP_RELOC      0x00400 /* Don't relocate */
>>
>>  #endif /* __ASM_GENERIC_GBL_DATA_H */
>> --
>
> What about reloc_fdt() and do_elf_reloc_fixups()?

I'll add the first one. The second one is not called and I have a
patch to remove it.

>
> Regards,
> Bin
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 21be26f..5e09c5f 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -664,6 +664,11 @@  static int reloc_fdt(void)
 
 static int setup_reloc(void)
 {
+	if (gd->flags & GD_FLG_SKIP_RELOC) {
+		debug("Skipping relocation due to flag\n");
+		return 0;
+	}
+
 #ifdef CONFIG_SYS_TEXT_BASE
 	gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
 #ifdef CONFIG_M68K
@@ -689,6 +694,8 @@  static int setup_reloc(void)
 
 static int jump_to_copy(void)
 {
+	if (gd->flags & GD_FLG_SKIP_RELOC)
+		return 0;
 	/*
 	 * x86 is special, but in a nice way. It uses a trampoline which
 	 * enables the dcache if possible.
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index db0550b..086ee96 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -116,5 +116,6 @@  typedef struct global_data {
 #define GD_FLG_ENV_READY	0x00080	/* Env. imported into hash table   */
 #define GD_FLG_SERIAL_READY	0x00100	/* Pre-reloc serial console ready  */
 #define GD_FLG_FULL_MALLOC_INIT	0x00200	/* Full malloc() is ready	   */
+#define GD_FLG_SKIP_RELOC	0x00400	/* Don't relocate */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */