diff options
author | Haoran.Wang <elven.wang@nxp.com> | 2019-07-22 17:45:49 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2020-05-15 17:34:22 +0800 |
commit | 7788f3c6c8e47271dc9bd457fb5c56afff7b47e1 (patch) | |
tree | 776c9934fbdddf3294b600d814e37421db46adee /lib | |
parent | 7ed79c9a987db289588887ece1392b1edfff4468 (diff) |
MA-15181 use correct API in SPL to get mmc index
Due SPL doesn't have env, so cannot use mmc_get_env_dev() get
the mmc index.
Following spl_mmc.c get correct mmc index in SPL.
Change-Id: I0f07a9ea35d5b3ba0d638af436238d0cfe925981
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
(cherry picked from commit 6e4753b4dc0c5bde5aa573b42cb6b7caa6a95bc9)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/avb/fsl/fsl_avbkey.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/avb/fsl/fsl_avbkey.c b/lib/avb/fsl/fsl_avbkey.c index 2624b063bd..8f7f3d02ae 100644 --- a/lib/avb/fsl/fsl_avbkey.c +++ b/lib/avb/fsl/fsl_avbkey.c @@ -26,6 +26,10 @@ #include "trusty/hwcrypto.h" #include "fsl_atx_attributes.h" +#if defined(CONFIG_SPL_BUILD) +#include <spl.h> +#endif + #define INITFLAG_FUSE_OFFSET 0 #define INITFLAG_FUSE_MASK 0x00000001 #define INITFLAG_FUSE 0x00000001 @@ -61,13 +65,36 @@ void fill_secure_keyslot_package(struct keyslot_package *kp) { 0x100)); } +#if defined(CONFIG_SPL_BUILD) +static int spl_mmc_get_device_index(u32 boot_device) +{ + switch (boot_device) { + case BOOT_DEVICE_MMC1: + return 0; + case BOOT_DEVICE_MMC2: + case BOOT_DEVICE_MMC2_2: + return 1; + } + +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT + printf("spl: unsupported mmc boot device.\n"); +#endif + + return -ENODEV; +} +#endif + int read_keyslot_package(struct keyslot_package* kp) { char original_part; int blksz; unsigned char* fill = NULL; int ret = 0; /* load tee from boot1 of eMMC. */ +#if defined(CONFIG_SPL_BUILD) + int mmcc = spl_mmc_get_device_index(spl_boot_device()); +#else int mmcc = mmc_get_env_dev(); +#endif struct blk_desc *dev_desc = NULL; struct mmc *mmc; |