]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
Update comments.
[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
d117ee1f 284 // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO are for variable arguments\r
285 // of format in DEBUG string. Its address is returned in Marker and has to be 64-bit aligned.\r
2cbfa7c7 286 // It must be noticed that EFI_DEBUG_INFO follows EFI_STATUS_CODE_DATA, whose size is\r
287 // 20 bytes. The size of EFI_DEBUG_INFO is 4 bytes, so we can ensure that Marker\r
288 // returned is 64-bit aligned.\r
289 // 64-bit aligned is a must, otherwise retrieving 64-bit parameter from BASE_LIST will\r
290 // cause unalignment exception.\r
291 //\r
292 *Marker = (BASE_LIST) (DebugInfo + 1);\r
2287f237 293 *Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);\r
294\r
295 return TRUE;\r
296}\r
297\r
298\r
299/**\r
300 Reports a status code.\r
301\r
302 Reports the status code specified by the parameters Type and Value. Status\r
303 code also require an instance, caller ID, and extended data. This function\r
304 passed in a zero instance, NULL extended data, and a caller ID of\r
305 gEfiCallerIdGuid, which is the GUID for the module.\r
306\r
307 ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode()\r
308 is called while processing another any other Report Status Code Library function,\r
309 then ReportStatusCode() must return immediately.\r
310\r
311 @param Type Status code type.\r
312 @param Value Status code value.\r
313\r
314 @retval EFI_SUCCESS The status code was reported.\r
315 @retval EFI_DEVICE_ERROR There status code could not be reported due to a\r
316 device error.\r
317 @retval EFI_UNSUPPORTED Report status code is not supported\r
318\r
319**/\r
320EFI_STATUS\r
321EFIAPI\r
322ReportStatusCode (\r
323 IN EFI_STATUS_CODE_TYPE Type,\r
324 IN EFI_STATUS_CODE_VALUE Value\r
325 )\r
326{\r
327 return InternalReportStatusCode (Type, Value, 0, &gEfiCallerIdGuid, NULL);\r
328}\r
329\r
330\r
331/**\r
332 Reports a status code with a Device Path Protocol as the extended data.\r
333\r
334 Allocates and fills in the extended data section of a status code with the\r
335 Device Path Protocol specified by DevicePath. This function is responsible\r
336 for allocating a buffer large enough for the standard header and the device\r
337 path. The standard header is filled in with a GUID of\r
338 gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero\r
339 instance and a caller ID of gEfiCallerIdGuid.\r
340\r
341 ReportStatusCodeWithDevicePath()must actively prevent recursion. If\r
342 ReportStatusCodeWithDevicePath() is called while processing another any other\r
343 Report Status Code Library function, then ReportStatusCodeWithDevicePath()\r
344 must return EFI_DEVICE_ERROR immediately.\r
345\r
346 If DevicePath is NULL, then ASSERT().\r
347\r
348 @param Type Status code type.\r
349 @param Value Status code value.\r
350 @param DevicePath Pointer to the Device Path Protocol to be reported.\r
351\r
352 @retval EFI_SUCCESS The status code was reported with the extended\r
353 data specified by DevicePath.\r
354 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r
355 extended data section.\r
356 @retval EFI_UNSUPPORTED Report status code is not supported\r
357\r
358**/\r
359EFI_STATUS\r
360EFIAPI\r
361ReportStatusCodeWithDevicePath (\r
362 IN EFI_STATUS_CODE_TYPE Type,\r
363 IN EFI_STATUS_CODE_VALUE Value,\r
364 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
365 )\r
366{\r
367 ASSERT (DevicePath != NULL);\r
368 return ReportStatusCodeWithExtendedData (\r
369 Type,\r
370 Value,\r
371 (VOID *)DevicePath,\r
2cbfa7c7 372 GetDevicePathSize (DevicePath)\r
2287f237 373 );\r
374}\r
375\r
376\r
377/**\r
378 Reports a status code with an extended data buffer.\r
379\r
380 Allocates and fills in the extended data section of a status code with the\r
381 extended data specified by ExtendedData and ExtendedDataSize. ExtendedData\r
382 is assumed to be one of the data structures specified in Related Definitions.\r
383 These data structure do not have the standard header, so this function is\r
384 responsible for allocating a buffer large enough for the standard header and\r
385 the extended data passed into this function. The standard header is filled\r
386 in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported\r
387 with a zero instance and a caller ID of gEfiCallerIdGuid.\r
388\r
389 ReportStatusCodeWithExtendedData()must actively prevent recursion. If\r
390 ReportStatusCodeWithExtendedData() is called while processing another any other\r
391 Report Status Code Library function, then ReportStatusCodeWithExtendedData()\r
392 must return EFI_DEVICE_ERROR immediately.\r
393\r
394 If ExtendedData is NULL, then ASSERT().\r
395 If ExtendedDataSize is 0, then ASSERT().\r
396\r
397 @param Type Status code type.\r
398 @param Value Status code value.\r
399 @param ExtendedData Pointer to the extended data buffer to be reported.\r
400 @param ExtendedDataSize The size, in bytes, of the extended data buffer to\r
401 be reported.\r
402\r
403 @retval EFI_SUCCESS The status code was reported with the extended\r
404 data specified by ExtendedData and ExtendedDataSize.\r
405 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r
406 extended data section.\r
407 @retval EFI_UNSUPPORTED Report status code is not supported\r
408\r
409**/\r
410EFI_STATUS\r
411EFIAPI\r
412ReportStatusCodeWithExtendedData (\r
413 IN EFI_STATUS_CODE_TYPE Type,\r
414 IN EFI_STATUS_CODE_VALUE Value,\r
415 IN CONST VOID *ExtendedData,\r
416 IN UINTN ExtendedDataSize\r
417 )\r
418{\r
419 ASSERT (ExtendedData != NULL);\r
420 ASSERT (ExtendedDataSize != 0);\r
421 return ReportStatusCodeEx (\r
422 Type,\r
423 Value,\r
424 0,\r
425 NULL,\r
426 NULL,\r
427 ExtendedData,\r
428 ExtendedDataSize\r
429 );\r
430}\r
431\r
432\r
433/**\r
434 Reports a status code with full parameters.\r
435\r
436 The function reports a status code. If ExtendedData is NULL and ExtendedDataSize\r
437 is 0, then an extended data buffer is not reported. If ExtendedData is not\r
438 NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.\r
439 ExtendedData is assumed not have the standard status code header, so this function\r
440 is responsible for allocating a buffer large enough for the standard header and\r
441 the extended data passed into this function. The standard header is filled in\r
442 with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a\r
8191cd5e 443 GUID of gEfiStatusCodeSpecificDataGuid is used. The status code is reported with\r
2287f237 444 an instance specified by Instance and a caller ID specified by CallerId. If\r
445 CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r
446\r
e5516b49 447 ReportStatusCodeEx()must actively prevent recursion. If\r
448 ReportStatusCodeEx() is called while processing another any\r
449 other Report Status Code Library function, then\r
450 ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.\r
2287f237 451\r
452 If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
453 If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r
454\r
455 @param Type Status code type.\r
456 @param Value Status code value.\r
457 @param Instance Status code instance number.\r
458 @param CallerId Pointer to a GUID that identifies the caller of this\r
459 function. If this parameter is NULL, then a caller\r
460 ID of gEfiCallerIdGuid is used.\r
461 @param ExtendedDataGuid Pointer to the GUID for the extended data buffer.\r
462 If this parameter is NULL, then a the status code\r
463 standard header is filled in with\r
464 gEfiStatusCodeSpecificDataGuid.\r
465 @param ExtendedData Pointer to the extended data buffer. This is an\r
466 optional parameter that may be NULL.\r
467 @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r
468\r
469 @retval EFI_SUCCESS The status code was reported.\r
470 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate\r
471 the extended data section if it was specified.\r
472 @retval EFI_UNSUPPORTED Report status code is not supported\r
473\r
474**/\r
475EFI_STATUS\r
476EFIAPI\r
477ReportStatusCodeEx (\r
478 IN EFI_STATUS_CODE_TYPE Type,\r
479 IN EFI_STATUS_CODE_VALUE Value,\r
480 IN UINT32 Instance,\r
481 IN CONST EFI_GUID *CallerId OPTIONAL,\r
482 IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,\r
483 IN CONST VOID *ExtendedData OPTIONAL,\r
484 IN UINTN ExtendedDataSize\r
485 )\r
486{\r
2cbfa7c7 487 EFI_STATUS Status;\r
488 EFI_STATUS_CODE_DATA *StatusCodeData;\r
489\r
490 ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
491 ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
492\r
493 //\r
494 // Allocate space for the Status Code Header and its buffer\r
495 //\r
496 StatusCodeData = NULL;\r
497 StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);\r
498 if (StatusCodeData == NULL) {\r
499 return EFI_OUT_OF_RESOURCES;\r
500 }\r
501\r
502 //\r
503 // Fill in the extended data header\r
504 //\r
505 StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r
506 StatusCodeData->Size = (UINT16)ExtendedDataSize;\r
507 if (ExtendedDataGuid == NULL) {\r
508 ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;\r
509 }\r
510 CopyGuid (&StatusCodeData->Type, ExtendedDataGuid);\r
511\r
512 //\r
513 // Fill in the extended data buffer\r
514 //\r
515 if (ExtendedData != NULL) {\r
516 CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize);\r
517 }\r
518\r
519 //\r
520 // Report the status code\r
521 //\r
522 if (CallerId == NULL) {\r
523 CallerId = &gEfiCallerIdGuid;\r
524 }\r
525 Status = InternalReportStatusCode (Type, Value, Instance, CallerId, StatusCodeData);\r
526\r
527 //\r
528 // Free the allocated buffer\r
529 //\r
530 FreePool (StatusCodeData);\r
2287f237 531\r
532 return Status;\r
533}\r
534\r
535\r
536/**\r
537 Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled\r
538\r
539 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED\r
540 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
541\r
542 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r
543 PcdReportStatusCodeProperyMask is set.\r
544 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r
545 PcdReportStatusCodeProperyMask is clear.\r
546\r
547**/\r
548BOOLEAN\r
549EFIAPI\r
550ReportProgressCodeEnabled (\r
551 VOID\r
552 )\r
553{\r
2cbfa7c7 554 return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
2287f237 555}\r
556\r
557\r
558/**\r
559 Returns TRUE if status codes of type EFI_ERROR_CODE are enabled\r
560\r
561 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED\r
562 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
563\r
564 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r
565 PcdReportStatusCodeProperyMask is set.\r
566 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r
567 PcdReportStatusCodeProperyMask is clear.\r
568\r
569**/\r
570BOOLEAN\r
571EFIAPI\r
572ReportErrorCodeEnabled (\r
573 VOID\r
574 )\r
575{\r
2cbfa7c7 576 return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
2287f237 577}\r
578\r
579\r
580/**\r
581 Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled\r
582\r
583 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED\r
584 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
585\r
586 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r
587 PcdReportStatusCodeProperyMask is set.\r
588 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r
589 PcdReportStatusCodeProperyMask is clear.\r
590\r
591**/\r
592BOOLEAN\r
593EFIAPI\r
594ReportDebugCodeEnabled (\r
595 VOID\r
596 )\r
597{\r
2cbfa7c7 598 return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
2287f237 599}\r