From b0b403d954081520ba82fef24dee6486ffebe017 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 31 Jul 2015 09:31:27 -0600 Subject: Reserve the top 16 flag bits for architecture-specific use Add a convention that the generic global_data only occupy the bottom 16 bits of the flags word, so that there is less chance of a conflict. At present the x86 flags conflict. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- include/asm-generic/global_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/asm-generic') diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 7ef3e259b46..9f5db0f5afb 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -104,7 +104,7 @@ typedef struct global_data { #endif /* - * Global Data Flags + * Global Data Flags - the top 16 bits are reserved for arch-specific flags */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ -- cgit v1.3.1 From f05ad9ba4c22b5c5929406394a0889791c2778da Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 4 Aug 2015 12:33:39 -0600 Subject: Add a way to skip relocation 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 Reviewed-by: Bin Meng --- common/board_f.c | 9 +++++++++ include/asm-generic/global_data.h | 1 + 2 files changed, 10 insertions(+) (limited to 'include/asm-generic') diff --git a/common/board_f.c b/common/board_f.c index 6d922b8c86b..c7cc67c7a48 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -654,6 +654,8 @@ static int setup_dram_config(void) static int reloc_fdt(void) { + if (gd->flags & GD_FLG_SKIP_RELOC) + return 0; if (gd->new_fdt) { memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size); gd->fdt_blob = gd->new_fdt; @@ -664,6 +666,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 +696,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 9f5db0f5afb..21552650025 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -117,5 +117,6 @@ typedef struct global_data { #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_SPL_INIT 0x00400 /* spl_init() has been called */ +#define GD_FLG_SKIP_RELOC 0x00800 /* Don't relocate */ #endif /* __ASM_GENERIC_GBL_DATA_H */ -- cgit v1.3.1