PTP (Platform TPM Profile) CRB (Command Response Buffer) interface used by dTPM2.0 library.\r
\r
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c), Microsoft Corporation.\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include <IndustryStandard/TpmPtp.h>\r
#include <IndustryStandard/TpmTis.h>\r
\r
+#include "Tpm2DeviceLibDTpm.h"\r
+\r
//\r
// Execution of the command may take from several seconds to minutes for certain\r
// commands, such as key generation.\r
// STEP 0:\r
// if CapCRbIdelByPass == 0, enforce Idle state before sending command\r
//\r
- if (PcdGet8(PcdCRBIdleByPass) == 0 && (MmioRead32((UINTN)&CrbReg->CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0){\r
+ if (GetCachedIdleByPass () == 0 && (MmioRead32((UINTN)&CrbReg->CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0){\r
Status = PtpCrbWaitRegisterBits (\r
&CrbReg->CrbControlStatus,\r
PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,\r
// Goto Ready State if command is completed successfully and TPM support IdleBypass\r
// If not supported. flow down to GoIdle\r
//\r
- if (PcdGet8(PcdCRBIdleByPass) == 1) {\r
+ if (GetCachedIdleByPass () == 1) {\r
MmioWrite32((UINTN)&CrbReg->CrbControlRequest, PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);\r
return Status;\r
}\r
// Only enforce Idle state transition if execution fails when CRBIdleBypass==1\r
// Leave regular Idle delay at the beginning of next command execution\r
//\r
- if (PcdGet8(PcdCRBIdleByPass) == 1){\r
+ if (GetCachedIdleByPass () == 1){\r
Status = PtpCrbWaitRegisterBits (\r
&CrbReg->CrbControlStatus,\r
PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,\r
Vid = 0xFFFF;\r
Did = 0xFFFF;\r
Rid = 0xFF;\r
- PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);\r
+ PtpInterface = GetCachedPtpInterface ();\r
DEBUG ((EFI_D_INFO, "PtpInterface - %x\n", PtpInterface));\r
switch (PtpInterface) {\r
case Tpm2PtpInterfaceCrb:\r
{\r
TPM2_PTP_INTERFACE_TYPE PtpInterface;\r
\r
- PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);\r
+ PtpInterface = GetCachedPtpInterface ();\r
switch (PtpInterface) {\r
case Tpm2PtpInterfaceCrb:\r
return PtpCrbTpmCommand (\r
{\r
TPM2_PTP_INTERFACE_TYPE PtpInterface;\r
\r
- PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);\r
+ PtpInterface = GetCachedPtpInterface ();\r
switch (PtpInterface) {\r
case Tpm2PtpInterfaceCrb:\r
return PtpCrbRequestUseTpm ((PTP_CRB_REGISTERS_PTR) (UINTN) PcdGet64 (PcdTpmBaseAddress));\r