feat(cactus): receive psci msg through direct req framework msg
Cactus receives PSCI CPU_OFF power management operation message
through framework direct request message and it will respond back
with framework direct message if all conditions are met.
Cactus SP1 and SP2 explicitly subscribe to CPU_OFF power management
message through their respective manifests.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I790a8698d238e29847e376b4fa9447a6241ef17e
diff --git a/include/runtime_services/cactus_message_loop.h b/include/runtime_services/cactus_message_loop.h
index 4d963ac..a13f42f 100644
--- a/include/runtime_services/cactus_message_loop.h
+++ b/include/runtime_services/cactus_message_loop.h
@@ -42,3 +42,5 @@
bool cactus_handle_cmd(struct ffa_value *cmd_args, struct ffa_value *ret,
struct mailbox_buffers *mb);
+
+struct ffa_value cactus_handle_framework_msg(struct ffa_value args);
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 0a63e96..24a7e38 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -349,6 +349,33 @@
return (args.arg2 >> 48) & 0xFFFFU;
}
+/**
+ * FF-A Framework message helpers
+ */
+#define FFA_FRAMEWORK_MSG_BIT (1U << 31)
+
+#define FFA_FRAMEWORK_MSG_MASK 0xFFU
+
+#define FFA_FRAMEWORK_MSG_PSCI_REQ 0U
+#define FFA_FRAMEWORK_MSG_PSCI_RESP 2U
+
+static inline uint32_t ffa_framework_msg_flags(struct ffa_value args)
+{
+ return (uint32_t)args.arg2;
+}
+
+static inline bool ffa_is_framework_msg(struct ffa_value args)
+{
+ return (ffa_func_id(args) == FFA_MSG_SEND_DIRECT_REQ_SMC32 ||
+ ffa_func_id(args) == FFA_MSG_SEND_DIRECT_REQ_SMC64) &&
+ ((ffa_framework_msg_flags(args) & FFA_FRAMEWORK_MSG_BIT) != 0);
+}
+
+static inline uint32_t ffa_get_framework_msg(struct ffa_value args)
+{
+ return ffa_framework_msg_flags(args) & FFA_FRAMEWORK_MSG_MASK;
+}
+
typedef uint64_t ffa_notification_bitmap_t;
/**
@@ -933,6 +960,10 @@
uint32_t arg1, uint32_t arg2,
uint32_t arg3, uint32_t arg4);
+struct ffa_value ffa_framework_msg_send_direct_resp(ffa_id_t source_id,
+ ffa_id_t dest_id, uint32_t msg,
+ uint32_t status_code);
+
struct ffa_value ffa_run(uint32_t dest_id, uint32_t vcpu_id);
struct ffa_value ffa_version(uint32_t input_version);
struct ffa_value ffa_id_get(void);