summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2006-03-31 18:32:53 +0200
committerWolfgang Denk <wd@pollux.denx.de>2006-03-31 18:32:53 +0200
commitd87080b721e4f8dca977af7571c5338ae7bb8db7 (patch)
tree514fc21eec39a2dd57f7aea516844a4400f8f140 /common
parentf6dbbe986481cff01334c64cacb971a5f237a9a9 (diff)
GCC-4.x fixes: clean up global data pointer initialization for all boards.
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bdinfo.c11
-rw-r--r--common/cmd_bedbug.c575
-rw-r--r--common/cmd_boot.c8
-rw-r--r--common/cmd_bootm.c9
-rw-r--r--common/cmd_date.c3
-rw-r--r--common/cmd_elf.c8
-rw-r--r--common/cmd_ide.c5
-rw-r--r--common/cmd_immap.c6
-rw-r--r--common/cmd_load.c6
-rw-r--r--common/cmd_log.c5
-rw-r--r--common/cmd_nvedit.c4
-rw-r--r--common/console.c18
-rw-r--r--common/devices.c4
-rw-r--r--common/dlmalloc.c4
-rw-r--r--common/env_common.c10
-rw-r--r--common/env_dataflash.c4
-rw-r--r--common/env_eeprom.c4
-rw-r--r--common/env_flash.c8
-rw-r--r--common/env_nand.c11
-rw-r--r--common/env_nowhere.c6
-rw-r--r--common/env_nvram.c6
-rw-r--r--common/exports.c3
-rw-r--r--common/hush.c3
-rw-r--r--common/lcd.c7
-rw-r--r--common/lynxkdi.c3
-rw-r--r--common/main.c64
-rw-r--r--common/serial.c16
-rw-r--r--common/soft_i2c.c5
28 files changed, 362 insertions, 454 deletions
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 40e28dd9d23..04fa4facae1 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -28,6 +28,7 @@
#include <command.h>
#include <net.h> /* for print_IPaddr */
+DECLARE_GLOBAL_DATA_PTR;
#if (CONFIG_COMMANDS & CFG_CMD_BDI)
static void print_num(const char *, ulong);
@@ -39,8 +40,6 @@ static void print_str(const char *, const char *);
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i;
bd_t *bd = gd->bd;
char buf[32];
@@ -127,8 +126,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i;
bd_t *bd = gd->bd;
@@ -153,8 +150,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i;
bd_t *bd = gd->bd;
@@ -187,8 +182,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i;
bd_t *bd = gd->bd;
@@ -215,8 +208,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i;
bd_t *bd = gd->bd;
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index cdb379de216..48086a62809 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -11,187 +11,183 @@
#include <bedbug/regs.h>
#include <bedbug/ppc.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-extern void show_regs __P((struct pt_regs*));
-extern int run_command __P((const char*, int));
+extern void show_regs __P ((struct pt_regs *));
+extern int run_command __P ((const char *, int));
extern char console_buffer[];
-ulong dis_last_addr = 0; /* Last address disassembled */
-ulong dis_last_len = 20; /* Default disassembler length */
-CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
-
+ulong dis_last_addr = 0; /* Last address disassembled */
+ulong dis_last_len = 20; /* Default disassembler length */
+CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
+
/* ======================================================================
* U-Boot's puts function does not append a newline, so the bedbug stuff
* will use this for the output of the dis/assembler.
* ====================================================================== */
-int bedbug_puts(const char *str)
+int bedbug_puts (const char *str)
{
- /* -------------------------------------------------- */
+ /* -------------------------------------------------- */
- printf( "%s\r\n", str );
- return 0;
-} /* bedbug_puts */
+ printf ("%s\r\n", str);
+ return 0;
+} /* bedbug_puts */
+
-
/* ======================================================================
* Initialize the bug_ctx structure used by the bedbug debugger. This is
* specific to the CPU since each has different debug registers and
* settings.
* ====================================================================== */
-void bedbug_init( void )
+void bedbug_init (void)
{
- /* -------------------------------------------------- */
+ /* -------------------------------------------------- */
#if defined(CONFIG_4xx)
- void bedbug405_init( void );
- bedbug405_init();
+ void bedbug405_init (void);
+
+ bedbug405_init ();
#elif defined(CONFIG_8xx)
- void bedbug860_init( void );
- bedbug860_init();
+ void bedbug860_init (void);
+
+ bedbug860_init ();
#endif
#if defined(CONFIG_MPC824X) || defined(CONFIG_MPC8260)
- /* Processors that are 603e core based */
- void bedbug603e_init( void );
+ /* Processors that are 603e core based */
+ void bedbug603e_init (void);
- bedbug603e_init();
+ bedbug603e_init ();
#endif
- return;
-} /* bedbug_init */
+ return;
+} /* bedbug_init */
+
-
/* ======================================================================
* Entry point from the interpreter to the disassembler. Repeated calls
* will resume from the last disassembled address.
* ====================================================================== */
-int do_bedbug_dis (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- ulong addr; /* Address to start disassembly from */
- ulong len; /* # of instructions to disassemble */
- /* -------------------------------------------------- */
-
- /* Setup to go from the last address if none is given */
- addr = dis_last_addr;
- len = dis_last_len;
-
- if (argc < 2)
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 1;
- }
-
- if(( flag & CMD_FLAG_REPEAT ) == 0 )
- {
- /* New command */
- addr = simple_strtoul( argv[1], NULL, 16 );
-
- /* If an extra param is given then it is the length */
- if( argc > 2 )
- len = simple_strtoul( argv[2], NULL, 16 );
- }
-
- /* Run the disassembler */
- disppc( (unsigned char *)addr, 0, len, bedbug_puts, F_RADHEX );
-
- dis_last_addr = addr + (len * 4);
- dis_last_len = len;
- return 0;
-} /* do_bedbug_dis */
-U_BOOT_CMD(
- ds, 3, 1, do_bedbug_dis,
- "ds - disassemble memory\n",
- "ds <address> [# instructions]\n"
-);
+ ulong addr; /* Address to start disassembly from */
+ ulong len; /* # of instructions to disassemble */
+
+ /* -------------------------------------------------- */
+
+ /* Setup to go from the last address if none is given */
+ addr = dis_last_addr;
+ len = dis_last_len;
+
+ if (argc < 2) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ if ((flag & CMD_FLAG_REPEAT) == 0) {
+ /* New command */
+ addr = simple_strtoul (argv[1], NULL, 16);
+
+ /* If an extra param is given then it is the length */
+ if (argc > 2)
+ len = simple_strtoul (argv[2], NULL, 16);
+ }
+
+ /* Run the disassembler */
+ disppc ((unsigned char *) addr, 0, len, bedbug_puts, F_RADHEX);
+
+ dis_last_addr = addr + (len * 4);
+ dis_last_len = len;
+ return 0;
+} /* do_bedbug_dis */
+
+U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
+ "ds - disassemble memory\n",
+ "ds <address> [# instructions]\n");
/* ======================================================================
* Entry point from the interpreter to the assembler. Assembles
* instructions in consecutive memory locations until a '.' (period) is
* entered on a line by itself.
* ====================================================================== */
-int do_bedbug_asm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- long mem_addr; /* Address to assemble into */
- unsigned long instr; /* Machine code for text */
- char prompt[ 15 ]; /* Prompt string for user input */
- int asm_err; /* Error code from the assembler*/
- /* -------------------------------------------------- */
- int rcode = 0;
-
- if (argc < 2)
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 1;
- }
-
- printf( "\nEnter '.' when done\n" );
- mem_addr = simple_strtoul( argv[ 1 ], NULL, 16 );
-
- while( 1 )
- {
- putc( '\n' );
- disppc( (unsigned char *)mem_addr, 0, 1, bedbug_puts, F_RADHEX );
-
- sprintf( prompt, "%08lx: ", mem_addr );
- readline( prompt );
-
- if( console_buffer[ 0 ] && strcmp( console_buffer, "." ))
- {
- if(( instr = asmppc( mem_addr, console_buffer, &asm_err )) != 0 )
- {
- *(unsigned long *)mem_addr = instr;
- mem_addr += 4;
- }
- else
- {
- printf( "*** Error: %s ***\n", asm_error_str( asm_err ));
- rcode = 1;
- }
- }
- else
- {
- break;
- }
- }
- return rcode;
-} /* do_bedbug_asm */
-U_BOOT_CMD(
- as, 2, 0, do_bedbug_asm,
- "as - assemble memory\n",
- "as <address>\n"
-);
+ long mem_addr; /* Address to assemble into */
+ unsigned long instr; /* Machine code for text */
+ char prompt[15]; /* Prompt string for user input */
+ int asm_err; /* Error code from the assembler */
+
+ /* -------------------------------------------------- */
+ int rcode = 0;
+
+ if (argc < 2) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ printf ("\nEnter '.' when done\n");
+ mem_addr = simple_strtoul (argv[1], NULL, 16);
+
+ while (1) {
+ putc ('\n');
+ disppc ((unsigned char *) mem_addr, 0, 1, bedbug_puts,
+ F_RADHEX);
+
+ sprintf (prompt, "%08lx: ", mem_addr);
+ readline (prompt);
+
+ if (console_buffer[0] && strcmp (console_buffer, ".")) {
+ if ((instr =
+ asmppc (mem_addr, console_buffer,
+ &asm_err)) != 0) {
+ *(unsigned long *) mem_addr = instr;
+ mem_addr += 4;
+ } else {
+ printf ("*** Error: %s ***\n",
+ asm_error_str (asm_err));
+ rcode = 1;
+ }
+ } else {
+ break;
+ }
+ }
+ return rcode;
+} /* do_bedbug_asm */
+
+U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
+ "as - assemble memory\n", "as <address>\n");
/* ======================================================================
* Used to set a break point from the interpreter. Simply calls into the
* CPU-specific break point set routine.
* ====================================================================== */
-int do_bedbug_break (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- /* -------------------------------------------------- */
- if( bug_ctx.do_break )
- (*bug_ctx.do_break)( cmdtp, flag, argc, argv );
- return 0;
-
-} /* do_bedbug_break */
-U_BOOT_CMD(
- break, 3, 0, do_bedbug_break,
- "break - set or clear a breakpoint\n",
- " - Set or clear a breakpoint\n"
- "break <address> - Break at an address\n"
- "break off <bp#> - Disable breakpoint.\n"
- "break show - List breakpoints.\n"
-);
+ /* -------------------------------------------------- */
+ if (bug_ctx.do_break)
+ (*bug_ctx.do_break) (cmdtp, flag, argc, argv);
+ return 0;
+
+} /* do_bedbug_break */
+
+U_BOOT_CMD (break, 3, 0, do_bedbug_break,
+ "break - set or clear a breakpoint\n",
+ " - Set or clear a breakpoint\n"
+ "break <address> - Break at an address\n"
+ "break off <bp#> - Disable breakpoint.\n"
+ "break show - List breakpoints.\n");
/* ======================================================================
* Called from the debug interrupt routine. Simply calls the CPU-specific
@@ -200,16 +196,16 @@ U_BOOT_CMD(
void do_bedbug_breakpoint (struct pt_regs *regs)
{
- /* -------------------------------------------------- */
+ /* -------------------------------------------------- */
- if( bug_ctx.break_isr )
- (*bug_ctx.break_isr)( regs );
+ if (bug_ctx.break_isr)
+ (*bug_ctx.break_isr) (regs);
- return;
-} /* do_bedbug_breakpoint */
+ return;
+} /* do_bedbug_breakpoint */
+
-
/* ======================================================================
* Called from the CPU-specific breakpoint handling routine. Enter a
* mini main loop until the stopped flag is cleared from the breakpoint
@@ -218,81 +214,77 @@ void do_bedbug_breakpoint (struct pt_regs *regs)
* This handles the parts of the debugger that are common to all CPU's.
* ====================================================================== */
-void bedbug_main_loop( unsigned long addr, struct pt_regs *regs )
+void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
{
- int len; /* Length of command line */
- int flag; /* Command flags */
- int rc = 0; /* Result from run_command*/
- char prompt_str[ 20 ]; /* Prompt string */
- static char lastcommand[ CFG_CBSIZE ] = {0}; /* previous command */
- /* -------------------------------------------------- */
+ int len; /* Length of command line */
+ int flag; /* Command flags */
+ int rc = 0; /* Result from run_command */
+ char prompt_str[20]; /* Prompt string */
+ static char lastcommand[CFG_CBSIZE] = { 0 }; /* previous command */
+ /* -------------------------------------------------- */
- if( bug_ctx.clear )
- (*bug_ctx.clear)( bug_ctx.current_bp );
+ if (bug_ctx.clear)
+ (*bug_ctx.clear) (bug_ctx.current_bp);
- printf( "Breakpoint %d: ", bug_ctx.current_bp );
- disppc( (unsigned char *)addr, 0, 1, bedbug_puts, F_RADHEX );
+ printf ("Breakpoint %d: ", bug_ctx.current_bp);
+ disppc ((unsigned char *) addr, 0, 1, bedbug_puts, F_RADHEX);
- bug_ctx.stopped = 1;
- bug_ctx.regs = regs;
+ bug_ctx.stopped = 1;
+ bug_ctx.regs = regs;
- sprintf( prompt_str, "BEDBUG.%d =>", bug_ctx.current_bp );
+ sprintf (prompt_str, "BEDBUG.%d =>", bug_ctx.current_bp);
- /* A miniature main loop */
- while( bug_ctx.stopped )
- {
- len = readline( prompt_str );
+ /* A miniature main loop */
+ while (bug_ctx.stopped) {
+ len = readline (prompt_str);
- flag = 0; /* assume no special flags for now */
+ flag = 0; /* assume no special flags for now */
- if (len > 0)
- strcpy( lastcommand, console_buffer );
- else if( len == 0 )
- flag |= CMD_FLAG_REPEAT;
+ if (len > 0)
+ strcpy (lastcommand, console_buffer);
+ else if (len == 0)
+ flag |= CMD_FLAG_REPEAT;
- if (len == -1)
- printf ("<INTERRUPT>\n");
- else
- rc = run_command( lastcommand, flag );
+ if (len == -1)
+ printf ("<INTERRUPT>\n");
+ else
+ rc = run_command (lastcommand, flag);
- if (rc <= 0) {
- /* invalid command or not repeatable, forget it */
- lastcommand[0] = 0;
- }
- }
+ if (rc <= 0) {
+ /* invalid command or not repeatable, forget it */
+ lastcommand[0] = 0;
+ }
+ }
- bug_ctx.regs = NULL;
- bug_ctx.current_bp = 0;
+ bug_ctx.regs = NULL;
+ bug_ctx.current_bp = 0;
- return;
-} /* bedbug_main_loop */
+ return;
+} /* bedbug_main_loop */
+
-
/* ======================================================================
* Interpreter command to continue from a breakpoint. Just clears the
* stopped flag in the context so that the breakpoint routine will
* return.
* ====================================================================== */
-int do_bedbug_continue (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-
+int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- /* -------------------------------------------------- */
-
- if( ! bug_ctx.stopped )
- {
- printf( "Not at a breakpoint\n" );
- return 1;
- }
-
- bug_ctx.stopped = 0;
- return 0;
-} /* do_bedbug_continue */
-U_BOOT_CMD(
- continue, 1, 0, do_bedbug_continue,
- "continue- continue from a breakpoint\n",
- " - continue from a breakpoint.\n"
-);
+ /* -------------------------------------------------- */
+
+ if (!bug_ctx.stopped) {
+ printf ("Not at a breakpoint\n");
+ return 1;
+ }
+
+ bug_ctx.stopped = 0;
+ return 0;
+} /* do_bedbug_continue */
+
+U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
+ "continue- continue from a breakpoint\n",
+ " - continue from a breakpoint.\n");
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping into
@@ -300,31 +292,30 @@ U_BOOT_CMD(
* the address passes control to the CPU-specific set breakpoint routine
* for the current breakpoint number.
* ====================================================================== */
-int do_bedbug_step (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- unsigned long addr; /* Address to stop at */
- /* -------------------------------------------------- */
-
- if( ! bug_ctx.stopped )
- {
- printf( "Not at a breakpoint\n" );
- return 1;
- }
-
- if( !find_next_address( (unsigned char *)&addr, FALSE, bug_ctx.regs ))
- return 1;
-
- if( bug_ctx.set )
- (*bug_ctx.set)( bug_ctx.current_bp, addr );
-
- bug_ctx.stopped = 0;
- return 0;
-} /* do_bedbug_step */
-U_BOOT_CMD(
- step, 1, 1, do_bedbug_step,
- "step - single step execution.\n",
- " - single step execution.\n"
-);
+ unsigned long addr; /* Address to stop at */
+
+ /* -------------------------------------------------- */
+
+ if (!bug_ctx.stopped) {
+ printf ("Not at a breakpoint\n");
+ return 1;
+ }
+
+ if (!find_next_address ((unsigned char *) &addr, FALSE, bug_ctx.regs))
+ return 1;
+
+ if (bug_ctx.set)
+ (*bug_ctx.set) (bug_ctx.current_bp, addr);
+
+ bug_ctx.stopped = 0;
+ return 0;
+} /* do_bedbug_step */
+
+U_BOOT_CMD (step, 1, 1, do_bedbug_step,
+ "step - single step execution.\n",
+ " - single step execution.\n");
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping over
@@ -332,105 +323,97 @@ U_BOOT_CMD(
* the address passes control to the CPU-specific set breakpoint routine
* for the current breakpoint number.
* ====================================================================== */
-int do_bedbug_next (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- unsigned long addr; /* Address to stop at */
- /* -------------------------------------------------- */
-
- if( ! bug_ctx.stopped )
- {
- printf( "Not at a breakpoint\n" );
- return 1;
- }
-
- if( !find_next_address( (unsigned char *)&addr, TRUE, bug_ctx.regs ))
- return 1;
-
- if( bug_ctx.set )
- (*bug_ctx.set)( bug_ctx.current_bp, addr );
-
- bug_ctx.stopped = 0;
- return 0;
-} /* do_bedbug_next */
-U_BOOT_CMD(
- next, 1, 1, do_bedbug_next,
- "next - single step execution, stepping over subroutines.\n",
- " - single step execution, stepping over subroutines.\n"
-);
+ unsigned long addr; /* Address to stop at */
+
+ /* -------------------------------------------------- */
+
+ if (!bug_ctx.stopped) {
+ printf ("Not at a breakpoint\n");
+ return 1;
+ }
+
+ if (!find_next_address ((unsigned char *) &addr, TRUE, bug_ctx.regs))
+ return 1;
+
+ if (bug_ctx.set)
+ (*bug_ctx.set) (bug_ctx.current_bp, addr);
+
+ bug_ctx.stopped = 0;
+ return 0;
+} /* do_bedbug_next */
+
+U_BOOT_CMD (next, 1, 1, do_bedbug_next,
+ "next - single step execution, stepping over subroutines.\n",
+ " - single step execution, stepping over subroutines.\n");
/* ======================================================================
* Interpreter command to print the current stack. This assumes an EABI
* architecture, so it starts with GPR R1 and works back up the stack.
* ====================================================================== */
-int do_bedbug_stack (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
- unsigned long sp; /* Stack pointer */
- unsigned long func; /* LR from stack */
- int depth; /* Stack iteration level */
- int skip = 1; /* Flag to skip the first entry */
- unsigned long top; /* Top of memory address */
- /* -------------------------------------------------- */
-
- if( ! bug_ctx.stopped )
- {
- printf( "Not at a breakpoint\n" );
- return 1;
- }
-
- top = gd->bd->bi_memstart + gd->bd->bi_memsize;
- depth = 0;
-
- printf( "Depth PC\n" );
- printf( "----- --------\n" );
- printf( "%5d %08lx\n", depth++, bug_ctx.regs->nip );
-
- sp = bug_ctx.regs->gpr[ 1 ];
- func = *(unsigned long *)(sp+4);
-
- while(( func < top ) && ( sp < top ))
- {
- if( !skip )
- printf( "%5d %08lx\n", depth++, func );
- else
- --skip;
-
- sp = *(unsigned long *)sp;
- func = *(unsigned long *)(sp+4);
- }
- return 0;
-} /* do_bedbug_stack */
-U_BOOT_CMD(
- where, 1, 1, do_bedbug_stack,
- "where - Print the running stack.\n",
- " - Print the running stack.\n"
-);
+ unsigned long sp; /* Stack pointer */
+ unsigned long func; /* LR from stack */
+ int depth; /* Stack iteration level */
+ int skip = 1; /* Flag to skip the first entry */
+ unsigned long top; /* Top of memory address */
+
+ /* -------------------------------------------------- */
+
+ if (!bug_ctx.stopped) {
+ printf ("Not at a breakpoint\n");
+ return 1;
+ }
+
+ top = gd->bd->bi_memstart + gd->bd->bi_memsize;
+ depth = 0;
+
+ printf ("Depth PC\n");
+ printf ("----- --------\n");
+ printf ("%5d %08lx\n", depth++, bug_ctx.regs->nip);
+
+ sp = bug_ctx.regs->gpr[1];
+ func = *(unsigned long *) (sp + 4);
+
+ while ((func < top) && (sp < top)) {
+ if (!skip)
+ printf ("%5d %08lx\n", depth++, func);
+ else
+ --skip;
+
+ sp = *(unsigned long *) sp;
+ func = *(unsigned long *) (sp + 4);
+ }
+ return 0;
+} /* do_bedbug_stack */
+
+U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
+ "where - Print the running stack.\n",
+ " - Print the running stack.\n");
/* ======================================================================
* Interpreter command to dump the registers. Calls the CPU-specific
* show registers routine.
* ====================================================================== */
-int do_bedbug_rdump (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- /* -------------------------------------------------- */
-
- if( ! bug_ctx.stopped )
- {
- printf( "Not at a breakpoint\n" );
- return 1;
- }
-
- show_regs( bug_ctx.regs );
- return 0;
-} /* do_bedbug_rdump */
-U_BOOT_CMD(
- rdump, 1, 1, do_bedbug_rdump,
- "rdump - Show registers.\n",
- " - Show registers.\n"
-);
+ /* -------------------------------------------------- */
+
+ if (!bug_ctx.stopped) {
+ printf ("Not at a breakpoint\n");
+ return 1;
+ }
+
+ show_regs (bug_ctx.regs);
+ return 0;
+} /* do_bedbug_rdump */
+
+U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
+ "rdump - Show registers.\n", " - Show registers.\n");
/* ====================================================================== */
-#endif /* CFG_CMD_BEDBUG */
+#endif /* CFG_CMD_BEDBUG */
/*
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 5b58d4e2f1f..e68f16f9da0 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -28,14 +28,12 @@
#include <command.h>
#include <net.h>
-
-/* -------------------------------------------------------------------- */
+#if defined(CONFIG_I386)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
-#if defined(CONFIG_I386)
- DECLARE_GLOBAL_DATA_PTR;
-#endif
ulong addr, rc;
int rcode = 0;
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index aeb7842aefa..fdf7180a19a 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -38,6 +38,8 @@
#include <ft_build.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
/*cmd_boot.c*/
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
@@ -469,7 +471,6 @@ U_BOOT_CMD(
static void
fixup_silent_linux ()
{
- DECLARE_GLOBAL_DATA_PTR;
char buf[256], *start, *end;
char *cmdline = getenv ("bootargs");
@@ -512,8 +513,6 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
ulong *len_ptr,
int verify)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong sp;
ulong len, checksum;
ulong initrd_start, initrd_end;
@@ -856,8 +855,6 @@ do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
ulong *len_ptr,
int verify)
{
- DECLARE_GLOBAL_DATA_PTR;
-
image_header_t *hdr = &header;
void (*loader)(bd_t *, image_header_t *, char *, char *);
@@ -941,7 +938,6 @@ do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
ulong *len_ptr,
int verify)
{
- DECLARE_GLOBAL_DATA_PTR;
ulong top;
char *s, *cmdline;
char **fwenv, **ss;
@@ -1370,7 +1366,6 @@ static void
do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify)
{
- DECLARE_GLOBAL_DATA_PTR;
image_header_t *hdr = &header;
void (*entry_point)(bd_t *);
diff --git a/common/cmd_date.c b/common/cmd_date.c
index a569d78cadc..84932f75680 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -28,6 +28,8 @@
#include <command.h>
#include <rtc.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if (CONFIG_COMMANDS & CFG_CMD_DATE)
const char *weekdays[] = {
@@ -40,7 +42,6 @@ int mk_date (char *, struct rtc_time *);
int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
struct rtc_time tm;
int rcode = 0;
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index eccf2e9e7b1..1d92bb37d3f 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -19,6 +19,9 @@
#include <net.h>
#include <elf.h>
+#if defined(CONFIG_WALNUT) || defined(CFG_VXWORKS_MAC_PTR)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
#if (CONFIG_COMMANDS & CFG_CMD_ELF)
@@ -78,11 +81,6 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
* ====================================================================== */
int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
-#if defined(CONFIG_WALNUT) || \
- defined(CFG_VXWORKS_MAC_PTR)
- DECLARE_GLOBAL_DATA_PTR;
-#endif
-
unsigned long addr; /* Address of image */
unsigned long bootaddr; /* Address to put the bootline */
char *bootline; /* Text of the bootline */
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index b67d35a5a4e..41621ba982b 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -60,6 +60,10 @@ unsigned long mips_io_port_base = 0;
# define SHOW_BOOT_PROGRESS(arg)
#endif
+#ifdef CONFIG_IDE_8xx_DIRECT
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
#ifdef __PPC__
# define EIEIO __asm__ volatile ("eieio")
# define SYNC __asm__ volatile ("sync")
@@ -498,7 +502,6 @@ void ide_init (void)
{
#ifdef CONFIG_IDE_8xx_DIRECT
- DECLARE_GLOBAL_DATA_PTR;
volatile immap_t *immr = (immap_t *)CFG_IMMR;
volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
#endif
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index 559d7b4c300..fa79b45a3cc 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -41,6 +41,10 @@
#include <asm/iopin_8260.h>
#endif
+#if defined(CONFIG_8xx) || defined(CONFIG_8260)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
static void
unimplemented ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -450,10 +454,8 @@ static void prbrg (int n, uint val)
uint div16 = (val & CPM_BRG_DIV16) != 0;
#if defined(CONFIG_8xx)
- DECLARE_GLOBAL_DATA_PTR;
ulong clock = gd->cpu_clk;
#elif defined(CONFIG_8260)
- DECLARE_GLOBAL_DATA_PTR;
ulong clock = gd->brg_clk;
#endif
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 749849711a0..b18709a47f5 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -30,6 +30,7 @@
#include <net.h>
#include <exports.h>
+DECLARE_GLOBAL_DATA_PTR;
#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
static ulong load_serial (ulong offset);
@@ -53,7 +54,6 @@ int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
char *env_echo;
int rcode = 0;
#ifdef CFG_LOADS_BAUD_CHANGE
- DECLARE_GLOBAL_DATA_PTR;
int load_baudrate, current_baudrate;
load_baudrate = current_baudrate = gd->baudrate;
@@ -213,7 +213,6 @@ load_serial (ulong offset)
static int
read_record (char *buf, ulong len)
{
- DECLARE_GLOBAL_DATA_PTR;
char *p;
char c;
@@ -256,7 +255,6 @@ int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
ulong offset = 0;
ulong size = 0;
#ifdef CFG_LOADS_BAUD_CHANGE
- DECLARE_GLOBAL_DATA_PTR;
int save_baudrate, current_baudrate;
save_baudrate = current_baudrate = gd->baudrate;
@@ -433,8 +431,6 @@ char his_quote; /* quote chars he'll use */
int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong offset = 0;
ulong addr;
int load_baudrate, current_baudrate;
diff --git a/common/cmd_log.c b/common/cmd_log.c
index efc9689c298..042a403026f 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -46,6 +46,8 @@
#include <post.h>
#include <logbuff.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_LOGBUFFER)
/* Local prototypes */
@@ -73,7 +75,6 @@ static unsigned long *ext_logged_chars;
in linux/kernel/printk */
void logbuff_init_ptrs (void)
{
- DECLARE_GLOBAL_DATA_PTR;
unsigned long *ext_tag;
unsigned long post_word;
char *s;
@@ -139,8 +140,6 @@ static void logbuff_puts (const char *s)
void logbuff_log(char *msg)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if ((gd->post_log_word & LOGBUFF_INITIALIZED)) {
logbuff_printk (msg);
} else {
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index ecf1db489a4..6257fbd23e6 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -50,6 +50,8 @@
#include <net.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
#if !defined(CFG_ENV_IS_IN_NVRAM) && \
!defined(CFG_ENV_IS_IN_EEPROM) && \
!defined(CFG_ENV_IS_IN_FLASH) && \
@@ -152,8 +154,6 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int _do_setenv (int flag, int argc, char *argv[])
{
- DECLARE_GLOBAL_DATA_PTR;
-
int i, len, oldval;
int console = -1;
uchar *env, *nxt = NULL;
diff --git a/common/console.c b/common/console.c
index 3c535d23d6d..e9f23bec182 100644
--- a/common/console.c
+++ b/common/console.c
@@ -27,6 +27,8 @@
#include <console.h>
#include <exports.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CONFIG_AMIGAONEG3SE
int console_changed = 0;
#endif
@@ -48,7 +50,6 @@ extern int overwrite_console (void);
static int console_setfile (int file, device_t * dev)
{
- DECLARE_GLOBAL_DATA_PTR;
int error = 0;
if (dev == NULL)
@@ -161,8 +162,6 @@ void fprintf (int file, const char *fmt, ...)
int getc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->flags & GD_FLG_DEVINIT) {
/* Get from the standard input */
return fgetc (stdin);
@@ -174,8 +173,6 @@ int getc (void)
int tstc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->flags & GD_FLG_DEVINIT) {
/* Test the standard input */
return ftstc (stdin);
@@ -187,8 +184,6 @@ int tstc (void)
void putc (const char c)
{
- DECLARE_GLOBAL_DATA_PTR;
-
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
return;
@@ -205,8 +200,6 @@ void putc (const char c)
void puts (const char *s)
{
- DECLARE_GLOBAL_DATA_PTR;
-
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
return;
@@ -258,8 +251,6 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */
static int ctrlc_was_pressed = 0;
int ctrlc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!ctrlc_disabled && gd->have_console) {
if (tstc ()) {
switch (getc ()) {
@@ -370,8 +361,6 @@ int console_assign (int file, char *devname)
/* Called before relocation - use serial functions */
int console_init_f (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
gd->have_console = 1;
#ifdef CONFIG_SILENT_CONSOLE
@@ -407,7 +396,6 @@ device_t *search_device (int flags, char *name)
/* Called after the relocation - use desired console functions */
int console_init_r (void)
{
- DECLARE_GLOBAL_DATA_PTR;
char *stdinname, *stdoutname, *stderrname;
device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
#ifdef CFG_CONSOLE_ENV_OVERWRITE
@@ -499,8 +487,6 @@ int console_init_r (void)
/* Called after the relocation - use desired console functions */
int console_init_r (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
device_t *inputdev = NULL, *outputdev = NULL;
int i, items = ListNumItems (devlist);
diff --git a/common/devices.c b/common/devices.c
index bd4dfa024a9..ddf8f8ee2d9 100644
--- a/common/devices.c
+++ b/common/devices.c
@@ -34,6 +34,8 @@
#include <i2c.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
list_t devlist = 0;
device_t *stdio_devices[] = { NULL, NULL, NULL };
char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
@@ -160,8 +162,6 @@ int device_deregister(char *devname)
int devices_init (void)
{
#ifndef CONFIG_ARM /* already relocated for current ARM implementation */
- DECLARE_GLOBAL_DATA_PTR;
-
ulong relocation_offset = gd->reloc_off;
int i;
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 0c0487228e5..20c206913c6 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -949,6 +949,8 @@ void malloc_stats();
#endif /* 0 */ /* Moved to malloc.h */
#include <common.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/*
Emulation of sbrk for WIN32
All code within the ifdef WIN32 is untested by me.
@@ -1493,8 +1495,6 @@ static mbinptr av_[NAV * 2 + 2] = {
void malloc_bin_reloc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
unsigned long *p = (unsigned long *)(&av_[2]);
int i;
for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
diff --git a/common/env_common.c b/common/env_common.c
index 3201135ea2e..eb33422af4b 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -37,6 +37,8 @@
# define SHOW_BOOT_PROGRESS(arg)
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CONFIG_AMIGAONEG3SE
extern void enable_nvram(void);
extern void disable_nvram(void);
@@ -150,7 +152,6 @@ void env_crc_update (void)
static uchar env_get_char_init (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
uchar c;
/* if crc was bad, use the default environment */
@@ -167,7 +168,6 @@ static uchar env_get_char_init (int index)
#ifdef CONFIG_AMIGAONEG3SE
uchar env_get_char_memory (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
uchar retval;
enable_nvram();
if (gd->env_valid) {
@@ -181,8 +181,6 @@ uchar env_get_char_memory (int index)
#else
uchar env_get_char_memory (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->env_valid) {
return ( *((uchar *)(gd->env_addr + index)) );
} else {
@@ -193,8 +191,6 @@ uchar env_get_char_memory (int index)
uchar *env_get_addr (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->env_valid) {
return ( ((uchar *)(gd->env_addr + index)) );
} else {
@@ -204,8 +200,6 @@ uchar *env_get_addr (int index)
void env_relocate (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,
gd->reloc_off);
diff --git a/common/env_dataflash.c b/common/env_dataflash.c
index 8834da032bd..93fff29b05a 100644
--- a/common/env_dataflash.c
+++ b/common/env_dataflash.c
@@ -26,6 +26,8 @@
#include <linux/stddef.h>
#include <dataflash.h>
+DECLARE_GLOBAL_DATA_PTR;
+
env_t *env_ptr = NULL;
char * env_name_spec = "dataflash";
@@ -68,8 +70,6 @@ int i;
*/
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong crc, len, new;
unsigned off;
uchar buf[64];
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 50c623e37e3..2adc129c677 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -32,6 +32,8 @@
#include <environment.h>
#include <linux/stddef.h>
+DECLARE_GLOBAL_DATA_PTR;
+
env_t *env_ptr = NULL;
char * env_name_spec = "EEPROM";
@@ -75,8 +77,6 @@ int saveenv(void)
*/
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong crc, len, new;
unsigned off;
uchar buf[64];
diff --git a/common/env_flash.c b/common/env_flash.c
index a2ea9c41406..1674b30e118 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -35,6 +35,8 @@
#include <linux/stddef.h>
#include <malloc.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if ((CONFIG_COMMANDS&(CFG_CMD_ENV|CFG_CMD_FLASH)) == (CFG_CMD_ENV|CFG_CMD_FLASH))
#define CMD_SAVEENV
#elif defined(CFG_ENV_ADDR_REDUND)
@@ -89,8 +91,6 @@ extern int default_environment_size;
uchar env_get_char_spec (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
-
return ( *((uchar *)(gd->env_addr + index)) );
}
@@ -98,7 +98,6 @@ uchar env_get_char_spec (int index)
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
int crc1_ok = 0, crc2_ok = 0;
uchar flag1 = flash_addr->flags;
@@ -260,7 +259,6 @@ Done:
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_OMAP2420H4
int flash_probe(void);
@@ -358,8 +356,6 @@ void env_relocate_spec (void)
{
#if !defined(ENV_IS_EMBEDDED) || defined(CFG_ENV_ADDR_REDUND)
#ifdef CFG_ENV_ADDR_REDUND
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->env_addr != (ulong)&(flash_addr->data)) {
env_t * etmp = flash_addr;
ulong ltmp = end_addr;
diff --git a/common/env_nand.c b/common/env_nand.c
index a6af74a75cf..0a05b09a7a8 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -78,11 +78,10 @@ env_t *env_ptr = 0;
/* local functions */
static void use_default(void);
+DECLARE_GLOBAL_DATA_PTR;
uchar env_get_char_spec (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
-
return ( *((uchar *)(gd->env_addr + index)) );
}
@@ -95,8 +94,6 @@ uchar env_get_char_spec (int index)
*/
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = 1;
@@ -114,8 +111,6 @@ int saveenv(void)
ulong total;
int ret = 0;
- DECLARE_GLOBAL_DATA_PTR;
-
env_ptr->flags++;
total = CFG_ENV_SIZE;
@@ -174,8 +169,6 @@ void env_relocate_spec (void)
int crc1_ok = 0, crc2_ok = 0;
env_t *tmp_env1, *tmp_env2;
- DECLARE_GLOBAL_DATA_PTR;
-
total = CFG_ENV_SIZE;
tmp_env1 = (env_t *) malloc(CFG_ENV_SIZE);
@@ -245,8 +238,6 @@ void env_relocate_spec (void)
static void use_default()
{
- DECLARE_GLOBAL_DATA_PTR;
-
puts ("*** Warning - bad CRC or NAND, using default environment\n\n");
if (default_environment_size > CFG_ENV_SIZE){
diff --git a/common/env_nowhere.c b/common/env_nowhere.c
index ee4237c7e90..17ecc775ff9 100644
--- a/common/env_nowhere.c
+++ b/common/env_nowhere.c
@@ -32,6 +32,8 @@
#include <environment.h>
#include <linux/stddef.h>
+DECLARE_GLOBAL_DATA_PTR;
+
env_t *env_ptr = NULL;
extern uchar default_environment[];
@@ -44,8 +46,6 @@ void env_relocate_spec (void)
uchar env_get_char_spec (int index)
{
- DECLARE_GLOBAL_DATA_PTR;
-
return ( *((uchar *)(gd->env_addr + index)) );
}
@@ -56,8 +56,6 @@ uchar env_get_char_spec (int index)
*/
int env_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = 0;
diff --git a/common/env_nvram.c b/common/env_nvram.c
index a406e427a24..7c18896cb04 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -42,6 +42,8 @@
#include <common.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CFG_ENV_IS_IN_NVRAM /* Environment is in NVRAM */
#include <command.h>
@@ -74,7 +76,6 @@ uchar env_get_char_spec (int index)
return c;
#else
- DECLARE_GLOBAL_DATA_PTR;
uchar retval;
enable_nvram();
retval = *((uchar *)(gd->env_addr + index));
@@ -92,8 +93,6 @@ uchar env_get_char_spec (int index)
return c;
#else
- DECLARE_GLOBAL_DATA_PTR;
-
return *((uchar *)(gd->env_addr + index));
#endif
}
@@ -135,7 +134,6 @@ int saveenv (void)
*/
int env_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_AMIGAONEG3SE
enable_nvram();
#endif
diff --git a/common/exports.c b/common/exports.c
index 9858217ae0c..ef253381697 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -1,6 +1,8 @@
#include <common.h>
#include <exports.h>
+DECLARE_GLOBAL_DATA_PTR;
+
static void dummy(void)
{
}
@@ -12,7 +14,6 @@ unsigned long get_version(void)
void jumptable_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
int i;
gd->jt = (void **) malloc (XF_MAX * sizeof (void *));
diff --git a/common/hush.c b/common/hush.c
index bb5041a08d8..feb5627ff2e 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -138,6 +138,8 @@ extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /
#endif
#ifdef __U_BOOT__
+DECLARE_GLOBAL_DATA_PTR;
+
#define EXIT_SUCCESS 0
#define EOF -1
#define syntax() syntax_err()
@@ -3272,7 +3274,6 @@ int parse_file_outer(void)
#ifdef __U_BOOT__
static void u_boot_hush_reloc(void)
{
- DECLARE_GLOBAL_DATA_PTR;
unsigned long addr;
struct reserved_combo *r;
diff --git a/common/lcd.c b/common/lcd.c
index e64972fd813..0be1912a359 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -50,7 +50,6 @@
#include <lcdvideo.h>
#endif
-
#ifdef CONFIG_LCD
/************************************************************************/
@@ -68,6 +67,8 @@
# endif
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
ulong lcd_setmem (ulong addr);
static void lcd_drawchars (ushort x, ushort y, uchar *str, int count);
@@ -339,8 +340,6 @@ static void test_pattern (void)
int drv_lcd_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
device_t lcddev;
int rc;
@@ -682,8 +681,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
static void *lcd_logo (void)
{
#ifdef CONFIG_LCD_INFO
- DECLARE_GLOBAL_DATA_PTR;
-
char info[80];
char temp[32];
#endif /* CONFIG_LCD_INFO */
diff --git a/common/lynxkdi.c b/common/lynxkdi.c
index ed1b595b844..76a271b966d 100644
--- a/common/lynxkdi.c
+++ b/common/lynxkdi.c
@@ -20,13 +20,14 @@
#if defined(CONFIG_LYNXKDI)
#include <lynxkdi.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_MPC8260) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
void lynxkdi_boot ( image_header_t *hdr )
{
void (*lynxkdi)(void) = (void(*)(void)) ntohl(hdr->ih_ep);
lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020;
bd_t *kbd;
- DECLARE_GLOBAL_DATA_PTR;
u32 *psz = (u32 *)(ntohl(hdr->ih_load) + 0x0204);
memset( parms, 0, sizeof(*parms));
diff --git a/common/main.c b/common/main.c
index 445cb18491b..758ef8d32b2 100644
--- a/common/main.c
+++ b/common/main.c
@@ -36,6 +36,10 @@
#include <post.h>
+#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
@@ -105,14 +109,10 @@ static __inline__ int abortboot(int bootdelay)
u_int i;
#ifdef CONFIG_SILENT_CONSOLE
- {
- DECLARE_GLOBAL_DATA_PTR;
-
- if (gd->flags & GD_FLG_SILENT) {
- /* Restore serial console */
- console_assign (stdout, "serial");
- console_assign (stderr, "serial");
- }
+ if (gd->flags & GD_FLG_SILENT) {
+ /* Restore serial console */
+ console_assign (stdout, "serial");
+ console_assign (stderr, "serial");
}
#endif
@@ -195,17 +195,13 @@ static __inline__ int abortboot(int bootdelay)
# endif
#ifdef CONFIG_SILENT_CONSOLE
- {
- DECLARE_GLOBAL_DATA_PTR;
-
- if (abort) {
- /* permanently enable normal console output */
- gd->flags &= ~(GD_FLG_SILENT);
- } else if (gd->flags & GD_FLG_SILENT) {
- /* Restore silent console */
- console_assign (stdout, "nulldev");
- console_assign (stderr, "nulldev");
- }
+ if (abort) {
+ /* permanently enable normal console output */
+ gd->flags &= ~(GD_FLG_SILENT);
+ } else if (gd->flags & GD_FLG_SILENT) {
+ /* Restore silent console */
+ console_assign (stdout, "nulldev");
+ console_assign (stderr, "nulldev");
}
#endif
@@ -223,14 +219,10 @@ static __inline__ int abortboot(int bootdelay)
int abort = 0;
#ifdef CONFIG_SILENT_CONSOLE
- {
- DECLARE_GLOBAL_DATA_PTR;
-
- if (gd->flags & GD_FLG_SILENT) {
- /* Restore serial console */
- console_assign (stdout, "serial");
- console_assign (stderr, "serial");
- }
+ if (gd->flags & GD_FLG_SILENT) {
+ /* Restore serial console */
+ console_assign (stdout, "serial");
+ console_assign (stderr, "serial");
}
#endif
@@ -279,17 +271,13 @@ static __inline__ int abortboot(int bootdelay)
putc ('\n');
#ifdef CONFIG_SILENT_CONSOLE
- {
- DECLARE_GLOBAL_DATA_PTR;
-
- if (abort) {
- /* permanently enable normal console output */
- gd->flags &= ~(GD_FLG_SILENT);
- } else if (gd->flags & GD_FLG_SILENT) {
- /* Restore silent console */
- console_assign (stdout, "nulldev");
- console_assign (stderr, "nulldev");
- }
+ if (abort) {
+ /* permanently enable normal console output */
+ gd->flags &= ~(GD_FLG_SILENT);
+ } else if (gd->flags & GD_FLG_SILENT) {
+ /* Restore silent console */
+ console_assign (stdout, "nulldev");
+ console_assign (stderr, "nulldev");
}
#endif
diff --git a/common/serial.c b/common/serial.c
index 22d8fd0584f..2acbd08b16d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -25,6 +25,8 @@
#include <serial.h>
#include <devices.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_SERIAL_MULTI)
static struct serial_device *serial_devices = NULL;
@@ -49,8 +51,6 @@ struct serial_device *default_serial_console (void)
static int serial_register (struct serial_device *dev)
{
- DECLARE_GLOBAL_DATA_PTR;
-
dev->init += gd->reloc_off;
dev->setbrg += gd->reloc_off;
dev->getc += gd->reloc_off;
@@ -131,8 +131,6 @@ void serial_reinit_all (void)
int serial_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
@@ -144,8 +142,6 @@ int serial_init (void)
void serial_setbrg (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
@@ -158,8 +154,6 @@ void serial_setbrg (void)
int serial_getc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
@@ -171,8 +165,6 @@ int serial_getc (void)
int serial_tstc (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
@@ -184,8 +176,6 @@ int serial_tstc (void)
void serial_putc (const char c)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
@@ -198,8 +188,6 @@ void serial_putc (const char c)
void serial_puts (const char *s)
{
- DECLARE_GLOBAL_DATA_PTR;
-
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
diff --git a/common/soft_i2c.c b/common/soft_i2c.c
index b3642dafc24..bffcd4405ec 100644
--- a/common/soft_i2c.c
+++ b/common/soft_i2c.c
@@ -39,6 +39,10 @@
/* #define DEBUG_I2C */
+#ifdef DEBUG_I2C
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
/*-----------------------------------------------------------------------
* Definitions
@@ -53,7 +57,6 @@
#ifdef DEBUG_I2C
#define PRINTD(fmt,args...) do { \
- DECLARE_GLOBAL_DATA_PTR; \
if (gd->have_console) \
printf (fmt ,##args); \
} while (0)