]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/ReportStatusCodeLib.h
add function header
[mirror_edk2.git] / MdePkg / Include / Library / ReportStatusCodeLib.h
CommitLineData
878ddf1f 1/** @file\r
2 Report Status Code Library public .h file\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
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
15#ifndef __REPORT_STATUS_CODE_LIB_H__\r
16#define __REPORT_STATUS_CODE_LIB_H__\r
17\r
18//\r
19// Declare bits for PcdReportStatusCodePropertyMask\r
20//\r
21#define REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED 0x00000001\r
22#define REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED 0x00000002\r
23#define REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED 0x00000004\r
24#define REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008\r
25#define REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010\r
26\r
27//\r
28// Extended Data structure definitions with EFI_STATUS_CODE_DATA headers removed\r
29//\r
30\r
31///\r
32/// Voltage Extended Error Data\r
33///\r
34typedef struct {\r
35 EFI_EXP_BASE10_DATA Voltage;\r
36 EFI_EXP_BASE10_DATA Threshold;\r
37} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_VOLTAGE_ERROR_DATA;\r
38\r
39///\r
40/// Microcode Update Extended Error Data\r
41///\r
42typedef struct {\r
43 UINT32 Version;\r
44} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_MICROCODE_UPDATE_ERROR_DATA;\r
45\r
46///\r
47/// Asynchronous Timer Extended Error Data\r
48///\r
49typedef struct {\r
50 EFI_EXP_BASE10_DATA TimerLimit;\r
51} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_TIMER_EXPIRED_ERROR_DATA;\r
52\r
53///\r
54/// Host Processor Mismatch Extended Error Data\r
55///\r
56typedef struct {\r
57 UINT32 Instance;\r
58 UINT16 Attributes;\r
59} REPORT_STATUS_CODE_LIBRARY_HOST_PROCESSOR_MISMATCH_ERROR_DATA;\r
60\r
61///\r
62/// Thermal Extended Error Data\r
63///\r
64typedef struct {\r
65 EFI_EXP_BASE10_DATA Temperature;\r
66 EFI_EXP_BASE10_DATA Threshold;\r
67} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_THERMAL_ERROR_DATA;\r
68\r
69///\r
70/// Processor Disabled Extended Error Data\r
71///\r
72typedef struct {\r
73 UINT32 Cause;\r
74 BOOLEAN SoftwareDisabled;\r
75} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_CPU_DISABLED_ERROR_DATA;\r
76\r
77///\r
78/// Embedded cache init extended data\r
79///\r
80typedef struct {\r
81 UINT32 Level;\r
82 EFI_INIT_CACHE_TYPE Type;\r
83} REPORT_STATUS_CODE_LIBRARY_CACHE_INIT_DATA;\r
84\r
85///\r
86/// Memory Extended Error Data\r
87///\r
88typedef struct {\r
89 EFI_MEMORY_ERROR_GRANULARITY Granularity;\r
90 EFI_MEMORY_ERROR_OPERATION Operation;\r
91 UINTN Syndrome;\r
92 EFI_PHYSICAL_ADDRESS Address;\r
93 UINTN Resolution;\r
94} REPORT_STATUS_CODE_LIBRARY_MEMORY_EXTENDED_ERROR_DATA;\r
95\r
96///\r
97/// DIMM number\r
98///\r
99typedef struct {\r
100 UINT16 Array;\r
101 UINT16 Device;\r
102} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_DIMM_NUMBER;\r
103\r
104///\r
105/// Memory Module Mismatch Extended Error Data\r
106///\r
107typedef struct {\r
108 EFI_STATUS_CODE_DIMM_NUMBER Instance;\r
109} REPORT_STATUS_CODE_LIBRARY_MEMORY_MODULE_MISMATCH_ERROR_DATA;\r
110\r
111///\r
112/// Memory Range Extended Data\r
113///\r
114typedef struct {\r
115 EFI_PHYSICAL_ADDRESS Start;\r
116 EFI_PHYSICAL_ADDRESS Length;\r
117} REPORT_STATUS_CODE_LIBRARY_MEMORY_RANGE_EXTENDED_DATA;\r
118\r
119///\r
120/// Device handle Extended Data. Used for many\r
121/// errors and progress codes to point to the device.\r
122///\r
123typedef struct {\r
124 EFI_HANDLE Handle;\r
125} REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA;\r
126\r
127typedef struct {\r
128 UINT8 *DevicePath;\r
129} REPORT_STATUS_CODE_LIBRARY_DEVICE_PATH_EXTENDED_DATA;\r
130\r
131typedef struct {\r
132 EFI_HANDLE ControllerHandle;\r
133 EFI_HANDLE DriverBindingHandle;\r
134 UINT16 DevicePathSize;\r
135 UINT8 *RemainingDevicePath;\r
136} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_START_EXTENDED_DATA;\r
137\r
138///\r
139/// Resource Allocation Failure Extended Error Data\r
140///\r
141typedef struct {\r
142 UINT32 Bar;\r
143 UINT16 DevicePathSize;\r
144 UINT16 ReqResSize;\r
145 UINT16 AllocResSize;\r
146 UINT8 *DevicePath;\r
147 UINT8 *ReqRes;\r
148 UINT8 *AllocRes;\r
149} REPORT_STATUS_CODE_LIBRARY_RESOURCE_ALLOC_FAILURE_ERROR_DATA;\r
150\r
151///\r
152/// Extended Error Data for Assert\r
153///\r
154typedef struct {\r
155 UINT32 LineNumber;\r
156 UINT32 FileNameSize;\r
157 EFI_STATUS_CODE_STRING_DATA *FileName;\r
158} REPORT_STATUS_CODE_LIBRARY_DEBUG_ASSERT_DATA;\r
159\r
160///\r
161/// System Context Data EBC/IA32/IPF\r
162///\r
163typedef struct {\r
164 EFI_STATUS_CODE_EXCEP_SYSTEM_CONTEXT Context;\r
165} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_EXCEP_EXTENDED_DATA;\r
166\r
167///\r
168/// Legacy Oprom extended data\r
169///\r
170typedef struct {\r
171 EFI_HANDLE DeviceHandle;\r
172 EFI_PHYSICAL_ADDRESS RomImageBase;\r
173} REPORT_STATUS_CODE_LIBRARY_LEGACY_OPROM_EXTENDED_DATA;\r
174\r
175//\r
176// Extern for the modules Caller ID GUID\r
177//\r
178extern EFI_GUID gEfiCallerIdGuid;\r
179\r
180/**\r
181 Converts a status code to an 8-bit POST code value.\r
182\r
183 Converts the status code specified by CodeType and Value to an 8-bit POST code \r
184 and returns the 8-bit POST code in PostCode. If CodeType is an \r
185 EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode \r
186 are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits \r
187 24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned. \r
188\r
189 If PostCode is NULL, then ASSERT().\r
190\r
191 @param CodeType The type of status code being converted.\r
192 @param Value The status code value being converted.\r
193 @param PostCode A pointer to the 8-bit POST code value to return. \r
194\r
195 @retval TRUE The status code specified by CodeType and Value was converted \r
196 to an 8-bit POST code and returned in PostCode.\r
197 @retval FALSE The status code specified by CodeType and Value could not be \r
198 converted to an 8-bit POST code value.\r
199\r
200**/\r
201BOOLEAN\r
202EFIAPI\r
203CodeTypeToPostCode (\r
204 IN EFI_STATUS_CODE_TYPE CodeType,\r
205 IN EFI_STATUS_CODE_VALUE Value,\r
206 OUT UINT8 *PostCode\r
207 );\r
208\r
209\r
210/**\r
211 Extracts ASSERT() information from a status code structure.\r
212\r
213 Converts the status code specified by CodeType, Value, and Data to the ASSERT()\r
214 arguments specified by Filename, Description, and LineNumber. If CodeType is \r
215 an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and \r
216 Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract \r
217 Filename, Description, and LineNumber from the optional data area of the \r
218 status code buffer specified by Data. The optional data area of Data contains \r
219 a Null-terminated ASCII string for the FileName, followed by a Null-terminated \r
220 ASCII string for the Description, followed by a 32-bit LineNumber. If the \r
221 ASSERT() information could be extracted from Data, then return TRUE. \r
222 Otherwise, FALSE is returned. \r
223\r
224 If Data is NULL, then ASSERT().\r
225 If Filename is NULL, then ASSERT().\r
226 If Description is NULL, then ASSERT().\r
227 If LineNumber is NULL, then ASSERT().\r
228\r
229 @param CodeType The type of status code being converted.\r
230 @param Value The status code value being converted.\r
231 @param Data Pointer to status code data buffer. \r
232 @param Filename Pointer to the source file name that generated the ASSERT().\r
233 @param Description Pointer to the description of the ASSERT().\r
234 @param LineNumber Pointer to source line number that generated the ASSERT().\r
235\r
236 @retval TRUE The status code specified by CodeType, Value, and Data was \r
237 converted ASSERT() arguments specified by Filename, Description, \r
238 and LineNumber.\r
239 @retval FALSE The status code specified by CodeType, Value, and Data could \r
240 not be converted to ASSERT() arguments.\r
241\r
242**/\r
243BOOLEAN\r
244EFIAPI\r
245ReportStatusCodeExtractAssertInfo (\r
246 IN EFI_STATUS_CODE_TYPE CodeType,\r
247 IN EFI_STATUS_CODE_VALUE Value, \r
248 IN EFI_STATUS_CODE_DATA *Data, \r
249 OUT CHAR8 **Filename,\r
250 OUT CHAR8 **Description,\r
251 OUT UINT32 *LineNumber\r
252 );\r
253\r
254\r
255/**\r
256 Extracts DEBUG() information from a status code structure.\r
257\r
258 Converts the status code specified by Data to the DEBUG() arguments specified \r
259 by ErrorLevel, Marker, and Format. If type GUID in Data is \r
260 EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and \r
261 Format from the optional data area of the status code buffer specified by Data. \r
262 The optional data area of Data contains a 32-bit ErrorLevel followed by Marker \r
263 which is 12 UINTN parameters, followed by a Null-terminated ASCII string for \r
264 the Format. If the DEBUG() information could be extracted from Data, then \r
265 return TRUE. Otherwise, FALSE is returned.\r
266\r
267 If Data is NULL, then ASSERT().\r
268 If ErrorLevel is NULL, then ASSERT().\r
269 If Marker is NULL, then ASSERT().\r
270 If Format is NULL, then ASSERT().\r
271\r
272 @param Data Pointer to status code data buffer. \r
273 @param ErrorLevel Pointer to error level mask for a debug message.\r
274 @param Marker Pointer to the variable argument list associated with Format.\r
275 @param Format Pointer to a Null-terminated ASCII format string of a \r
276 debug message.\r
277\r
278 @retval TRUE The status code specified by Data was converted DEBUG() arguments \r
279 specified by ErrorLevel, Marker, and Format.\r
280 @retval FALSE The status code specified by Data could not be converted to \r
281 DEBUG() arguments.\r
282\r
283**/\r
284BOOLEAN\r
285EFIAPI\r
286ReportStatusCodeExtractDebugInfo (\r
287 IN EFI_STATUS_CODE_DATA *Data,\r
288 OUT UINT32 *ErrorLevel,\r
289 OUT VA_LIST *Marker,\r
290 OUT CHAR8 **Format\r
291 );\r
292\r
293\r
294/**\r
295 Reports a status code.\r
296\r
297 Reports the status code specified by the parameters Type and Value. Status \r
298 code also require an instance, caller ID, and extended data. This function \r
299 passed in a zero instance, NULL extended data, and a caller ID of \r
300 gEfiCallerIdGuid, which is the GUID for the module. \r
301 \r
302 ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode() \r
303 is called while processing another any other Report Status Code Library function,\r
304 then ReportStatusCode() must return immediately.\r
305\r
306 @param Type Status code type. \r
307 @param Value Status code value.\r
308\r
309 @retval EFI_SUCCESS The status code was reported.\r
310 @retval EFI_DEVICE_ERROR There status code could not be reported due to a \r
311 device error.\r
312 @retval EFI_UNSUPPORTED Report status code is not supported\r
313\r
314**/\r
315EFI_STATUS\r
316EFIAPI\r
317ReportStatusCode (\r
318 IN EFI_STATUS_CODE_TYPE Type,\r
319 IN EFI_STATUS_CODE_VALUE Value\r
320 );\r
321\r
322\r
323/**\r
324 Reports a status code with a Device Path Protocol as the extended data.\r
325\r
326 Allocates and fills in the extended data section of a status code with the \r
327 Device Path Protocol specified by DevicePath. This function is responsible \r
328 for allocating a buffer large enough for the standard header and the device \r
329 path. The standard header is filled in with a GUID of \r
330 gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero \r
331 instance and a caller ID of gEfiCallerIdGuid.\r
332\r
333 ReportStatusCodeWithDevicePath()must actively prevent recursion. If \r
334 ReportStatusCodeWithDevicePath() is called while processing another any other \r
335 Report Status Code Library function, then ReportStatusCodeWithDevicePath() \r
336 must return EFI_DEVICE_ERROR immediately.\r
337\r
338 If DevicePath is NULL, then ASSERT().\r
339\r
340 @param Type Status code type. \r
341 @param Value Status code value.\r
342 @param DevicePath Pointer to the Device Path Protocol to be reported.\r
343\r
344 @retval EFI_SUCCESS The status code was reported with the extended \r
345 data specified by DevicePath.\r
346 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the \r
347 extended data section.\r
348 @retval EFI_UNSUPPORTED Report status code is not supported\r
349\r
350**/\r
351EFI_STATUS\r
352EFIAPI\r
353ReportStatusCodeWithDevicePath (\r
354 IN EFI_STATUS_CODE_TYPE Type,\r
355 IN EFI_STATUS_CODE_VALUE Value,\r
356 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
357 );\r
358\r
359\r
360/**\r
361 Reports a status code with an extended data buffer.\r
362\r
363 Allocates and fills in the extended data section of a status code with the \r
364 extended data specified by ExtendedData and ExtendedDataSize. ExtendedData \r
365 is assumed to be one of the data structures specified in Related Definitions. \r
366 These data structure do not have the standard header, so this function is \r
367 responsible for allocating a buffer large enough for the standard header and \r
368 the extended data passed into this function. The standard header is filled \r
369 in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported \r
370 with a zero instance and a caller ID of gEfiCallerIdGuid.\r
371\r
372 ReportStatusCodeWithExtendedData()must actively prevent recursion. If \r
373 ReportStatusCodeWithExtendedData() is called while processing another any other \r
374 Report Status Code Library function, then ReportStatusCodeWithExtendedData() \r
375 must return EFI_DEVICE_ERROR immediately.\r
376\r
377 If ExtendedData is NULL, then ASSERT().\r
378 If ExtendedDataSize is 0, then ASSERT().\r
379\r
380 @param Type Status code type. \r
381 @param Value Status code value.\r
382 @param ExtendedData Pointer to the extended data buffer to be reported.\r
383 @param ExtendedDataSize The size, in bytes, of the extended data buffer to \r
384 be reported.\r
385\r
386 @retval EFI_SUCCESS The status code was reported with the extended \r
387 data specified by ExtendedData and ExtendedDataSize.\r
388 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the \r
389 extended data section.\r
390 @retval EFI_UNSUPPORTED Report status code is not supported\r
391\r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395ReportStatusCodeWithExtendedData (\r
396 IN EFI_STATUS_CODE_TYPE Type,\r
397 IN EFI_STATUS_CODE_VALUE Value,\r
398 IN VOID *ExtendedData,\r
399 IN UINTN ExtendedDataSize\r
400 );\r
401\r
402\r
403/**\r
404 Reports a status code with full parameters.\r
405\r
406 The function reports a status code. If ExtendedData is NULL and ExtendedDataSize \r
407 is 0, then an extended data buffer is not reported. If ExtendedData is not \r
408 NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated. \r
409 ExtendedData is assumed not have the standard status code header, so this function \r
410 is responsible for allocating a buffer large enough for the standard header and \r
411 the extended data passed into this function. The standard header is filled in \r
412 with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a \r
413 GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with \r
414 an instance specified by Instance and a caller ID specified by CallerId. If \r
415 CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r
416\r
417 ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx() \r
418 is called while processing another any other Report Status Code Library function, \r
419 then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.\r
420\r
421 If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
422 If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r
423\r
424 @param Type Status code type. \r
425 @param Value Status code value.\r
426 @param Instance Status code instance number.\r
427 @param CallerId Pointer to a GUID that identifies the caller of this \r
428 function. If this parameter is NULL, then a caller \r
429 ID of gEfiCallerIdGuid is used.\r
430 @param ExtendedDataGuid Pointer to the GUID for the extended data buffer. \r
431 If this parameter is NULL, then a the status code \r
432 standard header is filled in with \r
433 gEfiStatusCodeSpecificDataGuid.\r
434 @param ExtendedData Pointer to the extended data buffer. This is an \r
435 optional parameter that may be NULL.\r
436 @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r
437\r
438 @retval EFI_SUCCESS The status code was reported.\r
439 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate \r
440 the extended data section if it was specified.\r
441 @retval EFI_UNSUPPORTED Report status code is not supported\r
442\r
443**/\r
444EFI_STATUS\r
445EFIAPI\r
446ReportStatusCodeEx (\r
447 IN EFI_STATUS_CODE_TYPE Type,\r
448 IN EFI_STATUS_CODE_VALUE Value,\r
449 IN UINT32 Instance,\r
450 IN EFI_GUID *CallerId OPTIONAL,\r
451 IN EFI_GUID *ExtendedDataGuid OPTIONAL,\r
452 IN VOID *ExtendedData OPTIONAL,\r
453 IN UINTN ExtendedDataSize\r
454 );\r
455\r
456\r
457/**\r
458 Sends an 32-bit value to a POST card.\r
459\r
460 Sends the 32-bit value specified by Value to a POST card, and returns Value. \r
461 Some implementations of this library function may perform I/O operations \r
462 directly to a POST card device. Other implementations may send Value to \r
463 ReportStatusCode(), and the status code reporting mechanism will eventually \r
464 display the 32-bit value on the status reporting device.\r
465 \r
466 PostCode() must actively prevent recursion. If PostCode() is called while \r
467 processing another any other Report Status Code Library function, then \r
468 PostCode() must return Value immediately.\r
469\r
470 @param Value The 32-bit value to write to the POST card.\r
471\r
472 @return Value\r
473\r
474**/\r
475UINT32\r
476EFIAPI\r
477PostCode (\r
478 IN UINT32 Value\r
479 );\r
480\r
481\r
482/**\r
483 Sends an 32-bit value to a POST and associated ASCII string.\r
484\r
485 Sends the 32-bit value specified by Value to a POST card, and returns Value.\r
486 If Description is not NULL, then the ASCII string specified by Description is \r
487 also passed to the handler that displays the POST card value. Some \r
488 implementations of this library function may perform I/O operations directly \r
489 to a POST card device. Other implementations may send Value to ReportStatusCode(), \r
490 and the status code reporting mechanism will eventually display the 32-bit \r
491 value on the status reporting device. \r
492\r
493 PostCodeWithDescription()must actively prevent recursion. If \r
494 PostCodeWithDescription() is called while processing another any other Report \r
495 Status Code Library function, then PostCodeWithDescription() must return Value \r
496 immediately.\r
497\r
498 @param Value The 32-bit value to write to the POST card.\r
499 @param Description Pointer to an ASCII string that is a description of the \r
500 POST code value. This is an optional parameter that may \r
501 be NULL.\r
502\r
503 @return Value\r
504\r
505**/\r
506UINT32\r
507EFIAPI\r
508PostCodeWithDescription (\r
509 IN UINT32 Value,\r
510 IN CONST CHAR8 *Description OPTIONAL\r
511 );\r
512\r
513\r
514/**\r
515 Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled\r
516\r
517 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \r
518 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
519\r
520 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of \r
521 PcdReportStatusCodeProperyMask is set.\r
522 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of \r
523 PcdReportStatusCodeProperyMask is clear.\r
524\r
525**/\r
526BOOLEAN\r
527EFIAPI\r
528ReportProgressCodeEnabled (\r
529 VOID\r
530 );\r
531\r
532\r
533/**\r
534 Returns TRUE if status codes of type EFI_ERROR_CODE are enabled\r
535\r
536 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \r
537 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
538\r
539 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of \r
540 PcdReportStatusCodeProperyMask is set.\r
541 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of \r
542 PcdReportStatusCodeProperyMask is clear.\r
543\r
544**/\r
545BOOLEAN\r
546EFIAPI\r
547ReportErrorCodeEnabled (\r
548 VOID\r
549 );\r
550\r
551\r
552/**\r
553 Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled\r
554\r
555 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \r
556 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
557\r
558 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of \r
559 PcdReportStatusCodeProperyMask is set.\r
560 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of \r
561 PcdReportStatusCodeProperyMask is clear.\r
562\r
563**/\r
564BOOLEAN\r
565EFIAPI\r
566ReportDebugCodeEnabled (\r
567 VOID\r
568 );\r
569\r
570\r
571/**\r
572 Returns TRUE if POST Codes are enabled.\r
573\r
574 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED \r
575 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
576\r
577 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of \r
578 PcdReportStatusCodeProperyMask is set.\r
579 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of \r
580 PcdReportStatusCodeProperyMask is clear.\r
581\r
582**/\r
583BOOLEAN\r
584EFIAPI\r
585ReportPostCodeEnabled (\r
586 VOID\r
587 );\r
588\r
589\r
590/**\r
591 Returns TRUE if POST code descriptions are enabled.\r
592\r
593 This function returns TRUE if the \r
594 REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED bit of \r
595 PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
596\r
597 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED \r
598 bit of PcdReportStatusCodeProperyMask is set.\r
599 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED \r
600 bit of PcdReportStatusCodeProperyMask is clear.\r
601\r
602**/\r
603BOOLEAN\r
604EFIAPI\r
605ReportPostCodeDescriptionEnabled (\r
606 VOID\r
607 );\r
608\r
609\r
610/**\r
611 Reports a status code with minimal parameters if the status code type is enabled.\r
612\r
613 If the status code type specified by Type is enabled in \r
614 PcdReportStatusCodeProperyMask, then call ReportStatusCode() passing in Type \r
615 and Value.\r
616\r
617 @param Type Status code type. \r
618 @param Value Status code value.\r
619\r
620 @retval EFI_SUCCESS The status code was reported.\r
621 @retval EFI_DEVICE_ERROR There status code could not be reported due to a device error.\r
622 @retval EFI_UNSUPPORTED Report status code is not supported\r
623\r
624**/\r
625#define REPORT_STATUS_CODE(Type,Value) \\r
626 (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \\r
627 ReportStatusCode(Type,Value) : \\r
628 (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \\r
629 ReportStatusCode(Type,Value) : \\r
630 (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \\r
631 ReportStatusCode(Type,Value) : \\r
632 EFI_UNSUPPORTED\r
633\r
634\r
635/**\r
636 Reports a status code with a Device Path Protocol as the extended data if the \r
637 status code type is enabled.\r
638\r
639 If the status code type specified by Type is enabled in \r
640 PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithDevicePath() \r
641 passing in Type, Value, and DevicePath.\r
642\r
643 @param Type Status code type. \r
644 @param Value Status code value.\r
645 @param DevicePath Pointer to the Device Path Protocol to be reported.\r
646\r
647 @retval EFI_SUCCESS The status code was reported with the extended \r
648 data specified by DevicePath.\r
649 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the \r
650 extended data section.\r
651 @retval EFI_UNSUPPORTED Report status code is not supported\r
652\r
653**/\r
654#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type,Value,DevicePathParameter) \\r
655 (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \\r
656 ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \\r
657 (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \\r
658 ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \\r
659 (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \\r
660 ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \\r
661 EFI_UNSUPPORTED\r
662\r
663\r
664/**\r
665 Reports a status code with an extended data buffer if the status code type \r
666 is enabled.\r
667\r
668 If the status code type specified by Type is enabled in \r
669 PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithExtendedData() \r
670 passing in Type, Value, ExtendedData, and ExtendedDataSize.\r
671\r
672 @param Type Status code type. \r
673 @param Value Status code value.\r
674 @param ExtendedData Pointer to the extended data buffer to be reported.\r
675 @param ExtendedDataSize The size, in bytes, of the extended data buffer to\r
676 be reported.\r
677\r
678 @retval EFI_SUCCESS The status code was reported with the extended \r
679 data specified by ExtendedData and ExtendedDataSize.\r
680 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the \r
681 extended data section.\r
682 @retval EFI_UNSUPPORTED Report status code is not supported\r
683\r
684**/\r
685#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type,Value,ExtendedData,ExtendedDataSize) \\r
686 (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \\r
687 ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \\r
688 (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \\r
689 ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \\r
690 (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \\r
691 ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \\r
692 EFI_UNSUPPORTED\r
693\r
694/**\r
695 Reports a status code specifying all parameters if the status code type is enabled.\r
696\r
697 If the status code type specified by Type is enabled in \r
698 PcdReportStatusCodeProperyMask, then call ReportStatusCodeEx() passing in Type, \r
699 Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, and ExtendedDataSize.\r
700\r
701 @param Type Status code type. \r
702 @param Value Status code value.\r
703 @param Instance Status code instance number.\r
704 @param CallerId Pointer to a GUID that identifies the caller of this \r
705 function. If this parameter is NULL, then a caller \r
706 ID of gEfiCallerIdGuid is used.\r
707 @param ExtendedDataGuid Pointer to the GUID for the extended data buffer. \r
708 If this parameter is NULL, then a the status code \r
709 standard header is filled in with \r
710 gEfiStatusCodeSpecificDataGuid.\r
711 @param ExtendedData Pointer to the extended data buffer. This is an \r
712 optional parameter that may be NULL.\r
713 @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r
714\r
715 @retval EFI_SUCCESS The status code was reported.\r
716 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the \r
717 extended data section if it was specified.\r
718 @retval EFI_UNSUPPORTED Report status code is not supported\r
719\r
720**/\r
721#define REPORT_STATUS_CODE_EX(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) \\r
722 (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \\r
723 ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \\r
724 (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \\r
725 ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \\r
726 (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \\r
727 ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \\r
728 EFI_UNSUPPORTED\r
729\r
730/**\r
731 Sends an 32-bit value to a POST card.\r
732\r
733 If POST codes are enabled in PcdReportStatusCodeProperyMask, then call PostCode() \r
734 passing in Value. Value is returned.\r
735\r
736 @param Value The 32-bit value to write to the POST card.\r
737\r
738 @return Value\r
739\r
740**/\r
741#define POST_CODE(Value) ReportPostCodeEnabled() ? PostCode(Value) : Value\r
742\r
743/**\r
744 Sends an 32-bit value to a POST and associated ASCII string.\r
745\r
746 If POST codes and POST code descriptions are enabled in \r
747 PcdReportStatusCodeProperyMask, then call PostCodeWithDescription() passing in \r
748 Value and Description. If only POST codes are enabled, then call PostCode() \r
749 passing in Value. Value is returned.\r
750\r
751 @param Value The 32-bit value to write to the POST card.\r
752 @param Description Pointer to an ASCII string that is a description of the \r
753 POST code value.\r
754\r
755**/\r
756#define POST_CODE_WITH_DESCRIPTION(Value,Description) \\r
757 ReportPostCodeEnabled() ? \\r
758 (ReportPostCodeDescriptionEnabled() ? \\r
759 PostCodeWithDescription(Value,Description) : \\r
760 PostCode(Value)) : \\r
761 Value\r
762\r
763#endif\r