Add MM communication protocol definitions
Add MM comminication SMC call function IDs, return codes and a
structure the MM communicate message header.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: Ibccd60a131f897400a7aa955dc1502ed66be3025
diff --git a/protocols/common/efi/efi_types.h b/protocols/common/efi/efi_types.h
index a96e31b..4998c53 100644
--- a/protocols/common/efi/efi_types.h
+++ b/protocols/common/efi/efi_types.h
@@ -24,4 +24,19 @@
uint8_t Data4[8];
} EFI_GUID;
+/**
+ * Header structure of messages in the MM communication buffer.
+ */
+typedef struct {
+ EFI_GUID HeaderGuid;
+ uint64_t MessageLength;
+ uint8_t Data[1];
+} EFI_MM_COMMUNICATE_HEADER;
+
+/**
+ * Size of the EFI MM_COMMUNICATE header without the data field.
+ */
+#define EFI_MM_COMMUNICATE_HEADER_SIZE \
+ (offsetof(EFI_MM_COMMUNICATE_HEADER, Data))
+
#endif /* COMMON_EFI_TYPES_H */
diff --git a/protocols/common/mm/mm_smc.h b/protocols/common/mm/mm_smc.h
new file mode 100644
index 0000000..7927518
--- /dev/null
+++ b/protocols/common/mm/mm_smc.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ */
+
+#ifndef MM_SMC_H_
+#define MM_SMC_H_
+
+/**
+ * The file contains the constant definitions of ARM Magangement Mode Interface
+ * specification (DEN0060A) which are used in MM SMC calls.
+ */
+
+#include "util.h"
+
+/* MM SMV IDs */
+#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32 UINT32_C(0x84000061)
+#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 UINT32_C(0xC4000061)
+
+#ifdef ARM64
+#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64
+#else /* ARM64 */
+#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32
+#endif /* ARM64 */
+
+/* Return codes */
+#define MM_RETURN_CODE_SUCCESS 0
+#define MM_RETURN_CODE_NOT_SUPPORTED -1
+#define MM_RETURN_CODE_INVALID_PARAMETER -2
+#define MM_RETURN_CODE_DENIED -3
+/* -4 is skipped according to the spec */
+#define MM_RETURN_CODE_NO_MEMORY -5
+
+#endif /* MM_SMC_H_ */