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