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
54 RtPlatformReportStatusCode (
55 IN EFI_STATUS_CODE_TYPE CodeType
,
56 IN EFI_STATUS_CODE_VALUE Value
,
58 IN EFI_GUID
* CallerId
,
59 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
65 Call all status code listeners in the MonoStatusCode.
69 Same as ReportStatusCode service
73 EFI_SUCCESS Always returns success.
77 RtMemoryReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
78 if (EfiAtRuntime ()) {
80 // For now all we do is post code at runtime
85 BsDataHubReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
88 // Call back into PEI to get status codes. This is because SecMain contains
89 // status code that reports to Win32.
91 if (mPeiReportStatusCode
!= NULL
) {
92 return mPeiReportStatusCode (CodeType
, Value
, Instance
, CallerId
, Data
);
101 RtPlatformInitializeStatusCode (
102 IN EFI_HANDLE ImageHandle
,
103 IN EFI_SYSTEM_TABLE
*SystemTable
109 Initialize the status code listeners.
113 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
125 RtMemoryInitializeStatusCode (ImageHandle
, SystemTable
);
126 BsDataHubInitializeStatusCode (ImageHandle
, SystemTable
);
129 // Play any prior status codes to the data hub.
131 PlaybackStatusCodes (BsDataHubReportStatusCode
);
134 // If PEI has a ReportStatusCode callback find it and use it before StdErr
137 mPeiReportStatusCode
= NULL
;
139 Status
= EfiLibGetSystemConfigurationTable (&gEfiHobListGuid
, &HobList
);
140 if (!EFI_ERROR (Status
)) {
141 Status
= GetNextGuidHob (&HobList
, &gEfiStatusCodeRuntimeProtocolGuid
, &Pointer
, NULL
);
142 if (!EFI_ERROR (Status
)) {
143 mPeiReportStatusCode
= (EFI_REPORT_STATUS_CODE
) (*(UINTN
*) Pointer
);