From nobody Wed Dec 25 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510298841704141.99638469288516; Thu, 9 Nov 2017 23:27:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 142992034EE01; Thu, 9 Nov 2017 23:23:17 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 891BF21B00DC0 for ; Thu, 9 Nov 2017 23:23:15 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 23:27:17 -0800 Received: from xianhu2x-mobl.ccr.corp.intel.com ([10.239.196.68]) by orsmga002.jf.intel.com with ESMTP; 09 Nov 2017 23:27:16 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=xianhuix.liu@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,373,1505804400"; d="scan'208";a="6087454" From: xianhu2x To: edk2-devel@lists.01.org Date: Fri, 10 Nov 2017 15:27:10 +0800 Message-Id: <20171110072710.15988-1-xianhuix.liu@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] fTPM X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Boot failed after PTT is enabled with gcc-built image Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: xianhu2x --- .../Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c | 44 ++++++++++++++----= ---- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/Pe= iDxePttPtpLib.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpL= ib/PeiDxePttPtpLib.c index 24e8c5bb6..89251fa19 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePtt= PtpLib.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePtt= PtpLib.c @@ -228,6 +228,8 @@ PttHciSend( { UINT32 ControlStatus; UINT32 WaitTime; + UINTN StartAddress; + UINT32 *ReturnBuffer; =20 // // Make sure that previous command was in fact completed if not, must not @@ -290,12 +292,15 @@ PttHciSend( DataLength +=3D (4 - (DataLength % 4)); DEBUG ((DEBUG_INFO, "to %d\n", DataLength)); } - - MmioWriteBuffer32 ((UINTN) R_PTT_HCI_BASE_ADDRESS + + ReturnBuffer =3D (UINT32 *)PttBuffer; + StartAddress =3D (UINTN) R_PTT_HCI_BASE_ADDRESS + ( TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE )+ - 0x80, - DataLength, - (UINT32 *) PttBuffer ); + 0x80; + while (DataLength !=3D 0) { + MmioWrite32 ((UINTN) StartAddress, *(ReturnBuffer++)); + StartAddress +=3D sizeof (UINT32); + DataLength-=3D sizeof (UINT32); + } =20 // // Trigger Command processing by writing to start register @@ -334,6 +339,9 @@ PttHciReceive ( UINT16 Data16; UINT32 Data32; EFI_STATUS Status; + UINT32 *ReturnBuffer; + UINTN StartAddress; + UINT32 DataLength; =20 Status =3D EFI_SUCCESS; DEBUG ((DEBUG_INFO, "PTT: PttHciReceive start\n")); @@ -365,11 +373,14 @@ PttHciReceive ( // // Read the response data header // - MmioReadBuffer32 ((UINTN) R_PTT_HCI_BASE_ADDRESS + - ( TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE )+ - 0x80, - PTT_HCI_RESPONSE_HEADER_SIZE, - (UINT32 *) PttBuffer); + ReturnBuffer =3D (UINT32 *)PttBuffer; + StartAddress =3D (UINTN) R_PTT_HCI_BASE_ADDRESS + ( TPM_LOCALITY_0 * TPM= _LOCALITY_BUFFER_SIZE ) + 0x80; + DataLength =3D PTT_HCI_RESPONSE_HEADER_SIZE; + while (DataLength !=3D 0) { + *(ReturnBuffer ++) =3D MmioRead32 (StartAddress); + StartAddress +=3D sizeof (UINT32); + DataLength -=3D sizeof (UINT32); + } =20 // // Check the reponse data header (tag, parasize and returncode) @@ -411,11 +422,14 @@ PttHciReceive ( // // Read the entire response data header // - MmioReadBuffer32 ((UINTN) R_PTT_HCI_BASE_ADDRESS + - (TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE)+ - 0x80, - *RespSize, - (UINT32 *) PttBuffer); + ReturnBuffer =3D (UINT32 *)PttBuffer; + StartAddress =3D (UINTN) R_PTT_HCI_BASE_ADDRESS + ( TPM_LOCALITY_0 * TPM= _LOCALITY_BUFFER_SIZE ) + 0x80; + DataLength =3D *RespSize; + while (DataLength !=3D 0) { + *(ReturnBuffer ++) =3D MmioRead32 (StartAddress); + StartAddress +=3D sizeof (UINT32); + DataLength -=3D sizeof (UINT32); + } Exit: =20 return Status; --=20 2.14.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel