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 Header file of EFI DXE/RT Status Code.
22 #ifndef __DXE_STATUS_CODE_H__
23 #define __DXE_STATUS_CODE_H__
26 // The package level header files this module uses
28 #include <FrameworkDxe.h>
30 // The protocols, PPI and GUID defintions for this module
32 #include <Guid/StatusCode.h>
33 #include <Protocol/DataHub.h>
34 #include <Protocol/SerialIo.h>
35 #include <Guid/MemoryStatusCodeRecord.h>
36 #include <Protocol/StatusCode.h>
37 #include <Guid/StatusCodeDataTypeId.h>
39 // The Library classes this module consumes
41 #include <Library/BaseLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/DebugLib.h>
44 #include <Library/ReportStatusCodeLib.h>
45 #include <Library/PrintLib.h>
46 #include <Library/PcdLib.h>
47 #include <Library/HobLib.h>
48 #include <Library/UefiDriverEntryPoint.h>
49 #include <Library/UefiBootServicesTableLib.h>
50 #include <Library/UefiLib.h>
51 #include <Library/MemoryAllocationLib.h>
52 #include <Library/UefiRuntimeLib.h>
53 #include <Library/SerialPortLib.h>
54 #include <Library/OemHookStatusCodeLib.h>
57 // Data hub worker definition
59 #define MAX_NUMBER_DATAHUB_RECORDS 1000
60 #define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
61 #define EMPTY_RECORD_TAG 0xFF
62 #define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
65 // Address type of pointer.
66 // The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
67 // Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
78 UINT8 Data
[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD
) + EFI_STATUS_CODE_DATA_MAX_SIZE
];
79 } DATAHUB_STATUSCODE_RECORD
;
83 // Runtime memory status code worker definition
87 UINT32 NumberOfRecords
;
88 UINT32 MaxRecordsNumber
;
89 } RUNTIME_MEMORY_STATUSCODE_HEADER
;
94 // Report operation nest status.
95 // If it is set, then the report operation has nested.
97 UINT32 StatusCodeNestStatus
;
99 // Runtime status code management header, the records buffer is following it.
101 RUNTIME_MEMORY_STATUSCODE_HEADER
*RtMemoryStatusCodeTable
[2];
102 } DXE_STATUS_CODE_CONTROLLER
;
107 Dispatch initialization request to sub status code devices based on
108 customized feature flags.
112 InitializationDispatcherWorker (
118 Initialize serial status code worker.
120 @return The function always return EFI_SUCCESS
124 EfiSerialStatusCodeInitializeWorker (
130 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
132 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
134 @param Value Describes the current status of a hardware or software entity.
135 This included information about the class and subclass that is used to classify the entity
136 as well as an operation. For progress codes, the operation is the current activity.
137 For error codes, it is the exception. For debug codes, it is not defined at this time.
138 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
139 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
141 @param Instance The enumeration of a hardware or software entity within the system.
142 A system may contain multiple entities that match a class/subclass pairing.
143 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
144 not meaningful, or not relevant. Valid instance numbers start with 1.
147 @param CallerId This optional parameter may be used to identify the caller.
148 This parameter allows the status code driver to apply different rules to different callers.
149 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
152 @param Data This optional parameter may be used to pass additional data
154 @retval EFI_SUCCESS Success to report status code to serial I/O.
155 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
159 SerialStatusCodeReportWorker (
160 IN EFI_STATUS_CODE_TYPE CodeType
,
161 IN EFI_STATUS_CODE_VALUE Value
,
163 IN EFI_GUID
*CallerId
,
164 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
168 Initialize runtime memory status code.
170 @return The function always return EFI_SUCCESS
174 RtMemoryStatusCodeInitializeWorker (
179 Report status code into runtime memory. If the runtime pool is full, roll back to the
180 first record and overwrite it.
182 @param RtMemoryStatusCodeTable
183 Point to Runtime memory table header.
185 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
187 @param Value Describes the current status of a hardware or software entity.
188 This included information about the class and subclass that is used to classify the entity
189 as well as an operation. For progress codes, the operation is the current activity.
190 For error codes, it is the exception. For debug codes, it is not defined at this time.
191 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
192 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
194 @param Instance The enumeration of a hardware or software entity within the system.
195 A system may contain multiple entities that match a class/subclass pairing.
196 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
197 not meaningful, or not relevant. Valid instance numbers start with 1.
199 @return The function always return EFI_SUCCESS.
203 RtMemoryStatusCodeReportWorker (
204 RUNTIME_MEMORY_STATUSCODE_HEADER
*RtMemoryStatusCodeTable
,
205 IN EFI_STATUS_CODE_TYPE CodeType
,
206 IN EFI_STATUS_CODE_VALUE Value
,
211 Initialize data hubstatus code.
212 Create a data hub listener.
214 @return The function always return EFI_SUCCESS
218 DataHubStatusCodeInitializeWorker (
224 Report status code into DataHub.
226 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
228 @param Value Describes the current status of a hardware or software entity.
229 This included information about the class and subclass that is used to classify the entity
230 as well as an operation. For progress codes, the operation is the current activity.
231 For error codes, it is the exception. For debug codes, it is not defined at this time.
232 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
233 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
235 @param Instance The enumeration of a hardware or software entity within the system.
236 A system may contain multiple entities that match a class/subclass pairing.
237 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
238 not meaningful, or not relevant. Valid instance numbers start with 1.
241 @param CallerId This optional parameter may be used to identify the caller.
242 This parameter allows the status code driver to apply different rules to different callers.
243 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
246 @param Data This optional parameter may be used to pass additional data
248 @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
249 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
250 @retval EFI_SUCCESS Success to cache status code and signal log data event.
254 DataHubStatusCodeReportWorker (
255 IN EFI_STATUS_CODE_TYPE CodeType
,
256 IN EFI_STATUS_CODE_VALUE Value
,
258 IN EFI_GUID
*CallerId
,
259 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
264 // Declaration for callback Event.
268 VirtualAddressChangeCallBack (
274 // Declaration for original Entry Point.
278 DxeStatusCodeDriverEntry (
279 IN EFI_HANDLE ImageHandle
,
280 IN EFI_SYSTEM_TABLE
*SystemTable
284 // declaration of DXE status code controller.
286 extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode
;