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"
19 Report status code to all supported device.
20 Calls into the workers which dispatches the platform specific
23 @param Type Indicates the type of status code being reported.
24 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
25 @param Value Describes the current status of a hardware or software entity.
26 This includes information about the class and subclass that is used to classify the entity
27 as well as an operation. For progress codes, the operation is the current activity.
28 For error codes, it is the exception. For debug codes, it is not defined at this time.
29 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
30 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
31 @param Instance The enumeration of a hardware or software entity within the system.
32 A system may contain multiple entities that match a class/subclass pairing.
33 The instance differentiates between them. An instance of 0 indicates that instance
34 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
35 @param CallerId This optional parameter may be used to identify the caller.
36 This parameter allows the status code driver to apply different rules to different callers.
37 @param Data This optional parameter may be used to pass additional data.
38 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
39 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
40 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
42 @return Always return EFI_SUCCESS.
48 IN EFI_STATUS_CODE_TYPE Type
,
49 IN EFI_STATUS_CODE_VALUE Value
,
51 IN EFI_GUID
*CallerId OPTIONAL
,
52 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
56 // Declaration of status code protocol.
59 EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol
= {
64 // Delaration of DXE status code controller
66 DXE_STATUS_CODE_CONTROLLER gDxeStatusCode
= {
68 // Initialize nest status as non nested.
76 Install the ReportStatusCode runtime service.
78 @param ImageHandle Image handle of the loaded driver
79 @param SystemTable Pointer to the System Table
81 @return The function always returns success.
85 DxeStatusCodeDriverEntry (
86 IN EFI_HANDLE ImageHandle
,
87 IN EFI_SYSTEM_TABLE
*SystemTable
90 EFI_HANDLE Handle
= NULL
;
94 // Dispatch initialization request to supported devices
96 InitializationDispatcherWorker ();
99 // Install Status Code Architectural Protocol implementation as defined in Tiano
100 // Architecture Specification.
102 Status
= gBS
->InstallMultipleProtocolInterfaces (
104 &gEfiStatusCodeRuntimeProtocolGuid
,
105 &mEfiStatusCodeProtocol
,
108 ASSERT_EFI_ERROR (Status
);
114 Report status code to all supported device.
115 Calls into the workers which dispatches the platform specific
118 @param CodeType Indicates the type of status code being reported.
119 The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
120 @param Value Describes the current status of a hardware or software entity.
121 This includes information about the class and subclass that is used to classify the entity
122 as well as an operation. For progress codes, the operation is the current activity.
123 For error codes, it is the exception. For debug codes, it is not defined at this time.
124 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
125 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
126 @param Instance The enumeration of a hardware or software entity within the system.
127 A system may contain multiple entities that match a class/subclass pairing.
128 The instance differentiates between them. An instance of 0 indicates that instance
129 information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
130 @param CallerId This optional parameter may be used to identify the caller.
131 This parameter allows the status code driver to apply different rules to different callers.
132 @param Data This optional parameter may be used to pass additional data.
133 Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
134 The contents of this data type may have additional GUID-specific data. The standard GUIDs and
135 their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
137 @return Always return EFI_SUCCESS.
143 IN EFI_STATUS_CODE_TYPE CodeType
,
144 IN EFI_STATUS_CODE_VALUE Value
,
146 IN EFI_GUID
*CallerId OPTIONAL
,
147 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
151 // Use atom operation to avoid the reentant of report.
152 // If current status is not zero, then the function is reentrancy.
154 if (1 == InterlockedCompareExchange32 (&gDxeStatusCode
.StatusCodeNestStatus
, 0, 1)) {
155 return EFI_DEVICE_ERROR
;
158 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
) || FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
159 SerialStatusCodeReportWorker (
167 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
168 RtMemoryStatusCodeReportWorker (
169 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
175 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
176 DataHubStatusCodeReportWorker (
184 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
185 OemHookStatusCodeReport (
195 // Restore the nest status of report
197 InterlockedCompareExchange32 (&gDxeStatusCode
.StatusCodeNestStatus
, 1, 0);
204 Virtual address change notification call back. It converts global pointer
207 @param Event Event whose notification function is being invoked.
208 @param Context Pointer to the notification function's context, which is
209 always zero in current implementation.
214 VirtualAddressChangeCallBack (
220 // Convert memory status code table to virtual address;
224 (VOID
**) &gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
]