diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/board_f.c | 6 | ||||
| -rw-r--r-- | common/cmd_bdinfo.c | 2 | ||||
| -rw-r--r-- | common/cmd_immap.c | 44 | ||||
| -rw-r--r-- | common/cmd_nvedit.c | 3 | ||||
| -rw-r--r-- | common/hush.c | 31 |
5 files changed, 54 insertions, 32 deletions
diff --git a/common/board_f.c b/common/board_f.c index e591a0e86..485697516 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -642,7 +642,7 @@ static int setup_board_part1(void) bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */ #endif -#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \ +#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || defined(CONFIG_5xx) || \ defined(CONFIG_E500) || defined(CONFIG_MPC86xx) bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */ #endif @@ -858,10 +858,10 @@ static init_fnc_t init_sequence_f[] = { #endif display_options, /* say that we are here */ display_text_info, /* show debugging info if required */ -#if defined(CONFIG_8260) +#if defined(CONFIG_MPC8260) prt_8260_rsr, prt_8260_clks, -#endif /* CONFIG_8260 */ +#endif /* CONFIG_MPC8260 */ #if defined(CONFIG_MPC83xx) prt_83xx_rsr, #endif diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 15119a775..238cadb1e 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -88,7 +88,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) print_num("sramstart", bd->bi_sramstart); print_num("sramsize", bd->bi_sramsize); #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \ - defined(CONFIG_8260) || defined(CONFIG_E500) + defined(CONFIG_MPC8260) || defined(CONFIG_E500) print_num("immr_base", bd->bi_immr_base); #endif print_num("bootflags", bd->bi_bootflags); diff --git a/common/cmd_immap.c b/common/cmd_immap.c index bdf53a4db..1414f9ad5 100644 --- a/common/cmd_immap.c +++ b/common/cmd_immap.c @@ -12,13 +12,13 @@ #include <common.h> #include <command.h> -#if defined(CONFIG_8xx) || defined(CONFIG_8260) +#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) #if defined(CONFIG_8xx) #include <asm/8xx_immap.h> #include <commproc.h> #include <asm/iopin_8xx.h> -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) #include <asm/immap_8260.h> #include <asm/cpm_8260.h> #include <asm/iopin_8260.h> @@ -40,7 +40,7 @@ do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) volatile sysconf8xx_t *sc = &immap->im_siu_conf; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile sysconf8260_t *sc = &immap->im_siu_conf; #endif @@ -50,7 +50,7 @@ do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf ("SIPEND= %08x SIMASK= %08x\n", sc->sc_sipend, sc->sc_simask); printf ("SIEL = %08x SIVEC = %08x\n", sc->sc_siel, sc->sc_sivec); printf ("TESR = %08x SDCR = %08x\n", sc->sc_tesr, sc->sc_sdcr); -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) printf ("BCR = %08x\n", sc->sc_bcr); printf ("P_ACR = %02x P_ALRH= %08x P_ALRL= %08x\n", sc->sc_ppc_acr, sc->sc_ppc_alrh, sc->sc_ppc_alrl); @@ -72,7 +72,7 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) volatile memctl8xx_t *memctl = &immap->im_memctl; int nbanks = 8; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile memctl8260_t *memctl = &immap->im_memctl; int nbanks = 12; #endif @@ -92,19 +92,19 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf ("MAR = %08x", memctl->memc_mar); #if defined(CONFIG_8xx) printf (" MCR = %08x\n", memctl->memc_mcr); -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) putc ('\n'); #endif printf ("MAMR = %08x MBMR = %08x", memctl->memc_mamr, memctl->memc_mbmr); #if defined(CONFIG_8xx) printf ("\nMSTAT = %04x\n", memctl->memc_mstat); -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) printf (" MCMR = %08x\n", memctl->memc_mcmr); #endif printf ("MPTPR = %04x MDR = %08x\n", memctl->memc_mptpr, memctl->memc_mdr); -#if defined(CONFIG_8260) +#if defined(CONFIG_MPC8260) printf ("PSDMR = %08x LSDMR = %08x\n", memctl->memc_psdmr, memctl->memc_lsdmr); printf ("PURT = %02x PSRT = %02x\n", @@ -123,7 +123,7 @@ do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } -#ifdef CONFIG_8260 +#ifdef CONFIG_MPC8260 int do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { @@ -139,7 +139,7 @@ do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) volatile car8xx_t *car = &immap->im_clkrst; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile car8260_t *car = &immap->im_clkrst; #endif @@ -147,7 +147,7 @@ do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf ("SCCR = %08x\n", car->car_sccr); printf ("PLPRCR= %08x\n", car->car_plprcr); printf ("RSR = %08x\n", car->car_rsr); -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) printf ("SCCR = %08x\n", car->car_sccr); printf ("SCMR = %08x\n", car->car_scmr); printf ("RSR = %08x\n", car->car_rsr); @@ -207,7 +207,7 @@ static void binary (char *label, uint value, int nbits) #define PB_NB_ODR 16 #define PC_NBITS 12 #define PD_NBITS 13 -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) #define PA_NBITS 32 #define PA_NB_ODR 32 #define PB_NBITS 28 @@ -224,7 +224,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) volatile iop8xx_t *iop = &immap->im_ioport; volatile ushort *l, *r; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile iop8260_t *iop = &immap->im_ioport; volatile uint *l, *r; #endif @@ -240,7 +240,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) l = &iop->iop_padir; R = &immap->im_cpm.cp_pbdir; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) l = &iop->iop_pdira; R = &iop->iop_pdirb; #endif @@ -248,7 +248,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) binary ("PB_DIR", *R++, PB_NBITS); binary ("PA_PAR", *l++, PA_NBITS); binary ("PB_PAR", *R++, PB_NBITS); -#if defined(CONFIG_8260) +#if defined(CONFIG_MPC8260) binary ("PA_SOR", *l++, PA_NBITS); binary ("PB_SOR", *R++, PB_NBITS); #endif @@ -266,7 +266,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) l = &iop->iop_pcdir; r = &iop->iop_pddir; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) l = &iop->iop_pdirc; r = &iop->iop_pdird; #endif @@ -278,7 +278,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) binary ("PC_SO ", *l++, PC_NBITS); binary (" ", 0, 0); r++; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) binary ("PC_SOR", *l++, PC_NBITS); binary ("PD_SOR", *r++, PD_NBITS); binary ("PC_ODR", *l++, PC_NBITS); @@ -436,7 +436,7 @@ static void prbrg (int n, uint val) #if defined(CONFIG_8xx) ulong clock = gd->cpu_clk; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) ulong clock = gd->arch.brg_clk; #endif @@ -489,7 +489,7 @@ do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #if defined(CONFIG_8xx) volatile cpm8xx_t *cp = &immap->im_cpm; volatile uint *p = &cp->cp_brgc1; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile uint *p = &immap->im_brgc1; #endif int i = 1; @@ -497,7 +497,7 @@ do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) while (i <= 4) prbrg (i++, *p++); -#if defined(CONFIG_8260) +#if defined(CONFIG_MPC8260) p = &immap->im_brgc5; while (i <= 8) prbrg (i++, *p++); @@ -514,7 +514,7 @@ do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) volatile i2c8xx_t *i2c = &immap->im_i2c; volatile cpm8xx_t *cp = &immap->im_cpm; volatile iic_t *iip = (iic_t *) & cp->cp_dparam[PROFF_IIC]; -#elif defined(CONFIG_8260) +#elif defined(CONFIG_MPC8260) volatile i2c8260_t *i2c = &immap->im_i2c; volatile iic_t *iip; uint dpaddr; @@ -614,7 +614,7 @@ U_BOOT_CMD( "" ); -#ifdef CONFIG_8260 +#ifdef CONFIG_MPC8260 U_BOOT_CMD( icinfo, 1, 1, do_icinfo, "print Interrupt Controller registers", diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 5bcc32467..c53601cf7 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -1008,6 +1008,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, if (argc == 2) { size = simple_strtoul(argv[1], NULL, 16); + } else if (argc == 1 && chk) { + puts("## Error: external checksum format must pass size\n"); + return CMD_RET_FAILURE; } else { char *s = addr; diff --git a/common/hush.c b/common/hush.c index 3f3a79c50..df10267d6 100644 --- a/common/hush.c +++ b/common/hush.c @@ -221,6 +221,8 @@ struct child_prog { pid_t pid; /* 0 if exited */ #endif char **argv; /* program name and arguments */ + /* was quoted when parsed; copy of struct o_string.nonnull field */ + int *argv_nonnull; #ifdef __U_BOOT__ int argc; /* number of program arguments */ #endif @@ -467,7 +469,7 @@ static int process_command_subs(o_string *dest, struct p_context *ctx, struct in static int parse_group(o_string *dest, struct p_context *ctx, struct in_str *input, int ch); #endif static char *lookup_param(char *src); -static char *make_string(char **inp); +static char *make_string(char **inp, int *nonnull); static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *input); #ifndef __U_BOOT__ static int parse_string(o_string *dest, struct p_context *ctx, const char *src); @@ -1613,7 +1615,8 @@ static int run_pipe_real(struct pipe *pi) if (child->sp) { char * str = NULL; - str = make_string((child->argv + i)); + str = make_string(child->argv + i, + child->argv_nonnull + i); parse_string_outer(str, FLAG_EXIT_FROM_LOOP | FLAG_REPARSING); free(str); return last_return_code; @@ -1940,7 +1943,8 @@ static int free_pipe(struct pipe *pi, int indent) for (a = 0; a < child->argc; a++) { free(child->argv[a]); } - free(child->argv); + free(child->argv); + free(child->argv_nonnull); child->argc = 0; #endif child->argv=NULL; @@ -2470,8 +2474,14 @@ static int done_word(o_string *dest, struct p_context *ctx) argc = ++child->argc; child->argv = realloc(child->argv, (argc+1)*sizeof(*child->argv)); if (child->argv == NULL) return 1; + child->argv_nonnull = realloc(child->argv_nonnull, + (argc+1)*sizeof(*child->argv_nonnull)); + if (child->argv_nonnull == NULL) + return 1; child->argv[argc-1]=str; + child->argv_nonnull[argc-1] = dest->nonnull; child->argv[argc]=NULL; + child->argv_nonnull[argc] = 0; for (s = dest->data; s && *s; s++,str++) { if (*s == '\\') s++; *str = *s; @@ -2537,6 +2547,7 @@ static int done_command(struct p_context *ctx) prog->redirects = NULL; #endif prog->argv = NULL; + prog->argv_nonnull = NULL; #ifndef __U_BOOT__ prog->is_stopped = 0; #endif @@ -3585,8 +3596,12 @@ static char **make_list_in(char **inp, char *name) return list; } -/* Make new string for parser */ -static char * make_string(char ** inp) +/* + * Make new string for parser + * inp - array of argument strings to flatten + * nonnull - indicates argument was quoted when originally parsed + */ +static char *make_string(char **inp, int *nonnull) { char *p; char *str = NULL; @@ -3600,13 +3615,17 @@ static char * make_string(char ** inp) noeval = 1; for (n = 0; inp[n]; n++) { p = insert_var_value_sub(inp[n], noeval); - str = xrealloc(str, (len + strlen(p))); + str = xrealloc(str, (len + strlen(p) + (2 * nonnull[n]))); if (n) { strcat(str, " "); } else { *str = '\0'; } + if (nonnull[n]) + strcat(str, "'"); strcat(str, p); + if (nonnull[n]) + strcat(str, "'"); len = strlen(str) + 3; if (p != inp[n]) free(p); } |