summaryrefslogtreecommitdiff
path: root/Board/EM/TCG2/Common/TcgDxeplatform.c
blob: 520c0f9c84d84665474517016e70d004efaec0f5 (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
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (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/TcgDxeplatform/TcgDxeplatform.c 1     4/21/14 2:17p Fredericko $
//
// $Revision: 1 $
//
// $Date: 4/21/14 2:17p $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/TCG2/Common/TcgDxeplatform/TcgDxeplatform.c $
// 
// 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:56p Fredericko
// [TAG]  		EIP120969
// [Category]  	New Feature
// [Description]  	TCG (TPM20)
// 
// 5     1/20/12 9:14p Fredericko
// 
// 4     4/04/11 2:16p Fredericko
// Removed #pragma optimization directives
// 
// 3     4/01/11 9:39a Fredericko
// Updated function Header
// 
// 2     3/29/11 1:21p Fredericko
// [TAG]        EIP 54642
// [Category] Improvement
// [Description] 1. Checkin Files related to TCG function override 
// 2. Include TCM and TPM auto detection
// [Files] Affects all TCG files
//
//
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:	TcgDxeplatform.c
//
// Description:	Function file for TcgDxeplatform
//
//<AMI_FHDR_END>
//*************************************************************************
#include<EFI.h>
#include "AmiTcgPlatformDxe.h"


EFI_GUID gAmiTcgPlatformProtocolguid     = AMI_TCG_PLATFORM_PROTOCOL_GUID;


//**********************************************************************
//<AMI_PHDR_START>
//
// Procedure:   TcgDxeplatformEntry
//
// Description: 
//
// Input:       IN EFI_HANDLE       ImageHandle,
//              IN EFI_SYSTEM_TABLE *SystemTable
//
// Output:      EFI_STATUS
//
// Modified:
//
// Referrals:
//
// Notes:
//<AMI_PHDR_END>
//**********************************************************************
EFI_STATUS
EFIAPI TcgDxeplatformEntry(
  IN EFI_HANDLE       ImageHandle,
  IN EFI_SYSTEM_TABLE *SystemTable ){

    AMI_TCG_PLATFORM_PROTOCOL  *AmiTcgPlatformProtocol = NULL;
    EFI_STATUS                 Status;
    BOOLEAN                    *ResetAllTcgVar = NULL;
    EFI_GUID                   legTcgGuid = AMI_TCG_RESETVAR_HOB_GUID;
    void                       ** DummyPtr;

    InitAmiLib( ImageHandle, SystemTable );

    DummyPtr       = &ResetAllTcgVar;
    ResetAllTcgVar = (UINT8*)LocateATcgHob(
        pST->NumberOfTableEntries,
        pST->ConfigurationTable,
        &legTcgGuid );

    Status = pBS->LocateProtocol( &gAmiTcgPlatformProtocolguid, NULL, 
                                            &AmiTcgPlatformProtocol);

    DummyPtr = &ResetAllTcgVar;

    if ( *DummyPtr != NULL )
    {
        //if ResetAllTcgVar, call setAllTcgVariable to zero
        if ( *ResetAllTcgVar == TRUE )
        {
            AmiTcgPlatformProtocol->ResetOSTcgVar();
        }
    }
  
    if(EFI_ERROR(Status)){
        return EFI_SUCCESS;
    }   


    Status = AmiTcgPlatformProtocol->ProcessTcgPpiRequest();
    if(EFI_ERROR(Status)){
      TRACE((TRACE_ALWAYS, "\n Possible ERROR Processing Ppi Request from O.S.\n"));
    }

    Status = AmiTcgPlatformProtocol->ProcessTcgSetup();
    if(EFI_ERROR(Status)){
      TRACE((TRACE_ALWAYS, "\n Possible ERROR Processing Tcg Setup\n"));
    }

#if (defined(MeasureCPUMicrocodeToken) && (MeasureCPUMicrocodeToken == 1))
    Status = AmiTcgPlatformProtocol->MeasureCpuMicroCode();
    if(EFI_ERROR(Status)){
        TRACE((TRACE_ALWAYS, "\n Possible ERROR Measuring CPU Microde\n"));
    }
#endif

    Status = AmiTcgPlatformProtocol->MeasurePCIOproms();
    if(EFI_ERROR(Status)){
        TRACE((TRACE_ALWAYS, "\n Possible ERROR Measuring PCI Option Roms\n"));
    }
    
    Status = AmiTcgPlatformProtocol->SetTcgReadyToBoot();
    if(EFI_ERROR(Status)){
      TRACE((TRACE_ALWAYS, "\n Possible ERROR process Tcg Ready to boot Callback\n"));
    }

    return Status;   
}


//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2010, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**     5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093            **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
//**********************************************************************