From patchwork Wed Jul 26 08:38:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 706624 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp856711wrs; Wed, 26 Jul 2023 09:58:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlGC+Culut/ReOWToZsa34SYd26ONrT7w24hQtmmGifTR3KqeAzHz4JWfbi/JEMSzStsq179 X-Received: by 2002:a5d:69cd:0:b0:315:a91c:1a8c with SMTP id s13-20020a5d69cd000000b00315a91c1a8cmr1798207wrw.22.1690390727965; Wed, 26 Jul 2023 09:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690390727; cv=none; d=google.com; s=arc-20160816; b=Smc/yCZFu6Eoo7EQyUGgKtHEmosQi7PwoMiMDO+n/wrEZDLCen6nj1+ksHtCddP4uY mv5x3pixpCQyn3IO4yPX9xd8tzAx5oEm+rP62IoRtjeStu6fh53DABHihjOePmRXtKyh N05KtPlyeGNFoNDlZfsvl958XMTzvHGfkfwREjoXwl7mnOENatNvV6YJ4iw5VEIO9aQz uxG60bPpbw1nXFKjhh8IZcev8xPD4CidIiKQ3zaW4bykeRCz7qSWEpkXywPZtehN9mAh DDz2sVRKT22063zuHmUu26QeX2yFPvTAXxe01uwghKxF8PX1wMEy106zBtgkR5ofYkCW ajSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S8x8c2njyEx5FOioJ6WBtX+vxaUUVviXVYxPTYzppaM=; fh=m4nYqZzoK9SCykCyJ/rhitDYsGwNiXM0bHxVQp6NtlE=; b=vFPqLR1B2iOQSHJ+ecdNJLfyNDiWE0z+0zYFDVDb+ZmenbaND3Hbe/kyFzMf3sH0mf sRCFfk7Nn4CaUJ5Z8JcFK8X31tRVYfRaMfNDXpBdm7IkZSc2unWIpPfrdSH2Uslg8Xmy mxBGPKMZNsal658m0Oxlfvls5DWfNa8j5lGbleCzoFs7k3TODBFzSdPbBLTfMA2MY0fZ Kr6rq83lHVErLQlrZ4X5VfnmlZ3UrXsKUAJsxiE9YLbT/6uNjnXJ+Ct6LBy6/iRS5wRn y52f8MdDlqgah46ZI0lC2ysetg1aT0K9ewVLZsAFa4fla5bWrBtsrWiDUxHU4746a5+/ e44g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/gTE2EA"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l18-20020adfe592000000b003143496851fsi7441042wrm.1011.2023.07.26.09.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 09:58:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/gTE2EA"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C704D865B0; Wed, 26 Jul 2023 18:58:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="D/gTE2EA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F28658682A; Wed, 26 Jul 2023 18:58:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 63EBF8686F for ; Wed, 26 Jul 2023 18:58:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-682ae5d4184so15154b3a.1 for ; Wed, 26 Jul 2023 09:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690390682; x=1690995482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S8x8c2njyEx5FOioJ6WBtX+vxaUUVviXVYxPTYzppaM=; b=D/gTE2EABwnEKqe5u2PLz2L+vaCeyph8o5Da7LF5N/+/vNBoJL44SwCqMazOjJZA86 lhd+uGAkHz8UZvr9cm+I4W5Jl2XSeLhnyAgyVHgiEReUwHyr1JZD5gnEKDNq/znAFHBs VKZH7lX7TTAq4vMIqPuEVR3ueQ8oO092lKv11aK11SIihPB5PZdoHJtskVv5tV8UujWo VB8zkfVVeJqspKw873c+9tojcggmDRyDvvRf5Y2az3Bkv7a/WdiAugtS0pApg5n639Bw /s6qCRw+GzJjHlONd41C/pO+hUf7T7fccooIF0WxB13f1h16IOXSa6SUG1UuuFxIvrLv Vs0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690390682; x=1690995482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S8x8c2njyEx5FOioJ6WBtX+vxaUUVviXVYxPTYzppaM=; b=gsce5pWWTWEaIgmXih6umHhL3glJlYjINnQQn711CIjzXsX1TqRdmTQQ8+s145wdG9 oQEqG4vOhmiBzlBbW7gGx8hKb4SLeeAA3nGNi2zd9UYXs+i3VGACa0JyvMGiZ8GLuWHd 2ZmRHkoa93TbkZbuK/emKvm1NM5mmdB2CtCP4bV+01hxkOqYknJnETd6E+WNSNRHZdjB vjU7h4D3m+IJ4DP1Ev4qbdaYkl1PGwqxrvP9S+ENL86GVk7oyKZXGt8ZWRgjcrfJ50qW gSNZ0JEDFVIqLaRn8GU65clNfIUwL6rkFvw7NHcYxBMVb8A4W+ddb0FxLOrDeMeeHhql V0FQ== X-Gm-Message-State: ABy/qLZXZ36L4QbwWofp8FsBHVfATIY6XehfOGmksDvDxfzq4wehQDKo mm814WJn366fgyEAaaSqLiDs20+8glaaWrUAKm4= X-Received: by 2002:a17:90a:728e:b0:267:f33c:bce2 with SMTP id e14-20020a17090a728e00b00267f33cbce2mr1422611pjg.4.1690360819611; Wed, 26 Jul 2023 01:40:19 -0700 (PDT) Received: from laputa.. ([2400:4050:c3e1:100:b3f9:1d29:2d48:cb41]) by smtp.gmail.com with ESMTPSA id 16-20020a17090a191000b00263c6b44dd8sm865986pjg.15.2023.07.26.01.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 01:40:15 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org Cc: etienne.carriere@st.com, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v2 12/12] test: dm: add scmi command test Date: Wed, 26 Jul 2023 17:38:08 +0900 Message-ID: <20230726083808.140780-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230726083808.140780-1-takahiro.akashi@linaro.org> References: <20230726083808.140780-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean In this test, "scmi" command is tested against different sub-commands. Please note that scmi command is for debug purpose and is not intended in production system. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass Reviewed-by: Simon Glass Reviewed-by: Etienne Carriere --- v2 * use helper functions, removing direct uses of ops --- test/dm/scmi.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 41d46548f7fd..a3e61355088a 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -134,9 +134,9 @@ static int dm_test_scmi_base(struct unit_test_state *uts) ut_asserteq_str(priv->vendor, vendor); /* message attributes */ - ret = scmi_protocol_message_attrs(base, - SCMI_BASE_DISCOVER_SUB_VENDOR, - &attributes); + ret = scmi_base_protocol_message_attrs(base, + SCMI_BASE_DISCOVER_SUB_VENDOR, + &attributes); ut_assertok(ret); ut_assertok(attributes); @@ -204,6 +204,59 @@ static int dm_test_scmi_base(struct unit_test_state *uts) DM_TEST(dm_test_scmi_base, UT_TESTF_SCAN_FDT); +static int dm_test_scmi_cmd(struct unit_test_state *uts) +{ + struct udevice *agent_dev; + + /* preparation */ + ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi", + &agent_dev)); + ut_assertnonnull(agent_dev); + + /* scmi info */ + ut_assertok(run_command("scmi info", 0)); + + ut_assert_nextline("SCMI device: scmi"); + ut_assert_nextline(" protocol version: 0x20000"); + ut_assert_nextline(" # of agents: 2"); + ut_assert_nextline(" 0: platform"); + ut_assert_nextline(" > 1: OSPM"); + ut_assert_nextline(" # of protocols: 3"); + ut_assert_nextline(" Clock management"); + ut_assert_nextline(" Reset domain management"); + ut_assert_nextline(" Voltage domain management"); + ut_assert_nextline(" vendor: U-Boot"); + ut_assert_nextline(" sub vendor: Sandbox"); + ut_assert_nextline(" impl version: 0x1"); + + ut_assert_console_end(); + + /* scmi perm_dev */ + ut_assertok(run_command("scmi perm_dev 1 0 1", 0)); + ut_assert_console_end(); + + ut_assert(run_command("scmi perm_dev 1 0 0", 0)); + ut_assert_nextline("Denying access to device:0 failed (-13)"); + ut_assert_console_end(); + + /* scmi perm_proto */ + ut_assertok(run_command("scmi perm_proto 1 0 14 1", 0)); + ut_assert_console_end(); + + ut_assert(run_command("scmi perm_proto 1 0 14 0", 0)); + ut_assert_nextline("Denying access to protocol:0x14 on device:0 failed (-13)"); + ut_assert_console_end(); + + /* scmi reset */ + ut_assert(run_command("scmi reset 1 1", 0)); + ut_assert_nextline("Reset failed (-13)"); + ut_assert_console_end(); + + return 0; +} + +DM_TEST(dm_test_scmi_cmd, UT_TESTF_SCAN_FDT); + static int dm_test_scmi_clocks(struct unit_test_state *uts) { struct sandbox_scmi_agent *agent;