2 Internal include file of Status Code Runtime DXE Driver.
4 Copyright (c) 2006 - 2009, 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 #ifndef __STATUS_CODE_RUNTIME_DXE_H__
16 #define __STATUS_CODE_RUNTIME_DXE_H__
19 #include <FrameworkDxe.h>
20 #include <FrameworkModuleDxe.h>
21 #include <Guid/DataHubStatusCodeRecord.h>
22 #include <Protocol/DataHub.h>
23 #include <Protocol/SerialIo.h>
24 #include <Guid/MemoryStatusCodeRecord.h>
25 #include <Protocol/StatusCode.h>
26 #include <Guid/StatusCodeDataTypeId.h>
27 #include <Guid/EventGroup.h>
29 #include <Library/BaseLib.h>
30 #include <Library/SynchronizationLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/ReportStatusCodeLib.h>
34 #include <Library/PrintLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/HobLib.h>
37 #include <Library/UefiDriverEntryPoint.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/MemoryAllocationLib.h>
41 #include <Library/UefiRuntimeLib.h>
42 #include <Library/SerialPortLib.h>
43 #include <Library/OemHookStatusCodeLib.h>
46 // Data hub worker definition
48 #define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')
53 UINT8 Data
[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD
) + EFI_STATUS_CODE_DATA_MAX_SIZE
];
54 } DATAHUB_STATUSCODE_RECORD
;
58 // Runtime memory status code worker definition
62 UINT32 NumberOfRecords
;
63 UINT32 MaxRecordsNumber
;
64 } RUNTIME_MEMORY_STATUSCODE_HEADER
;
66 extern RUNTIME_MEMORY_STATUSCODE_HEADER
*mRtMemoryStatusCodeTable
;
69 Report status code to all supported device.
71 This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().
72 It calls into the workers which dispatches the platform specific listeners.
74 @param CodeType Indicates the type of status code being reported.
75 @param Value Describes the current status of a hardware or software entity.
76 This included information about the class and subclass that is used to
77 classify the entity as well as an operation.
78 @param Instance The enumeration of a hardware or software entity within
79 the system. Valid instance numbers start with 1.
80 @param CallerId This optional parameter may be used to identify the caller.
81 This parameter allows the status code driver to apply different rules to
83 @param Data This optional parameter may be used to pass additional data.
85 @retval EFI_SUCCESS The function completed successfully
86 @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
92 IN EFI_STATUS_CODE_TYPE CodeType
,
93 IN EFI_STATUS_CODE_VALUE Value
,
95 IN EFI_GUID
*CallerId OPTIONAL
,
96 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
100 Dispatch initialization request to sub status code devices based on
101 customized feature flags.
105 InitializationDispatcherWorker (
111 Locates Serial I/O Protocol as initialization for serial status code worker.
113 @retval EFI_SUCCESS Serial I/O Protocol is successfully located.
117 EfiSerialStatusCodeInitializeWorker (
123 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
125 @param CodeType Indicates the type of status code being reported.
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
128 classify the entity as well as an operation.
129 @param Instance The enumeration of a hardware or software entity within
130 the system. Valid instance numbers start with 1.
131 @param CallerId This optional parameter may be used to identify the caller.
132 This parameter allows the status code driver to apply different rules to
134 @param Data This optional parameter may be used to pass additional data.
136 @retval EFI_SUCCESS Status code reported to serial I/O successfully.
137 @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
138 @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
142 SerialStatusCodeReportWorker (
143 IN EFI_STATUS_CODE_TYPE CodeType
,
144 IN EFI_STATUS_CODE_VALUE Value
,
146 IN EFI_GUID
*CallerId
,
147 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
151 Initialize runtime memory status code table as initialization for runtime memory status code worker
153 @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
157 RtMemoryStatusCodeInitializeWorker (
162 Report status code into runtime memory. If the runtime pool is full, roll back to the
163 first record and overwrite it.
165 @param CodeType Indicates the type of status code being reported.
166 @param Value Describes the current status of a hardware or software entity.
167 This included information about the class and subclass that is used to
168 classify the entity as well as an operation.
169 @param Instance The enumeration of a hardware or software entity within
170 the system. Valid instance numbers start with 1.
172 @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
176 RtMemoryStatusCodeReportWorker (
177 IN EFI_STATUS_CODE_TYPE CodeType
,
178 IN EFI_STATUS_CODE_VALUE Value
,
183 Locate Data Hub Protocol and create event for logging data
184 as initialization for data hub status code worker.
186 @retval EFI_SUCCESS Initialization is successful.
190 DataHubStatusCodeInitializeWorker (
196 Report status code into DataHub.
198 @param CodeType Indicates the type of status code being reported.
199 @param Value Describes the current status of a hardware or software entity.
200 This included information about the class and subclass that is used to
201 classify the entity as well as an operation.
202 @param Instance The enumeration of a hardware or software entity within
203 the system. Valid instance numbers start with 1.
204 @param CallerId This optional parameter may be used to identify the caller.
205 This parameter allows the status code driver to apply different rules to
207 @param Data This optional parameter may be used to pass additional data.
209 @retval EFI_SUCCESS The function completed successfully.
210 @retval EFI_DEVICE_ERROR Function is reentered.
211 @retval EFI_DEVICE_ERROR Function is called at runtime.
212 @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
216 DataHubStatusCodeReportWorker (
217 IN EFI_STATUS_CODE_TYPE CodeType
,
218 IN EFI_STATUS_CODE_VALUE Value
,
220 IN EFI_GUID
*CallerId
,
221 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
226 Virtual address change notification call back. It converts global pointer
229 @param Event Event whose notification function is being invoked.
230 @param Context Pointer to the notification function's context, which is
231 always zero in current implementation.
236 VirtualAddressChangeCallBack (