summaryrefslogtreecommitdiff
path: root/Board/EM/TCG2/Common/AmiTcgPlatformDxeLib.h
blob: 349a4bb50d6f19258273db856ae62b40264d4467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2010, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**        5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093         **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//*************************************************************************
// $Header: /Alaska/SOURCE/Modules/TCG2/Common/AmiTcgPlatform/AmiTcgPlatformDxe/AmiTcgPlatformDxeLib.h 1     4/21/14 2:17p Fredericko $
//
// $Revision: 1 $
//
// $Date: 4/21/14 2:17p $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/TCG2/Common/AmiTcgPlatform/AmiTcgPlatformDxe/AmiTcgPlatformDxeLib.h $
// 
// 1     4/21/14 2:17p Fredericko
// 
// 1     10/08/13 12:04p Fredericko
// Initial Check-In for Tpm-Next module
// 
// 1     7/10/13 5:55p Fredericko
// [TAG]  		EIP120969
// [Category]  	New Feature
// [Description]  	TCG (TPM20)
// 
// 4     7/25/11 3:45a Fredericko
// [TAG]  		EIP65177
// [Category]  	Spec Update
// [Severity]  	Minor
// [Description]  	Tcg Ppi Spec ver 1.2 update
// 
// 3     4/28/11 6:34p Fredericko
// Removed VFR compile
// 
// 2     3/29/11 2:27p Fredericko
//
// 
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:	AmiTcgPlatformDxeLib.h
//
// Description:	Header firl for AmiTcgPlatformDxe library
//
//<AMI_FHDR_END>
//*************************************************************************
#include <Protocol\SmmBase.h>
#include <Protocol\SmmSwDispatch.h>
#include <token.h>
#include <Include\Acpi.h>
#include <Include\Acpi11.h>
#include <Include/Setup.h>
#include <AmiDxeLib.h>
#include <AcpiRes.h>
#include <TcgMisc.h>
#include <HOB.h>
#include "Protocol/CpuIo.h"
#include "Protocol/AcpiSupport.h"
#include "TcgPc.h"

#define TCPA_PPIOP_ENABLE                       1
#define TCPA_PPIOP_DISABLE                      2
#define TCPA_PPIOP_ACTIVATE                     3
#define TCPA_PPIOP_DEACTIVATE                   4
#define TCPA_PPIOP_CLEAR                        5
#define TCPA_PPIOP_ENABLE_ACTV                  6
#define TCPA_PPIOP_DEACT_DSBL                   7
#define TCPA_PPIOP_OWNER_ON                     8
#define TCPA_PPIOP_OWNER_OFF                    9
#define TCPA_PPIOP_ENACTVOWNER                  10
#define TCPA_PPIOP_DADISBLOWNER                 11
#define TCPA_PPIOP_UNOWNEDFIELDUPGRADE          12
#define TCPA_PPIOP_SETOPAUTH                    13
#define TCPA_PPIOP_CLEAR_ENACT                  14
#define TCPA_PPIOP_SETNOPPIPROVISION_FALSE      15
#define TCPA_PPIOP_SETNOPPIPROVISION_TRUE       16
#define TCPA_PPIOP_SETNOPPICLEAR_FALSE          17
#define TCPA_PPIOP_SETNOPPICLEAR_TRUE           18
#define TCPA_PPIOP_SETNOPPIMAINTENANCE_FALSE    19
#define TCPA_PPIOP_SETNOPPIMAINTENANCE_TRUE     20
#define TCPA_PPIOP_ENABLE_ACTV_CLEAR            21
#define TCPA_PPIOP_ENABLE_ACTV_CLEAR_ENABLE_ACTV   22
#define EFI_TPL_DRIVER           6

#define TCGAML_PR_BYTE      0x0A
#define TCGAML_PR_WORD      0x0B
#define TCGAML_PR_DWORD     0x0C
#define TCGAML_PR_QWORD     0x0E
#define TCGAML_ZERO_OP      0x00
#define TCGAML_ONE_OP       0x01

//Opcode Definition for Name Object
#define TCGAML_OP_ALIAS     0x06
#define TCGAML_OP_NAME      0x08
#define TCGAML_OP_SCOPE     0x10
#define TCGAML_OP_ALIAS     0x06
#define TCGAML_OP_NAME      0x08
#define TCGAML_OP_SCOPE     0x10
#define TCGAML_OP_BUFFER    0x11
#define TCGAML_OP_PACKAGE   0x12
#define TCGAML_OP_VARPACK   0x13
#define TCGAML_OP_METHOD    0x14
#define TCGAML_PR_EXTOP     0x5B    //'['
#define TCGAML_PR_PARENT    0x5E    //'^'
#define TCGAML_PR_ROOT      0x5C    //'\'

#define TCGAML_OP_RETURN    0xA4

#define TCGAML_OP_OPREG     0x80
#define TCGAML_OP_DEVICE    0x82
#define TCGAML_OP_PROC      0x83
#define TCGAML_OP_PWRRES    0x84
#define TCGAML_OP_THERMAL   0x85

#ifndef SMBIOS_WAKEUP_TYPE_UNKNOWN
#define SMBIOS_WAKEUP_TYPE_UNKNOWN      0x02
#endif
#ifndef SMBIOS_WAKEUP_TYPE_POWER_SWITCH
#define SMBIOS_WAKEUP_TYPE_POWER_SWITCH     0x06
#endif

#define AMI_TPM_HARDWARE_PRESET        0
#define AMI_TPM_HARDWARE_NOTPRESET     1
#define AMI_TPM_HARDWARE_SETUP_REQUEST_ERROR     1


EFI_STATUS GetDsdt(
    IN OUT mem_in *dsdt );

EFI_STATUS getSetupData (
    SETUP_DATA** ppsd,
    UINT32    * pattr,
    UINTN     * psz );

EFI_STATUS GetTcgWakeEventType(
    IN OUT UINT8 *pWake  );

EFI_STATUS UpDateASL(
    IN UINT8 TcgSupport );

UINT8 ReadPpiRequest( );

void Update_PpiVar(
    IN UINT8 value );

void WritePpiResult(
    IN UINT8  last_op,
    IN UINT16 status );

VOID* LocateATcgHob(
    IN UINTN                   NoTableEntries,
    IN EFI_CONFIGURATION_TABLE *ConfigTable,
    IN EFI_GUID                *HOB_guid );


#if TPM_PASSWORD_AUTHENTICATION
BOOLEAN check_authenticate_set();

BOOLEAN check_user_is_administrator( );
#endif


EFI_STATUS readTpmSetup(
    IN OUT UINT8* enable_old,
    IN OUT UINT8* enable,
    IN OUT UINT8* operation,
    IN OUT UINT8* support );


EFI_STATUS UpdateTpmSetup(
    IN UINT8 enabled,
    IN UINT8 op );

EFI_STATUS UpdateTpmCapSetup(
    IN UINT8 EnaDis,
    IN UINT8 ActDeact,
    IN UINT8 OwnUnOwned,
    IN UINT8 Hardware,
    IN UINT8 TpmError);
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2010, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**     5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093            **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************