21 UINT32 CapabilityFlagSize;
22 UINT32 CapabilityFlag;
64 Command.Hdr.tag =
SwapBytes16 (TPM_TAG_RQU_COMMAND);
65 Command.Hdr.paramSize =
SwapBytes32 (
sizeof (Command));
66 Command.Hdr.ordinal =
SwapBytes32 (TPM_ORD_GetCapability);
68 Command.CapabilityFlagSize =
SwapBytes32 (
sizeof (TPM_CAP_FLAG_PERMANENT));
69 Command.CapabilityFlag =
SwapBytes32 (TPM_CAP_FLAG_PERMANENT);
70 Length =
sizeof (Response);
71 Status =
Tpm12SubmitCommand (
sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
72 if (EFI_ERROR (Status)) {
76 if (
SwapBytes32 (Response.Hdr.returnCode) != TPM_SUCCESS) {
77 DEBUG ((DEBUG_ERROR,
"Tpm12GetCapabilityFlagPermanent: Response Code error! 0x%08x\r\n",
SwapBytes32 (Response.Hdr.returnCode)));
78 return EFI_DEVICE_ERROR;
81 ZeroMem (TpmPermanentFlags,
sizeof (*TpmPermanentFlags));
82 CopyMem (TpmPermanentFlags, &Response.Flags,
MIN (
sizeof (*TpmPermanentFlags),
SwapBytes32 (Response.ResponseSize)));
110 Command.Hdr.tag =
SwapBytes16 (TPM_TAG_RQU_COMMAND);
111 Command.Hdr.paramSize =
SwapBytes32 (
sizeof (Command));
112 Command.Hdr.ordinal =
SwapBytes32 (TPM_ORD_GetCapability);
114 Command.CapabilityFlagSize =
SwapBytes32 (
sizeof (TPM_CAP_FLAG_VOLATILE));
115 Command.CapabilityFlag =
SwapBytes32 (TPM_CAP_FLAG_VOLATILE);
116 Length =
sizeof (Response);
117 Status =
Tpm12SubmitCommand (
sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
118 if (EFI_ERROR (Status)) {
122 if (
SwapBytes32 (Response.Hdr.returnCode) != TPM_SUCCESS) {
123 DEBUG ((DEBUG_ERROR,
"Tpm12GetCapabilityFlagVolatile: Response Code error! 0x%08x\r\n",
SwapBytes32 (Response.Hdr.returnCode)));
124 return EFI_DEVICE_ERROR;
127 ZeroMem (VolatileFlags,
sizeof (*VolatileFlags));
128 CopyMem (VolatileFlags, &Response.Flags,
MIN (
sizeof (*VolatileFlags),
SwapBytes32 (Response.ResponseSize)));
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DEBUG(Expression)
EFI_STATUS EFIAPI Tpm12SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
EFI_STATUS EFIAPI Tpm12GetCapabilityFlagVolatile(OUT TPM_STCLEAR_FLAGS *VolatileFlags)
EFI_STATUS EFIAPI Tpm12GetCapabilityFlagPermanent(OUT TPM_PERMANENT_FLAGS *TpmPermanentFlags)