SPM: Involve SPM backends
Compare to the existing IPC runtime model and the upcoming SFN
runtime model, they:
- Have different component runtime initialization methods:
thread vs thread-less.
- Have different messaging mechanisms: scheduling vs function call.
- Have different system kick-off mechanisms: scheduling vs calling
into partition initialization routines one by one.
Create backends for addressing these differentiate. And IPC backend
is the first instance. Also fine-tunes backend related items, move
them into backend sources, such as partition list, and change the
way for binding service signals with partitions.
Change-Id: I954af30d65514a13ac9f5f86e5e718cf1c9a697c
Signed-off-by: Ken Liu <ken.liu@arm.com>
Co-authored-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/spm/include/ffm/backend.h b/secure_fw/spm/include/ffm/backend.h
new file mode 100644
index 0000000..c53c35c
--- /dev/null
+++ b/secure_fw/spm/include/ffm/backend.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __BACKEND_H__
+#define __BACKEND_H__
+
+#include <stdint.h>
+#include "psa/error.h"
+#include "spm_ipc.h"
+#include "load/spm_load_api.h"
+
+/* BASIC TYPE DEFINITIONS */
+
+struct backend_ops_t {
+ /*
+ * Runtime model-specific component initialization routine. This
+ * is an `assuredly` function, would panic if any error occurred.
+ */
+ void (*comp_init_assuredly)(struct partition_t *p_pt,
+ uint32_t service_setting);
+
+ /*
+ * Runtime model-specific kick-off method for the whole system.
+ * Returns a hardware-specific control value, which is transparent
+ * to SPM common logic.
+ */
+ uint32_t (*system_run)(void);
+
+ /* Runtime model-specific message handling mechanism. */
+ psa_status_t (*messaging)(struct service_t *p_serv,
+ struct tfm_msg_body_t *p_msg);
+
+};
+
+/* RUNTIME MODEL BACKENDS DECLARATION */
+
+/* IPC backend */
+extern const struct backend_ops_t backend_instance;
+
+/* The component list, and a MACRO indicate this is not a common global. */
+extern struct partition_head_t partition_listhead;
+#define PARTITION_LIST_ADDR (&partition_listhead)
+
+#endif /* __BACKEND_H__ */