]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
Move EFI_STATUS_CODE_DATA_MAX_SIZE from IntelFrameworkPkg to IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.h
CommitLineData
ad1a1798 1/*++\r
2\r
ececc2eb 3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
ad1a1798 11\r
ad1a1798 12--*/\r
13\r
14#ifndef __DXE_STATUS_CODE_H__\r
15#define __DXE_STATUS_CODE_H__\r
16\r
ed7748fe 17\r
6f2b45bb 18#include <FrameworkDxe.h>\r
551ed06f 19#include <FrameworkModuleDxe.h>\r
29941df6 20#include <Guid/DataHubStatusCodeRecord.h>\r
6f2b45bb 21#include <Protocol/DataHub.h>\r
22#include <Protocol/SerialIo.h>\r
23#include <Guid/MemoryStatusCodeRecord.h>\r
24#include <Protocol/StatusCode.h>\r
25#include <Guid/StatusCodeDataTypeId.h>\r
ed7748fe 26\r
6f2b45bb 27#include <Library/BaseLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/ReportStatusCodeLib.h>\r
31#include <Library/PrintLib.h>\r
32#include <Library/PcdLib.h>\r
33#include <Library/HobLib.h>\r
34#include <Library/UefiDriverEntryPoint.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/UefiLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/UefiRuntimeLib.h>\r
39#include <Library/SerialPortLib.h>\r
40#include <Library/OemHookStatusCodeLib.h>\r
ad1a1798 41\r
42//\r
ececc2eb 43// Data hub worker definition\r
ad1a1798 44//\r
45#define MAX_NUMBER_DATAHUB_RECORDS 1000\r
46#define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE\r
47#define EMPTY_RECORD_TAG 0xFF\r
48#define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')\r
49\r
50//\r
51// Address type of pointer.\r
52// The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture\r
ececc2eb 53// Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,\r
54//\r
ad1a1798 55typedef enum {\r
56 PHYSICAL_MODE,\r
57 VIRTUAL_MODE\r
58} PROCESSOR_MODE;\r
59\r
60typedef struct {\r
6f2b45bb 61 UINTN Signature;\r
62 LIST_ENTRY Node;\r
63\r
64 UINT8 Data[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r
ad1a1798 65} DATAHUB_STATUSCODE_RECORD;\r
66\r
67\r
68//\r
ececc2eb 69// Runtime memory status code worker definition\r
70//\r
ad1a1798 71typedef struct {\r
72 UINT32 RecordIndex;\r
73 UINT32 NumberOfRecords;\r
74 UINT32 MaxRecordsNumber;\r
75} RUNTIME_MEMORY_STATUSCODE_HEADER;\r
76\r
77\r
78typedef struct {\r
79 //\r
ececc2eb 80 // Report operation nest status.\r
ad1a1798 81 // If it is set, then the report operation has nested.\r
ececc2eb 82 //\r
ad1a1798 83 UINT32 StatusCodeNestStatus;\r
84 //\r
85 // Runtime status code management header, the records buffer is following it.\r
ececc2eb 86 //\r
ad1a1798 87 RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];\r
88} DXE_STATUS_CODE_CONTROLLER;\r
89\r
90\r
91/**\r
ececc2eb 92\r
93 Dispatch initialization request to sub status code devices based on\r
ad1a1798 94 customized feature flags.\r
ececc2eb 95\r
ad1a1798 96**/\r
97VOID\r
98InitializationDispatcherWorker (\r
99 VOID\r
100 );\r
101\r
102\r
103/**\r
104 Initialize serial status code worker.\r
ececc2eb 105\r
ad1a1798 106 @return The function always return EFI_SUCCESS\r
107\r
108**/\r
109EFI_STATUS\r
110EfiSerialStatusCodeInitializeWorker (\r
111 VOID\r
112 );\r
113\r
114\r
115/**\r
116 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
ececc2eb 117\r
ad1a1798 118 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
ececc2eb 119\r
120 @param Value Describes the current status of a hardware or software entity.\r
121 This included information about the class and subclass that is used to classify the entity\r
122 as well as an operation. For progress codes, the operation is the current activity.\r
123 For error codes, it is the exception. For debug codes, it is not defined at this time.\r
124 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
ad1a1798 125 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
ececc2eb 126\r
127 @param Instance The enumeration of a hardware or software entity within the system.\r
128 A system may contain multiple entities that match a class/subclass pairing.\r
129 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r
ad1a1798 130 not meaningful, or not relevant. Valid instance numbers start with 1.\r
131\r
132\r
ececc2eb 133 @param CallerId This optional parameter may be used to identify the caller.\r
134 This parameter allows the status code driver to apply different rules to different callers.\r
ad1a1798 135 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.\r
136\r
137\r
138 @param Data This optional parameter may be used to pass additional data\r
ececc2eb 139\r
ad1a1798 140 @retval EFI_SUCCESS Success to report status code to serial I/O.\r
141 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .\r
142\r
143**/\r
144EFI_STATUS\r
145SerialStatusCodeReportWorker (\r
146 IN EFI_STATUS_CODE_TYPE CodeType,\r
147 IN EFI_STATUS_CODE_VALUE Value,\r
148 IN UINT32 Instance,\r
149 IN EFI_GUID *CallerId,\r
150 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
151 );\r
152\r
153/**\r
154 Initialize runtime memory status code.\r
ececc2eb 155\r
ad1a1798 156 @return The function always return EFI_SUCCESS\r
157\r
158**/\r
159EFI_STATUS\r
160RtMemoryStatusCodeInitializeWorker (\r
161 VOID\r
162 );\r
163\r
164/**\r
ececc2eb 165 Report status code into runtime memory. If the runtime pool is full, roll back to the\r
ad1a1798 166 first record and overwrite it.\r
ececc2eb 167\r
168 @param RtMemoryStatusCodeTable\r
ad1a1798 169 Point to Runtime memory table header.\r
170\r
171 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
ececc2eb 172\r
173 @param Value Describes the current status of a hardware or software entity.\r
174 This included information about the class and subclass that is used to classify the entity\r
175 as well as an operation. For progress codes, the operation is the current activity.\r
176 For error codes, it is the exception. For debug codes, it is not defined at this time.\r
177 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
ad1a1798 178 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
ececc2eb 179\r
180 @param Instance The enumeration of a hardware or software entity within the system.\r
181 A system may contain multiple entities that match a class/subclass pairing.\r
182 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r
ad1a1798 183 not meaningful, or not relevant. Valid instance numbers start with 1.\r
ececc2eb 184\r
ad1a1798 185 @return The function always return EFI_SUCCESS.\r
186\r
187**/\r
188EFI_STATUS\r
189RtMemoryStatusCodeReportWorker (\r
190 RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,\r
191 IN EFI_STATUS_CODE_TYPE CodeType,\r
192 IN EFI_STATUS_CODE_VALUE Value,\r
193 IN UINT32 Instance\r
194 );\r
195\r
196/**\r
197 Initialize data hubstatus code.\r
198 Create a data hub listener.\r
ececc2eb 199\r
ad1a1798 200 @return The function always return EFI_SUCCESS\r
201\r
202**/\r
203EFI_STATUS\r
204DataHubStatusCodeInitializeWorker (\r
205 VOID\r
206 );\r
207\r
208\r
209/**\r
210 Report status code into DataHub.\r
ececc2eb 211\r
ad1a1798 212 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
ececc2eb 213\r
214 @param Value Describes the current status of a hardware or software entity.\r
215 This included information about the class and subclass that is used to classify the entity\r
216 as well as an operation. For progress codes, the operation is the current activity.\r
217 For error codes, it is the exception. For debug codes, it is not defined at this time.\r
218 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
ad1a1798 219 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
ececc2eb 220\r
221 @param Instance The enumeration of a hardware or software entity within the system.\r
222 A system may contain multiple entities that match a class/subclass pairing.\r
223 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r
ad1a1798 224 not meaningful, or not relevant. Valid instance numbers start with 1.\r
225\r
226\r
ececc2eb 227 @param CallerId This optional parameter may be used to identify the caller.\r
228 This parameter allows the status code driver to apply different rules to different callers.\r
ad1a1798 229 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.\r
230\r
231\r
232 @param Data This optional parameter may be used to pass additional data\r
ececc2eb 233\r
ad1a1798 234 @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.\r
235 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .\r
236 @retval EFI_SUCCESS Success to cache status code and signal log data event.\r
237\r
238**/\r
239EFI_STATUS\r
240DataHubStatusCodeReportWorker (\r
241 IN EFI_STATUS_CODE_TYPE CodeType,\r
242 IN EFI_STATUS_CODE_VALUE Value,\r
243 IN UINT32 Instance,\r
244 IN EFI_GUID *CallerId,\r
245 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
246 );\r
247\r
6f2b45bb 248\r
249//\r
250// Declaration for callback Event.\r
251//\r
252VOID\r
253EFIAPI\r
254VirtualAddressChangeCallBack (\r
255 IN EFI_EVENT Event,\r
256 IN VOID *Context\r
257 );\r
258\r
259//\r
260// Declaration for original Entry Point.\r
261//\r
262EFI_STATUS\r
263EFIAPI\r
264DxeStatusCodeDriverEntry (\r
265 IN EFI_HANDLE ImageHandle,\r
266 IN EFI_SYSTEM_TABLE *SystemTable\r
267 );\r
268\r
ad1a1798 269//\r
270// declaration of DXE status code controller.\r
ececc2eb 271//\r
ad1a1798 272extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;\r
273\r
274#endif\r