aboutsummaryrefslogtreecommitdiff
path: root/include/spl.h
AgeCommit message (Collapse)AuthorFilesLines
2024-10-11spl: Rename SPL_TPL_NAME and SPL_TPL_PROMPTSimon Glass1-7/+7
Rename these to use the word PHASE instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11include: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILDSimon Glass1-7/+7
Use the new symbol to refer to any 'SPL' build, including TPL and VPL Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_phase_prefix() and spl_phase_name()Simon Glass1-4/+4
Use simpler names for these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_next_phase() and spl_prev_phase()Simon Glass1-4/+4
Rename this to use the xpl prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Add a function to indicate when in xPLSimon Glass1-0/+10
Add the opposite function to not_xpl() for completeness. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_in_proper() to not_xpl()Simon Glass1-2/+2
Give this function a slightly easier name. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_phase() to xpl_phase()Simon Glass1-5/+5
Rename this function to indicate that it refers to any xPL phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_phase to xpl_phase_tSimon Glass1-6/+6
This name fits better with the new naming scheme, so update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename u_boot_first_phase to xpl_is_first_phase()Simon Glass1-6/+8
This is a better name for this function, so update it. Tidy up the function comment to mention VPL. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-23spl: Create a function to init spl_load_infoSimon Glass1-14/+30
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 <sjg@chromium.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-08-23spl: Use unified inline functions for spl_load_infoSimon Glass1-11/+7
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 <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-08-09upl: Add support for Universal Payload in SPLSimon Glass1-0/+16
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 <sjg@chromium.org>
2024-07-29include: Remove duplicate newlinesMarek Vasut1-1/+0
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-06-17spl: Introduce SoC specific init functionLukas Funke1-0/+8
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 <lukas.funke@weidmueller.com> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Link: https://lore.kernel.org/r/20240327121153.2455126-2-lukas.funke-oss@weidmueller.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-01-29spl: Enforce framebuffer reservation from end of RAMDevarsh Thakkar1-0/+10
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 <devarsht@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: legacy: Split off LZMA decompression into its own functionSean Anderson1-0/+13
To allow for easier reuse of this functionality, split it off into its own function. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: Only support bl_len when we have toSean Anderson1-0/+25
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: Remove filename from spl_load_infoSean Anderson1-2/+0
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: Refactor spl_load_info->read to use units of bytesSean Anderson1-7/+11
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: Remove dev from spl_load_infoSean Anderson1-3/+1
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24Merge tag 'u-boot-imx-20231024' of ↵Tom Rini1-0/+26
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 Anderson1-0/+10
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the MMC load methodSean Anderson1-0/+4
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Add callbacks to invalidate cached devicesSean Anderson1-0/+22
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 <seanga2@gmail.com>
2023-10-17spl: mmc: Introduce proper layering for spl_mmc_get_uboot_raw_sector()Marek Vasut1-0/+26
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 <marex@denx.de>
2023-10-16spl: fit: Add board level function to decide application of DTOMarek Vasut1-0/+16
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 <marex@denx.de>
2023-10-09spl: add __noreturn attribute to spl_invoke_atf functionChanho Park1-1/+1
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 <chanho61.park@samsung.com>
2023-10-08Merge tag 'u-boot-rockchip-20231007' of ↵WIP/08Oct2023Tom Rini1-0/+9
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 <trini@konsulko.com>
2023-10-07spl: fit: support for booting a LZMA-compressed U-boot binaryManoj Sai1-1/+1
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 <abbaraju.manojsai@amarulasolutions.com> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-07spl: fit: support for booting a GZIP-compressed U-boot binaryManoj Sai1-0/+10
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 <abbaraju.manojsai@amarulasolutions.com> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-06spl: Add C-based runtime detection of SPLSimon Glass1-0/+10
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 <sjg@chromium.org>
2023-10-06spl: Move the full FIT code to spl_fit.cSimon Glass1-0/+11
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 <sjg@chromium.org>
2023-10-06spl: Drop the switch() statement for OS selectionSimon Glass1-0/+9
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 <sjg@chromium.org>
2023-10-06spl: Drop #ifdefs for BOARD_INIT and watchdogSimon Glass1-2/+6
Avoid using the preprocessor for these checks. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-02Merge branch 'next'Tom Rini1-1/+1
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-09-30Convert CFG_SYS_UBOOT_START to KconfigJesse Taube1-1/+1
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 <marek.vasut+renesas@gmail.com> Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-05spl: add __noreturn attribute to spl_invoke_opensbi functionChanho Park1-1/+1
spl_invoke_opensbi function is not returned to SPL. Thus, we need to set __noreturn function attribute. Signed-off-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2023-07-20spl: Correct spl_board_boot_device function prototypeTom Rini1-1/+2
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 <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-05Merge tag 'v2023.07-rc6' into nextTom Rini1-6/+0
Prepare v2023.07-rc6
2023-06-24imx: hab: Simplify the mechanismMarek Vasut1-6/+0
The current mechanism is unnecessarily complex. Simplify the whole mechanism such that the entire fitImage is signed, IVT is placed at the end, followed by CSF, and this entire bundle is also authenticated. This makes the signing scripting far simpler. Signed-off-by: Marek Vasut <marex@denx.de>
2023-06-19spl: blk: Support loading images from fsMayuresh Chitale1-0/+3
Add a generic API to support loading of SPL payload from any supported filesystem on a given partition of a block device. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-03-22spl: Add function prototype for spl_mmc_get_uboot_raw_sectorTom Rini1-0/+13
We did not add a prototype for spl_mmc_get_uboot_raw_sector to include/spl.h before, so add and document one now. Correct the incorrect prototype in board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c and ensure that we have spl.h where we define a non-weak spl_mmc_get_uboot_raw_sector as well. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-03-09spl: Add missing prototype for board_boot_orderAlgapally Santosh Sagar1-0/+1
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'board_boot_order' [-Wmissing-prototypes]. Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Link: https://lore.kernel.org/r/20230301103334.1455-3-ashok.reddy.soma@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-01-27spl: doc: use correct name in jump_to_image_optee() descriptionOvidiu Panait1-1/+1
The actual function being documented is jump_to_image_optee(), not jump_to_image_linux(). Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-12-05global: Move remaining CONFIG_SYS_* to CFG_SYS_*Tom Rini1-1/+1
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-31vbe: Add a command to show the VBE stateSimon Glass1-0/+2
Add a VBE comment which shows the current state. Currently this is just the phases which booted via VBE. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31sandbox: Support obtaining the next phase from an imageSimon Glass1-0/+3
At present sandbox runs the next phase from discrete executables, so for example u-boot-tpl runs u-boot-vpl to get to the next phase. In some cases the phases are all built into a single firmware image, as is done for real boards. Add support for this to sandbox. Make it higher priority so that it takes precedence over the existing method. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31sandbox: Generalise SPL bootingSimon Glass1-0/+9
At present sandbox only supports jumping to a file, to get to the next U-Boot phase. We want to support other methods, so update the code to use an enum for the method. Also use the Use board_boot_order() to set the order, so we can add more options. Also add the MMC methods into the BOOT_DEVICE enum so that booting from MMC can be supported. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31spl: Use binman suffix allow symbols of any SPL etypeSimon Glass1-4/+4
At present we use symbols for the u-boot-spl entry, but this is not always what we want. For example, sandbox actually jumps to a u-boot-spl-elf entry, since sandbox executables are ELF files. We already handle this with U-Boot by using the '-any' suffix. Add it for SPL as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASESimon Glass1-2/+2
The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE and this makes it imposible to use CONFIG_VAL(). Rename it to resolve this problem. Signed-off-by: Simon Glass <sjg@chromium.org>