Boot failed after PTT is enabled with gcc-built image Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: xianhu2x <xianhuix....@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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel