aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
authorSherry Zhang <sherry.zhang2@arm.com>2021-05-10 16:59:05 +0800
committerSherry Zhang <sherry.zhang2@arm.com>2021-05-26 12:56:38 +0800
commit2da977d7e463cc150991f2b0f6a502a457713a08 (patch)
treea985fb8e1ec3764df8c16f3f827e3243e404354e /interface
parent117b352793ca7afe93ccb8b3f54c468225d668a4 (diff)
downloadtrusted-firmware-m-2da977d7e463cc150991f2b0f6a502a457713a08.tar.gz
FWU: Add checking the state of the running image
The Firmware Update partition reads the image_ok flag to check whether the running image has been confirmed. The running image state is set according to this flag in psa_fwu_query(). Change-Id: I9cf58b7d6f3b87a50e0ac6f926e30170bb01b8f1 Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Diffstat (limited to 'interface')
-rw-r--r--interface/include/psa/update.h4
-rw-r--r--interface/src/tfm_firmware_update_func_api.c7
-rw-r--r--interface/src/tfm_firmware_update_ipc_api.c7
3 files changed, 13 insertions, 5 deletions
diff --git a/interface/include/psa/update.h b/interface/include/psa/update.h
index 65d7d2dd6..d7de5ac9d 100644
--- a/interface/include/psa/update.h
+++ b/interface/include/psa/update.h
@@ -207,6 +207,8 @@ psa_status_t psa_fwu_request_reboot(void);
/**
* \brief Indicates to the implementation that the upgrade was successful.
*
+ * \param[in] image_id The image_id of the image to query
+ *
* \return A status indicating the success/failure of the operation
*
* \retval PSA_SUCCESS The image and its dependencies have
@@ -217,7 +219,7 @@ psa_status_t psa_fwu_request_reboot(void);
* \retval PSA_ERROR_NOT_PERMITTED The caller is not permitted to make
* this call
*/
-psa_status_t psa_fwu_accept(void);
+psa_status_t psa_fwu_accept(psa_image_id_t image_id);
/**
* \brief Stores a manifest object and associates it with a particular image ID.
diff --git a/interface/src/tfm_firmware_update_func_api.c b/interface/src/tfm_firmware_update_func_api.c
index 487028897..5100d4439 100644
--- a/interface/src/tfm_firmware_update_func_api.c
+++ b/interface/src/tfm_firmware_update_func_api.c
@@ -122,12 +122,15 @@ psa_status_t psa_fwu_request_reboot(void)
return status;
}
-psa_status_t psa_fwu_accept(void)
+psa_status_t psa_fwu_accept(psa_image_id_t image_id)
{
psa_status_t status;
+ psa_invec in_vec[] = {
+ { .base = &image_id, .len = sizeof(image_id) }
+ };
status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_accept_req_veneer,
- (uint32_t)NULL, 0,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)NULL, 0);
if (status == (psa_status_t)TFM_ERROR_INVALID_PARAMETER) {
diff --git a/interface/src/tfm_firmware_update_ipc_api.c b/interface/src/tfm_firmware_update_ipc_api.c
index a21a3339f..60d4b2e6d 100644
--- a/interface/src/tfm_firmware_update_ipc_api.c
+++ b/interface/src/tfm_firmware_update_ipc_api.c
@@ -155,10 +155,13 @@ psa_status_t psa_fwu_request_reboot(void)
return status;
}
-psa_status_t psa_fwu_accept(void)
+psa_status_t psa_fwu_accept(psa_image_id_t image_id)
{
psa_handle_t handle;
psa_status_t status;
+ psa_invec in_vec[] = {
+ { .base = &image_id, .len = sizeof(image_id) }
+ };
handle = psa_connect(TFM_FWU_ACCEPT_SID,
TFM_FWU_ACCEPT_VERSION);
@@ -166,7 +169,7 @@ psa_status_t psa_fwu_accept(void)
return PSA_ERROR_GENERIC_ERROR;
}
- status = psa_call(handle, PSA_IPC_CALL, NULL, 0, NULL, 0);
+ status = psa_call(handle, PSA_IPC_CALL, in_vec, IOVEC_LEN(in_vec), NULL, 0);
psa_close(handle);