summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bl2/bl2_image_load_v2.c8
-rw-r--r--docs/porting-guide.rst23
-rw-r--r--include/plat/common/platform.h3
-rw-r--r--plat/common/platform_helpers_default.c12
4 files changed, 38 insertions, 8 deletions
diff --git a/bl2/bl2_image_load_v2.c b/bl2/bl2_image_load_v2.c
index 6517703d..ebbad45e 100644
--- a/bl2/bl2_image_load_v2.c
+++ b/bl2/bl2_image_load_v2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -54,6 +54,12 @@ entry_point_info_t *bl2_load_images(void)
}
}
+ err = bl2_plat_handle_pre_image_load(bl2_node_info->image_id);
+ if (err) {
+ ERROR("BL2: Failure in pre image load handling (%i)\n", err);
+ plat_error_handler(err);
+ }
+
if (!(bl2_node_info->image_info->h.attr & IMAGE_ATTRIB_SKIP_LOADING)) {
INFO("BL2: Loading image id %d\n", bl2_node_info->image_id);
err = load_auth_image(bl2_node_info->image_id,
diff --git a/docs/porting-guide.rst b/docs/porting-guide.rst
index 7683ded0..57da340a 100644
--- a/docs/porting-guide.rst
+++ b/docs/porting-guide.rst
@@ -1424,10 +1424,22 @@ The purpose of this function is to return a pointer to a ``meminfo`` structure
populated with the extents of secure RAM available for BL2 to use. See
``bl2_early_platform_setup()`` above.
-Following function is required only when LOAD\_IMAGE\_V2 is enabled.
+Following functions are optionally used only when LOAD\_IMAGE\_V2 is enabled.
-Function : bl2\_plat\_handle\_post\_image\_load() [mandatory]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Function : bl2\_plat\_handle\_pre\_image\_load() [optional]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+ Argument : unsigned int
+ Return : int
+
+This function can be used by the platforms to update/use image information
+for given ``image_id``. This function is currently invoked in BL2 before
+loading each image, when LOAD\_IMAGE\_V2 is enabled.
+
+Function : bl2\_plat\_handle\_post\_image\_load() [optional]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
@@ -1435,9 +1447,8 @@ Function : bl2\_plat\_handle\_post\_image\_load() [mandatory]
Return : int
This function can be used by the platforms to update/use image information
-for given ``image_id``. This function is currently invoked in BL2 to handle
-BL image specific information based on the ``image_id`` passed, when
-LOAD\_IMAGE\_V2 is enabled.
+for given ``image_id``. This function is currently invoked in BL2 after
+loading each image, when LOAD\_IMAGE\_V2 is enabled.
Following functions are required only when LOAD\_IMAGE\_V2 is disabled.
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index 09601058..69a2957a 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -169,6 +169,7 @@ struct meminfo *bl2_plat_sec_mem_layout(void);
* This function can be used by the platforms to update/use image
* information for given `image_id`.
*/
+int bl2_plat_handle_pre_image_load(unsigned int image_id);
int bl2_plat_handle_post_image_load(unsigned int image_id);
#else /* LOAD_IMAGE_V2 */
diff --git a/plat/common/platform_helpers_default.c b/plat/common/platform_helpers_default.c
index 75c5199d..597a5850 100644
--- a/plat/common/platform_helpers_default.c
+++ b/plat/common/platform_helpers_default.c
@@ -13,6 +13,8 @@
#pragma weak plat_error_handler
#pragma weak bl2_plat_preload_setup
+#pragma weak bl2_plat_handle_pre_image_load
+#pragma weak bl2_plat_handle_post_image_load
#pragma weak plat_try_next_boot_source
void __dead2 plat_error_handler(int err)
@@ -25,6 +27,16 @@ void bl2_plat_preload_setup(void)
{
}
+int bl2_plat_handle_pre_image_load(unsigned int image_id)
+{
+ return 0;
+}
+
+int bl2_plat_handle_post_image_load(unsigned int image_id)
+{
+ return 0;
+}
+
int plat_try_next_boot_source(void)
{
return 0;