blob: 4e3f237f639508675e8aa0a9b36f8927dcc1d4a5 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 4c249de0915750b328e456c34f18546f92850afd 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 Williams92b42cb2022-09-03 06:53:57 -05004Subject: [PATCH 15/24] 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>
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
Patrick Williams92b42cb2022-09-03 06:53:57 -050042index a0689ba912fc..e08e97cf3fb7 100644
Brad Bishopbec4ebc2022-08-03 09:55:16 -040043--- a/lib/efi_loader/efi_capsule.c
44+++ b/lib/efi_loader/efi_capsule.c
Patrick Williams92b42cb2022-09-03 06:53:57 -050045@@ -28,6 +28,8 @@
Brad Bishopbec4ebc2022-08-03 09:55:16 -040046 #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;
Patrick Williams92b42cb2022-09-03 06:53:57 -050054@@ -590,11 +592,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
Brad Bishopbec4ebc2022-08-03 09:55:16 -040055 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--
Patrick Williams92b42cb2022-09-03 06:53:57 -0500722.37.1
Brad Bishopbec4ebc2022-08-03 09:55:16 -040073