TianoCore EDK2 master
Loading...
Searching...
No Matches
Tpm2DeviceLibRouterDxe.c
Go to the documentation of this file.
1
11#include <Library/BaseLib.h>
13#include <Library/DebugLib.h>
14#include <Library/PcdLib.h>
16
17TPM2_DEVICE_INTERFACE mInternalTpm2DeviceInterface;
18
32EFIAPI
34 IN UINT32 InputParameterBlockSize,
35 IN UINT8 *InputParameterBlock,
36 IN OUT UINT32 *OutputParameterBlockSize,
37 IN UINT8 *OutputParameterBlock
38 )
39{
40 if (mInternalTpm2DeviceInterface.Tpm2SubmitCommand == NULL) {
41 return EFI_UNSUPPORTED;
42 }
43
44 return mInternalTpm2DeviceInterface.Tpm2SubmitCommand (
45 InputParameterBlockSize,
46 InputParameterBlock,
47 OutputParameterBlockSize,
48 OutputParameterBlock
49 );
50}
51
60EFIAPI
62 VOID
63 )
64{
65 if (mInternalTpm2DeviceInterface.Tpm2RequestUseTpm == NULL) {
66 return EFI_UNSUPPORTED;
67 }
68
69 return mInternalTpm2DeviceInterface.Tpm2RequestUseTpm ();
70}
71
82EFIAPI
84 IN TPM2_DEVICE_INTERFACE *Tpm2Device
85 )
86{
87 if (!CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &Tpm2Device->ProviderGuid)) {
88 DEBUG ((DEBUG_WARN, "WARNING: Tpm2RegisterTpm2DeviceLib - does not support %g registration\n", &Tpm2Device->ProviderGuid));
89 return EFI_UNSUPPORTED;
90 }
91
92 CopyMem (&mInternalTpm2DeviceInterface, Tpm2Device, sizeof (mInternalTpm2DeviceInterface));
93 return EFI_SUCCESS;
94}
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388
EFI_STATUS EFIAPI Tpm2RegisterTpm2DeviceLib(IN TPM2_DEVICE_INTERFACE *Tpm2Device)
EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
EFI_STATUS EFIAPI Tpm2RequestUseTpm(VOID)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112