1 /** @file
2   Definitions and function prototypes used by TPM DXE driver.
3 
4 Copyright (c) 2005 - 2010, 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 _TPM_COMM_H_
16 #define _TPM_COMM_H_
17 
18 /**
19   Add a new entry to the Event Log.
20 
21   @param[in, out] EventLogPtr   Pointer to the Event Log data.
22   @param[in, out] LogSize       Size of the Event Log.
23   @param[in]      MaxSize       Maximum size of the Event Log.
24   @param[in]      NewEventHdr   Pointer to a TCG_PCR_EVENT_HDR data structure.
25   @param[in]      NewEventData  Pointer to the new event data.
26 
27   @retval EFI_SUCCESS           The new event log entry was added.
28   @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
29 
30 **/
31 EFI_STATUS
32 TpmCommLogEvent (
33   IN OUT  UINT8                     **EventLogPtr,
34   IN OUT  UINTN                     *LogSize,
35   IN      UINTN                     MaxSize,
36   IN      TCG_PCR_EVENT_HDR         *NewEventHdr,
37   IN      UINT8                     *NewEventData
38   );
39 
40 /**
41   Extend a TPM PCR.
42 
43   @param[in]  TpmHandle       TPM handle.
44   @param[in]  DigestToExtend  The 160 bit value representing the event to be recorded.
45   @param[in]  PcrIndex        The PCR to be updated.
46   @param[out] NewPcrValue     New PCR value after extend.
47 
48   @retval EFI_SUCCESS         Operation completed successfully.
49   @retval EFI_DEVICE_ERROR    The command was unsuccessful.
50 
51 **/
52 EFI_STATUS
53 TpmCommExtend (
54   IN      TIS_TPM_HANDLE            TpmHandle,
55   IN      TPM_DIGEST                *DigestToExtend,
56   IN      TPM_PCRINDEX              PcrIndex,
57      OUT  TPM_DIGEST                *NewPcrValue
58   );
59 
60 /**
61   Get TPM capability flags.
62 
63   @param[in]  TpmHandle    TPM handle.
64   @param[in]  FlagSubcap   Flag subcap.
65   @param[out] FlagBuffer   Pointer to the buffer for returned flag structure.
66   @param[in]  FlagSize     Size of the buffer.
67 
68   @retval EFI_SUCCESS      Operation completed successfully.
69   @retval EFI_DEVICE_ERROR The command was unsuccessful.
70 
71 **/
72 EFI_STATUS
73 TpmCommGetFlags (
74   IN      TIS_TPM_HANDLE            TpmHandle,
75   IN      UINT32                    FlagSubcap,
76      OUT  VOID                      *Buffer,
77   IN      UINTN                     Size
78   );
79 
80 /**
81   Send formatted command to TPM for execution and return formatted data from response.
82 
83   @param[in] TisReg    TPM Handle.
84   @param[in] Fmt       Format control string.
85   @param[in] ...       The variable argument list.
86 
87   @retval EFI_SUCCESS  Operation completed successfully.
88   @retval EFI_TIMEOUT  The register can't run into the expected status in time.
89 
90 **/
91 EFI_STATUS
92 EFIAPI
93 TisPcExecute (
94   IN      TIS_TPM_HANDLE            TisReg,
95   IN      CONST CHAR8               *Fmt,
96   ...
97   );
98 
99 #endif  // _TPM_COMM_H_
100