2 Implement TPM1.2 NV Self Test related commands.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/Tpm12CommandLib.h>
12 #include <Library/BaseLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/Tpm12DeviceLib.h>
17 Send TPM_ContinueSelfTest command to TPM.
19 @retval EFI_SUCCESS Operation completed successfully.
20 @retval EFI_TIMEOUT The register can't run into the expected status in time.
21 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.
22 @retval EFI_DEVICE_ERROR Unexpected device behavior.
27 Tpm12ContinueSelfTest (
32 TPM_RQU_COMMAND_HDR Command
;
33 TPM_RSP_COMMAND_HDR Response
;
37 // send Tpm command TPM_ORD_ContinueSelfTest
39 Command
.tag
= SwapBytes16 (TPM_TAG_RQU_COMMAND
);
40 Command
.paramSize
= SwapBytes32 (sizeof (Command
));
41 Command
.ordinal
= SwapBytes32 (TPM_ORD_ContinueSelfTest
);
42 Length
= sizeof (Response
);
43 Status
= Tpm12SubmitCommand (sizeof (Command
), (UINT8
*)&Command
, &Length
, (UINT8
*)&Response
);
44 if (EFI_ERROR (Status
)) {
48 if (SwapBytes32 (Response
.returnCode
) != TPM_SUCCESS
) {
49 DEBUG ((DEBUG_ERROR
, "Tpm12ContinueSelfTest: Response Code error! 0x%08x\r\n", SwapBytes32 (Response
.returnCode
)));
50 return EFI_DEVICE_ERROR
;