feat(cactus): commands for notifications bindings
Added test command to test FFA_NOTIFICATION_BIND and
FFA_NOTIFICATION_UNBIND interfaces.
Both commands allow for the arguments to the call to be propagated in
the request payload. If the call to the interfaces returns with an error
Cactus places it in the response CACTUS_ERROR and adds the respective
FF-A error code.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I3fc3a5e559d0c6d6742f5d86973f6e67891ad790
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 16bb36b..b6af28b 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -312,4 +312,66 @@
return cactus_send_cmd(source, dest, CACTUS_DMA_SMMUv3_CMD, 0, 0, 0,
0);
}
+
+/*
+ * Request SP to bind a notification to a FF-A endpoint. In case of error
+ * when using the FFA_NOTIFICATION_BIND interface, include the error code
+ * in the response to the command's request. The receiver and sender arguments
+ * are propagated through the command's arguments, to allow the test of
+ * erroneous uses of the FFA_NOTIFICATION_BIND interface.
+ *
+ * The command id is the hex representation of the string "bind".
+ */
+#define CACTUS_NOTIFICATION_BIND_CMD U(0x62696e64)
+
+static inline smc_ret_values cactus_notification_bind_send_cmd(
+ ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
+ ffa_id_t sender, ffa_notification_bitmap_t notifications, uint32_t flags)
+{
+ return cactus_send_cmd(source, dest, CACTUS_NOTIFICATION_BIND_CMD,
+ receiver, sender, notifications, flags);
+}
+
+/**
+ * Request to SP unbind a notification. In case of error when using the
+ * FFA_NOTIFICATION_UNBIND interface, the test includes the error code in the
+ * response. The receiver and sender arguments are propagated throught the
+ * command's arguments, to allow the test of erroneous uses of the
+ * FFA_NOTIFICATION_BIND interface.
+ *
+ * The command id is the hex representation of the string "unbind".
+ */
+#define CACTUS_NOTIFICATION_UNBIND_CMD U(0x756e62696e64)
+
+static inline smc_ret_values cactus_notification_unbind_send_cmd(
+ ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
+ ffa_id_t sender, ffa_notification_bitmap_t notifications)
+{
+ return cactus_send_cmd(source, dest, CACTUS_NOTIFICATION_UNBIND_CMD,
+ receiver, sender, notifications, 0);
+}
+
+static inline ffa_id_t cactus_notification_get_receiver(
+ smc_ret_values ret)
+{
+ return (ffa_id_t)ret.ret4;
+}
+
+static inline ffa_id_t cactus_notification_get_sender(
+ smc_ret_values ret)
+{
+ return (ffa_id_t)ret.ret5;
+}
+
+static inline ffa_notification_bitmap_t cactus_notification_get_notifications(
+ smc_ret_values ret)
+{
+ return (uint64_t)ret.ret6;
+}
+
+static inline uint32_t cactus_notification_get_flags(smc_ret_values ret)
+{
+ return (uint32_t)ret.ret7;
+}
+
#endif