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.
14 RtPlatformStatusCode.c
18 Contains NT32 specific implementations required to use status codes.
23 // Statements that include other files.
26 #include "EfiCommonLib.h"
27 #include "EfiRuntimeLib.h"
28 #include "EfiStatusCode.h"
29 #include "EfiHobLib.h"
30 #include "RtMemoryStatusCodeLib.h"
31 #include "BsDataHubStatusCodeLib.h"
36 #include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)
41 #include EFI_GUID_DEFINITION (Hob)
44 // Globals only work at BootService Time. NOT at Runtime!
46 EFI_REPORT_STATUS_CODE mPeiReportStatusCode
;
49 // Function implementations
53 RtPlatformReportStatusCode (
54 IN EFI_STATUS_CODE_TYPE CodeType
,
55 IN EFI_STATUS_CODE_VALUE Value
,
57 IN EFI_GUID
* CallerId
,
58 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
64 Call all status code listeners in the MonoStatusCode.
68 Same as ReportStatusCode service
72 EFI_SUCCESS Always returns success.
76 RtMemoryReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
77 if (EfiAtRuntime ()) {
79 // For now all we do is post code at runtime
84 BsDataHubReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
87 // Call back into PEI to get status codes. This is because SecMain contains
88 // status code that reports to Win32.
90 if (mPeiReportStatusCode
!= NULL
) {
91 return mPeiReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
99 RtPlatformInitializeStatusCode (
100 IN EFI_HANDLE ImageHandle
,
101 IN EFI_SYSTEM_TABLE
*SystemTable
107 Initialize the status code listeners.
111 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
123 RtMemoryInitializeStatusCode (ImageHandle
, SystemTable
);
124 BsDataHubInitializeStatusCode (ImageHandle
, SystemTable
);
127 // Play any prior status codes to the data hub.
129 PlaybackStatusCodes (BsDataHubReportStatusCode
);
132 // If PEI has a ReportStatusCode callback find it and use it before StdErr
135 mPeiReportStatusCode
= NULL
;
137 Status
= EfiLibGetSystemConfigurationTable (&gEfiHobListGuid
, &HobList
);
138 if (!EFI_ERROR (Status
)) {
139 Status
= GetNextGuidHob (&HobList
, &gEfiStatusCodeRuntimeProtocolGuid
, &Pointer
, NULL
);
140 if (!EFI_ERROR (Status
)) {
141 mPeiReportStatusCode
= (EFI_REPORT_STATUS_CODE
) (*(UINTN
*) Pointer
);