diff options
author | Wolfgang Denk <wd@denx.de> | 2009-12-15 23:38:34 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-12-15 23:38:34 +0100 |
commit | bb3bcfa2426cc6a0aecec7270e3ee67ca843a125 (patch) | |
tree | 0314e3d8e8d9e4d568a496fca27db33d66e68bb4 /common | |
parent | a200a7c04d89853d2a1395b96d8ca5e3dd754551 (diff) | |
parent | 4b142febff71eabdb7ddbb125c7b583b24ddc434 (diff) | |
download | u-boot-imx-bb3bcfa2426cc6a0aecec7270e3ee67ca843a125.zip u-boot-imx-bb3bcfa2426cc6a0aecec7270e3ee67ca843a125.tar.gz u-boot-imx-bb3bcfa2426cc6a0aecec7270e3ee67ca843a125.tar.bz2 |
Merge branch 'next' of ../next
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 7 | ||||
-rw-r--r-- | common/cmd_bootm.c | 22 | ||||
-rw-r--r-- | common/cmd_echo.c | 58 | ||||
-rw-r--r-- | common/cmd_exit.c | 42 | ||||
-rw-r--r-- | common/cmd_fdt.c | 14 | ||||
-rw-r--r-- | common/cmd_help.c | 50 | ||||
-rw-r--r-- | common/cmd_ide.c | 4 | ||||
-rw-r--r-- | common/cmd_nand.c | 12 | ||||
-rw-r--r-- | common/cmd_onenand.c | 4 | ||||
-rw-r--r-- | common/cmd_test.c | 173 | ||||
-rw-r--r-- | common/cmd_version.c | 40 | ||||
-rw-r--r-- | common/command.c | 233 | ||||
-rw-r--r-- | common/dlmalloc.c | 6 | ||||
-rw-r--r-- | common/env_onenand.c | 10 | ||||
-rw-r--r-- | common/exports.c | 58 | ||||
-rw-r--r-- | common/image.c | 5 |
16 files changed, 433 insertions, 305 deletions
diff --git a/common/Makefile b/common/Makefile index 47f6a71..7784180 100644 --- a/common/Makefile +++ b/common/Makefile @@ -44,7 +44,9 @@ COBJS-y += xyzModem.o # core command COBJS-y += cmd_boot.o COBJS-y += cmd_bootm.o +COBJS-y += cmd_help.o COBJS-y += cmd_nvedit.o +COBJS-y += cmd_version.o # environment COBJS-y += env_common.o @@ -83,9 +85,11 @@ COBJS-$(CONFIG_CMD_DIAG) += cmd_diag.o endif COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o +COBJS-$(CONFIG_CMD_ECHO) += cmd_echo.o COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o COBJS-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o +COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o @@ -115,7 +119,7 @@ COBJS-$(CONFIG_CMD_MISC) += cmd_misc.o COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o COBJS-$(CONFIG_MP) += cmd_mp.o COBJS-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o -COBJS-y += cmd_nand.o +COBJS-$(CONFIG_CMD_NAND) += cmd_nand.o COBJS-$(CONFIG_CMD_NET) += cmd_net.o COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o @@ -134,6 +138,7 @@ COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o COBJS-$(CONFIG_CMD_SPIBOOTLDR) += cmd_spibootldr.o COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o +COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o COBJS-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index e16552e..efd6aec 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -57,6 +57,10 @@ #include <lzma/LzmaTools.h> #endif /* CONFIG_LZMA */ +#ifdef CONFIG_LZO +#include <linux/lzo.h> +#endif /* CONFIG_LZO */ + DECLARE_GLOBAL_DATA_PTR; extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp); @@ -405,6 +409,24 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) *load_end = load + unc_len; break; #endif /* CONFIG_LZMA */ +#ifdef CONFIG_LZO + case IH_COMP_LZO: + printf (" Uncompressing %s ... ", type_name); + + int ret = lzop_decompress((const unsigned char *)image_start, + image_len, (unsigned char *)load, + &unc_len); + if (ret != LZO_E_OK) { + printf ("LZO: uncompress or overwrite error %d " + "- must RESET board to recover\n", ret); + if (boot_progress) + show_boot_progress (-6); + return BOOTM_ERR_RESET; + } + + *load_end = load + unc_len; + break; +#endif /* CONFIG_LZO */ default: printf ("Unimplemented compression type %d\n", comp); return BOOTM_ERR_UNIMPLEMENTED; diff --git a/common/cmd_echo.c b/common/cmd_echo.c new file mode 100644 index 0000000..3ec4d48 --- /dev/null +++ b/common/cmd_echo.c @@ -0,0 +1,58 @@ +/* + * Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + int i; + int putnl = 1; + + for (i = 1; i < argc; i++) { + char *p = argv[i], c; + + if (i > 1) + putc(' '); + while ((c = *p++) != '\0') { + if (c == '\\' && *p == 'c') { + putnl = 0; + p++; + } else { + putc(c); + } + } + } + + if (putnl) + putc('\n'); + + return 0; +} + +U_BOOT_CMD( + echo, CONFIG_SYS_MAXARGS, 1, do_echo, + "echo args to console", + "[args..]\n" + " - echo args to console; \\c suppresses newline" +); diff --git a/common/cmd_exit.c b/common/cmd_exit.c new file mode 100644 index 0000000..ed876d8 --- /dev/null +++ b/common/cmd_exit.c @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +int do_exit(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + int r; + + r = 0; + if (argc > 1) + r = simple_strtoul(argv[1], NULL, 10); + + return -r - 2; +} + +U_BOOT_CMD( + exit, 2, 1, do_exit, + "exit script", + "" +); diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 919a0bf..5df79ae 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -364,13 +364,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } else if (strncmp(argv[1], "me", 2) == 0) { uint64_t addr, size; int err; -#ifdef CONFIG_SYS_64BIT_STRTOUL - addr = simple_strtoull(argv[2], NULL, 16); - size = simple_strtoull(argv[3], NULL, 16); -#else - addr = simple_strtoul(argv[2], NULL, 16); - size = simple_strtoul(argv[3], NULL, 16); -#endif + addr = simple_strtoull(argv[2], NULL, 16); + size = simple_strtoull(argv[3], NULL, 16); err = fdt_fixup_memory(working_fdt, addr, size); if (err < 0) return err; @@ -402,13 +397,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } else if (argv[2][0] == 'a') { uint64_t addr, size; int err; -#ifdef CONFIG_SYS_64BIT_STRTOUL addr = simple_strtoull(argv[3], NULL, 16); size = simple_strtoull(argv[4], NULL, 16); -#else - addr = simple_strtoul(argv[3], NULL, 16); - size = simple_strtoul(argv[4], NULL, 16); -#endif err = fdt_add_mem_rsv(working_fdt, addr, size); if (err < 0) { diff --git a/common/cmd_help.c b/common/cmd_help.c new file mode 100644 index 0000000..e860dfb --- /dev/null +++ b/common/cmd_help.c @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +int do_help(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + return _do_help(&__u_boot_cmd_start, + &__u_boot_cmd_end - &__u_boot_cmd_start, + cmdtp, flag, argc, argv); +} + +U_BOOT_CMD( + help, CONFIG_SYS_MAXARGS, 1, do_help, + "print command description/usage", + "\n" + " - print brief description of all commands\n" + "help command ...\n" + " - print detailed usage of 'command'" +); + +/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */ +cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { + "?", CONFIG_SYS_MAXARGS, 1, do_help, + "alias for 'help'", +#ifdef CONFIG_SYS_LONGHELP + "" +#endif /* CONFIG_SYS_LONGHELP */ +}; diff --git a/common/cmd_ide.c b/common/cmd_ide.c index ec9a1df..093ca9f 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1354,7 +1354,7 @@ ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer) } if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) { -#if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF) +#if defined(CONFIG_SYS_64BIT_LBA) printf ("Error (no IRQ) dev %d blk %Ld: status 0x%02x\n", device, blknr, c); #else @@ -1444,7 +1444,7 @@ ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer) c = ide_wait (device, IDE_TIME_OUT); /* can't take over 500 ms */ if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) { -#if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF) +#if defined(CONFIG_SYS_64BIT_LBA) printf ("Error (no IRQ) dev %d blk %Ld: status 0x%02x\n", device, blknr, c); #else diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 158a55f..075a8af 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -9,18 +9,7 @@ */ #include <common.h> - - -/* - * - * New NAND support - * - */ -#include <common.h> #include <linux/mtd/mtd.h> - -#if defined(CONFIG_CMD_NAND) - #include <command.h> #include <watchdog.h> #include <malloc.h> @@ -686,4 +675,3 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot, "boot from NAND device", "[partition] | [[[loadAddr] dev] offset]" ); -#endif diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index 9090940..565257c 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -19,10 +19,6 @@ #include <asm/io.h> -#if !defined(CONFIG_SYS_64BIT_VSPRINTF) -#warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output! -#endif - static struct mtd_info *mtd; static loff_t next_ofs; diff --git a/common/cmd_test.c b/common/cmd_test.c new file mode 100644 index 0000000..d886f89 --- /dev/null +++ b/common/cmd_test.c @@ -0,0 +1,173 @@ +/* + * Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + char **ap; + int left, adv, expr, last_expr, neg, last_cmp; + + /* args? */ + if (argc < 3) + return 1; + +#if 0 + { + printf("test:"); + left = 1; + while (argv[left]) + printf(" %s", argv[left++]); + } +#endif + + last_expr = 0; + left = argc - 1; ap = argv + 1; + if (left > 0 && strcmp(ap[0], "!") == 0) { + neg = 1; + ap++; + left--; + } else + neg = 0; + + expr = -1; + last_cmp = -1; + last_expr = -1; + while (left > 0) { + + if (strcmp(ap[0], "-o") == 0 || strcmp(ap[0], "-a") == 0) + adv = 1; + else if (strcmp(ap[0], "-z") == 0 || strcmp(ap[0], "-n") == 0) + adv = 2; + else + adv = 3; + + if (left < adv) { + expr = 1; + break; + } + + if (adv == 1) { + if (strcmp(ap[0], "-o") == 0) { + last_expr = expr; + last_cmp = 0; + } else if (strcmp(ap[0], "-a") == 0) { + last_expr = expr; + last_cmp = 1; + } else { + expr = 1; + break; + } + } + + if (adv == 2) { + if (strcmp(ap[0], "-z") == 0) + expr = strlen(ap[1]) == 0 ? 1 : 0; + else if (strcmp(ap[0], "-n") == 0) + expr = strlen(ap[1]) == 0 ? 0 : 1; + else { + expr = 1; + break; + } + + if (last_cmp == 0) + expr = last_expr || expr; + else if (last_cmp == 1) + expr = last_expr && expr; + last_cmp = -1; + } + + if (adv == 3) { + if (strcmp(ap[1], "=") == 0) + expr = strcmp(ap[0], ap[2]) == 0; + else if (strcmp(ap[1], "!=") == 0) + expr = strcmp(ap[0], ap[2]) != 0; + else if (strcmp(ap[1], ">") == 0) + expr = strcmp(ap[0], ap[2]) > 0; + else if (strcmp(ap[1], "<") == 0) + expr = strcmp(ap[0], ap[2]) < 0; + else if (strcmp(ap[1], "-eq") == 0) + expr = simple_strtol(ap[0], NULL, 10) == simple_strtol(ap[2], NULL, 10); + else if (strcmp(ap[1], "-ne") == 0) + expr = simple_strtol(ap[0], NULL, 10) != simple_strtol(ap[2], NULL, 10); + else if (strcmp(ap[1], "-lt") == 0) + expr = simple_strtol(ap[0], NULL, 10) < simple_strtol(ap[2], NULL, 10); + else if (strcmp(ap[1], "-le") == 0) + expr = simple_strtol(ap[0], NULL, 10) <= simple_strtol(ap[2], NULL, 10); + else if (strcmp(ap[1], "-gt") == 0) + expr = simple_strtol(ap[0], NULL, 10) > simple_strtol(ap[2], NULL, 10); + else if (strcmp(ap[1], "-ge") == 0) + expr = simple_strtol(ap[0], NULL, 10) >= simple_strtol(ap[2], NULL, 10); + else { + expr = 1; + break; + } + + if (last_cmp == 0) + expr = last_expr || expr; + else if (last_cmp == 1) + expr = last_expr && expr; + last_cmp = -1; + } + + ap += adv; left -= adv; + } + + if (neg) + expr = !expr; + + expr = !expr; + + debug (": returns %d\n", expr); + + return expr; +} + +U_BOOT_CMD( + test, CONFIG_SYS_MAXARGS, 1, do_test, + "minimal test like /bin/sh", + "[args..]" +); + +int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + return 1; +} + +U_BOOT_CMD( + false, CONFIG_SYS_MAXARGS, 1, do_false, + "do nothing, unsuccessfully", + NULL +); + +int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + return 0; +} + +U_BOOT_CMD( + true, CONFIG_SYS_MAXARGS, 1, do_true, + "do nothing, successfully", + NULL +); diff --git a/common/cmd_version.c b/common/cmd_version.c new file mode 100644 index 0000000..7f165c7 --- /dev/null +++ b/common/cmd_version.c @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> + +extern char version_string[]; + +int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + printf("\n%s\n", version_string); + + return 0; +} + +U_BOOT_CMD( + version, 1, 1, do_version, + "print monitor version", + "" +); diff --git a/common/command.c b/common/command.c index b57f8df..0c66b7a 100644 --- a/common/command.c +++ b/common/command.c @@ -28,206 +28,6 @@ #include <common.h> #include <command.h> -int -do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - extern char version_string[]; - printf ("\n%s\n", version_string); - return 0; -} - -U_BOOT_CMD( - version, 1, 1, do_version, - "print monitor version", - "" -); - -#if defined(CONFIG_CMD_ECHO) - -int -do_echo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int i, putnl = 1; - - for (i = 1; i < argc; i++) { - char *p = argv[i], c; - - if (i > 1) - putc(' '); - while ((c = *p++) != '\0') { - if (c == '\\' && *p == 'c') { - putnl = 0; - p++; - } else { - putc(c); - } - } - } - - if (putnl) - putc('\n'); - return 0; -} - -U_BOOT_CMD( - echo, CONFIG_SYS_MAXARGS, 1, do_echo, - "echo args to console", - "[args..]\n" - " - echo args to console; \\c suppresses newline" -); - -#endif - -#ifdef CONFIG_SYS_HUSH_PARSER - -int -do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - char **ap; - int left, adv, expr, last_expr, neg, last_cmp; - - /* args? */ - if (argc < 3) - return 1; - -#if 0 - { - printf("test:"); - left = 1; - while (argv[left]) - printf(" %s", argv[left++]); - } -#endif - - last_expr = 0; - left = argc - 1; ap = argv + 1; - if (left > 0 && strcmp(ap[0], "!") == 0) { - neg = 1; - ap++; - left--; - } else - neg = 0; - - expr = -1; - last_cmp = -1; - last_expr = -1; - while (left > 0) { - - if (strcmp(ap[0], "-o") == 0 || strcmp(ap[0], "-a") == 0) - adv = 1; - else if (strcmp(ap[0], "-z") == 0 || strcmp(ap[0], "-n") == 0) - adv = 2; - else - adv = 3; - - if (left < adv) { - expr = 1; - break; - } - - if (adv == 1) { - if (strcmp(ap[0], "-o") == 0) { - last_expr = expr; - last_cmp = 0; - } else if (strcmp(ap[0], "-a") == 0) { - last_expr = expr; - last_cmp = 1; - } else { - expr = 1; - break; - } - } - - if (adv == 2) { - if (strcmp(ap[0], "-z") == 0) - expr = strlen(ap[1]) == 0 ? 1 : 0; - else if (strcmp(ap[0], "-n") == 0) - expr = strlen(ap[1]) == 0 ? 0 : 1; - else { - expr = 1; - break; - } - - if (last_cmp == 0) - expr = last_expr || expr; - else if (last_cmp == 1) - expr = last_expr && expr; - last_cmp = -1; - } - - if (adv == 3) { - if (strcmp(ap[1], "=") == 0) - expr = strcmp(ap[0], ap[2]) == 0; - else if (strcmp(ap[1], "!=") == 0) - expr = strcmp(ap[0], ap[2]) != 0; - else if (strcmp(ap[1], ">") == 0) - expr = strcmp(ap[0], ap[2]) > 0; - else if (strcmp(ap[1], "<") == 0) - expr = strcmp(ap[0], ap[2]) < 0; - else if (strcmp(ap[1], "-eq") == 0) - expr = simple_strtol(ap[0], NULL, 10) == simple_strtol(ap[2], NULL, 10); - else if (strcmp(ap[1], "-ne") == 0) - expr = simple_strtol(ap[0], NULL, 10) != simple_strtol(ap[2], NULL, 10); - else if (strcmp(ap[1], "-lt") == 0) - expr = simple_strtol(ap[0], NULL, 10) < simple_strtol(ap[2], NULL, 10); - else if (strcmp(ap[1], "-le") == 0) - expr = simple_strtol(ap[0], NULL, 10) <= simple_strtol(ap[2], NULL, 10); - else if (strcmp(ap[1], "-gt") == 0) - expr = simple_strtol(ap[0], NULL, 10) > simple_strtol(ap[2], NULL, 10); - else if (strcmp(ap[1], "-ge") == 0) - expr = simple_strtol(ap[0], NULL, 10) >= simple_strtol(ap[2], NULL, 10); - else { - expr = 1; - break; - } - - if (last_cmp == 0) - expr = last_expr || expr; - else if (last_cmp == 1) - expr = last_expr && expr; - last_cmp = -1; - } - - ap += adv; left -= adv; - } - - if (neg) - expr = !expr; - - expr = !expr; - - debug (": returns %d\n", expr); - - return expr; -} - -U_BOOT_CMD( - test, CONFIG_SYS_MAXARGS, 1, do_test, - "minimal test like /bin/sh", - "[args..]" -); - -int -do_exit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int r; - - r = 0; - if (argc > 1) - r = simple_strtoul(argv[1], NULL, 10); - - return -r - 2; -} - -U_BOOT_CMD( - exit, 2, 1, do_exit, - "exit script", - "" -); - - -#endif - /* * Use puts() instead of printf() to avoid printf buffer overflow * for long help messages @@ -297,39 +97,6 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int return rcode; } -int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) -{ - return _do_help(&__u_boot_cmd_start, - &__u_boot_cmd_end - &__u_boot_cmd_start, - cmdtp, flag, argc, argv); -} - - -U_BOOT_CMD( - help, CONFIG_SYS_MAXARGS, 1, do_help, - "print online help", - "[command ...]\n" - " - show help information (for 'command')\n" - "'help' prints online help for the monitor commands.\n\n" - "Without arguments, it prints a short usage message for all commands.\n\n" - "To get detailed help information for specific commands you can type\n" - "'help' with one or more command names as arguments." -); - -/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */ -#ifdef CONFIG_SYS_LONGHELP -cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { - "?", CONFIG_SYS_MAXARGS, 1, do_help, - "alias for 'help'", - "" -}; -#else -cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { - "?", CONFIG_SYS_MAXARGS, 1, do_help, - "alias for 'help'" -}; -#endif /* CONFIG_SYS_LONGHELP */ - /*************************************************************************** * find command table entry for a command */ diff --git a/common/dlmalloc.c b/common/dlmalloc.c index ca088a1..735b344 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1522,11 +1522,6 @@ void *sbrk(ptrdiff_t increment) return (void *)old; } -#ifndef CONFIG_X86 -/* - * x86 boards use a slightly different init sequence thus they implement - * their own version of mem_malloc_init() - */ void mem_malloc_init(ulong start, ulong size) { mem_malloc_start = start; @@ -1535,7 +1530,6 @@ void mem_malloc_init(ulong start, ulong size) memset((void *)mem_malloc_start, 0, size); } -#endif /* field-extraction macros */ diff --git a/common/env_onenand.c b/common/env_onenand.c index dcf09de..23d2caa 100644 --- a/common/env_onenand.c +++ b/common/env_onenand.c @@ -60,11 +60,14 @@ uchar env_get_char_spec(int index) void env_relocate_spec(void) { struct mtd_info *mtd = &onenand_mtd; + struct onenand_chip *this = &onenand_chip; loff_t env_addr; int use_default = 0; size_t retlen; env_addr = CONFIG_ENV_ADDR; + if (FLEXONENAND(this)) + env_addr = CONFIG_ENV_ADDR_FLEX; /* Check OneNAND exist */ if (mtd->writesize) @@ -91,6 +94,7 @@ void env_relocate_spec(void) int saveenv(void) { struct mtd_info *mtd = &onenand_mtd; + struct onenand_chip *this = &onenand_chip; loff_t env_addr = CONFIG_ENV_ADDR; struct erase_info instr = { .callback = NULL, @@ -98,6 +102,12 @@ int saveenv(void) size_t retlen; instr.len = CONFIG_ENV_SIZE; + if (FLEXONENAND(this)) { + env_addr = CONFIG_ENV_ADDR_FLEX; + instr.len = CONFIG_ENV_SIZE_FLEX; + instr.len <<= onenand_mtd.eraseregions[0].numblocks == 1 ? + 1 : 0; + } instr.addr = env_addr; instr.mtd = mtd; if (mtd->erase(mtd, &instr)) { diff --git a/common/exports.c b/common/exports.c index b3b6e1f..60bba75 100644 --- a/common/exports.c +++ b/common/exports.c @@ -12,38 +12,34 @@ unsigned long get_version(void) return XF_VERSION; } -void jumptable_init (void) -{ - int i; - - gd->jt = (void **) malloc (XF_MAX * sizeof (void *)); - for (i = 0; i < XF_MAX; i++) - gd->jt[i] = (void *) dummy; +/* Reuse _exports.h with a little trickery to avoid bitrot */ +#define EXPORT_FUNC(sym) gd->jt[XF_##sym] = (void *)sym; - gd->jt[XF_get_version] = (void *) get_version; - gd->jt[XF_malloc] = (void *) malloc; - gd->jt[XF_free] = (void *) free; - gd->jt[XF_getenv] = (void *) getenv; - gd->jt[XF_setenv] = (void *) setenv; - gd->jt[XF_get_timer] = (void *) get_timer; - gd->jt[XF_simple_strtoul] = (void *) simple_strtoul; - gd->jt[XF_udelay] = (void *) udelay; - gd->jt[XF_simple_strtol] = (void *) simple_strtol; - gd->jt[XF_strcmp] = (void *) strcmp; -#if defined(CONFIG_I386) || defined(CONFIG_PPC) - gd->jt[XF_install_hdlr] = (void *) irq_install_handler; - gd->jt[XF_free_hdlr] = (void *) irq_free_handler; -#endif /* I386 || PPC */ -#if defined(CONFIG_CMD_I2C) - gd->jt[XF_i2c_write] = (void *) i2c_write; - gd->jt[XF_i2c_read] = (void *) i2c_read; +#if !defined(CONFIG_I386) && !defined(CONFIG_PPC) +# define install_hdlr dummy +# define free_hdlr dummy +#else /* kludge for non-standard function naming */ +# define install_hdlr irq_install_handler +# define free_hdlr irq_free_handler +#endif +#ifndef CONFIG_CMD_I2C +# define i2c_write dummy +# define i2c_read dummy #endif -#ifdef CONFIG_CMD_SPI - gd->jt[XF_spi_init] = (void *) spi_init; - gd->jt[XF_spi_setup_slave] = (void *) spi_setup_slave; - gd->jt[XF_spi_free_slave] = (void *) spi_free_slave; - gd->jt[XF_spi_claim_bus] = (void *) spi_claim_bus; - gd->jt[XF_spi_release_bus] = (void *) spi_release_bus; - gd->jt[XF_spi_xfer] = (void *) spi_xfer; +#ifndef CONFIG_CMD_SPI +# define spi_init dummy +# define spi_setup_slave dummy +# define spi_free_slave dummy +# define spi_claim_bus dummy +# define spi_release_bus dummy +# define spi_xfer dummy #endif +#ifndef CONFIG_HAS_UID +# define forceenv dummy +#endif + +void jumptable_init(void) +{ + gd->jt = malloc(XF_MAX * sizeof(void *)); +#include <_exports.h> } diff --git a/common/image.c b/common/image.c index 6eaf41e..82e7aa4 100644 --- a/common/image.c +++ b/common/image.c @@ -148,6 +148,7 @@ static table_entry_t uimage_comp[] = { { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", }, { IH_COMP_GZIP, "gzip", "gzip compressed", }, { IH_COMP_LZMA, "lzma", "lzma compressed", }, + { IH_COMP_LZO, "lzo", "lzo compressed", }, { -1, "", "", }, }; @@ -435,11 +436,7 @@ phys_size_t getenv_bootm_size(void) char *s = getenv ("bootm_size"); if (s) { phys_size_t tmp; -#ifdef CONFIG_SYS_64BIT_STRTOUL tmp = (phys_size_t)simple_strtoull (s, NULL, 16); -#else - tmp = (phys_size_t)simple_strtoul (s, NULL, 16); -#endif return tmp; } |