summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeLines
* cmd editing: mark erase/tab seqs constantMike Frysinger2011-01-09-2/+2
| | | | | | These strings are only read, so no need to have them be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cmd_mem: localize state variablesMike Frysinger2011-01-09-3/+3
| | | | | | These "last" variables aren't used outside of this file, so add static. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* load_addr: move to common env codeMike Frysinger2011-01-09-1/+2
| | | | | | | | | Rather than keep the load_addr definition with the bootm code (which just happens to use this), move it to the common env code. This way we can disable bootm support completely while retaining load_addr usage with many other commands. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* config_cmd_defaults.h: new header for common u-boot command defaultsMike Frysinger2011-01-09-1/+1
| | | | | | | | | | | | | We have config_defaults.h which are random configuration settings that everyone gets by default. We also have config_cmd_default.h which is a recommended list of defaults but boards have to opt into. Now we have config_cmd_defaults.h which is a list of defaults that everyone gets and has to actively opt out of. For now, we populate it with the bootm command which previously was unable to be disabled. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* env: re-add support for auto-completionMike Frysinger2011-01-09-27/+16
| | | | | | | Currently, only basic completion is supported (no globs), but this is what we had previously. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cmd_net.c: fix build breakageWolfgang Denk2010-12-23-0/+1
| | | | | | | | | | | | Commit 722b061 "autocomplete: remove runtime handler install" caused some boards (like NETTA2_V2) to break with errors like these: cmd_net.c:296: error: expected expression before ',' token Fix this. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Mike Frysinger <vapier@gentoo.org>
* onenand: add yaffs write commandLei Wen2010-12-17-5/+36
| | | | | | | | | | | Yaffs image require to use the oob to store some info, so when we burn the yaffs image, we need to also write the image's oob part into flash. This patch add addition suffix to onenand write to give the uboot the power to directly burn the yaffs image to onenand. Signed-off-by: Lei Wen <leiwen@marvell.com>
* hashtable: drop all non-reentrant versionsMike Frysinger2010-12-17-22/+24
| | | | | | | | | | | The non-reentrant versions of the hashtable functions operate on a single shared hashtable. So if two different people try using these funcs for two different purposes, they'll cause problems for the other. Avoid this by converting all existing hashtable consumers over to the reentrant versions and then punting the non-reentrant ones. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Merge branch 'master' of ../master into nextWolfgang Denk2010-12-16-16/+79
|\
| * hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfigKumar Gala2010-12-09-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got broken when we removed the boards defining dummy board_hwconfig & cpu_hwconfig values. We fix this by handling the various strings in priority order. If hwconfig_parse returns NULL for a given string we check the next one in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig). Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
| * onenand: fix oob print out issueLei Wen2010-12-07-1/+3
| | | | | | | | | | | | | | | | Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set. Signed-off-by: Lei Wen <leiwen@marvell.com>
| * env_nand: Use nand_read_skip_bad instead of nand_readSteve Sakoman2010-12-06-1/+1
| | | | | | | | | | | | | | | | | | | | | | The nand-read function returns an error code if correctable errors have occurred. This is not desirable, since the errors have been corrected! This patch switches to the nand_read_skip_bad function which does not return an error code if the errors are correctable. Signed-off-by: Steve Sakoman <steve.sakoman@linaro.org> Acked-by: Scott Wood <scottwood@freescale.com>
| * UBI/UBIFS: Automatically unmount UBIFS volume upon UBI partition changeStefan Roese2010-12-03-6/+35
| | | | | | | | | | | | | | Automatically unmount UBIFS partition when user changes the UBI device. Otherwise the following UBIFS commands will crash. Signed-off-by: Stefan Roese <sr@denx.de>
| * UBIFS: Change "ubifs mount" to "ubifsmount" in ubifsls outputStefan Roese2010-12-03-1/+1
| | | | | | | | Signed-off-by: Stefan Roese <sr@denx.de>
| * UBIFS: Add ubifsumount command to unmount an active volumeStefan Roese2010-12-03-0/+31
| | | | | | | | | | | | | | This new ubifsumount command allows the user to unmount a previously mounted UBIFS volume. Signed-off-by: Stefan Roese <sr@denx.de>
| * hwconfig: Fix dummy initialization of {board, cpu}_hwconfigKumar Gala2010-11-30-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since board_hwconfig & cpu_hwconfig are defined as weak and dont have a default value they will get put into the BSS if they aren't defined elsewhere. This is problematic as we try to utilize hwconfig before we've relocated and thus BSS isn't setup. Instead of giving dummy values in the board files that utilize this feature, we can just initialize the variables to an empty string and thus move them out of the BSS if they aren't defined elsewhere. Also made board_hwconfig & cpu_hwconfig arrays to reduce size associated with string pointers vs arrays. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* | stdio: constify "name" arg in public apiMike Frysinger2010-11-28-4/+4
| | | | | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | boot cmds: convert to getenv_yesno() with autostartMike Frysinger2010-11-28-9/+8
| | | | | | | | | | | | | | Use the new helper func to clean up duplicate logic handling of the autostart env var. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | image: constify lookup tablesMike Frysinger2010-11-28-7/+7
| | | | | | | | | | | | These are pure lookup tables -- no need to be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | cmd_itest: constify & localize op tableMike Frysinger2010-11-28-5/+3
| | | | | | | | | | | | | | No one else needs this table. While we're here, use the standard ARRAY_SIZE helper macro. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | cmd_date: constifyMike Frysinger2010-11-28-4/+4
| | | | | | | | | | | | Many strings in this file need not be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | autocomplete: remove runtime handler installMike Frysinger2010-11-28-36/+12
| | | | | | | | | | | | | | | | | | | | | | Rather than add runtime overhead of installing completion handlers, do it statically at build time. This requires a new build time helper macro to declare a command and the completion handler at the same time. Then we convert the env related funcs over to this. This gives an opportunity to also unify the U_BOOT_CMD macros. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | do_reset: unify duplicate prototypesMike Frysinger2010-11-28-10/+1
| | | | | | | | | | | | | | The duplication of the do_reset prototype has gotten out of hand, and they're not all in sync. Unify them all in command.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | do_bootd: unify duplicate prototypesMike Frysinger2010-11-28-6/+0
| | | | | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | do_bootm: unify duplicate prototypesMike Frysinger2010-11-28-8/+0
| | | | | | | | | | | | | | | | The duplication of the do_bootm prototype has gotten out of hand, and they're pretty much all outdated (wrt constness). Unify them all in command.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | cmd_mii: localize & constify local funcs/dataMike Frysinger2010-11-28-38/+30
|/ | | | | | | | No need for these structures to be writable or global. While we're here, also drop local versions of the ARRAY_SIZE macro. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Fix compiler warning in fdt_support.cDirk Behme2010-11-28-2/+2
| | | | | | | | | | | | Fix compiler warning fdt_support.c: In function 'of_bus_default_count_cells': fdt_support.c:957: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type fdt_support.c:965: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type be32_to_cpup() expects an 'u32 *' while prop is 'const u32 *'. Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
* common/cmd_nvedit: Use return value of cmd_usageThomas Weber2010-11-27-12/+6
| | | | | | | | Use the return value of cmd_usage instead of ignoring this and returning a 1. Signed-off-by: Thomas Weber <weber@corscience.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Common/command: Guard strchr/strlen from NULL pointerThomas Weber2010-11-27-0/+2
| | | | | | | | | | Guard strchr/strlen from being called with NULL pointer. This line is crashing when command "env" is called without subcommand. The cmd is NULL in this case because the calling function "do_env" decremented the argc without checking if there are still arguments available. Signed-off-by: Thomas Weber <weber@corscience.de>
* Common/cmd_nvedit: Check for env subcommandThomas Weber2010-11-27-0/+3
| | | | | | | The env command needs one subcommand. If this is not available print the usage help. Signed-off-by: Thomas Weber <weber@corscience.de>
* common/Makefile: don't include env_embedded.o into libcommonWolfgang Denk2010-11-26-7/+7
| | | | | | | | | | Some boards use an embedded environment, where env_embedded.o has to be linked at a special position in the U-Boot image; to make this possible, we do not include it into libcommon.o for such boards. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Stefan Roese <sr@denx.de>
* malloc: Fix issue with calloc memory possibly being non-zeroKumar Gala2010-11-17-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we set #define MORECORE_CLEARS 1, the code assumes 'sbrk' always returns zero'd out memory. However since its possible that free() returns memory back to sbrk() via malloc_trim we could possible get non-zero'd memory from sbrk(). This is a problem for when code might call calloc() and expect the memory to have been zero'd out. There are two possible solutions to this problem. 1. change #define MORECORE_CLEARS 0 2. memset to zero memory returned to sbrk. We go with the second since the sbrk being called to free up memory should be pretty rare. The following code problems an example test to show the issue. This test code was inserted right after the call to mem_malloc_init(). ... u8 *p2; int i; printf("MALLOC TEST\n"); p1 = malloc(135176); printf("P1 = %p\n", p1); memset(p1, 0xab, 135176); free(p1); p2 = calloc(4097, 1); printf("P2 = %p %p\n", p2, p2 + 4097); for (i = 0; i < 4097; i++) { if (p2[i] != 0) printf("miscompare at byte %d got %x\n", i, p2[i]); free(p2); printf("END MALLOC TEST\n\n"); ... Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Tested-by: Wolfgang Denk <wd@denx.de>
* Switch from archive libraries to partial linkingSebastien Carlier2010-11-17-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
* pci: Clean up PCI info when CONFIG_PCI_SCAN_SHOWPeter Tyser2010-11-14-64/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change does the following: - Removes the printing of the PCI interrupt line value. This is normally set to 0 by U-Boot on bootup and is rarely used during everyday operation. - Prints out the PCI function number of a device. Previously a device with multiple functions would be printed identically 2 times, which is generally confusing. For example, on an Intel 2 port gigabit Ethernet card the following was displayed: ... 04 01 8086 1010 0200 00 04 01 8086 1010 0200 00 ... - Prints a text description of each device's PCI class instead of the raw PCI class code. The textual description makes it much easier to determine what devices are installed on a PCI bus. - Changes the general formatting of the PCI device output. Previous output: PCIE1: connected as Root Complex 04 01 8086 1010 0200 00 04 01 8086 1010 0200 00 03 00 10b5 8112 0604 00 02 01 10b5 8518 0604 00 02 02 10b5 8518 0604 00 08 00 1957 0040 0b20 00 07 00 10b5 8518 0604 00 09 00 10b5 8112 0604 00 07 01 10b5 8518 0604 00 07 02 10b5 8518 0604 00 06 00 10b5 8518 0604 00 02 03 10b5 8518 0604 00 01 00 10b5 8518 0604 00 PCIE1: Bus 00 - 0b PCIE2: connected as Root Complex 0d 00 1957 0040 0b20 00 PCIE2: Bus 0c - 0d Updated output: PCIE1: connected as Root Complex 04:01.0 - 8086:1010 - Network controller 04:01.1 - 8086:1010 - Network controller 03:00.0 - 10b5:8112 - Bridge device 02:01.0 - 10b5:8518 - Bridge device 02:02.0 - 10b5:8518 - Bridge device 08:00.0 - 1957:0040 - Processor 07:00.0 - 10b5:8518 - Bridge device 09:00.0 - 10b5:8112 - Bridge device 07:01.0 - 10b5:8518 - Bridge device 07:02.0 - 10b5:8518 - Bridge device 06:00.0 - 10b5:8518 - Bridge device 02:03.0 - 10b5:8518 - Bridge device 01:00.0 - 10b5:8518 - Bridge device PCIE1: Bus 00 - 0b PCIE2: connected as Root Complex 0d:00.0 - 1957:0040 - Processor PCIE2: Bus 0c - 0d Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* env_mmc: fix compile warningLei Wen2010-11-14-0/+1
| | | | | | | | | | hexport would complain implicit declaration, if we don't add the include file. env_mmc.c: In function 'saveenv': env_mmc.c:109: warning: implicit declaration of function 'hexport' Signed-off-by: Lei Wen <leiwen@marvell.com>
* env_sf: remove warning introduced with last patchStefano Babic2010-10-29-2/+1
| | | | Signed-off-by: Stefano Babic <sbabic@denx.de>
* Drop support for CONFIG_SYS_ARM_WITHOUT_RELOCWolfgang Denk2010-10-29-2/+0
| | | | | | | | | | | | | | | | When this define was introduced, the idea was to provide a soft migration path for ARM boards to get adapted to the new relocation support. However, other recent changes led to a different implementation (ELF relocation), where this no longer works. By now CONFIG_SYS_ARM_WITHOUT_RELOC does not only not help any more, but it actually hurts because it obfuscates the actual code by sprinkling it with lots of dead and non-working debris. So let's make a clean cut and drop CONFIG_SYS_ARM_WITHOUT_RELOC. Signed-off-by: Wolfgang Denk <wd@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk2010-10-29-20/+20
| | | | | | | | | | | By now, the majority of architectures have working relocation support, so the few remaining architectures have become exceptions. To make this more obvious, we make working relocation now the default case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC. Signed-off-by: Wolfgang Denk <wd@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* cmd_onenand.c: Fix command usage help.Enric Balletbo i Serra2010-10-27-0/+3
| | | | | | | Running the onenand command without arguments does nothing, with this patch shows the command usage. Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
* env_sf: updated to the new environment codeStefano Babic2010-10-27-95/+77
| | | | | | | | | | | | Functions to store/retrieve the environment from a SPI flash was not updated to the new environment code. The non-redundant case was not working correctly, reporting ""Environment SPI flash not initialized" and the code was not compiled clean in the redundant case. The patch fixes these issue and makes the code more coherent with other environment storage (nand, flash). Signed-off-by: Stefano Babic <sbabic@denx.de>
* Revert "cmd_net: drop spurious comma in U_BOOT_CMD"Wolfgang Denk2010-10-27-1/+1
| | | | | | | | | | This commit causes build errors like this: cmd_net.c:301:1: error: macro "U_BOOT_CMD" requires 6 arguments, but only 5 given cmd_net.c:298: warning: data definition has no type or storage class cmd_net.c:298: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD' This reverts commit 8f4cb77ef7183ce1bb3f767604a0677c6f6d84a7.
* cmd_net: drop spurious comma in U_BOOT_CMDMike Frysinger2010-10-26-1/+1
| | | | | | | Building for boards that have CONFIG_CMD_CDP enabled fail with: cmd_net.c:301: error: expected expression before ',' token Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated valueWolfgang Denk2010-10-26-1/+1
| | | | | | | | | | | | | | | | | | CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not being able to use "sizeof(struct global_data)" in assembler files. Recent experience has shown that manual synchronization is not reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into GENERATED_GBL_DATA_SIZE which gets automatically generated by the asm-offsets tool. In the result, all definitions of this value can be deleted from the board config files. We have to make sure that all files that reference such data include the new <asm-offsets.h> file. No other changes have been done yet, but it is obvious that similar changes / simplifications can be done for other, related macro definitions as well. Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Kumar Gala <galak@kernel.crashing.org>
* ARM: fix relocation support for onenand device.Enric Balletbo i Serra2010-10-23-0/+6
| | | | | | | We also have to relocate the onenand command table manually, otherwise onenand command don't work. Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
* hwconfig: Utilize getenv_f before relocation to allow for larger bufferKumar Gala2010-10-23-1/+20
| | | | | | | | | | | | | | | | Since we use hwconfig in cases before relocation (like getting DDR params on FSL PPC systems), we can have strings that exceed the early small (32 byte) buffer size that getenv will handle. So we explicitly allocate our own buffer on the stack and use if to handle getting the hwconfig env string. We currently utilize a string length of 128 bytes. This allows us to get rid of boot messages like: env_buf too small [32] Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* env_flash: Disable debug print statementsPeter Tyser2010-10-23-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With debug the follow is printed: => saveenv Saving Environment to Flash... Data to save 0x18000 Data (start 0xfff48000, len 0x18000) saved at 0x7fe63f20 Protect off FFF40000 ... FFF5FFFF Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... Restoring the rest of data to 0xfff48000 len 0x18000 done Protected 1 sectors => Without debug: => saveenv Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... done Protected 1 sectors => Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* Merge branch 'master' of git://git.denx.de/u-boot-mpc85xxWolfgang Denk2010-10-23-0/+13
|\
| * pci: Add ability to re-enumerate PCI busesJohn Schmoller2010-10-22-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new 'pci enum' command which re-enumerates the PCI buses. This command is enabled via the CONFIG_CMD_PCI_ENUM define and can be useful in boards with FPGAs connected via PCI/PCIe, boards that support PCI hot-plugging, or during PCI debug. Also enable the 'pci enum' command for X-ES's Freescale-based boards. Signed-off-by: John Schmoller <jschmoller@xes-inc.com> Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Acked-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Wolfgang Denk <wd@denx.de>
* | usb_storage: constify us_direction lookup tableMike Frysinger2010-10-22-1/+1
|/ | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* always relocate fdt into an lmb-allocated memory blockTimur Tabi2010-10-20-55/+28
| | | | | | | | | | | | | | | | | | | | | The device tree (fdt) must always exist in within the bootmap (usually the first 16MB of RAM). If it doesn't, then boot_relocate_fdt() will allocate an LMB region in the bootmap and copy the fdt into that region. It will also increase the size of the fdt. If the fdt is already in the bootmap, then previously the memory was just reserved. There was no contingency if the reservation failed, however. By always allocating an lmb region and copying/resizing the fdt into that region, the code is simplified and the memory region is always allocated properly. Also change the types of some variables to avoid some typecasts. Signed-off-by: Timur Tabi <timur@freescale.com> Tested-by: Ira Snyder <iws@ovro.caltech.edu> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>