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