summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeLines
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-04-267/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Redundant environment: move flag definitions to header fileWolfgang Denk2010-07-04-8/+0
| | | | | | | Instead of defining the flags sevaral times in different source files (which is error prone), move them to a central place in a header file. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Make *printf() return "int" instead of "void"Wolfgang Denk2010-07-04-4/+8
| | | | | | | | | | Change the return type of the *printf() functions to the standard "int"; no changes are needed but returning the already available length count. This will save a few additional strlen() calls later... Signed-off-by: Wolfgang Denk <wd@denx.de>
* exports.c: fix warning: 'dummy' defined but not usedWolfgang Denk2010-07-04-1/+1
| | | | | | | Also get rid of the #ifdef's while doing this. Suggested-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Wolfgang Denk <wd@denx.de>
* cmd_ide.c: fix unused variable warning for SC3 boardWolfgang Denk2010-07-04-1/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* shannon/INFERNO: fix special handling of environment configurationWolfgang Denk2010-07-04-16/+0
| | | | | | | | | | | Remove some INFERNO related #ifdef's from common environment code by fixing the board configuration settings (add CONFIG_ENV_SECT_SIZE). While we are at it, fix comment which incorrectly talks about 4 KB environment size, while it's actually 0x4000 = 16 KiB. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Rolf Offermanns <rof@sysgo.de>
* add redundant environment for env_sf.cWolfgang Wegner2010-06-30-0/+232
| | | | | | | | | | | | | | | | | | | | This patch adds redundant environment for environment in SPI flash. I took env_flash.c as an example and slightly modified it. Apart from adapting things to SF, I also slightly changed the decision logic to use area 2 as a default in case the flags are wrong because not having a default path worried me. I did not add a section for CONFIG_ENV_IS_IN_SPI_FLASH in environment.h because I did not understand if this is desired and/or needed. So to use the feature, one has to set CONFIG_ENV_OFFSET_REDUND _and_ CONFIG_SYS_REDUNDAND_ENVIRONMENT. I checked it by powering off my board several times during flash erase or write, because I do not know if there are other stress test scenarios. Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Merge branch 'master' into nextWolfgang Denk2010-06-30-1/+1
|\
| * Fix console_buffer size conflict error.Remy Bohmer2010-06-29-1/+1
| | | | | | | | | | | | | | | | The console_buffer size is declared in common/main.c as -- char console_buffer[CONFIG_SYS_CBSIZE + 1]; so this extern definition is wrong. Signed-off-by: Remy Bohmer <linux@bohmer.net>
* | Fix #if chain and added AVR32 case in cmd_bdinfo.cReinhard Meyer2010-06-29-9/+35
| | | | | | | | | | | | | | | | | | | | | | AVR32 case was missing in cmd_bdinfo, resulting in compiler warning (bd->bi_baudrate declared unsigned int at AVR32, but printf used %d) At the same time slightly reordered #if #elif #endif to make ARM one of the cases and not an extra case surrounding all others Signed-off-by: Reinhard Meyer <info@emk-elektronik.de> Tested-by: Andreas Bießmann <biessmann@corscience.de>
* | hwconfig: Add some unit testsAnton Vorontsov2010-06-29-0/+55
| | | | | | | | | | | | | | I use this for testing, and I think this might be useful in the future. Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
* | hwconfig: Fix stop characters parsing for subkeysAnton Vorontsov2010-06-29-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the following hwconfig string: key1:subkey1=value1,subkey2=value2;key2:value3 The subkey2 cannot be extracted correctly. The parsing code looks for comma as a stopch, but there may be two kind of stop characters: a comma and a semicolon. Currently the code would return "value2;key2:value3", while just "value2" is the correct answer. This patch fixes the issue by making the code aware of multiple stop characters. For old U-Boots, the issue can be workarounded by placing a comma before a semicolon, i.e.: hwconfig=key1:subkey1=value1,subkey2=value2,;key2:value3 Reported-by: York Sun <yorksun@freescale.com> Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
* | Remove AmigaOneG3SE boardWolfgang Denk2010-06-23-253/+7
|/ | | | | | | | | | The AmigaOneG3SE board has been orphaned or a very long time, and broken for more than 12 releases resp. more than 3 years. As nobody seems to be interested any more in this stuff we may as well ged rid of it, especially as it clutters many areas of the code so it is a continuous pain for all kinds of ongoing work. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Prepare v2010.06-rc3v2010.06-rc3Wolfgang Denk2010-06-23-1/+1
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* fdt_support: add entry for sec3.1 and fix sec3.3Kim Phillips2010-05-30-1/+2
| | | | | | | | | | | | | | Add sec3.1 h/w geometry for fdt node fixups. Also, technically, whilst SEC v3.3 h/w honours the tls_ssl_stream descriptor type, it lacks the ARC4 algorithm execution unit required to be able to execute anything meaningful with it. Change the node to agree with the documentation that declares that the sec3.3 really doesn't have such a descriptor type. Reported-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* nios: remove nios-32 archThomas Chou2010-05-28-22/+0
| | | | | | The nios-32 arch is obsolete and broken. So it is removed. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* Fix "par[t]ition" typo.Wolfgang Denk2010-05-21-4/+4
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Enabled support for Rev 1.3 SPD for DDR2 DIMMsYork Sun2010-05-12-1/+5
| | | | | | | | | | | | | | SPD has minor change from Rev 1.2 to 1.3. This patch enables Rev 1.3. The difference has ben examined and the code is compatible. Speed bins is not verified on hardware for CL7 at this moment. This patch also enables SPD Rev 1.x where x is up to "F". According to SPD spec, the lower nibble is optionally used to determine which additinal bytes or attribute bits have been defined. Software can safely use defaults. However, the upper nibble should always be checked. Signed-off-by: York Sun <yorksun@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* cmd_usb.c: show cmd usage if no args givenSerge Ziryukin2010-05-06-0/+5
| | | | Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
* Move test for unnecessary memmove to memmove_wd()Larry Johnson2010-05-06-5/+5
| | | | Signed-off-by: Larry Johnson <lrj@acm.org>
* command.c: Enable auto tab for the editenv commandTrübenbach, Ralf2010-05-06-0/+3
| | | | | | | Enable the auto completion (with TAB) of the environment variable name after the editenv command. Signed-off-by: Ralf Trübenbach <ralf.truebenbach@men.de>
* x86: Use CONFIG_SERIAL_MULTIGraeme Russ2010-05-06-1/+2
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* cmd_onenand.c: moved to standard subcommand handlingFrans Meulenbroeks2010-05-05-115/+192
| | | | | | | | | | | | | | | | | | | | | On the fly also fixed the following things: - write help talked about a parameter oob, but that one was not used, so removed it from the help message. - the test command also allowed a force subcommand but didn't use it. eliminated the code. - do_onenand made static - do_onenand contained int blocksize; ... mtd = &onenand_mtd; this = mtd->priv; blocksize = (1 << this->erase_shift); As blocksize was not used the last two statements were unneeded so removed them. The first statement (mtd = ....) assigns to a global. Not sure if it is needed, and since I could not test this, left the line for now Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* Merge branch 'master' of git://git.denx.de/u-boot-armWolfgang Denk2010-05-04-8/+8
|\
| * SAMSUNG: serial: modify name from s5pc1xx to s5pMinkyu Kang2010-04-30-8/+8
| | | | | | | | | | | | | | Because of other s5p series SoC will use these serial functions, modify function's name and structure's name. Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* | mtdparts: get rid of custom DEBUG macro, use debug()Wolfgang Denk2010-04-28-50/+40
| | | | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* | mtdparts: fix write through NULL pointerWolfgang Denk2010-04-28-7/+12
|/ | | | | | | | | | | The "mtdparts add" command wrote through a NULL pointer - on many systems this went unnoticed (PowerPC has writable RAM there, some ARM systems have ROM where a write has no effect), but on arm1136 (i.MX31) it crashed the system. Add appropriate checks. Signed-off-by: Wolfgang Denk <wd@denx.de>
* mpc512x: add multi serial PSC supportAnatolij Gustschin2010-04-24-0/+23
| | | | | | | | | | | | | | | | | | Extend mpc512x serial driver to support multiple PSC ports. Subsequent patches for PDM360NG board support make use of this functionality by defining CONFIG_SERIAL_MULTI in the board config file. Additionally the used PSC devices are specified by defining e.g. CONFIG_SYS_PSC1, CONFIG_SYS_PSC4 and CONFIG_SYS_PSC6. Support for PSC devices other than 1, 3, 4 and 6 is not added by this patch because these aren't used currently. In the future it can be easily added using DECLARE_PSC_SERIAL_FUNCTIONS(N) and INIT_PSC_SERIAL_STRUCTURE(N) macros in cpu/mpc512x/serial.c. Additionally you have to add code for registering added devices in serial_initialize() in common/serial.c. Signed-off-by: Anatolij Gustschin <agust@denx.de>
* Move arch/ppc to arch/powerpcStefan Roese2010-04-21-1/+1
| | | | | | | | | | | | | | | | | As discussed on the list, move "arch/ppc" to "arch/powerpc" to better match the Linux directory structure. Please note that this patch also changes the "ppc" target in MAKEALL to "powerpc" to match this new infrastructure. But "ppc" is kept as an alias for now, to not break compatibility with scripts using this name. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de> Acked-by: Kim Phillips <kim.phillips@freescale.com> Cc: Peter Tyser <ptyser@xes-inc.com> Cc: Anatolij Gustschin <agust@denx.de>
* FIX: watchdog timeout, while waiting for inputJens Scharsig2010-04-10-0/+3
| | | | | | | | * add WATCHDOG_RESET to !tstc() loops * prevents watchdog timeout, while waiting for input, if CONFIG_BOOT_RETRY_TIME or CONFIG_SHOW_ACTIVITY defined Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
* malloc: sbrk() should return MORECORE_FAILURE instead of NULL on failurekarl.beldan@gmail.com2010-04-10-1/+1
| | | | Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
* cmd_bmp.c: add standard subcommand handlingFrans Meulenbroeks2010-04-09-25/+56
| | | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Acked-by: Detlev Zundel <dzu@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-ubiWolfgang Denk2010-04-09-1/+1
|\
| * cmd_ubi: Fix uninitialized variable warningPeter Tyser2010-04-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | gcc 3.4.6 previously reported the following error on many MIPS boards which utilize UBI: cmd_ubi.c:193: warning: 'vol' might be used uninitialized in this function The current code is structured such that 'vol' will never be used when it is NULL anyway, but gcc isn't smart enough to figure this out. Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Stefan Roese <sr@denx.de>
* | USB storage probeKim B. Heino2010-04-08-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | While debugging one ill behaving USB device I found two bugs in USB storage probe. usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part of this patch fixes error case. Second part fixes usb_inquiry()'s retry counter handling. Original code had retry = -1 on error case, not retry = 0 as checked in the next line. Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
* | USB storage countKim B. Heino2010-04-08-6/+9
|/ | | | | | | | | | | | | | | | Here's another USB storage patch. Currently U-Boot handles storage devices #0 - #4 as valid devices, even if there is none connected. This patch fixes usb_stor_get_dev() to check detected device count instead of MAX-define. This is very important for ill behaving devices. usb_dev_desc[] can be partially initialized if device probe fails. After fixing get_dev() it was easy to fix "usb part" etc commands. Previously it outputed "Unknown partition table" five times, now it's "no USB devices available". Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
* fdt: Add fdt_del_node_and_alias helperKumar Gala2010-04-07-0/+13
| | | | | | | | Add a helper function that given an alias will delete both the node the alias points to and the alias itself Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* Merge branch 'next'Wolfgang Denk2010-04-01-124/+420
|\
| * i2c: made unused function i2c_mux_add_device staticFrans Meulenbroeks2010-03-29-1/+1
| | | | | | | | | | | | and removed it from the .h file Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
| * cmd_i2c: introduced get_alen helper functionFrans Meulenbroeks2010-03-29-72/+47
| | | | | | | | | | | | | | The code to parse alen appeared 6 times in the function. Factored this out in a small helper function Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
| * cmd_i2c: moved a define to before the functionsFrans Meulenbroeks2010-03-29-2/+2
| | | | | | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
| * cmd_i2c: moved mispositioned comment for i2c mdFrans Meulenbroeks2010-03-29-4/+4
| | | | | | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
| * cmd_i2c.c: declared local functions as staticFrans Meulenbroeks2010-03-29-14/+14
| | | | | | | | | | | | Declared all functions that were not called outside the file as static Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
| * Merge remote branch 'origin/master' into nextWolfgang Denk2010-03-29-6/+22
| |\
| * \ Merge branch 'next' of git://git.denx.de/u-boot-coldfire into nextWolfgang Denk2010-03-28-2/+2
| |\ \
| | * | fix cmd_bdinfo.c:354: warning: 'print_eth' defined but not usedPhilippe De Muyter2010-03-24-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following warnings when running MAKEALL for coldfire : cmd_bdinfo.c:354: warning: 'print_eth' defined but not used Signed-off-by: Philippe De Muyter <phdm at macqel.be>
| * | | cmd_nand: show nand scrub confirmation characterFlorian Fainelli2010-03-23-2/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | When issuing a nand scrub command, the entered character is not displayed this may be confusing. This patch makes the input character being displayed if it is a 'y' so that an user knows he is about to scrub his nand. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
| * | Merge remote branch 'origin/master' into nextWolfgang Denk2010-03-21-4/+8
| |\ \
| * | | fdt_support: add partitions fixup in mtd nodeAnatolij Gustschin2010-03-21-1/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow overwriting defined partitions in the device tree blob using partition info defined in the 'mtdparts' environment variable. Signed-off-by: Anatolij Gustschin <agust@denx.de> Cc: Gerald Van Baren <vanbaren@cideas.com>
| * | | cmd history: Match history buffer size to console bufferJohn Schmoller2010-03-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Match history buffer size to console buffer size. History buffer size was hard coded to 256, artificially limiting the command buffer size. The history buffer now tracks CONFIG_SYS_CBSIZE. Signed-off-by: John Schmoller <jschmoller@xes-inc.com>