]>
Commit | Line | Data |
---|---|---|
2287f237 | 1 | /** @file\r |
0ad78d07 | 2 | Instance of Report Status Code Library for PEI Phase.\r |
2287f237 | 3 | \r |
0ad78d07 | 4 | Copyright (c) 2006 - 2009, Intel Corporation<BR>\r |
2287f237 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
2287f237 | 15 | #include <FrameworkPei.h>\r |
16 | \r | |
17 | #include <Guid/StatusCodeDataTypeId.h>\r | |
3a6064fa | 18 | #include <Guid/StatusCodeDataTypeDebug.h>\r |
2287f237 | 19 | \r |
20 | #include <Library/ReportStatusCodeLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseLib.h>\r | |
23 | #include <Library/BaseMemoryLib.h>\r | |
24 | #include <Library/PeiServicesTablePointerLib.h>\r | |
0df40b2b | 25 | #include <Library/OemHookStatusCodeLib.h>\r |
2287f237 | 26 | #include <Library/PcdLib.h>\r |
27 | \r | |
2287f237 | 28 | //\r |
29 | // Define the maximum extended data size that is supported in the PEI phase\r | |
30 | //\r | |
31 | #define MAX_EXTENDED_DATA_SIZE 0x200\r | |
32 | \r | |
33 | /**\r | |
0ad78d07 | 34 | Internal worker function that reports a status code through the PEI Status Code Service or\r |
35 | OEM Hook Status Code Library.\r | |
2287f237 | 36 | \r |
0ad78d07 | 37 | This function first tries to report status code via PEI Status Code Service. If the service\r |
38 | is not available, it then tries calling OEM Hook Status Code Library.\r | |
2287f237 | 39 | \r |
40 | @param Type Status code type.\r | |
41 | @param Value Status code value.\r | |
42 | @param Instance Status code instance number.\r | |
43 | @param CallerId Pointer to a GUID that identifies the caller of this\r | |
44 | function. This is an optional parameter that may be\r | |
45 | NULL.\r | |
46 | @param Data Pointer to the extended data buffer. This is an\r | |
47 | optional parameter that may be NULL.\r | |
48 | \r | |
0ad78d07 | 49 | @retval EFI_SUCCESS The status code was reported.\r |
50 | @retval EFI_UNSUPPORTED Status code type is not supported.\r | |
51 | @retval Others Failed to report status code.\r | |
2287f237 | 52 | \r |
53 | **/\r | |
2287f237 | 54 | EFI_STATUS\r |
55 | InternalReportStatusCode (\r | |
56 | IN EFI_STATUS_CODE_TYPE Type,\r | |
57 | IN EFI_STATUS_CODE_VALUE Value,\r | |
58 | IN UINT32 Instance,\r | |
59 | IN CONST EFI_GUID *CallerId OPTIONAL,\r | |
60 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
61 | )\r | |
62 | {\r | |
507b36ca | 63 | CONST EFI_PEI_SERVICES **PeiServices;\r |
ff8ff139 | 64 | EFI_STATUS Status;\r |
2287f237 | 65 | \r |
15cd6a82 | 66 | if ((ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r |
0ad78d07 | 67 | (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||\r |
68 | (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {\r | |
15cd6a82 | 69 | PeiServices = GetPeiServicesTablePointer ();\r |
0ad78d07 | 70 | Status = (*PeiServices)->ReportStatusCode (\r |
15cd6a82 LG |
71 | PeiServices,\r |
72 | Type,\r | |
73 | Value,\r | |
74 | Instance,\r | |
75 | (EFI_GUID *)CallerId,\r | |
76 | Data\r | |
77 | );\r | |
78 | if (Status == EFI_NOT_AVAILABLE_YET) {\r | |
79 | Status = OemHookStatusCodeInitialize ();\r | |
80 | if (!EFI_ERROR (Status)) {\r | |
81 | return OemHookStatusCodeReport (Type, Value, Instance, (EFI_GUID *) CallerId, Data);\r | |
82 | }\r | |
f26f2a7b | 83 | }\r |
15cd6a82 | 84 | return Status;\r |
ff8ff139 | 85 | }\r |
15cd6a82 LG |
86 | \r |
87 | return EFI_UNSUPPORTED;\r | |
2287f237 | 88 | }\r |
89 | \r | |
90 | \r | |
91 | /**\r | |
92 | Converts a status code to an 8-bit POST code value.\r | |
93 | \r | |
94 | Converts the status code specified by CodeType and Value to an 8-bit POST code\r | |
95 | and returns the 8-bit POST code in PostCode. If CodeType is an\r | |
96 | EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode\r | |
97 | are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits\r | |
98 | 24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned.\r | |
99 | \r | |
100 | If PostCode is NULL, then ASSERT().\r | |
101 | \r | |
102 | @param CodeType The type of status code being converted.\r | |
103 | @param Value The status code value being converted.\r | |
104 | @param PostCode A pointer to the 8-bit POST code value to return.\r | |
105 | \r | |
106 | @retval TRUE The status code specified by CodeType and Value was converted\r | |
107 | to an 8-bit POST code and returned in PostCode.\r | |
108 | @retval FALSE The status code specified by CodeType and Value could not be\r | |
109 | converted to an 8-bit POST code value.\r | |
110 | \r | |
111 | **/\r | |
112 | BOOLEAN\r | |
113 | EFIAPI\r | |
114 | CodeTypeToPostCode (\r | |
115 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
116 | IN EFI_STATUS_CODE_VALUE Value,\r | |
117 | OUT UINT8 *PostCode\r | |
118 | )\r | |
119 | {\r | |
120 | //\r | |
121 | // If PostCode is NULL, then ASSERT()\r | |
122 | //\r | |
123 | ASSERT (PostCode != NULL);\r | |
124 | \r | |
125 | //\r | |
126 | // Convert Value to an 8 bit post code\r | |
127 | //\r | |
128 | if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r | |
0ad78d07 | 129 | ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)) {\r |
2287f237 | 130 | *PostCode = (UINT8) ((((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |\r |
131 | (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r | |
132 | return TRUE;\r | |
133 | }\r | |
134 | return FALSE;\r | |
135 | }\r | |
136 | \r | |
137 | \r | |
138 | /**\r | |
139 | Extracts ASSERT() information from a status code structure.\r | |
140 | \r | |
141 | Converts the status code specified by CodeType, Value, and Data to the ASSERT()\r | |
142 | arguments specified by Filename, Description, and LineNumber. If CodeType is\r | |
143 | an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and\r | |
144 | Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract\r | |
145 | Filename, Description, and LineNumber from the optional data area of the\r | |
146 | status code buffer specified by Data. The optional data area of Data contains\r | |
147 | a Null-terminated ASCII string for the FileName, followed by a Null-terminated\r | |
148 | ASCII string for the Description, followed by a 32-bit LineNumber. If the\r | |
149 | ASSERT() information could be extracted from Data, then return TRUE.\r | |
150 | Otherwise, FALSE is returned.\r | |
151 | \r | |
152 | If Data is NULL, then ASSERT().\r | |
153 | If Filename is NULL, then ASSERT().\r | |
154 | If Description is NULL, then ASSERT().\r | |
155 | If LineNumber is NULL, then ASSERT().\r | |
156 | \r | |
157 | @param CodeType The type of status code being converted.\r | |
158 | @param Value The status code value being converted.\r | |
159 | @param Data Pointer to status code data buffer.\r | |
160 | @param Filename Pointer to the source file name that generated the ASSERT().\r | |
161 | @param Description Pointer to the description of the ASSERT().\r | |
162 | @param LineNumber Pointer to source line number that generated the ASSERT().\r | |
163 | \r | |
164 | @retval TRUE The status code specified by CodeType, Value, and Data was\r | |
165 | converted ASSERT() arguments specified by Filename, Description,\r | |
166 | and LineNumber.\r | |
167 | @retval FALSE The status code specified by CodeType, Value, and Data could\r | |
168 | not be converted to ASSERT() arguments.\r | |
169 | \r | |
170 | **/\r | |
171 | BOOLEAN\r | |
172 | EFIAPI\r | |
173 | ReportStatusCodeExtractAssertInfo (\r | |
174 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
175 | IN EFI_STATUS_CODE_VALUE Value,\r | |
176 | IN CONST EFI_STATUS_CODE_DATA *Data,\r | |
177 | OUT CHAR8 **Filename,\r | |
178 | OUT CHAR8 **Description,\r | |
179 | OUT UINT32 *LineNumber\r | |
180 | )\r | |
181 | {\r | |
182 | EFI_DEBUG_ASSERT_DATA *AssertData;\r | |
183 | \r | |
184 | ASSERT (Data != NULL);\r | |
185 | ASSERT (Filename != NULL);\r | |
186 | ASSERT (Description != NULL);\r | |
187 | ASSERT (LineNumber != NULL);\r | |
188 | \r | |
189 | if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) &&\r | |
190 | ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED) &&\r | |
191 | ((Value & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)) {\r | |
192 | AssertData = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);\r | |
193 | *Filename = (CHAR8 *)(AssertData + 1);\r | |
194 | *Description = *Filename + AsciiStrLen (*Filename) + 1;\r | |
195 | *LineNumber = AssertData->LineNumber;\r | |
196 | return TRUE;\r | |
197 | }\r | |
198 | return FALSE;\r | |
199 | }\r | |
200 | \r | |
201 | \r | |
202 | /**\r | |
203 | Extracts DEBUG() information from a status code structure.\r | |
204 | \r | |
205 | Converts the status code specified by Data to the DEBUG() arguments specified\r | |
206 | by ErrorLevel, Marker, and Format. If type GUID in Data is\r | |
207 | EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and\r | |
208 | Format from the optional data area of the status code buffer specified by Data.\r | |
209 | The optional data area of Data contains a 32-bit ErrorLevel followed by Marker\r | |
210 | which is 12 UINTN parameters, followed by a Null-terminated ASCII string for\r | |
211 | the Format. If the DEBUG() information could be extracted from Data, then\r | |
212 | return TRUE. Otherwise, FALSE is returned.\r | |
213 | \r | |
214 | If Data is NULL, then ASSERT().\r | |
215 | If ErrorLevel is NULL, then ASSERT().\r | |
216 | If Marker is NULL, then ASSERT().\r | |
217 | If Format is NULL, then ASSERT().\r | |
218 | \r | |
219 | @param Data Pointer to status code data buffer.\r | |
220 | @param ErrorLevel Pointer to error level mask for a debug message.\r | |
221 | @param Marker Pointer to the variable argument list associated with Format.\r | |
222 | @param Format Pointer to a Null-terminated ASCII format string of a\r | |
223 | debug message.\r | |
224 | \r | |
225 | @retval TRUE The status code specified by Data was converted DEBUG() arguments\r | |
226 | specified by ErrorLevel, Marker, and Format.\r | |
227 | @retval FALSE The status code specified by Data could not be converted to\r | |
228 | DEBUG() arguments.\r | |
229 | \r | |
230 | **/\r | |
231 | BOOLEAN\r | |
232 | EFIAPI\r | |
233 | ReportStatusCodeExtractDebugInfo (\r | |
234 | IN CONST EFI_STATUS_CODE_DATA *Data,\r | |
235 | OUT UINT32 *ErrorLevel,\r | |
ca9938b8 | 236 | OUT BASE_LIST *Marker,\r |
2287f237 | 237 | OUT CHAR8 **Format\r |
238 | )\r | |
239 | {\r | |
240 | EFI_DEBUG_INFO *DebugInfo;\r | |
241 | \r | |
242 | ASSERT (Data != NULL);\r | |
243 | ASSERT (ErrorLevel != NULL);\r | |
244 | ASSERT (Marker != NULL);\r | |
245 | ASSERT (Format != NULL);\r | |
246 | \r | |
247 | //\r | |
248 | // If the GUID type is not EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID then return FALSE\r | |
249 | //\r | |
250 | if (!CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeDebugGuid)) {\r | |
251 | return FALSE;\r | |
252 | }\r | |
253 | \r | |
254 | //\r | |
255 | // Retrieve the debug information from the status code record\r | |
256 | //\r | |
257 | DebugInfo = (EFI_DEBUG_INFO *)(Data + 1);\r | |
258 | \r | |
259 | *ErrorLevel = DebugInfo->ErrorLevel;\r | |
260 | \r | |
6b27e0f0 | 261 | //\r |
5e7ea54b | 262 | // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO are for variable arguments\r |
263 | // of format in DEBUG string. Its address is returned in Marker and has to be 64-bit aligned.\r | |
6b27e0f0 | 264 | // It must be noticed that EFI_DEBUG_INFO follows EFI_STATUS_CODE_DATA, whose size is\r |
265 | // 20 bytes. The size of EFI_DEBUG_INFO is 4 bytes, so we can ensure that Marker\r | |
266 | // returned is 64-bit aligned.\r | |
267 | // 64-bit aligned is a must, otherwise retrieving 64-bit parameter from BASE_LIST will\r | |
268 | // cause unalignment exception.\r | |
269 | //\r | |
270 | *Marker = (BASE_LIST) (DebugInfo + 1);\r | |
2287f237 | 271 | *Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);\r |
272 | \r | |
273 | return TRUE;\r | |
274 | }\r | |
275 | \r | |
276 | \r | |
277 | /**\r | |
278 | Reports a status code.\r | |
279 | \r | |
280 | Reports the status code specified by the parameters Type and Value. Status\r | |
281 | code also require an instance, caller ID, and extended data. This function\r | |
282 | passed in a zero instance, NULL extended data, and a caller ID of\r | |
283 | gEfiCallerIdGuid, which is the GUID for the module.\r | |
284 | \r | |
285 | ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode()\r | |
286 | is called while processing another any other Report Status Code Library function,\r | |
287 | then ReportStatusCode() must return immediately.\r | |
288 | \r | |
289 | @param Type Status code type.\r | |
290 | @param Value Status code value.\r | |
291 | \r | |
292 | @retval EFI_SUCCESS The status code was reported.\r | |
293 | @retval EFI_DEVICE_ERROR There status code could not be reported due to a\r | |
294 | device error.\r | |
295 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
296 | \r | |
297 | **/\r | |
298 | EFI_STATUS\r | |
299 | EFIAPI\r | |
300 | ReportStatusCode (\r | |
301 | IN EFI_STATUS_CODE_TYPE Type,\r | |
302 | IN EFI_STATUS_CODE_VALUE Value\r | |
303 | )\r | |
304 | {\r | |
305 | return InternalReportStatusCode (Type, Value, 0, &gEfiCallerIdGuid, NULL);\r | |
306 | }\r | |
307 | \r | |
308 | \r | |
309 | /**\r | |
310 | Reports a status code with a Device Path Protocol as the extended data.\r | |
311 | \r | |
312 | Allocates and fills in the extended data section of a status code with the\r | |
313 | Device Path Protocol specified by DevicePath. This function is responsible\r | |
314 | for allocating a buffer large enough for the standard header and the device\r | |
315 | path. The standard header is filled in with a GUID of\r | |
316 | gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero\r | |
317 | instance and a caller ID of gEfiCallerIdGuid.\r | |
318 | \r | |
319 | ReportStatusCodeWithDevicePath()must actively prevent recursion. If\r | |
320 | ReportStatusCodeWithDevicePath() is called while processing another any other\r | |
321 | Report Status Code Library function, then ReportStatusCodeWithDevicePath()\r | |
322 | must return EFI_DEVICE_ERROR immediately.\r | |
323 | \r | |
324 | If DevicePath is NULL, then ASSERT().\r | |
325 | \r | |
326 | @param Type Status code type.\r | |
327 | @param Value Status code value.\r | |
328 | @param DevicePath Pointer to the Device Path Protocol to be reported.\r | |
329 | \r | |
330 | @retval EFI_SUCCESS The status code was reported with the extended\r | |
331 | data specified by DevicePath.\r | |
332 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r | |
333 | extended data section.\r | |
334 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
335 | \r | |
336 | **/\r | |
337 | EFI_STATUS\r | |
338 | EFIAPI\r | |
339 | ReportStatusCodeWithDevicePath (\r | |
340 | IN EFI_STATUS_CODE_TYPE Type,\r | |
341 | IN EFI_STATUS_CODE_VALUE Value,\r | |
342 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
343 | )\r | |
344 | {\r | |
345 | ASSERT (DevicePath != NULL);\r | |
0ad78d07 | 346 | //\r |
347 | // EFI_UNSUPPORTED is returned for device path is not supported in PEI phase.\r | |
348 | //\r | |
2287f237 | 349 | return EFI_UNSUPPORTED;\r |
350 | }\r | |
351 | \r | |
352 | \r | |
353 | /**\r | |
354 | Reports a status code with an extended data buffer.\r | |
355 | \r | |
356 | Allocates and fills in the extended data section of a status code with the\r | |
357 | extended data specified by ExtendedData and ExtendedDataSize. ExtendedData\r | |
358 | is assumed to be one of the data structures specified in Related Definitions.\r | |
359 | These data structure do not have the standard header, so this function is\r | |
360 | responsible for allocating a buffer large enough for the standard header and\r | |
361 | the extended data passed into this function. The standard header is filled\r | |
362 | in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported\r | |
363 | with a zero instance and a caller ID of gEfiCallerIdGuid.\r | |
364 | \r | |
365 | ReportStatusCodeWithExtendedData()must actively prevent recursion. If\r | |
366 | ReportStatusCodeWithExtendedData() is called while processing another any other\r | |
367 | Report Status Code Library function, then ReportStatusCodeWithExtendedData()\r | |
368 | must return EFI_DEVICE_ERROR immediately.\r | |
369 | \r | |
370 | If ExtendedData is NULL, then ASSERT().\r | |
371 | If ExtendedDataSize is 0, then ASSERT().\r | |
372 | \r | |
373 | @param Type Status code type.\r | |
374 | @param Value Status code value.\r | |
375 | @param ExtendedData Pointer to the extended data buffer to be reported.\r | |
376 | @param ExtendedDataSize The size, in bytes, of the extended data buffer to\r | |
377 | be reported.\r | |
378 | \r | |
379 | @retval EFI_SUCCESS The status code was reported with the extended\r | |
380 | data specified by ExtendedData and ExtendedDataSize.\r | |
381 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r | |
382 | extended data section.\r | |
383 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
384 | \r | |
385 | **/\r | |
386 | EFI_STATUS\r | |
387 | EFIAPI\r | |
388 | ReportStatusCodeWithExtendedData (\r | |
389 | IN EFI_STATUS_CODE_TYPE Type,\r | |
390 | IN EFI_STATUS_CODE_VALUE Value,\r | |
391 | IN CONST VOID *ExtendedData,\r | |
392 | IN UINTN ExtendedDataSize\r | |
393 | )\r | |
394 | {\r | |
395 | ASSERT (ExtendedData != NULL);\r | |
396 | ASSERT (ExtendedDataSize != 0);\r | |
397 | return ReportStatusCodeEx (\r | |
398 | Type,\r | |
399 | Value,\r | |
400 | 0,\r | |
401 | NULL,\r | |
402 | NULL,\r | |
403 | ExtendedData,\r | |
404 | ExtendedDataSize\r | |
405 | );\r | |
406 | }\r | |
407 | \r | |
408 | \r | |
409 | /**\r | |
410 | Reports a status code with full parameters.\r | |
411 | \r | |
412 | The function reports a status code. If ExtendedData is NULL and ExtendedDataSize\r | |
413 | is 0, then an extended data buffer is not reported. If ExtendedData is not\r | |
414 | NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.\r | |
415 | ExtendedData is assumed not have the standard status code header, so this function\r | |
416 | is responsible for allocating a buffer large enough for the standard header and\r | |
417 | the extended data passed into this function. The standard header is filled in\r | |
418 | with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a\r | |
419 | GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with\r | |
420 | an instance specified by Instance and a caller ID specified by CallerId. If\r | |
421 | CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r | |
422 | \r | |
423 | ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx()\r | |
424 | is called while processing another any other Report Status Code Library function,\r | |
425 | then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.\r | |
426 | \r | |
427 | If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r | |
428 | If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r | |
429 | \r | |
430 | @param Type Status code type.\r | |
431 | @param Value Status code value.\r | |
432 | @param Instance Status code instance number.\r | |
433 | @param CallerId Pointer to a GUID that identifies the caller of this\r | |
434 | function. If this parameter is NULL, then a caller\r | |
435 | ID of gEfiCallerIdGuid is used.\r | |
436 | @param ExtendedDataGuid Pointer to the GUID for the extended data buffer.\r | |
437 | If this parameter is NULL, then a the status code\r | |
438 | standard header is filled in with\r | |
439 | gEfiStatusCodeSpecificDataGuid.\r | |
440 | @param ExtendedData Pointer to the extended data buffer. This is an\r | |
441 | optional parameter that may be NULL.\r | |
442 | @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r | |
443 | \r | |
444 | @retval EFI_SUCCESS The status code was reported.\r | |
445 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate\r | |
446 | the extended data section if it was specified.\r | |
447 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
448 | \r | |
449 | **/\r | |
450 | EFI_STATUS\r | |
451 | EFIAPI\r | |
452 | ReportStatusCodeEx (\r | |
453 | IN EFI_STATUS_CODE_TYPE Type,\r | |
454 | IN EFI_STATUS_CODE_VALUE Value,\r | |
455 | IN UINT32 Instance,\r | |
456 | IN CONST EFI_GUID *CallerId OPTIONAL,\r | |
457 | IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,\r | |
458 | IN CONST VOID *ExtendedData OPTIONAL,\r | |
459 | IN UINTN ExtendedDataSize\r | |
460 | )\r | |
461 | {\r | |
462 | EFI_STATUS_CODE_DATA *StatusCodeData;\r | |
463 | UINT64 Buffer[MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)];\r | |
464 | \r | |
0ad78d07 | 465 | //\r |
466 | // If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r | |
467 | //\r | |
2287f237 | 468 | ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r |
0ad78d07 | 469 | //\r |
470 | // If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r | |
471 | //\r | |
2287f237 | 472 | ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r |
473 | \r | |
474 | if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r | |
475 | return EFI_OUT_OF_RESOURCES;\r | |
476 | }\r | |
477 | StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;\r | |
478 | StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r | |
479 | StatusCodeData->Size = (UINT16)ExtendedDataSize;\r | |
480 | if (ExtendedDataGuid == NULL) {\r | |
481 | ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;\r | |
482 | }\r | |
483 | CopyGuid (&StatusCodeData->Type, ExtendedDataGuid);\r | |
261136bc | 484 | if (ExtendedData != NULL) {\r |
485 | CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize);\r | |
486 | }\r | |
2287f237 | 487 | if (CallerId == NULL) {\r |
488 | CallerId = &gEfiCallerIdGuid;\r | |
489 | }\r | |
490 | return InternalReportStatusCode (Type, Value, Instance, CallerId, StatusCodeData);\r | |
491 | }\r | |
492 | \r | |
493 | \r | |
494 | /**\r | |
495 | Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled\r | |
496 | \r | |
497 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED\r | |
498 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
499 | \r | |
500 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r | |
501 | PcdReportStatusCodeProperyMask is set.\r | |
502 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r | |
503 | PcdReportStatusCodeProperyMask is clear.\r | |
504 | \r | |
505 | **/\r | |
506 | BOOLEAN\r | |
507 | EFIAPI\r | |
508 | ReportProgressCodeEnabled (\r | |
509 | VOID\r | |
510 | )\r | |
511 | {\r | |
0ad78d07 | 512 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r |
2287f237 | 513 | }\r |
514 | \r | |
515 | \r | |
516 | /**\r | |
517 | Returns TRUE if status codes of type EFI_ERROR_CODE are enabled\r | |
518 | \r | |
519 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED\r | |
520 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
521 | \r | |
522 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r | |
523 | PcdReportStatusCodeProperyMask is set.\r | |
524 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r | |
525 | PcdReportStatusCodeProperyMask is clear.\r | |
526 | \r | |
527 | **/\r | |
528 | BOOLEAN\r | |
529 | EFIAPI\r | |
530 | ReportErrorCodeEnabled (\r | |
531 | VOID\r | |
532 | )\r | |
533 | {\r | |
0ad78d07 | 534 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r |
2287f237 | 535 | }\r |
536 | \r | |
537 | \r | |
538 | /**\r | |
539 | Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled\r | |
540 | \r | |
541 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED\r | |
542 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
543 | \r | |
544 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r | |
545 | PcdReportStatusCodeProperyMask is set.\r | |
546 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r | |
547 | PcdReportStatusCodeProperyMask is clear.\r | |
548 | \r | |
549 | **/\r | |
550 | BOOLEAN\r | |
551 | EFIAPI\r | |
552 | ReportDebugCodeEnabled (\r | |
553 | VOID\r | |
554 | )\r | |
555 | {\r | |
0ad78d07 | 556 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r |
2287f237 | 557 | }\r |