summaryrefslogtreecommitdiff
path: root/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch')
-rw-r--r--meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch183
1 files changed, 183 insertions, 0 deletions
diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch
new file mode 100644
index 0000000000..35f5cb2354
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch
@@ -0,0 +1,183 @@
+From 709e5d8ff07474f840f1d34d3077135f77795452 Mon Sep 17 00:00:00 2001
+From: Vishnu Banavath <vishnu.banavath@arm.com>
+Date: Mon, 15 Aug 2022 15:46:18 +0100
+Subject: [PATCH 24/26] efi_loader: send bootcomplete message to secure enclave
+
+On corstone1000 platform, Secure Enclave will be expecting
+an event from uboot when it performs capsule update. Previously,
+an event is sent at exitbootservice level. This will create a problem
+when user wants to interrupt at UEFI shell, hence, it is required
+to send an uboot efi initialized event at efi sub-system initialization
+stage.
+
+Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
+Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+---
+ include/configs/corstone1000.h | 2 +-
+ lib/efi_loader/efi_boottime.c | 43 ----------------------------------
+ lib/efi_loader/efi_firmware.c | 2 +-
+ lib/efi_loader/efi_setup.c | 39 ++++++++++++++++++++++++++++++
+ 4 files changed, 41 insertions(+), 45 deletions(-)
+
+diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
+index 4637dd5d5d..333b1d93b6 100644
+--- a/include/configs/corstone1000.h
++++ b/include/configs/corstone1000.h
+@@ -22,7 +22,7 @@
+
+ /* Notification events used with SE Proxy update service */
+ #define CORSTONE1000_BUFFER_READY_EVT (0x1)
+-#define CORSTONE1000_KERNEL_STARTED_EVT (0x2)
++#define CORSTONE1000_UBOOT_EFI_STARTED_EVT (0x2)
+
+ #define PREP_SEPROXY_SVC_ID_MASK GENMASK(31, 16)
+ #define PREP_SEPROXY_SVC_ID(x) (FIELD_PREP(PREP_SEPROXY_SVC_ID_MASK, (x)))
+diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
+index de815484d2..cede7826bd 100644
+--- a/lib/efi_loader/efi_boottime.c
++++ b/lib/efi_loader/efi_boottime.c
+@@ -27,11 +27,6 @@
+ #include <arm_ffa.h>
+ #endif
+
+-#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
+-#include <linux/bitfield.h>
+-#include <linux/bitops.h>
+-#endif
+-
+ DECLARE_GLOBAL_DATA_PTR;
+
+ /* Task priority level */
+@@ -2100,35 +2095,6 @@ static void efi_exit_caches(void)
+ #endif
+ }
+
+-#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
+-/**
+- * efi_corstone1000_kernel_started_event - notifies SE Proxy FW update service
+- *
+- * This function notifies the SE Proxy update service that the kernel has already started
+- *
+- * Return:
+- *
+- * 0: on success, otherwise failure
+- */
+-static int efi_corstone1000_kernel_started_event(void)
+-{
+- struct ffa_send_direct_data msg = {0};
+-
+- log_debug("[%s]\n", __func__);
+-
+- /*
+- * setting the kernel started event arguments:
+- * setting capsule update interface ID(31:16)
+- * the kernel started event ID(15:0)
+- */
+- msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
+- PREP_SEPROXY_EVT(CORSTONE1000_KERNEL_STARTED_EVT); /* w4 */
+-
+- return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
+-}
+-
+-#endif
+-
+ /**
+ * efi_exit_boot_services() - stop all boot services
+ * @image_handle: handle of the loaded image
+@@ -2244,15 +2210,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
+ /* Recalculate CRC32 */
+ efi_update_table_header_crc32(&systab.hdr);
+
+-#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
+- /* Notifying SE Proxy FW update service */
+- ffa_ret = efi_corstone1000_kernel_started_event();
+- if (ffa_ret)
+- debug("[efi_boottime][ERROR]: Failure to notify SE Proxy FW update service\n");
+- else
+- debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
+-#endif
+-
+ /* Give the payload some time to boot */
+ efi_set_watchdog(0);
+ WATCHDOG_RESET();
+diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
+index af43d4502f..25f427b936 100644
+--- a/lib/efi_loader/efi_firmware.c
++++ b/lib/efi_loader/efi_firmware.c
+@@ -47,7 +47,7 @@ static efi_status_t efi_corstone1000_img_info_get (
+ *package_version_name = NULL; /* not supported */
+
+ if(image_info == NULL) {
+- log_warning("image_info is null\n");
++ log_info("image_info is null\n");
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
+index bfd4687e10..6c9e14c37e 100644
+--- a/lib/efi_loader/efi_setup.c
++++ b/lib/efi_loader/efi_setup.c
+@@ -17,6 +17,9 @@
+ efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED;
+
+ #if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
++#include <linux/bitfield.h>
++#include <linux/bitops.h>
++#include <arm_ffa.h>
+ /**
+ * efi_corstone1000_alloc_capsule_shared_buf - allocate capsule shared buffer
+ */
+@@ -126,6 +129,34 @@ static efi_status_t efi_init_secure_boot(void)
+ }
+ #endif /* CONFIG_EFI_SECURE_BOOT */
+
++#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
++/**
++ * efi_corstone1000_uboot-efi_started_event - notifies SE Proxy FW update service
++ *
++ * This function notifies the SE Proxy update service that uboot efi has already started
++ *
++ * Return:
++ *
++ * 0: on success, otherwise failure
++ * */
++static int efi_corstone1000_uboot_efi_started_event(void)
++{
++ struct ffa_send_direct_data msg = {0};
++
++ log_debug("[%s]\n", __func__);
++
++ /*
++ * setting the kernel started event arguments:
++ * setting capsule update interface ID(31:16)
++ * the kernel started event ID(15:0)
++ */
++ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
++ PREP_SEPROXY_EVT(CORSTONE1000_UBOOT_EFI_STARTED_EVT); /* w4 */
++
++ return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
++}
++#endif
++
+ /**
+ * efi_init_capsule - initialize capsule update state
+ *
+@@ -136,6 +167,14 @@ static efi_status_t efi_init_capsule(void)
+ efi_status_t ret = EFI_SUCCESS;
+
+ #if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
++ int ffa_ret;
++
++ ffa_ret = efi_corstone1000_uboot_efi_started_event();
++ if (ffa_ret)
++ debug("[efi_boottime][ERROR]: Failure to notify SE Proxy FW update service\n");
++ else
++ debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
++
+ ret = efi_corstone1000_alloc_capsule_shared_buf();
+ if (ret != EFI_SUCCESS) {
+ printf("EFI: Corstone-1000: cannot allocate caspsule shared buffer\n");
+--
+2.17.1
+