summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Add option -r to env import to allow import of text files with CRLF as line ↵Alexander Holler2014-07-222-7/+18
| | | | | | | | | | | | | | endings When this option is enabled, CRLF is treated like LF when importing environments from text files, which means CRs ('\r') in front of LFs ('\n') are just ignored. Drawback of enabling this option is that (maybe exported) variables which have a trailing CR in their content will get imported without that CR. But this drawback is very unlikely and the big advantage of letting Windows user create a *working* uEnv.txt too is likely more welcome. Signed-off-by: Alexander Holler <holler@ahsoftware.de>
* common: cmd_ide: use __weak and add prototypesJeroen Hofstee2014-07-221-38/+13
| | | | | | | | | | | clang chokes about the concept of having an alias to an always_inlined function. gcc likely just ignores the always inlined since binary sizes are equal before and after this patch. Convert the aliases to weak functions and provide missing prototypes. cc: Pavel Herrmann <morpheus.ibis@gmail.com> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: cmd_ide: remove PIO modeJeroen Hofstee2014-07-221-84/+0
| | | | | | | | Since no board defines CONFIG_TUNE_PIO this is just dead code, so remove it. cc: Pavel Herrmann <morpheus.ibis@gmail.com> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* spl: nand: read only in the size of image_header on the first accessMasahiro Yamada2014-07-221-3/+3
| | | | | | | | | | | For the same reason as in commit 50c8d66d, all the remaining CONFIG_SYS_NAND_PAGE_SIZE in common/spl/spl_nand.c can be replaced with sizeof(*header). Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Tim Harvey <tharvey@gateworks.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Stefano Babic <sbabic@denx.de>
* Fix help text of ext2load and fatload.Pavel Machek2014-07-222-2/+2
| | | | | | | Fix help text of ext2load and fatload to match code in fs/fs.c Signed-off-by: Pavel Machek <pavel@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
* common: cmd_mii: fix printf format warningJeroen Hofstee2014-07-181-4/+4
| | | | | | | | The and operator implicitly upcasts the value to int, hence the format should expect an int type as well. (and make checkpatch happy) Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* autoboot: add its own headerJeroen Hofstee2014-07-181-0/+1
| | | | Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: env_common: make env_get_char_spec __weakJeroen Hofstee2014-07-181-3/+1
| | | | Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: bootm_os: make arch_preboot_os __weakJeroen Hofstee2014-07-181-2/+1
| | | | Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: main.c: make show_boot_progress __weakJeroen Hofstee2014-07-181-2/+1
| | | | | | | | This not only looks a bit better it also prevents a warning with W=1 (no previous prototype). Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> Acked-by: Simon Glass <sjg@chromium.org>
* common:splash: use __weakJeroen Hofstee2014-07-181-5/+1
| | | | | | | | This not only looks a bit better it also prevents a warning with W=1 (no previous prototype). cc: agust@denx.de Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: board_f: cosmetic use __weak for ledsJeroen Hofstee2014-07-181-19/+10
| | | | | | | | | | First of all this looks a lot better, but it also prevents a gcc warning (W=1), that the weak function has no previous prototype. cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> Acked-by: Simon Glass <sjg@chromium.org>
* common: commands: make commands staticJeroen Hofstee2014-07-1811-28/+36
| | | | | | | Since most commands are not public, make them static. This prevents warnings that no common prototype is available. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* env_fat: use get_device_and_partition() during env save and loadWu, Josh2014-07-071-58/+28
| | | | | | | | | | | | | | | | | | | | | | Use get_device_and_partition() is better since: 1. It will call the device initialize function internally. So we can remove the mmc intialization code to save many lines. 2. It is used by fatls/fatload/fatwrite. So saveenv & load env should use it too. 3. It can parse the "D:P", "D", "D:", "D:auto" string to get correct device and partition information by run-time. Also we remove the FAT_ENV_DEVICE and FAT_ENV_PART. We use a string: FAT_ENV_DEVICE_AND_PART. For at91sam9m10g45ek, it is "0". That means use device 0 and if: a)device 0 has no partition table, use the whole device as a FAT file system. b)device 0 has partittion table, use the partition #1. Refer to the commit: 10a37fd7a4 for details of device & partition string. Signed-off-by: Josh Wu <josh.wu@atmel.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* dfu: free entities when parsing failsStephen Warren2014-06-251-2/+3
| | | | | | | | | | | | | When dfu_init_env_entities() fails part-way through, some entities may have been added to dfu_list. These are only removed by dfu_free_entities(). If that function isn't called, those stale entities will still exist the next time dfu_init_env_entities() is called, leading to confusion. Fix do_dfu() to ensure that dfu_free_entities() is always called, to avoid this confusion. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
* sandbox: restore ability to access host fs through standard commandsStephen Warren2014-06-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree" removed the ability for get_device_and_partition() to handle the "host" device type, and redirect accesses to it to the host filesystem. This broke some unit tests that use this feature. So, revert that change. The code added back by this patch is slightly different to pacify checkpatch. However, we're then left with "host" being both: - A pseudo device that accesses the hosts real filesystem. - An emulated block device, which accesses "sectors" inside a file stored on the host. In order to resolve this discrepancy, rename the pseudo device from host to hostfs, and adjust the unit-tests for this change. The "help sb" output is modified to reflect this rename, and state where the host and hostfs devices should be used. Signed-off-by: Stephen Warren <swarren@nvidia.com> Tested-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* Add an I/O tracing featureSimon Glass2014-06-203-0/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging drivers it is useful to see what I/O accesses were done and in what order. Even if the individual accesses are of little interest it can be useful to verify that the access pattern is consistent each time an operation is performed. In this case a checksum can be used to characterise the operation of a driver. The checksum can be compared across different runs of the operation to verify that the driver is working properly. In particular, when performing major refactoring of the driver, where the access pattern should not change, the checksum provides assurance that the refactoring work has not broken the driver. Add an I/O tracing feature and associated commands to provide this facility. It works by sneaking into the io.h heder for an architecture and redirecting I/O accesses through its tracing mechanism. For now no commands are provided to examine the trace buffer. The format is fairly simple, so 'md' is a reasonable substitute. Note: The checksum feature is only useful for I/O regions where the contents do not change outside of software control. Where this is not suitable you can fall back to manually comparing the addresses. It might be useful to enhance tracing to only checksum the accesses and not the data read/written. Signed-off-by: Simon Glass <sjg@chromium.org>
* cosmetic: autoboot: update old style GNU struct initJeroen Hofstee2014-06-191-4/+4
| | | | Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* cmd_md5sum.c: remove dead code / fix warningJeroen Hofstee2014-06-191-1/+0
| | | | | | | | | | | | commit ecd729500 "Add parameter to md5sum to save the md5 sum" adds support to build a string to be saved in the env and tries to zero end it with str_ptr = '\0'; This does actually set the pointer to the end of the buffer itself to zero. Since the string was already zero terminated by the sprintf before it, just remove the line, preventing a clang warning. cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* includes: move openssl headers to include/u-bootJeroen Hofstee2014-06-195-8/+8
| | | | | | | | | | | | commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason. cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* Enhance fit_check_sign to check all imagesSimon Glass2014-06-192-1/+73
| | | | | | | | | At present this tool only checks the configuration signing. Have it also look at each of the images in the configuration and confirm that they verify. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> (v1)
* bootm: Move decompression code into its own functionSimon Glass2014-06-191-27/+48
| | | | | | | This makes it possible to decompress an image without it being a kernel and without intending to boot it (as it needed for host tools, for example). Signed-off-by: Simon Glass <sjg@chromium.org>
* Allow compiling common/bootm.c on with HOSTCCSimon Glass2014-06-191-4/+14
| | | | | | | We want to use some of the functionality in this file, so make it build on the host. Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix small 'case' typo in image-fit.cSimon Glass2014-06-191-1/+1
| | | | | | This typo makes the comment confusing. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Support android boot on sandboxSimon Glass2014-06-191-1/+1
| | | | | | A small change allows this to operate on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* image: Remove the fit_load_image() property parameterSimon Glass2014-06-194-5/+30
| | | | | | | This can be obtained by looking up the image type, so is redundant. It is better to centralise this lookup to avoid errors. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Split out code from cmd_bootm.cSimon Glass2014-06-194-1338/+1301
| | | | | | | | | | | | | | | | | This file has code in three different categories: - Command processing - OS-specific boot code - Locating images and setting up to boot Only the first category really belongs in a file called cmd_bootm.c. Leave the command processing code where it is. Split out the OS-specific boot code into bootm_os.c. Split out the other code into bootm.c Header files and extern declarations are tidied but otherwise no code changes are made, to make it easier to review. Signed-off-by: Simon Glass <sjg@chromium.org>
* Reverse the meaning of the fit_config_verify() return codeSimon Glass2014-06-193-4/+4
| | | | | | | It is more common to have 0 mean OK, and -ve mean error. Change this function to work the same way to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
* hash: Use uint8_t in preference to u8Simon Glass2014-06-191-6/+6
| | | | | | This type is more readily available on the host compiler, so use it instead. Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt_support: correct the return condition of fdt_initrd()Masahiro Yamada2014-06-191-4/+4
| | | | | | | | | | | | Before this commit, fdt_initrd() just returned if initrd start address is zero. But it is possible if the RAM is located at address 0. This commit makes the return condition more reasonable: Just return if the size of initrd is zero. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: fix an endian bug of fdt_initrd()Masahiro Yamada2014-06-191-21/+20
| | | | | | | | | | | | | | | Data written to DTB must be converted to big endian order. It is usually done by using cpu_to_fdt32(), cpu_to_fdt64(), etc. fdt_initrd() invoked write_cell(), which always swaps byte order. It means the function only worked on little endian architectures. (On big endian architectures, the byte order should be kept as it is) This commit uses cpu_to_fdt32() and cpu_to_fdt64() and deletes write_cell(). Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: fix an endian bug of fdt_fixup_memory_banksMasahiro Yamada2014-06-191-12/+30
| | | | | | | | | | | | | | | Data written to DTB must be converted to big endian order. It is usually done by using cpu_to_fdt32(), cpu_to_fdt64(), etc. fdt_fixup_memory_banks() invoked write_cell(), which always swaps byte order. It means the function only worked on little endian architectures. This commit adds and uses a new helper function, fdt_pack_reg(), which works on both big endian and little endian architrectures. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: add 'const' qualifier for unchanged argumentMasahiro Yamada2014-06-191-2/+2
| | | | | | | | | | | | | In the next commit, I will add a new function, fdt_pack_reg() which uses get_cells_len(). Beforehand, this commit adds 'const' qualifier to get_cells_len(). Otherwise, a warning message will appear: warning: passing argument 1 of 'get_cells_len' discards 'const' qualifier from pointer target type [enabled by default] Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: refactor fdt_fixup_stdout() functionMasahiro Yamada2014-06-191-43/+42
| | | | | | | | | | | | | | | | | | | - Do not use a deep indentation. We have only 80-character on each line and 1 indentation consumes 8 spaces. Before the code moves far to the right, you should consider to fix your code. See Linux Documentation/CodingStyle. - Add CONFIG_OF_STDOUT_VIA_ALIAS and OF_STDOUT_PATH macros only to their definition. Do not add them to both callee and caller. This is a tip to avoid using #ifdef everywhere. - OF_STDOUT_PATH and CONFIG_OF_STDOUT_VIA_ALIAS are exclusive. If both are defined, the former takes precedence. Do not try to fix-up "linux,stdout-path" property twice. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: delete force argument of fdt_chosen()Masahiro Yamada2014-06-193-28/+14
| | | | | | | | | | | | After all, we have realized "force" argument is completely useless. fdt_chosen() was always called with force = 1. We should always want to do the same thing (set appropriate value to the property) even if the property already exists. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: delete force argument of fdt_initrd()Masahiro Yamada2014-06-193-22/+17
| | | | | | | | | | | | After all, we have realized "force" argument is completely useless. fdt_initrd() was always called with force = 1. We should always want to do the same thing (set appropriate value to the property) even if the property already exists. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: refactor with fdt_find_or_add_subnode helper funcMasahiro Yamada2014-06-191-35/+36
| | | | | | | | | | | Some functions in fdt_support.c do the same routine: search a node with a given name ("chosen", "memory", etc.) or newly create it if it does not exist. So this commit makes that routine to a helper function. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt_support: delete unnecessary DECLARE_GLOBAL_DATA_PTRMasahiro Yamada2014-06-191-5/+0
| | | | | | | gd->bd is not used in fdt_support.c. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* ARM: fdt support: Add usbethaddr as an acceptable MACDan Murphy2014-06-191-1/+11
| | | | | | | | | | A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr. ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified. Signed-off-by: Dan Murphy <dmurphy@ti.com>
* cmd_mmc: make mmc dev always re-probe the HWStephen Warren2014-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, U-Boot behaves as follows: - Begin with no SD card inserted in "mmc 1" - Execute: mmc dev 1 - This fails, since there is no card - User plugs in an SD card - Execute: mmc dev 1 - This still fails, since the HW isn't reprobed. With this change, U-Boot behaves as follows: - Begin with no SD card inserted in "mmc 1" - Execute: mmc dev 1 - This fails, since there is no card - User plugs in an SD card - Execute: mmc dev 1 - The newly present SD card is detected I know that "mmc rescan" will force the HW to be reprobed, but I feel it makes more sense if "mmc dev" always reprobes the HW after selecting the current MMC device. This allows scripts to just execute "mmc dev", and not have to also execute "mmc rescan" to check for media presense. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* cmd_mmc: Use init_mmc_device() from do_mmc_rescan()Stephen Warren2014-06-121-8/+2
| | | | | | | | | | The body of init_mmc_device() is now identical to that of do_mmc_rescan() except for the error codes returned. Modify do_mmc_rescan() to simply call init_mmc_device() and convert the error codes, to avoid code duplication. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* cmd_mmc: add force_init parameter to init_mmc_device()Stephen Warren2014-06-121-12/+14
| | | | | | | | | | This allows callers to inject mmc->has_init = 0 between finding the MMC device, and calling mmc_init(), which forces mmc_init() to rescan the HW. Future changes will use this feature. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* cmd_mmc: default to HW partition 0 if not specifiedStephen Warren2014-06-121-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | Currently, "mmc dev 0" does not change the selected HW partition. I think it makes more sense if "mmc dev 0" is an alias for "mmc dev 0 0", i.e. that HW partition 0 (main data area) is always selected by default if the user didn't request a specific partition. Otherwise, the following happens, which feels wrong: Select HW partition 1 (boot0): mmc dev 0 1 Doesn't change the HW partition, so it's still 1 (boot0): mmc dev 0 With this patch, the second command above re-selects the main data area. Note that some MMC devices (i.e. SD cards) don't support HW partitions. However, this patch still works, since mmc_start_init() sets the current partition number to 0, and mmc_select_hwpart() succeeds if the requested partition is already selected. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* common/xyzModem.c: move empty statements to newlineJeroen Hofstee2014-06-111-1/+2
| | | | | | | | | To prevent a warning for clang the loop without a body is made more clear by moving it to a line of its own. This prevents a clang warning. cc: sbabic@denx.de Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common/cli_hush.c: remove unnecessary double bracesJeroen Hofstee2014-06-111-2/+2
| | | | | | | | | | Clang interpretes an if condition like "if ((a = b) == NULL) as it tries to assign a value in a statement. Hence if you do "if ((something)) it warns you that you might be confused. Hence drop the double braces for plane if statements. Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* common: hash: zero end the string instead of the pointerJeroen Hofstee2014-06-111-1/+1
| | | | | | | | | | | | | | | if algo->digest_size is zero nothing is set in the str_output buffer. An attempt is made to zero end the buffer, but the pointer to the buffer is set to zero instead. I am unaware if it causes any actual problems, but solves the following warning: common/hash.c:217:13: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion] str_ptr = '\0'; ^~~~ cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* Use run_command_repeatable()Thomas Betker2014-06-112-2/+2
| | | | | | | | | Replace run_command() by run_command_repeatable() in places which depend on the return code to indicate repeatability. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* Add run_command_repeatable()Thomas Betker2014-06-111-0/+24
| | | | | | | | | | run_command() returns 0 on success and 1 on error. However, there are some invocations which expect 0 or 1 for success (not repeatable or repeatable) and -1 for error; add run_command_repeatable() for this purpose. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* Check run_command() return code properlyThomas Betker2014-06-111-5/+1
| | | | | | | | | | run_command() returns 0 for success, 1 for failure. Fix places which assume that failure is indicated by a negative return code. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Roese <sr@denx.de>
* fdt: Update functions which write to an FDT to return -ENOSPCSimon Glass2014-06-111-2/+2
| | | | | | | | | | When writing values into an FDT it is possible that there will be insufficient space. If the caller gets a useful error then it can potentially deal with the situation. Adjust these functions to return -ENOSPC when the FDT is full. Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud