2 This file abstract internal interfaces of which implementation differs per library instance.
4 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>
5 Copyright (c) Microsoft Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/Tpm2DeviceLib.h>
11 #include <Library/PcdLib.h>
13 #include "Tpm2DeviceLibDTpm.h"
16 Return cached PTP CRB interface IdleByPass state.
18 @return Cached PTP CRB interface IdleByPass state.
25 return PcdGet8(PcdCRBIdleByPass
);
29 Return cached PTP interface type.
31 @return Cached PTP interface type.
33 TPM2_PTP_INTERFACE_TYPE
34 GetCachedPtpInterface (
38 return PcdGet8(PcdActiveTpmInterfaceType
);
42 The common function cache current active TpmInterfaceType when needed.
44 @retval EFI_SUCCESS DTPM2.0 instance is registered, or system does not support register DTPM2.0 instance
47 InternalTpm2DeviceLibDTpmCommonConstructor (
51 TPM2_PTP_INTERFACE_TYPE PtpInterface
;
55 // Cache current active TpmInterfaceType only when needed
57 if (PcdGet8(PcdActiveTpmInterfaceType
) == 0xFF) {
58 PtpInterface
= Tpm2GetPtpInterface ((VOID
*) (UINTN
) PcdGet64 (PcdTpmBaseAddress
));
59 PcdSet8S(PcdActiveTpmInterfaceType
, PtpInterface
);
62 if (PcdGet8(PcdActiveTpmInterfaceType
) == Tpm2PtpInterfaceCrb
&& PcdGet8(PcdCRBIdleByPass
) == 0xFF) {
63 IdleByPass
= Tpm2GetIdleByPass((VOID
*) (UINTN
) PcdGet64 (PcdTpmBaseAddress
));
64 PcdSet8S(PcdCRBIdleByPass
, IdleByPass
);