TianoCore EDK2 master
Loading...
Searching...
No Matches
Tpm12PhysicalPresence.c
Go to the documentation of this file.
1
9#include <PiPei.h>
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
14
15#pragma pack(1)
16
17typedef struct {
19 TPM_PHYSICAL_PRESENCE PhysicalPresence;
21
22#pragma pack()
23
36EFIAPI
38 IN TPM_PHYSICAL_PRESENCE PhysicalPresence
39 )
40{
41 EFI_STATUS Status;
43 TPM_RSP_COMMAND_HDR Response;
44 UINT32 Length;
45
46 //
47 // send Tpm command TSC_ORD_PhysicalPresence
48 //
49 Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
50 Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
51 Command.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);
52 Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
53 Length = sizeof (Response);
54
55 Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
56 if (EFI_ERROR (Status)) {
57 return Status;
58 }
59
60 if (SwapBytes32 (Response.returnCode) != TPM_SUCCESS) {
61 DEBUG ((DEBUG_ERROR, "Tpm12PhysicalPresence: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.returnCode)));
62 return EFI_DEVICE_ERROR;
63 }
64
65 return EFI_SUCCESS;
66}
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
Definition: SwapBytes16.c:25
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
Definition: SwapBytes32.c:25
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
UINT16 TPM_PHYSICAL_PRESENCE
Definition: Tpm12.h:69
EFI_STATUS EFIAPI Tpm12SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
Definition: Tpm12Tis.c:453
EFI_STATUS EFIAPI Tpm12PhysicalPresence(IN TPM_PHYSICAL_PRESENCE PhysicalPresence)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112