2 Status code driver for IA32/X64/EBC architecture.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DxeStatusCode.h"
18 // Event for Exit Boot Services Callback
20 STATIC EFI_EVENT mExitBootServicesEvent
= NULL
;
23 Report status code to all supported device.
24 Calls into the workers which dispatches the platform specific
27 @param Type Indicates the type of status code being reported.
28 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
29 @param Value Describes the current status of a hardware or software entity.
30 This includes information about the class and subclass that is used to classify the entity
31 as well as an operation. For progress codes, the operation is the current activity.
32 For error codes, it is the exception. For debug codes, it is not defined at this time.
33 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
34 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
35 @param Instance The enumeration of a hardware or software entity within the system.
36 A system may contain multiple entities that match a class/subclass pairing.
37 The instance differentiates between them. An instance of 0 indicates that instance
38 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
39 @param CallerId This optional parameter may be used to identify the caller.
40 This parameter allows the status code driver to apply different rules to different callers.
41 @param Data This optional parameter may be used to pass additional data.
42 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
43 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
44 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
46 @return Always return EFI_SUCCESS.
52 IN EFI_STATUS_CODE_TYPE Type
,
53 IN EFI_STATUS_CODE_VALUE Value
,
55 IN EFI_GUID
*CallerId OPTIONAL
,
56 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
60 // Declaration of status code protocol.
63 EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol
= {
68 // Delaration of DXE status code controller
70 DXE_STATUS_CODE_CONTROLLER gDxeStatusCode
= {
72 // Initialize nest status as non nested.
80 Install the ReportStatusCode runtime service.
82 @param ImageHandle Image handle of the loaded driver
83 @param SystemTable Pointer to the System Table
85 @return The function always returns success.
89 DxeStatusCodeDriverEntry (
90 IN EFI_HANDLE ImageHandle
,
91 IN EFI_SYSTEM_TABLE
*SystemTable
94 EFI_HANDLE Handle
= NULL
;
98 // Dispatch initialization request to supported devices
100 InitializationDispatcherWorker ();
103 // Install Status Code Architectural Protocol implementation as defined in Tiano
104 // Architecture Specification.
106 Status
= gBS
->InstallMultipleProtocolInterfaces (
108 &gEfiStatusCodeRuntimeProtocolGuid
,
109 &mEfiStatusCodeProtocol
,
112 ASSERT_EFI_ERROR (Status
);
114 Status
= gBS
->CreateEvent (
115 EVT_SIGNAL_EXIT_BOOT_SERVICES
,
117 VirtualAddressChangeCallBack
,
119 &mExitBootServicesEvent
121 ASSERT_EFI_ERROR (Status
);
127 Report status code to all supported device.
128 Calls into the workers which dispatches the platform specific
131 @param CodeType Indicates the type of status code being reported.
132 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
133 @param Value Describes the current status of a hardware or software entity.
134 This includes information about the class and subclass that is used to classify the entity
135 as well as an operation. For progress codes, the operation is the current activity.
136 For error codes, it is the exception. For debug codes, it is not defined at this time.
137 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
138 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
139 @param Instance The enumeration of a hardware or software entity within the system.
140 A system may contain multiple entities that match a class/subclass pairing.
141 The instance differentiates between them. An instance of 0 indicates that instance
142 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
143 @param CallerId This optional parameter may be used to identify the caller.
144 This parameter allows the status code driver to apply different rules to different callers.
145 @param Data This optional parameter may be used to pass additional data.
146 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
147 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
148 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
150 @return Always return EFI_SUCCESS.
156 IN EFI_STATUS_CODE_TYPE CodeType
,
157 IN EFI_STATUS_CODE_VALUE Value
,
159 IN EFI_GUID
*CallerId OPTIONAL
,
160 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
164 // Use atom operation to avoid the reentant of report.
165 // If current status is not zero, then the function is reentrancy.
167 if (1 == InterlockedCompareExchange32 (&gDxeStatusCode
.StatusCodeNestStatus
, 0, 1)) {
168 return EFI_DEVICE_ERROR
;
171 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
) || FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
172 SerialStatusCodeReportWorker (
180 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
181 RtMemoryStatusCodeReportWorker (
182 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
188 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
189 DataHubStatusCodeReportWorker (
197 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
198 OemHookStatusCodeReport (
208 // Restore the nest status of report
210 InterlockedCompareExchange32 (&gDxeStatusCode
.StatusCodeNestStatus
, 1, 0);
217 Virtual address change notification call back. It converts global pointer
220 @param Event Event whose notification function is being invoked.
221 @param Context Pointer to the notification function's context, which is
222 always zero in current implementation.
227 VirtualAddressChangeCallBack (
233 // Convert memory status code table to virtual address;
237 (VOID
**) &gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
]