mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-05-07 04:58:57 +00:00
arm-bsp/u-boot: corstone1000: upgrade to v2023.07
Port Corstone-1000 patches to U-Boot v2023.07 Include the latest FF-A patchset sent to the mailing list (v15). Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
ddae9c4370
commit
79afe6a41e
@@ -22,7 +22,7 @@ TFM_SIGN_PRIVATE_KEY = "${libdir}/tfm-scripts/root-RSA-3072_1.pem"
|
||||
RE_IMAGE_OFFSET = "0x1000"
|
||||
|
||||
# u-boot
|
||||
PREFERRED_VERSION_u-boot ?= "2023.01"
|
||||
PREFERRED_VERSION_u-boot ?= "2023.07"
|
||||
EXTRA_IMAGEDEPENDS += "u-boot"
|
||||
|
||||
UBOOT_CONFIG ??= "EFI"
|
||||
|
||||
+34
-46
@@ -1,8 +1,8 @@
|
||||
From 5ce8bf4ad1aeb2657a7ab83c46eeb2cdaa56cfd4 Mon Sep 17 00:00:00 2001
|
||||
From b79722ade56bd49cf9e7d9b47b6256599c8cdb36 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 29 Jul 2022 13:06:19 +0100
|
||||
Subject: [PATCH 01/42] arm64: smccc: add support for SMCCCv1.2 x0-x17
|
||||
registers
|
||||
Subject: [PATCH 01/33] FF-A v15: arm64: smccc: add support for SMCCCv1.2
|
||||
x0-x17 registers
|
||||
|
||||
add support for x0-x17 registers used by the SMC calls
|
||||
|
||||
@@ -16,51 +16,35 @@ arm64: smccc: Add support for SMCCCv1.2 extended input/output registers
|
||||
[1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6?token=
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v7:
|
||||
|
||||
* improve indentation of ARM_SMCCC_1_2_REGS_Xn_OFFS
|
||||
|
||||
v4:
|
||||
|
||||
* rename the commit title and improve description
|
||||
new commit title: the current
|
||||
|
||||
v3:
|
||||
|
||||
* port x0-x17 registers support from linux kernel as defined by SMCCCv1.2
|
||||
commit title:
|
||||
arm64: smccc: add Xn registers support used by SMC calls
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
arch/arm/cpu/armv8/smccc-call.S | 53 +++++++++++++++++++++++++++++++++
|
||||
arch/arm/lib/asm-offsets.c | 14 +++++++++
|
||||
include/linux/arm-smccc.h | 43 ++++++++++++++++++++++++++
|
||||
3 files changed, 110 insertions(+)
|
||||
arch/arm/cpu/armv8/smccc-call.S | 57 ++++++++++++++++++++++++++++++++-
|
||||
arch/arm/lib/asm-offsets.c | 16 +++++++++
|
||||
include/linux/arm-smccc.h | 45 ++++++++++++++++++++++++++
|
||||
3 files changed, 117 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/cpu/armv8/smccc-call.S b/arch/arm/cpu/armv8/smccc-call.S
|
||||
index dc92b28777..ec6f299bc9 100644
|
||||
index dc92b28777..93f66d3366 100644
|
||||
--- a/arch/arm/cpu/armv8/smccc-call.S
|
||||
+++ b/arch/arm/cpu/armv8/smccc-call.S
|
||||
@@ -1,6 +1,8 @@
|
||||
@@ -1,7 +1,11 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2015, Linaro Limited
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
- */
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+*/
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
@@ -45,3 +47,54 @@ ENDPROC(__arm_smccc_smc)
|
||||
#include <generated/asm-offsets.h>
|
||||
@@ -45,3 +49,54 @@ ENDPROC(__arm_smccc_smc)
|
||||
ENTRY(__arm_smccc_hvc)
|
||||
SMCCC hvc
|
||||
ENDPROC(__arm_smccc_hvc)
|
||||
@@ -116,20 +100,22 @@ index dc92b28777..ec6f299bc9 100644
|
||||
+
|
||||
+#endif
|
||||
diff --git a/arch/arm/lib/asm-offsets.c b/arch/arm/lib/asm-offsets.c
|
||||
index 22fd541f9a..db6d7ed234 100644
|
||||
index 6de0ce9152..181a8ac4c2 100644
|
||||
--- a/arch/arm/lib/asm-offsets.c
|
||||
+++ b/arch/arm/lib/asm-offsets.c
|
||||
@@ -9,6 +9,9 @@
|
||||
@@ -9,6 +9,11 @@
|
||||
* generate asm statements containing #defines,
|
||||
* compile this file to assembler, and then extract the
|
||||
* #defines from the assembly-language output.
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -117,6 +120,17 @@ int main(void)
|
||||
@@ -90,6 +95,17 @@ int main(void)
|
||||
DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2));
|
||||
DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id));
|
||||
DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state));
|
||||
@@ -148,19 +134,21 @@ index 22fd541f9a..db6d7ed234 100644
|
||||
|
||||
return 0;
|
||||
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
|
||||
index e1d09884a1..9105031d55 100644
|
||||
index e1d09884a1..f44e9e8f93 100644
|
||||
--- a/include/linux/arm-smccc.h
|
||||
+++ b/include/linux/arm-smccc.h
|
||||
@@ -1,6 +1,8 @@
|
||||
@@ -1,6 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2015, Linaro Limited
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
#ifndef __LINUX_ARM_SMCCC_H
|
||||
#define __LINUX_ARM_SMCCC_H
|
||||
@@ -70,6 +72,47 @@ struct arm_smccc_res {
|
||||
@@ -70,6 +74,47 @@ struct arm_smccc_res {
|
||||
unsigned long a3;
|
||||
};
|
||||
|
||||
+28
-43
@@ -1,84 +1,69 @@
|
||||
From 1dcebf6f57e3490f7b3e2464b4114b993dd70c7c Mon Sep 17 00:00:00 2001
|
||||
From 43137871fcc46513eea1480cd78ad091763578f0 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Thu, 4 Aug 2022 16:46:47 +0100
|
||||
Subject: [PATCH 02/42] lib: uuid: introduce uuid_str_to_le_bin function
|
||||
Subject: [PATCH 02/33] FF-A v15: lib: uuid: introduce uuid_str_to_le_bin
|
||||
function
|
||||
|
||||
convert UUID string to little endian binary data
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8:
|
||||
|
||||
* use simple_strtoull() in uuid_str_to_le_bin() to support 32-bit platforms
|
||||
|
||||
v7:
|
||||
|
||||
* rename be_uuid_str_to_le_bin() to uuid_str_to_le_bin()
|
||||
* make uuid_str_to_le_bin() implementation similar to uuid_str_to_bin()
|
||||
by using same APIs
|
||||
|
||||
v4:
|
||||
|
||||
* rename ffa_uuid_str_to_bin to be_uuid_str_to_le_bin and put in
|
||||
a standalone commit (the current)
|
||||
|
||||
v3:
|
||||
|
||||
* introduce ffa_uuid_str_to_bin (provided by
|
||||
arm_ffa: introduce Arm FF-A low-level driver)
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
include/uuid.h | 8 ++++++++
|
||||
lib/uuid.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 54 insertions(+)
|
||||
include/uuid.h | 15 +++++++++++++++
|
||||
lib/uuid.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 63 insertions(+)
|
||||
|
||||
diff --git a/include/uuid.h b/include/uuid.h
|
||||
index 4a4883d3b5..293a8eb0a5 100644
|
||||
index 4a4883d3b5..89b93e642b 100644
|
||||
--- a/include/uuid.h
|
||||
+++ b/include/uuid.h
|
||||
@@ -2,6 +2,8 @@
|
||||
@@ -2,6 +2,10 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Samsung Electronics
|
||||
* Przemyslaw Marczak <p.marczak@samsung.com>
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
#ifndef __UUID_H__
|
||||
#define __UUID_H__
|
||||
@@ -44,4 +46,10 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin);
|
||||
@@ -44,4 +48,15 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin);
|
||||
const char *uuid_guid_get_str(const unsigned char *guid_bin);
|
||||
void gen_rand_uuid(unsigned char *uuid_bin);
|
||||
void gen_rand_uuid_str(char *uuid_str, int str_format);
|
||||
+
|
||||
+/**
|
||||
+ * uuid_str_to_le_bin - Converts a UUID string to little endian binary data
|
||||
+ * uuid_str_to_le_bin() - Convert string UUID to little endian binary data.
|
||||
+ * @uuid_str: pointer to UUID string
|
||||
+ * @uuid_bin: pointer to allocated array for little endian output [16B]
|
||||
+ * Return:
|
||||
+ * uuid_bin filled with little endian UUID data
|
||||
+ * On success 0 is returned. Otherwise, failure code.
|
||||
+ */
|
||||
+int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin);
|
||||
+
|
||||
#endif
|
||||
diff --git a/lib/uuid.c b/lib/uuid.c
|
||||
index 465e1ac38f..d29f561a70 100644
|
||||
index 96e1af3c8b..45f325d964 100644
|
||||
--- a/lib/uuid.c
|
||||
+++ b/lib/uuid.c
|
||||
@@ -1,6 +1,8 @@
|
||||
@@ -1,6 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright 2011 Calxeda, Inc.
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -346,6 +348,50 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
|
||||
@@ -354,6 +358,50 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
From 80fd758cb55f8b44078b4535284ea132b0d5a944 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 27 Mar 2023 16:24:29 +0100
|
||||
Subject: [PATCH 03/33] FF-A v15: lib: uuid: introduce testcase for
|
||||
uuid_str_to_le_bin
|
||||
|
||||
provide a test case
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
MAINTAINERS | 5 +++++
|
||||
test/lib/Makefile | 1 +
|
||||
test/lib/uuid.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 47 insertions(+)
|
||||
create mode 100644 test/lib/uuid.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 3bf60c4643..a1122afb01 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1632,3 +1632,8 @@ S: Maintained
|
||||
F: arch/arm/dts/ls1021a-twr-u-boot.dtsi
|
||||
F: drivers/crypto/fsl/
|
||||
F: include/fsl_sec.h
|
||||
+
|
||||
+UUID testing
|
||||
+M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+S: Maintained
|
||||
+F: test/lib/uuid.c
|
||||
diff --git a/test/lib/Makefile b/test/lib/Makefile
|
||||
index e0bd9e04e8..e75a263e6a 100644
|
||||
--- a/test/lib/Makefile
|
||||
+++ b/test/lib/Makefile
|
||||
@@ -22,6 +22,7 @@ obj-$(CONFIG_AES) += test_aes.o
|
||||
obj-$(CONFIG_GETOPT) += getopt.o
|
||||
obj-$(CONFIG_CRC8) += test_crc8.o
|
||||
obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
|
||||
+obj-$(CONFIG_LIB_UUID) += uuid.o
|
||||
else
|
||||
obj-$(CONFIG_SANDBOX) += kconfig_spl.o
|
||||
endif
|
||||
diff --git a/test/lib/uuid.c b/test/lib/uuid.c
|
||||
new file mode 100644
|
||||
index 0000000000..e24331a136
|
||||
--- /dev/null
|
||||
+++ b/test/lib/uuid.c
|
||||
@@ -0,0 +1,41 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Functional tests for UCLASS_FFA class
|
||||
+ *
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <uuid.h>
|
||||
+#include <test/lib.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+/* test UUID */
|
||||
+#define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0"
|
||||
+
|
||||
+#define UUID_SIZE 16
|
||||
+
|
||||
+/* The UUID binary data (little-endian format) */
|
||||
+static const u8 ref_uuid_bin[UUID_SIZE] = {
|
||||
+ 0x33, 0xd5, 0x32, 0xed,
|
||||
+ 0x09, 0x42, 0xe6, 0x99,
|
||||
+ 0x72, 0x2d, 0xc0, 0x9c,
|
||||
+ 0xa7, 0x98, 0xd9, 0xcd
|
||||
+};
|
||||
+
|
||||
+static int lib_test_uuid_to_le(struct unit_test_state *uts)
|
||||
+{
|
||||
+ const char *uuid_str = TEST_SVC_UUID;
|
||||
+ u8 ret_uuid_bin[UUID_SIZE] = {0};
|
||||
+
|
||||
+ ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin));
|
||||
+ ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+LIB_TEST(lib_test_uuid_to_le, 0);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-2139
File diff suppressed because it is too large
Load Diff
+2132
File diff suppressed because it is too large
Load Diff
-74
@@ -1,74 +0,0 @@
|
||||
From b09b391e33e024a18842dfdc99282d0050cc5fcb Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Thu, 6 Oct 2022 15:04:25 +0100
|
||||
Subject: [PATCH 04/42] arm_ffa: efi: unmap RX/TX buffers
|
||||
|
||||
unmap RX/TX buffers at ExitBootServices()
|
||||
|
||||
Unmapping the RX/TX buffers created by u-boot is needed before EFI
|
||||
runtime.
|
||||
|
||||
At EFI runtime the linux kernel takes care of allocating its own RX/TX
|
||||
buffers and registering them with the secure world.
|
||||
|
||||
Secure world should be using the RX/TX buffers created by the kernel.
|
||||
So, RX/TX buffers created by u-boot must be unmapped.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8: pass NULL device pointer to the FF-A bus operation
|
||||
v7: replace debug() by log_err()
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
lib/efi_loader/efi_boottime.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index e65ca6a4cb..3481f2afe7 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -3,6 +3,9 @@
|
||||
* EFI application boot time services
|
||||
*
|
||||
* Copyright (c) 2016 Alexander Graf
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -23,6 +26,10 @@
|
||||
#include <asm/setjmp.h>
|
||||
#include <linux/libfdt_env.h>
|
||||
|
||||
+#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT)
|
||||
+#include <arm_ffa.h>
|
||||
+#endif
|
||||
+
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* Task priority level */
|
||||
@@ -2178,6 +2185,12 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
|
||||
}
|
||||
|
||||
+#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT)
|
||||
+ /* unmap FF-A RX/TX buffers */
|
||||
+ if (ffa_bus_ops_get()->rxtx_unmap(NULL))
|
||||
+ log_err("Can't unmap FF-A RX/TX buffers\n");
|
||||
+#endif
|
||||
+
|
||||
/* Patch out unsupported runtime function */
|
||||
efi_runtime_detach();
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+436
@@ -0,0 +1,436 @@
|
||||
From 3eb4fb19777383f5f05b7ce74da141f53ffc4374 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Wed, 10 May 2023 17:27:01 +0100
|
||||
Subject: [PATCH 05/33] FF-A v15: arm_ffa: introduce armffa command
|
||||
|
||||
Provide armffa command showcasing the use of the U-Boot FF-A support
|
||||
|
||||
armffa is a command showcasing how to invoke FF-A operations.
|
||||
This provides a guidance to the client developers on how to
|
||||
call the FF-A bus interfaces. The command also allows to gather secure
|
||||
partitions information and ping these partitions. The command is also
|
||||
helpful in testing the communication with secure partitions.
|
||||
|
||||
For more details please refer to the command documentation [1].
|
||||
|
||||
[1]: doc/usage/cmd/armffa.rst
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
MAINTAINERS | 2 +
|
||||
cmd/Kconfig | 10 ++
|
||||
cmd/Makefile | 1 +
|
||||
cmd/armffa.c | 202 +++++++++++++++++++++++++++++++
|
||||
doc/arch/arm64.ffa.rst | 7 ++
|
||||
doc/usage/cmd/armffa.rst | 93 ++++++++++++++
|
||||
doc/usage/index.rst | 1 +
|
||||
drivers/firmware/arm-ffa/Kconfig | 1 +
|
||||
8 files changed, 317 insertions(+)
|
||||
create mode 100644 cmd/armffa.c
|
||||
create mode 100644 doc/usage/cmd/armffa.rst
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 9c5ebf312c..4ae82229fc 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -269,7 +269,9 @@ F: configs/cortina_presidio-asic-pnand_defconfig
|
||||
ARM FF-A
|
||||
M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
S: Maintained
|
||||
+F: cmd/armffa.c
|
||||
F: doc/arch/arm64.ffa.rst
|
||||
+F: doc/usage/cmd/armffa.rst
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/sandbox_arm_ffa.h
|
||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
||||
index 02e54f1e50..79b4f8367a 100644
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -935,6 +935,16 @@ endmenu
|
||||
|
||||
menu "Device access commands"
|
||||
|
||||
+config CMD_ARMFFA
|
||||
+ bool "Arm FF-A test command"
|
||||
+ depends on ARM_FFA_TRANSPORT
|
||||
+ help
|
||||
+ Provides a test command for the FF-A support
|
||||
+ supported options:
|
||||
+ - Listing the partition(s) info
|
||||
+ - Sending a data pattern to the specified partition
|
||||
+ - Displaying the arm_ffa device info
|
||||
+
|
||||
config CMD_ARMFLASH
|
||||
#depends on FLASH_CFI_DRIVER
|
||||
bool "armflash"
|
||||
diff --git a/cmd/Makefile b/cmd/Makefile
|
||||
index 6c37521b4e..7d20a85a46 100644
|
||||
--- a/cmd/Makefile
|
||||
+++ b/cmd/Makefile
|
||||
@@ -12,6 +12,7 @@ obj-y += panic.o
|
||||
obj-y += version.o
|
||||
|
||||
# command
|
||||
+obj-$(CONFIG_CMD_ARMFFA) += armffa.o
|
||||
obj-$(CONFIG_CMD_2048) += 2048.o
|
||||
obj-$(CONFIG_CMD_ACPI) += acpi.o
|
||||
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
|
||||
diff --git a/cmd/armffa.c b/cmd/armffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..7e6eafc03a
|
||||
--- /dev/null
|
||||
+++ b/cmd/armffa.c
|
||||
@@ -0,0 +1,202 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+#include <common.h>
|
||||
+#include <arm_ffa.h>
|
||||
+#include <command.h>
|
||||
+#include <dm.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <asm/io.h>
|
||||
+
|
||||
+/* Select the right physical address formatting according to the platform */
|
||||
+#ifdef CONFIG_PHYS_64BIT
|
||||
+#define PhysAddrLength "ll"
|
||||
+#else
|
||||
+#define PhysAddrLength ""
|
||||
+#endif
|
||||
+#define PHYS_ADDR_LN "%" PhysAddrLength "x"
|
||||
+
|
||||
+/**
|
||||
+ * ffa_get_dev() - Return the FF-A device
|
||||
+ * @devp: pointer to the FF-A device
|
||||
+ *
|
||||
+ * Search for the FF-A device.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ * 0 on success. Otherwise, failure
|
||||
+ */
|
||||
+static int ffa_get_dev(struct udevice **devp)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, devp);
|
||||
+ if (ret) {
|
||||
+ log_err("Cannot find FF-A bus device\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * do_ffa_getpart() - implementation of the getpart subcommand
|
||||
+ * @cmdtp: Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * Query a secure partition information. The secure partition UUID is provided
|
||||
+ * as an argument. The function uses the arm_ffa driver
|
||||
+ * partition_info_get operation which implements FFA_PARTITION_INFO_GET
|
||||
+ * ABI to retrieve the data. The input UUID string is expected to be in big
|
||||
+ * endian format.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+static int do_ffa_getpart(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ u32 count = 0;
|
||||
+ int ret;
|
||||
+ struct ffa_partition_desc *descs;
|
||||
+ u32 i;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (argc != 2) {
|
||||
+ log_err("Missing argument\n");
|
||||
+ return CMD_RET_USAGE;
|
||||
+ }
|
||||
+
|
||||
+ ret = ffa_get_dev(&dev);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ /* Ask the driver to fill the buffer with the SPs info */
|
||||
+
|
||||
+ ret = ffa_partition_info_get(dev, argv[1], &count, &descs);
|
||||
+ if (ret) {
|
||||
+ log_err("Failure in querying partition(s) info (error code: %d)\n", ret);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ /* SPs found , show the partition information */
|
||||
+ for (i = 0; i < count ; i++) {
|
||||
+ log_info("Partition: id = %x , exec_ctxt %x , properties %x\n",
|
||||
+ descs[i].info.id,
|
||||
+ descs[i].info.exec_ctxt,
|
||||
+ descs[i].info.properties);
|
||||
+ }
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * do_ffa_ping() - implementation of the ping subcommand
|
||||
+ * @cmdtp: Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * Send data to a secure partition. The secure partition UUID is provided
|
||||
+ * as an argument. Use the arm_ffa driver sync_send_receive operation
|
||||
+ * which implements FFA_MSG_SEND_DIRECT_{REQ,RESP} ABIs to send/receive data.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+static int do_ffa_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {
|
||||
+ .data0 = 0xaaaaaaaa,
|
||||
+ .data1 = 0xbbbbbbbb,
|
||||
+ .data2 = 0xcccccccc,
|
||||
+ .data3 = 0xdddddddd,
|
||||
+ .data4 = 0xeeeeeeee,
|
||||
+ };
|
||||
+ u16 part_id;
|
||||
+ int ret;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (argc != 2) {
|
||||
+ log_err("Missing argument\n");
|
||||
+ return CMD_RET_USAGE;
|
||||
+ }
|
||||
+
|
||||
+ part_id = strtoul(argv[1], NULL, 16);
|
||||
+ if (!part_id) {
|
||||
+ log_err("Partition ID can not be 0\n");
|
||||
+ return CMD_RET_USAGE;
|
||||
+ }
|
||||
+
|
||||
+ ret = ffa_get_dev(&dev);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ ret = ffa_sync_send_receive(dev, part_id, &msg, 1);
|
||||
+ if (!ret) {
|
||||
+ u8 cnt;
|
||||
+
|
||||
+ log_info("SP response:\n[LSB]\n");
|
||||
+ for (cnt = 0;
|
||||
+ cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64);
|
||||
+ cnt++)
|
||||
+ log_info("%llx\n", ((u64 *)&msg)[cnt]);
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ log_err("Sending direct request error (%d)\n", ret);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ *do_ffa_devlist() - implementation of the devlist subcommand
|
||||
+ * @cmdtp: [in] Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * Query the device belonging to the UCLASS_FFA
|
||||
+ * class.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+static int do_ffa_devlist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
+{
|
||||
+ struct udevice *dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = ffa_get_dev(&dev);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ log_info("device %s, addr " PHYS_ADDR_LN ", driver %s, ops " PHYS_ADDR_LN "\n",
|
||||
+ dev->name,
|
||||
+ map_to_sysmem(dev),
|
||||
+ dev->driver->name,
|
||||
+ map_to_sysmem(dev->driver->ops));
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static char armffa_help_text[] =
|
||||
+ "getpart <partition UUID>\n"
|
||||
+ " - lists the partition(s) info\n"
|
||||
+ "ping <partition ID>\n"
|
||||
+ " - sends a data pattern to the specified partition\n"
|
||||
+ "devlist\n"
|
||||
+ " - displays information about the FF-A device/driver\n";
|
||||
+
|
||||
+U_BOOT_CMD_WITH_SUBCMDS(armffa, "Arm FF-A test command", armffa_help_text,
|
||||
+ U_BOOT_SUBCMD_MKENT(getpart, 2, 1, do_ffa_getpart),
|
||||
+ U_BOOT_SUBCMD_MKENT(ping, 2, 1, do_ffa_ping),
|
||||
+ U_BOOT_SUBCMD_MKENT(devlist, 1, 1, do_ffa_devlist));
|
||||
diff --git a/doc/arch/arm64.ffa.rst b/doc/arch/arm64.ffa.rst
|
||||
index 4f817f053c..aefd527447 100644
|
||||
--- a/doc/arch/arm64.ffa.rst
|
||||
+++ b/doc/arch/arm64.ffa.rst
|
||||
@@ -205,6 +205,13 @@ The following features are provided:
|
||||
|
||||
- FF-A bus can be compiled and used without EFI
|
||||
|
||||
+The armffa command
|
||||
+-----------------------------------
|
||||
+
|
||||
+armffa is a command showcasing how to use the FF-A bus and how to invoke the driver operations.
|
||||
+
|
||||
+Please refer the command documentation at :doc:`../usage/cmd/armffa`
|
||||
+
|
||||
Example of boot logs with FF-A enabled
|
||||
--------------------------------------
|
||||
|
||||
diff --git a/doc/usage/cmd/armffa.rst b/doc/usage/cmd/armffa.rst
|
||||
new file mode 100644
|
||||
index 0000000000..3d422686c1
|
||||
--- /dev/null
|
||||
+++ b/doc/usage/cmd/armffa.rst
|
||||
@@ -0,0 +1,93 @@
|
||||
+.. SPDX-License-Identifier: GPL-2.0+:
|
||||
+
|
||||
+armffa command
|
||||
+==============
|
||||
+
|
||||
+Synopsis
|
||||
+--------
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ armffa [sub-command] [arguments]
|
||||
+
|
||||
+ sub-commands:
|
||||
+
|
||||
+ getpart [partition UUID]
|
||||
+
|
||||
+ lists the partition(s) info
|
||||
+
|
||||
+ ping [partition ID]
|
||||
+
|
||||
+ sends a data pattern to the specified partition
|
||||
+
|
||||
+ devlist
|
||||
+
|
||||
+ displays information about the FF-A device/driver
|
||||
+
|
||||
+Description
|
||||
+-----------
|
||||
+
|
||||
+armffa is a command showcasing how to use the FF-A bus and how to invoke its operations.
|
||||
+
|
||||
+This provides a guidance to the client developers on how to call the FF-A bus interfaces.
|
||||
+
|
||||
+The command also allows to gather secure partitions information and ping these partitions.
|
||||
+
|
||||
+The command is also helpful in testing the communication with secure partitions.
|
||||
+
|
||||
+Example
|
||||
+-------
|
||||
+
|
||||
+The following examples are run on Corstone-1000 platform.
|
||||
+
|
||||
+* ping
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ corstone1000# armffa ping 0x8003
|
||||
+ SP response:
|
||||
+ [LSB]
|
||||
+ fffffffe
|
||||
+ 0
|
||||
+ 0
|
||||
+ 0
|
||||
+ 0
|
||||
+
|
||||
+* ping (failure case)
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ corstone1000# armffa ping 0
|
||||
+ Sending direct request error (-22)
|
||||
+
|
||||
+* getpart
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ corstone1000# armffa getpart 33d532ed-e699-0942-c09c-a798d9cd722d
|
||||
+ Partition: id = 8003 , exec_ctxt 1 , properties 3
|
||||
+
|
||||
+* getpart (failure case)
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ corstone1000# armffa getpart 33d532ed-e699-0942-c09c-a798d9cd7221
|
||||
+ INVALID_PARAMETERS: Unrecognized UUID
|
||||
+ Failure in querying partitions count (error code: -22)
|
||||
+
|
||||
+* devlist
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ corstone1000# armffa devlist
|
||||
+ device name arm_ffa, dev 00000000fdf41c30, driver name arm_ffa, ops 00000000fffc0e98
|
||||
+
|
||||
+Configuration
|
||||
+-------------
|
||||
+
|
||||
+The command is available if CONFIG_CMD_ARMFFA=y and CONFIG_ARM_FFA_TRANSPORT=y.
|
||||
+
|
||||
+Return value
|
||||
+------------
|
||||
+
|
||||
+The return value $? is 0 (true) on success, 1 (false) on failure.
|
||||
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
|
||||
index 388e59f173..e462de2806 100644
|
||||
--- a/doc/usage/index.rst
|
||||
+++ b/doc/usage/index.rst
|
||||
@@ -22,6 +22,7 @@ Shell commands
|
||||
|
||||
cmd/acpi
|
||||
cmd/addrmap
|
||||
+ cmd/armffa
|
||||
cmd/askenv
|
||||
cmd/base
|
||||
cmd/bdinfo
|
||||
diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig
|
||||
index 9200c8028b..a7d5392859 100644
|
||||
--- a/drivers/firmware/arm-ffa/Kconfig
|
||||
+++ b/drivers/firmware/arm-ffa/Kconfig
|
||||
@@ -5,6 +5,7 @@ config ARM_FFA_TRANSPORT
|
||||
depends on DM && ARM64
|
||||
select ARM_SMCCC
|
||||
select ARM_SMCCC_FEATURES
|
||||
+ imply CMD_ARMFFA
|
||||
select LIB_UUID
|
||||
select DEVRES
|
||||
help
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-364
@@ -1,364 +0,0 @@
|
||||
From f3bc86a7ec63c0454577cb6712395c577b2cfd66 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 6 Jun 2022 12:46:38 +0100
|
||||
Subject: [PATCH 05/42] arm_ffa: introduce armffa command
|
||||
|
||||
Provide armffa command showcasing the use of the FF-A driver
|
||||
|
||||
The armffa command allows to query secure partitions data from
|
||||
the secure world and exchanging messages with the partitions
|
||||
using 64-bit FF-A direct messaging.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8:
|
||||
|
||||
* update partition_info_get() second argument to be an SP count
|
||||
* pass NULL device pointer to the FF-A bus discovery and operations
|
||||
|
||||
v7:
|
||||
|
||||
* adapt do_ffa_dev_list() following the recent update on
|
||||
uclass_first_device/uclass_next_device functions (they return void now)
|
||||
* set armffa command to use 64-bit direct messaging
|
||||
|
||||
v4:
|
||||
|
||||
* remove pattern data in do_ffa_msg_send_direct_req
|
||||
|
||||
v3:
|
||||
|
||||
* use the new driver interfaces (partition_info_get, sync_send_receive)
|
||||
in armffa command
|
||||
|
||||
v2:
|
||||
|
||||
* replace use of ffa_helper_init_device function by
|
||||
ffa_helper_bus_discover
|
||||
|
||||
v1:
|
||||
|
||||
* introduce armffa command
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
cmd/Kconfig | 10 ++
|
||||
cmd/Makefile | 2 +
|
||||
cmd/armffa.c | 237 +++++++++++++++++++++++++++++++
|
||||
drivers/firmware/arm-ffa/Kconfig | 1 +
|
||||
5 files changed, 251 insertions(+)
|
||||
create mode 100644 cmd/armffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 509619d31c..61ce6c436f 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -267,6 +267,7 @@ F: configs/cortina_presidio-asic-pnand_defconfig
|
||||
ARM FF-A
|
||||
M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
S: Maintained
|
||||
+F: cmd/armffa.c
|
||||
F: doc/arch/arm64.ffa.rst
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
||||
index b2d7598717..7d0a40e8ac 100644
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -924,6 +924,16 @@ endmenu
|
||||
|
||||
menu "Device access commands"
|
||||
|
||||
+config CMD_ARMFFA
|
||||
+ bool "Arm FF-A test command"
|
||||
+ depends on ARM_FFA_TRANSPORT
|
||||
+ help
|
||||
+ Provides a test command for the Arm FF-A driver
|
||||
+ supported options:
|
||||
+ - Listing the partition(s) info
|
||||
+ - Sending a data pattern to the specified partition
|
||||
+ - Displaying the arm_ffa device info
|
||||
+
|
||||
config CMD_ARMFLASH
|
||||
#depends on FLASH_CFI_DRIVER
|
||||
bool "armflash"
|
||||
diff --git a/cmd/Makefile b/cmd/Makefile
|
||||
index 0b6a96c1d9..c757f1647d 100644
|
||||
--- a/cmd/Makefile
|
||||
+++ b/cmd/Makefile
|
||||
@@ -12,6 +12,8 @@ obj-y += panic.o
|
||||
obj-y += version.o
|
||||
|
||||
# command
|
||||
+
|
||||
+obj-$(CONFIG_CMD_ARMFFA) += armffa.o
|
||||
obj-$(CONFIG_CMD_ACPI) += acpi.o
|
||||
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
|
||||
obj-$(CONFIG_CMD_AES) += aes.o
|
||||
diff --git a/cmd/armffa.c b/cmd/armffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..d2e8687bfb
|
||||
--- /dev/null
|
||||
+++ b/cmd/armffa.c
|
||||
@@ -0,0 +1,237 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <arm_ffa.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <common.h>
|
||||
+#include <command.h>
|
||||
+#include <dm.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+/**
|
||||
+ * do_ffa_get_singular_partition_info - implementation of the getpart subcommand
|
||||
+ * @cmdtp: Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function queries the secure partition information which the UUID is provided
|
||||
+ * as an argument. The function uses the arm_ffa driver partition_info_get operation
|
||||
+ * to retrieve the data.
|
||||
+ * The input UUID string is expected to be in big endian format.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+static int do_ffa_get_singular_partition_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ u32 count = 0;
|
||||
+ int ret;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+ u32 info_idx;
|
||||
+
|
||||
+ if (argc != 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Mode 1: getting the number of secure partitions */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, argv[0], &count, NULL);
|
||||
+ if (ret != 0) {
|
||||
+ ffa_err("Failure in querying partitions count (error code: %d)", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (!count) {
|
||||
+ ffa_info("No secure partition found");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ ffa_info("Pre-allocating %d partition(s) info structures", count);
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ if (!parts_info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the buffer with the SPs info
|
||||
+ */
|
||||
+
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, argv[0], &count, parts_info);
|
||||
+ if (ret != 0) {
|
||||
+ ffa_err("Failure in querying partition(s) info (error code: %d)", ret);
|
||||
+ free(parts_info);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * SPs found , show the partition information
|
||||
+ */
|
||||
+ for (info_idx = 0; info_idx < count ; info_idx++) {
|
||||
+ ffa_info("Partition: id = 0x%x , exec_ctxt 0x%x , properties 0x%x",
|
||||
+ parts_info[info_idx].id,
|
||||
+ parts_info[info_idx].exec_ctxt,
|
||||
+ parts_info[info_idx].properties);
|
||||
+ }
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * do_ffa_msg_send_direct_req - implementation of the ping subcommand
|
||||
+ * @cmdtp: Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function sends data to the secure partition which the ID is provided
|
||||
+ * as an argument. The function uses the arm_ffa driver sync_send_receive operation
|
||||
+ * to send data.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+int do_ffa_msg_send_direct_req(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {
|
||||
+ .data0 = 0xaaaaaaaa,
|
||||
+ .data1 = 0xbbbbbbbb,
|
||||
+ .data2 = 0xcccccccc,
|
||||
+ .data3 = 0xdddddddd,
|
||||
+ .data4 = 0xeeeeeeee,
|
||||
+ };
|
||||
+ u16 part_id;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (argc != 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ part_id = strtoul(argv[0], NULL, 16);
|
||||
+
|
||||
+ if (errno) {
|
||||
+ ffa_err("Invalid partition ID");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(NULL, part_id, &msg, 1);
|
||||
+ if (ret == 0) {
|
||||
+ u8 cnt;
|
||||
+
|
||||
+ ffa_info("SP response:\n[LSB]");
|
||||
+ for (cnt = 0;
|
||||
+ cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64);
|
||||
+ cnt++)
|
||||
+ ffa_info("0x%llx", ((u64 *)&msg)[cnt]);
|
||||
+ } else {
|
||||
+ ffa_err("Sending direct request error (%d)", ret);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ *do_ffa_dev_list - implementation of the devlist subcommand
|
||||
+ * @cmdtp: [in] Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function queries the devices belonging to the UCLASS_FFA
|
||||
+ * class. Currently, one device is expected to show up: the arm_ffa device
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+int do_ffa_dev_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
+{
|
||||
+ struct udevice *dev = NULL;
|
||||
+ int i;
|
||||
+
|
||||
+ ffa_info("arm_ffa uclass entries:");
|
||||
+
|
||||
+ for (i = 0, uclass_first_device(UCLASS_FFA, &dev);
|
||||
+ dev;
|
||||
+ uclass_next_device(&dev), i++) {
|
||||
+ ffa_info("entry %d - instance %08x, ops %08x, plat %08x",
|
||||
+ i,
|
||||
+ (u32)map_to_sysmem(dev),
|
||||
+ (u32)map_to_sysmem(dev->driver->ops),
|
||||
+ (u32)map_to_sysmem(dev_get_plat(dev)));
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct cmd_tbl armffa_commands[] = {
|
||||
+ U_BOOT_CMD_MKENT(getpart, 1, 1, do_ffa_get_singular_partition_info, "", ""),
|
||||
+ U_BOOT_CMD_MKENT(ping, 1, 1, do_ffa_msg_send_direct_req, "", ""),
|
||||
+ U_BOOT_CMD_MKENT(devlist, 0, 1, do_ffa_dev_list, "", ""),
|
||||
+};
|
||||
+
|
||||
+/**
|
||||
+ * do_armffa - the armffa command main function
|
||||
+ * @cmdtp: Command Table
|
||||
+ * @flag: flags
|
||||
+ * @argc: number of arguments
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function identifies which armffa subcommand to run.
|
||||
+ * Then, it makes sure the arm_ffa device is probed and
|
||||
+ * ready for use.
|
||||
+ * Then, it runs the subcommand.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS: on success, otherwise failure
|
||||
+ */
|
||||
+static int do_armffa(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
+{
|
||||
+ struct cmd_tbl *armffa_cmd;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (argc < 2)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ armffa_cmd = find_cmd_tbl(argv[1], armffa_commands, ARRAY_SIZE(armffa_commands));
|
||||
+
|
||||
+ argc -= 2;
|
||||
+ argv += 2;
|
||||
+
|
||||
+ if (!armffa_cmd || argc > armffa_cmd->maxargs)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ ret = ffa_bus_discover(NULL);
|
||||
+ if (ret != 0)
|
||||
+ return cmd_process_error(cmdtp, ret);
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ ret = armffa_cmd->cmd(armffa_cmd, flag, argc, argv);
|
||||
+
|
||||
+ return cmd_process_error(armffa_cmd, ret);
|
||||
+}
|
||||
+
|
||||
+U_BOOT_CMD(armffa, 4, 1, do_armffa,
|
||||
+ "Arm FF-A operations test command",
|
||||
+ "getpart <partition UUID>\n"
|
||||
+ " - lists the partition(s) info\n"
|
||||
+ "ping <partition ID>\n"
|
||||
+ " - sends a data pattern to the specified partition\n"
|
||||
+ "devlist\n"
|
||||
+ " - displays the arm_ffa device info\n");
|
||||
diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig
|
||||
index e4914b9bc7..be4df89d23 100644
|
||||
--- a/drivers/firmware/arm-ffa/Kconfig
|
||||
+++ b/drivers/firmware/arm-ffa/Kconfig
|
||||
@@ -4,6 +4,7 @@ config ARM_FFA_TRANSPORT
|
||||
bool "Enable Arm Firmware Framework for Armv8-A driver"
|
||||
depends on DM && ARM64
|
||||
select ARM_SMCCC
|
||||
+ select CMD_ARMFFA
|
||||
select LIB_UUID
|
||||
select DEVRES
|
||||
help
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+1314
File diff suppressed because it is too large
Load Diff
-1164
File diff suppressed because it is too large
Load Diff
+341
@@ -0,0 +1,341 @@
|
||||
From 00d0d8edf47430e3069e7c1dfa7a5bb7bb36bd49 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Wed, 10 May 2023 17:34:55 +0100
|
||||
Subject: [PATCH 07/33] FF-A v15: arm_ffa: introduce sandbox test cases for
|
||||
UCLASS_FFA
|
||||
|
||||
Add functional test cases for the FF-A support
|
||||
|
||||
These tests rely on the FF-A sandbox emulator and FF-A
|
||||
sandbox driver which help in inspecting the FF-A communication.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
doc/arch/arm64.ffa.rst | 1 +
|
||||
test/dm/Makefile | 3 +-
|
||||
test/dm/ffa.c | 261 +++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 265 insertions(+), 1 deletion(-)
|
||||
create mode 100644 test/dm/ffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 679a3acdd8..ccd7859c88 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -276,6 +276,7 @@ F: doc/arch/arm64.ffa.rst
|
||||
F: doc/usage/cmd/armffa.rst
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
+F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
M: Stefano Babic <sbabic@denx.de>
|
||||
diff --git a/doc/arch/arm64.ffa.rst b/doc/arch/arm64.ffa.rst
|
||||
index b7c754fa3d..325fb80346 100644
|
||||
--- a/doc/arch/arm64.ffa.rst
|
||||
+++ b/doc/arch/arm64.ffa.rst
|
||||
@@ -37,6 +37,7 @@ The U-Boot FF-A support provides the following parts:
|
||||
FF-A ABIs inspection methods.
|
||||
- An FF-A sandbox device driver for FF-A communication with the emulated Secure World.
|
||||
The driver leverages the FF-A Uclass to establish FF-A communication.
|
||||
+- Sandbox FF-A test cases.
|
||||
|
||||
FF-A and SMC specifications
|
||||
-------------------------------------------
|
||||
diff --git a/test/dm/Makefile b/test/dm/Makefile
|
||||
index 3799b1ae8f..7ed00733c1 100644
|
||||
--- a/test/dm/Makefile
|
||||
+++ b/test/dm/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (c) 2013 Google, Inc
|
||||
-# Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
|
||||
obj-$(CONFIG_UT_DM) += test-dm.o
|
||||
|
||||
@@ -92,6 +92,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
|
||||
obj-$(CONFIG_ACPI_PMC) += pmc.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_PWM) += pwm.o
|
||||
+obj-$(CONFIG_ARM_FFA_TRANSPORT) += ffa.o
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_RAM) += ram.o
|
||||
obj-y += regmap.o
|
||||
diff --git a/test/dm/ffa.c b/test/dm/ffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..6912666bb4
|
||||
--- /dev/null
|
||||
+++ b/test/dm/ffa.c
|
||||
@@ -0,0 +1,261 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Functional tests for UCLASS_FFA class
|
||||
+ *
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <console.h>
|
||||
+#include <dm.h>
|
||||
+#include <asm/sandbox_arm_ffa.h>
|
||||
+#include <asm/sandbox_arm_ffa_priv.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+/* Functional tests for the UCLASS_FFA */
|
||||
+
|
||||
+static int check_fwk_version(struct ffa_priv *uc_priv, struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_sandbox_data func_data;
|
||||
+ u32 fwk_version = 0;
|
||||
+
|
||||
+ func_data.data0 = &fwk_version;
|
||||
+ func_data.data0_size = sizeof(fwk_version);
|
||||
+ ut_assertok(sandbox_query_ffa_emul_state(FFA_VERSION, &func_data));
|
||||
+ ut_asserteq(uc_priv->fwk_version, fwk_version);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int check_endpoint_id(struct ffa_priv *uc_priv, struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_asserteq(0, uc_priv->id);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int check_rxtxbuf(struct ffa_priv *uc_priv, struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_assertnonnull(uc_priv->pair.rxbuf);
|
||||
+ ut_assertnonnull(uc_priv->pair.txbuf);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int check_features(struct ffa_priv *uc_priv, struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_assert(uc_priv->pair.rxtx_min_pages == RXTX_4K ||
|
||||
+ uc_priv->pair.rxtx_min_pages == RXTX_16K ||
|
||||
+ uc_priv->pair.rxtx_min_pages == RXTX_64K);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_mapped_flag(u32 queried_func_id,
|
||||
+ u8 rxbuf_mapped,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ switch (queried_func_id) {
|
||||
+ case FFA_RXTX_MAP:
|
||||
+ ut_asserteq(1, rxbuf_mapped);
|
||||
+ break;
|
||||
+ case FFA_RXTX_UNMAP:
|
||||
+ ut_asserteq(0, rxbuf_mapped);
|
||||
+ break;
|
||||
+ default:
|
||||
+ ut_assert(false);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_release_flag(u8 rxbuf_owned, struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_asserteq(0, rxbuf_owned);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int test_ffa_msg_send_direct_req(u16 part_id, struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg;
|
||||
+ u8 cnt;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev));
|
||||
+
|
||||
+ ut_assertok(ffa_sync_send_receive(dev, part_id, &msg, 1));
|
||||
+
|
||||
+ for (cnt = 0; cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64); cnt++)
|
||||
+ ut_asserteq_64(-1UL, ((u64 *)&msg)[cnt]);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int test_partitions_and_comms(const char *service_uuid,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_partition_desc *descs;
|
||||
+ u32 count, i, j, valid_sps = 0;
|
||||
+ struct udevice *dev;
|
||||
+ struct ffa_sandbox_data func_data;
|
||||
+ struct ffa_partitions *partitions;
|
||||
+
|
||||
+ ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev));
|
||||
+
|
||||
+ /* Get from the driver the count and information of the SPs matching the UUID */
|
||||
+ ut_assertok(ffa_partition_info_get(dev, service_uuid, &count, &descs));
|
||||
+
|
||||
+ /* Make sure the count is correct */
|
||||
+ ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, count);
|
||||
+
|
||||
+ /* SPs found , verify the partitions information */
|
||||
+
|
||||
+ func_data.data0 = &partitions;
|
||||
+ func_data.data0_size = sizeof(struct ffa_partitions *);
|
||||
+ ut_assertok(sandbox_query_ffa_emul_state(FFA_PARTITION_INFO_GET, &func_data));
|
||||
+
|
||||
+ for (i = 0; i < count ; i++) {
|
||||
+ for (j = 0;
|
||||
+ j < partitions->count;
|
||||
+ j++) {
|
||||
+ if (descs[i].info.id ==
|
||||
+ partitions->descs[j].info.id) {
|
||||
+ valid_sps++;
|
||||
+ ut_asserteq_mem(&descs[i],
|
||||
+ &partitions->descs[j],
|
||||
+ sizeof(struct ffa_partition_desc));
|
||||
+ /* Send and receive data from the current partition */
|
||||
+ test_ffa_msg_send_direct_req(descs[i].info.id, uts);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Verify expected partitions found in the emulated secure world */
|
||||
+ ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, valid_sps);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int dm_test_ffa_ack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_priv *uc_priv;
|
||||
+ struct ffa_sandbox_data func_data;
|
||||
+ u8 rxbuf_flag = 0;
|
||||
+ const char *svc1_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *svc2_uuid = SANDBOX_SERVICE2_UUID;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ /* Test probing the sandbox FF-A bus */
|
||||
+ ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev));
|
||||
+
|
||||
+ /* Get a pointer to the sandbox FF-A bus private data */
|
||||
+ uc_priv = dev_get_uclass_priv(dev);
|
||||
+
|
||||
+ /* Make sure the private data pointer is retrieved */
|
||||
+ ut_assertnonnull(uc_priv);
|
||||
+
|
||||
+ /* Test FFA_VERSION */
|
||||
+ check_fwk_version(uc_priv, uts);
|
||||
+
|
||||
+ /* Test FFA_ID_GET */
|
||||
+ check_endpoint_id(uc_priv, uts);
|
||||
+
|
||||
+ /* Test FFA_FEATURES */
|
||||
+ check_features(uc_priv, uts);
|
||||
+
|
||||
+ /* Test RX/TX buffers */
|
||||
+ check_rxtxbuf(uc_priv, uts);
|
||||
+
|
||||
+ /* Test FFA_RXTX_MAP */
|
||||
+ func_data.data0 = &rxbuf_flag;
|
||||
+ func_data.data0_size = sizeof(rxbuf_flag);
|
||||
+
|
||||
+ rxbuf_flag = 0;
|
||||
+ sandbox_query_ffa_emul_state(FFA_RXTX_MAP, &func_data);
|
||||
+ check_rxbuf_mapped_flag(FFA_RXTX_MAP, rxbuf_flag, uts);
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ test_partitions_and_comms(svc1_uuid, uts);
|
||||
+
|
||||
+ /* Test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ sandbox_query_ffa_emul_state(FFA_RX_RELEASE, &func_data);
|
||||
+ check_rxbuf_release_flag(rxbuf_flag, uts);
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ test_partitions_and_comms(svc2_uuid, uts);
|
||||
+
|
||||
+ /* Test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_query_ffa_emul_state(FFA_RX_RELEASE, &func_data));
|
||||
+ check_rxbuf_release_flag(rxbuf_flag, uts);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_ack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
+
|
||||
+static int dm_test_ffa_nack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_priv *uc_priv;
|
||||
+ const char *valid_svc_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *unvalid_svc_uuid = SANDBOX_SERVICE3_UUID;
|
||||
+ const char *unvalid_svc_uuid_str = SANDBOX_SERVICE4_UUID;
|
||||
+ struct ffa_send_direct_data msg;
|
||||
+ int ret;
|
||||
+ u32 count;
|
||||
+ u16 part_id = 0;
|
||||
+ struct udevice *dev;
|
||||
+ struct ffa_partition_desc *descs = NULL;
|
||||
+
|
||||
+ /* Test probing the sandbox FF-A bus */
|
||||
+ ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev));
|
||||
+
|
||||
+ /* Get a pointer to the sandbox FF-A bus private data */
|
||||
+ uc_priv = dev_get_uclass_priv(dev);
|
||||
+
|
||||
+ /* Make sure the private data pointer is retrieved */
|
||||
+ ut_assertnonnull(uc_priv);
|
||||
+
|
||||
+ /* Query partitions count using invalid arguments */
|
||||
+ ret = ffa_partition_info_get(dev, NULL, NULL, NULL);
|
||||
+ ut_asserteq(-EINVAL, ret);
|
||||
+ ret = ffa_partition_info_get(dev, unvalid_svc_uuid, NULL, NULL);
|
||||
+ ut_asserteq(-EINVAL, ret);
|
||||
+ ret = ffa_partition_info_get(dev, unvalid_svc_uuid, &count, NULL);
|
||||
+ ut_asserteq(-EINVAL, ret);
|
||||
+
|
||||
+ /* Query partitions count using an invalid UUID string */
|
||||
+ ret = ffa_partition_info_get(dev, unvalid_svc_uuid_str, &count, &descs);
|
||||
+ ut_asserteq(-EINVAL, ret);
|
||||
+
|
||||
+ /* Query partitions count using an invalid UUID (no matching SP) */
|
||||
+ count = 0;
|
||||
+ ret = ffa_partition_info_get(dev, unvalid_svc_uuid, &count, &descs);
|
||||
+ ut_asserteq(0, count);
|
||||
+
|
||||
+ /* Query partitions data using a valid UUID */
|
||||
+ count = 0;
|
||||
+ ut_assertok(ffa_partition_info_get(dev, valid_svc_uuid, &count, &descs));
|
||||
+ /* Make sure partitions are detected */
|
||||
+ ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, count);
|
||||
+ ut_assertnonnull(descs);
|
||||
+
|
||||
+ /* Send data to an invalid partition */
|
||||
+ ret = ffa_sync_send_receive(dev, part_id, &msg, 1);
|
||||
+ ut_asserteq(-EINVAL, ret);
|
||||
+
|
||||
+ /* Send data to a valid partition */
|
||||
+ part_id = uc_priv->partitions.descs[0].info.id;
|
||||
+ ut_assertok(ffa_sync_send_receive(dev, part_id, &msg, 1));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_nack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-472
@@ -1,472 +0,0 @@
|
||||
From 3664fe7503cbc4348bbd7bcb8fbf7e1db332ac5d Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 6 Jun 2022 17:26:06 +0100
|
||||
Subject: [PATCH 07/42] arm_ffa: introduce Sandbox test cases for UCLASS_FFA
|
||||
|
||||
Add functional test cases for the FF-A core driver
|
||||
|
||||
These tests rely on the FF-A Sandbox driver which helps in
|
||||
inspecting the FF-A core driver.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8:
|
||||
|
||||
* update partition_info_get() second argument to be an SP count
|
||||
* pass NULL device pointer to the FF-A bus discovery and operations
|
||||
|
||||
v7: set the tests to use 64-bit direct messaging
|
||||
|
||||
v4: align sandbox tests with the new FF-A driver interfaces
|
||||
and new way of error handling
|
||||
|
||||
v1: introduce sandbox tests
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
test/dm/Makefile | 2 +
|
||||
test/dm/ffa.c | 392 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 395 insertions(+)
|
||||
create mode 100644 test/dm/ffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 297d165f84..c1d3d4ae1c 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/sandbox_arm_ffa.h
|
||||
+F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
M: Stefano Babic <sbabic@denx.de>
|
||||
diff --git a/test/dm/Makefile b/test/dm/Makefile
|
||||
index 7a79b6e1a2..85e99e1c12 100644
|
||||
--- a/test/dm/Makefile
|
||||
+++ b/test/dm/Makefile
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (c) 2013 Google, Inc
|
||||
+# (C) Copyright 2022 ARM Limited
|
||||
|
||||
obj-$(CONFIG_UT_DM) += test-dm.o
|
||||
|
||||
@@ -85,6 +86,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
|
||||
obj-$(CONFIG_ACPI_PMC) += pmc.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_PWM) += pwm.o
|
||||
+obj-$(CONFIG_SANDBOX_FFA) += ffa.o
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_RAM) += ram.o
|
||||
obj-y += regmap.o
|
||||
diff --git a/test/dm/ffa.c b/test/dm/ffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..128d8626a7
|
||||
--- /dev/null
|
||||
+++ b/test/dm/ffa.c
|
||||
@@ -0,0 +1,392 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Functional tests for UCLASS_FFA class
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <console.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/test.h>
|
||||
+#include "../../drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h"
|
||||
+#include <sandbox_arm_ffa.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+/* Macros */
|
||||
+
|
||||
+#define LOG_MSG_SZ (100)
|
||||
+#define LOG_CMD_SZ (LOG_MSG_SZ * 2)
|
||||
+
|
||||
+/* Functional tests for the UCLASS_FFA */
|
||||
+
|
||||
+static int dm_test_ffa_log(struct unit_test_state *uts, char *msg)
|
||||
+{
|
||||
+ char cmd[LOG_CMD_SZ] = {0};
|
||||
+
|
||||
+ console_record_reset();
|
||||
+
|
||||
+ snprintf(cmd, LOG_CMD_SZ, "echo \"%s\"", msg);
|
||||
+ run_command(cmd, 0);
|
||||
+
|
||||
+ ut_assert_console_end();
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_fwk_version(struct ffa_prvdata *prvdata, struct sandbox_ffa_prvdata *sdx_prvdata,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (prvdata->fwk_version != sdx_prvdata->fwk_version) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ,
|
||||
+ "[%s]: Error: framework version: core = 0x%x , sandbox = 0x%x", __func__,
|
||||
+ prvdata->fwk_version,
|
||||
+ sdx_prvdata->fwk_version);
|
||||
+
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_endpoint_id(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (prvdata->id) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ,
|
||||
+ "[%s]: Error: endpoint id: core = 0x%x", __func__, prvdata->id);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_core_dev(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!prvdata->dev) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: core device NULL", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_sandbox_dev(struct sandbox_ffa_prvdata *sdx_prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!sdx_prvdata->dev) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: sandbox device NULL", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_rxtxbuf(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!prvdata->pair.rxbuf && prvdata->pair.txbuf) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: rxbuf = 0x%llx txbuf = 0x%llx", __func__,
|
||||
+ prvdata->pair.rxbuf,
|
||||
+ prvdata->pair.txbuf);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_features(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ if (prvdata->pair.rxtx_min_pages != RXTX_4K &&
|
||||
+ prvdata->pair.rxtx_min_pages != RXTX_16K &&
|
||||
+ prvdata->pair.rxtx_min_pages != RXTX_64K) {
|
||||
+ snprintf(msg,
|
||||
+ LOG_MSG_SZ,
|
||||
+ "[%s]: Error: FFA_RXTX_MAP features = 0x%lx",
|
||||
+ __func__,
|
||||
+ prvdata->pair.rxtx_min_pages);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_mapped_flag(u32 queried_func_id,
|
||||
+ u8 rxbuf_mapped,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ switch (queried_func_id) {
|
||||
+ case FFA_RXTX_MAP:
|
||||
+ {
|
||||
+ if (rxbuf_mapped)
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ break;
|
||||
+ }
|
||||
+ case FFA_RXTX_UNMAP:
|
||||
+ {
|
||||
+ if (!rxbuf_mapped)
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: %s mapping issue", __func__,
|
||||
+ (queried_func_id == FFA_RXTX_MAP ? "FFA_RXTX_MAP" : "FFA_RXTX_UNMAP"));
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+
|
||||
+ return CMD_RET_FAILURE;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_release_flag(u8 rxbuf_owned, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (rxbuf_owned) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: RX buffer not released", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int test_ffa_msg_send_direct_req(u16 part_id, struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u8 cnt;
|
||||
+
|
||||
+ ut_assertok(ffa_bus_ops_get()->sync_send_receive(NULL, part_id, &msg, 1));
|
||||
+
|
||||
+ for (cnt = 0; cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64); cnt++)
|
||||
+ ut_assertok(((u64 *)&msg)[cnt] != 0xffffffffffffffff);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int test_partitions_and_comms(const char *service_uuid,
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ u32 count = 0;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+ u32 info_idx, exp_info_idx;
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, service_uuid, &count, NULL);
|
||||
+ /* make sure partitions are detected */
|
||||
+ ut_assertok(ret != 0);
|
||||
+ ut_assertok(count != SANDBOX_SP_COUNT_PER_VALID_SERVICE);
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ ut_assertok(!parts_info);
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, service_uuid, &count, parts_info);
|
||||
+ if (ret != 0) {
|
||||
+ free(parts_info);
|
||||
+ ut_assertok(ret != 0);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * SPs found , verify the partitions information
|
||||
+ */
|
||||
+
|
||||
+ ret = CMD_RET_FAILURE;
|
||||
+
|
||||
+ for (info_idx = 0; info_idx < count ; info_idx++) {
|
||||
+ for (exp_info_idx = 0;
|
||||
+ exp_info_idx < sdx_prvdata->partitions.count;
|
||||
+ exp_info_idx++) {
|
||||
+ if (parts_info[info_idx].id ==
|
||||
+ sdx_prvdata->partitions.descs[exp_info_idx].info.id) {
|
||||
+ ret = memcmp(&parts_info[info_idx],
|
||||
+ &sdx_prvdata->partitions.descs[exp_info_idx]
|
||||
+ .info,
|
||||
+ sizeof(struct ffa_partition_info));
|
||||
+ if (ret)
|
||||
+ free(parts_info);
|
||||
+ ut_assertok(ret != 0);
|
||||
+ /* send and receive data from the current partition */
|
||||
+ test_ffa_msg_send_direct_req(parts_info[info_idx].id, uts);
|
||||
+ }
|
||||
+ ret = CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ /* Verify expected partitions found in the emulated secure world*/
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int dm_test_ffa_ack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_prvdata *prvdata = NULL;
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata = NULL;
|
||||
+ struct ffa_sandbox_data func_data = {0};
|
||||
+ u8 rxbuf_flag = 0;
|
||||
+ const char *svc1_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *svc2_uuid = SANDBOX_SERVICE2_UUID;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* test probing FF-A devices */
|
||||
+ ut_assertok(ffa_bus_discover(NULL));
|
||||
+
|
||||
+ /* get a pointer to the FF-A core and sandbox drivers private data */
|
||||
+ func_data.data0 = &prvdata;
|
||||
+ func_data.data0_size = sizeof(prvdata);
|
||||
+ func_data.data1 = &sdx_prvdata;
|
||||
+ func_data.data1_size = sizeof(sdx_prvdata);
|
||||
+
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_VERSION, &func_data));
|
||||
+
|
||||
+ /* make sure private data pointers are retrieved */
|
||||
+ ut_assertok(prvdata == 0);
|
||||
+ ut_assertok(sdx_prvdata == 0);
|
||||
+
|
||||
+ /* make sure dev devices created */
|
||||
+ ut_assertok(check_core_dev(prvdata, uts));
|
||||
+ ut_assertok(check_sandbox_dev(sdx_prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_VERSION */
|
||||
+ ut_assertok(check_fwk_version(prvdata, sdx_prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_ID_GET */
|
||||
+ ut_assertok(check_endpoint_id(prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_FEATURES */
|
||||
+ ut_assertok(check_features(prvdata, uts));
|
||||
+
|
||||
+ /* test core RX/TX buffers */
|
||||
+ ut_assertok(check_rxtxbuf(prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_RXTX_MAP */
|
||||
+ func_data.data0 = &rxbuf_flag;
|
||||
+ func_data.data0_size = sizeof(rxbuf_flag);
|
||||
+
|
||||
+ rxbuf_flag = 0;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RXTX_MAP, &func_data));
|
||||
+ ut_assertok(check_rxbuf_mapped_flag(FFA_RXTX_MAP, rxbuf_flag, uts));
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ ret = test_partitions_and_comms(svc1_uuid, sdx_prvdata, uts);
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ /* test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RX_RELEASE, &func_data));
|
||||
+ ut_assertok(check_rxbuf_release_flag(rxbuf_flag, uts));
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ ret = test_partitions_and_comms(svc2_uuid, sdx_prvdata, uts);
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ /* test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RX_RELEASE, &func_data));
|
||||
+ ut_assertok(check_rxbuf_release_flag(rxbuf_flag, uts));
|
||||
+
|
||||
+ /* test FFA_RXTX_UNMAP */
|
||||
+ ut_assertok(ffa_bus_ops_get()->rxtx_unmap(NULL));
|
||||
+
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RXTX_UNMAP, &func_data));
|
||||
+ ut_assertok(check_rxbuf_mapped_flag(FFA_RXTX_UNMAP, rxbuf_flag, uts));
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_ack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
+
|
||||
+static int dm_test_ffa_nack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_prvdata *prvdata = NULL;
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata = NULL;
|
||||
+ struct ffa_sandbox_data func_data = {0};
|
||||
+ const char *valid_svc_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *unvalid_svc_uuid = SANDBOX_SERVICE3_UUID;
|
||||
+ const char *unvalid_svc_uuid_str = SANDBOX_SERVICE4_UUID;
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ u32 count = 0;
|
||||
+ u16 part_id = 0;
|
||||
+
|
||||
+ /* test probing FF-A devices */
|
||||
+ ut_assertok(ffa_bus_discover(NULL));
|
||||
+
|
||||
+ /* get a pointer to the FF-A core and sandbox drivers private data */
|
||||
+ func_data.data0 = &prvdata;
|
||||
+ func_data.data0_size = sizeof(prvdata);
|
||||
+ func_data.data1 = &sdx_prvdata;
|
||||
+ func_data.data1_size = sizeof(sdx_prvdata);
|
||||
+
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_VERSION, &func_data));
|
||||
+
|
||||
+ /* make sure private data pointers are retrieved */
|
||||
+ ut_assertok(prvdata == 0);
|
||||
+ ut_assertok(sdx_prvdata == 0);
|
||||
+
|
||||
+ /* make sure dev devices created */
|
||||
+ ut_assertok(check_core_dev(prvdata, uts));
|
||||
+ ut_assertok(check_sandbox_dev(sdx_prvdata, uts));
|
||||
+
|
||||
+ /* query partitions count using invalid arguments */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, unvalid_svc_uuid, NULL, NULL);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* query partitions count using an invalid UUID string */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, unvalid_svc_uuid_str, &count, NULL);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* query partitions count using an invalid UUID (no matching SP) */
|
||||
+ count = 0;
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, unvalid_svc_uuid, &count, NULL);
|
||||
+ ut_assertok(count != 0);
|
||||
+
|
||||
+ /* query partitions count using a valid UUID */
|
||||
+ count = 0;
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, valid_svc_uuid, &count, NULL);
|
||||
+ /* make sure partitions are detected */
|
||||
+ ut_assertok(ret != 0);
|
||||
+ ut_assertok(count != SANDBOX_SP_COUNT_PER_VALID_SERVICE);
|
||||
+
|
||||
+ /* send data to an invalid partition */
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(NULL, part_id, &msg, 1);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* send data to a valid partition */
|
||||
+ part_id = prvdata->partitions.descs[0].info.id;
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(NULL, part_id, &msg, 1);
|
||||
+ ut_assertok(ret != 0);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_nack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+26
-39
@@ -1,105 +1,92 @@
|
||||
From 5af272d2bb2a7a8c8a4732c8d598dd1713856949 Mon Sep 17 00:00:00 2001
|
||||
From 78547a9f322b981a93bbeeb48b3eda1d2ab35cd0 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Tue, 29 Nov 2022 14:48:34 +0000
|
||||
Subject: [PATCH 08/42] arm_ffa: introduce armffa command Sandbox test
|
||||
Date: Fri, 23 Jun 2023 13:44:10 +0100
|
||||
Subject: [PATCH 08/33] FF-A v15: arm_ffa: introduce armffa command Sandbox
|
||||
test
|
||||
|
||||
Add Sandbox test for the armffa command
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4: drop use of helper APIs
|
||||
|
||||
v1: introduce armffa command sandbox test
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
test/cmd/Makefile | 2 ++
|
||||
test/cmd/armffa.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 42 insertions(+)
|
||||
test/cmd/armffa.c | 33 +++++++++++++++++++++++++++++++++
|
||||
3 files changed, 36 insertions(+)
|
||||
create mode 100644 test/cmd/armffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index c1d3d4ae1c..a2f60a3b93 100644
|
||||
index ccd7859c88..885d91fe5c 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst
|
||||
@@ -276,6 +276,7 @@ F: doc/arch/arm64.ffa.rst
|
||||
F: doc/usage/cmd/armffa.rst
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/sandbox_arm_ffa.h
|
||||
+F: test/cmd/armffa.c
|
||||
F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
|
||||
index bc961df3dc..21aa6d740e 100644
|
||||
index 055adc65a2..1d1dbb4fbc 100644
|
||||
--- a/test/cmd/Makefile
|
||||
+++ b/test/cmd/Makefile
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (c) 2013 Google, Inc
|
||||
+# (C) Copyright 2022 ARM Limited
|
||||
+# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
|
||||
ifdef CONFIG_HUSH_PARSER
|
||||
obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
|
||||
@@ -18,6 +19,7 @@ obj-$(CONFIG_CMD_PINMUX) += pinmux.o
|
||||
obj-$(CONFIG_CMD_PWM) += pwm.o
|
||||
@@ -23,6 +24,7 @@ obj-$(CONFIG_CMD_SEAMA) += seama.o
|
||||
ifdef CONFIG_SANDBOX
|
||||
obj-$(CONFIG_CMD_READ) += rw.o
|
||||
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
|
||||
+obj-$(CONFIG_SANDBOX_FFA) += armffa.o
|
||||
+obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
|
||||
endif
|
||||
obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
|
||||
obj-$(CONFIG_CMD_WGET) += wget.o
|
||||
diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..e04363ba63
|
||||
index 0000000000..9a44a397e8
|
||||
--- /dev/null
|
||||
+++ b/test/cmd/armffa.c
|
||||
@@ -0,0 +1,39 @@
|
||||
@@ -0,0 +1,33 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Test for armffa command
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <sandbox_arm_ffa.h>
|
||||
+#include <string.h>
|
||||
+#include <asm/sandbox_arm_ffa.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+#define PING_CMD_SIZE 19
|
||||
+
|
||||
+/* Basic test of 'armffa' command */
|
||||
+static int dm_test_armffa_cmd(struct unit_test_state *uts)
|
||||
+{
|
||||
+ char ping_cmd[PING_CMD_SIZE] = {0};
|
||||
+
|
||||
+ ut_assertok(ffa_bus_discover(NULL));
|
||||
+
|
||||
+ /* armffa getpart <UUID> */
|
||||
+ ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
|
||||
+
|
||||
+ snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
|
||||
+
|
||||
+ /* armffa ping <ID> */
|
||||
+ ut_assertok(run_command(ping_cmd, 0));
|
||||
+ ut_assertok(run_commandf("armffa ping 0x%x", SANDBOX_SP1_ID));
|
||||
+
|
||||
+ /* armffa devlist */
|
||||
+ ut_assertok(run_command("armffa devlist", 0));
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
+162
-213
@@ -1,7 +1,7 @@
|
||||
From ca1ae0e78ee3476090919459ec5d08187d5eefbc Mon Sep 17 00:00:00 2001
|
||||
From 342844c2a5ad6beb127e1e8e52b311df77cff472 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 15 Aug 2022 15:12:49 +0100
|
||||
Subject: [PATCH 09/42] arm_ffa: efi: introduce FF-A MM communication
|
||||
Subject: [PATCH 09/33] FF-A v15: arm_ffa: efi: introduce FF-A MM communication
|
||||
|
||||
Add MM communication support using FF-A transport
|
||||
|
||||
@@ -27,80 +27,33 @@ consumed by the EFI subsystem.
|
||||
MM communication protocol supports FF-A 64-bit direct messaging.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Tested-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8:
|
||||
|
||||
* isolate the compilation choices between FF-A and OP-TEE
|
||||
* update partition_info_get() second argument to be an SP count
|
||||
* pass NULL device pointer to the FF-A bus discovery and operations
|
||||
|
||||
v7:
|
||||
|
||||
* set the MM door bell event to use 64-bit direct messaging
|
||||
* issue a compile time error when one of these macros are not found :
|
||||
FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_OFFSET, FFA_SHARED_MM_BUFFER_ADDR
|
||||
* make mm_sp_svc_uuid static
|
||||
* replace EINVAL with ENOMEM in ffa_discover_mm_sp_id() when calloc() fails
|
||||
* improve use of unmap_sysmem() in ffa_mm_communicate()
|
||||
|
||||
v6:
|
||||
|
||||
* add FF-A runtime discovery at MM communication level
|
||||
* drop EFI runtime support for FF-A MM communication
|
||||
* revert the changes in include/mm_communication.h for
|
||||
efi_mm_communicate_header and smm_variable_access structures
|
||||
|
||||
v4:
|
||||
|
||||
* use the new FF-A driver interfaces
|
||||
* discover MM partitions at runtime
|
||||
* copy FF-A driver private data to EFI runtime section at
|
||||
ExitBootServices()
|
||||
* drop use of FFA_ERR_STAT_SUCCESS error code
|
||||
* replace EFI_BUFFER_TOO_SMALL with EFI_OUT_OF_RESOURCES
|
||||
in ffa_mm_communicate(). No need for efi_memcpy_runtime() anymore
|
||||
* revert the error log in mm_communicate() in case of failure
|
||||
* remove packed attribute from efi_mm_communicate_header and
|
||||
smm_variable_communicate_header
|
||||
|
||||
v2:
|
||||
|
||||
* set default values to 0 for FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_ADDR and MM_SP_UUID_DATA and add warnings
|
||||
|
||||
v1:
|
||||
|
||||
* introduce FF-A MM communication
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
include/mm_communication.h | 5 +
|
||||
lib/efi_loader/Kconfig | 14 +-
|
||||
lib/efi_loader/efi_variable_tee.c | 294 +++++++++++++++++++++++++++++-
|
||||
3 files changed, 307 insertions(+), 6 deletions(-)
|
||||
include/mm_communication.h | 13 ++
|
||||
lib/efi_loader/Kconfig | 46 +++++-
|
||||
lib/efi_loader/efi_variable_tee.c | 257 +++++++++++++++++++++++++++++-
|
||||
3 files changed, 309 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/include/mm_communication.h b/include/mm_communication.h
|
||||
index e65fbde60d..d409bed777 100644
|
||||
index e65fbde60d..f17847583b 100644
|
||||
--- a/include/mm_communication.h
|
||||
+++ b/include/mm_communication.h
|
||||
@@ -6,6 +6,8 @@
|
||||
@@ -6,6 +6,9 @@
|
||||
* Copyright (c) 2017, Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2020 Linaro Ltd. <sughosh.ganu@linaro.org>
|
||||
* Copyright (C) 2020 Linaro Ltd. <ilias.apalodimas@linaro.org>
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
|
||||
#ifndef _MM_COMMUNICATION_H_
|
||||
@@ -13,6 +15,9 @@
|
||||
@@ -13,6 +16,9 @@
|
||||
|
||||
#include <part_efi.h>
|
||||
|
||||
@@ -110,18 +63,32 @@ index e65fbde60d..d409bed777 100644
|
||||
/*
|
||||
* Interface to the pseudo Trusted Application (TA), which provides a
|
||||
* communication channel with the Standalone MM (Management Mode)
|
||||
@@ -248,4 +254,11 @@ struct smm_variable_var_check_property {
|
||||
u16 name[];
|
||||
};
|
||||
|
||||
+/* supported MM transports */
|
||||
+enum mm_comms_select {
|
||||
+ MM_COMMS_UNDEFINED,
|
||||
+ MM_COMMS_FFA,
|
||||
+ MM_COMMS_OPTEE
|
||||
+};
|
||||
+
|
||||
#endif /* _MM_COMMUNICATION_H_ */
|
||||
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
|
||||
index b498c72206..ca73908481 100644
|
||||
index c5835e6ef6..553e6a30a2 100644
|
||||
--- a/lib/efi_loader/Kconfig
|
||||
+++ b/lib/efi_loader/Kconfig
|
||||
@@ -55,13 +55,23 @@ config EFI_VARIABLE_FILE_STORE
|
||||
@@ -55,13 +55,55 @@ config EFI_VARIABLE_FILE_STORE
|
||||
stored as file /ubootefi.var on the EFI system partition.
|
||||
|
||||
config EFI_MM_COMM_TEE
|
||||
- bool "UEFI variables storage service via OP-TEE"
|
||||
- depends on OPTEE
|
||||
+ bool "UEFI variables storage service via the trusted world"
|
||||
+ depends on OPTEE || ARM_FFA_TRANSPORT
|
||||
+ select ARM_FFA_TRANSPORT
|
||||
+ select TEE
|
||||
+ select OPTEE
|
||||
help
|
||||
+ Allowing access to the MM SP services (SPs such as StandAlonneMM, smm-gateway).
|
||||
+ When using the u-boot OP-TEE driver, StandAlonneMM is supported.
|
||||
@@ -136,85 +103,88 @@ index b498c72206..ca73908481 100644
|
||||
+ A door bell mechanism is used to notify the SP when there is data in the shared
|
||||
+ MM buffer. The data is copied by u-boot to the shared buffer before issuing
|
||||
+ the door bell event.
|
||||
+
|
||||
+config FFA_SHARED_MM_BUF_SIZE
|
||||
+ int "Memory size of the shared MM communication buffer"
|
||||
+ default 0
|
||||
+ depends on EFI_MM_COMM_TEE
|
||||
+ help
|
||||
+ This defines the size in bytes of the memory area reserved for the shared
|
||||
+ buffer used for communication between the MM feature in U-Boot and
|
||||
+ the MM SP in secure world.
|
||||
+ The size of the memory region must be a multiple of the size of the maximum
|
||||
+ translation granule size that is specified in the ID_AA64MMFR0_EL1 System register.
|
||||
+ It is assumed that the MM SP knows the size of the shared MM communication buffer.
|
||||
+
|
||||
+config FFA_SHARED_MM_BUF_OFFSET
|
||||
+ int "Data offset in the shared MM communication buffer"
|
||||
+ default 0
|
||||
+ depends on EFI_MM_COMM_TEE
|
||||
+ help
|
||||
+ This defines the offset in bytes of the data read or written to in the shared
|
||||
+ buffer by the MM SP.
|
||||
+
|
||||
+config FFA_SHARED_MM_BUF_ADDR
|
||||
+ hex "Define the address of the shared MM communication buffer"
|
||||
+ default 0x0
|
||||
+ depends on EFI_MM_COMM_TEE
|
||||
+ help
|
||||
+ This defines the address of the shared MM communication buffer
|
||||
+ used for communication between the MM feature in U-Boot and
|
||||
+ the MM SP in secure world.
|
||||
+ It is assumed that the MM SP knows the address of the shared MM communication buffer.
|
||||
+
|
||||
config EFI_VARIABLE_NO_STORE
|
||||
bool "Don't persist non-volatile UEFI variables"
|
||||
help
|
||||
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
|
||||
index dfef18435d..3933a24e8c 100644
|
||||
index dfef18435d..5137b871ea 100644
|
||||
--- a/lib/efi_loader/efi_variable_tee.c
|
||||
+++ b/lib/efi_loader/efi_variable_tee.c
|
||||
@@ -4,9 +4,12 @@
|
||||
@@ -4,17 +4,34 @@
|
||||
*
|
||||
* Copyright (C) 2019 Linaro Ltd. <sughosh.ganu@linaro.org>
|
||||
* Copyright (C) 2019 Linaro Ltd. <ilias.apalodimas@linaro.org>
|
||||
+ * Copyright (C) 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
+#include <arm_ffa.h>
|
||||
+#include <cpu_func.h>
|
||||
+#include <dm.h>
|
||||
#include <efi.h>
|
||||
#include <efi_api.h>
|
||||
#include <efi_loader.h>
|
||||
@@ -15,6 +18,36 @@
|
||||
#include <efi_variable.h>
|
||||
-#include <tee.h>
|
||||
#include <malloc.h>
|
||||
#include <mm_communication.h>
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+
|
||||
+#include <arm_ffa.h>
|
||||
+#include <cpu_func.h>
|
||||
+#include <mapmem.h>
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_SIZE
|
||||
+#error "FFA_SHARED_MM_BUFFER_SIZE must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_SIZE 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_OFFSET
|
||||
+#error "FFA_SHARED_MM_BUFFER_OFFSET must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_OFFSET 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_ADDR
|
||||
+#error "FFA_SHARED_MM_BUFFER_ADDR must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_ADDR 0
|
||||
+#endif
|
||||
#include <mm_communication.h>
|
||||
+#include <tee.h>
|
||||
+
|
||||
+/* MM return codes */
|
||||
+#define MM_SUCCESS (0)
|
||||
+
|
||||
+#define MM_NOT_SUPPORTED (-1)
|
||||
+#define MM_INVALID_PARAMETER (-2)
|
||||
+#define MM_DENIED (-3)
|
||||
+#define MM_NO_MEMORY (-5)
|
||||
|
||||
+static const char *mm_sp_svc_uuid = MM_SP_UUID;
|
||||
+
|
||||
+static u16 mm_sp_id;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
extern struct efi_var_file __efi_runtime_data *efi_var_buf;
|
||||
static efi_uintn_t max_buffer_size; /* comm + var + func + data */
|
||||
static efi_uintn_t max_payload_size; /* func + data */
|
||||
@@ -24,6 +57,7 @@ struct mm_connection {
|
||||
u32 session;
|
||||
};
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_OPTEE))
|
||||
/**
|
||||
* get_connection() - Retrieve OP-TEE session for a specific UUID.
|
||||
*
|
||||
@@ -143,13 +177,248 @@ static efi_status_t optee_mm_communicate(void *comm_buf, ulong dsize)
|
||||
|
||||
return ret;
|
||||
@@ -145,16 +162,241 @@ static efi_status_t optee_mm_communicate(void *comm_buf, ulong dsize)
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
|
||||
/**
|
||||
- * mm_communicate() - Adjust the cmonnucation buffer to StandAlonneMM and send
|
||||
+ * ffa_notify_mm_sp() - Announce there is data in the shared buffer
|
||||
+ *
|
||||
+ * Notifies the MM partition in the trusted world that
|
||||
+ * Notify the MM partition in the trusted world that
|
||||
+ * data is available in the shared buffer.
|
||||
+ * This is a blocking call during which trusted world has exclusive access
|
||||
+ * to the MM shared buffer.
|
||||
@@ -227,27 +197,44 @@ index dfef18435d..3933a24e8c 100644
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ int sp_event_ret = -1;
|
||||
+ int sp_event_ret;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, &dev);
|
||||
+ if (ret) {
|
||||
+ log_err("EFI: Cannot find FF-A bus device, notify MM SP failure\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ msg.data0 = FFA_SHARED_MM_BUFFER_OFFSET; /* x3 */
|
||||
+ msg.data0 = CONFIG_FFA_SHARED_MM_BUF_OFFSET; /* x3 */
|
||||
+
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(NULL, mm_sp_id, &msg, 1);
|
||||
+ if (ret != 0)
|
||||
+ ret = ffa_sync_send_receive(dev, mm_sp_id, &msg, 1);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ sp_event_ret = msg.data0; /* x3 */
|
||||
+
|
||||
+ if (sp_event_ret == MM_SUCCESS)
|
||||
+ return 0;
|
||||
+ switch (sp_event_ret) {
|
||||
+ case MM_SUCCESS:
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+ case MM_NOT_SUPPORTED:
|
||||
+ ret = -EINVAL;
|
||||
+ break;
|
||||
+ case MM_INVALID_PARAMETER:
|
||||
+ ret = -EPERM;
|
||||
+ break;
|
||||
+ case MM_DENIED:
|
||||
+ ret = -EACCES;
|
||||
+ break;
|
||||
+ case MM_NO_MEMORY:
|
||||
+ ret = -EBUSY;
|
||||
+ break;
|
||||
+ default:
|
||||
+ ret = -EACCES;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Failure to notify the MM SP
|
||||
+ */
|
||||
+
|
||||
+ return -EACCES;
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
@@ -265,57 +252,28 @@ index dfef18435d..3933a24e8c 100644
|
||||
+{
|
||||
+ u32 count = 0;
|
||||
+ int ret;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+ struct ffa_partition_desc *descs;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, mm_sp_svc_uuid, &count, NULL);
|
||||
+ if (ret != 0) {
|
||||
+ log_err("EFI: Failure in querying partitions count (error code: %d)\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (!count) {
|
||||
+ log_info("EFI: No MM partition found\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ log_info("EFI: Pre-allocating %d partition(s) info structures\n", count);
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(*parts_info));
|
||||
+ if (!parts_info)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the
|
||||
+ * buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(NULL, mm_sp_svc_uuid, &count, parts_info);
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, &dev);
|
||||
+ if (ret) {
|
||||
+ log_err("EFI: Failure in querying partition(s) info (error code: %d)\n", ret);
|
||||
+ free(parts_info);
|
||||
+ log_err("EFI: Cannot find FF-A bus device, MM SP discovery failure\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * MM SPs found , use the first one
|
||||
+ */
|
||||
+ /* Ask the driver to fill the buffer with the SPs info */
|
||||
+ ret = ffa_partition_info_get(dev, mm_sp_svc_uuid, &count, &descs);
|
||||
+ if (ret) {
|
||||
+ log_err("EFI: Failure in querying SPs info (%d), MM SP discovery failure\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ mm_sp_id = parts_info[0].id;
|
||||
+ /* MM SPs found , use the first one */
|
||||
+
|
||||
+ mm_sp_id = descs[0].info.id;
|
||||
+
|
||||
+ log_info("EFI: MM partition ID 0x%x\n", mm_sp_id);
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
@@ -324,7 +282,7 @@ index dfef18435d..3933a24e8c 100644
|
||||
+ * @comm_buf: locally allocated communication buffer used for rx/tx
|
||||
+ * @dsize: communication buffer size
|
||||
+ *
|
||||
+ * Issues a door bell event to notify the MM partition (SP) running in OP-TEE
|
||||
+ * Issue a door bell event to notify the MM partition (SP) running in OP-TEE
|
||||
+ * that there is data to read from the shared buffer.
|
||||
+ * Communication with the MM SP is performed using FF-A transport.
|
||||
+ * On the event, MM SP can read the data from the buffer and
|
||||
@@ -347,20 +305,20 @@ index dfef18435d..3933a24e8c 100644
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Discover MM partition ID at boot time */
|
||||
+ if (!mm_sp_id && ffa_discover_mm_sp_id() != 0) {
|
||||
+ log_err("EFI: Failure to discover MM partition ID at boot time\n");
|
||||
+ if (!mm_sp_id && ffa_discover_mm_sp_id()) {
|
||||
+ log_err("EFI: Failure to discover MM SP ID at boot time, FF-A MM comms failure\n");
|
||||
+ return EFI_UNSUPPORTED;
|
||||
+ }
|
||||
+
|
||||
+ mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
+ tx_data_size = mm_hdr->message_len + sizeof(efi_guid_t) + sizeof(size_t);
|
||||
+
|
||||
+ if (comm_buf_size != tx_data_size || tx_data_size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ if (comm_buf_size != tx_data_size || tx_data_size > CONFIG_FFA_SHARED_MM_BUF_SIZE)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Copy the data to the shared buffer */
|
||||
+
|
||||
+ virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0);
|
||||
+ virt_shared_buf = map_sysmem((phys_addr_t)CONFIG_FFA_SHARED_MM_BUF_ADDR, 0);
|
||||
+ memcpy(virt_shared_buf, comm_buf, tx_data_size);
|
||||
+
|
||||
+ /*
|
||||
@@ -369,17 +327,16 @@ index dfef18435d..3933a24e8c 100644
|
||||
+ * In this case, the secure world reads the data from DRAM.
|
||||
+ * Let's flush the cache so the DRAM is updated with the latest data.
|
||||
+ */
|
||||
+ #ifdef CONFIG_ARM64
|
||||
+#ifdef CONFIG_ARM64
|
||||
+ invalidate_dcache_all();
|
||||
+ #endif
|
||||
+#endif
|
||||
+
|
||||
+ /* Announce there is data in the shared buffer */
|
||||
+
|
||||
+ ffa_ret = ffa_notify_mm_sp();
|
||||
+
|
||||
+ switch (ffa_ret) {
|
||||
+ case 0:
|
||||
+ {
|
||||
+ case 0: {
|
||||
+ ulong rx_data_size;
|
||||
+ /* Copy the MM SP response from the shared buffer to the communication buffer */
|
||||
+ rx_data_size = ((struct efi_mm_communicate_header *)virt_shared_buf)->message_len +
|
||||
@@ -414,27 +371,32 @@ index dfef18435d..3933a24e8c 100644
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+ return efi_ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * select_ffa_mm_comms() - checks FF-A support availability
|
||||
+ * get_mm_comms() - detect the available MM transport
|
||||
+ *
|
||||
+ * Making sure FF-A is compiled in. If that's the case try to discover
|
||||
+ * the FF-A bus.
|
||||
+ * Make sure the FF-A bus is probed successfully
|
||||
+ * which means FF-A communication with secure world works and ready
|
||||
+ * for use.
|
||||
+ *
|
||||
+ * If FF-A bus is not ready, use OPTEE comms.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0: FF-A ready for use. Otherwise, failure
|
||||
+ * MM_COMMS_FFA or MM_COMMS_OPTEE
|
||||
+ */
|
||||
+static efi_status_t select_ffa_mm_comms(void)
|
||||
+static enum mm_comms_select get_mm_comms(void)
|
||||
+{
|
||||
+ efi_status_t ret = EFI_UNSUPPORTED;
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ ret = ffa_bus_discover(NULL);
|
||||
+ if (ret)
|
||||
+ ret = EFI_NOT_READY;
|
||||
+#endif
|
||||
+ return ret;
|
||||
+ struct udevice *dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, &dev);
|
||||
+ if (ret) {
|
||||
+ log_err("EFI: Cannot find FF-A bus device, trying Optee comms\n");
|
||||
+ return MM_COMMS_OPTEE;
|
||||
+ }
|
||||
+
|
||||
+ return MM_COMMS_FFA;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
@@ -453,40 +415,27 @@ index dfef18435d..3933a24e8c 100644
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
@@ -162,7 +431,17 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
{
|
||||
efi_status_t ret;
|
||||
+ enum mm_comms_select mm_comms;
|
||||
struct efi_mm_communicate_header *mm_hdr;
|
||||
struct smm_variable_communicate_header *var_hdr;
|
||||
|
||||
@@ -162,7 +404,12 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data;
|
||||
|
||||
- ret = optee_mm_communicate(comm_buf, dsize);
|
||||
+ ret = select_ffa_mm_comms();
|
||||
+ if (ret != EFI_SUCCESS) {
|
||||
+#if (IS_ENABLED(CONFIG_OPTEE))
|
||||
+ ret = optee_mm_communicate(comm_buf, dsize);
|
||||
+#endif
|
||||
+ } else {
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ mm_comms = get_mm_comms();
|
||||
+ if (mm_comms == MM_COMMS_FFA)
|
||||
+ ret = ffa_mm_communicate(comm_buf, dsize);
|
||||
+#endif
|
||||
+ }
|
||||
+ else
|
||||
+ ret = optee_mm_communicate(comm_buf, dsize);
|
||||
+
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("%s failed!\n", __func__);
|
||||
return ret;
|
||||
@@ -258,6 +537,13 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size)
|
||||
goto out;
|
||||
}
|
||||
*size = var_payload->size;
|
||||
+
|
||||
+ #if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ if (*size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ *size = FFA_SHARED_MM_BUFFER_SIZE - MM_COMMUNICATE_HEADER_SIZE -
|
||||
+ MM_VARIABLE_COMMUNICATE_SIZE;
|
||||
+ #endif
|
||||
+
|
||||
/*
|
||||
* There seems to be a bug in EDK2 miscalculating the boundaries and
|
||||
* size checks, so deduct 2 more bytes to fulfill this requirement. Fix
|
||||
@@ -697,7 +983,7 @@ void efi_variables_boot_exit_notify(void)
|
||||
@@ -697,7 +944,7 @@ void efi_variables_boot_exit_notify(void)
|
||||
ret = EFI_NOT_FOUND;
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
From 79e941be83a7394d03b09c618c8e2924ef962d64 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 17 Jul 2023 15:23:33 +0100
|
||||
Subject: [PATCH 10/33] FF-A v15: arm_ffa: efi: corstone1000: enable MM
|
||||
communication
|
||||
|
||||
turn on EFI MM communication
|
||||
|
||||
On corstone1000 platform MM communication between u-boot
|
||||
and the secure world (Optee) is done using the FF-A bus.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
configs/corstone1000_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index 2d391048cd..ee5481b63c 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -53,3 +53,8 @@ CONFIG_DM_SERIAL=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_ISP1760=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
+CONFIG_NVMXIP_QSPI=y
|
||||
+CONFIG_EFI_MM_COMM_TEE=y
|
||||
+CONFIG_FFA_SHARED_MM_BUF_SIZE=4096
|
||||
+CONFIG_FFA_SHARED_MM_BUF_OFFSET=0
|
||||
+CONFIG_FFA_SHARED_MM_BUF_ADDR=0x02000000
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
From a595dfd91d3e226eaa39e324673871c73ae0aa29 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 23 Sep 2022 15:17:21 +0100
|
||||
Subject: [PATCH 10/42] arm_ffa: efi: corstone1000: enable MM communication
|
||||
|
||||
turn on EFI MM communication
|
||||
|
||||
On corstone1000 platform MM communication between u-boot
|
||||
and the secure world (Optee) is done using the FF-A bus.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
Cc: Jens Wiklander <jens.wiklander@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v8:
|
||||
|
||||
* drop OP-TEE configs from Corstone-1000 defconfig
|
||||
|
||||
v7:
|
||||
|
||||
* improve the definition of FFA_SHARED_MM_BUFFER_ADDR and
|
||||
FFA_SHARED_MM_BUFFER_OFFSET
|
||||
* update FFA_SHARED_MM_BUFFER_ADDR value
|
||||
|
||||
v6:
|
||||
|
||||
* corstone-1000: enable optee driver
|
||||
* corstone-1000: remove CONFIG_ARM_FFA_EFI_RUNTIME_MODE from the defconfig
|
||||
|
||||
v4:
|
||||
|
||||
* corstone-1000: turn on EFI MM communication
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
configs/corstone1000_defconfig | 2 ++
|
||||
include/configs/corstone1000.h | 10 ++++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index dddfa27507..d1dc06c86c 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -52,3 +52,5 @@ CONFIG_DM_SERIAL=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_ISP1760=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
+CONFIG_EFI_MM_COMM_TEE=y
|
||||
+CONFIG_ARM_FFA_TRANSPORT=y
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index 8e0230c135..b6226fa12a 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -14,6 +14,15 @@
|
||||
|
||||
#include <linux/sizes.h>
|
||||
|
||||
+#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
|
||||
+
|
||||
+/*
|
||||
+ * shared buffer physical address used for communication between
|
||||
+ * u-boot and the MM SP
|
||||
+ */
|
||||
+#define FFA_SHARED_MM_BUFFER_ADDR 0x02000000UL
|
||||
+#define FFA_SHARED_MM_BUFFER_OFFSET 0
|
||||
+
|
||||
#define V2M_BASE 0x80000000
|
||||
|
||||
#define CONFIG_PL011_CLOCK 50000000
|
||||
@@ -22,6 +31,7 @@
|
||||
#define PHYS_SDRAM_1 (V2M_BASE)
|
||||
#define PHYS_SDRAM_1_SIZE 0x80000000
|
||||
|
||||
+#define CFG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+135
-92
@@ -1,7 +1,7 @@
|
||||
From b9c44c396f9ad9588184272cdc5ed98e19e82c0a Mon Sep 17 00:00:00 2001
|
||||
From 90b2741149a538c93aed61522c0d3363351bd578 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Tue, 29 Nov 2022 15:11:27 +0000
|
||||
Subject: [PATCH 11/42] efi: corstone1000: introduce EFI capsule update
|
||||
Date: Mon, 17 Jul 2023 15:56:18 +0100
|
||||
Subject: [PATCH 11/33] efi: corstone1000: fwu: introduce EFI capsule update
|
||||
|
||||
This commit provides capsule update feature for Corstone1000.
|
||||
|
||||
@@ -12,30 +12,35 @@ is physically contiguous and allocated at the start of the DDR
|
||||
memory after u-boot relocation to the end of DDR.
|
||||
|
||||
The capsule buffer is shared between u-boot and the secure world.
|
||||
On UpdateCapsule() , capsule data is copied to the buffer
|
||||
and a buffer ready event is generated using FF-A transport.
|
||||
|
||||
On ExitBootServices() a kernel started event is sent to the
|
||||
SE Proxy FW update service. This event is generated on each boot.
|
||||
On UpdateCapsule() , capsule data is copied to the buffer and a buffer ready event is generated using FF-A transport.
|
||||
|
||||
On efi_init_capsule() in U-Boot, an EFI started event is sent to SE Proxy FW update service. This event is generated on each boot.
|
||||
|
||||
Note: The SE proxy SP requires that the interface/event IDs are passed using register w4 for the buffer ready event and the EFI started event.
|
||||
|
||||
interface ID (31:16)
|
||||
event ID (15:0)
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 4 +
|
||||
configs/corstone1000_defconfig | 3 +
|
||||
include/configs/corstone1000.h | 18 ++++
|
||||
include/configs/corstone1000.h | 24 ++++
|
||||
include/efi_loader.h | 4 +-
|
||||
lib/efi_loader/efi_boottime.c | 36 +++++++
|
||||
lib/efi_loader/efi_capsule.c | 124 ++++++++++++++++++++++-
|
||||
lib/efi_loader/efi_setup.c | 15 +++
|
||||
7 files changed, 200 insertions(+), 4 deletions(-)
|
||||
lib/efi_loader/efi_boottime.c | 7 ++
|
||||
lib/efi_loader/efi_capsule.c | 136 ++++++++++++++++++++++-
|
||||
lib/efi_loader/efi_setup.c | 64 +++++++++++
|
||||
7 files changed, 238 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index 4f4b96a095..76816f8f4e 100644
|
||||
index 6ec8e6144f..c840290885 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -66,6 +66,10 @@ static struct mm_region corstone1000_mem_map[] = {
|
||||
@@ -67,6 +67,10 @@ static struct mm_region corstone1000_mem_map[] = {
|
||||
|
||||
struct mm_region *mem_map = corstone1000_mem_map;
|
||||
|
||||
@@ -47,21 +52,21 @@ index 4f4b96a095..76816f8f4e 100644
|
||||
{
|
||||
return 0;
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index d1dc06c86c..06eac3e041 100644
|
||||
index ee5481b63c..40ba415ecb 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -54,3 +54,6 @@ CONFIG_USB_ISP1760=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
CONFIG_EFI_MM_COMM_TEE=y
|
||||
CONFIG_ARM_FFA_TRANSPORT=y
|
||||
@@ -58,3 +58,6 @@ CONFIG_EFI_MM_COMM_TEE=y
|
||||
CONFIG_FFA_SHARED_MM_BUF_SIZE=4096
|
||||
CONFIG_FFA_SHARED_MM_BUF_OFFSET=0
|
||||
CONFIG_FFA_SHARED_MM_BUF_ADDR=0x02000000
|
||||
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
||||
+CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
|
||||
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index b6226fa12a..cd30499e3c 100644
|
||||
index 3347c11792..8927b09499 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -14,6 +14,24 @@
|
||||
@@ -14,6 +14,30 @@
|
||||
|
||||
#include <linux/sizes.h>
|
||||
|
||||
@@ -73,7 +78,13 @@ index b6226fa12a..cd30499e3c 100644
|
||||
+
|
||||
+/* 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)))
|
||||
+
|
||||
+#define PREP_SEPROXY_EVT_MASK GENMASK(15, 0)
|
||||
+#define PREP_SEPROXY_EVT(x) (FIELD_PREP(PREP_SEPROXY_EVT_MASK, (x)))
|
||||
+
|
||||
+/* Size in 4KB pages of the EFI capsule buffer */
|
||||
+#define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */
|
||||
@@ -83,14 +94,14 @@ index b6226fa12a..cd30499e3c 100644
|
||||
+ EFI_GUID(0x3a770ddc, 0x409b, 0x48b2, 0x81, 0x41, \
|
||||
+ 0x93, 0xb7, 0xc6, 0x0b, 0x20, 0x9e)
|
||||
+
|
||||
#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
|
||||
#define V2M_BASE 0x80000000
|
||||
|
||||
/*
|
||||
#define CFG_PL011_CLOCK 50000000
|
||||
diff --git a/include/efi_loader.h b/include/efi_loader.h
|
||||
index f9e427f090..26981141c2 100644
|
||||
index 38d7f66bab..0a613ed51e 100644
|
||||
--- a/include/efi_loader.h
|
||||
+++ b/include/efi_loader.h
|
||||
@@ -1032,11 +1032,11 @@ extern const struct efi_firmware_management_protocol efi_fmp_fit;
|
||||
@@ -1036,11 +1036,11 @@ extern const struct efi_firmware_management_protocol efi_fmp_fit;
|
||||
extern const struct efi_firmware_management_protocol efi_fmp_raw;
|
||||
|
||||
/* Capsule update */
|
||||
@@ -105,70 +116,37 @@ index f9e427f090..26981141c2 100644
|
||||
efi_uintn_t capsule_count,
|
||||
u64 *maximum_capsule_size,
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index fea4eb7a34..faab74474d 100644
|
||||
index d5065f296a..a5da77c36c 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -2103,6 +2103,33 @@ static void efi_exit_caches(void)
|
||||
#endif
|
||||
}
|
||||
@@ -23,6 +23,13 @@
|
||||
#include <asm/setjmp.h>
|
||||
#include <linux/libfdt_env.h>
|
||||
|
||||
+#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
|
||||
+ */
|
||||
+ msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
+ msg.data2 = CORSTONE1000_KERNEL_STARTED_EVT; /* x5 */
|
||||
+
|
||||
+ return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
+}
|
||||
+
|
||||
+#include <arm_ffa.h>
|
||||
+#include <dm.h>
|
||||
+#include <linux/bitfield.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* efi_exit_boot_services() - stop all boot services
|
||||
* @image_handle: handle of the loaded image
|
||||
@@ -2209,6 +2236,15 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
/* Recalculate CRC32 */
|
||||
efi_update_table_header_crc32(&systab.hdr);
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
+#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);
|
||||
schedule();
|
||||
/* Task priority level */
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index 0997cd248f..9e8ddaac7f 100644
|
||||
index 7a6f195cbc..ea084e4ed2 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -26,6 +26,14 @@
|
||||
@@ -26,6 +26,17 @@
|
||||
#include <crypto/pkcs7_parser.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
+#ifdef CONFIG_TARGET_CORSTONE1000
|
||||
+#include <arm_ffa.h>
|
||||
+#include <cpu_func.h>
|
||||
+#include <dm.h>
|
||||
+#include <linux/bitfield.h>
|
||||
+#include <linux/bitops.h>
|
||||
+
|
||||
+void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
|
||||
+efi_guid_t corstone1000_capsule_guid = EFI_CORSTONE1000_CAPSULE_ID_GUID;
|
||||
@@ -177,7 +155,7 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
const efi_guid_t efi_guid_capsule_report = EFI_CAPSULE_REPORT_GUID;
|
||||
@@ -696,6 +704,78 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
@@ -709,6 +720,87 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
}
|
||||
#endif /* CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT */
|
||||
|
||||
@@ -239,24 +217,33 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
+static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_size)
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ log_debug("[%s]\n", __func__);
|
||||
+
|
||||
+ /*
|
||||
+ * setting the buffer ready event arguments
|
||||
+ */
|
||||
+ msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
+ msg.data1 = capsule_image_size; /* x4 */
|
||||
+ msg.data2 = CORSTONE1000_BUFFER_READY_EVT; /* x5 */
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, &dev);
|
||||
+ if (ret) {
|
||||
+ log_err("Cannot find FF-A bus device\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return ffa_bus_ops_get()->sync_send_receive(NULL, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
+ /*
|
||||
+ * setting the buffer ready event arguments in register w4:
|
||||
+ * - 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 */
|
||||
+
|
||||
+ return ffa_sync_send_receive(dev, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* efi_update_capsule() - process information from operating system
|
||||
* @capsule_header_array: Array of virtual address pointers
|
||||
@@ -709,7 +789,7 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
@@ -722,7 +814,7 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
@@ -265,7 +252,7 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
struct efi_capsule_header **capsule_header_array,
|
||||
efi_uintn_t capsule_count,
|
||||
u64 scatter_gather_list)
|
||||
@@ -726,6 +806,13 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
@@ -739,6 +831,13 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -279,7 +266,7 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
ret = EFI_SUCCESS;
|
||||
for (i = 0, capsule = *capsule_header_array; i < capsule_count;
|
||||
i++, capsule = *(++capsule_header_array)) {
|
||||
@@ -738,6 +825,39 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
@@ -751,6 +850,39 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
|
||||
log_debug("Capsule[%d] (guid:%pUs)\n",
|
||||
i, &capsule->capsule_guid);
|
||||
@@ -319,7 +306,7 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
if (!guidcmp(&capsule->capsule_guid,
|
||||
&efi_guid_firmware_management_capsule_id)) {
|
||||
ret = efi_capsule_update_firmware(capsule);
|
||||
@@ -776,7 +896,7 @@ out:
|
||||
@@ -789,7 +921,7 @@ out:
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
@@ -329,14 +316,19 @@ index 0997cd248f..9e8ddaac7f 100644
|
||||
efi_uintn_t capsule_count,
|
||||
u64 *maximum_capsule_size,
|
||||
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
|
||||
index 5437641135..1ad2fa52d7 100644
|
||||
index 58d4e13402..bf90a98b5a 100644
|
||||
--- a/lib/efi_loader/efi_setup.c
|
||||
+++ b/lib/efi_loader/efi_setup.c
|
||||
@@ -16,6 +16,13 @@
|
||||
@@ -17,6 +17,18 @@
|
||||
|
||||
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>
|
||||
+#include <dm.h>
|
||||
+
|
||||
+/**
|
||||
+ * efi_corstone1000_alloc_capsule_shared_buf - allocate capsule shared buffer
|
||||
+ */
|
||||
@@ -346,11 +338,62 @@ index 5437641135..1ad2fa52d7 100644
|
||||
/*
|
||||
* Allow unaligned memory access.
|
||||
*
|
||||
@@ -128,6 +135,14 @@ static efi_status_t efi_init_capsule(void)
|
||||
@@ -120,6 +132,42 @@ 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};
|
||||
+ int ret;
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ log_debug("[%s]\n", __func__);
|
||||
+
|
||||
+ ret = uclass_first_device_err(UCLASS_FFA, &dev);
|
||||
+ if (ret) {
|
||||
+ log_err("Cannot find FF-A bus device\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * 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_sync_send_receive(dev, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* efi_init_capsule - initialize capsule update state
|
||||
*
|
||||
@@ -129,6 +177,22 @@ 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)
|
||||
+ log_err("Failure to notify SE Proxy FW update service\n");
|
||||
+ else
|
||||
+ debug("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");
|
||||
@@ -358,9 +401,9 @@ index 5437641135..1ad2fa52d7 100644
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) {
|
||||
ret = efi_set_variable_int(u"CapsuleMax",
|
||||
&efi_guid_capsule_report,
|
||||
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) {
|
||||
u16 var_name16[12];
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From ac738fa33edec9ff712dee6d10491cb2eb7cfe3a Mon Sep 17 00:00:00 2001
|
||||
From 445dfd4a5d8f31a7efb3f2f15aa677de8b3eb602 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Fri, 4 Mar 2022 15:56:09 +0000
|
||||
Subject: [PATCH 12/42] arm: corstone1000: fix unrecognized filesystem type
|
||||
Subject: [PATCH 12/33] arm: corstone1000: fix unrecognized filesystem type
|
||||
|
||||
Some usb sticks are not recognized by usb, just add a
|
||||
delay before checking status.
|
||||
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
From baa961b6050508710e1c6b572f2e93ac5c488201 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 10 Dec 2021 20:03:35 +0000
|
||||
Subject: [PATCH 13/42] efi_capsule: corstone1000: pass interface id and buffer
|
||||
event id using register w4
|
||||
|
||||
Initially the interface/event IDs are passed to the SP using register
|
||||
w3 and w5.
|
||||
|
||||
Now the SE proxy SP requires this arguments to be in register w4.
|
||||
|
||||
This change is to pass interface ID(31:16) and event ID(15:0)
|
||||
to SE proxy SP to trigger an event to secure enclave about
|
||||
firmware update.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 6 ++++++
|
||||
lib/efi_loader/efi_capsule.c | 11 +++++++----
|
||||
2 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index cd30499e3c..e4c7bcb96f 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -24,6 +24,12 @@
|
||||
#define CORSTONE1000_BUFFER_READY_EVT (0x1)
|
||||
#define CORSTONE1000_KERNEL_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)))
|
||||
+
|
||||
+#define PREP_SEPROXY_EVT_MASK GENMASK(15, 0)
|
||||
+#define PREP_SEPROXY_EVT(x) (FIELD_PREP(PREP_SEPROXY_EVT_MASK, (x)))
|
||||
+
|
||||
/* Size in 4KB pages of the EFI capsule buffer */
|
||||
#define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index 9e8ddaac7f..bd4cc8d272 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -29,6 +29,8 @@
|
||||
#ifdef CONFIG_TARGET_CORSTONE1000
|
||||
#include <arm_ffa.h>
|
||||
#include <cpu_func.h>
|
||||
+#include <linux/bitfield.h>
|
||||
+#include <linux/bitops.h>
|
||||
|
||||
void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
|
||||
efi_guid_t corstone1000_capsule_guid = EFI_CORSTONE1000_CAPSULE_ID_GUID;
|
||||
@@ -766,11 +768,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
|
||||
log_debug("[%s]\n", __func__);
|
||||
|
||||
/*
|
||||
- * setting the buffer ready event arguments
|
||||
+ * setting the buffer ready event arguments in register w4:
|
||||
+ * - capsule update interface ID (31:16)
|
||||
+ * - the buffer ready event ID (15:0)
|
||||
*/
|
||||
- msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
- msg.data1 = capsule_image_size; /* x4 */
|
||||
- msg.data2 = CORSTONE1000_BUFFER_READY_EVT; /* x5 */
|
||||
+ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT); /* w4 */
|
||||
|
||||
return ffa_bus_ops_get()->sync_send_receive(NULL, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
From 5e09d349ec8af6585bce777acbfd2d218fc2e8d4 Mon Sep 17 00:00:00 2001
|
||||
From 68248cd3cc95e0480ee2cbc3ebaba51967889199 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Sat, 11 Dec 2021 13:23:55 +0000
|
||||
Subject: [PATCH 15/42] efi_loader: corstone1000: remove guid check from
|
||||
Subject: [PATCH 13/33] efi_loader: corstone1000: remove guid check from
|
||||
corstone1000 config option
|
||||
|
||||
Use generic fmp guid and no separte check is required for
|
||||
@@ -15,10 +15,10 @@ Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
1 file changed, 1 insertion(+), 15 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index bd4cc8d272..ef7b358ddb 100644
|
||||
index ea084e4ed2..5314f529b4 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -830,12 +830,6 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -852,12 +852,6 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
i, &capsule->capsule_guid);
|
||||
|
||||
#if CONFIG_IS_ENABLED(TARGET_CORSTONE1000)
|
||||
@@ -31,7 +31,7 @@ index bd4cc8d272..ef7b358ddb 100644
|
||||
if (efi_size_in_pages(capsule->capsule_image_size) >
|
||||
CORSTONE1000_CAPSULE_BUFFER_SIZE) {
|
||||
log_err("Corstone1000: Capsule data size exceeds the shared buffer size\n");
|
||||
@@ -861,15 +855,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -883,15 +877,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
From d761d59dd251ae93980f659d253576fc872f2c5f Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 10 Dec 2021 20:10:41 +0000
|
||||
Subject: [PATCH 14/42] efi_boottime: corstone1000: pass interface id and
|
||||
kernel event id using register w4
|
||||
|
||||
Initially the interface/event IDs are passed to the SP using register
|
||||
w3 and w5.
|
||||
|
||||
Now the SE proxy SP requires this arguments to be in register w4.
|
||||
|
||||
This change is to pass interface ID(31:16) and kernel started
|
||||
event ID(15:0) to SE proxy SP to trigger an event to
|
||||
secure enclave just before ExitbootService().
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_boottime.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index faab74474d..36a0be7ba1 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -30,6 +30,11 @@
|
||||
#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 */
|
||||
@@ -2120,10 +2125,12 @@ static int efi_corstone1000_kernel_started_event(void)
|
||||
log_debug("[%s]\n", __func__);
|
||||
|
||||
/*
|
||||
- * setting the kernel started event arguments
|
||||
+ * setting the kernel started event arguments:
|
||||
+ * setting capsule update interface ID(31:16)
|
||||
+ * the kernel started event ID(15:0)
|
||||
*/
|
||||
- msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
- msg.data2 = CORSTONE1000_KERNEL_STARTED_EVT; /* x5 */
|
||||
+ 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, 0);
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From e3ccad1cf9e905ec15ff772dcf53972fafcf54ee Mon Sep 17 00:00:00 2001
|
||||
From bb0eb602d3697384318cac90605259aa7fb21c9b Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 17 Dec 2021 19:49:02 +0000
|
||||
Subject: [PATCH 16/42] efi_loader: populate ESRT table if EFI_ESRT config
|
||||
Subject: [PATCH 14/33] efi_loader: populate ESRT table if EFI_ESRT config
|
||||
option is set
|
||||
|
||||
This change is to call efi_esrt_populate function if CONFIG_EFI_ESRT
|
||||
@@ -15,10 +15,10 @@ Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index ef7b358ddb..8eb8fc406a 100644
|
||||
index 5314f529b4..6a06605ad9 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -852,6 +852,13 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -874,6 +874,13 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
ret = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From d8f79ab37bae283599e40018055ff9d5648fb647 Mon Sep 17 00:00:00 2001
|
||||
From 5e12999d179e84ac52e242d56c57a4d429651124 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 17 Dec 2021 19:50:25 +0000
|
||||
Subject: [PATCH 17/42] efi_firmware: add get_image_info for corstone1000
|
||||
Subject: [PATCH 15/33] efi_firmware: add get_image_info for corstone1000
|
||||
|
||||
This change is to populate get_image_info which eventually
|
||||
will be populated in ESRT table
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 3d28467e447f12c5aa276827aa742e7eed1d577a Mon Sep 17 00:00:00 2001
|
||||
From 957e88fc52d77e6a3024f06bebfaa713c9e99e59 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 14 Jan 2022 15:24:18 +0000
|
||||
Subject: [PATCH 19/42] efi_loader: fix null pointer exception with
|
||||
Subject: [PATCH 16/33] efi_loader: fix null pointer exception with
|
||||
get_image_info
|
||||
|
||||
get_img_info API implemented for corstone1000 target does not
|
||||
@@ -17,7 +17,7 @@ Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index 70568f2290..c883e2ff0a 100644
|
||||
index 0a38a96351..c883e2ff0a 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -39,26 +39,29 @@ static efi_status_t efi_corstone1000_img_info_get (
|
||||
@@ -39,7 +39,7 @@ index 70568f2290..c883e2ff0a 100644
|
||||
*package_version_name = NULL; /* not supported */
|
||||
|
||||
if(image_info == NULL) {
|
||||
- log_info("image_info is null\n");
|
||||
- log_warning("image_info is null\n");
|
||||
+ log_debug("image_info is null\n");
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
+13
-12
@@ -1,7 +1,7 @@
|
||||
From d6c183a99a7d232ef5dbf886c49e7fb75b50ecf9 Mon Sep 17 00:00:00 2001
|
||||
From 61b5f50718431b5fff57fcaa924238135b11ed3c Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Wed, 30 Nov 2022 15:37:22 +0000
|
||||
Subject: [PATCH 20/42] arm:corstone1000: add mmc for fvp
|
||||
Date: Mon, 17 Jul 2023 16:50:53 +0100
|
||||
Subject: [PATCH 17/33] arm:corstone1000: add mmc for fvp
|
||||
|
||||
Enable support mmc/sdcard for the corstone1000 FVP.
|
||||
|
||||
@@ -10,15 +10,15 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 28 +++++++++++++++++++-----
|
||||
configs/corstone1000_defconfig | 8 ++++++-
|
||||
configs/corstone1000_defconfig | 9 ++++++--
|
||||
include/configs/corstone1000.h | 4 +++-
|
||||
3 files changed, 32 insertions(+), 8 deletions(-)
|
||||
3 files changed, 32 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index 76816f8f4e..d6ca6e8961 100644
|
||||
index c840290885..ecfd8366df 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -38,19 +38,35 @@ static struct mm_region corstone1000_mem_map[] = {
|
||||
@@ -39,19 +39,35 @@ static struct mm_region corstone1000_mem_map[] = {
|
||||
}, {
|
||||
/* USB */
|
||||
.virt = 0x40200000UL,
|
||||
@@ -61,14 +61,15 @@ index 76816f8f4e..d6ca6e8961 100644
|
||||
/* OCVM */
|
||||
.virt = 0x80000000UL,
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index 06eac3e041..f7c276a10a 100644
|
||||
index 40ba415ecb..76158fc37d 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -40,7 +40,13 @@ CONFIG_VERSION_VARIABLE=y
|
||||
@@ -40,8 +40,13 @@ CONFIG_VERSION_VARIABLE=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_MISC=y
|
||||
-# CONFIG_MMC is not set
|
||||
-CONFIG_NVMXIP_QSPI=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_DM_MMC=y
|
||||
@@ -80,11 +81,11 @@ index 06eac3e041..f7c276a10a 100644
|
||||
CONFIG_PHY_SMSC=y
|
||||
CONFIG_SMC911X=y
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index be13b98d48..a015a1630e 100644
|
||||
index 8927b09499..1466507f80 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -59,7 +59,9 @@
|
||||
#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
@@ -49,7 +49,9 @@
|
||||
#define CFG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
- func(USB, usb, 0)
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 155f20028ad5f3ba5d2362ec48abb7804eaade00 Mon Sep 17 00:00:00 2001
|
||||
From a5879f1e7d91fc31058ba75b499d77cab080d611 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Mason <jon.mason@arm.com>
|
||||
Date: Wed, 30 Nov 2022 18:59:59 +0000
|
||||
Subject: [PATCH 21/42] corstone1000: add compressed kernel support
|
||||
Subject: [PATCH 18/33] corstone1000: add compressed kernel support
|
||||
|
||||
The corstone1000 kernel has become too large to fit in the available
|
||||
storage. Swtiching to a compressed kernel avoids the problem, but
|
||||
@@ -17,10 +17,10 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index f7c276a10a..1179bf5f3b 100644
|
||||
index 76158fc37d..a92668389a 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -15,7 +15,7 @@ CONFIG_FIT=y
|
||||
@@ -15,7 +15,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyAMA0 loglevel=9 ip=dhcp earlyprintk"
|
||||
-183
@@ -1,183 +0,0 @@
|
||||
From a6fee840a411a6a7b6c276d0a7b1d5445039e6c2 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 18/42] 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 e4c7bcb96f..be13b98d48 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 36a0be7ba1..fea4eb7a34 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -30,11 +30,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 */
|
||||
@@ -2108,35 +2103,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, 0);
|
||||
-}
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
/**
|
||||
* efi_exit_boot_services() - stop all boot services
|
||||
* @image_handle: handle of the loaded image
|
||||
@@ -2243,15 +2209,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);
|
||||
schedule();
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index 0a38a96351..70568f2290 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -48,7 +48,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 1ad2fa52d7..89f988b09c 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(NULL, CORSTONE1000_SEPROXY_PART_ID, &msg, 0);
|
||||
+}
|
||||
+#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.25.1
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 984c431cd594c112d71ea1378bc1ac3b72806baa Mon Sep 17 00:00:00 2001
|
||||
From 0748658414dd02cec0219841a86c4e7b99bfc171 Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan <emekcan.aras@arm.com>
|
||||
Date: Wed, 30 Nov 2022 19:02:26 +0000
|
||||
Subject: [PATCH 22/42] Introduce external sys driver to device-tree
|
||||
Subject: [PATCH 19/33] Introduce external sys driver to device-tree
|
||||
|
||||
It adds external sys driver binding to u-boot
|
||||
device tree.
|
||||
@@ -14,10 +14,10 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi
|
||||
index 4e46826f88..2c7185e139 100644
|
||||
index 533dfdf8e1..a834d38454 100644
|
||||
--- a/arch/arm/dts/corstone1000.dtsi
|
||||
+++ b/arch/arm/dts/corstone1000.dtsi
|
||||
@@ -160,5 +160,12 @@
|
||||
@@ -167,5 +167,12 @@
|
||||
secure-status = "okay"; /* secure-world-only */
|
||||
status = "disabled";
|
||||
};
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 4167fe9079b64aaaf3eefc53063d242af8d2badd Mon Sep 17 00:00:00 2001
|
||||
From 396229d3d29d9cfd5e2567be5427a9066072e32f Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan <emekcan.aras@arm.com>
|
||||
Date: Mon, 12 Sep 2022 15:47:06 +0100
|
||||
Subject: [PATCH 23/42] Add mhu and rpmsg client to u-boot device tree
|
||||
Subject: [PATCH 20/33] Add mhu and rpmsg client to u-boot device tree
|
||||
|
||||
Adds external system controller and mhu driver to u-boot
|
||||
device tree. This enables communication between host and
|
||||
@@ -15,10 +15,10 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
1 file changed, 50 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi
|
||||
index 2c7185e139..61e0c33247 100644
|
||||
index a834d38454..18c4d1e19a 100644
|
||||
--- a/arch/arm/dts/corstone1000.dtsi
|
||||
+++ b/arch/arm/dts/corstone1000.dtsi
|
||||
@@ -161,6 +161,56 @@
|
||||
@@ -168,6 +168,56 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
From f924535544515cdb350b2979b8c413cf221124b6 Mon Sep 17 00:00:00 2001
|
||||
From 0380dee4df6ef11bb08a9c44119b41c58afc562d Mon Sep 17 00:00:00 2001
|
||||
From: Satish Kumar <satish.kumar01@arm.com>
|
||||
Date: Wed, 30 Nov 2022 19:11:43 +0000
|
||||
Subject: [PATCH 24/42] arm/corstone1000: esrt support
|
||||
Subject: [PATCH 21/33] arm/corstone1000: esrt support
|
||||
|
||||
The implementation is platform specific and would require
|
||||
change in future.
|
||||
@@ -20,10 +20,10 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
3 files changed, 143 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/include/efi_api.h b/include/efi_api.h
|
||||
index 9bd70b0f18..23e427236a 100644
|
||||
index 55a4c989fc..f267ab5110 100644
|
||||
--- a/include/efi_api.h
|
||||
+++ b/include/efi_api.h
|
||||
@@ -2030,7 +2030,7 @@ struct efi_firmware_image_descriptor {
|
||||
@@ -2086,7 +2086,7 @@ struct efi_firmware_image_descriptor {
|
||||
u32 last_attempt_status;
|
||||
u64 hardware_instance;
|
||||
efi_firmware_image_dep_t *dependencies;
|
||||
@@ -186,10 +186,10 @@ index c883e2ff0a..c6ab6e2182 100644
|
||||
.set_image = efi_firmware_fit_set_image,
|
||||
.check_image = efi_firmware_check_image_unsupported,
|
||||
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
|
||||
index 89f988b09c..08c742edbd 100644
|
||||
index bf90a98b5a..d20568c1c8 100644
|
||||
--- a/lib/efi_loader/efi_setup.c
|
||||
+++ b/lib/efi_loader/efi_setup.c
|
||||
@@ -167,14 +167,6 @@ static efi_status_t efi_init_capsule(void)
|
||||
@@ -178,14 +178,6 @@ static efi_status_t efi_init_capsule(void)
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
|
||||
#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
|
||||
@@ -197,14 +197,14 @@ index 89f988b09c..08c742edbd 100644
|
||||
-
|
||||
- ffa_ret = efi_corstone1000_uboot_efi_started_event();
|
||||
- if (ffa_ret)
|
||||
- debug("[efi_boottime][ERROR]: Failure to notify SE Proxy FW update service\n");
|
||||
- log_err("Failure to notify SE Proxy FW update service\n");
|
||||
- else
|
||||
- debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
|
||||
- debug("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");
|
||||
@@ -288,6 +280,15 @@ efi_status_t efi_init_obj_list(void)
|
||||
@@ -304,6 +296,15 @@ efi_status_t efi_init_obj_list(void)
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
@@ -212,9 +212,9 @@ index 89f988b09c..08c742edbd 100644
|
||||
+ 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");
|
||||
+ log_err("Failure to notify SE Proxy FW update service\n");
|
||||
+ else
|
||||
+ debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
|
||||
+ debug("SE Proxy FW update service notified\n");
|
||||
+#endif
|
||||
+
|
||||
/* Initialize variable services */
|
||||
+6
-6
@@ -1,26 +1,26 @@
|
||||
From 2a281a45b7dfc5c0e78f6256bf0ac122d825ce82 Mon Sep 17 00:00:00 2001
|
||||
From b3c9b57d862060b7d112725a567c0ff24184c6e1 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 5 Dec 2022 17:02:32 +0000
|
||||
Subject: [PATCH 26/42] corstone1000: enable distro booting command
|
||||
Subject: [PATCH 22/33] corstone1000: enable distro booting command
|
||||
|
||||
enable distro_bootcmd
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index a015a1630e..c30a7bfa0c 100644
|
||||
index 1466507f80..8622565a87 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -65,5 +65,6 @@
|
||||
@@ -55,5 +55,6 @@
|
||||
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
+#define CONFIG_EXTRA_ENV_SETTINGS BOOTENV
|
||||
+#define CFG_EXTRA_ENV_SETTINGS BOOTENV
|
||||
|
||||
#endif
|
||||
--
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From e2fb90ab15babd146dd47b7c946674cd5a5260a1 Mon Sep 17 00:00:00 2001
|
||||
From 10265c2006291f961cc4fdbbffdec6c5f52bf73b Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Wed, 1 Feb 2023 15:58:07 +0000
|
||||
Subject: [PATCH 33/42] corstone1000: add fwu-metadata store info
|
||||
Subject: [PATCH 23/33] corstone1000: add fwu-metadata store info
|
||||
|
||||
Add fwu-mdata node and handle for the reference
|
||||
nvmxip-qspi.
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From ac77679ffcb4b7fac01414c1492d3e1aae13f9be Mon Sep 17 00:00:00 2001
|
||||
From 046e54d0152987163355e33fe260419dfcf3b8bb Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Wed, 1 Feb 2023 16:13:24 +0000
|
||||
Subject: [PATCH 35/42] fwu_metadata: make sure structures are packed
|
||||
Subject: [PATCH 24/33] fwu_metadata: make sure structures are packed
|
||||
|
||||
The fwu metadata in the metadata partitions
|
||||
should/are packed to guarantee that the info is
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
From 92f471d3195e3893f463b11d49f0db62793ca585 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Mon, 17 Jul 2023 17:04:10 +0100
|
||||
Subject: [PATCH 25/33] corstone1000: add boot index
|
||||
|
||||
it is expected that the firmware that runs before
|
||||
u-boot somehow provide the information of the bank
|
||||
(index) of it is booting.
|
||||
We will need to extend tf-a to pass that info,
|
||||
meanwhile just set it to the default bank.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index ecfd8366df..ba6d024b80 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <common.h>
|
||||
#include <cpu_func.h>
|
||||
#include <dm.h>
|
||||
+#include <fwu.h>
|
||||
#include <netdev.h>
|
||||
#include <dm/platform_data/serial_pl01x.h>
|
||||
#include <asm/armv8/mmu.h>
|
||||
@@ -107,6 +108,7 @@ int dram_init_banksize(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void reset_cpu(void)
|
||||
+void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
{
|
||||
+ *boot_idx = 0;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
From 1f165f5b6e7d82611b55260b7254fee5fbebe539 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Wed, 30 Nov 2022 19:14:52 +0000
|
||||
Subject: [PATCH 25/42] efi_setup: discover FF-A bus before raising EFI started
|
||||
event
|
||||
|
||||
add FF-A discovery to efi_corstone1000_uboot_efi_started_event()
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
lib/efi_loader/efi_setup.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
|
||||
index 08c742edbd..65bd626e49 100644
|
||||
--- a/lib/efi_loader/efi_setup.c
|
||||
+++ b/lib/efi_loader/efi_setup.c
|
||||
@@ -142,9 +142,16 @@ static efi_status_t efi_init_secure_boot(void)
|
||||
static int efi_corstone1000_uboot_efi_started_event(void)
|
||||
{
|
||||
struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
|
||||
log_debug("[%s]\n", __func__);
|
||||
|
||||
+ ret = ffa_bus_discover(NULL);
|
||||
+ if (ret != 0) {
|
||||
+ log_err("failure to discover FF-A bus\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* setting the kernel started event arguments:
|
||||
* setting capsule update interface ID(31:16)
|
||||
@@ -284,9 +291,9 @@ efi_status_t efi_init_obj_list(void)
|
||||
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");
|
||||
+ log_err("Failure to notify SE Proxy FW update service\n");
|
||||
else
|
||||
- debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
|
||||
+ debug("SE Proxy FW update service notified\n");
|
||||
#endif
|
||||
|
||||
/* Initialize variable services */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From 1a54c12aa6eed28a1a4e4f50d1aeb92a31cf6f52 Mon Sep 17 00:00:00 2001
|
||||
From 6ea58b2450c72036551e59186888474bcb54a194 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Wed, 1 Feb 2023 16:17:21 +0000
|
||||
Subject: [PATCH 37/42] corstone1000: adjust boot bank and kernel location
|
||||
Subject: [PATCH 26/33] corstone1000: adjust boot bank and kernel location
|
||||
|
||||
Adjust in the env boot script the address of the
|
||||
bootbank with the new gpt layout, and also the
|
||||
+20
-45
@@ -1,7 +1,7 @@
|
||||
From 5e0b7e40c4702d5494378d3e120fce0136f69a79 Mon Sep 17 00:00:00 2001
|
||||
From af1bb3af4ff7bb9486dc9489d27605b8eded45b9 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Fri, 9 Jun 2023 13:28:06 +0100
|
||||
Subject: [PATCH 38/42] corstone1000: add nvmxip, fwu-mdata and gpt options
|
||||
Date: Mon, 17 Jul 2023 17:33:52 +0100
|
||||
Subject: [PATCH 27/33] corstone1000: add nvmxip, fwu-mdata and gpt options
|
||||
|
||||
Enable the newest features: nvmxip, fwu-metadata and
|
||||
gpt. Commands to print the partition info, gpt info
|
||||
@@ -10,29 +10,14 @@ and fwu metadata will be available.
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
configs/corstone1000_defconfig | 29 +++++++++++++++++++----------
|
||||
1 file changed, 19 insertions(+), 10 deletions(-)
|
||||
configs/corstone1000_defconfig | 21 ++++++++++++++-------
|
||||
1 file changed, 14 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index 1179bf5f3b..c38113ce95 100644
|
||||
index a92668389a..4c75a01818 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -4,18 +4,20 @@ CONFIG_TARGET_CORSTONE1000=y
|
||||
CONFIG_TEXT_BASE=0x80000000
|
||||
CONFIG_SYS_MALLOC_LEN=0x2000000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000
|
||||
+CONFIG_DM_GPIO=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="corstone1000-mps3"
|
||||
CONFIG_SYS_PROMPT="corstone1000# "
|
||||
CONFIG_IDENT_STRING=" corstone1000 aarch64 "
|
||||
CONFIG_SYS_LOAD_ADDR=0x82100000
|
||||
+CONFIG_FWU_NUM_IMAGES_PER_BANK=4
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000
|
||||
CONFIG_FIT=y
|
||||
@@ -15,7 +15,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyAMA0 loglevel=9 ip=dhcp earlyprintk"
|
||||
@@ -41,7 +26,7 @@ index 1179bf5f3b..c38113ce95 100644
|
||||
CONFIG_CONSOLE_RECORD=y
|
||||
CONFIG_LOGLEVEL=7
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
@@ -23,11 +25,15 @@ CONFIG_LOGLEVEL=7
|
||||
@@ -23,11 +23,15 @@ CONFIG_LOGLEVEL=7
|
||||
CONFIG_SYS_MAXARGS=64
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
# CONFIG_CMD_CONSOLE is not set
|
||||
@@ -57,18 +42,12 @@ index 1179bf5f3b..c38113ce95 100644
|
||||
CONFIG_CMD_USB=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
# CONFIG_CMD_NFS is not set
|
||||
@@ -39,27 +45,30 @@ CONFIG_OF_CONTROL=y
|
||||
CONFIG_VERSION_VARIABLE=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
@@ -41,12 +45,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
-CONFIG_MISC=y
|
||||
+CONFIG_ARM_FFA_TRANSPORT=y
|
||||
CONFIG_MISC=y
|
||||
CONFIG_CLK=y
|
||||
-CONFIG_CMD_MMC=y
|
||||
-CONFIG_DM_MMC=y
|
||||
+CONFIG_FWU_MDATA=y
|
||||
+CONFIG_FWU_MDATA_GPT_BLK=y
|
||||
+CONFIG_MISC=y
|
||||
CONFIG_ARM_PL180_MMCI=y
|
||||
-CONFIG_MMC_SDHCI_ADMA_HELPERS=y
|
||||
-CONFIG_MMC_WRITE=y
|
||||
@@ -76,25 +55,21 @@ index 1179bf5f3b..c38113ce95 100644
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PHY_SMSC=y
|
||||
CONFIG_SMC911X=y
|
||||
+CONFIG_NVMXIP_QSPI=y
|
||||
CONFIG_PHY=y
|
||||
CONFIG_RAM=y
|
||||
CONFIG_DM_RTC=y
|
||||
CONFIG_RTC_EMULATION=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
+CONFIG_SYSRESET=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_ISP1760=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
CONFIG_EFI_MM_COMM_TEE=y
|
||||
CONFIG_ARM_FFA_TRANSPORT=y
|
||||
@@ -65,4 +64,12 @@ CONFIG_FFA_SHARED_MM_BUF_OFFSET=0
|
||||
CONFIG_FFA_SHARED_MM_BUF_ADDR=0x02000000
|
||||
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
||||
+CONFIG_EFI_CAPSULE_ON_DISK=y
|
||||
+CONFIG_EFI_IGNORE_OSINDICATIONS=y
|
||||
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
|
||||
-CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
|
||||
+CONFIG_FWU_NUM_IMAGES_PER_BANK=4
|
||||
+CONFIG_FWU_MDATA=y
|
||||
+CONFIG_FWU_MDATA_GPT_BLK=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_EFI_CAPSULE_ON_DISK=y
|
||||
+CONFIG_EFI_IGNORE_OSINDICATIONS=y
|
||||
+CONFIG_FWU_MULTI_BANK_UPDATE=y
|
||||
+# CONFIG_TOOLS_MKEFICAPSULE is not set
|
||||
+CONFIG_DM_GPIO=y
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-455
@@ -1,455 +0,0 @@
|
||||
From c7567aaf75a66e204d492a8f6e2a3b4bfb8a7e45 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 14 Apr 2023 13:23:25 +0100
|
||||
Subject: [PATCH 27/42] drivers/mtd/nvmxip: introduce NVM XIP block storage
|
||||
emulation
|
||||
|
||||
add block storage emulation for NVM XIP flash devices
|
||||
|
||||
Some paltforms such as Corstone-1000 need to see NVM XIP raw flash
|
||||
as a block storage device with read only capability.
|
||||
|
||||
Here NVM flash devices are devices with addressable
|
||||
memory (e.g: QSPI NOR flash).
|
||||
|
||||
The implementation is generic and can be used by different platforms.
|
||||
|
||||
Two drivers are provided as follows.
|
||||
|
||||
nvmxip-blk :
|
||||
|
||||
a generic block driver allowing to read from the XIP flash
|
||||
|
||||
nvmxip Uclass driver :
|
||||
|
||||
When a device is described in the DT and associated with
|
||||
UCLASS_NVMXIP, the Uclass creates a block device and binds it with
|
||||
the nvmxip-blk.
|
||||
|
||||
Platforms can use multiple NVM XIP devices at the same time by defining a
|
||||
DT node for each one of them.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
---
|
||||
MAINTAINERS | 6 ++
|
||||
doc/develop/driver-model/index.rst | 1 +
|
||||
doc/develop/driver-model/nvmxip.rst | 48 +++++++++++
|
||||
drivers/block/blk-uclass.c | 1 +
|
||||
drivers/mtd/Kconfig | 2 +
|
||||
drivers/mtd/Makefile | 1 +
|
||||
drivers/mtd/nvmxip/Kconfig | 13 +++
|
||||
drivers/mtd/nvmxip/Makefile | 7 ++
|
||||
drivers/mtd/nvmxip/nvmxip-uclass.c | 67 ++++++++++++++++
|
||||
drivers/mtd/nvmxip/nvmxip.c | 119 ++++++++++++++++++++++++++++
|
||||
drivers/mtd/nvmxip/nvmxip.h | 32 ++++++++
|
||||
include/dm/uclass-id.h | 1 +
|
||||
12 files changed, 298 insertions(+)
|
||||
create mode 100644 doc/develop/driver-model/nvmxip.rst
|
||||
create mode 100644 drivers/mtd/nvmxip/Kconfig
|
||||
create mode 100644 drivers/mtd/nvmxip/Makefile
|
||||
create mode 100644 drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
create mode 100644 drivers/mtd/nvmxip/nvmxip.c
|
||||
create mode 100644 drivers/mtd/nvmxip/nvmxip.h
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index a2f60a3b93..1dbfab5f43 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1202,6 +1202,12 @@ F: cmd/nvme.c
|
||||
F: include/nvme.h
|
||||
F: doc/develop/driver-model/nvme.rst
|
||||
|
||||
+NVMXIP
|
||||
+M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+S: Maintained
|
||||
+F: doc/develop/driver-model/nvmxip.rst
|
||||
+F: drivers/mtd/nvmxip/
|
||||
+
|
||||
NVMEM
|
||||
M: Sean Anderson <seanga2@gmail.com>
|
||||
S: Maintained
|
||||
diff --git a/doc/develop/driver-model/index.rst b/doc/develop/driver-model/index.rst
|
||||
index 7366ef818c..8e12bbd936 100644
|
||||
--- a/doc/develop/driver-model/index.rst
|
||||
+++ b/doc/develop/driver-model/index.rst
|
||||
@@ -20,6 +20,7 @@ subsystems
|
||||
livetree
|
||||
migration
|
||||
nvme
|
||||
+ nvmxip
|
||||
of-plat
|
||||
pci-info
|
||||
pmic-framework
|
||||
diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst
|
||||
new file mode 100644
|
||||
index 0000000000..fe087b13d2
|
||||
--- /dev/null
|
||||
+++ b/doc/develop/driver-model/nvmxip.rst
|
||||
@@ -0,0 +1,48 @@
|
||||
+.. SPDX-License-Identifier: GPL-2.0+
|
||||
+
|
||||
+NVM XIP Block Storage Emulation Driver
|
||||
+=======================================
|
||||
+
|
||||
+Summary
|
||||
+-------
|
||||
+
|
||||
+Non-Volatile Memory devices with addressable memory (e.g: QSPI NOR flash) could
|
||||
+be used for block storage needs (e.g: parsing a GPT layout in a raw QSPI NOR flash).
|
||||
+
|
||||
+The NVMXIP Uclass provides this functionality and can be used for any 64-bit platform.
|
||||
+
|
||||
+The NVMXIP Uclass provides the following drivers:
|
||||
+
|
||||
+ nvmxip-blk block driver:
|
||||
+
|
||||
+ A generic block driver allowing to read from the XIP flash.
|
||||
+ The driver belongs to UCLASS_BLK.
|
||||
+ The driver implemented by drivers/mtd/nvmxip/nvmxip.c
|
||||
+
|
||||
+ nvmxip Uclass driver:
|
||||
+
|
||||
+ When a device is described in the DT and associated with UCLASS_NVMXIP,
|
||||
+ the Uclass creates a block device and binds it with the nvmxip-blk.
|
||||
+ The Uclass driver implemented by drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
+
|
||||
+ The implementation is generic and can be used by different platforms.
|
||||
+
|
||||
+Supported hardware
|
||||
+--------------------------------
|
||||
+
|
||||
+Any 64-bit plaform.
|
||||
+
|
||||
+Configuration
|
||||
+----------------------
|
||||
+
|
||||
+config NVMXIP
|
||||
+ This option allows the emulation of a block storage device
|
||||
+ on top of a direct access non volatile memory XIP flash devices.
|
||||
+ This support provides the read operation.
|
||||
+ This option provides the block storage driver nvmxip-blk which
|
||||
+ handles the read operation. This driver is HW agnostic and can support
|
||||
+ multiple flash devices at the same time.
|
||||
+
|
||||
+Contributors
|
||||
+------------
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
|
||||
index c69fc4d518..e8ab576c32 100644
|
||||
--- a/drivers/block/blk-uclass.c
|
||||
+++ b/drivers/block/blk-uclass.c
|
||||
@@ -28,6 +28,7 @@ static struct {
|
||||
{ UCLASS_AHCI, "sata" },
|
||||
{ UCLASS_HOST, "host" },
|
||||
{ UCLASS_NVME, "nvme" },
|
||||
+ { UCLASS_NVMXIP, "nvmxip" },
|
||||
{ UCLASS_EFI_MEDIA, "efi" },
|
||||
{ UCLASS_EFI_LOADER, "efiloader" },
|
||||
{ UCLASS_VIRTIO, "virtio" },
|
||||
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
|
||||
index fcdb450f77..0537ac64e3 100644
|
||||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -224,4 +224,6 @@ source "drivers/mtd/spi/Kconfig"
|
||||
|
||||
source "drivers/mtd/ubi/Kconfig"
|
||||
|
||||
+source "drivers/mtd/nvmxip/Kconfig"
|
||||
+
|
||||
endmenu
|
||||
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
|
||||
index 3a78590aaa..c638980ea2 100644
|
||||
--- a/drivers/mtd/Makefile
|
||||
+++ b/drivers/mtd/Makefile
|
||||
@@ -25,6 +25,7 @@ obj-y += nand/
|
||||
obj-y += onenand/
|
||||
obj-y += spi/
|
||||
obj-$(CONFIG_MTD_UBI) += ubi/
|
||||
+obj-$(CONFIG_NVMXIP) += nvmxip/
|
||||
|
||||
#SPL/TPL build
|
||||
else
|
||||
diff --git a/drivers/mtd/nvmxip/Kconfig b/drivers/mtd/nvmxip/Kconfig
|
||||
new file mode 100644
|
||||
index 0000000000..ef53fc3c79
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/Kconfig
|
||||
@@ -0,0 +1,13 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0+
|
||||
+#
|
||||
+# Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+# Authors:
|
||||
+# Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+
|
||||
+config NVMXIP
|
||||
+ bool "NVM XIP devices support"
|
||||
+ select BLK
|
||||
+ help
|
||||
+ This option allows the emulation of a block storage device
|
||||
+ on top of a direct access non volatile memory XIP flash devices.
|
||||
+ This support provides the read operation.
|
||||
diff --git a/drivers/mtd/nvmxip/Makefile b/drivers/mtd/nvmxip/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..07890982c7
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/Makefile
|
||||
@@ -0,0 +1,7 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0+
|
||||
+#
|
||||
+# Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+# Authors:
|
||||
+# Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+
|
||||
+obj-y += nvmxip-uclass.o nvmxip.o
|
||||
diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
new file mode 100644
|
||||
index 0000000000..9f96041e3d
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
@@ -0,0 +1,67 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <log.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include "nvmxip.h"
|
||||
+
|
||||
+/* LBA Macros */
|
||||
+
|
||||
+#define DEFAULT_LBA_SHIFT 10 /* 1024 bytes per block */
|
||||
+#define DEFAULT_LBA_COUNT 1024 /* block count */
|
||||
+
|
||||
+#define DEFAULT_LBA_SZ BIT(DEFAULT_LBA_SHIFT)
|
||||
+
|
||||
+/**
|
||||
+ * nvmxip_post_bind() - post binding treatments
|
||||
+ * @dev: the NVMXIP device
|
||||
+ *
|
||||
+ * Create and probe a child block device.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success. Otherwise, failure
|
||||
+ */
|
||||
+static int nvmxip_post_bind(struct udevice *udev)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct udevice *bdev = NULL;
|
||||
+ char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1];
|
||||
+ int devnum;
|
||||
+
|
||||
+ devnum = uclass_id_count(UCLASS_NVMXIP);
|
||||
+ snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", devnum);
|
||||
+
|
||||
+ ret = blk_create_devicef(udev, NVMXIP_BLKDRV_NAME, bdev_name, UCLASS_NVMXIP,
|
||||
+ devnum, DEFAULT_LBA_SZ,
|
||||
+ DEFAULT_LBA_COUNT, &bdev);
|
||||
+ if (ret) {
|
||||
+ log_err("[%s]: failure during creation of the block device %s, error %d\n",
|
||||
+ udev->name, bdev_name, ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = blk_probe_or_unbind(bdev);
|
||||
+ if (ret) {
|
||||
+ log_err("[%s]: failure during probing the block device %s, error %d\n",
|
||||
+ udev->name, bdev_name, ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ log_info("[%s]: the block device %s ready for use\n", udev->name, bdev_name);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+UCLASS_DRIVER(nvmxip) = {
|
||||
+ .name = "nvmxip",
|
||||
+ .id = UCLASS_NVMXIP,
|
||||
+ .post_bind = nvmxip_post_bind,
|
||||
+};
|
||||
diff --git a/drivers/mtd/nvmxip/nvmxip.c b/drivers/mtd/nvmxip/nvmxip.c
|
||||
new file mode 100644
|
||||
index 0000000000..a359e3b482
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/nvmxip.c
|
||||
@@ -0,0 +1,119 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <log.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include "nvmxip.h"
|
||||
+
|
||||
+/**
|
||||
+ * nvmxip_mmio_rawread() - read from the XIP flash
|
||||
+ * @address: address of the data
|
||||
+ * @value: pointer to where storing the value read
|
||||
+ *
|
||||
+ * Read raw data from the XIP flash.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * Always return 0.
|
||||
+ */
|
||||
+static int nvmxip_mmio_rawread(const phys_addr_t address, u64 *value)
|
||||
+{
|
||||
+ *value = readq(address);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * nvmxip_blk_read() - block device read operation
|
||||
+ * @dev: the block device
|
||||
+ * @blknr: first block number to read from
|
||||
+ * @blkcnt: number of blocks to read
|
||||
+ * @buffer: destination buffer
|
||||
+ *
|
||||
+ * Read data from the block storage device.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * number of blocks read on success. Otherwise, failure
|
||||
+ */
|
||||
+static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
|
||||
+{
|
||||
+ struct nvmxip_plat *plat = dev_get_plat(dev->parent);
|
||||
+ struct blk_desc *desc = dev_get_uclass_plat(dev);
|
||||
+ /* number of the u64 words to read */
|
||||
+ u32 qwords = (blkcnt * desc->blksz) / sizeof(u64);
|
||||
+ /* physical address of the first block to read */
|
||||
+ phys_addr_t blkaddr = plat->phys_base + blknr * desc->blksz;
|
||||
+ u64 *virt_blkaddr;
|
||||
+ u64 *pdst = buffer;
|
||||
+ uint qdata_idx;
|
||||
+
|
||||
+ if (!pdst)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ log_debug("[%s]: reading from blknr: %lu , blkcnt: %lu\n", dev->name, blknr, blkcnt);
|
||||
+
|
||||
+ virt_blkaddr = map_sysmem(blkaddr, 0);
|
||||
+
|
||||
+ /* assumption: the data is virtually contiguous */
|
||||
+
|
||||
+ for (qdata_idx = 0 ; qdata_idx < qwords ; qdata_idx++)
|
||||
+ nvmxip_mmio_rawread((phys_addr_t)(virt_blkaddr + qdata_idx), pdst++);
|
||||
+
|
||||
+ log_debug("[%s]: src[0]: 0x%llx , dst[0]: 0x%llx , src[-1]: 0x%llx , dst[-1]: 0x%llx\n",
|
||||
+ dev->name,
|
||||
+ *virt_blkaddr,
|
||||
+ *(u64 *)buffer,
|
||||
+ *(u64 *)((u8 *)virt_blkaddr + desc->blksz * blkcnt - sizeof(u64)),
|
||||
+ *(u64 *)((u8 *)buffer + desc->blksz * blkcnt - sizeof(u64)));
|
||||
+
|
||||
+ unmap_sysmem(virt_blkaddr);
|
||||
+
|
||||
+ return blkcnt;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * nvmxip_blk_probe() - block storage device probe
|
||||
+ * @dev: the block storage device
|
||||
+ *
|
||||
+ * Initialize the block storage descriptor.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * Always return 0.
|
||||
+ */
|
||||
+static int nvmxip_blk_probe(struct udevice *dev)
|
||||
+{
|
||||
+ struct nvmxip_plat *plat = dev_get_plat(dev->parent);
|
||||
+ struct blk_desc *desc = dev_get_uclass_plat(dev);
|
||||
+
|
||||
+ desc->lba = plat->lba;
|
||||
+ desc->log2blksz = plat->lba_shift;
|
||||
+ desc->blksz = BIT(plat->lba_shift);
|
||||
+ desc->bdev = dev;
|
||||
+
|
||||
+ log_debug("[%s]: block storage layout\n lbas: %lu , log2blksz: %d, blksz: %lu\n",
|
||||
+ dev->name, desc->lba, desc->log2blksz, desc->blksz);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct blk_ops nvmxip_blk_ops = {
|
||||
+ .read = nvmxip_blk_read,
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(nvmxip_blk) = {
|
||||
+ .name = NVMXIP_BLKDRV_NAME,
|
||||
+ .id = UCLASS_BLK,
|
||||
+ .probe = nvmxip_blk_probe,
|
||||
+ .ops = &nvmxip_blk_ops,
|
||||
+};
|
||||
diff --git a/drivers/mtd/nvmxip/nvmxip.h b/drivers/mtd/nvmxip/nvmxip.h
|
||||
new file mode 100644
|
||||
index 0000000000..f4ef37725d
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/nvmxip.h
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __DRIVER_NVMXIP_H__
|
||||
+#define __DRIVER_NVMXIP_H__
|
||||
+
|
||||
+#include <blk.h>
|
||||
+
|
||||
+#define NVMXIP_BLKDRV_NAME "nvmxip-blk"
|
||||
+#define NVMXIP_BLKDEV_NAME_SZ 20
|
||||
+
|
||||
+/**
|
||||
+ * struct nvmxip_plat - the NVMXIP driver plat
|
||||
+ *
|
||||
+ * @phys_base: NVM XIP device base address
|
||||
+ * @lba_shift: block size shift count
|
||||
+ * @lba: number of blocks
|
||||
+ *
|
||||
+ * The NVMXIP information read from the DT.
|
||||
+ */
|
||||
+struct nvmxip_plat {
|
||||
+ phys_addr_t phys_base;
|
||||
+ u32 lba_shift;
|
||||
+ lbaint_t lba;
|
||||
+};
|
||||
+
|
||||
+#endif /* __DRIVER_NVMXIP_H__ */
|
||||
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
|
||||
index fa08a66ac8..f3564a49d9 100644
|
||||
--- a/include/dm/uclass-id.h
|
||||
+++ b/include/dm/uclass-id.h
|
||||
@@ -92,6 +92,7 @@ enum uclass_id {
|
||||
UCLASS_NOP, /* No-op devices */
|
||||
UCLASS_NORTHBRIDGE, /* Intel Northbridge / SDRAM controller */
|
||||
UCLASS_NVME, /* NVM Express device */
|
||||
+ UCLASS_NVMXIP, /* NVM XIP devices */
|
||||
UCLASS_P2SB, /* (x86) Primary-to-Sideband Bus */
|
||||
UCLASS_PANEL, /* Display panel, such as an LCD */
|
||||
UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-271
@@ -1,271 +0,0 @@
|
||||
From 4b71ade0e8e5ad3692b1decb5c1d0c9472827535 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 14 Apr 2023 13:44:25 +0100
|
||||
Subject: [PATCH 28/42] drivers/mtd/nvmxip: introduce QSPI XIP driver
|
||||
|
||||
add nvmxip_qspi driver under UCLASS_NVMXIP
|
||||
|
||||
The device associated with this driver is the parent of the blk#<id> device
|
||||
nvmxip_qspi can be reused by other platforms. If the platform
|
||||
has custom settings to apply before using the flash, then the platform
|
||||
can provide its own parent driver belonging to UCLASS_NVMXIP and reuse
|
||||
nvmxip-blk driver. The custom driver can be implemented like nvmxip_qspi in
|
||||
addition to the platform custom settings.
|
||||
|
||||
Platforms can use multiple NVM XIP devices at the same time by defining a
|
||||
DT node for each one of them.
|
||||
|
||||
For more details please refer to doc/develop/driver-model/nvmxip_qspi.rst
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
doc/develop/driver-model/nvmxip.rst | 45 +++++++++++-
|
||||
.../nvmxip/nvmxip_qspi.txt | 56 +++++++++++++++
|
||||
drivers/mtd/nvmxip/Kconfig | 6 ++
|
||||
drivers/mtd/nvmxip/Makefile | 1 +
|
||||
drivers/mtd/nvmxip/nvmxip_qspi.c | 70 +++++++++++++++++++
|
||||
6 files changed, 178 insertions(+), 1 deletion(-)
|
||||
create mode 100644 doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
create mode 100644 drivers/mtd/nvmxip/nvmxip_qspi.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 1dbfab5f43..f81654346e 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1206,6 +1206,7 @@ NVMXIP
|
||||
M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
S: Maintained
|
||||
F: doc/develop/driver-model/nvmxip.rst
|
||||
+F: doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
F: drivers/mtd/nvmxip/
|
||||
|
||||
NVMEM
|
||||
diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst
|
||||
index fe087b13d2..09afdbcccf 100644
|
||||
--- a/doc/develop/driver-model/nvmxip.rst
|
||||
+++ b/doc/develop/driver-model/nvmxip.rst
|
||||
@@ -25,7 +25,33 @@ The NVMXIP Uclass provides the following drivers:
|
||||
the Uclass creates a block device and binds it with the nvmxip-blk.
|
||||
The Uclass driver implemented by drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
|
||||
- The implementation is generic and can be used by different platforms.
|
||||
+ nvmxip_qspi driver :
|
||||
+
|
||||
+ The driver probed with the DT and is the parent of the blk#<id> device.
|
||||
+ nvmxip_qspi can be reused by other platforms. If the platform
|
||||
+ has custom settings to apply before using the flash, then the platform
|
||||
+ can provide its own parent driver belonging to UCLASS_NVMXIP and reuse
|
||||
+ nvmxip-blk. The custom driver can be implemented like nvmxip_qspi in
|
||||
+ addition to the platform custom settings.
|
||||
+ The nvmxip_qspi driver belongs to UCLASS_NVMXIP.
|
||||
+ The driver implemented by drivers/mtd/nvmxip/nvmxip_qspi.c
|
||||
+
|
||||
+ For example, if we have two NVMXIP devices described in the DT
|
||||
+ The devices hierarchy is as follows:
|
||||
+
|
||||
+::
|
||||
+
|
||||
+ => dm tree
|
||||
+
|
||||
+ Class Index Probed Driver Name
|
||||
+ -----------------------------------------------------------
|
||||
+ ...
|
||||
+ nvmxip 0 [ + ] nvmxip_qspi |-- nvmxip-qspi1@08000000
|
||||
+ blk 3 [ + ] nvmxip-blk | `-- nvmxip-qspi1@08000000.blk#1
|
||||
+ nvmxip 1 [ + ] nvmxip_qspi |-- nvmxip-qspi2@08200000
|
||||
+ blk 4 [ + ] nvmxip-blk | `-- nvmxip-qspi2@08200000.blk#2
|
||||
+
|
||||
+The implementation is generic and can be used by different platforms.
|
||||
|
||||
Supported hardware
|
||||
--------------------------------
|
||||
@@ -43,6 +69,23 @@ config NVMXIP
|
||||
handles the read operation. This driver is HW agnostic and can support
|
||||
multiple flash devices at the same time.
|
||||
|
||||
+config NVMXIP_QSPI
|
||||
+ This option allows the emulation of a block storage device on top of a QSPI XIP flash.
|
||||
+ Any platform that needs to emulate one or multiple QSPI XIP flash devices can turn this
|
||||
+ option on to enable the functionality. NVMXIP config is selected automatically.
|
||||
+ Platforms that need to add custom treatments before accessing to the flash, can
|
||||
+ write their own driver (same as nvmxip_qspi in addition to the custom settings).
|
||||
+
|
||||
+Device Tree nodes
|
||||
+--------------------
|
||||
+
|
||||
+Multiple QSPI XIP flash devices can be used at the same time by describing them through DT
|
||||
+nodes.
|
||||
+
|
||||
+Please refer to the documentation of the DT binding at:
|
||||
+
|
||||
+doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
+
|
||||
Contributors
|
||||
------------
|
||||
* Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
diff --git a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
new file mode 100644
|
||||
index 0000000000..cc60e9efdc
|
||||
--- /dev/null
|
||||
+++ b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
@@ -0,0 +1,56 @@
|
||||
+Specifying NVMXIP information for devices
|
||||
+======================================
|
||||
+
|
||||
+QSPI XIP flash device nodes
|
||||
+---------------------------
|
||||
+
|
||||
+Each flash device should have its own node.
|
||||
+
|
||||
+Each node must specify the following fields:
|
||||
+
|
||||
+1)
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+
|
||||
+This allows to bind the flash device with the nvmxip_qspi driver
|
||||
+If a platform has its own driver, please provide your own compatible
|
||||
+string.
|
||||
+
|
||||
+2)
|
||||
+ reg = <0x0 0x08000000 0x0 0x00200000>;
|
||||
+
|
||||
+The start address and size of the flash device. The values give here are an
|
||||
+example (when the cell size is 2).
|
||||
+
|
||||
+When cell size is 1, the reg field looks like this:
|
||||
+
|
||||
+ reg = <0x08000000 0x00200000>;
|
||||
+
|
||||
+3)
|
||||
+
|
||||
+ lba_shift = <9>;
|
||||
+
|
||||
+The number of bit shifts used to calculate the size in bytes of one block.
|
||||
+In this example the block size is 1 << 9 = 2 ^ 9 = 512 bytes
|
||||
+
|
||||
+4)
|
||||
+
|
||||
+ lba = <4096>;
|
||||
+
|
||||
+The number of blocks.
|
||||
+
|
||||
+Example of multiple flash devices
|
||||
+----------------------------------------------------
|
||||
+
|
||||
+ nvmxip-qspi1@08000000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = <0x0 0x08000000 0x0 0x00200000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <4096>;
|
||||
+ };
|
||||
+
|
||||
+ nvmxip-qspi2@08200000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = <0x0 0x08200000 0x0 0x00100000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <2048>;
|
||||
+ };
|
||||
diff --git a/drivers/mtd/nvmxip/Kconfig b/drivers/mtd/nvmxip/Kconfig
|
||||
index ef53fc3c79..3ef7105026 100644
|
||||
--- a/drivers/mtd/nvmxip/Kconfig
|
||||
+++ b/drivers/mtd/nvmxip/Kconfig
|
||||
@@ -11,3 +11,9 @@ config NVMXIP
|
||||
This option allows the emulation of a block storage device
|
||||
on top of a direct access non volatile memory XIP flash devices.
|
||||
This support provides the read operation.
|
||||
+
|
||||
+config NVMXIP_QSPI
|
||||
+ bool "QSPI XIP support"
|
||||
+ select NVMXIP
|
||||
+ help
|
||||
+ This option allows the emulation of a block storage device on top of a QSPI XIP flash
|
||||
diff --git a/drivers/mtd/nvmxip/Makefile b/drivers/mtd/nvmxip/Makefile
|
||||
index 07890982c7..54eacc102e 100644
|
||||
--- a/drivers/mtd/nvmxip/Makefile
|
||||
+++ b/drivers/mtd/nvmxip/Makefile
|
||||
@@ -5,3 +5,4 @@
|
||||
# Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
|
||||
obj-y += nvmxip-uclass.o nvmxip.o
|
||||
+obj-$(CONFIG_NVMXIP_QSPI) += nvmxip_qspi.o
|
||||
diff --git a/drivers/mtd/nvmxip/nvmxip_qspi.c b/drivers/mtd/nvmxip/nvmxip_qspi.c
|
||||
new file mode 100644
|
||||
index 0000000000..7221fd1cb4
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nvmxip/nvmxip_qspi.c
|
||||
@@ -0,0 +1,70 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <fdt_support.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include "nvmxip.h"
|
||||
+
|
||||
+#include <asm/global_data.h>
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+#define NVMXIP_QSPI_DRV_NAME "nvmxip_qspi"
|
||||
+
|
||||
+/**
|
||||
+ * nvmxip_qspi_of_to_plat() -read from DT
|
||||
+ * @dev: the NVMXIP device
|
||||
+ *
|
||||
+ * Read from the DT the NVMXIP information.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success. Otherwise, failure
|
||||
+ */
|
||||
+static int nvmxip_qspi_of_to_plat(struct udevice *dev)
|
||||
+{
|
||||
+ struct nvmxip_plat *plat = dev_get_plat(dev);
|
||||
+ int ret;
|
||||
+
|
||||
+ plat->phys_base = (phys_addr_t)dev_read_addr(dev);
|
||||
+ if (plat->phys_base == FDT_ADDR_T_NONE) {
|
||||
+ log_err("[%s]: can not get base address from device tree\n", dev->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ ret = dev_read_u32(dev, "lba_shift", &plat->lba_shift);
|
||||
+ if (ret) {
|
||||
+ log_err("[%s]: can not get lba_shift from device tree\n", dev->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ ret = dev_read_u32(dev, "lba", (u32 *)&plat->lba);
|
||||
+ if (ret) {
|
||||
+ log_err("[%s]: can not get lba from device tree\n", dev->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ log_debug("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n",
|
||||
+ dev->name, plat->phys_base, plat->lba_shift, plat->lba);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id nvmxip_qspi_ids[] = {
|
||||
+ { .compatible = "nvmxip,qspi" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(nvmxip_qspi) = {
|
||||
+ .name = NVMXIP_QSPI_DRV_NAME,
|
||||
+ .id = UCLASS_NVMXIP,
|
||||
+ .of_match = nvmxip_qspi_ids,
|
||||
+ .of_to_plat = nvmxip_qspi_of_to_plat,
|
||||
+ .plat_auto = sizeof(struct nvmxip_plat),
|
||||
+};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From d280414229d7bbee368f40be6cde17e4f251dd0f Mon Sep 17 00:00:00 2001
|
||||
From 050c2d8577fd98f20c8b96dab3e4c42c8508b6bc Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Fri, 9 Jun 2023 13:31:53 +0100
|
||||
Subject: [PATCH 39/42] nvmxip: move header to include
|
||||
Subject: [PATCH 28/33] nvmxip: move header to include
|
||||
|
||||
Move header to include to allow external code
|
||||
to get the internal bdev structures to access
|
||||
@@ -20,10 +20,10 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
rename {drivers/mtd/nvmxip => include}/nvmxip.h (100%)
|
||||
|
||||
diff --git a/disk/part.c b/disk/part.c
|
||||
index 5ee60a7fb5..593dd0004f 100644
|
||||
index 35300df590..f57dce7a29 100644
|
||||
--- a/disk/part.c
|
||||
+++ b/disk/part.c
|
||||
@@ -270,6 +270,9 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
|
||||
@@ -271,6 +271,9 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
|
||||
case UCLASS_NVME:
|
||||
puts ("NVMe");
|
||||
break;
|
||||
+11
-9
@@ -1,7 +1,7 @@
|
||||
From e7cb997fd59c883572994b504dbc77bc670de8f7 Mon Sep 17 00:00:00 2001
|
||||
From c547f3335ddff71a7f4915dc0c99ccbcdbf24b54 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Thu, 23 Feb 2023 10:35:00 +0000
|
||||
Subject: [PATCH 40/42] corstone1000: set kernel_addr based on boot_idx
|
||||
Date: Tue, 18 Jul 2023 12:14:47 +0100
|
||||
Subject: [PATCH 29/33] corstone1000: set kernel_addr based on boot_idx
|
||||
|
||||
We need to distinguish between boot banks and from which
|
||||
partition to load the kernel+initramfs to memory.
|
||||
@@ -19,17 +19,19 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
3 files changed, 58 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index 0a58ccd99c..b767195ccc 100644
|
||||
index ba6d024b80..a045262ebb 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -5,13 +5,23 @@
|
||||
@@ -5,15 +5,25 @@
|
||||
* Rui Miguel Silva <rui.silva@linaro.org>
|
||||
*/
|
||||
|
||||
+#include <blk.h>
|
||||
#include <common.h>
|
||||
#include <cpu_func.h>
|
||||
#include <dm.h>
|
||||
+#include <env.h>
|
||||
#include <fwu.h>
|
||||
#include <netdev.h>
|
||||
+#include <nvmxip.h>
|
||||
+#include <part.h>
|
||||
@@ -46,9 +48,9 @@ index 0a58ccd99c..b767195ccc 100644
|
||||
static struct mm_region corstone1000_mem_map[] = {
|
||||
{
|
||||
/* CVM */
|
||||
@@ -108,5 +118,51 @@ int dram_init_banksize(void)
|
||||
@@ -110,5 +120,51 @@ int dram_init_banksize(void)
|
||||
|
||||
void fwu_plat_get_bootidx(int *boot_idx)
|
||||
void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
{
|
||||
- *boot_idx = 0;
|
||||
+ *boot_idx = corstone1000_boot_idx;
|
||||
@@ -117,10 +119,10 @@ index a6ee496221..ee318b1b1c 100644
|
||||
- fi;
|
||||
kernel_addr_r=0x88200000
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index c38113ce95..20359cb181 100644
|
||||
index 4c75a01818..0232131a11 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -22,6 +22,7 @@ CONFIG_CONSOLE_RECORD=y
|
||||
@@ -20,6 +20,7 @@ CONFIG_CONSOLE_RECORD=y
|
||||
CONFIG_LOGLEVEL=7
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
From 1b80dfbefd59c8ddff77960552d6c0cc2747758c Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 16 Dec 2022 17:20:58 +0000
|
||||
Subject: [PATCH 29/42] sandbox64: fix: return unsigned long in readq()
|
||||
|
||||
make readq return unsigned long
|
||||
|
||||
readq should return 64-bit data
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
---
|
||||
arch/sandbox/cpu/cpu.c | 2 +-
|
||||
arch/sandbox/include/asm/io.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
|
||||
index 636d3545b9..248d17a85c 100644
|
||||
--- a/arch/sandbox/cpu/cpu.c
|
||||
+++ b/arch/sandbox/cpu/cpu.c
|
||||
@@ -230,7 +230,7 @@ phys_addr_t map_to_sysmem(const void *ptr)
|
||||
return mentry->tag;
|
||||
}
|
||||
|
||||
-unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
|
||||
+unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
|
||||
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
|
||||
index ad6c29a4e2..31ab7289b4 100644
|
||||
--- a/arch/sandbox/include/asm/io.h
|
||||
+++ b/arch/sandbox/include/asm/io.h
|
||||
@@ -45,7 +45,7 @@ static inline void unmap_sysmem(const void *vaddr)
|
||||
/* Map from a pointer to our RAM buffer */
|
||||
phys_addr_t map_to_sysmem(const void *ptr);
|
||||
|
||||
-unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size);
|
||||
+unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size);
|
||||
void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size);
|
||||
|
||||
#define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+9
-10
@@ -1,7 +1,7 @@
|
||||
From ab07a26290e44fb198403b658b8f1550e959a0cc Mon Sep 17 00:00:00 2001
|
||||
From faeeeecba2a7c8c507280ce369e3779f7c63d1e4 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Mon, 27 Feb 2023 14:40:13 +0000
|
||||
Subject: [PATCH 41/42] corstone1000: boot index from active
|
||||
Subject: [PATCH 30/33] corstone1000: boot index from active
|
||||
|
||||
In our platform, the Secure Enclave is the one who control
|
||||
all the boot tries and status, so, every time we get here
|
||||
@@ -9,17 +9,18 @@ we know that the we are booting from the active index.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
board/armltd/corstone1000/corstone1000.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index b767195ccc..db508ac3cb 100644
|
||||
index a045262ebb..53c65506d5 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -118,7 +118,18 @@ int dram_init_banksize(void)
|
||||
@@ -120,7 +120,16 @@ int dram_init_banksize(void)
|
||||
|
||||
void fwu_plat_get_bootidx(int *boot_idx)
|
||||
void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
{
|
||||
- *boot_idx = corstone1000_boot_idx;
|
||||
+ int ret;
|
||||
@@ -31,9 +32,7 @@ index b767195ccc..db508ac3cb 100644
|
||||
+ */
|
||||
+ ret = fwu_get_active_index(boot_idx);
|
||||
+ if (ret < 0)
|
||||
+ log_err("corstone1000: failed to read active index\n");
|
||||
+
|
||||
+ return ret;
|
||||
+ log_err("corstone1000: failed to read active index err %d\n", ret);
|
||||
}
|
||||
|
||||
int board_late_init(void)
|
||||
-161
@@ -1,161 +0,0 @@
|
||||
From 25467e433f02f40f5999ed6e6b0d3adb4c9cf16d Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 9 Jun 2023 13:08:37 +0100
|
||||
Subject: [PATCH 30/42] sandbox64: add support for NVMXIP QSPI
|
||||
|
||||
enable NVMXIP QSPI for sandbox 64-bit
|
||||
|
||||
Adding two NVM XIP QSPI storage devices.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v2:
|
||||
|
||||
* address nits
|
||||
---
|
||||
arch/sandbox/dts/sandbox64.dts | 13 +++++++++++++
|
||||
arch/sandbox/dts/test.dts | 14 ++++++++++++++
|
||||
configs/sandbox64_defconfig | 3 ++-
|
||||
doc/develop/driver-model/nvmxip.rst | 2 +-
|
||||
doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt | 6 +++---
|
||||
drivers/mtd/nvmxip/nvmxip-uclass.c | 7 +++++++
|
||||
6 files changed, 40 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts
|
||||
index 3eb0457089..c9a2f4b4a4 100644
|
||||
--- a/arch/sandbox/dts/sandbox64.dts
|
||||
+++ b/arch/sandbox/dts/sandbox64.dts
|
||||
@@ -89,6 +89,19 @@
|
||||
cs-gpios = <0>, <&gpio_a 0>;
|
||||
};
|
||||
|
||||
+ nvmxip-qspi1@08000000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = /bits/ 64 <0x08000000 0x00200000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <4096>;
|
||||
+ };
|
||||
+
|
||||
+ nvmxip-qspi2@08200000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = /bits/ 64 <0x08200000 0x00100000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <2048>;
|
||||
+ };
|
||||
};
|
||||
|
||||
#include "sandbox.dtsi"
|
||||
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
|
||||
index dffe10adbf..c3ba0a225e 100644
|
||||
--- a/arch/sandbox/dts/test.dts
|
||||
+++ b/arch/sandbox/dts/test.dts
|
||||
@@ -1745,6 +1745,20 @@
|
||||
compatible = "u-boot,fwu-mdata-gpt";
|
||||
fwu-mdata-store = <&mmc0>;
|
||||
};
|
||||
+
|
||||
+ nvmxip-qspi1@08000000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = <0x08000000 0x00200000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <4096>;
|
||||
+ };
|
||||
+
|
||||
+ nvmxip-qspi2@08200000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = <0x08200000 0x00100000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <2048>;
|
||||
+ };
|
||||
};
|
||||
|
||||
#include "sandbox_pmic.dtsi"
|
||||
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
|
||||
index 4b8a1ec42b..2dca176ae3 100644
|
||||
--- a/configs/sandbox64_defconfig
|
||||
+++ b/configs/sandbox64_defconfig
|
||||
@@ -260,4 +260,5 @@ CONFIG_UNIT_TEST=y
|
||||
CONFIG_UT_TIME=y
|
||||
CONFIG_UT_DM=y
|
||||
CONFIG_ARM_FFA_TRANSPORT=y
|
||||
-CONFIG_SANDBOX_FFA=y
|
||||
\ No newline at end of file
|
||||
+CONFIG_SANDBOX_FFA=y
|
||||
+CONFIG_NVMXIP_QSPI=y
|
||||
\ No newline at end of file
|
||||
diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst
|
||||
index 09afdbcccf..e85dc220b9 100644
|
||||
--- a/doc/develop/driver-model/nvmxip.rst
|
||||
+++ b/doc/develop/driver-model/nvmxip.rst
|
||||
@@ -56,7 +56,7 @@ The implementation is generic and can be used by different platforms.
|
||||
Supported hardware
|
||||
--------------------------------
|
||||
|
||||
-Any 64-bit plaform.
|
||||
+Any plaform supporting readq().
|
||||
|
||||
Configuration
|
||||
----------------------
|
||||
diff --git a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
index cc60e9efdc..882728d541 100644
|
||||
--- a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
+++ b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
@@ -16,7 +16,7 @@ If a platform has its own driver, please provide your own compatible
|
||||
string.
|
||||
|
||||
2)
|
||||
- reg = <0x0 0x08000000 0x0 0x00200000>;
|
||||
+ reg = /bits/ 64 <0x08000000 0x00200000>;
|
||||
|
||||
The start address and size of the flash device. The values give here are an
|
||||
example (when the cell size is 2).
|
||||
@@ -43,14 +43,14 @@ Example of multiple flash devices
|
||||
|
||||
nvmxip-qspi1@08000000 {
|
||||
compatible = "nvmxip,qspi";
|
||||
- reg = <0x0 0x08000000 0x0 0x00200000>;
|
||||
+ reg = /bits/ 64 <0x08000000 0x00200000>;
|
||||
lba_shift = <9>;
|
||||
lba = <4096>;
|
||||
};
|
||||
|
||||
nvmxip-qspi2@08200000 {
|
||||
compatible = "nvmxip,qspi";
|
||||
- reg = <0x0 0x08200000 0x0 0x00100000>;
|
||||
+ reg = /bits/ 64 <0x08200000 0x00100000>;
|
||||
lba_shift = <9>;
|
||||
lba = <2048>;
|
||||
};
|
||||
diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
index 9f96041e3d..6d8eb177b5 100644
|
||||
--- a/drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
+++ b/drivers/mtd/nvmxip/nvmxip-uclass.c
|
||||
@@ -9,6 +9,9 @@
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <log.h>
|
||||
+#if CONFIG_IS_ENABLED(SANDBOX64)
|
||||
+#include <asm/test.h>
|
||||
+#endif
|
||||
#include <linux/bitops.h>
|
||||
#include "nvmxip.h"
|
||||
|
||||
@@ -36,6 +39,10 @@ static int nvmxip_post_bind(struct udevice *udev)
|
||||
char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1];
|
||||
int devnum;
|
||||
|
||||
+#if CONFIG_IS_ENABLED(SANDBOX64)
|
||||
+ sandbox_set_enable_memio(true);
|
||||
+#endif
|
||||
+
|
||||
devnum = uclass_id_count(UCLASS_NVMXIP);
|
||||
snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", devnum);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
From 635848c90343a1b8a268519e3fc78ef7af2e4819 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 19 Dec 2022 13:20:19 +0000
|
||||
Subject: [PATCH 31/42] corstone1000: add NVM XIP QSPI device tree node
|
||||
|
||||
add QSPI flash device node for block storage access
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
---
|
||||
arch/arm/dts/corstone1000.dtsi | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi
|
||||
index 61e0c33247..18c4d1e19a 100644
|
||||
--- a/arch/arm/dts/corstone1000.dtsi
|
||||
+++ b/arch/arm/dts/corstone1000.dtsi
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 or MIT
|
||||
/*
|
||||
- * Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
* Copyright (c) 2022, Linaro Limited. All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -38,6 +38,13 @@
|
||||
reg = <0x88200000 0x77e00000>;
|
||||
};
|
||||
|
||||
+ nvmxip-qspi@08000000 {
|
||||
+ compatible = "nvmxip,qspi";
|
||||
+ reg = <0x08000000 0x2000000>;
|
||||
+ lba_shift = <9>;
|
||||
+ lba = <65536>;
|
||||
+ };
|
||||
+
|
||||
gic: interrupt-controller@1c000000 {
|
||||
compatible = "arm,gic-400";
|
||||
#interrupt-cells = <3>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+14
-13
@@ -1,7 +1,7 @@
|
||||
From 8bf48a56aa014146a8950532906b06e191754daa Mon Sep 17 00:00:00 2001
|
||||
From 0524aa417c4989bf03366f13a2456b3bcb72fb87 Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan Aras <emekcan.aras@arm.com>
|
||||
Date: Wed, 24 May 2023 09:12:11 +0100
|
||||
Subject: [PATCH 42/42] corstone1000: enable PSCI reset
|
||||
Date: Tue, 18 Jul 2023 12:19:17 +0100
|
||||
Subject: [PATCH 31/33] corstone1000: enable PSCI reset
|
||||
|
||||
Even though corstone1000 does not implement entire PSCI APIs,it relies on
|
||||
PSCI reset interface for the system reset. U-boot change the config name, so we
|
||||
@@ -10,21 +10,22 @@ need to enable it again.
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
|
||||
---
|
||||
configs/corstone1000_defconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
configs/corstone1000_defconfig | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index 20359cb181..19fe1432ae 100644
|
||||
index 0232131a11..ccd558cfce 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -62,6 +62,7 @@ CONFIG_DM_RTC=y
|
||||
CONFIG_RTC_EMULATION=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_SYSRESET=y
|
||||
@@ -73,4 +73,5 @@ CONFIG_EFI_CAPSULE_ON_DISK=y
|
||||
CONFIG_EFI_IGNORE_OSINDICATIONS=y
|
||||
CONFIG_FWU_MULTI_BANK_UPDATE=y
|
||||
# CONFIG_TOOLS_MKEFICAPSULE is not set
|
||||
-CONFIG_DM_GPIO=y
|
||||
\ No newline at end of file
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_SYSRESET_PSCI=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_ISP1760=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+14
-13
@@ -1,7 +1,7 @@
|
||||
From 9f326f0db8aa13fde93e2ed79055b920c8598a28 Mon Sep 17 00:00:00 2001
|
||||
From 0ba2b25a9c1dd9c63615bf6830cfb470f33a31b5 Mon Sep 17 00:00:00 2001
|
||||
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Date: Mon, 12 Jun 2023 15:14:52 +0000
|
||||
Subject: [PATCH] Enable EFI set/get time services
|
||||
Date: Tue, 18 Jul 2023 12:21:39 +0100
|
||||
Subject: [PATCH 32/33] Enable EFI set/get time services
|
||||
|
||||
SetTime_Conf and SetTime_Func tests in UEFI SCT test suite of ACS
|
||||
fails with unsupported return value. CONFIG_EFI_SET_TIME and
|
||||
@@ -10,23 +10,24 @@ services.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
---
|
||||
configs/corstone1000_defconfig | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
configs/corstone1000_defconfig | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index c692cc91bd..f1901dfe8b 100644
|
||||
index ccd558cfce..a0af413de8 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -7,6 +7,8 @@ CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000
|
||||
@@ -74,4 +74,6 @@ CONFIG_EFI_IGNORE_OSINDICATIONS=y
|
||||
CONFIG_FWU_MULTI_BANK_UPDATE=y
|
||||
# CONFIG_TOOLS_MKEFICAPSULE is not set
|
||||
CONFIG_DM_GPIO=y
|
||||
-CONFIG_SYSRESET_PSCI=y
|
||||
\ No newline at end of file
|
||||
+CONFIG_SYSRESET_PSCI=y
|
||||
+CONFIG_EFI_SET_TIME=y
|
||||
+CONFIG_EFI_GET_TIME=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="corstone1000-mps3"
|
||||
CONFIG_SYS_PROMPT="corstone1000# "
|
||||
CONFIG_IDENT_STRING=" corstone1000 aarch64 "
|
||||
--
|
||||
2.17.1
|
||||
2.25.1
|
||||
|
||||
-219
@@ -1,219 +0,0 @@
|
||||
From 0ecb61da60febc66e589d6fbf439478af1c88283 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 12 Jun 2023 17:33:54 +0100
|
||||
Subject: [PATCH 32/42] sandbox64: add a test case for UCLASS_NVMXIP
|
||||
|
||||
provide a test for NVM XIP devices
|
||||
|
||||
The test case allows to make sure of the following:
|
||||
|
||||
- The NVM XIP QSPI devices are probed
|
||||
- The DT entries are read correctly
|
||||
- the data read from the flash by the NVMXIP block driver is correct
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c]
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v2:
|
||||
|
||||
* address nits
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
test/dm/Makefile | 6 +-
|
||||
test/dm/nvmxip.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 151 insertions(+), 1 deletion(-)
|
||||
create mode 100644 test/dm/nvmxip.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index f81654346e..6692ce9974 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1208,6 +1208,7 @@ S: Maintained
|
||||
F: doc/develop/driver-model/nvmxip.rst
|
||||
F: doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
|
||||
F: drivers/mtd/nvmxip/
|
||||
+F: test/dm/nvmxip.c
|
||||
|
||||
NVMEM
|
||||
M: Sean Anderson <seanga2@gmail.com>
|
||||
diff --git a/test/dm/Makefile b/test/dm/Makefile
|
||||
index 85e99e1c12..963fa927f7 100644
|
||||
--- a/test/dm/Makefile
|
||||
+++ b/test/dm/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (c) 2013 Google, Inc
|
||||
-# (C) Copyright 2022 ARM Limited
|
||||
+# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
|
||||
obj-$(CONFIG_UT_DM) += test-dm.o
|
||||
|
||||
@@ -18,6 +18,10 @@ obj-$(CONFIG_UT_DM) += test-uclass.o
|
||||
obj-$(CONFIG_UT_DM) += core.o
|
||||
obj-$(CONFIG_UT_DM) += read.o
|
||||
obj-$(CONFIG_UT_DM) += phys2bus.o
|
||||
+ifeq ($(CONFIG_NVMXIP_QSPI)$(CONFIG_SANDBOX64),yy)
|
||||
+obj-y += nvmxip.o
|
||||
+endif
|
||||
+
|
||||
ifneq ($(CONFIG_SANDBOX),)
|
||||
ifeq ($(CONFIG_ACPIGEN),y)
|
||||
obj-y += acpi.o
|
||||
diff --git a/test/dm/nvmxip.c b/test/dm/nvmxip.c
|
||||
new file mode 100644
|
||||
index 0000000000..e934748eb5
|
||||
--- /dev/null
|
||||
+++ b/test/dm/nvmxip.c
|
||||
@@ -0,0 +1,145 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Functional tests for UCLASS_FFA class
|
||||
+ *
|
||||
+ * Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <blk.h>
|
||||
+#include <console.h>
|
||||
+#include <dm.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+#include "../../drivers/mtd/nvmxip/nvmxip.h"
|
||||
+
|
||||
+/* NVMXIP devices described in the device tree */
|
||||
+#define SANDBOX_NVMXIP_DEVICES 2
|
||||
+
|
||||
+/* reference device tree data for the probed devices */
|
||||
+static struct nvmxip_plat nvmqspi_refdata[SANDBOX_NVMXIP_DEVICES] = {
|
||||
+ {0x08000000, 9, 4096}, {0x08200000, 9, 2048}
|
||||
+};
|
||||
+
|
||||
+#define NVMXIP_BLK_START_PATTERN 0x1122334455667788ULL
|
||||
+#define NVMXIP_BLK_END_PATTERN 0xa1a2a3a4a5a6a7a8ULL
|
||||
+
|
||||
+/**
|
||||
+ * dm_nvmxip_flash_sanity() - check flash data
|
||||
+ * @uts: test state
|
||||
+ * @device_idx: the NVMXIP device index
|
||||
+ * @buffer: the user buffer where the blocks data is copied to
|
||||
+ *
|
||||
+ * Mode 1: When buffer is NULL, initialize the flash with pattern data at the start
|
||||
+ * and at the end of each block. This pattern data will be used to check data consistency
|
||||
+ * when verifying the data read.
|
||||
+ * Mode 2: When the user buffer is provided in the argument (not NULL), compare the data
|
||||
+ * of the start and the end of each block in the user buffer with the expected pattern data.
|
||||
+ * Return an error when the check fails.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success. Otherwise, failure
|
||||
+ */
|
||||
+static int dm_nvmxip_flash_sanity(struct unit_test_state *uts, u8 device_idx, void *buffer)
|
||||
+{
|
||||
+ int i;
|
||||
+ u64 *ptr;
|
||||
+ u8 *base;
|
||||
+ unsigned long blksz;
|
||||
+
|
||||
+ blksz = BIT(nvmqspi_refdata[device_idx].lba_shift);
|
||||
+
|
||||
+ if (!buffer) {
|
||||
+ /* Mode 1: point at the flash start address. Pattern data will be written */
|
||||
+ base = map_sysmem(nvmqspi_refdata[device_idx].phys_base, 0);
|
||||
+ } else {
|
||||
+ /* Mode 2: point at the user buffer containing the data read and to be verified */
|
||||
+ base = buffer;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < nvmqspi_refdata[device_idx].lba ; i++) {
|
||||
+ ptr = (u64 *)(base + i * blksz);
|
||||
+
|
||||
+ /* write an 8 bytes pattern at the start of the current block */
|
||||
+ if (!buffer)
|
||||
+ *ptr = NVMXIP_BLK_START_PATTERN;
|
||||
+ else
|
||||
+ ut_asserteq_64(NVMXIP_BLK_START_PATTERN, *ptr);
|
||||
+
|
||||
+ ptr = (u64 *)((u8 *)ptr + blksz - sizeof(u64));
|
||||
+
|
||||
+ /* write an 8 bytes pattern at the end of the current block */
|
||||
+ if (!buffer)
|
||||
+ *ptr = NVMXIP_BLK_END_PATTERN;
|
||||
+ else
|
||||
+ ut_asserteq_64(NVMXIP_BLK_END_PATTERN, *ptr);
|
||||
+ }
|
||||
+
|
||||
+ if (!buffer)
|
||||
+ unmap_sysmem(base);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * dm_test_nvmxip() - check flash data
|
||||
+ * @uts: test state
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * CMD_RET_SUCCESS on success. Otherwise, failure
|
||||
+ */
|
||||
+static int dm_test_nvmxip(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct nvmxip_plat *plat_data = NULL;
|
||||
+ struct udevice *dev = NULL, *bdev = NULL;
|
||||
+ u8 device_idx;
|
||||
+ void *buffer = NULL;
|
||||
+ unsigned long flashsz;
|
||||
+
|
||||
+ /* set the flash content first for both devices */
|
||||
+ dm_nvmxip_flash_sanity(uts, 0, NULL);
|
||||
+ dm_nvmxip_flash_sanity(uts, 1, NULL);
|
||||
+
|
||||
+ /* probing all NVM XIP QSPI devices */
|
||||
+ for (device_idx = 0, uclass_first_device(UCLASS_NVMXIP, &dev);
|
||||
+ dev;
|
||||
+ uclass_next_device(&dev), device_idx++) {
|
||||
+ plat_data = dev_get_plat(dev);
|
||||
+
|
||||
+ /* device tree entries checks */
|
||||
+ ut_assertok(nvmqspi_refdata[device_idx].phys_base != plat_data->phys_base);
|
||||
+ ut_assertok(nvmqspi_refdata[device_idx].lba_shift != plat_data->lba_shift);
|
||||
+ ut_assertok(nvmqspi_refdata[device_idx].lba != plat_data->lba);
|
||||
+
|
||||
+ /* before reading all the flash blocks, let's calculate the flash size */
|
||||
+ flashsz = plat_data->lba << plat_data->lba_shift;
|
||||
+
|
||||
+ /* allocate the user buffer where to copy the blocks data to */
|
||||
+ buffer = calloc(flashsz, 1);
|
||||
+ ut_assertok(!buffer);
|
||||
+
|
||||
+ /* the block device is the child of the parent device probed with DT */
|
||||
+ ut_assertok(device_find_first_child(dev, &bdev));
|
||||
+
|
||||
+ /* reading all the flash blocks */
|
||||
+ ut_asserteq(plat_data->lba, blk_read(bdev, 0, plat_data->lba, buffer));
|
||||
+
|
||||
+ /* compare the data read from flash with the expected data */
|
||||
+ dm_nvmxip_flash_sanity(uts, device_idx, buffer);
|
||||
+
|
||||
+ free(buffer);
|
||||
+ }
|
||||
+
|
||||
+ ut_assertok(device_idx != SANDBOX_NVMXIP_DEVICES);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_nvmxip, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
From 92948559987d02baf9f690d9bbdc96d1179264ef Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Wed, 1 Feb 2023 16:15:30 +0000
|
||||
Subject: [PATCH 36/42] corstone1000: add boot index
|
||||
|
||||
it is expected that the firmware that runs before
|
||||
u-boot somehow provide the information of the bank
|
||||
(index) of it is booting.
|
||||
We will need to extend tf-a to pass that info,
|
||||
meanwhile just set it to the default bank.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index d6ca6e8961..0a58ccd99c 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -106,6 +106,7 @@ int dram_init_banksize(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void reset_cpu(ulong addr)
|
||||
+void fwu_plat_get_bootidx(int *boot_idx)
|
||||
{
|
||||
+ *boot_idx = 0;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
From dfebda98ce08d0cab411521ab3d9e832ed1b4608 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Thu, 15 Jun 2023 16:51:49 +0100
|
||||
Subject: [PATCH] corstone1000: fix compilation warnings in
|
||||
fwu_plat_get_bootidx()
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
---
|
||||
board/armltd/corstone1000/corstone1000.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index db508ac3cb..2e1ace5d04 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <env.h>
|
||||
+#include <fwu.h>
|
||||
#include <netdev.h>
|
||||
#include <nvmxip.h>
|
||||
#include <part.h>
|
||||
@@ -116,7 +117,7 @@ int dram_init_banksize(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void fwu_plat_get_bootidx(int *boot_idx)
|
||||
+void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -127,9 +128,7 @@ void fwu_plat_get_bootidx(int *boot_idx)
|
||||
*/
|
||||
ret = fwu_get_active_index(boot_idx);
|
||||
if (ret < 0)
|
||||
- log_err("corstone1000: failed to read active index\n");
|
||||
-
|
||||
- return ret;
|
||||
+ log_err("corstone1000: failed to read active index err %d\n", ret);
|
||||
}
|
||||
|
||||
int board_late_init(void)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -18,49 +18,38 @@ EXTRA_OEMAKE:append:corstone1000 = ' DEVICE_TREE=${CORSTONE1000_DEVICE_TREE}'
|
||||
SYSROOT_DIRS:append:corstone1000 = " /boot"
|
||||
|
||||
SRC_URI:append:corstone1000 = " \
|
||||
file://0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch \
|
||||
file://0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch \
|
||||
file://0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch \
|
||||
file://0004-arm_ffa-efi-unmap-RX-TX-buffers.patch \
|
||||
file://0005-arm_ffa-introduce-armffa-command.patch \
|
||||
file://0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch \
|
||||
file://0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch \
|
||||
file://0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch \
|
||||
file://0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch \
|
||||
file://0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch \
|
||||
file://0011-efi-corstone1000-introduce-EFI-capsule-update.patch \
|
||||
file://0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch \
|
||||
file://0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch \
|
||||
file://0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch \
|
||||
file://0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch \
|
||||
file://0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \
|
||||
file://0017-efi_firmware-add-get_image_info-for-corstone1000.patch \
|
||||
file://0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch \
|
||||
file://0019-efi_loader-fix-null-pointer-exception-with-get_image.patch \
|
||||
file://0020-arm-corstone1000-add-mmc-for-fvp.patch \
|
||||
file://0021-corstone1000-add-compressed-kernel-support.patch \
|
||||
file://0022-Introduce-external-sys-driver-to-device-tree.patch \
|
||||
file://0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \
|
||||
file://0024-arm-corstone1000-esrt-support.patch \
|
||||
file://0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch \
|
||||
file://0026-corstone1000-enable-distro-booting-command.patch \
|
||||
file://0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch \
|
||||
file://0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch \
|
||||
file://0029-sandbox64-fix-return-unsigned-long-in-readq.patch \
|
||||
file://0030-sandbox64-add-support-for-NVMXIP-QSPI.patch \
|
||||
file://0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch \
|
||||
file://0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch \
|
||||
file://0033-corstone1000-add-fwu-metadata-store-info.patch \
|
||||
file://0034-fwu_metadata-make-sure-structures-are-packed.patch \
|
||||
file://0035-corstone1000-add-boot-index.patch \
|
||||
file://0036-corstone1000-adjust-boot-bank-and-kernel-location.patch \
|
||||
file://0037-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch \
|
||||
file://0038-nvmxip-move-header-to-include.patch \
|
||||
file://0039-corstone1000-set-kernel_addr-based-on-boot_idx.patch \
|
||||
file://0040-corstone1000-boot-index-from-active.patch \
|
||||
file://0041-corstone1000-enable-PSCI-reset.patch \
|
||||
file://0042-Enable-EFI-set-get-time-services.patch \
|
||||
file://0043-corstone1000-fix-compilation-warnings-in-fwu_plat_get_bootidx.patch \
|
||||
file://0001-FF-A-v15-arm64-smccc-add-support-for-SMCCCv1.2-x0-x1.patch \
|
||||
file://0002-FF-A-v15-lib-uuid-introduce-uuid_str_to_le_bin-funct.patch \
|
||||
file://0003-FF-A-v15-lib-uuid-introduce-testcase-for-uuid_str_to.patch \
|
||||
file://0004-FF-A-v15-arm_ffa-introduce-Arm-FF-A-support.patch \
|
||||
file://0005-FF-A-v15-arm_ffa-introduce-armffa-command.patch \
|
||||
file://0006-FF-A-v15-arm_ffa-introduce-sandbox-FF-A-support.patch \
|
||||
file://0007-FF-A-v15-arm_ffa-introduce-sandbox-test-cases-for-UC.patch \
|
||||
file://0008-FF-A-v15-arm_ffa-introduce-armffa-command-Sandbox-te.patch \
|
||||
file://0009-FF-A-v15-arm_ffa-efi-introduce-FF-A-MM-communication.patch \
|
||||
file://0010-FF-A-v15-arm_ffa-efi-corstone1000-enable-MM-communic.patch \
|
||||
file://0011-efi-corstone1000-fwu-introduce-EFI-capsule-update.patch \
|
||||
file://0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch \
|
||||
file://0013-efi_loader-corstone1000-remove-guid-check-from-corst.patch \
|
||||
file://0014-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \
|
||||
file://0015-efi_firmware-add-get_image_info-for-corstone1000.patch \
|
||||
file://0016-efi_loader-fix-null-pointer-exception-with-get_image.patch \
|
||||
file://0017-arm-corstone1000-add-mmc-for-fvp.patch \
|
||||
file://0018-corstone1000-add-compressed-kernel-support.patch \
|
||||
file://0019-Introduce-external-sys-driver-to-device-tree.patch \
|
||||
file://0020-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \
|
||||
file://0021-arm-corstone1000-esrt-support.patch \
|
||||
file://0022-corstone1000-enable-distro-booting-command.patch \
|
||||
file://0023-corstone1000-add-fwu-metadata-store-info.patch \
|
||||
file://0024-fwu_metadata-make-sure-structures-are-packed.patch \
|
||||
file://0025-corstone1000-add-boot-index.patch \
|
||||
file://0026-corstone1000-adjust-boot-bank-and-kernel-location.patch \
|
||||
file://0027-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch \
|
||||
file://0028-nvmxip-move-header-to-include.patch \
|
||||
file://0029-corstone1000-set-kernel_addr-based-on-boot_idx.patch \
|
||||
file://0030-corstone1000-boot-index-from-active.patch \
|
||||
file://0031-corstone1000-enable-PSCI-reset.patch \
|
||||
file://0032-Enable-EFI-set-get-time-services.patch \
|
||||
"
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user