3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Contains NT32 specific implementations required to use status codes.
22 #include "MonoStatusCode.h"
25 BOOLEAN gRunningFromMemory
= FALSE
;
27 // Platform definitions
29 EFI_PEI_REPORT_STATUS_CODE mSecReportStatusCode
= NULL
;
31 extern EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi
;
34 // Function implementations
38 PlatformReportStatusCode (
39 IN EFI_PEI_SERVICES
**PeiServices
,
40 IN EFI_STATUS_CODE_TYPE CodeType
,
41 IN EFI_STATUS_CODE_VALUE Value
,
43 IN EFI_GUID
* CallerId
,
44 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
50 Call all status code listeners in the MonoStatusCode.
54 Same as ReportStatusCode service
58 EFI_SUCCESS Always returns success.
62 if (mSecReportStatusCode
!= NULL
) {
63 mSecReportStatusCode (PeiServices
, CodeType
, Value
, Instance
, CallerId
, Data
);
65 MemoryReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
70 PlatformInitializeStatusCode (
71 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
72 IN EFI_PEI_SERVICES
**PeiServices
78 Initialize the status code listeners. This consists of locating the
79 listener produced by SecMain.exe.
83 FfsHeader - FV this PEIM was loaded from.
84 PeiServices - General purpose services available to every PEIM.
93 EFI_PEI_PROGRESS_CODE_PPI
*ReportStatusCodePpi
;
94 EFI_PEI_PPI_DESCRIPTOR
*ReportStatusCodeDescriptor
;
97 // Cache the existing status code listener installed by the SEC core.
98 // We should actually do a heap allocate, install a PPI, etc, but since we
99 // know that we are running from a DLL, we can use global variables, and
100 // directly update the status code PPI descriptor
103 // Locate SEC status code PPI
105 Status
= (*PeiServices
)->LocatePpi (
107 &gEfiPeiStatusCodePpiGuid
,
109 &ReportStatusCodeDescriptor
,
112 if (EFI_ERROR (Status
)) {
116 mSecReportStatusCode
= ReportStatusCodePpi
->ReportStatusCode
;
117 ReportStatusCodeDescriptor
->Ppi
= &mStatusCodePpi
;
120 // Always initialize memory status code listener.
122 MemoryStatusCodeInitialize (FfsHeader
, PeiServices
);
128 InstallMonoStatusCode (
129 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
130 IN EFI_PEI_SERVICES
**PeiServices
136 Install the PEIM. Publish the DXE callback as well.
140 FfsHeader - FV this PEIM was loaded from.
141 PeiServices - General purpose services available to every PEIM.
145 EFI_SUCCESS The function always returns success.
149 if (!gRunningFromMemory
) {
151 // First pass, running from flash, initialize everything
153 InitializeMonoStatusCode (FfsHeader
, PeiServices
);
156 // Second pass, running from memory, initialize memory listener and
157 // publish the DXE listener in a HOB.
159 MemoryStatusCodeInitialize (FfsHeader
, PeiServices
);
160 InitializeDxeReportStatusCode (PeiServices
);