+\r
+/**\r
+ The function caches current active TPM interface type.\r
+ \r
+ @retval EFI_SUCCESS DTPM2.0 instance is registered, or system dose not surpport registr DTPM2.0 instance\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm2DeviceLibConstructor (\r
+ VOID\r
+ )\r
+{\r
+ TPM2_PTP_INTERFACE_TYPE PtpInterface;\r
+\r
+ //\r
+ // Cache current active TpmInterfaceType only when needed\r
+ //\r
+ if (PcdGet8(PcdActiveTpmInterfaceType) == 0xFF) {\r
+ PtpInterface = Tpm2GetPtpInterface ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));\r
+ PcdSet8S(PcdActiveTpmInterfaceType, PtpInterface);\r
+ }\r
+ return EFI_SUCCESS;\r
+}\r