aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2018-08-31spl: Kconfig: Fix typo in 'Upgrade'Fabio Estevam1-2/+2
Correct the spelling of 'Upgrade'. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
2018-08-24malloc_simple: calloc: don't call memset if malloc failedSimon Goldschmidt1-1/+2
malloc_simple() can return 0 if out of memory. Don't call memset from calloc() in this case but rely on the caller checking the return value. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Marek Vasut <marex@denx.de>
2018-08-24common: avb_verify: Fix division by zero in mmc_byte_io()Eugeniu Rosca1-0/+3
Compiling U-Boot with ubsan/asan libraries and running it in sandbox may lead to below backtrace: => avb init 0 => avb verify ## Android Verified Boot 2.0 version 1.1.0 read_is_device_unlocked not supported yet common/avb_verify.c:407:31: runtime error: division by zero AddressSanitizer:DEADLYSIGNAL Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org> ================================================================= ==9388==ERROR: AddressSanitizer: FPE on unknown address 0x0000004b467f \ (pc 0x0000004b467f bp 0x000000000000 sp 0x7ffd899fe150 T0) #0 0x4b467e in mmc_byte_io common/avb_verify.c:407 #1 0x4b4c47 in mmc_byte_io common/avb_verify.c:532 #2 0x4b4c47 in read_from_partition common/avb_verify.c:533 #3 0x69dc0d in load_and_verify_vbmeta lib/libavb/avb_slot_verify.c:560 #4 0x6a1ee6 in avb_slot_verify lib/libavb/avb_slot_verify.c:1139 #5 0x45dabd in do_avb_verify_part cmd/avb.c:245 #6 0x4af77c in cmd_call common/command.c:499 #7 0x4af77c in cmd_process common/command.c:538 #8 0x46bafc in run_pipe_real common/cli_hush.c:1677 #9 0x46bafc in run_list_real common/cli_hush.c:1875 #10 0x46c780 in run_list common/cli_hush.c:2024 #11 0x46c780 in parse_stream_outer common/cli_hush.c:3216 #12 0x46d34b in parse_file_outer common/cli_hush.c:3299 #13 0x4ad609 in cli_loop common/cli.c:217 #14 0x4625ae in main_loop common/main.c:65 #15 0x46f2d1 in run_main_loop common/board_r.c:648 #16 0x640253 in initcall_run_list lib/initcall.c:30 #17 0x46f9d0 in board_init_r common/board_r.c:879 #18 0x40539b in main arch/sandbox/cpu/start.c:321 #19 0x7fa94925f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #20 0x408908 in _start (/srv/R/u-boot-master/u-boot+0x408908) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: FPE common/avb_verify.c:407 in mmc_byte_io ==9388==ABORTING Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
2018-08-24common: avb_verify: Fix never-occurring avb_free(ops_data)Eugeniu Rosca1-1/+1
Cppcheck (v1.85) reports w/o this patch: [common/avb_verify.c:738] -> [common/avb_verify.c:741]: (warning) \ Either the condition 'ops' is redundant or there is possible null \ pointer dereference: ops. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-24common: avb_verify: Fix memory leaksEugeniu Rosca1-5/+8
Cppcheck (v1.85) reports w/o this patch: [common/avb_verify.c:351]: (error) Memory leak: part [common/avb_verify.c:356]: (error) Memory leak: part [common/avb_verify.c:361]: (error) Memory leak: part [common/avb_verify.c:366]: (error) Memory leak: part Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-24common: avb_verify: Make local data staticEugeniu Rosca1-1/+1
Fix sparse complaint: common/avb_verify.c:14:21: warning: \ symbol 'avb_root_pub' was not declared. Should it be static? Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-24common: kconfig: Mark AVB_VERIFY as dependent on PARTITION_UUIDSEugeniu Rosca1-0/+1
Avoid below compiler [1] errors, reproduced with configuration [2]: common/avb_verify.c: In function ‘get_unique_guid_for_partition’: common/avb_verify.c:692:31: error: ‘disk_partition_t {aka struct disk_partition}’ has no member named ‘uuid’ uuid_size = sizeof(part->info.uuid); ^ common/avb_verify.c:696:29: error: ‘disk_partition_t {aka struct disk_partition}’ has no member named ‘uuid’ memcpy(guid_buf, part->info.uuid, uuid_size); ^ LD drivers/built-in.o make[2]: *** [scripts/Makefile.build:278: common/avb_verify.o] Error 1 [1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) [2] r8a7795_ulcb_defconfig, plus: CONFIG_AVB_VERIFY=y CONFIG_PARTITION_UUIDS=y CONFIG_UDP_FUNCTION_FASTBOOT=y CONFIG_LIBAVB=y Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-24common: avb_verify: Fix invalid 'for' loop conditionEugeniu Rosca1-1/+1
Fix below compiler [1] warning: common/avb_verify.c: In function ‘avb_find_dm_args’: common/avb_verify.c:179:30: warning: left-hand operand of comma expression has no effect [-Wunused-value] for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) { [1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-08-20cmd: Add dtimg commandSam Protsenko1-0/+2
dtimg command allows user to work with Android DTB/DTBO image format. Such as, getting the address of desired DTB/DTBO file, printing the dump of the image in U-Boot shell, etc. This command is needed to provide Android boot with new Android DT image format further. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-08-20common: Add support for Android DT imageSam Protsenko1-0/+156
Android documentation recommends new image format for storing DTB/DTBO files: [1]. To support that format, this patch adds helper functions for Android DTB/DTBO format. In image-android-dt.* files you can find helper functions to work with Android DT image format, such us routines for: - printing the dump of image structure - getting the address and size of desired dtb/dtbo file This patch uses dt_table.h file, that was added in commit 643cefa4d848 ("Import Android's dt_table.h for DT image format") by Alex Deymo. [1] https://source.android.com/devices/architecture/dto/partitions Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-08-20spl: fix debug print in spl_common_init()Simon Goldschmidt1-2/+4
spl_common_init() debug-prints "spl_early_init()\n" but it is called both from spl_early_init() and spl_init(). Fix this by moving the debug() statement to the calling functions which now print their name. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-08-17Convert CONFIG_MISC_INIT_R to KconfigAdam Ford1-0/+7
This converts the following to Kconfig: CONFIG_MISC_INIT_R Signed-off-by: Adam Ford <aford173@gmail.com> [trini: Update the defaults logic slightly] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-08-17kconfig: fix typo 'parition'Simon Goldschmidt1-1/+1
Replaced misspelled words "parition"/"paritioning" (missing 't') in two Kconfig files by correct words "partition"/"partitioning" Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-08-16fdt_support: Use CONFIG_NR_DRAM_BANKS if necessaryRamon Fried1-0/+4
If CONFIG_NR_DRAM_BANKS is bigger than the default value (4) define MEMORY_BANKS_MAX as CONFIG_NR_DRAM_BANKS. Fixes: 2a1f4f1758b5 ("Revert "fdt_support: Use CONFIG_NR_DRAM_BANKS if defined"") Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
2018-08-13avb2.0: add get_size_of_partition()Igor Opaniuk1-1/+32
Implement get_size_of_partition() operation, which is required by the latest upstream libavb [1]. [1] https://android.googlesource.com/platform/external/avb/+/android-p-preview-5 Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> Acked-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2018-08-10sandbox: led: use new function to configure default statePatrick Delaunay1-1/+2
Initialize the led with the default state defined in device tree in board_init and solve issue with test for led default state. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-08-07Merge tag 'xilinx-for-v2018.09-rc2' of git://git.denx.de/u-boot-microblazeTom Rini1-2/+2
Xilinx fixes for v2018.09-rc2 xilinx: - Add support for zybo z7 and ultra96 - Tune zynq and zynqmp mini configurations - Move SYS_MALLOC_LEN to Kconfig fdt - make static funcs gpio: - Fix soft gpio driver - Fix Zynq gpio driver by using platdata microblaze: - Fix Kconfig entry spi - Move ISSI to Kconfig
2018-08-07common: fdt: Make fdt_del_subnodes/fdt_del_partition staticMichal Simek1-2/+2
These functions are only called in this file that's why make them static to keep static analysers happy. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-06power: Add CONFIG_SPL_POWER_DOMAIN configPeng Fan1-0/+9
Add CONFIG_SPL_POWER_DOMAIN config entry. Build drivers/power/domain if this config is selected. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-04Merge branch 'master' of git://git.denx.de/u-boot-sunxiTom Rini1-1/+1
2018-08-01binman: Add a new 'image-pos' propertySimon Glass2-3/+3
At present each entry has an offset within its parent section. This is useful for figuring out how entries relate to one another. However it is sometimes necessary to locate an entry within an image, regardless of which sections it is nested inside. Add a new 'image-pos' property to provide this information. Also add some documentation for the -u option binman provides, which updates the device tree with final entry information. Since the image position is a better symbol to use for the position of U-Boot as obtained by SPL, update the SPL symbols to use this instead of offset, which might be incorrect if hierarchical sections are used. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Rename 'position' to 'offset'Simon Glass2-3/+3
After some thought, I believe there is an unfortunate naming flaw in binman. Entries have a position and size, but now that we support hierarchical sections it is unclear whether a position should be an absolute position within the image, or a relative position within its parent section. At present 'position' actually means the relative position. This indicates a need for an 'image position' for code that wants to find the location of an entry without having to do calculations back through parents to discover this image position. A better name for the current 'position' or 'pos' is 'offset'. It is not always an absolute position, but it is always an offset from its parent offset. It is unfortunate to rename this concept now, 18 months after binman was introduced. However I believe it is the right thing to do. The impact is mostly limited to binman itself and a few changes to in-tree users to binman: tegra sunxi x86 The change makes old binman definitions (e.g. downstream or out-of-tree) incompatible if they use the 'pos = <...>' property. Later work will adjust binman to generate an error when it is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-31sunxi: add support for Allwinner H6 SoCIcenowy Zheng1-1/+1
Allwinner H6 is a new SoC from Allwinner features USB3 and PCIe interfaces. This patch adds support for it. The corresponding DTSI file, from Linux next-20180720, is also introduced. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Reviewed-by: Jagan Teki <jagan@openedev.com> Tested-by: Jagan Teki <jagan@amarulasolutions.com>
2018-07-30common: Log should depends on DM not be selected by DMMichal Simek1-1/+1
Better use depends on instead of select. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-28Revert "fdt_support: Use CONFIG_NR_DRAM_BANKS if defined"Ramon Fried1-4/+0
This reverts commit 5e5745465c94605720295fab942eacbdd215db90. The reverted commit didn't support the scenario where there are less DRAM banks in U-Boot than in Linux. Also, it didn't introduce any new functionality, only limitaion. User could just increase MEMORY_BANKS_MAX if it's too small. Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-27Merge git://git.denx.de/u-boot-fsl-qoriqTom Rini1-0/+10
2018-07-26sandbox: Don't disable ctrlc() on sandbox if in raw modeJoe Hershberger1-2/+0
In raw mode, handle ctrl-c as normal. This allows normal ctrl-c behavior such as aborting a command that is timing out without completely terminating the sandbox executable. In [1], Simon disabled this. His reason for it was that it interferes with piping test scripts. Piping should be done in cooked mode, so this change should still not interfere. [1] commit 8969ea3e9f2db04a6b3675 ("sandbox: Disable Ctrl-C") Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-26console: Remember if ctrlc is disabled in console_tstc()Joe Hershberger1-3/+4
We don't necessarily want to re-enable ctrl-c if it was already disabled when calling tstc(). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-26spl: Add option SPL_PAYLOADYork Sun1-0/+10
Some legacy boards use RAW image for SPL boot. Add Kconfig option SPL_PAYLOAD to set alternative image. Signed-off-by: York Sun <york.sun@nxp.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-24Merge branch 'master' of git://git.denx.de/u-boot-uniphierTom Rini1-6/+7
2018-07-25fdt_support: make fdt_fixup_mtdparts() prototype more specificMasahiro Yamada1-6/+7
The second argument of fdt_fixup_mtdparts() is an opaque pointer, 'void *node_info', hence callers can pass any pointer. Obviously, fdt_fixup_mtdparts() expects 'struct node_info *' otherwise, it crashes run-time. Change the prototype so that it is compile-time checked. Also, add 'const' qualifier to it so that callers can constify the struct node_info arrays. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-24spl: remove dependency to "asm/utils.h"Paulo Zaneti1-1/+0
Header file "asm/utils.h" is not required to compile "spl_ymodem.c". So, removing this dependency allows other architectures to use this booting device as "asm/utils.h" is only present in "arm" architecture. Signed-off-by: Paulo Zaneti <paulo.zaneti@datacom.ind.br>
2018-07-24avb2.0: use block API in AVB opsIgor Opaniuk1-4/+5
Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when CONFIG_BLK is enabled. Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
2018-07-24avb2.0: add proper dependenciesIgor Opaniuk2-1/+11
1. Since libavb library alone is highly portable, introduce dedicated Kconfig symbol for AVB bootloader-dependent operations, so it's possible to build libavb separately. AVB bootloader-dependent operations include: * Helpers to process strings in order to build OS bootargs. * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c. * Helpers to alloc/init/free avb ops. 2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is re-used in partition verification operations. Reported-by: Eugeniu Rosca <rosca.eugeniu@gmail.com> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com> Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
2018-07-21configs: Make NAND_BOOT and ONENAND_BOOT imply NANDAdam Ford1-0/+2
Some boards indicate support from booting NAND or ONENAND booting, but don't enable the CONFIG_NAND. This makes those boards imply NAND which will make enabling other flags that are dependent on CONFIG_NAND possible and easier to migrate. Signed-off-by: Adam Ford <aford173@gmail.com>
2018-07-21spl: record boot_device into spl_image and call spl_perform_fixupsPhilipp Tomsich1-1/+11
On some boards, we want to give the board/architecture-specific code a chance to look at where the next image has been loaded from and perform fixups before starting the next image. This is of particular importance, when we probe multiple devices for bootable payloads and boot the first one found. This change adds the following: - we record the boot_device used into the spl_image structure - we provide an extension-point for boards/architectures that can perform late fixups depending on a fully populated spl_image structure (i.e. we'll know the final boot_device and have info on the image type and operating system to be booted). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2018-07-20bootmenu: Extend BOOTDELAY help textAlex Kiernan1-0/+4
Extend BOOTDELAY help text to cover its additional usage within the bootmenu command. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-07-20spl: Make the spl_nand_load_image staticMichael Trimarchi1-1/+1
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2018-07-20spl: mmc: Skip RAW mode ARGS sectors if not definedYork Sun1-1/+4
RAW mode ARGS sector doesn't have to be used for all falcon boot. Skip loading ARGS sectors if not defined. Signed-off-by: York Sun <york.sun@nxp.com>
2018-07-19spl: nor: Skip CONFIG_SYS_FDT_BASE if not definedYork Sun1-1/+2
If FIT image is used, CONFIG_SYS_FDT_BASE is not needed. Signed-off-by: York Sun <york.sun@nxp.com>
2018-07-19spl: nor: Add FIT supportYork Sun1-2/+40
Add support of loading FIT image from NOR flash. Signed-off-by: York Sun <york.sun@nxp.com>
2018-07-19env: common: accept flags on reset to default envYaniv Levinsky2-2/+2
The function set_default_env() sets the hashtable flags for import_r(). Formally set_default_env() doesn't accept flags from its callers. In practice the caller can (un)set the H_INTERACTIVE flag, but it has to be done using the first character of the function's string argument. Other flags like H_FORCE can't be set by the caller. Change the function to accept flags argument. The benefits are: 1. The caller will have to explicitly set the H_INTERACTIVE flag, instead of un-setting it using a special char in a string. 2. Add the ability to propagate flags from the caller to himport(), especially the H_FORCE flag from do_env_default() in nvedit.c that currently gets ignored for "env default -a -f" commands. 3. Flags and messages will not be coupled together. A caller will be able to set flags without passing a string and vice versa. Please note: The propagation of H_FORCE from do_env_default() does not introduce any functional changes, because currently himport_r() is set to destroy the old environment regardless if H_FORCE flag is set or not. More changes are needed to utilize the propagation of H_FORCE. Signed-off-by: Yaniv Levinsky <yaniv.levinsky@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
2018-07-19spl: fit: display a message when an FPGA image is loadedLuis Araneda1-0/+1
A message should be displayed if an image is loaded to an FPGA, because the hardware might have changed, and the user should be informed Signed-off-by: Luis Araneda <luaraneda@gmail.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-07-19lib: fdtdec: Update ram_base to store ram start adddressSiva Durga Prasad Paladugu1-2/+2
This patch updates the ram_base to store the start address of the first bank DRAM and the use this ram_base to calculate ram_top properly. This patch fixes the erroneous calculation of ram_top incase of non zero ram start address. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-19usb_kdb: Get stdio_dev directly from sdev pointerMichal Simek1-2/+2
Driver supports only one instance of usb keyboard. Remove the first dependency on generic usbkbd DEVNAME. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-07-19usb_kbd: Add support for watchdogMichal Simek1-1/+4
There is need to service watchdog in while loop or system will be restarted when idlying. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-07-19common: command: Handle USAGE failure separatelyMichal Simek1-0/+3
command_ret_t enum contains 3 return values but only two are handled now. Extend cmd_process_error() and handle CMD_RET_USAGE separately. These commands are affected by this change. cmd/demo.c cmd/efi.c cmd/gpio.c cmd/qfw.c cmd/x86/fsp.c test/dm/cmd_dm.c And scripts shouldn't be affected because return value is not 0. But every command implementation can choose what it is correct to pass. I would expect that RET_USAGE is called when parameters are not correctly passed (have incorrect value, missing parameters) and RET_FAILURE when correct parameters are passed but command fails. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromum.org>
2018-07-19common: command: Use command_ret_t enum values instead of valuesMichal Simek1-2/+2
Use enum command_ret_t types in cmd_process_error(). Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromum.org>
2018-07-10common/memsize.c: Increase save array for supporting memory size > 4GBTien Fong Chee1-1/+1
In ARM 64-bits, memory size can be supported is more than 4GB, hence increasing save array is needed to cope with testing larger memory. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
2018-07-10common: print \n in initr_scsi()Heinrich Schuchardt1-0/+1
Typically init_scsi() does not output anything. So initr_scsi() should provide a \n or we may see borked output like SCSI: Net: No ethernet found. as observed with sandbox_defconfig. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>