mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
feat(s32g274a): map each image before its loading
The regions used by the stages loaded by BL2 must be mapped before they can be used. Change-Id: Ia70f8c5f35d7930e2b20f1a26be0ad2cdfea2b1a Signed-off-by: Khristine Andreea Barbulescu <khristineandreea.barbulescu@nxp.com> Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
This commit is contained in:
parent
514c738045
commit
34fb2b35b9
1 changed files with 25 additions and 0 deletions
|
@ -4,9 +4,11 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <common/debug.h>
|
||||
#include <common/desc_image_load.h>
|
||||
#include <lib/mmio.h>
|
||||
#include <lib/xlat_tables/xlat_tables_v2.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <plat_console.h>
|
||||
#include <s32cc-clk-drv.h>
|
||||
|
@ -78,3 +80,26 @@ void bl2_el3_plat_arch_setup(void)
|
|||
{
|
||||
}
|
||||
|
||||
int bl2_plat_handle_pre_image_load(unsigned int image_id)
|
||||
{
|
||||
const struct bl_mem_params_node *desc = get_bl_mem_params_node(image_id);
|
||||
const struct image_info *img_info;
|
||||
size_t size;
|
||||
|
||||
if (desc == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
img_info = &desc->image_info;
|
||||
|
||||
if ((img_info == NULL) || (img_info->image_max_size == 0U)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
size = page_align(img_info->image_max_size, UP);
|
||||
|
||||
return mmap_add_dynamic_region(img_info->image_base,
|
||||
img_info->image_base,
|
||||
size,
|
||||
MT_MEMORY | MT_RW | MT_SECURE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue