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 #ifndef __DXE_STATUS_CODE_H__
15 #define __DXE_STATUS_CODE_H__
18 // The package level header files this module uses
20 #include <FrameworkDxe.h>
22 // The protocols, PPI and GUID defintions for this module
24 #include <Guid/StatusCode.h>
25 #include <Protocol/DataHub.h>
26 #include <Protocol/SerialIo.h>
27 #include <Guid/MemoryStatusCodeRecord.h>
28 #include <Protocol/StatusCode.h>
29 #include <Guid/StatusCodeDataTypeId.h>
31 // The Library classes this module consumes
33 #include <Library/BaseLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/DebugLib.h>
36 #include <Library/ReportStatusCodeLib.h>
37 #include <Library/PrintLib.h>
38 #include <Library/PcdLib.h>
39 #include <Library/HobLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/UefiBootServicesTableLib.h>
42 #include <Library/UefiLib.h>
43 #include <Library/MemoryAllocationLib.h>
44 #include <Library/UefiRuntimeLib.h>
45 #include <Library/SerialPortLib.h>
46 #include <Library/OemHookStatusCodeLib.h>
49 // Data hub worker definition
51 #define MAX_NUMBER_DATAHUB_RECORDS 1000
52 #define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
53 #define EMPTY_RECORD_TAG 0xFF
54 #define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
57 // Address type of pointer.
58 // The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
59 // Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
70 UINT8 Data
[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD
) + EFI_STATUS_CODE_DATA_MAX_SIZE
];
71 } DATAHUB_STATUSCODE_RECORD
;
75 // Runtime memory status code worker definition
79 UINT32 NumberOfRecords
;
80 UINT32 MaxRecordsNumber
;
81 } RUNTIME_MEMORY_STATUSCODE_HEADER
;
86 // Report operation nest status.
87 // If it is set, then the report operation has nested.
89 UINT32 StatusCodeNestStatus
;
91 // Runtime status code management header, the records buffer is following it.
93 RUNTIME_MEMORY_STATUSCODE_HEADER
*RtMemoryStatusCodeTable
[2];
94 } DXE_STATUS_CODE_CONTROLLER
;
99 Dispatch initialization request to sub status code devices based on
100 customized feature flags.
104 InitializationDispatcherWorker (
110 Initialize serial status code worker.
112 @return The function always return EFI_SUCCESS
116 EfiSerialStatusCodeInitializeWorker (
122 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
124 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
126 @param Value Describes the current status of a hardware or software entity.
127 This included information about the class and subclass that is used to classify the entity
128 as well as an operation. For progress codes, the operation is the current activity.
129 For error codes, it is the exception. For debug codes, it is not defined at this time.
130 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
131 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
133 @param Instance The enumeration of a hardware or software entity within the system.
134 A system may contain multiple entities that match a class/subclass pairing.
135 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
136 not meaningful, or not relevant. Valid instance numbers start with 1.
139 @param CallerId This optional parameter may be used to identify the caller.
140 This parameter allows the status code driver to apply different rules to different callers.
141 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
144 @param Data This optional parameter may be used to pass additional data
146 @retval EFI_SUCCESS Success to report status code to serial I/O.
147 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
151 SerialStatusCodeReportWorker (
152 IN EFI_STATUS_CODE_TYPE CodeType
,
153 IN EFI_STATUS_CODE_VALUE Value
,
155 IN EFI_GUID
*CallerId
,
156 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
160 Initialize runtime memory status code.
162 @return The function always return EFI_SUCCESS
166 RtMemoryStatusCodeInitializeWorker (
171 Report status code into runtime memory. If the runtime pool is full, roll back to the
172 first record and overwrite it.
174 @param RtMemoryStatusCodeTable
175 Point to Runtime memory table header.
177 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
179 @param Value Describes the current status of a hardware or software entity.
180 This included information about the class and subclass that is used to classify the entity
181 as well as an operation. For progress codes, the operation is the current activity.
182 For error codes, it is the exception. For debug codes, it is not defined at this time.
183 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
184 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
186 @param Instance The enumeration of a hardware or software entity within the system.
187 A system may contain multiple entities that match a class/subclass pairing.
188 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
189 not meaningful, or not relevant. Valid instance numbers start with 1.
191 @return The function always return EFI_SUCCESS.
195 RtMemoryStatusCodeReportWorker (
196 RUNTIME_MEMORY_STATUSCODE_HEADER
*RtMemoryStatusCodeTable
,
197 IN EFI_STATUS_CODE_TYPE CodeType
,
198 IN EFI_STATUS_CODE_VALUE Value
,
203 Initialize data hubstatus code.
204 Create a data hub listener.
206 @return The function always return EFI_SUCCESS
210 DataHubStatusCodeInitializeWorker (
216 Report status code into DataHub.
218 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
220 @param Value Describes the current status of a hardware or software entity.
221 This included information about the class and subclass that is used to classify the entity
222 as well as an operation. For progress codes, the operation is the current activity.
223 For error codes, it is the exception. For debug codes, it is not defined at this time.
224 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
225 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
227 @param Instance The enumeration of a hardware or software entity within the system.
228 A system may contain multiple entities that match a class/subclass pairing.
229 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
230 not meaningful, or not relevant. Valid instance numbers start with 1.
233 @param CallerId This optional parameter may be used to identify the caller.
234 This parameter allows the status code driver to apply different rules to different callers.
235 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
238 @param Data This optional parameter may be used to pass additional data
240 @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
241 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
242 @retval EFI_SUCCESS Success to cache status code and signal log data event.
246 DataHubStatusCodeReportWorker (
247 IN EFI_STATUS_CODE_TYPE CodeType
,
248 IN EFI_STATUS_CODE_VALUE Value
,
250 IN EFI_GUID
*CallerId
,
251 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
256 // Declaration for callback Event.
260 VirtualAddressChangeCallBack (
266 // Declaration for original Entry Point.
270 DxeStatusCodeDriverEntry (
271 IN EFI_HANDLE ImageHandle
,
272 IN EFI_SYSTEM_TABLE
*SystemTable
276 // declaration of DXE status code controller.
278 extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode
;