SecurityPkg Tpm2DeviceLibDTpm: Update enum type name to match the one in lib
[mirror_edk2.git] / SecurityPkg / Library / Tpm2DeviceLibDTpm / Tpm2InstanceLibDTpm.c
index 01f78bf..5f6e163 100644 (file)
@@ -34,6 +34,18 @@ Tpm2GetPtpInterface (
   IN VOID *Register\r
   );\r
 \r
+/**\r
+  Return PTP CRB interface IdleByPass state.\r
+\r
+  @param[in] Register                Pointer to PTP register.\r
+\r
+  @return PTP CRB interface IdleByPass state.\r
+**/\r
+UINT8\r
+Tpm2GetIdleByPass (\r
+  IN VOID *Register\r
+  );\r
+\r
 /**\r
   Dump PTP register information.\r
 \r
@@ -97,6 +109,7 @@ Tpm2InstanceLibDTpmConstructor (
 {\r
   EFI_STATUS               Status;\r
   TPM2_PTP_INTERFACE_TYPE  PtpInterface;\r
+  UINT8                    IdleByPass;\r
 \r
   Status = Tpm2RegisterTpm2DeviceLib (&mDTpm2InternalTpm2Device);\r
   if ((Status == EFI_SUCCESS) || (Status == EFI_UNSUPPORTED)) {\r
@@ -111,6 +124,12 @@ Tpm2InstanceLibDTpmConstructor (
         PtpInterface = Tpm2GetPtpInterface ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));\r
         PcdSet8S(PcdActiveTpmInterfaceType, PtpInterface);\r
       }\r
+\r
+      if (PcdGet8(PcdActiveTpmInterfaceType) == Tpm2PtpInterfaceCrb && PcdGet8(PcdCRBIdleByPass) == 0xFF) {\r
+        IdleByPass = Tpm2GetIdleByPass((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));\r
+        PcdSet8S(PcdCRBIdleByPass, IdleByPass);\r
+      }\r
+\r
       DumpPtpInfo ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));\r
     }\r
     return EFI_SUCCESS;\r