
Move this field into arch_global_data and tidy up.
This will certainly break x86, so will need Graeme's help to sort out the problem. I would prefer not to put the architecture-specific stuff at the top of global_data since we relying on that seems even more ugly.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/cpu.c | 2 +- arch/x86/include/asm/global_data.h | 12 +++++++++--- arch/x86/lib/init_helpers.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index e9bb0d7..c276aa6 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
void init_gd(gd_t *id, u64 *gdt_addr) { - id->gd_addr = (ulong)id; + id->arch.gd_addr = (ulong)id; setup_gdt(id, gdt_addr); }
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index 3df83bb..d2eb00a 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -28,8 +28,16 @@
/* Architecture-specific global data */ struct arch_global_data { - unsigned long gdt_addr; /* Location of GDT */ + /* + * NOTE: gd_addr MUST be first member of struct global_data! + * + * But it now isn't, so this is sure to break x86. Can we change + * x86 to not require this? I don't think we should put the + * arch data first in global_data... + */ unsigned long new_gd_addr; /* New location of Global Data */ + unsigned long gd_addr; /* Location of Global Data */ + unsigned long gdt_addr; /* Location of GDT */ };
/* @@ -41,8 +49,6 @@ struct arch_global_data { */
typedef struct global_data { - /* NOTE: gd_addr MUST be first member of struct global_data! */ - unsigned long gd_addr; /* Location of Global Data */ bd_t *bd; unsigned long flags; unsigned int baudrate; diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 05cadcd..ac789c2 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void) * in-RAM copy of Global Data (calculate_relocation_address() * has already calculated the in-RAM location of the GDT) */ - ram_gd->gd_addr = (ulong)ram_gd; + ram_gd->arch.gd_addr = (ulong)ram_gd; init_gd(ram_gd, (u64 *)gd->arch.gdt_addr);
return 0;