]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h
Remove unnecessary use of gEfiStatusCodeSpecificDataGuid and sync algorithm with...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / RuntimeDxe / StatusCodeRuntimeDxe.h
CommitLineData
3dbba770 1/** @file\r
a8cbf345 2 Internal include file of Status Code Runtime DXE Driver.\r
ad1a1798 3\r
a8cbf345 4 Copyright (c) 2006 - 2009, Intel Corporation\r
ececc2eb 5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
ad1a1798 12\r
3dbba770 13**/\r
ad1a1798 14\r
a8cbf345 15#ifndef __STATUS_CODE_RUNTIME_DXE_H__\r
16#define __STATUS_CODE_RUNTIME_DXE_H__\r
ad1a1798 17\r
ed7748fe 18\r
6f2b45bb 19#include <FrameworkDxe.h>\r
551ed06f 20#include <FrameworkModuleDxe.h>\r
29941df6 21#include <Guid/DataHubStatusCodeRecord.h>\r
6f2b45bb 22#include <Protocol/DataHub.h>\r
23#include <Protocol/SerialIo.h>\r
24#include <Guid/MemoryStatusCodeRecord.h>\r
25#include <Protocol/StatusCode.h>\r
26#include <Guid/StatusCodeDataTypeId.h>\r
6a27a4eb 27#include <Guid/EventGroup.h>\r
ed7748fe 28\r
6f2b45bb 29#include <Library/BaseLib.h>\r
16f3deb0 30#include <Library/SynchronizationLib.h>\r
6f2b45bb 31#include <Library/BaseMemoryLib.h>\r
32#include <Library/DebugLib.h>\r
33#include <Library/ReportStatusCodeLib.h>\r
34#include <Library/PrintLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/HobLib.h>\r
37#include <Library/UefiDriverEntryPoint.h>\r
38#include <Library/UefiBootServicesTableLib.h>\r
39#include <Library/UefiLib.h>\r
40#include <Library/MemoryAllocationLib.h>\r
41#include <Library/UefiRuntimeLib.h>\r
42#include <Library/SerialPortLib.h>\r
43#include <Library/OemHookStatusCodeLib.h>\r
ad1a1798 44\r
45//\r
ececc2eb 46// Data hub worker definition\r
ad1a1798 47//\r
f02bd376 48#define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')\r
ad1a1798 49\r
ad1a1798 50typedef struct {\r
6f2b45bb 51 UINTN Signature;\r
52 LIST_ENTRY Node;\r
a8cbf345 53 UINT8 Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r
ad1a1798 54} DATAHUB_STATUSCODE_RECORD;\r
55\r
56\r
57//\r
ececc2eb 58// Runtime memory status code worker definition\r
59//\r
ad1a1798 60typedef struct {\r
61 UINT32 RecordIndex;\r
62 UINT32 NumberOfRecords;\r
63 UINT32 MaxRecordsNumber;\r
64} RUNTIME_MEMORY_STATUSCODE_HEADER;\r
65\r
a8cbf345 66extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;\r
ad1a1798 67\r
a8cbf345 68/**\r
69 Report status code to all supported device.\r
ad1a1798 70\r
a8cbf345 71 This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().\r
72 It calls into the workers which dispatches the platform specific listeners.\r
ad1a1798 73\r
9484bb62 74 @param CodeType Indicates the type of status code being reported.\r
a8cbf345 75 @param Value Describes the current status of a hardware or software entity.\r
76 This included information about the class and subclass that is used to\r
77 classify the entity as well as an operation.\r
78 @param Instance The enumeration of a hardware or software entity within\r
79 the system. Valid instance numbers start with 1.\r
80 @param CallerId This optional parameter may be used to identify the caller.\r
81 This parameter allows the status code driver to apply different rules to\r
82 different callers.\r
83 @param Data This optional parameter may be used to pass additional data.\r
ececc2eb 84\r
a8cbf345 85 @retval EFI_SUCCESS The function completed successfully\r
86 @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.\r
ececc2eb 87\r
a8cbf345 88**/\r
89EFI_STATUS\r
90EFIAPI\r
91ReportDispatcher (\r
92 IN EFI_STATUS_CODE_TYPE CodeType,\r
93 IN EFI_STATUS_CODE_VALUE Value,\r
94 IN UINT32 Instance,\r
95 IN EFI_GUID *CallerId OPTIONAL,\r
96 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
97 );\r
98\r
99/**\r
100 Dispatch initialization request to sub status code devices based on \r
101 customized feature flags.\r
102 \r
ad1a1798 103**/\r
104VOID\r
105InitializationDispatcherWorker (\r
106 VOID\r
107 );\r
108\r
109\r
110/**\r
a8cbf345 111 Locates Serial I/O Protocol as initialization for serial status code worker.\r
112 \r
113 @retval EFI_SUCCESS Serial I/O Protocol is successfully located.\r
ad1a1798 114\r
115**/\r
116EFI_STATUS\r
117EfiSerialStatusCodeInitializeWorker (\r
118 VOID\r
119 );\r
120\r
121\r
122/**\r
123 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
a8cbf345 124 \r
125 @param CodeType Indicates the type of status code being reported.\r
126 @param Value Describes the current status of a hardware or software entity.\r
127 This included information about the class and subclass that is used to\r
128 classify the entity as well as an operation.\r
129 @param Instance The enumeration of a hardware or software entity within\r
130 the system. Valid instance numbers start with 1.\r
131 @param CallerId This optional parameter may be used to identify the caller.\r
132 This parameter allows the status code driver to apply different rules to\r
133 different callers.\r
134 @param Data This optional parameter may be used to pass additional data.\r
135\r
136 @retval EFI_SUCCESS Status code reported to serial I/O successfully.\r
137 @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.\r
138 @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.\r
ad1a1798 139\r
140**/\r
141EFI_STATUS\r
142SerialStatusCodeReportWorker (\r
143 IN EFI_STATUS_CODE_TYPE CodeType,\r
144 IN EFI_STATUS_CODE_VALUE Value,\r
145 IN UINT32 Instance,\r
146 IN EFI_GUID *CallerId,\r
147 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
148 );\r
149\r
150/**\r
a8cbf345 151 Initialize runtime memory status code table as initialization for runtime memory status code worker\r
152 \r
153 @retval EFI_SUCCESS Runtime memory status code table successfully initialized.\r
ad1a1798 154\r
155**/\r
156EFI_STATUS\r
157RtMemoryStatusCodeInitializeWorker (\r
158 VOID\r
159 );\r
160\r
161/**\r
a8cbf345 162 Report status code into runtime memory. If the runtime pool is full, roll back to the \r
ad1a1798 163 first record and overwrite it.\r
a8cbf345 164 \r
165 @param CodeType Indicates the type of status code being reported.\r
166 @param Value Describes the current status of a hardware or software entity.\r
167 This included information about the class and subclass that is used to\r
168 classify the entity as well as an operation.\r
169 @param Instance The enumeration of a hardware or software entity within\r
170 the system. Valid instance numbers start with 1.\r
a8cbf345 171 \r
172 @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.\r
ad1a1798 173\r
174**/\r
175EFI_STATUS\r
176RtMemoryStatusCodeReportWorker (\r
ad1a1798 177 IN EFI_STATUS_CODE_TYPE CodeType,\r
178 IN EFI_STATUS_CODE_VALUE Value,\r
179 IN UINT32 Instance\r
180 );\r
181\r
182/**\r
a8cbf345 183 Locate Data Hub Protocol and create event for logging data\r
184 as initialization for data hub status code worker.\r
ececc2eb 185\r
a8cbf345 186 @retval EFI_SUCCESS Initialization is successful.\r
ad1a1798 187\r
188**/\r
189EFI_STATUS\r
190DataHubStatusCodeInitializeWorker (\r
191 VOID\r
192 );\r
193\r
194\r
195/**\r
196 Report status code into DataHub.\r
ececc2eb 197\r
a8cbf345 198 @param CodeType Indicates the type of status code being reported.\r
199 @param Value Describes the current status of a hardware or software entity.\r
200 This included information about the class and subclass that is used to\r
201 classify the entity as well as an operation.\r
202 @param Instance The enumeration of a hardware or software entity within\r
203 the system. Valid instance numbers start with 1.\r
204 @param CallerId This optional parameter may be used to identify the caller.\r
205 This parameter allows the status code driver to apply different rules to\r
206 different callers.\r
207 @param Data This optional parameter may be used to pass additional data.\r
208\r
209 @retval EFI_SUCCESS The function completed successfully.\r
210 @retval EFI_DEVICE_ERROR Function is reentered.\r
211 @retval EFI_DEVICE_ERROR Function is called at runtime.\r
212 @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.\r
ad1a1798 213\r
214**/\r
215EFI_STATUS\r
216DataHubStatusCodeReportWorker (\r
217 IN EFI_STATUS_CODE_TYPE CodeType,\r
218 IN EFI_STATUS_CODE_VALUE Value,\r
219 IN UINT32 Instance,\r
220 IN EFI_GUID *CallerId,\r
221 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
222 );\r
223\r
6f2b45bb 224\r
a8cbf345 225/**\r
226 Virtual address change notification call back. It converts global pointer\r
227 to virtual address.\r
228\r
229 @param Event Event whose notification function is being invoked.\r
230 @param Context Pointer to the notification function's context, which is\r
231 always zero in current implementation.\r
232\r
233**/\r
6f2b45bb 234VOID\r
235EFIAPI\r
236VirtualAddressChangeCallBack (\r
237 IN EFI_EVENT Event,\r
238 IN VOID *Context\r
239 );\r
240\r
ad1a1798 241#endif\r