X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fcmd_bedbug.c;h=77b6e3e88e4b72aefdf55ef79cee6c6ffa6b4428;hb=d366438d8ac80fd10110dceda9f4792f4a16ac9d;hp=1c3547a1fcc680247d4401c244d7ef55b4f22916;hpb=375c2c9e57ea5b8d678475379378f4774aa9cb88;p=karo-tx-uboot.git
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 1c3547a1fc..77b6e3e88e 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -13,15 +13,8 @@
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_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 char console_buffer[];
ulong dis_last_addr = 0; /* Last address disassembled */
ulong dis_last_len = 20; /* Default disassembler length */
@@ -79,7 +72,7 @@ void bedbug_init (void)
* 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 * const argv[])
{
ulong addr; /* Address to start disassembly from */
ulong len; /* # of instructions to disassemble */
@@ -90,10 +83,8 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
addr = dis_last_addr;
len = dis_last_len;
- if (argc < 2) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 1;
- }
+ if (argc < 2)
+ return CMD_RET_USAGE;
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
@@ -113,15 +104,15 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_dis */
U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
- "ds - disassemble memory\n",
- "ds
[# instructions]\n");
+ "disassemble memory",
+ "ds [# instructions]");
/* ======================================================================
* 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 * const argv[])
{
long mem_addr; /* Address to assemble into */
unsigned long instr; /* Machine code for text */
@@ -131,10 +122,8 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/* -------------------------------------------------- */
int rcode = 0;
- if (argc < 2) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 1;
- }
+ if (argc < 2)
+ return CMD_RET_USAGE;
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
@@ -166,14 +155,14 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_asm */
U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
- "as - assemble memory\n", "as \n");
+ "assemble memory", "as ");
/* ======================================================================
* 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 * const argv[])
{
/* -------------------------------------------------- */
if (bug_ctx.do_break)
@@ -183,11 +172,11 @@ int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_break */
U_BOOT_CMD (break, 3, 0, do_bedbug_break,
- "break - set or clear a breakpoint\n",
+ "set or clear a breakpoint",
" - Set or clear a breakpoint\n"
"break - Break at an address\n"
"break off - Disable breakpoint.\n"
- "break show - List breakpoints.\n");
+ "break show - List breakpoints.");
/* ======================================================================
* Called from the debug interrupt routine. Simply calls the CPU-specific
@@ -220,7 +209,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
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 */
+ static char lastcommand[CONFIG_SYS_CBSIZE] = { 0 }; /* previous command */
/* -------------------------------------------------- */
if (bug_ctx.clear)
@@ -248,7 +237,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
if (len == -1)
printf ("\n");
else
- rc = run_command (lastcommand, flag);
+ rc = run_command(lastcommand, flag);
if (rc <= 0) {
/* invalid command or not repeatable, forget it */
@@ -269,7 +258,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
* 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 * const argv[])
{
/* -------------------------------------------------- */
@@ -283,8 +272,8 @@ int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_continue */
U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
- "continue- continue from a breakpoint\n",
- " - continue from a breakpoint.\n");
+ "continue from a breakpoint",
+ "");
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping into
@@ -292,7 +281,7 @@ U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
* 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 * const argv[])
{
unsigned long addr; /* Address to stop at */
@@ -303,7 +292,7 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 1;
}
- if (!find_next_address ((unsigned char *) &addr, FALSE, bug_ctx.regs))
+ if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
return 1;
if (bug_ctx.set)
@@ -314,8 +303,8 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_step */
U_BOOT_CMD (step, 1, 1, do_bedbug_step,
- "step - single step execution.\n",
- " - single step execution.\n");
+ "single step execution.",
+ "");
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping over
@@ -323,7 +312,7 @@ U_BOOT_CMD (step, 1, 1, do_bedbug_step,
* 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 * const argv[])
{
unsigned long addr; /* Address to stop at */
@@ -334,7 +323,7 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 1;
}
- if (!find_next_address ((unsigned char *) &addr, TRUE, bug_ctx.regs))
+ if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
return 1;
if (bug_ctx.set)
@@ -345,14 +334,14 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* 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");
+ "single step execution, stepping over subroutines.",
+ "");
/* ======================================================================
* 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 * const argv[])
{
unsigned long sp; /* Stack pointer */
unsigned long func; /* LR from stack */
@@ -390,14 +379,14 @@ int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_stack */
U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
- "where - Print the running stack.\n",
- " - Print the running stack.\n");
+ "Print the running stack.",
+ "");
/* ======================================================================
* 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 * const argv[])
{
/* -------------------------------------------------- */
@@ -411,9 +400,8 @@ int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} /* do_bedbug_rdump */
U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
- "rdump - Show registers.\n", " - Show registers.\n");
+ "Show registers.", "");
/* ====================================================================== */
-#endif
/*