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