Skip to content
Snippets Groups Projects
Commit e4fb6116 authored by Graeme Russ's avatar Graeme Russ Committed by Simon Glass
Browse files

x86: Forward declare gd_t


So it can be used as a type in struct global_data and remove an ugly typecast

Signed-off-by: default avatarGraeme Russ <graeme.russ@gmail.com>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Acked-by: default avatarMarek Vasut <marex@denx.de>
parent d41b3cc1
No related branches found
No related tags found
No related merge requests found
...@@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries) ...@@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
void init_gd(gd_t *id, u64 *gdt_addr) void init_gd(gd_t *id, u64 *gdt_addr)
{ {
id->gd_addr = (ulong)id; id->gd_addr = id;
setup_gdt(id, gdt_addr); setup_gdt(id, gdt_addr);
} }
......
...@@ -33,9 +33,11 @@ ...@@ -33,9 +33,11 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
typedef struct global_data { typedef struct global_data gd_t;
struct global_data {
/* NOTE: gd_addr MUST be first member of struct global_data! */ /* NOTE: gd_addr MUST be first member of struct global_data! */
unsigned long gd_addr; /* Location of Global Data */ gd_t *gd_addr; /* Location of Global Data */
bd_t *bd; bd_t *bd;
unsigned long flags; unsigned long flags;
unsigned int baudrate; unsigned int baudrate;
...@@ -57,7 +59,7 @@ typedef struct global_data { ...@@ -57,7 +59,7 @@ typedef struct global_data {
unsigned long reset_status; /* reset status register at boot */ unsigned long reset_status; /* reset status register at boot */
void **jt; /* jump table */ void **jt; /* jump table */
char env_buf[32]; /* buffer for getenv() before reloc. */ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t; };
static inline gd_t *get_fs_gd_ptr(void) static inline gd_t *get_fs_gd_ptr(void)
{ {
......
...@@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void) ...@@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void)
* in-RAM copy of Global Data (calculate_relocation_address() * in-RAM copy of Global Data (calculate_relocation_address()
* has already calculated the in-RAM location of the GDT) * has already calculated the in-RAM location of the GDT)
*/ */
ram_gd->gd_addr = (ulong)ram_gd; ram_gd->gd_addr = ram_gd;
init_gd(ram_gd, (u64 *)gd->gdt_addr); init_gd(ram_gd, (u64 *)gd->gdt_addr);
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment