From patchwork Wed Jun 28 00:48:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1800832 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=neDlYxKC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrNLx5YM4z20bH for ; Wed, 28 Jun 2023 10:51:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0736E8662D; Wed, 28 Jun 2023 02:51:10 +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="neDlYxKC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A004186615; Wed, 28 Jun 2023 02:50:20 +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-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (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 959CE8660E for ; Wed, 28 Jun 2023 02:49:53 +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-pl1-x62c.google.com with SMTP id d9443c01a7336-1b816d30140so3336075ad.0 for ; Tue, 27 Jun 2023 17:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687913391; x=1690505391; 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=UNec+yYqM/9p8g33e1zRr4zBUrhLWSTWYQhFZ4LteI4=; b=neDlYxKCuRK6RNRI3gAz5sP1GBbDzUp25kUPEeSwV4pH8K+vhDHuVzFoSR4AotA+w/ PK/HimR/DTpmfVyB2wvnpF3xxKEQkHcT2yQU0H4N6cyKPZh9PGkkL9hfnVRy5BT3l1U7 yKJHUrc1kuYU4UTjbhbFmtvlZYZ1/TZbi4lysrokYuY62G28+18u5g8MIPEWzK+/fF7c EoV0plerrz1oeuWb7y7bOxVDuXjtzjC+S05aPgTE22YJoljdph1wljvKREnUVOlaEKdY ZJXF9Ahx2EvNmjunmLY9NnYLd8BkzZaDQ0JHcGsCicYcKWmNsTHiJ7F7AUfmes5HlmFs VBAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687913391; x=1690505391; 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=UNec+yYqM/9p8g33e1zRr4zBUrhLWSTWYQhFZ4LteI4=; b=X/DhxbhqvqlHy2lFdeZ938gbI3Gam86Re21aDB2ub7j6ITEUh7k0ovGZDI+5VGfuuD kcb+XscXWDH1OmvTxPOF98jcwrjBEb5/CnWewFkXOBqjMNvD3D1aua/9yrPqZIXU6vMS LR/PG6GoH2/ZxoVZLZH4mI3kdCJh8VH1ieqcqu8riFWL0JjK1L/ths6OuLDFvwQoY7kh O4t0IURU7vE7uAim99jruWtwuWmamDYhWnAqgbUWF35fuI2W7SzGf34RTX+7J4xj0VJN ZN3iRwp4Ip612nsCVgpzWl/b1miEEzul8GybGT5FR1t7hWXe/bde1m/LLvhY6qKz6LvX c6eg== X-Gm-Message-State: AC+VfDyGRRNcoUopFq3bSoKakaBZ8Z6mAf5W+Zw3icvl/v616b2SmT+H CCxV2267t9VkqBIjIfbL+86fCw== X-Google-Smtp-Source: ACHHUZ7XeWerG/rodVpWo5KFBCaYsnLIwHXiwZhWPoVVh+sHwU7k9I4xovIoNr4c3sbNbvxVLVoFoQ== X-Received: by 2002:a17:902:f691:b0:1af:adc2:ab5b with SMTP id l17-20020a170902f69100b001afadc2ab5bmr40801291plg.0.1687913391557; Tue, 27 Jun 2023 17:49:51 -0700 (PDT) Received: from laputa.. ([2400:4050:c3e1:100:58b2:60ed:38ea:8b1f]) by smtp.gmail.com with ESMTPSA id u13-20020a170903124d00b001b3fb2f0296sm6517278plh.120.2023.06.27.17.49.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 17:49:51 -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 10/10] test: dm: add scmi command test Date: Wed, 28 Jun 2023 09:48:41 +0900 Message-ID: <20230628004841.21774-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628004841.21774-1-takahiro.akashi@linaro.org> References: <20230628004841.21774-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" with different sub-commands is tested. 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 --- test/dm/scmi.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 563017bb63e0..b40c84011295 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -207,6 +207,63 @@ 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, *base; + struct scmi_agent_priv *priv; + + /* preparation */ + ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi", + &agent_dev)); + ut_assertnonnull(agent_dev); + ut_assertnonnull(priv = dev_get_uclass_plat(agent_dev)); + ut_assertnonnull(base = scmi_get_protocol(agent_dev, + SCMI_PROTOCOL_ID_BASE)); + + /* scmi base info */ + ut_assertok(run_command("scmi base 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 base perm_dev */ + ut_assertok(run_command("scmi base perm_dev 1 0 1", 0)); + ut_assert_console_end(); + + ut_assert(run_command("scmi base perm_dev 1 0 0", 0)); + ut_assert_nextline("Denying access to device:0 failed (-13)"); + ut_assert_console_end(); + + /* scmi base perm_proto */ + ut_assertok(run_command("scmi base perm_proto 1 0 14 1", 0)); + ut_assert_console_end(); + + ut_assert(run_command("scmi base 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 base reset */ + ut_assert(run_command("scmi base 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;