summaryrefslogtreecommitdiff
path: root/include/spl.h
AgeCommit message (Collapse)Author
2026-03-26spl: add squashfs supportRichard Genoud
Implement spl_load_image_sqfs() in spl code. This will be used in MMC to read a file from a squashfs partition. Also, loosen squashfs read checks on file size by not failing when a bigger size than the actual file size is requested. (Just read the file) This is needed for FIT loading, because the length is ALIGNed. Signed-off-by: Richard Genoud <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Reviewed-by: João Marcos Costa <[email protected]>
2025-11-06spl: fit: Add ability to jump to Linux via OPTEE-OS on ARMv7aMarek Vasut
Add support for jumping to Linux kernel through OPTEE-OS on ARMv7a to SPL. This is already supported on ARMv8a, this patch adds the ARMv7a support. Extend the SPL fitImage loader to record OPTEE-OS load address and in case the load address is non-zero, use the same bootm-optee.S code used by the U-Boot fitImage jump code to start OPTEE-OS first and jump to Linux next. Signed-off-by: Marek Vasut <[email protected]>
2025-10-22spl: split spl_board_fixups to arch/board specificAnshul Dalal
The current spl_board_fixups API allows for modification of spl_image before the SPL jumps to it. This can be used to modify the DT for the next boot stage, however the current API only allows either the machine arch or the board to use it. This limits the utility of the API as there might be certain fixups that should be applied to all boards sharing the same machine architecture with others being board specific. For TI's K3 specifically, this prevents us from performing architecture level fixups since a lot of TI boards are already making use of the spl_board_fixups API. Therefore this patch splits the API into two to allow both board and the architecture specific fixups. The order is kept as arch then board to give board specific fixups the precedence. Reviewed-by: Dhruva Gole <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> Tested-by: Wadim Egorov <[email protected]>
2025-06-13spl: Rename jump_to_image_no_args()Simon Glass
This function is currently a misnomer at times as we have cases where it passes arguments to the image. In preparation for making that be a more common case rename this function to jump_to_image(...). In order to do this, rename jump_to_image in board_init_r(...) to jumper so that we do not have a conflict. Signed-off-by: Simon Glass <[email protected]> [trini: Reword the commit message, adding missing cases of jump_to_image_no_args()] Signed-off-by: Tom Rini <[email protected]>
2025-02-03vbe: Allow VBE to disable adding loadables to the FDTSimon Glass
When VBE operates within VPL it does not want the FDT to be changed. Provide a way to disable this feature. Move the FIT_IMAGE_TINY condition out of spl_fit_record_loadable() so that both conditions are together. This makes the code easier to understand. Replace the existing fit_loaded member, which is no-longer used. Signed-off-by: Simon Glass <[email protected]>
2025-01-22spl: Plumb in the relocating loaderSimon Glass
This is fairly easy to use. The SPL loader sets up some fields in the spl_image_info struct and calls spl_reloc_prepare(). When SPL is ready to do the jump it must call spl_reloc_jump() instead of jump_to_image(). Add this logic. Signed-off-by: Simon Glass <[email protected]>
2025-01-22spl: Add support for a relocating jump to the next phaseSimon Glass
When one xPL phase wants to jump to the next, the next phase must be loaded into its required address. This means that the TEXT_BASE for the two phases must be different and there cannot be any memory overlap between the code used by the two phases. It also can mean that phases need to be moved around to accommodate any size growth. Having two xPL phases in SRAM at the same time can be tricky if SRAM is limited, which it often is. It would be better if the second phase could be loaded somewhere else, then decompressed into place over the top of the first phase. Introduce a relocating jump for xPL to support this. This selects a suitable place to load the (typically compressed) next phase, copies some decompression code out of the first phase, then jumps to this code to decompress and start the next phase. This feature makes it much easier to support Verified Boot for Embedded (VBE) on RK3399 boards, which have 192KB of SRAM. Signed-off-by: Simon Glass <[email protected]>
2025-01-22spl: Add a type for the jumper functionSimon Glass
This function will be used by the relocating jumper too, so add a typedef to the header file to avoid mismatches. Signed-off-by: Simon Glass <[email protected]>
2025-01-22spl: Add fields for VBESimon Glass
Add some fields to track the VBE state in SPL. Signed-off-by: Simon Glass <[email protected]>
2024-12-27spl: Drop use of uintptr_tSimon Glass
U-Boot uses ulong for addresses. It is confusing to use uintptr_t in a few places, since it makes people wonder if the types are compatible. Change the few occurences in SPL to use ulong Signed-off-by: Simon Glass <[email protected]>
2024-12-12Revert "Merge patch series "vbe: Series part E""Tom Rini
This reverts commit 1fdf53ace13f745fe8ad4d2d4e79eed98088d555, reversing changes made to e5aef1bbf11412eebd4c242b46adff5301353c30. I had missed that this caused too much size growth on rcar3_salvator-x. Signed-off-by: Tom Rini <[email protected]>
2024-12-12spl: Drop use of uintptr_tSimon Glass
U-Boot uses ulong for addresses. It is confusing to use uintptr_t in a few places, since it makes people wonder if the types are compatible. Change the few occurences in SPL to use ulong Signed-off-by: Simon Glass <[email protected]>
2024-10-11spl: Rename SPL_TPL_NAME and SPL_TPL_PROMPTSimon Glass
Rename these to use the word PHASE instead. Signed-off-by: Simon Glass <[email protected]>
2024-10-11include: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILDSimon Glass
Use the new symbol to refer to any 'SPL' build, including TPL and VPL Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename spl_phase_prefix() and spl_phase_name()Simon Glass
Use simpler names for these functions. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename spl_next_phase() and spl_prev_phase()Simon Glass
Rename this to use the xpl prefix. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Add a function to indicate when in xPLSimon Glass
Add the opposite function to not_xpl() for completeness. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename spl_in_proper() to not_xpl()Simon Glass
Give this function a slightly easier name. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename spl_phase() to xpl_phase()Simon Glass
Rename this function to indicate that it refers to any xPL phase. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename spl_phase to xpl_phase_tSimon Glass
This name fits better with the new naming scheme, so update it. Signed-off-by: Simon Glass <[email protected]>
2024-10-11xpl: Rename u_boot_first_phase to xpl_is_first_phase()Simon Glass
This is a better name for this function, so update it. Tidy up the function comment to mention VPL. Signed-off-by: Simon Glass <[email protected]>
2024-08-23spl: Create a function to init spl_load_infoSimon Glass
Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Michael Trimarchi <[email protected]>
2024-08-23spl: Use unified inline functions for spl_load_infoSimon Glass
Rather than declaring completely separate functions, put the code for each case into the same function. This makes it easier to read. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Sean Anderson <[email protected]> Reviewed-by: Quentin Schulz <[email protected]>
2024-08-09upl: Add support for Universal Payload in SPLSimon Glass
Add the basic code to create a handoff structure in SPL, so it can be passed to the next phase. For now this is not plumbed in. Signed-off-by: Simon Glass <[email protected]>
2024-07-29include: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-06-17spl: Introduce SoC specific init functionLukas Funke
Some architectures use spl_board_init() in their SoC specific implementation. Board developers should be able to add board specific implementation via spl_board_init(). Hence, introduce a spl_soc_init() method which is called right before spl_board_init() for SoC specific implementation. Signed-off-by: Lukas Funke <[email protected]> Reviewed-by: Devarsh Thakkar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
2024-01-29spl: Enforce framebuffer reservation from end of RAMDevarsh Thakkar
Add an API which enforces framebuffer reservation from end of RAM. This is done so that next stage can directly skip this region before carrying out further reservations. Signed-off-by: Devarsh Thakkar <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-11-16spl: legacy: Split off LZMA decompression into its own functionSean Anderson
To allow for easier reuse of this functionality, split it off into its own function. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-11-16spl: Only support bl_len when we have toSean Anderson
Aligning addresses and sizes causes overhead which is unnecessary when we are not loading from block devices. Remove bl_len when it is not needed. For example, on iot2050 we save 144 bytes with this patch (once the rest of this series is applied): add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144) Function old new delta spl_load_simple_fit 920 904 -16 load_simple_fit 496 444 -52 spl_spi_load_image 384 308 -76 Total: Before=87431, After=87287, chg -0.16% We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still need to be able to compile it for things like mmc_load_image_raw_sector, even if that function will not be used. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-11-16spl: Remove filename from spl_load_infoSean Anderson
For filesystems, filename serves the same purpose as priv. However, spl_load_fit_image also uses it to determine whether to use a DMA-aligned buffer. This is beneficial for FAT, which uses a bounce-buffer if the destination is not DMA-aligned. However, this is unnecessary now that filesystems set bl_len to ARCH_DMA_MINALIGN instead. With this done, we can remove filename entirely. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-11-16spl: Refactor spl_load_info->read to use units of bytesSean Anderson
Simplify things a bit for callers of spl_load_info->read by refactoring it to use units of bytes instead of bl_len. This generally simplifies the logic, as MMC is the only loader which actually works in sectors. It will also allow further refactoring to remove the special-case handling of filename. spl_load_legacy_img already works in units of bytes (oops) so it doesn't need to be changed. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-11-16spl: Remove dev from spl_load_infoSean Anderson
dev and priv serve the same purpose, and are never set at the same time. Remove dev and convert all users to priv. While we're at it, reorder bl_len to be last for better alignment. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-24Merge tag 'u-boot-imx-20231024' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20231024 ------------------- CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/18211 - Fixes for MC2432 Eeprom - i.MX93 ADC - Secondary boot mode on i.MX8M
2023-10-17test: spl: Add a test for the SPI load methodSean Anderson
Add test for the SPI load method. This one is pretty straightforward. We can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image doesn't know the total image size and has to guess from fdt_totalsize. This doesn't include external data, so loading it will fail. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-17test: spl: Add a test for the MMC load methodSean Anderson
Add a test for the MMC load method. This shows the general shape of tests to come: The main test function calls do_spl_test_load with an appropriate callback to write the image to the medium. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-17spl: Add callbacks to invalidate cached devicesSean Anderson
Several SPL functions try to avoid performing initialization twice by caching devices. This is fine for regular boot, but does not work with UNIT_TEST, since all devices are torn down after each test. Add some functions to invalidate the caches which can be called before testing these load methods. Signed-off-by: Sean Anderson <[email protected]>
2023-10-17spl: mmc: Introduce proper layering for spl_mmc_get_uboot_raw_sector()Marek Vasut
Introduce two new weak functions, arch_spl_mmc_get_uboot_raw_sector() and board_spl_mmc_get_uboot_raw_sector(), each of which can be overridden at a matching level, that is arch/ and board/ , in addition to the existing weak function spl_mmc_get_uboot_raw_sector(). This way, architecture code can define a default architecture specific implementation of arch_spl_mmc_get_uboot_raw_sector(), while the board code can override that using board_spl_mmc_get_uboot_raw_sector() which takes precedence over the architecture code. In some sort of unlikely special case where code has to take precedence over board code too, the spl_mmc_get_uboot_raw_sector() is still left out to be a weak function, but it should be unlikely that this is ever needed to be overridden. Signed-off-by: Marek Vasut <[email protected]>
2023-10-16spl: fit: Add board level function to decide application of DTOMarek Vasut
Add board-specific function used to indicate whether a DTO from fitImage configuration node 'fdt' property DT and DTO list should be applied onto the base DT or not applied. This is useful in case of DTOs which implement e.g. different board revision details, where such DTO should be applied on one board revision, and should not be applied on another board revision. Signed-off-by: Marek Vasut <[email protected]>
2023-10-09spl: add __noreturn attribute to spl_invoke_atf functionChanho Park
spl_invoke_atf function will not be returned to SPL. Thus, we need to set __noreturn function attribute to the function. Signed-off-by: Chanho Park <[email protected]>
2023-10-08Merge tag 'u-boot-rockchip-20231007' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-rockchip - Add Board: rk3568 Bananapi R2Pro; - Update pcie bifurcation support; - dwc_eth_qos controller support for rk3568 and rk3588; - Compressed binary support for U-Boot on rockchip platform; - dts and config updates for different board and soc; [ trini: Fix conflict on include/spl.h ] Signed-off-by: Tom Rini <[email protected]>
2023-10-07spl: fit: support for booting a LZMA-compressed U-boot binaryManoj Sai
If LZMA Compression support is enabled, LZMA compressed U-Boot binary will be placed at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assigned as the source address. image_decomp() function, will decompress the LZMA compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai <[email protected]> Signed-off-by: Suniel Mahesh <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Kever Yang <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-10-07spl: fit: support for booting a GZIP-compressed U-boot binaryManoj Sai
If GZIP Compression support is enabled, GZIP compressed U-Boot binary will be at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assign it as the source address. gunzip function in spl_load_fit_image ,will decompress the GZIP compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai <[email protected]> Signed-off-by: Suniel Mahesh <[email protected]> Reviewed-by: Kever Yang <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-10-06spl: Add C-based runtime detection of SPLSimon Glass
The spl_phase() function indicates whether U-Boot is in SPL and before or after relocation. But sometimes it is useful to check for SPL with zero code-size impact. Since spl_phase() checks the global_data flags, it does add a few bytes. Add a new spl_in_proper() function to check if U-Boot proper is running, regardless of the relocation status. Signed-off-by: Simon Glass <[email protected]>
2023-10-06spl: Move the full FIT code to spl_fit.cSimon Glass
For some reason this code was put in the main spl.c file. Move it out to the FIT implementation where it belongs. Signed-off-by: Simon Glass <[email protected]>
2023-10-06spl: Drop the switch() statement for OS selectionSimon Glass
This code is pretty ugly, with many #ifdefs There are quite a lot of IH_OS_U_BOOT values so the compiler struggles to create a jump table here. Also, most of the options are normally disabled. Change it to an else...if construct instead. Add an accessor for the spl_image field behind an #ifdef to avoid needing #ifdef in the C code. Signed-off-by: Simon Glass <[email protected]>
2023-10-06spl: Drop #ifdefs for BOARD_INIT and watchdogSimon Glass
Avoid using the preprocessor for these checks. Signed-off-by: Simon Glass <[email protected]>
2023-10-02Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <[email protected]>
2023-09-30Convert CFG_SYS_UBOOT_START to KconfigJesse Taube
Commit 65cc0e2a65d2 ("global: Move remaining CONFIG_SYS_* to CFG_SYS_*") renamed CONFIG_SYS_UBOOT_START to CFG_SYS_UBOOT_START. Unfortunately, this meant that the value was no longer available to the Makefile. This caused imxrt to fail to boot. All the other boards that used this variable were unaffected because they were using the default value which is CONFIG_TEXT_BASE. This commit converts CFG_SYS_UBOOT_START to Kconfig and sets the default value to CONFIG_TEXT_BASE. Suggested-by: Marek Vasut <[email protected]> Suggested-by: Tom Rini <[email protected]> Signed-off-by: Jesse Taube <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-09-05spl: add __noreturn attribute to spl_invoke_opensbi functionChanho Park
spl_invoke_opensbi function is not returned to SPL. Thus, we need to set __noreturn function attribute. Signed-off-by: Chanho Park <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2023-07-20spl: Correct spl_board_boot_device function prototypeTom Rini
With gcc-13.1 we get a warning about enum vs int here, so correct the declaration to match the implementation. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Simon Glass <[email protected]>