2016-01-21 20:30:05 +01:00
|
|
|
/** @file
|
|
|
|
Implement TPM1.2 NV Self Test related commands.
|
|
|
|
|
2017-01-10 17:46:20 +01:00
|
|
|
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>
|
2016-04-28 22:29:27 +02:00
|
|
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
2016-01-21 20:30:05 +01:00
|
|
|
This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
#include <Library/Tpm12CommandLib.h>
|
|
|
|
#include <Library/BaseLib.h>
|
2017-01-10 17:46:20 +01:00
|
|
|
#include <Library/DebugLib.h>
|
2016-01-21 20:30:05 +01:00
|
|
|
#include <Library/Tpm12DeviceLib.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
Send TPM_ContinueSelfTest command to TPM.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Operation completed successfully.
|
|
|
|
@retval EFI_TIMEOUT The register can't run into the expected status in time.
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.
|
|
|
|
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
Tpm12ContinueSelfTest (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2017-01-10 17:46:20 +01:00
|
|
|
EFI_STATUS Status;
|
2016-01-21 20:30:05 +01:00
|
|
|
TPM_RQU_COMMAND_HDR Command;
|
|
|
|
TPM_RSP_COMMAND_HDR Response;
|
|
|
|
UINT32 Length;
|
|
|
|
|
|
|
|
//
|
|
|
|
// send Tpm command TPM_ORD_ContinueSelfTest
|
|
|
|
//
|
|
|
|
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
|
|
|
Command.paramSize = SwapBytes32 (sizeof (Command));
|
|
|
|
Command.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest);
|
2016-04-28 22:29:27 +02:00
|
|
|
Length = sizeof (Response);
|
2017-01-10 17:46:20 +01:00
|
|
|
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SwapBytes32 (Response.returnCode) != TPM_SUCCESS) {
|
|
|
|
DEBUG ((DEBUG_ERROR, "Tpm12ContinueSelfTest: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.returnCode)));
|
|
|
|
return EFI_DEVICE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
2016-01-21 20:30:05 +01:00
|
|
|
}
|