aboutsummaryrefslogtreecommitdiff
path: root/module/scmi/include/internal/mod_scmi.h
diff options
context:
space:
mode:
authorRonald Cron <ronald.cron@arm.com>2018-06-05 09:31:39 +0200
committerRonald Cron <ronald.cron@arm.com>2018-06-08 11:46:47 +0200
commitb151958dbb2f37383f4d9a1f7802c36008d9fef2 (patch)
treefe20ebfb8c10facbfd028edefe601462ae3ee64c /module/scmi/include/internal/mod_scmi.h
parentfd3027b6fd17a4a33a685adb73f2acfcae9a2ced (diff)
Add support for SGM-775
Co-authored-by: Filipe Rinaldi <filipe.rinaldi@arm.com> Co-authored-by: Paul Beesley <paul.beesley@arm.com> Co-authored-by: Chris Kay <chris.kay@arm.com> Co-authored-by: Elieva Pignat <elieva.pignat@arm.com> Co-authored-by: Pedro Custodio <pedro.krewinkelcustodio@arm.com> Change-Id: Ic7524ad58a7c15d5b055e88a9719b2feee437f1d Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Diffstat (limited to 'module/scmi/include/internal/mod_scmi.h')
-rw-r--r--module/scmi/include/internal/mod_scmi.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/module/scmi/include/internal/mod_scmi.h b/module/scmi/include/internal/mod_scmi.h
new file mode 100644
index 00000000..822e196b
--- /dev/null
+++ b/module/scmi/include/internal/mod_scmi.h
@@ -0,0 +1,63 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2015-2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Description:
+ * System Control and Management Interface (SCMI) support.
+ */
+
+#ifndef MOD_INTERNAL_SCMI_H
+#define MOD_INTERNAL_SCMI_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <mod_scmi.h>
+
+#define SCMI_VERSION 0x10000
+
+#define SCMI_MESSAGE_HEADER_MESSAGE_ID_POS 0
+#define SCMI_MESSAGE_HEADER_PROTOCOL_ID_POS 10
+#define SCMI_MESSAGE_HEADER_TOKEN_POS 18
+
+#define SCMI_MESSAGE_HEADER_MESSAGE_ID_MASK \
+ (UINT32_C(0x3FF) << SCMI_MESSAGE_HEADER_MESSAGE_ID_POS)
+#define SCMI_MESSAGE_HEADER_PROTOCOL_ID_MASK \
+ (UINT32_C(0xFF) << SCMI_MESSAGE_HEADER_PROTOCOL_ID_POS)
+#define SCMI_MESSAGE_HEADER_TOKEN_MASK \
+ (UINT32_C(0x3FF) << SCMI_MESSAGE_HEADER_TOKEN_POS)
+
+#define SCMI_MESSAGE_HEADER(MESSAGE_ID, PROTOCOL_ID, TOKEN) \
+ ((((MESSAGE_ID) << SCMI_MESSAGE_HEADER_MESSAGE_ID_POS) & \
+ SCMI_MESSAGE_HEADER_MESSAGE_ID_MASK) | \
+ (((PROTOCOL_ID) << SCMI_MESSAGE_HEADER_PROTOCOL_ID_POS) & \
+ SCMI_MESSAGE_HEADER_PROTOCOL_ID_MASK) | \
+ (((TOKEN) << SCMI_MESSAGE_HEADER_TOKEN_POS) & \
+ SCMI_MESSAGE_HEADER_TOKEN_POS))
+
+/* SCMI service context */
+struct scmi_service_ctx {
+ /* Pointer to SCMI service configuration data */
+ const struct mod_scmi_service_config *config;
+
+ /*
+ * Identifier of the transport entity used by the service to read/respond
+ * to SCMI messages.
+ */
+ fwk_id_t transport_id;
+
+ /* Pointer to the transport API used to read and respond to messages */
+ const struct mod_scmi_to_transport_api *transport_api;
+
+ /* Copy of the pointer to the 'respond' function within the transport API */
+ int (*respond)(fwk_id_t transport_id, const void *payload, size_t size);
+
+ /* SCMI identifier of the protocol processing the current message */
+ unsigned int scmi_protocol_id;
+
+ /* SCMI identifier of the message currently being processed */
+ unsigned int scmi_message_id;
+};
+
+#endif /* MOD_INTERNAL_SCMI_H */