1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 Module Name:
25 
26   Tpm.h
27 
28 Abstract:
29 
30 
31 --*/
32 
33 #ifndef __EFI_TPM_MP_DRIVER_PROTOCOL_H__
34 #define __EFI_TPM_MP_DRIVER_PROTOCOL_H__
35 
36 
37 #define EFI_TPM_MP_DRIVER_PROTOCOL_GUID \
38   { 0xde161cfe, 0x1e60, 0x42a1, 0x8c, 0xc3, 0xee, 0x7e, 0xf0, 0x73, 0x52, 0x12 }
39 
40 
41 EFI_FORWARD_DECLARATION (EFI_TPM_MP_DRIVER_PROTOCOL);
42 
43 #define TPM_DRIVER_STATUS         0
44 #define TPM_DEVICE_STATUS         1
45 
46 #define TPM_DRIVER_OK             0
47 #define TPM_DRIVER_FAILED         1
48 #define TPM_DRIVER_NOT_OPENED     2
49 #define TPM_DEVICE_OK             0
50 #define TPM_DEVICE_UNRECOVERABLE  1
51 #define TPM_DEVICE_RECOVERABLE    2
52 #define TPM_DEVICE_NOT_FOUND      3
53 
54 //
55 // Prototypes for the TPM MP Driver Protocol
56 //
57 
58 /**
59   This service Open the TPM interface
60 
61   @param[in] This             A pointer to the EFI_TPM_MP_DRIVER_PROTOCOL.
62 
63   @retval  EFI_SUCCESS        Operation completed successfully
64   @retval  EFI_DEVICE_ERROR   The command was unsuccessful
65   @retval  EFI_NOT_FOUND      The component was not running
66 
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_TPM_MP_INIT) (
71   IN EFI_TPM_MP_DRIVER_PROTOCOL   *This
72   );
73 
74 /**
75   This service close the TPM interface and deactivate TPM
76 
77   @param[in] This            A pointer to the EFI_TPM_MP_DRIVER_PROTOCOL.
78 
79   @retval EFI_SUCCESS        Operation completed successfully
80   @retval EFI_DEVICE_ERROR   The command was unsuccessful
81   @retval EFI_NOT_FOUND      The component was not running
82 
83 **/
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_TPM_MP_CLOSE) (
87   IN EFI_TPM_MP_DRIVER_PROTOCOL   *This
88   );
89 
90 /**
91   This service get the current status infomation of TPM
92 
93   @param[in]  This                  A pointer to the EFI_TPM_MP_DRIVER_PROTOCOL.
94   @param[in]  ReqStatusType	        Requested type of status information, driver or device.
95   @param[in]  Status	              Pointer to the returned status.
96 
97   @retval  EFI_SUCCESS              Operation completed successfully
98   @retval  EFI_DEVICE_ERROR         The command was unsuccessful
99   @retval  EFI_INVALID_PARAMETER    One or more of the parameters are incorrect
100   @retval  EFI_BUFFER_TOO_SMALL     The receive buffer is too small
101   @retval  EFI_NOT_FOUND            The component was not running
102 
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EFI_TPM_MP_GET_STATUS_INFO) (
107   IN EFI_TPM_MP_DRIVER_PROTOCOL   *This,
108   IN UINT32				                ReqStatusType,
109   OUT UINT32				              *Status
110   );
111 
112 /**
113   This service transmit data to the TPM and get response from TPM
114 
115   @param[in] This                  A pointer to the EFI_TPM_MP_DRIVER_PROTOCOL.
116   @param[in] TransmitBuf	         Pointer to a buffer containing TPM transmit data.
117   @param[in] TransmitBufLen	       Sizeof TPM input buffer in bytes.
118   @param[in] ReceiveBuf	           Pointer to a buffer containing TPM receive data.
119   @param[in]  ReceiveBufLen	       On input, size of TPM receive buffer in bytes.
120                                    On output, number of bytes written.
121 
122   @retval  EFI_SUCCESS             Operation completed successfully
123   @retval  EFI_DEVICE_ERROR        The command was unsuccessful
124   @retval  EFI_INVALID_PARAMETER   One or more of the parameters are incorrect
125   @retval  EFI_BUFFER_TOO_SMALL    The receive buffer is too small
126   @retval  EFI_NOT_FOUND           The component was not running
127 
128 **/
129 typedef
130 EFI_STATUS
131 (EFIAPI *EFI_TPM_MP_TRANSMIT) (
132   IN EFI_TPM_MP_DRIVER_PROTOCOL   *This,
133   IN UINT8				  	            *TransmitBuffer,
134   IN UINT32			  	              TransmitBufferLen,
135   OUT UINT8				  	            *ReceiveBuf,
136   IN OUT UINT32			  	          *ReceiveBufLen
137   );
138 
139 
140 
141 typedef struct _EFI_TPM_MP_DRIVER_PROTOCOL {
142   EFI_TPM_MP_INIT			              Init;
143   EFI_TPM_MP_CLOSE			            Close;
144   EFI_TPM_MP_GET_STATUS_INFO 		    GetStatusInfo;
145   EFI_TPM_MP_TRANSMIT		            Transmit;
146 } EFI_TPM_MP_DRIVER_PROTOCOL;
147 
148 extern EFI_GUID gEfiTpmMpDriverProtocolGuid;
149 
150 #endif
151