u-boot/common/spl
Sean Anderson 775074165d spl: Add generic spl_load function
Implementers of SPL_LOAD_IMAGE_METHOD have to correctly determine what
type of image is being loaded and then call the appropriate image load
function correctly. This is tricky, because some image load functions
expect the whole image to already be loaded (CONFIG_SPL_LOAD_FIT_FULL),
some will load the image automatically using spl_load_info.read()
(CONFIG_SPL_LOAD_FIT/CONFIG_SPL_LOAD_IMX_CONTAINER), and some just parse
the header and expect the caller to do the actual loading afterwards
(legacy/raw images). Load methods often only support a subset of the
above methods, meaning that not all image types can be used with all
load methods. Further, the code to invoke these functions is
duplicated between different load functions.

To address this problem, this commit introduces a "spl_load" function.
It aims to handle image detection and correct invocation of each of the
parse/load functions.

Although this function generally results in a size reduction with
several users, it tends to bloat boards with only a single user.
This is generally because programmers open-coding the contents of this
function can make optimizations based on the specific loader. For
example, NOR flash is memory-mapped, so it never bothers calling
load->read. The compiler can't really make these optimizations across
translation units. LTO solves this, but it is only available on some
arches. To address this, perform "pseudo-LTO" by inlining spl_load when
there are one or fewer users. At the moment, there are no users, so
define SPL_LOAD_USERS to be 0.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16 13:49:14 -05:00
..
Kconfig spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
Kconfig.nxp spl: Use CONFIG_SPL... instead of CONFIG_..._SPL_... 2023-10-06 14:38:11 -04:00
Kconfig.tpl Kconfigs: Correct default of "0" on hex type entries 2023-08-09 09:21:42 -04:00
Kconfig.vpl vbe: Add Kconfig options for VPL 2022-10-31 11:03:59 -04:00
Makefile Move i.MX8 container image loading support to common/spl 2023-10-17 20:50:52 -04:00
spl.c spl: Add generic spl_load function 2023-11-16 13:49:14 -05:00
spl_atf.c spl: add __noreturn attribute to spl_invoke_atf function 2023-10-09 15:24:31 -04:00
spl_blk_fs.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_bootrom.c spl: pass args to board_return_to_bootrom 2019-10-08 16:35:16 +02:00
spl_dfu.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
spl_ext.c spl: Use map_sysmem where appropriate 2023-10-17 20:50:52 -04:00
spl_fat.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_fit.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_imx_container.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_legacy.c spl: legacy: Split off LZMA decompression into its own function 2023-11-16 13:49:14 -05:00
spl_mmc.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_nand.c spl: nand: Remove spl_nand_legacy_read 2023-11-16 13:49:14 -05:00
spl_net.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_nor.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_nvme.c spl: initialize PCI before booting 2023-07-30 18:53:08 +02:00
spl_onenand.c treewide: Drop image_header_t typedef 2022-09-29 16:07:57 -04:00
spl_opensbi.c spl: riscv: add os type for next booting stage 2023-10-19 17:29:33 +08:00
spl_optee.S Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE 2022-10-31 11:01:31 -04:00
spl_ram.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_sata.c spl: sata: Rework the loading case it not use IS_ENABLED(...) 2023-01-20 12:27:06 -05:00
spl_sdp.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
spl_semihosting.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_spi.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00
spl_ubi.c spl: Rename SYS_SPL_ARGS_ADDR to SPL_PAYLOAD_ARGS_ADDR 2023-10-06 14:38:11 -04:00
spl_usb.c blk: Rename if_type to uclass_id 2022-09-25 08:30:05 -06:00
spl_xip.c spl: Rename SYS_SPL_ARGS_ADDR to SPL_PAYLOAD_ARGS_ADDR 2023-10-06 14:38:11 -04:00
spl_ymodem.c spl: Only support bl_len when we have to 2023-11-16 13:49:14 -05:00