refact(twdog): move trusted wdog API to spm_common
Other tests cases need same API to enable/disable twdog,
so we need to move them to common place.
Signed-off-by: Nabil Kahlouche <nabil.kahlouche@arm.com>
Change-Id: Ie54cfdf44777000dda924bb1239b77182a3dced9
diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h
index de5c254..6fe445a 100644
--- a/include/runtime_services/spm_common.h
+++ b/include/runtime_services/spm_common.h
@@ -154,5 +154,7 @@
const struct ffa_uuid uuid,
const struct ffa_partition_info *expected,
const uint16_t expected_size);
+bool enable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest);
+bool disable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest);
#endif /* SPM_COMMON_H */
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index 452322a..ae30ebc 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -612,3 +612,34 @@
}
return result;
}
+
+static bool configure_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest,
+ bool enable)
+{
+ struct ffa_value ret_values;
+
+ ret_values = cactus_interrupt_cmd(source, dest, IRQ_TWDOG_INTID,
+ enable, INTERRUPT_TYPE_IRQ);
+
+ if (!is_ffa_direct_response(ret_values)) {
+ ERROR("Expected a direct response message while configuring"
+ " TWDOG interrupt\n");
+ return false;
+ }
+
+ if (cactus_get_response(ret_values) != CACTUS_SUCCESS) {
+ ERROR("Failed to configure Trusted Watchdog interrupt\n");
+ return false;
+ }
+ return true;
+}
+
+bool enable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest)
+{
+ return configure_trusted_wdog_interrupt(source, dest, true);
+}
+
+bool disable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest)
+{
+ return configure_trusted_wdog_interrupt(source, dest, false);
+}
\ No newline at end of file
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c b/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
index 89c9b40..5977717 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
@@ -21,37 +21,6 @@
{PRIMARY_UUID}, {SECONDARY_UUID}
};
-static bool configure_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest,
- bool enable)
-{
- struct ffa_value ret_values;
-
- ret_values = cactus_interrupt_cmd(source, dest, IRQ_TWDOG_INTID,
- enable, INTERRUPT_TYPE_IRQ);
-
- if (!is_ffa_direct_response(ret_values)) {
- ERROR("Expected a direct response message while configuring"
- " TWDOG interrupt\n");
- return false;
- }
-
- if (cactus_get_response(ret_values) != CACTUS_SUCCESS) {
- ERROR("Failed to configure Trusted Watchdog interrupt\n");
- return false;
- }
- return true;
-}
-
-static bool enable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest)
-{
- return configure_trusted_wdog_interrupt(source, dest, true);
-}
-
-static bool disable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest)
-{
- return configure_trusted_wdog_interrupt(source, dest, false);
-}
-
/*
* @Test_Aim@ Test secure interrupt handling while first Secure Partition is
* in RUNNING state.