From a8421600d1d1a03a322e45b00db318dbf80fa03f Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 5 Jul 2007 18:01:28 +0200 Subject: svn_rev_152 remove global data gd_t and board info bd_t entirely for arm --- arch/arm/lib/armlinux.c | 33 ++++++++++++++++----------------- arch/arm/lib/board.c | 8 -------- common/cmd_bootm.c | 9 ++++++++- common/dlmalloc.c | 5 ++++- common/exports.c | 18 +++++++++++++++++- common/hush.c | 10 +++++++++- common/main.c | 4 ---- include/asm-arm/global_data.h | 33 ++------------------------------- 8 files changed, 56 insertions(+), 64 deletions(-) diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index 432b4fb8c2..323948f204 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -40,18 +40,18 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); defined (CONFIG_REVISION_TAG) || \ defined (CONFIG_VFD) || \ defined (CONFIG_LCD) -static void setup_start_tag (bd_t *bd); +static void setup_start_tag (void); # ifdef CONFIG_SETUP_MEMORY_TAGS -static void setup_memory_tags (bd_t *bd); +static void setup_memory_tags (void); # endif -static void setup_commandline_tag (bd_t *bd, char *commandline); +static void setup_commandline_tag (char *commandline); # ifdef CONFIG_INITRD_TAG -static void setup_initrd_tag (bd_t *bd, ulong initrd_start, +static void setup_initrd_tag (ulong initrd_start, ulong initrd_end); # endif -static void setup_end_tag (bd_t *bd); +static void setup_end_tag (void); # if defined (CONFIG_VFD) || defined (CONFIG_LCD) static void setup_videolfb_tag (gd_t *gd); @@ -79,7 +79,6 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ulong data; void (*theKernel)(int zero, int arch, uint params); image_header_t *hdr = &header; - bd_t *bd = gd->bd; #ifdef CONFIG_CMDLINE_TAG char *commandline = getenv ("bootargs"); @@ -214,7 +213,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], defined (CONFIG_REVISION_TAG) || \ defined (CONFIG_LCD) || \ defined (CONFIG_VFD) - setup_start_tag (bd); + setup_start_tag (); #ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -222,19 +221,19 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], setup_revision_tag (¶ms); #endif #ifdef CONFIG_SETUP_MEMORY_TAGS - setup_memory_tags (bd); + setup_memory_tags (); #endif #ifdef CONFIG_CMDLINE_TAG - setup_commandline_tag (bd, commandline); + setup_commandline_tag (commandline); #endif #ifdef CONFIG_INITRD_TAG if (initrd_start && initrd_end) - setup_initrd_tag (bd, initrd_start, initrd_end); + setup_initrd_tag (initrd_start, initrd_end); #endif #if defined (CONFIG_VFD) || defined (CONFIG_LCD) setup_videolfb_tag ((gd_t *) gd); #endif - setup_end_tag (bd); + setup_end_tag (); #endif /* we assume that the kernel is in place */ @@ -260,9 +259,9 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], defined (CONFIG_REVISION_TAG) || \ defined (CONFIG_LCD) || \ defined (CONFIG_VFD) -static void setup_start_tag (bd_t *bd) +static void setup_start_tag (void) { - params = (struct tag *) bd->bi_boot_params; + params = (struct tag *) CONFIG_BOOT_PARAMS; params->hdr.tag = ATAG_CORE; params->hdr.size = tag_size (tag_core); @@ -276,7 +275,7 @@ static void setup_start_tag (bd_t *bd) #ifdef CONFIG_SETUP_MEMORY_TAGS -static void setup_memory_tags (bd_t *bd) +static void setup_memory_tags (void) { struct device_d *dev = NULL; @@ -298,7 +297,7 @@ static void setup_memory_tags (bd_t *bd) #endif /* CONFIG_SETUP_MEMORY_TAGS */ -static void setup_commandline_tag (bd_t *bd, char *commandline) +static void setup_commandline_tag (char *commandline) { char *p; @@ -325,7 +324,7 @@ static void setup_commandline_tag (bd_t *bd, char *commandline) #ifdef CONFIG_INITRD_TAG -static void setup_initrd_tag (bd_t *bd, ulong initrd_start, ulong initrd_end) +static void setup_initrd_tag (ulong initrd_start, ulong initrd_end) { /* an ATAG_INITRD node tells the kernel where the compressed * ramdisk can be found. ATAG_RDIMG is a better name, actually. @@ -396,7 +395,7 @@ void setup_revision_tag(struct tag **in_params) #endif /* CONFIG_REVISION_TAG */ -static void setup_end_tag (bd_t *bd) +static void setup_end_tag (void) { params->hdr.tag = ATAG_NONE; params->hdr.size = 0; diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index b573b5a068..8dc42ab905 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -147,15 +147,9 @@ void start_armboot (void) int result; int i = 'a'; - /* Pointer is writable since we allocated a register for it */ - gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t)); /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("": : :"memory"); - memset ((void*)gd, 0, sizeof (gd_t)); - gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); - memset (gd->bd, 0, sizeof (bd_t)); - monitor_flash_len = _bss_start - _armboot_start; /* armboot_start is defined in the board-specific linker script */ @@ -170,8 +164,6 @@ void start_armboot (void) display_banner(); - jumptable_init (); - /* enable exceptions */ enable_interrupts (); diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 5be86ed99a..c2615660cf 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -1024,7 +1024,11 @@ do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag, * r5: console device * r6: boot args string */ +#if 0 (*loader) (gd->bd, img_addr, consdev, cmdline); +#else +#warning NetBSD Support is broken +#endif } #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC) @@ -1484,8 +1488,11 @@ do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], * RTEMS Parameters: * r3: ptr to board info data */ - +#if 0 (*entry_point ) ( gd->bd ); +#else +#warning RTEMS support is broken +#endif } #if (CONFIG_COMMANDS & CFG_CMD_ELF) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 01aca94226..7c5375a5f0 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -549,13 +549,16 @@ static mbinptr av_[NAV * 2 + 2] = { void malloc_bin_reloc (void) { +#ifdef CONFIG_ARM + return; +#else unsigned long *p = (unsigned long *)(&av_[2]); int i; for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) { *p++ += gd->reloc_off; } +#endif } - /* field-extraction macros */ diff --git a/common/exports.c b/common/exports.c index 70b9c7fe1d..83d2a8ae76 100644 --- a/common/exports.c +++ b/common/exports.c @@ -1,8 +1,11 @@ #include +#include +#include #include DECLARE_GLOBAL_DATA_PTR; +#if 0 static void dummy(void) { } @@ -12,7 +15,13 @@ unsigned long get_version(void) return XF_VERSION; } -void jumptable_init (void) +/* + * FIXME: instead of using the global data struct for standalone + * programs, just use a register to pass the jumptable. + * For now, this is broken. + */ + +int jumptable_init (void) { int i; @@ -36,4 +45,11 @@ void jumptable_init (void) gd->jt[XF_i2c_write] = (void *) i2c_write; gd->jt[XF_i2c_read] = (void *) i2c_read; #endif /* CFG_CMD_I2C */ + + return 0; } + +late_initcall(jumptable_init); + +#endif + diff --git a/common/hush.c b/common/hush.c index f81fdcf0b4..f7550b9cdf 100644 --- a/common/hush.c +++ b/common/hush.c @@ -3228,9 +3228,17 @@ static void u_boot_hush_reloc(void) { unsigned long addr; struct reserved_combo *r; + unsigned long reloc_off; + +#if 0 + reloc_off = gd->reloc_off; +#else + reloc_off = 0; +#warning FIXME: This is broken on !ARM +#endif for (r=reserved_list; rliteral) + gd->reloc_off; + addr = (ulong) (r->literal) + reloc_off; r->literal = (char *)addr; } } diff --git a/common/main.c b/common/main.c index 4c438b766d..c569d1df73 100644 --- a/common/main.c +++ b/common/main.c @@ -40,10 +40,6 @@ #include -#ifdef CONFIG_SILENT_CONSOLE -DECLARE_GLOBAL_DATA_PTR; -#endif - #if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY) extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */ #endif diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index 9254664488..9dcb70decf 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -23,38 +23,9 @@ #ifndef __ASM_GBL_DATA_H #define __ASM_GBL_DATA_H -/* - * The following data structure is placed in some memory wich is - * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or - * some locked parts of the data cache) to allow for a minimum set of - * global variables during system initialization (until we have set - * up the memory controller so that we can use RAM). - * - * Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t) - */ -typedef struct global_data { - bd_t *bd; - unsigned long flags; - unsigned long baudrate; - unsigned long have_console; /* serial_init() was called */ - unsigned long reloc_off; /* Relocation Offset */ - unsigned long env_addr; /* Address of Environment struct */ - unsigned long env_valid; /* Checksum of Environment valid? */ - unsigned long fb_base; /* base address of frame buffer */ -#ifdef CONFIG_VFD - unsigned char vfd_type; /* display type */ -#endif - void **jt; /* jump table */ -} gd_t; - -/* - * Global Data Flags - */ -#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ -#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ -#define GD_FLG_SILENT 0x00004 /* Silent mode */ +typedef struct global_data {} gd_t; -#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#define DECLARE_GLOBAL_DATA_PTR #endif /* __ASM_GBL_DATA_H */ -- cgit v1.2.3