From patchwork Thu Nov 11 04:06:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553757 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=jXTnFZ+e; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=FD5V3IiV; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSpn0dkMz9s1l for ; Thu, 11 Nov 2021 15:07:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 56D1583742; Thu, 11 Nov 2021 05:06:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="jXTnFZ+e"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="FD5V3IiV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 193BE835A8; Thu, 11 Nov 2021 05:06:52 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E0D64835A8 for ; Thu, 11 Nov 2021 05:06:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 158AA5C0218; Wed, 10 Nov 2021 23:06:48 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 10 Nov 2021 23:06:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ZmiWFA1moMbr0 g7kM5XBaQxDudAkkZxt5GyKKyh5zg8=; b=jXTnFZ+eLNtWt4tWOOsw0E3Vs2Xn+ KWRNx5yLi4BfwyUSsu9IBsleBsD6kGLFX7xDlhfLwmzBIapIaMM5erD8/H3T962O sG60N3p19L8v7jiznzigJ+n6WFOIj+XpXv2lnBkVJisdyDsMjqASFsP90XsIjZil SposNxr2/Zu3WH943rsw3CSzafZ5vAMzx2rABv2eC5VU+20gMiX9+taFVjQ7vfSj V+cshPqGCil18r3F1S2hbtDu55Mv+/4UJqnvxEc/ui17WARm0G5sZH5UEyw7/0FZ gTcL6SzN/kJTAG3QqOhrhtAwYRrSDT1JnV1dXeO+7NpjuphFAHsKwGvYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ZmiWFA1moMbr0g7kM5XBaQxDudAkkZxt5GyKKyh5zg8=; b=FD5V3IiV nH3qrBF722EGThpsTi7idFs/3yLcqpMtMinhVU8v46E04YnK5kzkMZZZ4SEmi8c8 98p2JqoDmKPRJf/rLrQLaZZospNxXrLPgNZJpXAXh96kg0zMtEBRHsIWlr+yPbXd 0QUgJTmfuvp2Adk7ffEOFieBK5ond9Qkz+tXv/jCBndtod+QL8qW6jIErhoKLUMB yCyKEucj/+uC7yw8/g0N4sAR0iLwNy0aBC9PoStKERz0VK87ZzSiHdISvMm+QgAP YGrIiBROTNplVPwPzg2HMhPwZ2NrOl81A/c0AFoFkfFvFVbFIzUqz65cSCvm6GjS HD6ZD3tTfdUD7g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:45 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 1/6] cmd: tpm-v1: fix compile error in TPMv1 list resources command Date: Thu, 11 Nov 2021 04:06:26 +0000 Message-Id: <20211111040631.21262-2-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean This command is not compiled by default and was not updated to pass the udevice to tpm_get_capability. Signed-off-by: Mathew McBride Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- cmd/tpm-v1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c index 3a7e35d525..55f2aeff46 100644 --- a/cmd/tpm-v1.c +++ b/cmd/tpm-v1.c @@ -582,6 +582,7 @@ static int do_tpm_flush(struct cmd_tbl *cmdtp, int flag, int argc, static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + struct udevice *dev; int type = 0; u16 res_count; u8 buf[288]; @@ -589,6 +590,10 @@ static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc, int err; uint i; + err = get_tpm(&dev); + if (err) + return err; + if (argc != 2) return CMD_RET_USAGE; @@ -619,7 +624,7 @@ static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc, } /* fetch list of already loaded resources in the TPM */ - err = tpm_get_capability(TPM_CAP_HANDLE, type, buf, + err = tpm_get_capability(dev, TPM_CAP_HANDLE, type, buf, sizeof(buf)); if (err) { printf("tpm_get_capability returned error %d.\n", err); From patchwork Thu Nov 11 04:06:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553759 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=CVtlhXNr; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Q634POEk; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSq83S7hz9s1l for ; Thu, 11 Nov 2021 15:07:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DB9B98373E; Thu, 11 Nov 2021 05:07:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="CVtlhXNr"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Q634POEk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3E218372E; Thu, 11 Nov 2021 05:06:55 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2D8928372E for ; Thu, 11 Nov 2021 05:06:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5D0C05C0217; Wed, 10 Nov 2021 23:06:50 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 10 Nov 2021 23:06:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=StheaqQp2nvv6 MyeoZ4T6g1xP7fgCPmOAPEGBEXZ7p8=; b=CVtlhXNrjmZlaboJVOTbyXq1+VyCn QJZOfwFSJ/sp4Qaas0+tklLAPm18qZSQ59ASmHxyIESOexZs29rZEUf/MZr8VyWW LSEczCQFf3RH/gnz1VQJCLyQaKlZVWGb1otLb/yDQLWa7MAsAx0CpGuBFgoC++Dd XoIarKCPZPDNalfwXafhcKS7ns3x/4Zgy1Cx3chmBGRtH8KTxC9hIMgRp7k2iSix fJwYdisIJcfyZbsAkHI/z9Jwxb+5UB085eo5Iq2pHN3okkREe+2cTi7bQLF4lieu pFYQqQtgQ0YGFjJc5nsHqhp9IQ0kw/D8UfR1LdlI/5M59UmvdT0D1NYsA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=StheaqQp2nvv6MyeoZ4T6g1xP7fgCPmOAPEGBEXZ7p8=; b=Q634POEk l0qzx+PFhV2B+da2aPq9tvLgDpTGJbMbNHHx/EhDE5gSjJT2rWFDhRDr0bMVG8CV n3wvuQ083GrZwBRwTLx/w/PeCjbGHOMgHw6gSKbS4Bmsze68u7erq/o0CRzm0m9W 0cLATEfn+ah3VGulSr1V08DaRLJaOCK1ydn6WVsp+c/w6HfLVSvXSFyCDYjxveXo QcIzxPbumIFqlqwAT34yPF35b2gW8gV+C5s9EBnehwBoRfd4OLVeCZAOBf89N5ZK GFGXtVXczbPzvBSNJl1KutU0Rih/3x2Md9TGtoTLRUATmEyfKehtFnz8uFcXkx89 RCrSTn/ODSi7LA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:48 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 2/6] cmd: tpm-v1: fix load_key_by_sha1 compile errors Date: Thu, 11 Nov 2021 04:06:27 +0000 Message-Id: <20211111040631.21262-3-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean This command is not compiled by default and has not been updated alongside changes to the tpmv1 API, such as passing the TPM udevice to the relevant functions. Signed-off-by: Mathew McBride Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- cmd/tpm-v1.c | 10 +++++----- lib/tpm-v1.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c index 55f2aeff46..bf238a9f2e 100644 --- a/cmd/tpm-v1.c +++ b/cmd/tpm-v1.c @@ -406,9 +406,9 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc, void *key; struct udevice *dev; - rc = get_tpm(&dev); - if (rc) - return rc; + err = get_tpm(&dev); + if (err) + return err; if (argc < 5) return CMD_RET_USAGE; @@ -420,7 +420,7 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; parse_byte_string(argv[4], usage_auth, NULL); - err = tpm_find_key_sha1(usage_auth, parent_hash, &parent_handle); + err = tpm1_find_key_sha1(dev, usage_auth, parent_hash, &parent_handle); if (err) { printf("Could not find matching parent key (err = %d)\n", err); return CMD_RET_FAILURE; @@ -428,7 +428,7 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc, printf("Found parent key %08x\n", parent_handle); - err = tpm_load_key2_oiap(parent_handle, key, key_len, usage_auth, + err = tpm1_load_key2_oiap(dev, parent_handle, key, key_len, usage_auth, &key_handle); if (!err) { printf("Key handle is 0x%x\n", key_handle); diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c index 8dc144080c..22a769c587 100644 --- a/lib/tpm-v1.c +++ b/lib/tpm-v1.c @@ -840,7 +840,7 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20], unsigned int i; /* fetch list of already loaded keys in the TPM */ - err = tpm_get_capability(dev, TPM_CAP_HANDLE, TPM_RT_KEY, buf, + err = tpm1_get_capability(dev, TPM_CAP_HANDLE, TPM_RT_KEY, buf, sizeof(buf)); if (err) return -1; @@ -852,7 +852,7 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20], /* now search a(/ the) key which we can access with the given auth */ for (i = 0; i < key_count; ++i) { buf_len = sizeof(buf); - err = tpm_get_pub_key_oiap(key_handles[i], auth, buf, &buf_len); + err = tpm1_get_pub_key_oiap(dev, key_handles[i], auth, buf, &buf_len); if (err && err != TPM_AUTHFAIL) return -1; if (err) From patchwork Thu Nov 11 04:06:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553758 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=gLmHEUUF; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=cDdI+ePC; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSpy1r5sz9s1l for ; Thu, 11 Nov 2021 15:07:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8B5418398C; Thu, 11 Nov 2021 05:07:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="gLmHEUUF"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="cDdI+ePC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E7BA835A8; Thu, 11 Nov 2021 05:06:57 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 59B39835A8 for ; Thu, 11 Nov 2021 05:06:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 937C35C0227; Wed, 10 Nov 2021 23:06:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 10 Nov 2021 23:06:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=DSVE/1jt5gc4K comdsJtOvubn5vsBrfr82+Tsvp5X/s=; b=gLmHEUUFyFEWVuUXpGzZxt3yPske8 GiQTjnrt6iVOckvTVLSN4INER/nh0iWMVCVQLFAXbN6tGP7EkSoIXVtEded+UdS3 8OZEwRjw5bisUu7gVQSH5xkOyDFnn9iYQZX2cluhNn9iWICBL/plEkEEkIMl+S9Q OEAb6VJFKuuIQ38lLwz6JzwbXEj3BYO1U7eKPCyvoP1SxFT7O1qqSC86Ns7rcPoH jdQ0sY3JaVKndJ+OtBSLEfKCeicAe/5CkRm/tHgUPs7jLObG05AMDIe12A9Gl4vD 8mp2FWkKMkEz0YSEvdbfWybSnqSezN36vrMpX0kJ7jCTiv6gStUhIHLjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=DSVE/1jt5gc4KcomdsJtOvubn5vsBrfr82+Tsvp5X/s=; b=cDdI+ePC 5sBkWXEUQ63uJ/9kWH1Bf3c3NBimLypuy6BxkCQO5Gx1H/L8qlIAHHagqosSzSJY vpI8C0CCHZuEKqYSbq4OZWnOhcUfvXerwdqZnrVWkmiKgq2/2AyMzoBN6xg+r3bh YbTjBQEOG8u+/GT2kVPuc+7l/qM0LqzmlTsGw/MT8JL4lVbB1QjMJZbT9lZY/xwt kneakDDJ07ztdj4700D6ccrccIWPd0CJiDcHc/umrCH0EpgfY7h+Uer7x1mu1/tk POyAFUVnln0QZQagVsG3EUQgHRa7rv2lLB7wz+Pp19YQGM5Zx96ckclbeRGFCARE 2o1B2sdmKprOhA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:50 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 3/6] drivers: tpm: atmel_twi: drop non-DM_I2C compatibility Date: Thu, 11 Nov 2021 04:06:28 +0000 Message-Id: <20211111040631.21262-4-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean There are no users of this driver without DM_I2C Signed-off-by: Mathew McBride Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- drivers/tpm/tpm_atmel_twi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c index 2dcc2af67f..4ff4cf4cd4 100644 --- a/drivers/tpm/tpm_atmel_twi.c +++ b/drivers/tpm/tpm_atmel_twi.c @@ -81,22 +81,15 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, print_buffer(0, (void *)sendbuf, 1, send_size, 0); #endif -#if !CONFIG_IS_ENABLED(DM_I2C) - res = i2c_write(0x29, 0, 0, (uchar *)sendbuf, send_size); -#else res = dm_i2c_write(dev, 0, sendbuf, send_size); -#endif if (res) { printf("i2c_write returned %d\n", res); return -1; } start = get_timer(0); -#if !CONFIG_IS_ENABLED(DM_I2C) - while ((res = i2c_read(0x29, 0, 0, recvbuf, 10))) -#else + while ((res = dm_i2c_read(dev, 0, recvbuf, 10))) -#endif { /* TODO Use TIS_TIMEOUT from tpm_tis_infineon.h */ if (get_timer(start) > ATMEL_TPM_TIMEOUT_MS) { @@ -116,12 +109,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, return -1; } else { *recv_len = hdr_recv_len; -#if !CONFIG_IS_ENABLED(DM_I2C) - res = i2c_read(0x29, 0, 0, recvbuf, *recv_len); -#else res = dm_i2c_read(dev, 0, recvbuf, *recv_len); -#endif - } } if (res) { From patchwork Thu Nov 11 04:06:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553761 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=ayspOTjn; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Y+LJ90Mi; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSqX243kz9s1l for ; Thu, 11 Nov 2021 15:07:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D2A4C839A5; Thu, 11 Nov 2021 05:07:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="ayspOTjn"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Y+LJ90Mi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D4DC8374A; Thu, 11 Nov 2021 05:07:04 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A3C8183744 for ; Thu, 11 Nov 2021 05:06:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D4ECB5C0218; Wed, 10 Nov 2021 23:06:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 10 Nov 2021 23:06:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=Gh0BjNRf6qb2Y z9Tfy1ipucmBrLoXLASg3SWmT13xiU=; b=ayspOTjnolQQXmFVA3R6lx+Kz9xhM jQG5odUPr3qN8hlRLzCP2xgXdRgvHliXTKSnWO/Nijf+ZPKlxObkkGTIanaFr6XM Qns75nURjj/4HRqKwNqmryTXvBE0qJ2SjYWTTjeInLX0ue52MDfdNzTEaE2F9+VA BLjXB7aXyh1HRmf0n7MVpkOVcnunsApxjOyUHy8nTIAEwX7n+i3EVVVObJ2nRDKn whowoMc9TafCkn9OIsqU/ltOZS9fxMpEGiJTipR2mGhLimoApAvxKdi3i3UYfY43 O6sHSN7nTOAVqUBKIxzJ8xkYVlFm+qe7/H7CTJiefzLwm1krgIWYkFGiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Gh0BjNRf6qb2Yz9Tfy1ipucmBrLoXLASg3SWmT13xiU=; b=Y+LJ90Mi IQ/kYEn5dwfEcV+325Yfsk5i91Oyq/FCnnjla3MbMdMS5m3WfmO5cNvxxcgBhGAz FXmCGu1d0ehSTj25ulABBMA27l3nh9vNXhDZNYgcnm+j9e9iaznD4X1CMtHcmW5s lnZcmztvS10D4DiMyCZvXlZG/DPywMMchpohpSv9DzrT63o4D1DecRvFFTqgv9K2 8d/UPvXtcl/88OhpALSIOzHoCgxqVxl9+HaAwKuNxakUvRV0e+DfE0WZNkTOqoG8 GOIencDS0JAgojO4E62lPABD8XXVF+nC80Aetbor6SiMgoQjl/kmZmRH9e0FkNjy 151CmmsB3j+2KA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:52 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 4/6] drivers: tpm: atmel_twi: do not use an offset byte Date: Thu, 11 Nov 2021 04:06:29 +0000 Message-Id: <20211111040631.21262-5-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean This driver was broken due to an empty offset byte being prepended at the start of every transmission. The hardware does not mimic an EEPROM device with registers so an offset byte is not required. Signed-off-by: Mathew McBride Acked-by: Ilias Apalodimas Reviewed-by: Simon Glass --- drivers/tpm/tpm_atmel_twi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c index 4ff4cf4cd4..71b101406d 100644 --- a/drivers/tpm/tpm_atmel_twi.c +++ b/drivers/tpm/tpm_atmel_twi.c @@ -131,6 +131,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, static int tpm_atmel_twi_probe(struct udevice *dev) { + i2c_set_chip_offset_len(dev, 0); return 0; } From patchwork Thu Nov 11 04:06:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553760 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=C8sKe13Q; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=DK2otGy0; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSqL4bQjz9s1l for ; Thu, 11 Nov 2021 15:07:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D574E83983; Thu, 11 Nov 2021 05:07:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="C8sKe13Q"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="DK2otGy0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB7ED83754; Thu, 11 Nov 2021 05:07:04 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCEF6836C5 for ; Thu, 11 Nov 2021 05:06:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1EBCB5C01AF; Wed, 10 Nov 2021 23:06:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 10 Nov 2021 23:06:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=5yzbRPTQHQkF6 SwBlh9zwsIV/AGxkdDXi9d4xr5dQO8=; b=C8sKe13QZp0WPInZ3wSRoVq3b9Gmh Xaqqiyxy7jTg0EyhOzvD4mA3Kormv+akhukCQQShvHWRAXOScDUbagi4f2/pCjSb zIw6CoJz6RbV2JKcplNIfOoJzaXm9vtLB8zMjMZxCv6oImqr8fSqRJgAgLDoWySx 5bKYcbHD36JlG9IvrRBsgoSvrsAHNUz8zAgyqwgQ9FbkxRoI695MdOjy0dCW9sjV jn9mZiIAFuAnmnZl/BBJ3iKaX6ueqU/Po37Rpg4Ly7hOD3lGJSPvR7jNejuCDrQz wYCxk9QibPv61rvnZ2Z4eZPME5Yf0O35iCQ0sYGsBNFrSqfIUVxu7mLAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=5yzbRPTQHQkF6SwBlh9zwsIV/AGxkdDXi9d4xr5dQO8=; b=DK2otGy0 ORNpnZqrp3TMi8SWvpBx3jdspsmK1HXOcsTQBAVSfR/YbkkgM94YW/YInBWGhYAw LPtTX0wJGm/OX5MqNjQODtp3SI78Iq6n3fpZeJKtqDRLoq+Mma1F/1DgCZJ/2uvg oZ70cu0gZmAst7KHqj0OBk1J+1V6P8hDzcjPzyPHvYuA8GdEkKsI+t+7Ro+PKyhB wdHqdx4xMDbMGgImBw6Hxm0JGmQA2y3FZqHIBLVLpGzSEexasrxFpYi2UT3aUEIB iPbHZq7prQ1jVeh3u6pEDn/rHE72aPAcNK64UsfFFnn0oFVOBVCUsyFsCO145PlE NJ/3ih3o/XQ2lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:55 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 5/6] drivers: tpm: atmel_twi: implement get_desc operation Date: Thu, 11 Nov 2021 04:06:30 +0000 Message-Id: <20211111040631.21262-6-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Without get_desc, the tpm command will not provide a description of the device in 'tpm device' or 'tpm info'. Due to the characteristics of the Atmel TPM it isn't possible to determine certain attributes (e.g open/close status) without using the TPM stack (compare Infineon and ST TPM drivers), so just print out the chip model and udevice name as the identifier. Signed-off-by: Mathew McBride Reviewed-by: Simon Glass --- drivers/tpm/tpm_atmel_twi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c index 71b101406d..a5dfb34846 100644 --- a/drivers/tpm/tpm_atmel_twi.c +++ b/drivers/tpm/tpm_atmel_twi.c @@ -52,7 +52,10 @@ static int tpm_atmel_twi_close(struct udevice *dev) */ static int tpm_atmel_twi_get_desc(struct udevice *dev, char *buf, int size) { - return 0; + if (size < 50) + return -ENOSPC; + + return snprintf(buf, size, "Atmel AT97SC3204T I2C 1.2 TPM (%s)", dev->name); } /* From patchwork Thu Nov 11 04:06:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1553762 X-Patchwork-Delegate: apalos@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm2 header.b=kjB0iJ4E; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Gk38NfM8; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HqSqj6HChz9s1l for ; Thu, 11 Nov 2021 15:08:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2388683752; Thu, 11 Nov 2021 05:07:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au 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=traverse.com.au header.i=@traverse.com.au header.b="kjB0iJ4E"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Gk38NfM8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82312836C5; Thu, 11 Nov 2021 05:07:07 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EDC6483747 for ; Thu, 11 Nov 2021 05:06:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=traverse.com.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matt@traverse.com.au Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 311215C0225; Wed, 10 Nov 2021 23:06:59 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 10 Nov 2021 23:06:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=NNIIBRO/IdyP8 rLn96vBTX7B7rGHlPy/Gmhjo5lZFYw=; b=kjB0iJ4Ei1tKngnHU9Elum5G6TtN2 evQBsFLqGusWa0rXteUd+5RHewkzvVLwHV60YzEulgj0fzbbjBkfKcj2sg6bRLyn ySarJ9OGH0vGNk5LOnkQyhptiq3QRr5MTrkrHCPmVFR6+mv4bSTOAln/g5DgOF6q tnvmHqC8USJoidu1xI6Rh5QEXykgNlQbmF5gSSa6WF7UqW9J2aJhVOUqiHa1kdmK 4xOdth7tk7+76GobQajR/+de9/g0E8uqY4FXknT4AYkQXIxJGnsy3tcmlBVEZTZq E1KPqWWI5q0u0ZKwtIb/huZTQk+gmuNd2eYI54AA++3R0d9GNS4Y8aQ3Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=NNIIBRO/IdyP8rLn96vBTX7B7rGHlPy/Gmhjo5lZFYw=; b=Gk38NfM8 /1yCyy1Bfvb5ahqohka/6/dYmXW/13fNlStKi7gROadjcNu5jq1Ph1g3V/K8HZp3 BkXnlDTLWrwm9Muw4uxX6LEsiDdGdRyXtVMemHnaTnW4OcVq5CzkdHrcLm1vWuaa ZVoMvTcNaBcfV8GgcXa+USYI3FTY+1Da+03vciE6I5/apEm+ohzpCOUi6Tu1kh1K 7gmo5LkI2zYpVbMz+CUmByE16ELHyLIIS6uMTRhCEnN3qB1QSS6mtuRIe+iy19fl Gkv+ibq9xCFHCwjfXtyUEgIXl/F4TJyi+5A/wQmlICsnHVaf6eCpCtahLF23RGRN lW2zlx/ch6Nbpw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvddtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeekleevteelvdduheetgfdvfeelueekffeggeethedtteeljeeivedv gfehjeejheenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrghtthesthhrrghvvghrshgvrdgtohhmrdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 23:06:57 -0500 (EST) From: Mathew McBride To: Ilias Apalodimas , eugen.hristev@microchip.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Mathew McBride Subject: [PATCH v2 6/6] drivers: tpm: atmel_twi: fix printf specifier compile warning Date: Thu, 11 Nov 2021 04:06:31 +0000 Message-Id: <20211111040631.21262-7-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211111040631.21262-1-matt@traverse.com.au> References: <20211111040631.21262-1-matt@traverse.com.au> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean %d was being used as the specifier for size_t, leading to a compiler warning Signed-off-by: Mathew McBride Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- drivers/tpm/tpm_atmel_twi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c index a5dfb34846..fa4fbec6bb 100644 --- a/drivers/tpm/tpm_atmel_twi.c +++ b/drivers/tpm/tpm_atmel_twi.c @@ -116,7 +116,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, } } if (res) { - printf("i2c_read returned %d (rlen=%d)\n", res, *recv_len); + printf("i2c_read returned %d (rlen=%zu)\n", res, *recv_len); #ifdef DEBUG print_buffer(0, recvbuf, 1, *recv_len, 0); #endif