blob: a86e0c8ce32dead8e2cd71d88a79f2ffab13d5e0 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From 8727a1b34fb500ca5cce6fc1c30a1d73bf23aaba Mon Sep 17 00:00:00 2001
Brad Bishopbec4ebc2022-08-03 09:55:16 -04002From: Vishnu Banavath <vishnu.banavath@arm.com>
3Date: Fri, 10 Dec 2021 20:03:35 +0000
Patrick Williams864cc432023-02-09 14:54:44 -06004Subject: [PATCH 13/27] efi_capsule: corstone1000: pass interface id and buffer
Brad Bishopbec4ebc2022-08-03 09:55:16 -04005 event id using register w4
6
7Initially the interface/event IDs are passed to the SP using register
8w3 and w5.
9
10Now the SE proxy SP requires this arguments to be in register w4.
11
12This change is to pass interface ID(31:16) and event ID(15:0)
13to SE proxy SP to trigger an event to secure enclave about
14firmware update.
15
16Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
17Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
18Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Patrick Williams8dd68482022-10-04 07:57:18 -050019Upstream-Status: Pending [Not submitted to upstream yet]
Brad Bishopbec4ebc2022-08-03 09:55:16 -040020---
21 include/configs/corstone1000.h | 6 ++++++
22 lib/efi_loader/efi_capsule.c | 11 +++++++----
23 2 files changed, 13 insertions(+), 4 deletions(-)
24
25diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
Patrick Williams864cc432023-02-09 14:54:44 -060026index cd30499e3c9c..e4c7bcb96f27 100644
Brad Bishopbec4ebc2022-08-03 09:55:16 -040027--- a/include/configs/corstone1000.h
28+++ b/include/configs/corstone1000.h
29@@ -24,6 +24,12 @@
30 #define CORSTONE1000_BUFFER_READY_EVT (0x1)
31 #define CORSTONE1000_KERNEL_STARTED_EVT (0x2)
32
33+#define PREP_SEPROXY_SVC_ID_MASK GENMASK(31, 16)
34+#define PREP_SEPROXY_SVC_ID(x) (FIELD_PREP(PREP_SEPROXY_SVC_ID_MASK, (x)))
35+
36+#define PREP_SEPROXY_EVT_MASK GENMASK(15, 0)
37+#define PREP_SEPROXY_EVT(x) (FIELD_PREP(PREP_SEPROXY_EVT_MASK, (x)))
38+
39 /* Size in 4KB pages of the EFI capsule buffer */
40 #define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */
41
42diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
Patrick Williams864cc432023-02-09 14:54:44 -060043index 9e8ddaac7f03..bd4cc8d27285 100644
Brad Bishopbec4ebc2022-08-03 09:55:16 -040044--- a/lib/efi_loader/efi_capsule.c
45+++ b/lib/efi_loader/efi_capsule.c
Patrick Williams864cc432023-02-09 14:54:44 -060046@@ -29,6 +29,8 @@
Brad Bishopbec4ebc2022-08-03 09:55:16 -040047 #ifdef CONFIG_TARGET_CORSTONE1000
Patrick Williams8dd68482022-10-04 07:57:18 -050048 #include <arm_ffa.h>
Brad Bishopbec4ebc2022-08-03 09:55:16 -040049 #include <cpu_func.h>
50+#include <linux/bitfield.h>
51+#include <linux/bitops.h>
52
53 void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
54 efi_guid_t corstone1000_capsule_guid = EFI_CORSTONE1000_CAPSULE_ID_GUID;
Patrick Williams864cc432023-02-09 14:54:44 -060055@@ -766,11 +768,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
Patrick Williams8dd68482022-10-04 07:57:18 -050056 log_debug("[%s]\n", __func__);
Brad Bishopbec4ebc2022-08-03 09:55:16 -040057
58 /*
59- * setting the buffer ready event arguments
60+ * setting the buffer ready event arguments in register w4:
61+ * - capsule update interface ID (31:16)
62+ * - the buffer ready event ID (15:0)
63 */
Patrick Williams8dd68482022-10-04 07:57:18 -050064- msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
65- msg.data1 = capsule_image_size; /* x4 */
66- msg.data2 = CORSTONE1000_BUFFER_READY_EVT; /* x5 */
67+ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
68+ PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT); /* w4 */
Brad Bishopbec4ebc2022-08-03 09:55:16 -040069
Andrew Geisslerea144b032023-01-27 16:03:57 -060070 return ffa_bus_ops_get()->sync_send_receive(NULL, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
Patrick Williams8dd68482022-10-04 07:57:18 -050071 }
Brad Bishopbec4ebc2022-08-03 09:55:16 -040072--
Patrick Williams864cc432023-02-09 14:54:44 -0600732.39.1
Brad Bishopbec4ebc2022-08-03 09:55:16 -040074