]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Include/Library/Tpm2DeviceLib.h
67f158ef039c404a8bdba292cf070bc2b9d21d1f
[mirror_edk2.git] / SecurityPkg / Include / Library / Tpm2DeviceLib.h
1 /** @file
2 This library abstract how to access TPM2 hardware device.
3
4 Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _TPM2_DEVICE_LIB_H_
16 #define _TPM2_DEVICE_LIB_H_
17
18 #include <Uefi.h>
19
20 /**
21 This service enables the sending of commands to the TPM2.
22
23 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
24 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
25 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
26 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
27
28 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
29 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
30 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
31 **/
32 EFI_STATUS
33 EFIAPI
34 Tpm2SubmitCommand (
35 IN UINT32 InputParameterBlockSize,
36 IN UINT8 *InputParameterBlock,
37 IN OUT UINT32 *OutputParameterBlockSize,
38 IN UINT8 *OutputParameterBlock
39 );
40
41 /**
42 This service requests use TPM2.
43
44 @retval EFI_SUCCESS Get the control of TPM2 chip.
45 @retval EFI_NOT_FOUND TPM2 not found.
46 @retval EFI_DEVICE_ERROR Unexpected device behavior.
47 **/
48 EFI_STATUS
49 EFIAPI
50 Tpm2RequestUseTpm (
51 VOID
52 );
53
54 /**
55 This service enables the sending of commands to the TPM2.
56
57 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
58 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
59 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
60 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
61
62 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
63 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
64 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
65 **/
66 typedef
67 EFI_STATUS
68 (EFIAPI *TPM2_SUBMIT_COMMAND) (
69 IN UINT32 InputParameterBlockSize,
70 IN UINT8 *InputParameterBlock,
71 IN OUT UINT32 *OutputParameterBlockSize,
72 IN UINT8 *OutputParameterBlock
73 );
74
75 /**
76 This service requests use TPM2.
77
78 @retval EFI_SUCCESS Get the control of TPM2 chip.
79 @retval EFI_NOT_FOUND TPM2 not found.
80 @retval EFI_DEVICE_ERROR Unexpected device behavior.
81 **/
82 typedef
83 EFI_STATUS
84 (EFIAPI *TPM2_REQUEST_USE_TPM) (
85 VOID
86 );
87
88 typedef struct {
89 EFI_GUID ProviderGuid;
90 TPM2_SUBMIT_COMMAND Tpm2SubmitCommand;
91 TPM2_REQUEST_USE_TPM Tpm2RequestUseTpm;
92 } TPM2_DEVICE_INTERFACE;
93
94 /**
95 This service register TPM2 device.
96
97 @param Tpm2Device TPM2 device
98
99 @retval EFI_SUCCESS This TPM2 device is registered successfully.
100 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
101 @retval EFI_ALREADY_STARTED System already register this TPM2 device.
102 **/
103 EFI_STATUS
104 EFIAPI
105 Tpm2RegisterTpm2DeviceLib (
106 IN TPM2_DEVICE_INTERFACE *Tpm2Device
107 );
108
109 #endif