blob: fed806e6af5bc20227cca2694a20176d35053ec3 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From 5816c61212f9710a5c7310cd7c57cc349e852152 Mon Sep 17 00:00:00 2001
Patrick Williams8dd68482022-10-04 07:57:18 -05002From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Andrew Geisslerea144b032023-01-27 16:03:57 -06003Date: Tue, 29 Nov 2022 14:48:34 +0000
Patrick Williams864cc432023-02-09 14:54:44 -06004Subject: [PATCH 08/27] arm_ffa: introduce armffa command Sandbox test
Patrick Williams8dd68482022-10-04 07:57:18 -05005
6Add Sandbox test for the armffa command
7
8Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Andrew Geisslerea144b032023-01-27 16:03:57 -06009Cc: Tom Rini <trini@konsulko.com>
10Cc: Simon Glass <sjg@chromium.org>
11Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12Cc: Jens Wiklander <jens.wiklander@linaro.org>
13Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
Patrick Williams8dd68482022-10-04 07:57:18 -050014
15Changelog:
16===============
17
18v4: drop use of helper APIs
19
20v1: introduce armffa command sandbox test
Patrick Williams864cc432023-02-09 14:54:44 -060021Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Andrew Geisslerea144b032023-01-27 16:03:57 -060022---
Patrick Williams8dd68482022-10-04 07:57:18 -050023 MAINTAINERS | 1 +
Andrew Geisslerea144b032023-01-27 16:03:57 -060024 test/cmd/Makefile | 2 ++
25 test/cmd/armffa.c | 39 +++++++++++++++++++++++++++++++++++++++
Patrick Williams8dd68482022-10-04 07:57:18 -050026 3 files changed, 42 insertions(+)
27 create mode 100644 test/cmd/armffa.c
28
29diff --git a/MAINTAINERS b/MAINTAINERS
Patrick Williams864cc432023-02-09 14:54:44 -060030index c1d3d4ae1c56..a2f60a3b93a6 100644
Patrick Williams8dd68482022-10-04 07:57:18 -050031--- a/MAINTAINERS
32+++ b/MAINTAINERS
Patrick Williams864cc432023-02-09 14:54:44 -060033@@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst
Patrick Williams8dd68482022-10-04 07:57:18 -050034 F: drivers/firmware/arm-ffa/
35 F: include/arm_ffa.h
36 F: include/sandbox_arm_ffa.h
37+F: test/cmd/armffa.c
38 F: test/dm/ffa.c
39
40 ARM FREESCALE IMX
41diff --git a/test/cmd/Makefile b/test/cmd/Makefile
Patrick Williams864cc432023-02-09 14:54:44 -060042index bc961df3dcee..21aa6d740ee8 100644
Patrick Williams8dd68482022-10-04 07:57:18 -050043--- a/test/cmd/Makefile
44+++ b/test/cmd/Makefile
Andrew Geisslerea144b032023-01-27 16:03:57 -060045@@ -1,6 +1,7 @@
46 # SPDX-License-Identifier: GPL-2.0+
47 #
48 # Copyright (c) 2013 Google, Inc
49+# (C) Copyright 2022 ARM Limited
50
51 ifdef CONFIG_HUSH_PARSER
52 obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
Patrick Williams864cc432023-02-09 14:54:44 -060053@@ -18,6 +19,7 @@ obj-$(CONFIG_CMD_PINMUX) += pinmux.o
Patrick Williams8dd68482022-10-04 07:57:18 -050054 obj-$(CONFIG_CMD_PWM) += pwm.o
Patrick Williams864cc432023-02-09 14:54:44 -060055 ifdef CONFIG_SANDBOX
Patrick Williams8dd68482022-10-04 07:57:18 -050056 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
57+obj-$(CONFIG_SANDBOX_FFA) += armffa.o
Patrick Williams864cc432023-02-09 14:54:44 -060058 endif
59 obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
60 obj-$(CONFIG_CMD_WGET) += wget.o
Patrick Williams8dd68482022-10-04 07:57:18 -050061diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
62new file mode 100644
Patrick Williams864cc432023-02-09 14:54:44 -060063index 000000000000..e04363ba63f9
Patrick Williams8dd68482022-10-04 07:57:18 -050064--- /dev/null
65+++ b/test/cmd/armffa.c
Andrew Geisslerea144b032023-01-27 16:03:57 -060066@@ -0,0 +1,39 @@
Patrick Williams8dd68482022-10-04 07:57:18 -050067+// SPDX-License-Identifier: GPL-2.0+
68+/*
69+ * Test for armffa command
70+ *
71+ * (C) Copyright 2022 ARM Limited
72+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
73+ */
74+
75+#include <common.h>
Patrick Williams8dd68482022-10-04 07:57:18 -050076+#include <dm/test.h>
77+#include <sandbox_arm_ffa.h>
78+#include <string.h>
79+#include <test/test.h>
80+#include <test/ut.h>
81+
82+#define PING_CMD_SIZE 19
83+
84+/* Basic test of 'armffa' command */
85+static int dm_test_armffa_cmd(struct unit_test_state *uts)
86+{
87+ char ping_cmd[PING_CMD_SIZE] = {0};
88+
Andrew Geisslerea144b032023-01-27 16:03:57 -060089+ ut_assertok(ffa_bus_discover(NULL));
Patrick Williams8dd68482022-10-04 07:57:18 -050090+
91+ /* armffa getpart <UUID> */
92+ ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
93+
94+ snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
95+
96+ /* armffa ping <ID> */
97+ ut_assertok(run_command(ping_cmd, 0));
98+
99+ /* armffa devlist */
100+ ut_assertok(run_command("armffa devlist", 0));
101+
102+ return CMD_RET_SUCCESS;
103+}
104+
105+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
106--
Patrick Williams864cc432023-02-09 14:54:44 -06001072.39.1
Patrick Williams8dd68482022-10-04 07:57:18 -0500108