aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2020-03-16spl: Kconfig: Escape '$(ARCH)' in LDSCRIPT entriesTom Rini1-2/+2
The default SPL / TPL linker script is in the $(ARCH) directory. The way we use this today works but isn't ideal. With an update to Kconfig to re-sync with the Linux Kernel, we need to escape the '$' here so that it will end up being evaluated by make. Cc: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
2020-03-12lib: rsa: decouple rsa from FIT image verificationAKASHI Takahiro5-400/+429
Introduce new configuration, CONFIG_RSA_VERIFY which will decouple building RSA functions from FIT verification and allow for adding a RSA-based signature verification for other file formats, in particular PE file for UEFI secure boot. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-03-09spl: mmc: Fix spl_mmc_get_uboot_raw_sector() implementationFaiz Abbas1-7/+4
The call to spl_mmc_get_uboot_raw_sector() completely ignores and overwrites the raw_sect value passed from the caller of spl_mmc_load(). Fix this by passing raw_sect to the function and returning the same value in the default case. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-19rockchip: rk3288: Enable pre console bufferJagan Teki1-0/+1
Enable pre console buffer for rk3288 platform. This would help to capture the console messages prior to the console being initialised. Enabling this would help to capture all the console messages on video output source like HDMI. So we can find the full console messages of U-Boot proper on HDMI display when enabled it for RK3288 platform boards. Buffer address used for pre console is 0x0f000000 which is ram base plus 240MiB. right now the Allwinner SoC is using similar computation. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2020-02-13board_f: Make clear_bss genericOvidiu Panait1-3/+5
clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic and provide a weak nop stub for it. This also removes arch-specific ifdef duplications around clear_bss. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2020-02-13common/console.c: discard volatileHeinrich Schuchardt1-10/+13
Avoid errors of like common/console.c: In function ‘console_record_reset’: common/console.c:615:16: error: passing argument 1 of ‘membuff_purge’ discards ‘volatile’ qualifier from pointer target type [-Werror=discarded-qualifiers] 615 | membuff_purge(&gd->console_out); | ^~~~~~~~~~~~~~~~ by casting to non-volatile. The volatile property stems from declarations like arch/arm/include/asm/global_data.h:114: But there is no need to treat gd->console_out and gd->console_in as volatile in the context of common/console.c. Fixes: b612312816ff ("console: Add a function to read a line of the output / eof") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-02-11Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dmTom Rini10-5/+49
sandbox conversion to SDL2 TPM TEE driver Various minor sandbox video enhancements New driver model core utility functions
2020-02-10Kconfig: update LOGLEVEL rangeMarek Bykowski1-1/+1
As LOGLEVEL ranges form 0 to 9 set the limit to 10. Signed-off-by: Marek Bykowski <marek.bykowski@gmail.com>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass6-0/+6
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05exports: Add the malloc.h headerSimon Glass1-0/+1
This file should include the malloc.h header since it references malloc(). Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05cli: Make the sandbox board_run_command the defaultSean Anderson1-0/+7
If CONFIG_CMDLINE=n, common/cli.c calls board_run_command. This fails to link on most architectures. However, the sandbox architecture has an implementation which we can use. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-02-05image: fdt: check "status" of "/reserved-memory" subnodesThirupathaiah Annapureddy1-1/+1
boot_fdt_add_mem_rsv_regions() scans the subnodes of "/reserved-memory" and adds them to reserved lmb regions. Currently this scanning does not take into "status" property. Even if the subnode is disabled, it gets added to the reserved lmb regions. This patch checks the "status" property before adding it to reserved lmb regions. Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
2020-02-05console: Add a function to read a line of the output / eofSimon Glass1-0/+11
When recording the console output for testing it is useful to be able to read the output a line at a time to check that the output is correct. Also we need to check that we get to the end of the output. Add a console function to return the next line and another to see how must data is left. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05bloblist: Zero records when addingSimon Glass1-0/+3
It is convenient for bloblist to zero out the contents of a records when it is added. This saves the callers having to do it. Update the API accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05bloblist: Tidy up a few comments and code-style nitsSimon Glass1-3/+2
Add a messing error code to bloblist_new() and tidy up the line length in bloblist_addrec(). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05bloblist: Add a new function to add or check sizeSimon Glass1-1/+18
A common check is to see if a blob is present, create it if not and make sure that the size is large enough. Add a function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-04image: android: Add routine to get dtbo paramsSam Protsenko1-0/+61
Android Boot Image v1 adds "Recovery DTB" field in image header and associate payload in boot image itself [1]. Payload should be in Android DTB/DTBO format [2]. That "Recovery DTB" area should be only populated for non-A/B devices, and only in recovery image. Add function to get an address and size of that payload. That function can be further used e.g. in 'abootimg' command to provide the user a way to get the address of recovery dtbo from U-Boot shell, which can be further parsed using 'adtimg' command. [1] https://source.android.com/devices/bootloader/boot-image-header [2] https://source.android.com/devices/architecture/dto/partitions Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04image: android: Add functions for handling dtb fieldSam Protsenko2-1/+222
Android Boot Image v2 adds "DTB" payload (and corresponding field in the image header). Provide functions for its handling: - android_image_get_dtb_by_index(): Obtain DTB blob from "DTB" part of boot image, by blob's index - android_image_print_dtb_contents(): Iterate over all DTB blobs in "DTB" part of boot image and print those blobs info "DTB" payload might be in one of the following formats: 1. concatenated DTB blobs 2. Android DTBO format The latter requires "android-image-dt.c" functionality, so this commit selects that file for building for CONFIG_ANDROID_BOOT_IMAGE option. Right now this new functionality isn't used, but it can be used further. As it's required to apply some specific dtbo blob(s) from "dtbo" partition, we can't automate this process inside of "bootm" command. But we can do next: - come up with some new command like "abootimg" to extract dtb blob from boot image (using functions from this patch) - extract desired dtbo blobs from "dtbo" partition using "adtimg" command - merge dtbo blobs into dtb blob using "fdt apply" command - pass resulting dtb blob into bootm command in order to boot the Android kernel with Android ramdisk from boot image Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-30common/board_f.c: Remove arch-specific checks for cpucheckOvidiu Panait1-2/+5
This removes the arch-specific checks for "checkcpu" function from the init sequence. Make "checkcpu" generic and provide a weak nop stub instead. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2020-01-26common: fix regression on block cache initAngelo Durgehello1-1/+1
m68k needs block cache list initialized after relocation. Other architectures must not be involved. Fixing regression related to: commit 1526bcce0f7285087621e16e6720636d01839da8 ("common: add blkcache init") Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
2020-01-26Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxiTom Rini1-0/+1
- Libre Computer ALL-H3-IT/ALL-H5-CC board (Chen-Yu Tsai) - Allwinner R40 Ethernet, usb phy enablement (Andre Przywara) - Sunxi auto load from 128KB MMC offset (Andre Przywara) - Orange Pi Win Ethernet phy enablement (Jernej Skrabec)
2020-01-25common: add blkcache initAngelo Durgehello1-0/+3
On m68k, block_cache list is relocated, but next and prev list pointers are not adjusted to the relocated struct list_head address, so the first iteration over the block_cache list hangs. This patch initializes the block_cache list after relocation. Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com> Reviewed-by: Eric Nelson <eric@nelint.com>
2020-01-24sunxi: move CONFIG_SYS_SPI_U_BOOT_OFFS out of defconfigAndre Przywara1-0/+1
For Allwinner SoCs the CONFIG_SYS_SPI_U_BOOT_OFFS value is not really a board choice: The boot ROM only loads the SPL from offset 0 of the SPI NOR flash, and loads at most 32KB. This is a similar situation as on MMC, so consequently we create our "joint" image (SPL + U-Boot proper) with that 32KB offset during the build. So define the value of this symbol to be 32KB by default for every Allwinner SoC. This removes the definition of this symbol from the _defconfig files, and avoids every board to define this over and over again. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-01-24common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATASimon Glass1-1/+1
This is not really a CONFIG since it is not intended to be set by boards. Move it into the compiler header with other similar defines, and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move hang() to the same header as panic()Simon Glass6-0/+6
At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Migrate a few more files] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-01-24common: Move RAM-sizing functions to init.hSimon Glass1-0/+1
These functions relate to memory init so move them into the init header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move the image globals into image.hSimon Glass2-0/+2
These three globals relate to image handling. Move them to the image header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24image: Rename load_addr, save_addr, save_sizeSimon Glass5-16/+16
These global variables are quite short and generic. In fact the same name is more often used locally for struct members and function arguments. Add a image_ prefix to make them easier to distinguish. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move clock functions into a new fileSimon Glass1-0/+1
These three clock functions don't use driver model and should be migrated. In the meantime, create a new file to hold them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move reset_phy() to net.hSimon Glass1-0/+1
This is a network function so let's move it into that header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move jumptable_init() out of common.hSimon Glass1-0/+1
This function is defined in exports.c so move it to its header file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-24common: Move flash_perror() to flash.hSimon Glass1-1/+1
This function belongs more in flash.h than common.h so move it. Also remove the space before the bracket in some calls. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-24common: Move main_loop() to init.hSimon Glass2-0/+2
Move this function out of common.h and into a better place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-01-23board_init: remove meaningless increment in board_init_f_init_reserve()Masahiro Yamada1-2/+0
The base is not used in the code that follows this increment. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-22spl_fit.c: enable loading compressed u-boot from fit imageKlaus H. Sorensen1-5/+3
Allow reading compressed content from fit image, even if CONFIG_SPL_OS_BOOT is not set. This allow booting compressed 2nd stage u-boot from fit image. Additionally, do not print warning message if compression node is not found, since it simply implies the content is uncompressed. Signed-off-by: Klaus H. Sorensen <khso@prevas.dk> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2020-01-17common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATASimon Glass1-1/+1
This is not really a CONFIG since it is not intended to be set by boards. Move it into the compiler header with other similar defines, and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move hang() to the same header as panic()Simon Glass6-0/+6
At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Migrate a few more files] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-01-17common: Move RAM-sizing functions to init.hSimon Glass1-0/+1
These functions relate to memory init so move them into the init header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move the image globals into image.hSimon Glass2-0/+2
These three globals relate to image handling. Move them to the image header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17image: Rename load_addr, save_addr, save_sizeSimon Glass5-16/+16
These global variables are quite short and generic. In fact the same name is more often used locally for struct members and function arguments. Add a image_ prefix to make them easier to distinguish. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move clock functions into a new fileSimon Glass1-0/+1
These three clock functions don't use driver model and should be migrated. In the meantime, create a new file to hold them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move reset_phy() to net.hSimon Glass1-0/+1
This is a network function so let's move it into that header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move jumptable_init() out of common.hSimon Glass1-0/+1
This function is defined in exports.c so move it to its header file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-17common: Move flash_perror() to flash.hSimon Glass1-1/+1
This function belongs more in flash.h than common.h so move it. Also remove the space before the bracket in some calls. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move main_loop() to init.hSimon Glass2-0/+2
Move this function out of common.h and into a better place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-01-17u-boot: fit: add support to decrypt fit with aesPhilippe Reynes2-0/+167
This commit add to u-boot the support to decrypt fit image encrypted with aes. The FIT image contains the key name and the IV name. Then u-boot look for the key and IV in his device tree and decrypt images before moving to the next stage. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-01-17mkimage: fit: add support to encrypt image with aesPhilippe Reynes3-0/+91
This commit add the support of encrypting image with aes in mkimage. To enable the ciphering, a node cipher with a reference to a key and IV (Initialization Vector) must be added to the its file. Then mkimage add the encrypted image to the FIT and add the key and IV to the u-boot device tree. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-01-16Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvellTom Rini2-2/+25
- Clearfog: Fix SD booting (Baruch) - Misc updates to MMC handling in SPL to support booting from main data partition (vs hardware boot partition) on MVEBU (Baruch)
2020-01-16Merge tag 'xilinx-for-v2020.04' of ↵Tom Rini1-15/+2
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze Xilinx/FPGA changes for v2020.04 ARM64: - Add INIT_SPL_RELATIVE dependency SPL: - FIT image fix - Enable customization of bl2_plat_get_bl31_params() Pytest: - Add test for octal/hex conversions Microblaze: - Fix manual relocation for one SPI instance Nand: - Convert zynq/zynqmp drivers to DM Xilinx: - Enable boot script location via Kconfig - Support OF_SEPARATE in board FDT selection - Remove low level uart setup it is done later by code - Add support for DEVICE_TREE variable passing for SPL Zynq: - Enable jtag boot mode via distro boot - Removing unused baseaddresses from hardware.h - DT fixups ZynqMP: - Fix emmc boot sequence - Simplify spl logic around bss and board_init_r() - Support psu_post_config_data() calling - Tune mini-nand DTS - Fix psu wiring for a2197 boards - Add runtime MMC device boot order filling in spl - Clear ATF handoff handling with custom bl2_plat_get_bl31_params() - Add support u-boot.its generation - Use single image configuration for all platforms - Enable PANIC_HANG via Kconfig - DT fixups - Firmware fixes - Add support for zcu208 and zcu1285 Versal: - Fix emmc boot sequence - Enable board_late_init() by default
2020-01-16spl: mmc: support uboot image offset on main partitionBaruch Siach2-2/+25
On Armada 38x platforms the ROM code loads SPL from offset 0 of eMMC hardware boot partitions. When there are no boot partitions (i.e. SD card) the ROM skips the first sector that usually contains the (logical) partition table. Since the generated .kwb image contains the main U-Boot image in a fixed location (0x140 sectors by default), we end up with the main U-Boot image in offset of 1 sector. The current workaround is to manually set CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR to 0x141 to compensate for that. This patch uses the run-time detected boot partition to determine the right offset of the main U-Boot partition. The generated .kwb image is now compatible with both eMMC boot partition, and SD card main data partition. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>