From 9574fd63a97d080e379f30b6a81a1221eaeb797e Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Thu, 15 Oct 2009 10:48:17 -0500 Subject: cmd_nand: Remove duplicate include Also remove vague, unnecessary comment Signed-off-by: Peter Tyser --- common/cmd_nand.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'common') diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 158a55fa7..404ef9cf7 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -9,14 +9,6 @@ */ #include - - -/* - * - * New NAND support - * - */ -#include #include #if defined(CONFIG_CMD_NAND) -- cgit v1.2.3 From 581d04f14d7a39b63d418e2a21e44101233096d1 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Thu, 15 Oct 2009 10:48:18 -0500 Subject: cmd_nand: Move conditional compilation to Makefile Signed-off-by: Peter Tyser --- common/Makefile | 2 +- common/cmd_nand.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 3781738e1..b8c596c7c 100644 --- a/common/Makefile +++ b/common/Makefile @@ -116,7 +116,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 diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 404ef9cf7..075a8afb6 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -10,9 +10,6 @@ #include #include - -#if defined(CONFIG_CMD_NAND) - #include #include #include @@ -678,4 +675,3 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot, "boot from NAND device", "[partition] | [[[loadAddr] dev] offset]" ); -#endif -- cgit v1.2.3 From c758e947aa7d39a2be607ecdedd818ad300807b2 Mon Sep 17 00:00:00 2001 From: Amul Kumar Saha Date: Wed, 4 Nov 2009 10:38:46 +0530 Subject: ENV Variable support for Flex-OneNAND Define and use CONFIG_ENV_ADDR_FLEX and CONFIG_ENV_SIZE_FLEX for storing environment variables. Signed-off-by: Rohit Hagargundgi Signed-off-by: Amul Kumar Saha --- common/env_onenand.c | 10 ++++++++++ include/configs/apollon.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'common') diff --git a/common/env_onenand.c b/common/env_onenand.c index dcf09dee1..23d2caa62 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/include/configs/apollon.h b/include/configs/apollon.h index 575f60e16..ddac5fbab 100644 --- a/include/configs/apollon.h +++ b/include/configs/apollon.h @@ -76,6 +76,7 @@ * Size of malloc() pool */ #define CONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE_FLEX SZ_256K #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_1M) /* bytes reserved for initial data */ #define CONFIG_SYS_GBL_DATA_SIZE 128 @@ -255,6 +256,7 @@ #define CONFIG_SYS_MONITOR_LEN SZ_256K /* U-Boot image size */ #define CONFIG_ENV_IS_IN_ONENAND 1 #define CONFIG_ENV_ADDR 0x00020000 +#define CONFIG_ENV_ADDR_FLEX 0x00040000 #define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ -- cgit v1.2.3 From 6b8f5ad10f567362a3682840f59ba0fc470af319 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Fri, 16 Oct 2009 17:36:25 -0500 Subject: command.c: Break commands out to appropriate cmd_*.c files command.c should contain common code related to commands, not miscellaneous command implementations. Signed-off-by: Peter Tyser --- common/Makefile | 5 ++ common/cmd_echo.c | 58 +++++++++++++ common/cmd_exit.c | 42 ++++++++++ common/cmd_help.c | 57 +++++++++++++ common/cmd_test.c | 151 +++++++++++++++++++++++++++++++++ common/cmd_version.c | 40 +++++++++ common/command.c | 233 --------------------------------------------------- 7 files changed, 353 insertions(+), 233 deletions(-) create mode 100644 common/cmd_echo.c create mode 100644 common/cmd_exit.c create mode 100644 common/cmd_help.c create mode 100644 common/cmd_test.c create mode 100644 common/cmd_version.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index b8c596c7c..ec025eddd 100644 --- a/common/Makefile +++ b/common/Makefile @@ -45,7 +45,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 @@ -84,9 +86,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 @@ -135,6 +139,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_echo.c b/common/cmd_echo.c new file mode 100644 index 000000000..3ec4d4856 --- /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 +#include + +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 000000000..ed876d8c9 --- /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 +#include + +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_help.c b/common/cmd_help.c new file mode 100644 index 000000000..f01d14e47 --- /dev/null +++ b/common/cmd_help.c @@ -0,0 +1,57 @@ +/* + * 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 +#include + +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 */ diff --git a/common/cmd_test.c b/common/cmd_test.c new file mode 100644 index 000000000..3cdd07bf3 --- /dev/null +++ b/common/cmd_test.c @@ -0,0 +1,151 @@ +/* + * 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 +#include + +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..]" +); diff --git a/common/cmd_version.c b/common/cmd_version.c new file mode 100644 index 000000000..7f165c7b7 --- /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 +#include + +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 b57f8dfc8..0c66b7a1d 100644 --- a/common/command.c +++ b/common/command.c @@ -28,206 +28,6 @@ #include #include -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 */ -- cgit v1.2.3 From 4e1ca93b6bae34b68be9280b43bf0289d994656c Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Fri, 16 Oct 2009 17:36:26 -0500 Subject: cmd_help: General cleanup Shorten the overly-verbose help message of 'help' and clean up some redundant ifdefery while we're at it. Signed-off-by: Peter Tyser --- common/cmd_help.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'common') diff --git a/common/cmd_help.c b/common/cmd_help.c index f01d14e47..e860dfb57 100644 --- a/common/cmd_help.c +++ b/common/cmd_help.c @@ -33,25 +33,18 @@ int do_help(cmd_tbl_t * cmdtp, int flag, int argc, char *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." + "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 */ -#ifdef CONFIG_SYS_LONGHELP cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { "?", CONFIG_SYS_MAXARGS, 1, do_help, "alias for 'help'", +#ifdef CONFIG_SYS_LONGHELP "" -}; -#else -cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { - "?", CONFIG_SYS_MAXARGS, 1, do_help, - "alias for 'help'" -}; #endif /* CONFIG_SYS_LONGHELP */ +}; -- cgit v1.2.3 From 396fd17338b9bf1f84f494ec1860427e18868ede Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Fri, 16 Oct 2009 17:36:27 -0500 Subject: Add 'true' and 'false' commands These commands are only enabled when the hush shell is enabled and can be useful in scripts such as: while true do echo "Booting OS..."; run $bootcmd; echo "Booting OS failed"; sleep 10; done Signed-off-by: Peter Tyser --- common/cmd_test.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'common') diff --git a/common/cmd_test.c b/common/cmd_test.c index 3cdd07bf3..d886f893c 100644 --- a/common/cmd_test.c +++ b/common/cmd_test.c @@ -149,3 +149,25 @@ U_BOOT_CMD( "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 +); -- cgit v1.2.3 From bf44f3f327acddba202ff67f70192926ea47dfd1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 4 Nov 2009 16:34:42 -0500 Subject: exports: rewrite jump table init The current jump table init fails to initialize a bunch of exported symbols (forceenv/do_reset/etc...). Rather than fix just these few missing pieces, rewrite the code to utilize the existing list of exported symbols -- _exports.h. Since every exported symbol has to be listed in this header, it makes sense to use it so that we only ever have one list that needs to be updated and things can't fall out of sync again. Signed-off-by: Mike Frysinger --- common/exports.c | 58 ++++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'common') diff --git a/common/exports.c b/common/exports.c index b3b6e1f9c..60bba750f 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> } -- cgit v1.2.3 From b4feeb4e8a1d9124bae39985a97b99d08e06186d Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Tue, 24 Nov 2009 20:04:13 +1100 Subject: i386: Fix malloc initialization Signed-off-by: Graeme Russ --- common/dlmalloc.c | 6 ------ include/configs/eNET.h | 2 +- include/configs/sc520_cdp.h | 2 +- include/configs/sc520_spunk.h | 2 +- lib_i386/board.c | 15 +++++++-------- 5 files changed, 10 insertions(+), 17 deletions(-) (limited to 'common') diff --git a/common/dlmalloc.c b/common/dlmalloc.c index ca088a17d..735b3443e 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/include/configs/eNET.h b/include/configs/eNET.h index 243a55417..54c34fa67 100644 --- a/include/configs/eNET.h +++ b/include/configs/eNET.h @@ -61,7 +61,7 @@ /* * Size of malloc() pool */ -#define CONFIG_MALLOC_SIZE (CONFIG_SYS_ENV_SIZE + 128*1024) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_BAUDRATE 9600 diff --git a/include/configs/sc520_cdp.h b/include/configs/sc520_cdp.h index 214a9af35..2f1dae729 100644 --- a/include/configs/sc520_cdp.h +++ b/include/configs/sc520_cdp.h @@ -65,7 +65,7 @@ /* * Size of malloc() pool */ -#define CONFIG_MALLOC_SIZE (CONFIG_ENV_SIZE + 128*1024) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_BAUDRATE 9600 diff --git a/include/configs/sc520_spunk.h b/include/configs/sc520_spunk.h index f3fc9602a..cf5633c0d 100644 --- a/include/configs/sc520_spunk.h +++ b/include/configs/sc520_spunk.h @@ -63,7 +63,7 @@ /* * Size of malloc() pool */ -#define CONFIG_MALLOC_SIZE (CONFIG_ENV_SIZE + 128*1024) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_BAUDRATE 9600 diff --git a/lib_i386/board.c b/lib_i386/board.c index 12ca20f60..ebd70476c 100644 --- a/lib_i386/board.c +++ b/lib_i386/board.c @@ -77,17 +77,16 @@ ulong i386boot_bios_size = (ulong)&_i386boot_bios_size; /* size of BIOS const char version_string[] = U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"; -static int mem_malloc_init(void) +static int heap_init(void) { /* start malloc area right after the stack */ - mem_malloc_start = i386boot_bss_start + - i386boot_bss_size + CONFIG_SYS_STACK_SIZE; - mem_malloc_start = (mem_malloc_start+3)&~3; + ulong start = i386boot_bss_start + i386boot_bss_size + + CONFIG_SYS_STACK_SIZE; - /* Use all available RAM for malloc() */ - mem_malloc_end = gd->ram_size; + /* 4-byte aligned */ + start = (start+3)&~3; - mem_malloc_brk = mem_malloc_start; + mem_malloc_init(start, CONFIG_SYS_MALLOC_LEN); return 0; } @@ -184,7 +183,7 @@ init_fnc_t *init_sequence[] = { cpu_init, /* basic cpu dependent setup */ board_init, /* basic board dependent setup */ dram_init, /* configure available RAM banks */ - mem_malloc_init, /* dependant on dram_init */ + heap_init, /* dependant on dram_init */ interrupt_init, /* set up exceptions */ timer_init, serial_init, -- cgit v1.2.3 From 20dde48bcadd856c86a91d5463831a10be46db83 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Thu, 19 Nov 2009 11:37:51 +0100 Subject: add lzop decompression support Add lzop decompression support to the existing lzo bitstream handling (think gzip versus zlib), and support it for uImage decompression if CONFIG_LZO is enabled. Lzop doesn't compress as good as gzip (~10% worse), but decompression is very fast (~0.7s faster here on a slow ppc). The lzop decompression code is based on Albin Tonnerre's recent ARM Linux lzo support patch. Cc: albin.tonnerre@free-electrons.com Signed-off-by: Peter Korsgaard --- common/cmd_bootm.c | 22 ++++++++++ common/image.c | 1 + include/image.h | 1 + include/linux/lzo.h | 4 ++ lib_generic/lzo/lzo1x_decompress.c | 87 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 115 insertions(+) (limited to 'common') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 8f8359856..aa85fafab 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -57,6 +57,10 @@ #include #endif /* CONFIG_LZMA */ +#ifdef CONFIG_LZO +#include +#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/image.c b/common/image.c index 6eaf41eb1..5cc3ab49d 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, "", "", }, }; diff --git a/include/image.h b/include/image.h index 5a424e6a9..cc38eae39 100644 --- a/include/image.h +++ b/include/image.h @@ -164,6 +164,7 @@ #define IH_COMP_GZIP 1 /* gzip Compression Used */ #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ #define IH_COMP_LZMA 3 /* lzma Compression Used */ +#define IH_COMP_LZO 4 /* lzo Compression Used */ #define IH_MAGIC 0x27051956 /* Image Magic Number */ #define IH_NMLEN 32 /* Image Name Length */ diff --git a/include/linux/lzo.h b/include/linux/lzo.h index d793497ec..88687faba 100644 --- a/include/linux/lzo.h +++ b/include/linux/lzo.h @@ -27,6 +27,10 @@ int lzo1x_1_compress(const unsigned char *src, size_t src_len, int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, unsigned char *dst, size_t *dst_len); +/* decompress lzop format */ +int lzop_decompress(const unsigned char *src, size_t src_len, + unsigned char *dst, size_t *dst_len); + /* * Return values (< 0 = Error) */ diff --git a/lib_generic/lzo/lzo1x_decompress.c b/lib_generic/lzo/lzo1x_decompress.c index 2780e118a..09bdc8f6c 100644 --- a/lib_generic/lzo/lzo1x_decompress.c +++ b/lib_generic/lzo/lzo1x_decompress.c @@ -24,6 +24,93 @@ #define COPY4(dst, src) \ put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst)) +static const unsigned char lzop_magic[] = { + 0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a +}; + +#define HEADER_HAS_FILTER 0x00000800L + +static inline const unsigned char *parse_header(const unsigned char *src) +{ + u8 level = 0; + u16 version; + int i; + + /* read magic: 9 first bytes */ + for (i = 0; i < ARRAY_SIZE(lzop_magic); i++) { + if (*src++ != lzop_magic[i]) + return NULL; + } + /* get version (2bytes), skip library version (2), + * 'need to be extracted' version (2) and + * method (1) */ + version = get_unaligned_be16(src); + src += 7; + if (version >= 0x0940) + level = *src++; + if (get_unaligned_be32(src) & HEADER_HAS_FILTER) + src += 4; /* filter info */ + + /* skip flags, mode and mtime_low */ + src += 12; + if (version >= 0x0940) + src += 4; /* skip mtime_high */ + + i = *src++; + /* don't care about the file name, and skip checksum */ + src += i + 4; + + return src; +} + +int lzop_decompress(const unsigned char *src, size_t src_len, + unsigned char *dst, size_t *dst_len) +{ + unsigned char *start = dst; + const unsigned char *send = src + src_len; + u32 slen, dlen; + size_t tmp; + int r; + + src = parse_header(src); + if (!src) + return LZO_E_ERROR; + + while (src < send) { + /* read uncompressed block size */ + dlen = get_unaligned_be32(src); + src += 4; + + /* exit if last block */ + if (dlen == 0) { + *dst_len = dst - start; + return LZO_E_OK; + } + + /* read compressed block size, and skip block checksum info */ + slen = get_unaligned_be32(src); + src += 8; + + if (slen <= 0 || slen > dlen) + return LZO_E_ERROR; + + /* decompress */ + tmp = dlen; + r = lzo1x_decompress_safe((u8 *) src, slen, dst, &tmp); + + if (r != LZO_E_OK) + return r; + + if (dlen != tmp) + return LZO_E_ERROR; + + src += slen; + dst += dlen; + } + + return LZO_E_INPUT_OVERRUN; +} + int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) { -- cgit v1.2.3 From 4b142febff71eabdb7ddbb125c7b583b24ddc434 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Thu, 3 Dec 2009 11:21:21 +0100 Subject: common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL There is more and more usage of printing 64bit values, so enable this feature generally, and delete the CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL defines. Signed-off-by: Heiko Schocher --- README | 9 +-------- common/cmd_fdt.c | 14 ++------------ common/cmd_ide.c | 4 ++-- common/cmd_onenand.c | 4 ---- common/image.c | 4 ---- cpu/mpc85xx/mp.c | 4 ---- disk/part.c | 2 +- drivers/mtd/nand/nand_util.c | 4 ---- fs/ubifs/ubifs.c | 4 ---- include/common.h | 2 -- include/configs/ASH405.h | 2 -- include/configs/CMS700.h | 2 -- include/configs/HH405.h | 2 -- include/configs/HUB405.h | 2 -- include/configs/IDS8247.h | 2 -- include/configs/MPC8313ERDB.h | 1 - include/configs/MPC8315ERDB.h | 1 - include/configs/MPC8360ERDK.h | 1 - include/configs/MPC837XEMDS.h | 3 --- include/configs/MPC837XERDB.h | 3 --- include/configs/MPC8536DS.h | 4 ---- include/configs/MPC8540ADS.h | 3 --- include/configs/MPC8541CDS.h | 3 --- include/configs/MPC8544DS.h | 3 --- include/configs/MPC8548CDS.h | 3 --- include/configs/MPC8555CDS.h | 3 --- include/configs/MPC8560ADS.h | 3 --- include/configs/MPC8568MDS.h | 3 --- include/configs/MPC8569MDS.h | 3 --- include/configs/MPC8572DS.h | 3 --- include/configs/MPC8610HPCD.h | 3 --- include/configs/MPC8641HPCN.h | 4 ---- include/configs/P1_P2_RDB.h | 3 --- include/configs/P2020DS.h | 3 --- include/configs/PLU405.h | 2 -- include/configs/PPChameleonEVB.h | 2 -- include/configs/SIMPC8313.h | 1 - include/configs/TQM8272.h | 2 -- include/configs/TQM85xx.h | 2 -- include/configs/VOH405.h | 2 -- include/configs/WUH405.h | 2 -- include/configs/XPEDITE5170.h | 3 --- include/configs/XPEDITE5200.h | 3 --- include/configs/XPEDITE5370.h | 3 --- include/configs/acadia.h | 2 -- include/configs/afeb9260.h | 1 - include/configs/apollon.h | 2 -- include/configs/aria.h | 2 -- include/configs/at91cap9adk.h | 1 - include/configs/at91sam9260ek.h | 1 - include/configs/at91sam9261ek.h | 1 - include/configs/at91sam9263ek.h | 1 - include/configs/at91sam9m10g45ek.h | 2 -- include/configs/at91sam9rlek.h | 1 - include/configs/bfin_adi_common.h | 3 --- include/configs/cpu9260.h | 1 - include/configs/davinci_dm355evm.h | 1 - include/configs/davinci_dm355leopard.h | 1 - include/configs/davinci_dm365evm.h | 1 - include/configs/davinci_dm6467evm.h | 1 - include/configs/davinci_dvevm.h | 1 - include/configs/davinci_schmoogie.h | 1 - include/configs/davinci_sffsdr.h | 1 - include/configs/davinci_sonata.h | 1 - include/configs/delta.h | 2 -- include/configs/devkit8000.h | 2 -- include/configs/keymile-common.h | 2 -- include/configs/kilauea.h | 2 -- include/configs/mecp5123.h | 2 -- include/configs/meesc.h | 1 - include/configs/mpc5121ads.h | 2 -- include/configs/netstar.h | 2 -- include/configs/nhk8815.h | 1 - include/configs/omap3_beagle.h | 2 -- include/configs/omap3_evm.h | 2 -- include/configs/omap3_overo.h | 2 -- include/configs/omap3_pandora.h | 3 --- include/configs/omap3_zoom1.h | 3 --- include/configs/omap3_zoom2.h | 2 -- include/configs/openrd_base.h | 1 - include/configs/pdnb3.h | 1 - include/configs/pm9261.h | 3 --- include/configs/pm9263.h | 1 - include/configs/quad100hd.h | 1 - include/configs/rd6281a.h | 1 - include/configs/sbc35_a9g20.h | 1 - include/configs/sbc8641d.h | 3 --- include/configs/sc3.h | 2 -- include/configs/sheevaplug.h | 1 - include/configs/smdk6400.h | 2 -- include/configs/smdkc100.h | 2 -- include/configs/socrates.h | 2 -- include/configs/tny_a9260.h | 1 - include/configs/vct.h | 6 ------ include/configs/zylonite.h | 2 -- include/ppc4xx.h | 6 ------ lib_generic/vsprintf.c | 18 +----------------- 97 files changed, 7 insertions(+), 239 deletions(-) (limited to 'common') diff --git a/README b/README index fe6ca98d8..22e35c39b 100644 --- a/README +++ b/README @@ -777,7 +777,7 @@ The following options need to be configured: CONFIG_LBA48 Set this to enable support for disks larger than 137GB - Also look at CONFIG_SYS_64BIT_LBA ,CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL + Also look at CONFIG_SYS_64BIT_LBA. Whithout these , LBA48 support uses 32bit variables and will 'only' support disks up to 2.1TB. @@ -2524,13 +2524,6 @@ use the "saveenv" command to store a valid environment. - CONFIG_SYS_FAULT_MII_ADDR: MII address of the PHY to check for the Ethernet link state. -- CONFIG_SYS_64BIT_VSPRINTF: - Makes vsprintf (and all *printf functions) support printing - of 64bit values by using the L quantifier - -- CONFIG_SYS_64BIT_STRTOUL: - Adds simple_strtoull that returns a 64bit value - - CONFIG_NS16550_MIN_FUNCTIONS: Define this if you desire to only have use of the NS16550_init and NS16550_putc functions for the serial driver located at diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 919a0bf6e..5df79ae3e 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_ide.c b/common/cmd_ide.c index ec9a1df38..093ca9f90 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_onenand.c b/common/cmd_onenand.c index 9090940ae..565257cf4 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -19,10 +19,6 @@ #include -#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/image.c b/common/image.c index 5cc3ab49d..82e7aa436 100644 --- a/common/image.c +++ b/common/image.c @@ -436,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; } diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c index 00b645069..7626eb8e7 100644 --- a/cpu/mpc85xx/mp.c +++ b/cpu/mpc85xx/mp.c @@ -90,11 +90,7 @@ int cpu_release(int nr, int argc, char *argv[]) return 1; } -#ifdef CONFIG_SYS_64BIT_STRTOUL boot_addr = simple_strtoull(argv[0], NULL, 16); -#else - boot_addr = simple_strtoul(argv[0], NULL, 16); -#endif /* handle pir, r3, r6 */ for (i = 1; i < 4; i++) { diff --git a/disk/part.c b/disk/part.c index 9ced4527f..b6bae1794 100644 --- a/disk/part.c +++ b/disk/part.c @@ -196,7 +196,7 @@ void dev_print (block_dev_desc_t *dev_desc) if (dev_desc->lba48) printf (" Supports 48-bit addressing\n"); #endif -#if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF) +#if defined(CONFIG_SYS_64BIT_LBA) printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n", mb_quot, mb_rem, gb_quot, gb_rem, diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c index 7085d42cc..df7f1400f 100644 --- a/drivers/mtd/nand/nand_util.c +++ b/drivers/mtd/nand/nand_util.c @@ -41,10 +41,6 @@ #include #include -#if !defined(CONFIG_SYS_64BIT_VSPRINTF) -#warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output! -#endif - typedef struct erase_info erase_info_t; typedef struct mtd_info mtd_info_t; diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 82f1c547d..3fc79909e 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -26,10 +26,6 @@ #include "ubifs.h" #include -#if !defined(CONFIG_SYS_64BIT_VSPRINTF) -#warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output! -#endif - DECLARE_GLOBAL_DATA_PTR; /* compress.c */ diff --git a/include/common.h b/include/common.h index 749d35cab..00b543408 100644 --- a/include/common.h +++ b/include/common.h @@ -617,9 +617,7 @@ void udelay (unsigned long); /* lib_generic/vsprintf.c */ ulong simple_strtoul(const char *cp,char **endp,unsigned int base); -#ifdef CONFIG_SYS_64BIT_VSPRINTF unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base); -#endif long simple_strtol(const char *cp,char **endp,unsigned int base); void panic(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); diff --git a/include/configs/ASH405.h b/include/configs/ASH405.h index 694a87b97..5cb0f1e28 100644 --- a/include/configs/ASH405.h +++ b/include/configs/ASH405.h @@ -160,8 +160,6 @@ #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I 1 /* ".i" read skips bad blocks */ #define CONFIG_SYS_NAND_QUIET 1 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /*----------------------------------------------------------------------- * PCI stuff *----------------------------------------------------------------------- diff --git a/include/configs/CMS700.h b/include/configs/CMS700.h index 2384925a2..ae8494d57 100644 --- a/include/configs/CMS700.h +++ b/include/configs/CMS700.h @@ -165,8 +165,6 @@ #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I 1 /* ".i" read skips bad blocks */ #define CONFIG_SYS_NAND_QUIET 1 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /* * For booting Linux, the board info and command line data * have to be in the first 8 MB of memory, since this is diff --git a/include/configs/HH405.h b/include/configs/HH405.h index 1a2266ff7..92335239d 100644 --- a/include/configs/HH405.h +++ b/include/configs/HH405.h @@ -219,8 +219,6 @@ #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I 1 /* ".i" read skips bad blocks */ #define CONFIG_SYS_NAND_QUIET 1 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /*----------------------------------------------------------------------- * PCI stuff *----------------------------------------------------------------------- diff --git a/include/configs/HUB405.h b/include/configs/HUB405.h index 518d94d61..ea502d42c 100644 --- a/include/configs/HUB405.h +++ b/include/configs/HUB405.h @@ -160,8 +160,6 @@ #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I 1 /* ".i" read skips bad blocks */ #define CONFIG_SYS_NAND_QUIET 1 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /*----------------------------------------------------------------------- * PCI stuff *----------------------------------------------------------------------- diff --git a/include/configs/IDS8247.h b/include/configs/IDS8247.h index 147a8b267..71bb7b48c 100644 --- a/include/configs/IDS8247.h +++ b/include/configs/IDS8247.h @@ -263,8 +263,6 @@ #define CONFIG_SYS_NAND0_BASE 0xE1000000 #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - #endif /* CONFIG_CMD_NAND */ /*----------------------------------------------------------------------- diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h index 5927e7639..0a4ba2915 100644 --- a/include/configs/MPC8313ERDB.h +++ b/include/configs/MPC8313ERDB.h @@ -236,7 +236,6 @@ #define CONFIG_CMD_NAND 1 #define CONFIG_NAND_FSL_ELBC 1 #define CONFIG_SYS_NAND_BLOCK_SIZE 16384 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ #define CONFIG_SYS_NAND_U_BOOT_SIZE (512 << 10) #define CONFIG_SYS_NAND_U_BOOT_DST 0x00100000 diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index 8eaff5d06..79376b3c5 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -228,7 +228,6 @@ #define CONFIG_MTD_NAND_VERIFY_WRITE 1 #define CONFIG_CMD_NAND 1 #define CONFIG_NAND_FSL_ELBC 1 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ #define CONFIG_SYS_BR1_PRELIM ( CONFIG_SYS_NAND_BASE \ | (2<= 0xc0000000) #define CONFIG_ENABLE_MMU #endif diff --git a/include/configs/socrates.h b/include/configs/socrates.h index 3632b847f..96410413a 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -188,8 +188,6 @@ #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_CMD_NAND -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /* LIME GDC */ #define CONFIG_SYS_LIME_BASE 0xc8000000 #define CONFIG_SYS_LIME_SIZE 0x04000000 /* 64 MB */ diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h index 5b70a7bec..4ad081b0b 100644 --- a/include/configs/tny_a9260.h +++ b/include/configs/tny_a9260.h @@ -138,7 +138,6 @@ #define CONFIG_ENV_OFFSET 0x60000 #define CONFIG_ENV_OFFSET_REDUND 0x80000 #define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ #endif #define CONFIG_BOOTCOMMAND "nboot 0x21000000 0 400000" diff --git a/include/configs/vct.h b/include/configs/vct.h index 20bf48148..1b894a60e 100644 --- a/include/configs/vct.h +++ b/include/configs/vct.h @@ -283,12 +283,6 @@ int vct_gpio_get(int pin); #define CONFIG_BOOTCOMMAND "run test3" #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ -/* - * Needed for 64bit printf format - */ -#define CONFIG_SYS_64BIT_VSPRINTF 1 -#define CONFIG_SYS_64BIT_STRTOUL 1 - /* * UBI configuration */ diff --git a/include/configs/zylonite.h b/include/configs/zylonite.h index 36c341e7c..d0fc13888 100644 --- a/include/configs/zylonite.h +++ b/include/configs/zylonite.h @@ -205,8 +205,6 @@ #define CONFIG_SYS_NAND_SENDCMD_RETRY 3 #undef NAND_ALLOW_ERASE_ALL /* Allow erasing bad blocks - don't use */ -#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ - /* NAND Timing Parameters (in ns) */ #define NAND_TIMING_tCH 10 #define NAND_TIMING_tCS 0 diff --git a/include/ppc4xx.h b/include/ppc4xx.h index 5024db447..ee30a4ca3 100644 --- a/include/ppc4xx.h +++ b/include/ppc4xx.h @@ -100,12 +100,6 @@ #endif /* 440EP/EPX 440GR/GRX 440SP/SPE 460EX/GT/SX 405EX*/ #if defined(CONFIG_440) -/* - * Enable long long (%ll ...) printf format on 440 PPC's since most of - * them support 36bit physical addressing - */ -#define CONFIG_SYS_64BIT_VSPRINTF -#define CONFIG_SYS_64BIT_STRTOUL #include #else #include diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 3d95728ef..8c58a9366 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -21,21 +21,10 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); #endif -#ifdef CONFIG_SYS_64BIT_VSPRINTF #include # define NUM_TYPE long long -#else -# define NUM_TYPE long -#define do_div(n, base) ({ \ - unsigned int __res; \ - __res = ((unsigned NUM_TYPE) n) % base; \ - n = ((unsigned NUM_TYPE) n) / base; \ - __res; \ -}) -#endif #define noinline __attribute__((noinline)) - const char hex_asc[] = "0123456789abcdef"; #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] @@ -104,7 +93,6 @@ int ustrtoul(const char *cp, char **endp, unsigned int base) return result; } -#ifdef CONFIG_SYS_64BIT_STRTOUL unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int base) { unsigned long long result = 0, value; @@ -132,7 +120,6 @@ unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int ba *endp = (char *) cp; return result; } -#endif /* CONFIG_SYS_64BIT_STRTOUL */ /* we use this so that we can do without the ctype library */ #define is_digit(c) ((c) >= '0' && (c) <= '9') @@ -631,12 +618,9 @@ int vsprintf(char *buf, const char *fmt, va_list args) --fmt; continue; } -#ifdef CONFIG_SYS_64BIT_VSPRINTF if (qualifier == 'L') /* "quad" for 64 bit variables */ num = va_arg(args, unsigned long long); - else -#endif - if (qualifier == 'l') { + else if (qualifier == 'l') { num = va_arg(args, unsigned long); if (flags & SIGN) num = (signed long) num; -- cgit v1.2.3 From 8f8bd565f35ff8a068727bfcf8975c50df082043 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Sat, 31 Oct 2009 12:37:38 -0500 Subject: USB Consolidate descriptor definitions The header files usb.h and usbdescriptors.h have the same nameed structure definitions for usb_config_descriptor usb_interface_descriptor usb_endpoint_descriptor usb_device_descriptor usb_string_descriptor These are out right duplicates in usb.h usb_device_descriptor usb_string_descriptor This one has extra unused elements usb_endpoint_descriptor unsigned char bRefresh unsigned char bSynchAddress; These in usb.h have extra elements at the end of the usb 2.0 specified descriptor and are used. usb_config_descriptor usb_interface_descriptor The change is to consolidate the definition of the descriptors to usbdescriptors.h. The dublicates in usb.h are removed. The extra element structure will have their name shorted by removing the '_descriptor' suffix. So usb_config_descriptor -> usb_config usb_interface_descriptor -> usb_interface For these, the common descriptor elements are accessed now by an element 'desc'. As an example - if (iface->bInterfaceClass != USB_CLASS_HUB) + if (iface->desc.bInterfaceClass != USB_CLASS_HUB) This has been compile tested on MAKEALL arm, ppc and mips. Signed-off-by: Tom Rix --- common/cmd_usb.c | 20 ++++++------- common/usb.c | 35 +++++++++++------------ common/usb_kbd.c | 22 ++++++++------ common/usb_storage.c | 16 +++++------ cpu/ppc4xx/usbdev.c | 4 +-- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/musb/musb_hcd.c | 2 +- include/usb.h | 70 ++++++--------------------------------------- 8 files changed, 61 insertions(+), 110 deletions(-) (limited to 'common') diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 7b8ee6b48..1e297d53d 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -157,7 +157,7 @@ void usb_display_desc(struct usb_device *dev) { if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) { printf("%d: %s, USB Revision %x.%x\n", dev->devnum, - usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass), + usb_get_class_desc(dev->config.if_desc[0].desc.bInterfaceClass), (dev->descriptor.bcdUSB>>8) & 0xff, dev->descriptor.bcdUSB & 0xff); @@ -174,7 +174,7 @@ void usb_display_desc(struct usb_device *dev) } else { printf(" - Class: (from Interface) %s\n", usb_get_class_desc( - dev->config.if_desc[0].bInterfaceClass)); + dev->config.if_desc[0].desc.bInterfaceClass)); } printf(" - PacketSize: %d Configurations: %d\n", dev->descriptor.bMaxPacketSize0, @@ -187,14 +187,14 @@ void usb_display_desc(struct usb_device *dev) } -void usb_display_conf_desc(struct usb_config_descriptor *config, +void usb_display_conf_desc(struct usb_configuration_descriptor *config, struct usb_device *dev) { printf(" Configuration: %d\n", config->bConfigurationValue); printf(" - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces, (config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ", (config->bmAttributes & 0x20) ? "Remote Wakeup " : "", - config->MaxPower*2); + config->bMaxPower*2); if (config->iConfiguration) { printf(" - "); usb_display_string(dev, config->iConfiguration); @@ -246,16 +246,16 @@ void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc) /* main routine to diasplay the configs, interfaces and endpoints */ void usb_display_config(struct usb_device *dev) { - struct usb_config_descriptor *config; - struct usb_interface_descriptor *ifdesc; + struct usb_config *config; + struct usb_interface *ifdesc; struct usb_endpoint_descriptor *epdesc; int i, ii; config = &dev->config; - usb_display_conf_desc(config, dev); + usb_display_conf_desc(&config->desc, dev); for (i = 0; i < config->no_of_if; i++) { ifdesc = &config->if_desc[i]; - usb_display_if_desc(ifdesc, dev); + usb_display_if_desc(&ifdesc->desc, dev); for (ii = 0; ii < ifdesc->no_of_ep; ii++) { epdesc = &ifdesc->ep_desc[ii]; usb_display_ep_desc(epdesc); @@ -319,9 +319,9 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) pre[index++] = has_child ? '|' : ' '; pre[index] = 0; printf(" %s (%s, %dmA)\n", usb_get_class_desc( - dev->config.if_desc[0].bInterfaceClass), + dev->config.if_desc[0].desc.bInterfaceClass), portspeed(dev->speed), - dev->config.MaxPower * 2); + dev->config.desc.bMaxPower * 2); if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial)) printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial); printf(" %s\n", pre); diff --git a/common/usb.c b/common/usb.c index 87fca7070..eef4b34a7 100644 --- a/common/usb.c +++ b/common/usb.c @@ -299,8 +299,8 @@ int usb_set_maxpacket(struct usb_device *dev) { int i, ii; - for (i = 0; i < dev->config.bNumInterfaces; i++) - for (ii = 0; ii < dev->config.if_desc[i].bNumEndpoints; ii++) + for (i = 0; i < dev->config.desc.bNumInterfaces; i++) + for (ii = 0; ii < dev->config.if_desc[i].desc.bNumEndpoints; ii++) usb_set_maxpacket_ep(dev, &dev->config.if_desc[i].ep_desc[ii]); @@ -330,14 +330,14 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno) return -1; } memcpy(&dev->config, buffer, buffer[0]); - le16_to_cpus(&(dev->config.wTotalLength)); + le16_to_cpus(&(dev->config.desc.wTotalLength)); dev->config.no_of_if = 0; - index = dev->config.bLength; + index = dev->config.desc.bLength; /* Ok the first entry must be a configuration entry, * now process the others */ head = (struct usb_descriptor_header *) &buffer[index]; - while (index + 1 < dev->config.wTotalLength) { + while (index + 1 < dev->config.desc.wTotalLength) { switch (head->bDescriptorType) { case USB_DT_INTERFACE: if (((struct usb_interface_descriptor *) \ @@ -350,7 +350,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno) dev->config.if_desc[ifno].no_of_ep = 0; dev->config.if_desc[ifno].num_altsetting = 1; curr_if_num = - dev->config.if_desc[ifno].bInterfaceNumber; + dev->config.if_desc[ifno].desc.bInterfaceNumber; } else { /* found alternate setting for the interface */ dev->config.if_desc[ifno].num_altsetting++; @@ -440,10 +440,9 @@ int usb_get_configuration_no(struct usb_device *dev, { int result; unsigned int tmp; - struct usb_config_descriptor *config; + struct usb_configuration_descriptor *config; - - config = (struct usb_config_descriptor *)&buffer[0]; + config = (struct usb_configuration_descriptor *)&buffer[0]; result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, 9); if (result < 9) { if (result < 0) @@ -489,11 +488,11 @@ int usb_set_address(struct usb_device *dev) */ int usb_set_interface(struct usb_device *dev, int interface, int alternate) { - struct usb_interface_descriptor *if_face = NULL; + struct usb_interface *if_face = NULL; int ret, i; - for (i = 0; i < dev->config.bNumInterfaces; i++) { - if (dev->config.if_desc[i].bInterfaceNumber == interface) { + for (i = 0; i < dev->config.desc.bNumInterfaces; i++) { + if (dev->config.if_desc[i].desc.bInterfaceNumber == interface) { if_face = &dev->config.if_desc[i]; break; } @@ -897,7 +896,7 @@ int usb_new_device(struct usb_device *dev) usb_parse_config(dev, &tmpbuf[0], 0); usb_set_maxpacket(dev); /* we set the default configuration here */ - if (usb_set_configuration(dev, dev->config.bConfigurationValue)) { + if (usb_set_configuration(dev, dev->config.desc.bConfigurationValue)) { printf("failed to set default configuration " \ "len %d, status %lX\n", dev->act_len, dev->status); return -1; @@ -1347,21 +1346,21 @@ int usb_hub_configure(struct usb_device *dev) int usb_hub_probe(struct usb_device *dev, int ifnum) { - struct usb_interface_descriptor *iface; + struct usb_interface *iface; struct usb_endpoint_descriptor *ep; int ret; iface = &dev->config.if_desc[ifnum]; /* Is it a hub? */ - if (iface->bInterfaceClass != USB_CLASS_HUB) + if (iface->desc.bInterfaceClass != USB_CLASS_HUB) return 0; /* Some hubs have a subclass of 1, which AFAICT according to the */ /* specs is not defined, but it works */ - if ((iface->bInterfaceSubClass != 0) && - (iface->bInterfaceSubClass != 1)) + if ((iface->desc.bInterfaceSubClass != 0) && + (iface->desc.bInterfaceSubClass != 1)) return 0; /* Multiple endpoints? What kind of mutant ninja-hub is this? */ - if (iface->bNumEndpoints != 1) + if (iface->desc.bNumEndpoints != 1) return 0; ep = &iface->ep_desc[0]; /* Output endpoint? Curiousier and curiousier.. */ diff --git a/common/usb_kbd.c b/common/usb_kbd.c index b458d7728..9957dcc32 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -229,7 +229,7 @@ int usb_kbd_deregister(void) static void usb_kbd_setled(struct usb_device *dev) { - struct usb_interface_descriptor *iface; + struct usb_interface *iface; iface = &dev->config.if_desc[0]; leds=0; if(scroll_lock!=0) @@ -242,7 +242,7 @@ static void usb_kbd_setled(struct usb_device *dev) leds|=1; usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE, - 0x200, iface->bInterfaceNumber,(void *)&leds, 1, 0); + 0x200, iface->desc.bInterfaceNumber, (void *)&leds, 1, 0); } @@ -348,17 +348,21 @@ static int usb_kbd_irq(struct usb_device *dev) /* probes the USB device dev for keyboard type */ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) { - struct usb_interface_descriptor *iface; + struct usb_interface *iface; struct usb_endpoint_descriptor *ep; int pipe,maxp; if (dev->descriptor.bNumConfigurations != 1) return 0; iface = &dev->config.if_desc[ifnum]; - if (iface->bInterfaceClass != 3) return 0; - if (iface->bInterfaceSubClass != 1) return 0; - if (iface->bInterfaceProtocol != 1) return 0; - if (iface->bNumEndpoints != 1) return 0; + if (iface->desc.bInterfaceClass != 3) + return 0; + if (iface->desc.bInterfaceSubClass != 1) + return 0; + if (iface->desc.bInterfaceProtocol != 1) + return 0; + if (iface->desc.bNumEndpoints != 1) + return 0; ep = &iface->ep_desc[0]; @@ -367,9 +371,9 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) USB_KBD_PRINTF("USB KBD found set protocol...\n"); /* ok, we found a USB Keyboard, install it */ /* usb_kbd_get_hid_desc(dev); */ - usb_set_protocol(dev, iface->bInterfaceNumber, 0); + usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0); USB_KBD_PRINTF("USB KBD found set idle...\n"); - usb_set_idle(dev, iface->bInterfaceNumber, REPEAT_RATE, 0); + usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0); memset(&new[0], 0, 8); memset(&old[0], 0, 8); repeat_delay=0; diff --git a/common/usb_storage.c b/common/usb_storage.c index 19613f28c..391948b18 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -1070,7 +1070,7 @@ retry_it: int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss) { - struct usb_interface_descriptor *iface; + struct usb_interface *iface; int i; unsigned int flags = 0; @@ -1094,9 +1094,9 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, #endif if (dev->descriptor.bDeviceClass != 0 || - iface->bInterfaceClass != USB_CLASS_MASS_STORAGE || - iface->bInterfaceSubClass < US_SC_MIN || - iface->bInterfaceSubClass > US_SC_MAX) { + iface->desc.bInterfaceClass != USB_CLASS_MASS_STORAGE || + iface->desc.bInterfaceSubClass < US_SC_MIN || + iface->desc.bInterfaceSubClass > US_SC_MAX) { /* if it's not a mass storage, we go no further */ return 0; } @@ -1119,8 +1119,8 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, ss->subclass = subclass; ss->protocol = protocol; } else { - ss->subclass = iface->bInterfaceSubClass; - ss->protocol = iface->bInterfaceProtocol; + ss->subclass = iface->desc.bInterfaceSubClass; + ss->protocol = iface->desc.bInterfaceProtocol; } /* set the handler pointers based on the protocol */ @@ -1153,7 +1153,7 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, * An optional interrupt is OK (necessary for CBI protocol). * We will ignore any others. */ - for (i = 0; i < iface->bNumEndpoints; i++) { + for (i = 0; i < iface->desc.bNumEndpoints; i++) { /* is it an BULK endpoint? */ if ((iface->ep_desc[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { @@ -1178,7 +1178,7 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, ss->ep_in, ss->ep_out, ss->ep_int); /* Do some basic sanity checks, and bail if we find a problem */ - if (usb_set_interface(dev, iface->bInterfaceNumber, 0) || + if (usb_set_interface(dev, iface->desc.bInterfaceNumber, 0) || !ss->ep_in || !ss->ep_out || (ss->protocol == US_PR_CBI && ss->ep_int == 0)) { USB_STOR_PRINTF("Problems with device\n"); diff --git a/cpu/ppc4xx/usbdev.c b/cpu/ppc4xx/usbdev.c index 5bb4f3ce6..fe398afc0 100644 --- a/cpu/ppc4xx/usbdev.c +++ b/cpu/ppc4xx/usbdev.c @@ -21,7 +21,7 @@ void process_endpoints(unsigned short usb2d0_intrin) { /*will hold the packet received */ struct usb_device_descriptor usb_device_packet; - struct usb_config_descriptor usb_config_packet; + struct usb_configuration_descriptor usb_config_packet; struct usb_string_descriptor usb_string_packet; struct devrequest setup_packet; unsigned int *setup_packet_pt; @@ -99,7 +99,7 @@ void process_endpoints(unsigned short usb2d0_intrin) usb_config_packet.bConfigurationValue = 1; usb_config_packet.iConfiguration = 0; usb_config_packet.bmAttributes = 0x40; - usb_config_packet.MaxPower = 0; + usb_config_packet.bMaxPower = 0; /*put packet in fifo */ packet_pt = (unsigned char *)&usb_config_packet; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 324c308f4..ba85991e8 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -96,7 +96,7 @@ static struct descriptor { * UE_DIR_IN | EHCI_INTR_ENDPT */ 3, /* bmAttributes: UE_INTERRUPT */ - 8, 0, /* wMaxPacketSize */ + 8, /* wMaxPacketSize */ 255 /* bInterval */ }, }; diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c index 4ca94cb31..555d2dc1b 100644 --- a/drivers/usb/musb/musb_hcd.c +++ b/drivers/usb/musb/musb_hcd.c @@ -803,7 +803,7 @@ void usb_event_poll() { struct stdio_dev *dev; struct usb_device *usb_kbd_dev; - struct usb_interface_descriptor *iface; + struct usb_interface *iface; struct usb_endpoint_descriptor *ep; int pipe; int maxp; diff --git a/include/usb.h b/include/usb.h index 7c47098d8..4148d67e1 100644 --- a/include/usb.h +++ b/include/usb.h @@ -27,6 +27,7 @@ #define _USB_H_ #include +#include /* Everything is aribtrary */ #define USB_ALTSETTINGALLOC 4 @@ -41,13 +42,6 @@ #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */ -/* String descriptor */ -struct usb_string_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short wData[1]; -} __attribute__ ((packed)); - /* device request (setup) */ struct devrequest { unsigned char requesttype; @@ -63,47 +57,9 @@ struct usb_descriptor_header { unsigned char bDescriptorType; } __attribute__ ((packed)); -/* Device descriptor */ -struct usb_device_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short bcdUSB; - unsigned char bDeviceClass; - unsigned char bDeviceSubClass; - unsigned char bDeviceProtocol; - unsigned char bMaxPacketSize0; - unsigned short idVendor; - unsigned short idProduct; - unsigned short bcdDevice; - unsigned char iManufacturer; - unsigned char iProduct; - unsigned char iSerialNumber; - unsigned char bNumConfigurations; -} __attribute__ ((packed)); - -/* Endpoint descriptor */ -struct usb_endpoint_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned char bEndpointAddress; - unsigned char bmAttributes; - unsigned short wMaxPacketSize; - unsigned char bInterval; - unsigned char bRefresh; - unsigned char bSynchAddress; -} __attribute__ ((packed)) __attribute__ ((aligned(2))); - -/* Interface descriptor */ -struct usb_interface_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned char bInterfaceNumber; - unsigned char bAlternateSetting; - unsigned char bNumEndpoints; - unsigned char bInterfaceClass; - unsigned char bInterfaceSubClass; - unsigned char bInterfaceProtocol; - unsigned char iInterface; +/* Interface */ +struct usb_interface { + struct usb_interface_descriptor desc; unsigned char no_of_ep; unsigned char num_altsetting; @@ -112,20 +68,12 @@ struct usb_interface_descriptor { struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS]; } __attribute__ ((packed)); - -/* Configuration descriptor information.. */ -struct usb_config_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short wTotalLength; - unsigned char bNumInterfaces; - unsigned char bConfigurationValue; - unsigned char iConfiguration; - unsigned char bmAttributes; - unsigned char MaxPower; +/* Configuration information.. */ +struct usb_config { + struct usb_configuration_descriptor desc; unsigned char no_of_if; /* number of interfaces */ - struct usb_interface_descriptor if_desc[USB_MAXINTERFACES]; + struct usb_interface if_desc[USB_MAXINTERFACES]; } __attribute__ ((packed)); enum { @@ -156,7 +104,7 @@ struct usb_device { int configno; /* selected config number */ struct usb_device_descriptor descriptor; /* Device Descriptor */ - struct usb_config_descriptor config; /* config descriptor */ + struct usb_config config; /* config descriptor */ int have_langid; /* whether string_langid is valid yet */ int string_langid; /* language ID for strings */ -- cgit v1.2.3 From 127e10842b2474ac20e40572a4102dd4d5ed80f1 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Tue, 3 Nov 2009 12:22:10 +0530 Subject: usb: write command for RAW partition. This patch implements write support to usb device with raw partition. It will be useful for filesystem write support to usb device from u-boot in future. Tested with writing kernel image to raw usb disk & booting with usb read command into ram. [Note: run usb part to get info about start sector & number of sectors on a partition for usb write operation.] Signed-off-by: Mahavir Jain --- common/cmd_usb.c | 24 +++++++++++++ common/usb_storage.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) (limited to 'common') diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 1e297d53d..9de515c32 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -642,6 +642,28 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } } + if (strcmp(argv[1], "write") == 0) { + if (usb_stor_curr_dev < 0) { + printf("no current device selected\n"); + return 1; + } + if (argc == 5) { + unsigned long addr = simple_strtoul(argv[2], NULL, 16); + unsigned long blk = simple_strtoul(argv[3], NULL, 16); + unsigned long cnt = simple_strtoul(argv[4], NULL, 16); + unsigned long n; + printf("\nUSB write: device %d block # %ld, count %ld" + " ... ", usb_stor_curr_dev, blk, cnt); + stor_dev = usb_stor_get_dev(usb_stor_curr_dev); + n = stor_dev->block_write(usb_stor_curr_dev, blk, cnt, + (ulong *)addr); + printf("%ld blocks write: %s\n", n, + (n == cnt) ? "OK" : "ERROR"); + if (n == cnt) + return 0; + return 1; + } + } if (strncmp(argv[1], "dev", 3) == 0) { if (argc == 3) { int dev = (int)simple_strtoul(argv[2], NULL, 10); @@ -687,6 +709,8 @@ U_BOOT_CMD( " devices\n" "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n" " to memory address `addr'" + "usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'\n" + " from memory address `addr'" ); diff --git a/common/usb_storage.c b/common/usb_storage.c index 391948b18..a8642c9cc 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -168,6 +168,8 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss); unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer); +unsigned long usb_stor_write(int device, unsigned long blknr, + unsigned long blkcnt, const void *buffer); struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); @@ -227,6 +229,7 @@ int usb_stor_scan(int mode) usb_dev_desc[i].dev = i; usb_dev_desc[i].part_type = PART_TYPE_UNKNOWN; usb_dev_desc[i].block_read = usb_stor_read; + usb_dev_desc[i].block_write = usb_stor_write; } usb_max_devs = 0; @@ -964,6 +967,22 @@ static int usb_read_10(ccb *srb, struct us_data *ss, unsigned long start, return ss->transport(srb, ss); } +static int usb_write_10(ccb *srb, struct us_data *ss, unsigned long start, + unsigned short blocks) +{ + memset(&srb->cmd[0], 0, 12); + srb->cmd[0] = SCSI_WRITE10; + srb->cmd[2] = ((unsigned char) (start >> 24)) & 0xff; + srb->cmd[3] = ((unsigned char) (start >> 16)) & 0xff; + srb->cmd[4] = ((unsigned char) (start >> 8)) & 0xff; + srb->cmd[5] = ((unsigned char) (start)) & 0xff; + srb->cmd[7] = ((unsigned char) (blocks >> 8)) & 0xff; + srb->cmd[8] = (unsigned char) blocks & 0xff; + srb->cmdlen = 12; + USB_STOR_PRINTF("write10: start %lx blocks %x\n", start, blocks); + return ss->transport(srb, ss); +} + #ifdef CONFIG_USB_BIN_FIXUP /* @@ -1065,6 +1084,86 @@ retry_it: return blkcnt; } +#define USB_MAX_WRITE_BLK 20 + +unsigned long usb_stor_write(int device, unsigned long blknr, + unsigned long blkcnt, const void *buffer) +{ + unsigned long start, blks, buf_addr; + unsigned short smallblks; + struct usb_device *dev; + int retry, i; + ccb *srb = &usb_ccb; + + if (blkcnt == 0) + return 0; + + device &= 0xff; + /* Setup device */ + USB_STOR_PRINTF("\nusb_write: dev %d \n", device); + dev = NULL; + for (i = 0; i < USB_MAX_DEVICE; i++) { + dev = usb_get_dev_index(i); + if (dev == NULL) + return 0; + if (dev->devnum == usb_dev_desc[device].target) + break; + } + + usb_disable_asynch(1); /* asynch transfer not allowed */ + + srb->lun = usb_dev_desc[device].lun; + buf_addr = (unsigned long)buffer; + start = blknr; + blks = blkcnt; + if (usb_test_unit_ready(srb, (struct us_data *)dev->privptr)) { + printf("Device NOT ready\n Request Sense returned %02X %02X" + " %02X\n", srb->sense_buf[2], srb->sense_buf[12], + srb->sense_buf[13]); + return 0; + } + + USB_STOR_PRINTF("\nusb_write: dev %d startblk %lx, blccnt %lx" + " buffer %lx\n", device, start, blks, buf_addr); + + do { + /* If write fails retry for max retry count else + * return with number of blocks written successfully. + */ + retry = 2; + srb->pdata = (unsigned char *)buf_addr; + if (blks > USB_MAX_WRITE_BLK) + smallblks = USB_MAX_WRITE_BLK; + else + smallblks = (unsigned short) blks; +retry_it: + if (smallblks == USB_MAX_WRITE_BLK) + usb_show_progress(); + srb->datalen = usb_dev_desc[device].blksz * smallblks; + srb->pdata = (unsigned char *)buf_addr; + if (usb_write_10(srb, (struct us_data *)dev->privptr, start, + smallblks)) { + USB_STOR_PRINTF("Write ERROR\n"); + usb_request_sense(srb, (struct us_data *)dev->privptr); + if (retry--) + goto retry_it; + blkcnt -= blks; + break; + } + start += smallblks; + blks -= smallblks; + buf_addr += srb->datalen; + } while (blks != 0); + + USB_STOR_PRINTF("usb_write: end startblk %lx, blccnt %x buffer %lx\n", + start, smallblks, buf_addr); + + usb_disable_asynch(0); /* asynch transfer allowed */ + if (blkcnt >= USB_MAX_WRITE_BLK) + printf("\n"); + return blkcnt; + +} /* Probe to see if a new device is actually a Storage device */ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, -- cgit v1.2.3 From 87d93a1ba2ae23550e1370adb7a3b00af0831165 Mon Sep 17 00:00:00 2001 From: Wolfgang Wegner Date: Wed, 9 Dec 2009 15:16:47 +0100 Subject: move prototypes for gunzip() and zunzip() to common.h Prototype for gunzip/zunzip was only in lib_generic/gunzip.c and thus repeated in every file using it. This patch moves the prototypes to common.h and removes all prototypes distributed anywhere else. Signed-off-by: Wolfgang Wegner --- board/bf527-ezkit/video.c | 2 -- board/bf533-stamp/video.c | 2 -- board/bf548-ezkit/video.c | 2 -- board/cm-bf548/video.c | 2 -- board/dave/PPChameleonEVB/PPChameleonEVB.c | 3 --- board/esd/apc405/apc405.c | 3 --- board/esd/ash405/ash405.c | 4 ---- board/esd/cpci405/cpci405.c | 1 - board/esd/hh405/hh405.c | 4 ---- board/esd/pci405/pci405.c | 1 - board/esd/plu405/plu405.c | 3 --- board/esd/tasreg/tasreg.c | 1 - board/esd/voh405/voh405.c | 4 ---- board/esd/wuh405/wuh405.c | 4 ---- board/mpl/common/common_util.c | 1 - board/prodrive/pdnb3/pdnb3.c | 1 - common/cmd_bmp.c | 2 -- common/cmd_bootm.c | 1 - common/cmd_license.c | 1 - common/cmd_mem.c | 2 -- drivers/video/cfb_console.c | 2 -- fs/ubifs/ubifs.h | 3 --- include/common.h | 5 +++++ lib_generic/gunzip.c | 3 --- 24 files changed, 5 insertions(+), 52 deletions(-) (limited to 'common') diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c index 0b6b7b2e7..57652be29 100644 --- a/board/bf527-ezkit/video.c +++ b/board/bf527-ezkit/video.c @@ -16,8 +16,6 @@ #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); - #define DMA_SIZE16 2 #include diff --git a/board/bf533-stamp/video.c b/board/bf533-stamp/video.c index 28ffa618f..939bd35a0 100644 --- a/board/bf533-stamp/video.c +++ b/board/bf533-stamp/video.c @@ -20,8 +20,6 @@ #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); - #define DMA_SIZE16 2 #include diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c index f4f1becae..10b08e2bf 100644 --- a/board/bf548-ezkit/video.c +++ b/board/bf548-ezkit/video.c @@ -16,8 +16,6 @@ #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); - #define DMA_SIZE16 2 #include diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c index 078734269..4097f09e1 100644 --- a/board/cm-bf548/video.c +++ b/board/cm-bf548/video.c @@ -16,8 +16,6 @@ #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); - #ifdef CONFIG_VIDEO #define DMA_SIZE16 2 diff --git a/board/dave/PPChameleonEVB/PPChameleonEVB.c b/board/dave/PPChameleonEVB/PPChameleonEVB.c index 06de6e0b1..6bc70ef9a 100644 --- a/board/dave/PPChameleonEVB/PPChameleonEVB.c +++ b/board/dave/PPChameleonEVB/PPChameleonEVB.c @@ -33,9 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; /* ------------------------------------------------------------------------- */ -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - int board_early_init_f (void) { out32(GPIO0_OR, CONFIG_SYS_NAND0_CE); /* set initial outputs */ diff --git a/board/esd/apc405/apc405.c b/board/esd/apc405/apc405.c index 409a0540b..72c0907e0 100644 --- a/board/esd/apc405/apc405.c +++ b/board/esd/apc405/apc405.c @@ -54,9 +54,6 @@ const unsigned char fpgadata[] = */ #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - #ifdef CONFIG_LCD_USED /* logo bitmap data - gzip compressed and generated by bin2c */ unsigned char logo_bmp[] = diff --git a/board/esd/ash405/ash405.c b/board/esd/ash405/ash405.c index 5f0e67cbb..061595931 100644 --- a/board/esd/ash405/ash405.c +++ b/board/esd/ash405/ash405.c @@ -48,10 +48,6 @@ const unsigned char fpgadata[] = #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - - int board_early_init_f (void) { /* diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c index c29c876d6..24db8830c 100644 --- a/board/esd/cpci405/cpci405.c +++ b/board/esd/cpci405/cpci405.c @@ -89,7 +89,6 @@ int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0])); /* Prototypes */ int cpci405_version(void); -int gunzip(void *, int, unsigned char *, unsigned long *); void lxt971_no_sleep(void); int board_early_init_f(void) diff --git a/board/esd/hh405/hh405.c b/board/esd/hh405/hh405.c index 132531b39..4251d51b2 100644 --- a/board/esd/hh405/hh405.c +++ b/board/esd/hh405/hh405.c @@ -251,10 +251,6 @@ const unsigned char fpgadata[] = #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - - /* logo bitmap data - gzip compressed and generated by bin2c */ unsigned char logo_bmp_320[] = { diff --git a/board/esd/pci405/pci405.c b/board/esd/pci405/pci405.c index 34a163240..536485727 100644 --- a/board/esd/pci405/pci405.c +++ b/board/esd/pci405/pci405.c @@ -34,7 +34,6 @@ DECLARE_GLOBAL_DATA_PTR; /* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); unsigned long fpga_done_state(void); unsigned long fpga_init_state(void); diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c index fcffdf67c..e385a78a2 100644 --- a/board/esd/plu405/plu405.c +++ b/board/esd/plu405/plu405.c @@ -46,9 +46,6 @@ const unsigned char fpgadata[] = */ #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - int board_early_init_f(void) { /* diff --git a/board/esd/tasreg/tasreg.c b/board/esd/tasreg/tasreg.c index 18444427f..bd9fb2fc2 100644 --- a/board/esd/tasreg/tasreg.c +++ b/board/esd/tasreg/tasreg.c @@ -29,7 +29,6 @@ /* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len); int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len); diff --git a/board/esd/voh405/voh405.c b/board/esd/voh405/voh405.c index 3f81665eb..a5600de6f 100644 --- a/board/esd/voh405/voh405.c +++ b/board/esd/voh405/voh405.c @@ -48,10 +48,6 @@ const unsigned char fpgadata[] = #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - - /* logo bitmap data - gzip compressed and generated by bin2c */ unsigned char logo_bmp_320[] = { diff --git a/board/esd/wuh405/wuh405.c b/board/esd/wuh405/wuh405.c index f2591d57f..01966eec2 100644 --- a/board/esd/wuh405/wuh405.c +++ b/board/esd/wuh405/wuh405.c @@ -46,10 +46,6 @@ const unsigned char fpgadata[] = #include "../common/fpga.c" -/* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); - - int board_early_init_f (void) { /* diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c index 61af4aea1..32bf24493 100644 --- a/board/mpl/common/common_util.c +++ b/board/mpl/common/common_util.c @@ -48,7 +48,6 @@ DECLARE_GLOBAL_DATA_PTR; #define FIRM_START 0xFFF00000 #endif -extern int gunzip(void *, int, uchar *, unsigned long *); extern int mem_test(ulong start, ulong ramsize, int quiet); #define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */ diff --git a/board/prodrive/pdnb3/pdnb3.c b/board/prodrive/pdnb3/pdnb3.c index c323456d6..69f8f9bbc 100644 --- a/board/prodrive/pdnb3/pdnb3.c +++ b/board/prodrive/pdnb3/pdnb3.c @@ -29,7 +29,6 @@ DECLARE_GLOBAL_DATA_PTR; /* Prototypes */ -int gunzip(void *, int, unsigned char *, unsigned long *); int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* predefine these here for FPGA programming (before including fpga.c) */ diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index faa10a414..74ab24ca9 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -35,8 +35,6 @@ static int bmp_info (ulong addr); static int bmp_display (ulong addr, int x, int y); -int gunzip(void *, int, unsigned char *, unsigned long *); - /* * Allocate and decompress a BMP image using gunzip(). * diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index efd6aec0c..94ddac37c 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -63,7 +63,6 @@ DECLARE_GLOBAL_DATA_PTR; -extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp); #ifndef CONFIG_SYS_BOOTM_LEN #define CONFIG_SYS_BOOTM_LEN 0x800000 /* use 8MByte as default max gunzip size */ #endif diff --git a/common/cmd_license.c b/common/cmd_license.c index c6f272ad3..85a4871de 100644 --- a/common/cmd_license.c +++ b/common/cmd_license.c @@ -29,7 +29,6 @@ #include #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { diff --git a/common/cmd_mem.c b/common/cmd_mem.c index a34b342f0..183933076 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1225,8 +1225,6 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif #ifdef CONFIG_CMD_UNZIP -int gunzip (void *, int, unsigned char *, unsigned long *); - int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { unsigned long src, dst; diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 16d6689f2..c07a26e3c 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -403,8 +403,6 @@ static const int video_font_draw_table32[16][4] = { { 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff } }; -int gunzip(void *, int, unsigned char *, unsigned long *); - /******************************************************************************/ static void video_drawchars (int xx, int yy, unsigned char *s, int count) diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 06772af36..0af471afb 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -2140,7 +2140,4 @@ int ubifs_decompress(const void *buf, int len, void *out, int *out_len, /* todo: Move these to a common U-Boot header */ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len); - -int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, - int stoponerr, int offset); #endif /* !__UBIFS_H__ */ diff --git a/include/common.h b/include/common.h index 00b543408..07897f682 100644 --- a/include/common.h +++ b/include/common.h @@ -612,6 +612,11 @@ ulong usec2ticks (unsigned long usec); ulong ticks2usec (unsigned long ticks); int init_timebase (void); +/* lib_generic/gunzip.c */ +int gunzip(void *, int, unsigned char *, unsigned long *); +int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, + int stoponerr, int offset); + /* lib_generic/time.c */ void udelay (unsigned long); diff --git a/lib_generic/gunzip.c b/lib_generic/gunzip.c index d59a4482b..d2b7ad477 100644 --- a/lib_generic/gunzip.c +++ b/lib_generic/gunzip.c @@ -36,11 +36,8 @@ #define RESERVED 0xe0 #define DEFLATED 8 -int gunzip(void *, int, unsigned char *, unsigned long *); void *zalloc(void *, unsigned, unsigned); void zfree(void *, void *, unsigned); -int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, - int stoponerr, int offset); void *zalloc(void *x, unsigned items, unsigned size) { -- cgit v1.2.3