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