summaryrefslogtreecommitdiff
path: root/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c
blob: 3f46c3e5abaf10140694accd064337222eed4779 (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
202
203
204
205
206
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (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/SharkBayRefCodes/ME/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c 1     7/27/12 5:12a Klzhan $
//
// $Revision: 1 $
//
// $Date: 7/27/12 5:12a $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c $
// 
// 1     7/27/12 5:12a Klzhan
// [TAG]  		EIPNone
// [Category]  	New Feature
// [Description]  	Add support MDES
// [Files]  		MdesStatusCode.cif
// MdesStatusCode.sdl
// MdesStatusCode.mak
// MdesStatusCodeDxe.c
// 
// 1     10/19/11 9:06a Calvinchen
// [TAG]  		EIPNone
// [Category]  	New Feature
// [Description]  	Added MDES BIOS Status Code Support.
// [Files]  		MdesStatusCode.cif
// MdesStatusCode.sdl
// MdesStatusCode.mak
// MdesStatusCodeDxe.c
// 
//
//**********************************************************************
//
//<AMI_FHDR_START>
//---------------------------------------------------------------------------
// Name:		MdesStatusCodeDxe.c
//
// Description:	Processes ASF messages for DXE.
//
//---------------------------------------------------------------------------
//<AMI_FHDR_END>
/*++

Copyright (c)  2009 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.


Module Name:

  AmtStatusCodeDxe.c

Abstract:
  Processes ASF messages

--*/

//#include "Tiano.h"
#include <AmiDxeLib.h>
#ifdef DXE_STATUS_CODE
#include <AmiDxeLib.h>
#include <token.h>
#include <Setup.h>
#include "MePlatformPolicy.h"
#include "MdesStatusCodeDxe.h"
EFI_GUID gSetupGuid = SETUP_GUID;
EFI_GUID gMdesStatusCodeProtocolGuid = MDES_STATUS_CODE_PROTOCOL_GUID;
EFI_GUID gDxePlatformMePolicyGuid = DXE_PLATFORM_ME_POLICY_GUID;
extern EFI_BOOT_SERVICES        *pBS;
#endif

VOID MdesBiosStatusCode(
    IN  VOID                        **Dummy,
    IN  EFI_STATUS_CODE_TYPE        Type,
    IN  EFI_STATUS_CODE_VALUE       Value,
    IN  UINT32                      Instance,
    IN  EFI_GUID                    *CallerId OPTIONAL,
    IN  EFI_STATUS_CODE_DATA        *Data OPTIONAL
)
/*++
Routine Description: 

  Provides an interface that a software module can call to report an ASF DXE status code.

Arguments:

  PeiServices - PeiServices pointer.

  Type     - Indicates the type of status code being reported.
  
  Value    - Describes the current status of a hardware or software entity.
             This included information about the class and subclass that is 
             used to classify the entity as well as an operation.
  
  Instance - The enumeration of a hardware or software entity within 
             the system. Valid instance numbers start with 1.
  
  CallerId - This optional parameter may be used to identify the caller.
             This parameter allows the status code driver to apply different 
             rules to different callers.
  
  Data     - This optional parameter may be used to pass additional data.

Returns: 
  
  None

--*/
{
#ifdef DXE_STATUS_CODE
    //
    // Do nothing, because AMT ASF driver will handle that.
    //
  EFI_STATUS                Status;
  MDES_STATUS_CODE_PROTOCOL *MdesStatusCodeProtocol;
  static UINTN              MdesEnable        = 0;
  static UINTN              MdesEnableChecked = 0;
  DXE_ME_POLICY_PROTOCOL   *MePlatformPolicy;

  if (MdesEnableChecked == 0) {
    Status = pBS->LocateProtocol (&gDxePlatformMePolicyGuid, NULL, &MePlatformPolicy);
    if (EFI_ERROR(Status)) {
      //
      // Check if GetVariable function has been initialized
      //
      return;
    } else {
      MdesEnableChecked = 1;
      //
      // set gfMDESCheck to 1 to lock geting variable next time
      //
      if (!(EFI_ERROR (Status))) {
        if (MePlatformPolicy->MeConfig.MdesForBiosState == 1) {
          //
          // check if function is set in BIOS Menu
          //
          MdesEnable = 1;
        }
      }
    }
  }
  if (MdesEnable == 1) {
    Status = pBS->LocateProtocol (&gMdesStatusCodeProtocolGuid, NULL, &MdesStatusCodeProtocol);
    if (EFI_ERROR (Status)) {
      return;
    }

    MdesStatusCodeProtocol->SendMdesStatusCode (Type, Value, Instance, CallerId, Data);
  }
#endif
    return ;
}

EFI_STATUS
MdesBiosStatusCodeInit(
    IN EFI_HANDLE *ImageHandle, 
    IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description: 

  Init routine for DXE ASF StatusCode.

Arguments:

  FfsHeader   - FfsHeader pointer.
  PeiServices - PeiServices pointer.

Returns: 
  
  EFI_SUCCESS      - The function completed successfully

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