aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2010-11-28stdio: constify "name" arg in public apiMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28boot cmds: convert to getenv_yesno() with autostartMike Frysinger
Use the new helper func to clean up duplicate logic handling of the autostart env var. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28image: constify lookup tablesMike Frysinger
These are pure lookup tables -- no need to be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28cmd_itest: constify & localize op tableMike Frysinger
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>
2010-11-28cmd_date: constifyMike Frysinger
Many strings in this file need not be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28autocomplete: remove runtime handler installMike Frysinger
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>
2010-11-28do_reset: unify duplicate prototypesMike Frysinger
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>
2010-11-28do_bootd: unify duplicate prototypesMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28do_bootm: unify duplicate prototypesMike Frysinger
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>
2010-11-28cmd_mii: localize & constify local funcs/dataMike Frysinger
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>
2010-11-28Fix compiler warning in fdt_support.cDirk Behme
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>
2010-11-27common/cmd_nvedit: Use return value of cmd_usageThomas Weber
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>
2010-11-27Common/command: Guard strchr/strlen from NULL pointerThomas Weber
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>
2010-11-27Common/cmd_nvedit: Check for env subcommandThomas Weber
The env command needs one subcommand. If this is not available print the usage help. Signed-off-by: Thomas Weber <weber@corscience.de>
2010-11-26common/Makefile: don't include env_embedded.o into libcommonWolfgang Denk
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>
2010-11-17malloc: Fix issue with calloc memory possibly being non-zeroKumar Gala
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>
2010-11-17Switch from archive libraries to partial linkingSebastien Carlier
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>
2010-11-14pci: Clean up PCI info when CONFIG_PCI_SCAN_SHOWPeter Tyser
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>
2010-11-14env_mmc: fix compile warningLei Wen
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>
2010-10-29env_sf: remove warning introduced with last patchStefano Babic
Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-29Drop support for CONFIG_SYS_ARM_WITHOUT_RELOCWolfgang Denk
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>
2010-10-29Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk
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>
2010-10-27cmd_onenand.c: Fix command usage help.Enric Balletbo i Serra
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>
2010-10-27env_sf: updated to the new environment codeStefano Babic
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>
2010-10-27Revert "cmd_net: drop spurious comma in U_BOOT_CMD"Wolfgang Denk
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.
2010-10-26cmd_net: drop spurious comma in U_BOOT_CMDMike Frysinger
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>
2010-10-26Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated valueWolfgang Denk
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>
2010-10-23ARM: fix relocation support for onenand device.Enric Balletbo i Serra
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>
2010-10-23hwconfig: Utilize getenv_f before relocation to allow for larger bufferKumar Gala
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>
2010-10-23env_flash: Disable debug print statementsPeter Tyser
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>
2010-10-23Merge branch 'master' of git://git.denx.de/u-boot-mpc85xxWolfgang Denk
2010-10-22usb_storage: constify us_direction lookup tableMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-22pci: Add ability to re-enumerate PCI busesJohn Schmoller
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>
2010-10-20always relocate fdt into an lmb-allocated memory blockTimur Tabi
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>
2010-10-20common/fdt_support.c: Fix compile warningsWolfgang Denk
Commit a6bd9e8 "FDT: Add fixup support for multiple banks of memory" removed code but forgot to remove the variables used by it, resulting in warnings: fdt_support.c: In function 'fdt_fixup_memory_banks': fdt_support.c:399: warning: unused variable 'sizecell' fdt_support.c:399: warning: unused variable 'addrcell' Remove the declarations, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-10-20Merge branch 'master' of git://git.denx.de/u-boot-armWolfgang Denk
2010-10-19cmd_fpga: cleanup help and check parametersStefano Babic
The usage and help for the fpga command is wrong and incomplete, and the parameters are not checked before to be passed to the underlying subfunction. Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-19common: Enable serial for PXA250Marek Vasut
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
2010-10-18boot: change some arch ifdefs to feature ifdefsJohn Rigby
The routines boot_ramdisk_high, boot_get_cmdline and boot_get_kbd are currently enabled by various combinations of CONFIG_M68K, CONFIG_POWERPC and CONFIG_SPARC. Use CONFIG_SYS_BOOT_<FEATURE> defines instead. CONFIG_SYS_BOOT_RAMDISK_HIGH CONFIG_SYS_BOOT_GET_CMDLINE CONFIG_SYS_BOOT_GET_KBD Define these as appropriate in arch/include/asm/config.h files. Signed-off-by: John Rigby <john.rigby@linaro.org> Acked-by: Wolfgang Denk <wd@denx.de>
2010-10-18FDT: only call boot_get_fdt from generic codeJohn Rigby
All arches except nios2 and microblaze call boot_get_fdt from bootm_start in common/cmd_bootm.c. Having nios2 and microblaze do so as well removes code from their respective do_bootm_linux routines and allows removal of a nasty ifdef from bootm_start. In the case where boot_get_fdt returns an error bootm_start returns and the platform specific do_bootm_linux routines will never get called. Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2. Signed-off-by: John Rigby <john.rigby@linaro.org> CC: Scott McNutt <smcnutt@psyent.com> CC: Michal Simek <monstr@monstr.eu> CC: Thomas Chou <thomas@wytron.com.tw> Acked-by: Wolfgang Denk <wd@denx.de> Acked-by: Michal Simek <monstr@monstr.eu> Tested-by: Thomas Chou <thomas@wytron.com.tw>
2010-10-18FDT: Add fixup support for multiple banks of memoryJohn Rigby
Add fdt_fixup_memory_banks and reimplement fdt_fixup_memory using it. Tested on OMAP3 beagle board with two banks of memory. Signed-off-by: John Rigby <john.rigby@linaro.org> CC: Jerry Van Baren <vanbaren@cideas.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-10-18common/image.c remove extra calls to be32_to_cpu in boot_get_fdtJohn Rigby
fdt_totalsize returns size in cpu endian so don't call be32_to_cpu on the result. This was harmless on big endian platforms but not on little endian ARMs. Signed-off-by: John Rigby <john.rigby@linaro.org>
2010-10-18common/image.c fix length calculation in boot_relocate_fdtJohn Rigby
boot_relocate_fdt is called on platforms with CONFIG_SYS_BOOTMAPSZ defined to relocate the device tree blob to be inside the boot map area between bootmap_base and bootmap_base+CONFIG_SYS_BOOTMAPSZ. For the case where the blob needs to be relocated, space is allocated inside the bootmap by calling lmb_alloc_base with size passed in plus some padding: of_len = *of_size + CONFIG_SYS_FDT_PAD; For the case where the blob is already inside the bounds of the boot map area, lmb_reserve is called to reserve the the space where the blob is already residing. The calculation for this case is currently: of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob; This is wrong because it reserves all the space in the boot map area from the blob to the end ignoring completely the actual size. The worst case is where the blob is at the beginning and the entire boot map area get reserved. Fix this by changing the length calculation to this: of_len = *of_size + CONFIG_SYS_FDT_PAD; This bug has likely never manifested itself because bootm has never been called with the fdt blob already in the bootmap area. In my testing on an OMAP3 beagle board I initially worked around the bug by simply moving the initial location of the fdt blob. I have tested with the new calculation with the fdt blob both inside and outside the boot map area. Signed-off-by: John Rigby <john.rigby@linaro.org>
2010-10-18dlmalloc.c: Fix gcc alias warningJoakim Tjernlund
Fix these warnings: dlmalloc.c: In function 'free': dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules Some page(http://blog.worldofcoding.com/2010/02/solving-gcc-44-strict-aliasing-problems.html) suggests adding __attribute__((__may_alias__)). Doing so makes the warnings go away. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-10-18Fix warning in nand unlock commandScott Wood
Commit ea533c260a801c4e51f92f75165cebe6d7b01e35 changed arg_off_size to take a pointer to a device index, rather than to the device itself. When updating callers, the nand unlock code was missed. Signed-off-by: Scott Wood <scottwood@freescale.com>
2010-10-17Merge branch 'master' of git://git.denx.de/u-boot-armWolfgang Denk
2010-10-13env_mmc: fix cannot save env issueLei Wen
The env change its implementation after this log, while env mmc didn't change it immediately, which cause issue. Follow to the new style to fix it. commit ea882baf9c17cd142c99e3ff640d3ab01daa5cec Author: Wolfgang Denk <wd@denx.de> Date: Sun Jun 20 23:33:59 2010 +0200 New implementation for internal handling of environment variables. Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-10-13env_mmc: Fix crashing bug encountered after enabling ARM relocationSteve Sakoman
The crash was occuring in env_relocate because it was being called prior to mmc_initialize. This patch moves the MMC initialization earlier in the init process. This patch also cleans up the env_relocate_spec code in env_mmc.c Signed-off-by: Steve Sakoman <steve.sakoman@linaro.org> Acked-by: Stefano Babic <sbabic@denx.de>
2010-10-13Merge branch 'master' of git://git.denx.de/u-boot-usbWolfgang Denk
2010-10-13common/fdt_support.c: fix compile errorMatthew McClintock
Fix build error introduced in beca5a5f5bf0d88125580e5e9c1730469cd50ab8 common/libcommon.a(fdt_support.o): In function `fdt_add_edid': /local/hudson/jobs/mirrors-u-boot.git/workspace/common/fdt_support.c:1205: undefined reference to `fdt_increase_size' make: *** [u-boot] Error 1 Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Anatolij Gustschin <agust@denx.de>