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