Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 1 | From 5816c61212f9710a5c7310cd7c57cc349e852152 Mon Sep 17 00:00:00 2001 |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 2 | From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 3 | Date: Tue, 29 Nov 2022 14:48:34 +0000 |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 4 | Subject: [PATCH 08/27] arm_ffa: introduce armffa command Sandbox test |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 5 | |
| 6 | Add Sandbox test for the armffa command |
| 7 | |
| 8 | Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 9 | Cc: Tom Rini <trini@konsulko.com> |
| 10 | Cc: Simon Glass <sjg@chromium.org> |
| 11 | Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> |
| 12 | Cc: Jens Wiklander <jens.wiklander@linaro.org> |
| 13 | Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/] |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 14 | |
| 15 | Changelog: |
| 16 | =============== |
| 17 | |
| 18 | v4: drop use of helper APIs |
| 19 | |
| 20 | v1: introduce armffa command sandbox test |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 21 | Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 22 | --- |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 23 | MAINTAINERS | 1 + |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 24 | test/cmd/Makefile | 2 ++ |
| 25 | test/cmd/armffa.c | 39 +++++++++++++++++++++++++++++++++++++++ |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 26 | 3 files changed, 42 insertions(+) |
| 27 | create mode 100644 test/cmd/armffa.c |
| 28 | |
| 29 | diff --git a/MAINTAINERS b/MAINTAINERS |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 30 | index c1d3d4ae1c56..a2f60a3b93a6 100644 |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 31 | --- a/MAINTAINERS |
| 32 | +++ b/MAINTAINERS |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 33 | @@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 34 | 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 |
| 41 | diff --git a/test/cmd/Makefile b/test/cmd/Makefile |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 42 | index bc961df3dcee..21aa6d740ee8 100644 |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 43 | --- a/test/cmd/Makefile |
| 44 | +++ b/test/cmd/Makefile |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 45 | @@ -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 Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 53 | @@ -18,6 +19,7 @@ obj-$(CONFIG_CMD_PINMUX) += pinmux.o |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 54 | obj-$(CONFIG_CMD_PWM) += pwm.o |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 55 | ifdef CONFIG_SANDBOX |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 56 | obj-$(CONFIG_CMD_SETEXPR) += setexpr.o |
| 57 | +obj-$(CONFIG_SANDBOX_FFA) += armffa.o |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 58 | endif |
| 59 | obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o |
| 60 | obj-$(CONFIG_CMD_WGET) += wget.o |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 61 | diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c |
| 62 | new file mode 100644 |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 63 | index 000000000000..e04363ba63f9 |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 64 | --- /dev/null |
| 65 | +++ b/test/cmd/armffa.c |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 66 | @@ -0,0 +1,39 @@ |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 67 | +// 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 Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 76 | +#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 Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 89 | + ut_assertok(ffa_bus_discover(NULL)); |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 90 | + |
| 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 Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 107 | 2.39.1 |
Patrick Williams | 8dd6848 | 2022-10-04 07:57:18 -0500 | [diff] [blame] | 108 | |