diff mbox series

[7/9] arm-bsp/u-boot: corstone1000: update TS RPC protocol

Message ID 20240423163205.5885-7-gyorgy.szing@arm.com
State New
Headers show
Series [1/9] arm/trusted-services: Update FFA TEE driver to v2.0.0 | expand

Commit Message

Gyorgy Szing April 23, 2024, 4:32 p.m. UTC
From: Bence Balogh <bence.balogh@arm.com>

The Trusted Services v1.0 uses new RPC protocol and the message
fields in u-boot had to be synchronized.

Signed-off-by: Bence Balogh <bence.balogh@arm.com>
---
 .../u-boot/u-boot-corstone1000.inc            |  1 +
 ...-efi-corstone1000-fwu-update-RPC-ABI.patch | 75 +++++++++++++++++++
 2 files changed, 76 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0044-efi-corstone1000-fwu-update-RPC-ABI.patch
diff mbox series

Patch

diff --git a/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc b/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
index b5e53818..43c19b84 100644
--- a/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
+++ b/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
@@ -61,6 +61,7 @@  SRC_URI:append = " \
     file://0043-firmware-psci-Fix-bind_smccc_features-psci-check.patch		  \
     file://0044-corstone1000-set-unique-GUID-for-fvp-and-mps3.patch		  \
     file://0045-Corstone1000-Change-MMCOMM-buffer-location.patch		  \
+    file://0044-efi-corstone1000-fwu-update-RPC-ABI.patch			  \
     "
 
 do_configure:append() {
diff --git a/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0044-efi-corstone1000-fwu-update-RPC-ABI.patch b/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0044-efi-corstone1000-fwu-update-RPC-ABI.patch
new file mode 100644
index 00000000..00fc1f07
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0044-efi-corstone1000-fwu-update-RPC-ABI.patch
@@ -0,0 +1,75 @@ 
+From 7c25404d64ef8efec63c154ce38b0bb38845680f Mon Sep 17 00:00:00 2001
+From: Bence Balogh <bence.balogh@arm.com>
+Date: Tue, 5 Dec 2023 20:23:55 +0100
+Subject: [PATCH] efi: corstone1000: fwu: update RPC ABI
+
+The Trusted Services RPC protocol format changed: the
+data has to be placed in w3 and the memory handle has
+to be placed in w4-w5.
+
+Signed-off-by: Bence Balogh <bence.balogh@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+---
+ lib/efi_loader/efi_capsule.c | 14 +++++++++++---
+ lib/efi_loader/efi_setup.c   | 14 +++++++++++---
+ 2 files changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
+index f3326b1f67..1d966e3f26 100644
+--- a/lib/efi_loader/efi_capsule.c
++++ b/lib/efi_loader/efi_capsule.c
+@@ -790,12 +790,20 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
+ 	}
+ 
+ 	/*
+-	 * setting the buffer ready event arguments in register w4:
++	 * setting the buffer ready event arguments in register w3:
+ 	 * - capsule update interface ID (31:16)
+ 	 * - the buffer ready event ID (15:0)
+ 	 */
+-	msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
+-		PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT); /* w4 */
++	msg.data0 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
++		PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT); /* w3 */
++
++	/*
++	 * setting the memory handle fields to
++	 * FFA_MEM_HANDLE_INVALID (0xFFFF_FFFF_FFFF_FFFF)
++	 * to signal that there is no shared memory used
++	*/
++	msg.data1 = 0xFFFFFFFF;	/* w4 */
++	msg.data2 = 0xFFFFFFFF; /* w5 */
+ 
+ 	return ffa_sync_send_receive(dev, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
+ }
+diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
+index d20568c1c8..c31e74532f 100644
+--- a/lib/efi_loader/efi_setup.c
++++ b/lib/efi_loader/efi_setup.c
+@@ -157,12 +157,20 @@ static int efi_corstone1000_uboot_efi_started_event(void)
+ 	}
+ 
+ 	/*
+-	 * setting the kernel started  event arguments:
++	 * setting the kernel started  event arguments in register w3::
+ 	 * 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 */
++	msg.data0 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
++			PREP_SEPROXY_EVT(CORSTONE1000_UBOOT_EFI_STARTED_EVT); /* w3 */
++
++	/*
++	 * setting the memory handle fields to
++	 * FFA_MEM_HANDLE_INVALID (0xFFFF_FFFF_FFFF_FFFF)
++	 * to signal that there is no shared memory used
++	*/
++	msg.data1 = 0xFFFFFFFF;	/* w4 */
++	msg.data2 = 0xFFFFFFFF; /* w5 */
+ 
+ 	return ffa_sync_send_receive(dev, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
+ }
+-- 
+2.25.1
+