From patchwork Wed Apr 26 19:18:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Snitselaar X-Patchwork-Id: 9701891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6C596032C for ; Wed, 26 Apr 2017 19:18:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E7D2860D for ; Wed, 26 Apr 2017 19:18:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D3B128614; Wed, 26 Apr 2017 19:18:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 370082860D for ; Wed, 26 Apr 2017 19:18:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1d3SSF-0007bO-PF; Wed, 26 Apr 2017 19:18:23 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1d3SSE-0007bG-Op for tpmdd-devel@lists.sourceforge.net; Wed, 26 Apr 2017 19:18:22 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=jsnitsel@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1d3SSD-00043V-J5 for tpmdd-devel@lists.sourceforge.net; Wed, 26 Apr 2017 19:18:22 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE54A7DD06; Wed, 26 Apr 2017 19:18:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BE54A7DD06 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jsnitsel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BE54A7DD06 Received: from localhost (ovpn-120-231.rdu2.redhat.com [10.10.120.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9E2E17AE8; Wed, 26 Apr 2017 19:18:14 +0000 (UTC) Date: Wed, 26 Apr 2017 12:18:08 -0700 From: Jerry Snitselaar To: Ken Goldman Message-ID: <20170426191808.kkvbg4iynbwysu6k@rhwork> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 26 Apr 2017 19:18:15 +0000 (UTC) X-Headers-End: 1d3SSD-00043V-J5 Cc: tpmdd-devel@lists.sourceforge.net Subject: Re: [tpmdd-devel] What does error code 38 mean? -> hex vs. decimal X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: Jerry Snitselaar List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Virus-Scanned: ClamAV using ClamSMTP On Wed Apr 26 17, Ken Goldman wrote: >On 4/23/2017 9:32 PM, Peter Huewe wrote: >> 38=0x26= invalid post init, which means tpm did not receive tpm_startup >> command after reset. > >A minor observation: > >While the TPM 1.2 specification listed error codes in decimal, TPM 2.0 >uses hex, and further has a lot of bit level encoding. > >Thus, for TPM 2.0, it would be easier if error messages printed TPM >errors in hex. > > > >------------------------------------------------------------------------------ >Check out the vibrant tech community on one of the world's most >engaging tech sites, Slashdot.org! http://sdm.link/slashdot >_______________________________________________ >tpmdd-devel mailing list >tpmdd-devel@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/tpmdd-devel Maybe the following? --8<-- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index bd2128e0b56c..e6e60f9f428c 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -453,9 +453,14 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *buf, return -EFAULT; err = be32_to_cpu(header->return_code); - if (err != 0 && desc) - dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err, - desc); + if (err != 0 && desc) { + if (chip->flags & TPM_CHIP_FLAG_TPM2) + dev_err(&chip->dev, "A TPM error (0x%x) occurred %s\n", err, + desc); + else + dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err, + desc); + } if (err) return err;