2 Implement the InternalTpm12Detect() function on top of the Tpm12DeviceLib
5 Copyright (C) 2020, Red Hat, Inc.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/BaseLib.h>
11 #include <Library/Tpm12DeviceLib.h>
13 #include "Tpm12Support.h"
17 TPM_RSP_COMMAND_HDR Hdr
;
18 TPM_CURRENT_TICKS CurrentTicks
;
23 Probe for the TPM for 1.2 version, by sending TPM1.2 GetTicks
25 Sending a TPM1.2 command to a TPM2 should return a TPM1.2
26 header (tag = 0xc4) and error code (TPM_BADTAG = 0x1e)
28 @retval EFI_SUCCESS TPM version 1.2 probing successful.
30 @return Error codes propagated from Tpm12SubmitCommand().
38 TPM_RQU_COMMAND_HDR Command
;
39 TPM_RSP_GET_TICKS Response
;
42 Command
.tag
= SwapBytes16 (TPM_TAG_RQU_COMMAND
);
43 Command
.paramSize
= SwapBytes32 (sizeof (Command
));
44 Command
.ordinal
= SwapBytes32 (TPM_ORD_GetTicks
);
46 Length
= sizeof (Response
);
47 Status
= Tpm12SubmitCommand (
53 if (EFI_ERROR (Status
)) {
61 Detect the presence of a TPM with interface version 1.2.
63 @retval EFI_SUCCESS TPM-1.2 available. The Tpm12RequestUseTpm() and
64 Tpm12SubmitCommand(TPM_ORD_GetTicks) operations
65 (from the Tpm12DeviceLib class) have succeeded.
67 @return Error codes propagated from Tpm12RequestUseTpm() and
77 Status
= Tpm12RequestUseTpm ();
78 if (EFI_ERROR (Status
)) {