2013-09-18 07:31:18 +02:00
|
|
|
/** @file
|
2014-08-15 10:10:55 +02:00
|
|
|
Implement TPM1.2 Ownership related command.
|
2013-09-18 07:31:18 +02:00
|
|
|
|
2018-06-27 15:13:09 +02:00
|
|
|
Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>
|
2019-04-04 01:06:56 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2013-09-18 07:31:18 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
2016-01-21 20:30:05 +01:00
|
|
|
#include <PiPei.h>
|
2013-09-18 07:31:18 +02:00
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/Tpm12DeviceLib.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
Send ForceClear command to TPM1.2.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Operation completed successfully.
|
|
|
|
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
Tpm12ForceClear (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2016-01-21 20:30:05 +01:00
|
|
|
EFI_STATUS Status;
|
|
|
|
TPM_RQU_COMMAND_HDR Command;
|
|
|
|
TPM_RSP_COMMAND_HDR Response;
|
|
|
|
UINT32 Length;
|
2013-09-18 07:31:18 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// send Tpm command TPM_ORD_ForceClear
|
|
|
|
//
|
2016-01-21 20:30:05 +01:00
|
|
|
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
|
|
|
Command.paramSize = SwapBytes32 (sizeof (Command));
|
|
|
|
Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear);
|
|
|
|
Length = sizeof (Response);
|
2013-09-18 07:31:18 +02:00
|
|
|
|
2016-01-21 20:30:05 +01:00
|
|
|
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
2013-09-18 07:31:18 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
2016-01-21 20:30:05 +01:00
|
|
|
switch (SwapBytes32 (Response.returnCode)) {
|
2013-09-18 07:31:18 +02:00
|
|
|
case TPM_SUCCESS:
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
default:
|
|
|
|
return EFI_DEVICE_ERROR;
|
|
|
|
}
|
2018-06-27 15:13:09 +02:00
|
|
|
}
|