blob: a1dc18edaa2dc69ecde35bb2821da0b8593eb404 [file] [log] [blame]
Patrick Williams44b3caf2024-04-12 16:51:14 -05001From c95d1bd311b251e5dd6c6e53c2dc7977bdca7870 Mon Sep 17 00:00:00 2001
Patrick Williams2a254922023-08-11 09:48:11 -05002From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
3Date: Fri, 23 Jun 2023 13:44:10 +0100
Patrick Williams44b3caf2024-04-12 16:51:14 -05004Subject: [PATCH] FF-A v15: arm_ffa: introduce armffa command Sandbox test
Patrick Williams2a254922023-08-11 09:48:11 -05005
6Add Sandbox test for the armffa command
7
8Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
9Reviewed-by: Simon Glass <sjg@chromium.org>
10Cc: Tom Rini <trini@konsulko.com>
11Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12Cc: Jens Wiklander <jens.wiklander@linaro.org>
13Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20230713132847.176000-1-abdellatif.elkhlifi@arm.com/]
14---
15 MAINTAINERS | 1 +
16 test/cmd/Makefile | 2 ++
17 test/cmd/armffa.c | 33 +++++++++++++++++++++++++++++++++
18 3 files changed, 36 insertions(+)
19 create mode 100644 test/cmd/armffa.c
20
21diff --git a/MAINTAINERS b/MAINTAINERS
22index ccd7859c88..885d91fe5c 100644
23--- a/MAINTAINERS
24+++ b/MAINTAINERS
25@@ -276,6 +276,7 @@ F: doc/arch/arm64.ffa.rst
26 F: doc/usage/cmd/armffa.rst
27 F: drivers/firmware/arm-ffa/
28 F: include/arm_ffa.h
29+F: test/cmd/armffa.c
30 F: test/dm/ffa.c
31
32 ARM FREESCALE IMX
33diff --git a/test/cmd/Makefile b/test/cmd/Makefile
34index 055adc65a2..1d1dbb4fbc 100644
35--- a/test/cmd/Makefile
36+++ b/test/cmd/Makefile
37@@ -1,6 +1,7 @@
38 # SPDX-License-Identifier: GPL-2.0+
39 #
40 # Copyright (c) 2013 Google, Inc
41+# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
42
43 ifdef CONFIG_HUSH_PARSER
44 obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
45@@ -23,6 +24,7 @@ obj-$(CONFIG_CMD_SEAMA) += seama.o
46 ifdef CONFIG_SANDBOX
47 obj-$(CONFIG_CMD_READ) += rw.o
48 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
49+obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
50 endif
51 obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
52 obj-$(CONFIG_CMD_WGET) += wget.o
53diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
54new file mode 100644
55index 0000000000..9a44a397e8
56--- /dev/null
57+++ b/test/cmd/armffa.c
58@@ -0,0 +1,33 @@
59+// SPDX-License-Identifier: GPL-2.0+
60+/*
61+ * Test for armffa command
62+ *
63+ * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
64+ *
65+ * Authors:
66+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
67+ */
68+
69+#include <common.h>
70+#include <string.h>
71+#include <asm/sandbox_arm_ffa.h>
72+#include <dm/test.h>
73+#include <test/test.h>
74+#include <test/ut.h>
75+
76+/* Basic test of 'armffa' command */
77+static int dm_test_armffa_cmd(struct unit_test_state *uts)
78+{
79+ /* armffa getpart <UUID> */
80+ ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
81+
82+ /* armffa ping <ID> */
83+ ut_assertok(run_commandf("armffa ping 0x%x", SANDBOX_SP1_ID));
84+
85+ /* armffa devlist */
86+ ut_assertok(run_command("armffa devlist", 0));
87+
88+ return 0;
89+}
90+
91+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);