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