Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From 4c249de0915750b328e456c34f18546f92850afd Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Vishnu Banavath <vishnu.banavath@arm.com> |
| 3 | Date: Fri, 10 Dec 2021 20:03:35 +0000 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 4 | Subject: [PATCH 15/24] efi_capsule: corstone1000: pass interface id and buffer |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 5 | event id using register w4 |
| 6 | |
| 7 | Initially the interface/event IDs are passed to the SP using register |
| 8 | w3 and w5. |
| 9 | |
| 10 | Now the SE proxy SP requires this arguments to be in register w4. |
| 11 | |
| 12 | This change is to pass interface ID(31:16) and event ID(15:0) |
| 13 | to SE proxy SP to trigger an event to secure enclave about |
| 14 | firmware update. |
| 15 | |
| 16 | Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com> |
| 17 | Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 18 | Signed-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 | |
| 24 | diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h |
| 25 | index 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 | |
| 41 | diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 42 | index a0689ba912fc..e08e97cf3fb7 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 43 | --- a/lib/efi_loader/efi_capsule.c |
| 44 | +++ b/lib/efi_loader/efi_capsule.c |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 45 | @@ -28,6 +28,8 @@ |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 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; |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 54 | @@ -590,11 +592,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 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 | -- |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 72 | 2.37.1 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 73 | |