FWU: Align to FWU API v1.0
'component' and 'component state' is newly introduced in
FWU API v1.0. The FWU process is now based on component
state other than image state.
Remove the image ID convertion layer as image ID is removed
in FWU API v1.0.
Update the shim layer between FWU and bootloader to fit the new
FWU APIs.
Update the FWU design document accordingly.
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: Idcbf2b643f22a5c6ec09869510d406662948c61d
diff --git a/interface/src/tfm_fwu_api.c b/interface/src/tfm_fwu_api.c
index 3cba758..f7565bf 100644
--- a/interface/src/tfm_fwu_api.c
+++ b/interface/src/tfm_fwu_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -10,56 +10,75 @@
#include "psa_manifest/sid.h"
#include "tfm_api.h"
-psa_status_t psa_fwu_write(const psa_image_id_t image_id,
- size_t block_offset,
+psa_status_t psa_fwu_start(psa_fwu_component_t component,
+ const void *manifest,
+ size_t manifest_size)
+{
+ psa_invec in_vec[] = {
+ { .base = &component, .len = sizeof(component) },
+ { .base = manifest, .len = manifest_size }
+ };
+
+ return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_START,
+ in_vec, IOVEC_LEN(in_vec), NULL, 0);
+}
+
+psa_status_t psa_fwu_write(psa_fwu_component_t component,
+ size_t image_offset,
const void *block,
size_t block_size)
{
psa_invec in_vec[] = {
- { .base = &image_id, .len = sizeof(image_id) },
- { .base = &block_offset, .len = sizeof(block_offset) },
+ { .base = &component, .len = sizeof(component) },
+ { .base = &image_offset, .len = sizeof(image_offset) },
{ .base = block, .len = block_size }
};
return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_WRITE,
+ in_vec, IOVEC_LEN(in_vec), NULL, 0);
+}
+
+psa_status_t psa_fwu_finish(psa_fwu_component_t component)
+{
+ psa_invec in_vec[] = {
+ { .base = &component, .len = sizeof(component) },
+ };
+
+ return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_FINISH,
in_vec, IOVEC_LEN(in_vec), NULL, 0);
}
-psa_status_t psa_fwu_install(const psa_image_id_t image_id,
- psa_image_id_t *dependency_uuid,
- psa_image_version_t *dependency_version)
+psa_status_t psa_fwu_install(void)
{
- psa_invec in_vec[] = {
- { .base = &image_id, .len = sizeof(image_id) }
- };
-
- psa_outvec out_vec[] = {
- { .base = dependency_uuid, .len = sizeof(*dependency_uuid) },
- { .base = dependency_version, .len = sizeof(*dependency_version)}
- };
-
- if ((dependency_uuid == NULL) || (dependency_version == NULL)) {
- return PSA_ERROR_INVALID_ARGUMENT;
- }
-
return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_INSTALL,
- in_vec, IOVEC_LEN(in_vec), out_vec, IOVEC_LEN(out_vec));
+ NULL, 0, NULL, 0);
}
-psa_status_t psa_fwu_abort(const psa_image_id_t image_id)
+psa_status_t psa_fwu_cancel(psa_fwu_component_t component)
{
psa_invec in_vec[] = {
- { .base = &image_id, .len = sizeof(image_id) }
+ { .base = &component, .len = sizeof(component) },
};
- return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_ABORT,
+ return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_CANCEL,
in_vec, IOVEC_LEN(in_vec), NULL, 0);
}
-psa_status_t psa_fwu_query(const psa_image_id_t image_id, psa_image_info_t *info)
+psa_status_t psa_fwu_clean(psa_fwu_component_t component)
{
psa_invec in_vec[] = {
- { .base = &image_id, .len = sizeof(image_id) }
+ { .base = &component, .len = sizeof(component) },
+ };
+
+ return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_CLEAN,
+ in_vec, IOVEC_LEN(in_vec), NULL, 0);
+}
+
+psa_status_t psa_fwu_query(psa_fwu_component_t component,
+ psa_fwu_component_info_t *info)
+{
+ psa_invec in_vec[] = {
+ { .base = &component, .len = sizeof(component) }
};
psa_outvec out_vec[] = {
{ .base = info, .len = sizeof(*info)}
@@ -75,24 +94,18 @@
NULL, 0, NULL, 0);
}
-psa_status_t psa_fwu_accept(psa_image_id_t image_id)
+psa_status_t psa_fwu_accept(void)
{
- psa_invec in_vec[] = {
- { .base = &image_id, .len = sizeof(image_id) }
- };
-
return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_ACCEPT,
- in_vec, IOVEC_LEN(in_vec), NULL, 0);
+ NULL, 0, NULL, 0);
}
-psa_status_t psa_fwu_set_manifest(psa_image_id_t image_id,
- const void *manifest,
- size_t manifest_size,
- psa_hash_t *manifest_dependency)
+psa_status_t psa_fwu_reject(psa_status_t error)
{
- psa_status_t status;
+ psa_invec in_vec[] = {
+ { .base = &error, .len = sizeof(error) }
+ };
- status = PSA_ERROR_NOT_SUPPORTED;
-
- return status;
+ return psa_call(TFM_FIRMWARE_UPDATE_SERVICE_HANDLE, TFM_FWU_REJECT,
+ in_vec, IOVEC_LEN(in_vec), NULL, 0);
}