1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-06-06 02:40:18 +00:00

arm-bsp/u-boot: corstone1000: Remove GetVariable() fix

The efi_get_var() expects EFI_BUFFER_TOO_SMALL return value
from efi_get_variable_int() to just read the size of the data.
So when comm buffer is smaller than received buffer,
efi_get_variable_int is expected to return error code. This
functionality will be fixed in future patches.

Change-Id: I3e5119b1fdf18c965cc2ebc11056b6ca70d57e0f
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Gowtham Suresh Kumar
2021-12-14 11:12:39 +00:00
committed by Jon Mason
parent acdead8bc0
commit 125707768c
7 changed files with 5 additions and 53 deletions
@@ -1,47 +0,0 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
From ff2b492bf68337d6cdd296ed61f91304b2da3143 Mon Sep 17 00:00:00 2001
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Date: Tue, 7 Dec 2021 00:26:37 +0000
Subject: [PATCH] Fix GetVariable() to handle 0 data size
This patch fixes the GetVariable() issue which causes
mm_communicate failure when called with 0 data size. The comm buffer
is set to maximum size when 0 data size request is made to handle the
MM response from the secure world. This is a generic fix but used by
corstone1000.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
%% original patch: 0035-corstone1000-Add-support-in-GetVariable-to-handle-re.patch
---
lib/efi_loader/efi_variable_tee.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
index 9375aa6a63..b7de80cd39 100644
--- a/lib/efi_loader/efi_variable_tee.c
+++ b/lib/efi_loader/efi_variable_tee.c
@@ -637,10 +637,15 @@ efi_status_t efi_get_variable_int(u16 *variable_name, const efi_guid_t *vendor,
goto out;
}
- /* Trim output buffer size */
+ /* Set output buffer size to maximum value if data_size is
+ * larger than the supported value or if efi_get_variable_int()
+ * is called with data_size set to 0. In the latter case if
+ * output buffer is not set to maximum, the comm_buf will be
+ * smaller than the MM response.
+ */
tmp_dsize = *data_size;
- if (name_size + tmp_dsize >
- max_payload_size - MM_VARIABLE_ACCESS_HEADER_SIZE) {
+ if ((name_size + tmp_dsize > max_payload_size - MM_VARIABLE_ACCESS_HEADER_SIZE)
+ || (!tmp_dsize)) {
tmp_dsize = max_payload_size -
MM_VARIABLE_ACCESS_HEADER_SIZE -
name_size;
--
2.17.1
@@ -44,12 +44,11 @@ SRC_URI:append:corstone1000 = " \
file://0032-arm-corstone1000-identify-which-bank-to-load-kernel.patch \
file://0033-corstone1000-dts-setting-the-boot-console-output.patch \
file://0034-corstone1000-dts-remove-the-use-of-fdt_addr_r.patch \
file://0035-Fix-GetVariable-to-handle-0-data-size.patch \
file://0036-efi_capsule-corstone1000-pass-interface-and-buffer-event-ids-in-w4.patch \
file://0037-efi_boottime-corstone1000-pass-interface-and-kernel-event-ids-in-w4.patch \
file://0038-efi_loader-remove-guid-check-from-corstone1000-confi.patch \
file://0039-arm_ffa-removing-the-cast-when-using-binary-OR-on-FIELD_PREP.patch \
file://0040-efi_loader-add-the-header-file-for-invalidate_dcache_all.patch \
file://0035-efi_capsule-corstone1000-pass-interface-and-buffer-event-ids-in-w4.patch \
file://0036-efi_boottime-corstone1000-pass-interface-and-kernel-event-ids-in-w4.patch \
file://0037-efi_loader-remove-guid-check-from-corstone1000-confi.patch \
file://0038-arm_ffa-removing-the-cast-when-using-binary-OR-on-FIELD_PREP.patch \
file://0039-efi_loader-add-the-header-file-for-invalidate_dcache_all.patch \
"
#