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