diff options
| author | Tom Rini <[email protected]> | 2025-05-04 08:51:43 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-05-04 08:51:43 -0600 |
| commit | dcea465e5e299903b889f5f426eac6d6523cbf84 (patch) | |
| tree | 9ead94204004efef6be0c1b1942a6d194426db7c /common | |
| parent | 0c8a89d252c3db3401ffa572ee2e4dfcb94e2c3b (diff) | |
| parent | fbe176c39c896e3dcec356bd3153074d411d487e (diff) | |
Merge tag 'u-boot-imx-master-20250503' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/26064
- Add i.MX95 support.
- Enable BOOTAUX on the i.MX8M Beacon boards.
Diffstat (limited to 'common')
| -rw-r--r-- | common/spl/Kconfig | 6 | ||||
| -rw-r--r-- | common/spl/spl_imx_container.c | 38 |
2 files changed, 38 insertions, 6 deletions
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index b076f49ac00..0bc96d0a781 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -363,6 +363,12 @@ config SPL_LOAD_IMX_CONTAINER Support booting U-Boot from an i.MX8 container image. If you are not using i.MX8, say 'n'. +config SPL_IMX_CONTAINER_USE_TRAMPOLINE + bool + depends on SPL + help + Enable SPL load reader to load data to a trampoline buffer. + config IMX_CONTAINER_CFG string "i.MX8 Container config file" depends on SPL && SPL_LOAD_IMX_CONTAINER diff --git a/common/spl/spl_imx_container.c b/common/spl/spl_imx_container.c index 2c31777fcd3..b3565efb225 100644 --- a/common/spl/spl_imx_container.c +++ b/common/spl/spl_imx_container.c @@ -14,6 +14,16 @@ #include <asm/mach-imx/ahab.h> #endif +__weak bool arch_check_dst_in_secure(void *start, ulong size) +{ + return false; +} + +__weak void *arch_get_container_trampoline(void) +{ + return NULL; +} + static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image, struct spl_load_info *info, struct container_hdr *container, @@ -22,6 +32,7 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image, { struct boot_img_t *images; ulong offset, overhead, size; + void *buf, *trampoline; if (image_index > container->num_images) { debug("Invalid image number\n"); @@ -42,12 +53,27 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image, debug("%s: container: %p offset: %lu size: %lu\n", __func__, container, offset, size); - if (info->read(info, offset, size, - map_sysmem(images[image_index].dst - overhead, - images[image_index].size)) < - images[image_index].size) { - printf("%s wrong\n", __func__); - return NULL; + + buf = map_sysmem(images[image_index].dst - overhead, images[image_index].size); + if (IS_ENABLED(CONFIG_SPL_IMX_CONTAINER_USE_TRAMPOLINE) && + arch_check_dst_in_secure(buf, size)) { + trampoline = arch_get_container_trampoline(); + if (!trampoline) { + printf("%s: trampoline size is zero\n", __func__); + return NULL; + } + + if (info->read(info, offset, size, trampoline) < images[image_index].size) { + printf("%s: failed to load image to a trampoline buffer\n", __func__); + return NULL; + } + + memcpy(buf, trampoline, images[image_index].size); + } else { + if (info->read(info, offset, size, buf) < images[image_index].size) { + printf("%s: failed to load image to a non-secure region\n", __func__); + return NULL; + } } #ifdef CONFIG_AHAB_BOOT |
