blob: 0d1912c880ff14b81bab783d8abc419a1bf55719 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 81bf9ed7e8e858cef13cfc3d1435c44445e523df Mon Sep 17 00:00:00 2001
2From: Vishnu Banavath <vishnu.banavath@arm.com>
3Date: Fri, 10 Dec 2021 20:03:35 +0000
4Subject: [PATCH 15/27] efi_capsule: corstone1000: pass interface id and buffer
5 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>
19---
20 include/configs/corstone1000.h | 6 ++++++
21 lib/efi_loader/efi_capsule.c | 11 +++++++----
22 2 files changed, 13 insertions(+), 4 deletions(-)
23
24diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
25index db0f91335cef..a7445e61348b 100644
26--- a/include/configs/corstone1000.h
27+++ b/include/configs/corstone1000.h
28@@ -24,6 +24,12 @@
29 #define CORSTONE1000_BUFFER_READY_EVT (0x1)
30 #define CORSTONE1000_KERNEL_STARTED_EVT (0x2)
31
32+#define PREP_SEPROXY_SVC_ID_MASK GENMASK(31, 16)
33+#define PREP_SEPROXY_SVC_ID(x) (FIELD_PREP(PREP_SEPROXY_SVC_ID_MASK, (x)))
34+
35+#define PREP_SEPROXY_EVT_MASK GENMASK(15, 0)
36+#define PREP_SEPROXY_EVT(x) (FIELD_PREP(PREP_SEPROXY_EVT_MASK, (x)))
37+
38 /* Size in 4KB pages of the EFI capsule buffer */
39 #define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */
40
41diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
42index c100c1b95298..17d769803b2a 100644
43--- a/lib/efi_loader/efi_capsule.c
44+++ b/lib/efi_loader/efi_capsule.c
45@@ -27,6 +27,8 @@
46 #ifdef CONFIG_TARGET_CORSTONE1000
47 #include <arm_ffa_helper.h>
48 #include <cpu_func.h>
49+#include <linux/bitfield.h>
50+#include <linux/bitops.h>
51
52 void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
53 efi_guid_t corstone1000_capsule_guid = EFI_CORSTONE1000_CAPSULE_ID_GUID;
54@@ -587,11 +589,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
55 func_data.data0 = &part_id;
56
57 /*
58- * setting the buffer ready event arguments
59+ * setting the buffer ready event arguments in register w4:
60+ * - capsule update interface ID (31:16)
61+ * - the buffer ready event ID (15:0)
62 */
63- msg.a3 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID;
64- msg.a4 = capsule_image_size;
65- msg.a5 = CORSTONE1000_BUFFER_READY_EVT;
66+ msg.a4 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
67+ PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT);
68
69 func_data.data1_size = sizeof(msg);
70 func_data.data1 = &msg;
71--
722.30.2
73