diff options
author | Ye Li <ye.li@nxp.com> | 2018-06-05 03:30:37 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2022-04-06 15:58:47 +0800 |
commit | 965bf8e05a285f25574dfc4e5486797c4ae5df26 (patch) | |
tree | e3533bc4b9ce36eab554dbe670bb4e1cc262a918 /common | |
parent | ffc105845732e1dd4a8f31b4d104c10f6c3cac1f (diff) |
MLK-18591-6 android: iot: Add boot Trusty OS codes for i.MX SoCs
Use trusty_os_init to load Trusty OS from CONFIG_TRUSTY_OS_ENTRY
before u-boot ready.
Add Trusty OS SOC level codes and u-boot/SPL common codes.
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
(cherry picked from commit 1ae9ecc73f5001b8bd743011c06a7d07861be64e)
(cherry picked from commit 6fa4f4a42fd90631f8dc8303b17f600c085d8595)
(cherry picked from commit d5046e6f021f3d55c58e8b46b13ac3e8e1761755)
(cherry picked from commit e1588a2741dfd0f37421e13ceb5e310e0b35d3bf)
(cherry picked from commit 6eae7a4c237199be90984f03f5c396e0d63b34f1)
Diffstat (limited to 'common')
-rw-r--r-- | common/board_r.c | 12 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 24 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 23 |
3 files changed, 58 insertions, 1 deletions
diff --git a/common/board_r.c b/common/board_r.c index c885e46760..244c22dd6d 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -599,6 +599,15 @@ static int initr_check_fastboot(void) } #endif +#ifdef CONFIG_IMX_TRUSTY_OS +extern void tee_setup(void); +static int initr_tee_setup(void) +{ + tee_setup(); + return 0; +} +#endif + static int run_main_loop(void) { #ifdef CONFIG_SANDBOX @@ -822,6 +831,9 @@ static init_fnc_t init_sequence_r[] = { #if defined(AVB_RPMB) && !defined(CONFIG_SPL) initr_avbkey, #endif +#ifdef CONFIG_IMX_TRUSTY_OS + initr_tee_setup, +#endif #ifdef CONFIG_FSL_FASTBOOT initr_check_fastboot, #endif diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 1bbf824684..967c20a452 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -218,6 +218,15 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size, return (data_size + info->bl_len - 1) / info->bl_len; } +#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS) +__weak int get_tee_load(ulong *load) +{ + /* default return ok */ + return 0; +} + +#endif + /** * spl_load_fit_image(): load the image described in a certain FIT node * @info: points to information about the device to load data from @@ -272,6 +281,21 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, load_addr = image_info->load_addr; } +#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS) + char *desc = NULL; + + if (fit_get_desc(fit, node, &desc)) { + printf("can't found node description!\n"); + return -ENOENT; + } else if (!strncmp(desc, "TEE firmware", + strlen("TEE firmware"))) { + if (get_tee_load(&load_addr)) { + printf("Failed to get TEE load address!\n"); + return -ENOENT; + } + } +#endif + if (!fit_image_get_data_position(fit, node, &offset)) { external_data = true; } else if (!fit_image_get_data_offset(fit, node, &offset)) { diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 1c41d24ff4..163e3c6f7d 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -77,6 +77,11 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part) return 0; } +#if defined(CONFIG_IMX_TRUSTY_OS) +/* Pre-declaration of check_rpmb_blob. */ +int check_rpmb_blob(struct mmc *mmc); +#endif + static __maybe_unused int mmc_load_image_raw_sector(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, @@ -130,7 +135,23 @@ end: return -1; } - return 0; + /* Images loaded, now check the rpmb keyblob for Trusty OS. + * Skip this step when the dual bootloader feature is enabled + * since the blob should be checked earlier. + */ +#if defined(CONFIG_IMX_TRUSTY_OS) + if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { +#if !defined(CONFIG_DUAL_BOOTLOADER) + ret = check_rpmb_blob(mmc); +#endif + } else { +#if !defined(CONFIG_AVB_ATX) + ret = check_rpmb_blob(mmc); +#endif + } +#endif + + return ret; } static int spl_mmc_get_device_index(u32 boot_device) |