From: xianhu2x <xianhuix.liu@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] fTPM
Date: Fri, 10 Nov 2017 15:27:10 +0800 [thread overview]
Message-ID: <20171110072710.15988-1-xianhuix.liu@intel.com> (raw)
Boot failed after PTT is enabled with gcc-built image
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: xianhu2x <xianhuix.liu@intel.com>
---
.../Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c | 44 ++++++++++++++--------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c
index 24e8c5bb6..89251fa19 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/PeiDxePttPtpLib/PeiDxePttPtpLib.c
@@ -228,6 +228,8 @@ PttHciSend(
{
UINT32 ControlStatus;
UINT32 WaitTime;
+ UINTN StartAddress;
+ UINT32 *ReturnBuffer;
//
// Make sure that previous command was in fact completed if not, must not
@@ -290,12 +292,15 @@ PttHciSend(
DataLength += (4 - (DataLength % 4));
DEBUG ((DEBUG_INFO, "to %d\n", DataLength));
}
-
- MmioWriteBuffer32 ((UINTN) R_PTT_HCI_BASE_ADDRESS +
+ ReturnBuffer = (UINT32 *)PttBuffer;
+ StartAddress = (UINTN) R_PTT_HCI_BASE_ADDRESS +
( TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE )+
- 0x80,
- DataLength,
- (UINT32 *) PttBuffer );
+ 0x80;
+ while (DataLength != 0) {
+ MmioWrite32 ((UINTN) StartAddress, *(ReturnBuffer++));
+ StartAddress += sizeof (UINT32);
+ DataLength-= sizeof (UINT32);
+ }
//
// 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;
Status = 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 = (UINT32 *)PttBuffer;
+ StartAddress = (UINTN) R_PTT_HCI_BASE_ADDRESS + ( TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE ) + 0x80;
+ DataLength = PTT_HCI_RESPONSE_HEADER_SIZE;
+ while (DataLength != 0) {
+ *(ReturnBuffer ++) = MmioRead32 (StartAddress);
+ StartAddress += sizeof (UINT32);
+ DataLength -= sizeof (UINT32);
+ }
//
// 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 = (UINT32 *)PttBuffer;
+ StartAddress = (UINTN) R_PTT_HCI_BASE_ADDRESS + ( TPM_LOCALITY_0 * TPM_LOCALITY_BUFFER_SIZE ) + 0x80;
+ DataLength = *RespSize;
+ while (DataLength != 0) {
+ *(ReturnBuffer ++) = MmioRead32 (StartAddress);
+ StartAddress += sizeof (UINT32);
+ DataLength -= sizeof (UINT32);
+ }
Exit:
return Status;
--
2.14.1.windows.1
reply other threads:[~2017-11-10 7:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171110072710.15988-1-xianhuix.liu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox