diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/image-fit.c | 25 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 11 |
2 files changed, 34 insertions, 2 deletions
diff --git a/common/image-fit.c b/common/image-fit.c index 7f17fd1410..b785d8a36e 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -807,6 +807,31 @@ int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset) } /** + * Get 'data-position' property from a given image node. + * + * @fit: pointer to the FIT image header + * @noffset: component image node offset + * @data_position: holds the data-position property + * + * returns: + * 0, on success + * -ENOENT if the property could not be found + */ +int fit_image_get_data_position(const void *fit, int noffset, + int *data_position) +{ + const fdt32_t *val; + + val = fdt_getprop(fit, noffset, FIT_DATA_POSITION_PROP, NULL); + if (!val) + return -ENOENT; + + *data_position = fdt32_to_cpu(*val); + + return 0; +} + +/** * Get 'data-size' property from a given image node. * * @fit: pointer to the FIT image header diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 72ae8f4c50..cc07fbc8a0 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -173,6 +173,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, int align_len = ARCH_DMA_MINALIGN - 1; uint8_t image_comp = -1, type = -1; const void *data; + bool external_data = false; if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) { if (fit_image_get_comp(fit, node, &image_comp)) @@ -189,9 +190,15 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, if (fit_image_get_load(fit, node, &load_addr)) load_addr = image_info->load_addr; - if (!fit_image_get_data_offset(fit, node, &offset)) { - /* External data */ + if (!fit_image_get_data_position(fit, node, &offset)) { + external_data = true; + } else if (!fit_image_get_data_offset(fit, node, &offset)) { offset += base_offset; + external_data = true; + } + + if (external_data) { + /* External data */ if (fit_image_get_data_size(fit, node, &len)) return -ENOENT; |