From patchwork Thu Jan 25 14:05:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weizhao Ouyang X-Patchwork-Id: 1890842 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=WQEtnEEb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLMzy0Grmz23f0 for ; Fri, 26 Jan 2024 01:05:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FD7487559; Thu, 25 Jan 2024 15:05:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="WQEtnEEb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 93672876FF; Thu, 25 Jan 2024 15:05:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 7461787447 for ; Thu, 25 Jan 2024 15:05:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=o451686892@gmail.com Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d751bc0c15so41334635ad.2 for ; Thu, 25 Jan 2024 06:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706191536; x=1706796336; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JJRrfJa0Or+UJAFVxi6i/FIkYVEA7m44U3O+kQ18FQI=; b=WQEtnEEb6lBDQjIJhyxJvbR/Sw2LKLZ3PJ4RKrUqE3E/w7t7WevyesV/xDpGKWzIMl wQr4IPsRHXN4gFduOsxeFpy/KSvL2a8T3LYiIzuP3udQK05MX4+3+UyNHgbrlT/df/Sx ppUqwWbgBrLCoxMfhaidwh8r4zfKedWZfe+957njTiezW9nNxTU9uGtvNBpOD/nOL2BT ttLbYzHsYSJtM6f+e7pXIjFioHDqcLRPGCEDnSAg82XdytzCPoHUDX9T8j3xg+Snxjsf xWZ+BrO9PuwSGBu9PWvaqRT9diuiwTDhyLeXCxq+jeCP97E/JQ77NqiN2UHB2kvdu3lw Xehw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706191536; x=1706796336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJRrfJa0Or+UJAFVxi6i/FIkYVEA7m44U3O+kQ18FQI=; b=PZyQBbbOQnMrR1lxjIlnM0BEATcMtGBdi3JKj4i7Ajkt0N3lUaWLHmy5Nz6voo2owi bFUP2VwWUDi1G5v+e3lOLCEZmSsreWoX4NsDv4KM2pT5d69sU33yOkpKkzwzb/FpLhmG 8YtdPSVoX+cPI9l8jEgURW0fQuhJE8SsPmLus/AFj335bb3vbQwSIqsT1x8L5mUNIxzP bsK0E2Q0pmJ33yG6rNIia1GrKHURGTaiQwJEdvSvfr+bP3gq+I7hUluybNQorkaz9isd 7Ea8boBS19prPwoBC9TlPKu5AdLkhDqoT7Max2LRYcWLQMNmeIxUSe4Rwx15pL5p5EIb E28w== X-Gm-Message-State: AOJu0YxyBCSput7TCdoKIbgrQGEjuO8thRBG/9PsTHYRzIFbteo4RFlb ThZ7eehEBQFvq/MTDDXnoo7qtxGXNxekTsnIU4Zb6LyAnfNQ2sAL X-Google-Smtp-Source: AGHT+IFaUtKiV8Hn4YoeOYNikMqYqFfJVzOc0tAmnxgUg21kW8GWsNVoQfOQ+Fjb3B5l26kMD8W8Dw== X-Received: by 2002:a17:902:724b:b0:1d7:9290:8e32 with SMTP id c11-20020a170902724b00b001d792908e32mr1066849pll.86.1706191535155; Thu, 25 Jan 2024 06:05:35 -0800 (PST) Received: from ownia.localdomain ([8.210.91.195]) by smtp.gmail.com with ESMTPSA id p18-20020a170902ead200b001d705836d0dsm11925699pld.200.2024.01.25.06.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:05:34 -0800 (PST) From: Weizhao Ouyang To: Sughosh Ganu , Heinrich Schuchardt , Tom Rini , Etienne Carriere , Weizhao Ouyang , Simon Glass , Peng Fan , Ilias Apalodimas , Jens Wiklander , Abdellatif El Khlifi , u-boot@lists.denx.de Subject: [PATCH 1/3] firmware: psci: Fix bind_smccc_features psci check Date: Thu, 25 Jan 2024 14:05:00 +0000 Message-Id: <20240125140502.22400-2-o451686892@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125140502.22400-1-o451686892@gmail.com> References: <20240125140502.22400-1-o451686892@gmail.com> 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 According to PSCI specification DEN0022F, PSCI_FEATURES is used to check whether the SMCCC is implemented by discovering SMCCC_VERSION. Signed-off-by: Weizhao Ouyang Acked-by: Heinrich Schuchardt --- drivers/firmware/psci.c | 2 +- include/linux/arm-smccc.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index c6b9efab41..894be8128d 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -135,7 +135,7 @@ static int bind_smccc_features(struct udevice *dev, int psci_method) PSCI_VERSION_MAJOR(psci_0_2_get_version()) == 0) return 0; - if (request_psci_features(ARM_SMCCC_ARCH_FEATURES) == + if (request_psci_features(ARM_SMCCC_VERSION) == PSCI_RET_NOT_SUPPORTED) return 0; diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index f44e9e8f93..453017eb5f 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -55,6 +55,7 @@ #define ARM_SMCCC_QUIRK_NONE 0 #define ARM_SMCCC_QUIRK_QCOM_A6 1 /* Save/restore register a6 */ +#define ARM_SMCCC_VERSION 0x80000000 #define ARM_SMCCC_ARCH_FEATURES 0x80000001 #define ARM_SMCCC_RET_NOT_SUPPORTED ((unsigned long)-1) From patchwork Thu Jan 25 14:05:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weizhao Ouyang X-Patchwork-Id: 1890843 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lMajJreQ; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLN0856Xzz23f0 for ; Fri, 26 Jan 2024 01:06:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF8488799C; Thu, 25 Jan 2024 15:05:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="lMajJreQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 307EF8799C; Thu, 25 Jan 2024 15:05:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (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 128BF877BC for ; Thu, 25 Jan 2024 15:05:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=o451686892@gmail.com Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d71207524dso29393405ad.1 for ; Thu, 25 Jan 2024 06:05:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706191539; x=1706796339; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=O2ngYXwY+cKFGpNDkR+ROk1lRTC9/m7Kj3St2IuESVI=; b=lMajJreQacs7TiLvEAwObMcDiaThNnmUhHT6UgTL8hyGMbypZPjDlraM1P986sBT0A UDSE2rvucdjJuyjTPf18iBcxL8Ah1FWFh8DHENL/81C3LTxdEgtw7UV4bwf4qMKZtuyh fqwVce8FQWQNRLyPhcEErduANE+0F0L92Ycai27fCf1qZqk6aF6Atv0IQQsAECWlnugN P6TxScwSLvWGk1LyGzjqHtnzIiSXL5VRABmF1Bw5WQ8FffPMOl5KBXBcic1nammdKEqr ncZlNabkZT2cfTOrU9WB1i3GMeEVdKzAWFsbJMHAJApRpht7CAv22NIb8nfNVUrMXVgi ZKGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706191539; x=1706796339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O2ngYXwY+cKFGpNDkR+ROk1lRTC9/m7Kj3St2IuESVI=; b=CcuBYl7/GRppX5fHBzGX18InXaNS2XuQz2Xm2WY35WyzYNTSx/W8IpkZ4YJ1+YE6vD oPEIhy7rq/EF1gmzAIWJaWHaHo3tWFE95EXPSnLia6lqXmfUjzCVM/441IRlGl5cN/o7 75Uxmh1I6F7WDcTC4O+sUTGQua2cIo0hSPYXn4zd1RbcEMXq5CmBEbLH8fFEKCJuQi/v CX2Ix3X3jxqXFOpw2HbH3ht/u36YlUpqs+gyMX7dXjPJtIEnj/zTRYfWDzm6mTOGU14a 1cM+nlfsQBA5u4gOJ+WUSDW+96rmNSG0Hc0MeW+gBmJVt9fK3NeHkz4gw33iaDz0NeOo lTtQ== X-Gm-Message-State: AOJu0YzKzjV4W+HAk3wSCNh6S3OjiLtW2TIh+YNDilLbUsi2HzQdX4wy qcNFPAab5AoVjDKxDLTiy9znQ3QKDvWVEl+bBpBVVswJRuNo988K X-Google-Smtp-Source: AGHT+IHsbr7CoOItIr+LEdK8VkABYPgypFXwrUJCRQxsz1nzKeTtJAUuXi41oHnUTa3pZqCm8ED6mw== X-Received: by 2002:a17:902:fc8d:b0:1d7:1e5d:ab39 with SMTP id mf13-20020a170902fc8d00b001d71e5dab39mr1064455plb.80.1706191538791; Thu, 25 Jan 2024 06:05:38 -0800 (PST) Received: from ownia.localdomain ([8.210.91.195]) by smtp.gmail.com with ESMTPSA id p18-20020a170902ead200b001d705836d0dsm11925699pld.200.2024.01.25.06.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:05:37 -0800 (PST) From: Weizhao Ouyang To: Sughosh Ganu , Heinrich Schuchardt , Tom Rini , Etienne Carriere , Weizhao Ouyang , Simon Glass , Peng Fan , Ilias Apalodimas , Jens Wiklander , Abdellatif El Khlifi , u-boot@lists.denx.de Subject: [PATCH 2/3] driver: rng: Fix SMCCC TRNG crash Date: Thu, 25 Jan 2024 14:05:01 +0000 Message-Id: <20240125140502.22400-3-o451686892@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125140502.22400-1-o451686892@gmail.com> References: <20240125140502.22400-1-o451686892@gmail.com> 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 Fix a SMCCC TRNG null pointer crash due to a failed smccc feature binding. Signed-off-by: Weizhao Ouyang Reviewed-by: Heinrich Schuchardt Reviewed-by: Heinrich Schuchardt --- drivers/rng/smccc_trng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rng/smccc_trng.c b/drivers/rng/smccc_trng.c index 3a4bb33941..3087cb991a 100644 --- a/drivers/rng/smccc_trng.c +++ b/drivers/rng/smccc_trng.c @@ -166,7 +166,7 @@ static int smccc_trng_probe(struct udevice *dev) struct smccc_trng_priv *priv = dev_get_priv(dev); struct arm_smccc_res res; - if (!(smccc_trng_is_supported(smccc->invoke_fn))) + if (!smccc || !(smccc_trng_is_supported(smccc->invoke_fn))) return -ENODEV; /* At least one of 64bit and 32bit interfaces is available */ From patchwork Thu Jan 25 14:05:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weizhao Ouyang X-Patchwork-Id: 1890844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Ti2f4SBx; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLN0M2wzHz23f0 for ; Fri, 26 Jan 2024 01:06:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7CA4687887; Thu, 25 Jan 2024 15:05:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="Ti2f4SBx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FDED87866; Thu, 25 Jan 2024 15:05:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 58C6D8786C for ; Thu, 25 Jan 2024 15:05:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=o451686892@gmail.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1d71e1d7c78so41334015ad.3 for ; Thu, 25 Jan 2024 06:05:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706191542; x=1706796342; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9QfwjjOjTYSvR4bsSBfYeLV+M7GwON/WlQUjHkqYUeI=; b=Ti2f4SBxtxHKUj2OIGXjRHOKxhFwpRA5KkAIIzUqv7G8F+ejpqHsTRbblslXDcSNpQ glSF+Irx9oBO9TU87grK+IuKzi0rk/pe6yRRniSFfcueCN72pQZYsZ/O9IOkxDpnFSuR kuUVAD2BpAx8z1FtNUgMGzAdzF7ltVWYiXFqQYO3eWSfeG8aT08GzEYgrh3DAVOPSQgi QTI2xiYTYUGwFNxG6y5QvFNulfGcQV/wiKBjoloelAeGLFOTD/C4hcIhKw3MmXVYjw8v 1jEu2LTxrdYk6Iu0oy44qrg3ag4PBiLDfOE2gI8AjC/25khqw6FjPtEh30DN66lUogtf +TOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706191542; x=1706796342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9QfwjjOjTYSvR4bsSBfYeLV+M7GwON/WlQUjHkqYUeI=; b=lWy8v6KnzQbMsFvOyUNyQgzYYrTFkcIp+b8hjP0R3AF0KgdG72raPtea32CuF0aKZy OIwS5n9rAb8R2t1as/vwMijRLJW9/X2WQCPj//XWX5M19FvLZBl6qi8zeuXj739Zjo5m 4iI3GLnukQY2/hCqZE+lPuIHMPR1fAuPAtXdZ7GTqs+Ayk1w1Tji2M+MY8gieO7vr768 /BAb70SKTDsBFRqQPxeR84X7ogQMn7P3XpwvPpZuuVCvJpqEGJExqhQXDmoFLreM3TU0 5W9+uBjfpCuJp2tt/0+HBV3M+a3yMq24uBQfkfH5xtbb6Wi39QUBNL9gWsUh8JQh4NYw /GVA== X-Gm-Message-State: AOJu0Yy6B0Hxb5+80kXISA56EplpHCmPpzyCFAyak99dDCy6Z8O70d3X /KeCmkwBACP1BQaJWk/c46kyjVyxPUNTNErYn5X2sCRn4Z2e+cHlGNPiWdwk/w8= X-Google-Smtp-Source: AGHT+IFN+oiAP8lCibcu2IxCg1JTbA4m59tlrFfhOhG/fqzQRRcEp+wkwHgkYGfNPqnQuQAUnhtjkA== X-Received: by 2002:a17:902:d905:b0:1d7:27a0:127b with SMTP id c5-20020a170902d90500b001d727a0127bmr882523plz.19.1706191541869; Thu, 25 Jan 2024 06:05:41 -0800 (PST) Received: from ownia.localdomain ([8.210.91.195]) by smtp.gmail.com with ESMTPSA id p18-20020a170902ead200b001d705836d0dsm11925699pld.200.2024.01.25.06.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:05:41 -0800 (PST) From: Weizhao Ouyang To: Sughosh Ganu , Heinrich Schuchardt , Tom Rini , Etienne Carriere , Weizhao Ouyang , Simon Glass , Peng Fan , Ilias Apalodimas , Jens Wiklander , Abdellatif El Khlifi , u-boot@lists.denx.de Subject: [PATCH 3/3] cmd: rng: Add rng list command Date: Thu, 25 Jan 2024 14:05:02 +0000 Message-Id: <20240125140502.22400-4-o451686892@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125140502.22400-1-o451686892@gmail.com> References: <20240125140502.22400-1-o451686892@gmail.com> 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 Add rng list command to list all probed RNG device. Signed-off-by: Weizhao Ouyang --- cmd/rng.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/rng.c b/cmd/rng.c index 52f722c7af..4818133f94 100644 --- a/cmd/rng.c +++ b/cmd/rng.c @@ -18,6 +18,19 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int devnum; struct udevice *dev; int ret = CMD_RET_SUCCESS; + int idx; + + if (argc == 2 && !strcmp(argv[1], "list")) { + uclass_foreach_dev_probe(UCLASS_RNG, dev) { + printf("RNG #%d - %s\n", dev->seq_, dev->name); + } + + if (!idx) { + printf("*** no RNG devices available ***\n"); + return CMD_RET_FAILURE; + } + return CMD_RET_SUCCESS; + } switch (argc) { case 1: @@ -57,6 +70,8 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } U_BOOT_LONGHELP(rng, + "[list]\n" + " - list all the probe rng device\n" "[dev [n]]\n" " - print n random bytes(max 64) read from dev\n");