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
|
//*************************************************************************
//*************************************************************************
//** **
//** (C)Copyright 1985-2011, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//*************************************************************************
//*************************************************************************
//**********************************************************************
// $Header: /Alaska/SOURCE/Modules/TCG2/Common/TpmClearOnRollback/TpmClearOnRollbackSmiFlash.c 1 4/21/14 2:18p Fredericko $
//
// $Revision: 1 $
//
// $Date: 4/21/14 2:18p $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/TCG2/Common/TpmClearOnRollback/TpmClearOnRollbackSmiFlash.c $
//
// 1 4/21/14 2:18p Fredericko
//
// 1 10/08/13 12:06p Fredericko
// Initial Check-In for Tpm-Next module
//
// 1 7/10/13 5:57p Fredericko
// [TAG] EIP120969
// [Category] New Feature
// [Description] TCG (TPM20)
//**********************************************************************
//<AMI_FHDR_START>
//---------------------------------------------------------------------------
// Name:
//
//
//
//---------------------------------------------------------------------------
//<AMI_FHDR_END>
#include "TpmClearOnRollback.h"
#include <Protocol/AmiPostMgr.h>
CLEAR_TPM_ROLLBACK_PROTOCOL *PrivateProtocol;
EFI_SMM_SYSTEM_TABLE2 *mSmst;
static FW_VERSION Fid;
UINT8 SmiFlashClearTpmBeforeFlash (){
return(ClearTpmBeforeFlash());
}
//**********************************************************************
//<AMI_PHDR_START>
//
// Procedure: InstallTpmClearProtocolInSmm
//
// Description: InstallTcgSmmFlash Protocol
//
//
// Input: IN EFI_HANDLE ImageHandle,
// IN EFI_SYSTEM_TABLE *SystemTable
//
// Output: EFI_STATUS
//
// Modified:
//
// Referrals:
//
// Notes:
//<AMI_PHDR_END>
//**********************************************************************
EFI_STATUS InstallTpmClearProtocolInSmm(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable )
{
EFI_SMM_BASE2_PROTOCOL *SmmBase;
EFI_HANDLE Handle=NULL;
EFI_STATUS Status;
EFI_GUID TpmRollbackSmmGuid = \
AMI_TPM_ROLLBACK_SMM_PROTOCOL_GUID;
Status = pBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, &SmmBase);
if((EFI_ERROR(Status)) || (SmmBase == NULL)){
return Status;
}
Status = SmmBase->GetSmstLocation(SmmBase, &mSmst);
if(EFI_ERROR(Status)){
return Status;
}
Status = mSmst->SmmAllocatePool (
EfiRuntimeServicesData,
sizeof (CLEAR_TPM_ON_ROLLBACK),
&PrivateProtocol
);
if((EFI_ERROR(Status)) || (PrivateProtocol == NULL)){
return Status;
}
TpmRecoveryGetFidFromFv(&Fid);
PrivateProtocol->ClearTpmOnRollBack = (VOID *)&SmiFlashClearTpmBeforeFlash;
Status = mSmst->SmmInstallProtocolInterface( &Handle, \
&TpmRollbackSmmGuid, \
EFI_NATIVE_INTERFACE, \
PrivateProtocol );
return Status;
}
//****************************************************** ****************
//<AMI_PHDR_START>
//
// Procedure: TpmClearRollBackSmmInit
//
// Description: Entry point for subcomponent
//
// Input: IN EFI_HANDLE ImageHandle,
// IN EFI_SYSTEM_TABLE *SystemTable
//
// Output: EFI_STATUS
//
// Modified:
//
// Referrals:
//
// Notes:
//
//<AMI_PHDR_END>
//**********************************************************************
EFI_STATUS TpmClearRollBackSmmInit(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable )
{
InitAmiLib( ImageHandle, SystemTable );
return InitSmmHandler( ImageHandle, SystemTable, InstallTpmClearProtocolInSmm, NULL );
}
//*************************************************************************
//*************************************************************************
//** **
//** (C)Copyright 1985-2010, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//*************************************************************************
//*************************************************************************
|