All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 2/6] efi_loader: Add headers for EDK2 StandAloneMM communication
Date: Wed,  6 May 2020 22:12:42 +0300	[thread overview]
Message-ID: <20200506191246.237790-3-ilias.apalodimas@linaro.org> (raw)
In-Reply-To: <20200506191246.237790-1-ilias.apalodimas@linaro.org>

From: Sughosh Ganu <sughosh.ganu@linaro.org>

In Arm devices OP-TEE has the ability to run StandAloneMM (from EDK2)
in a separate partition and handle UEFI variables.
A following patch introduces this functionality.

Add the headers needed for OP-TEE <--> StandAloneMM communication

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 include/mm_communication.h | 28 ++++++++++++++
 include/mm_variable.h      | 78 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 include/mm_communication.h
 create mode 100644 include/mm_variable.h

diff --git a/include/mm_communication.h b/include/mm_communication.h
new file mode 100644
index 000000000000..fb4c91103400
--- /dev/null
+++ b/include/mm_communication.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ *  Headers for EFI variable service via StandAloneMM, EDK2 application running
+ *  in OP-TEE
+ *
+ *  Copyright (C) 2020 Linaro Ltd. <sughosh.ganu@linaro.org>
+ *  Copyright (C) 2020 Linaro Ltd. <ilias.apalodimas@linaro.org>
+ */
+
+#if !defined _MM_COMMUNICATION_H_
+#define _MM_COMMUNICATION_H_
+
+/* defined in EDK2 MmCommunication.h */
+struct mm_communicate_header {
+	efi_guid_t header_guid;
+	size_t     message_len;
+	u8         data[1];
+};
+
+#define MM_COMMUNICATE_HEADER_SIZE \
+	(offsetof(struct mm_communicate_header, data))
+
+#define MM_RET_SUCCESS         0
+#define MM_RET_INVALID_PARAMS -2
+#define MM_RET_DENIED         -3
+#define MM_RET_NO_MEMORY      -4
+
+#endif /* _MM_COMMUNICATION_H_*/
diff --git a/include/mm_variable.h b/include/mm_variable.h
new file mode 100644
index 000000000000..f56c52597629
--- /dev/null
+++ b/include/mm_variable.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ *  Headers for EFI variable service via StandAloneMM, EDK2 application running
+ *  in OP-TEE
+ *
+ *  Copyright (C) 2020 Linaro Ltd. <sughosh.ganu@linaro.org>
+ *  Copyright (C) 2020 Linaro Ltd. <ilias.apalodimas@linaro.org>
+ */
+
+#if !defined _MM_VARIABLE_H_
+#define _MM_VARIABLE_H_
+
+#include <part_efi.h>
+
+/* defined in EDK2 SmmVariableCommon.h */
+struct mm_variable_communicate_header {
+	efi_uintn_t  function;
+	efi_status_t ret_status;
+	u8           data[1];
+};
+
+#define MM_VARIABLE_COMMUNICATE_SIZE \
+	(offsetof(struct mm_variable_communicate_header, data))
+
+#define MM_VARIABLE_FUNCTION_GET_VARIABLE			1
+
+#define MM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME		2
+
+#define MM_VARIABLE_FUNCTION_SET_VARIABLE			3
+
+#define MM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO		4
+
+#define MM_VARIABLE_FUNCTION_READY_TO_BOOT			5
+
+#define MM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE			6
+
+#define MM_VARIABLE_FUNCTION_GET_STATISTICS			7
+
+#define MM_VARIABLE_FUNCTION_LOCK_VARIABLE			8
+
+#define MM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET	9
+
+#define MM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET	10
+
+#define MM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE			11
+
+struct mm_variable_access {
+	efi_guid_t  guid;
+	efi_uintn_t data_size;
+	efi_uintn_t name_size;
+	u32         attr;
+	u16         name[1];
+};
+
+#define MM_VARIABLE_ACCESS_HEADER_SIZE \
+	(offsetof(struct mm_variable_access, name))
+
+struct mm_variable_payload_size {
+	efi_uintn_t size;
+};
+
+struct mm_variable_getnext {
+	efi_guid_t  guid;
+	efi_uintn_t name_size;
+	u16         name[1];
+};
+
+#define MM_VARIABLE_GET_NEXT_HEADER_SIZE \
+	(offsetof(struct mm_variable_getnext, name))
+
+struct mm_variable_query_info {
+	u64 max_variable_storage;
+	u64 remaining_variable_storage;
+	u64 max_variable_size;
+	u32 attr;
+};
+
+#endif /* _MM_VARIABLE_H_ */
-- 
2.26.2

  parent reply	other threads:[~2020-05-06 19:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 19:12 [PATCH 0/6] EFI variable support via OP-TEE Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 1/6] charset: Add support for calculating bytes occupied by a u16 string Ilias Apalodimas
2020-05-09  6:44   ` Heinrich Schuchardt
2020-05-06 19:12 ` Ilias Apalodimas [this message]
2020-05-09  8:12   ` [PATCH 2/6] efi_loader: Add headers for EDK2 StandAloneMM communication Heinrich Schuchardt
2020-05-11 10:25     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 3/6] efi_loader: Implement EFI variable handling via OP-TEE Ilias Apalodimas
2020-05-09  9:14   ` Heinrich Schuchardt
2020-05-11  8:43     ` Ilias Apalodimas
2020-05-11 10:00     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 4/6] cmd: efidebug: Add support for querying UEFI variable storage Ilias Apalodimas
2020-05-09  9:58   ` Heinrich Schuchardt
2020-05-11  8:49     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 5/6] MAINTAINERS: Add maintainer for EFI variables via OP-TEE Ilias Apalodimas
2020-05-09  9:17   ` Heinrich Schuchardt
2020-05-11  8:47     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 6/6] doc: uefi.rst: Add OP-TEE variable storage config options Ilias Apalodimas
2020-05-09  9:51   ` Heinrich Schuchardt
2020-05-11  8:52     ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506191246.237790-3-ilias.apalodimas@linaro.org \
    --to=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.