Home | History | Annotate | Download | only in BaseReportStatusCodeLibNull
      1 /** @file
      2   Null Base Report Status Code Library instance with empty functions.
      3 
      4   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php.
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #include <Base.h>
     16 #include <Library/ReportStatusCodeLib.h>
     17 #include <Library/DebugLib.h>
     18 
     19 /**
     20   Converts a status code to an 8-bit POST code value.
     21 
     22   Converts the status code specified by CodeType and Value to an 8-bit POST code
     23   and returns the 8-bit POST code in PostCode.  If CodeType is an
     24   EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode
     25   are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits
     26   24..26 of Value., and TRUE is returned.  Otherwise, FALSE is returned.
     27 
     28   If PostCode is NULL, then ASSERT().
     29 
     30   @param  CodeType  The type of status code being converted.
     31   @param  Value     The status code value being converted.
     32   @param  PostCode  A pointer to the 8-bit POST code value to return.
     33 
     34   @retval  TRUE   The status code specified by CodeType and Value was converted
     35                   to an 8-bit POST code and returned in  PostCode.
     36   @retval  FALSE  The status code specified by CodeType and Value could not be
     37                   converted to an 8-bit POST code value.
     38 
     39 **/
     40 BOOLEAN
     41 EFIAPI
     42 CodeTypeToPostCode (
     43   IN  EFI_STATUS_CODE_TYPE   CodeType,
     44   IN  EFI_STATUS_CODE_VALUE  Value,
     45   OUT UINT8                  *PostCode
     46   )
     47 {
     48   ASSERT (PostCode != NULL);
     49 
     50   return FALSE;
     51 }
     52 
     53 
     54 /**
     55   Extracts ASSERT() information from a status code structure.
     56 
     57   Converts the status code specified by CodeType, Value, and Data to the ASSERT()
     58   arguments specified by Filename, Description, and LineNumber.  If CodeType is
     59   an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and
     60   Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract
     61   Filename, Description, and LineNumber from the optional data area of the
     62   status code buffer specified by Data.  The optional data area of Data contains
     63   a Null-terminated ASCII string for the FileName, followed by a Null-terminated
     64   ASCII string for the Description, followed by a 32-bit LineNumber.  If the
     65   ASSERT() information could be extracted from Data, then return TRUE.
     66   Otherwise, FALSE is returned.
     67 
     68   If Data is NULL, then ASSERT().
     69   If Filename is NULL, then ASSERT().
     70   If Description is NULL, then ASSERT().
     71   If LineNumber is NULL, then ASSERT().
     72 
     73   @param  CodeType     The type of status code being converted.
     74   @param  Value        The status code value being converted.
     75   @param  Data         The pointer to the status code data buffer.
     76   @param  Filename     The pointer to the source file name that generated the ASSERT().
     77   @param  Description  The pointer to the description of the ASSERT().
     78   @param  LineNumber   The pointer to the source line number that generated the ASSERT().
     79 
     80   @retval  TRUE   The status code specified by CodeType, Value, and Data was
     81                   converted ASSERT() arguments specified by Filename, Description,
     82                   and LineNumber.
     83   @retval  FALSE  The status code specified by CodeType, Value, and Data could
     84                   not be converted to ASSERT() arguments.
     85 
     86 **/
     87 BOOLEAN
     88 EFIAPI
     89 ReportStatusCodeExtractAssertInfo (
     90   IN EFI_STATUS_CODE_TYPE        CodeType,
     91   IN EFI_STATUS_CODE_VALUE       Value,
     92   IN CONST EFI_STATUS_CODE_DATA  *Data,
     93   OUT CHAR8                      **Filename,
     94   OUT CHAR8                      **Description,
     95   OUT UINT32                     *LineNumber
     96   )
     97 {
     98   return FALSE;
     99 }
    100 
    101 
    102 /**
    103   Extracts DEBUG() information from a status code structure.
    104 
    105   Converts the status code specified by Data to the DEBUG() arguments specified
    106   by ErrorLevel, Marker, and Format.  If type GUID in Data is
    107   EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and
    108   Format from the optional data area of the status code buffer specified by Data.
    109   The optional data area of Data contains a 32-bit ErrorLevel followed by Marker
    110   which is 12 UINTN parameters, followed by a Null-terminated ASCII string for
    111   the Format.  If the DEBUG() information could be extracted from Data, then
    112   return TRUE.  Otherwise, FALSE is returned.
    113 
    114   If Data is NULL, then ASSERT().
    115   If ErrorLevel is NULL, then ASSERT().
    116   If Marker is NULL, then ASSERT().
    117   If Format is NULL, then ASSERT().
    118 
    119   @param  Data        The pointer to the status code data buffer.
    120   @param  ErrorLevel  The pointer to the error level mask for a debug message.
    121   @param  Marker      The pointer to the variable argument list associated with Format.
    122   @param  Format      The pointer to a Null-terminated ASCII format string of a
    123                       debug message.
    124 
    125   @retval  TRUE   The status code specified by Data was converted DEBUG() arguments
    126                   specified by ErrorLevel, Marker, and Format.
    127   @retval  FALSE  The status code specified by Data could not be converted to
    128                   DEBUG() arguments.
    129 
    130 **/
    131 BOOLEAN
    132 EFIAPI
    133 ReportStatusCodeExtractDebugInfo (
    134   IN CONST EFI_STATUS_CODE_DATA  *Data,
    135   OUT UINT32                     *ErrorLevel,
    136   OUT BASE_LIST                  *Marker,
    137   OUT CHAR8                      **Format
    138   )
    139 {
    140   ASSERT (Data       != NULL);
    141   ASSERT (ErrorLevel != NULL);
    142   ASSERT (Marker     != NULL);
    143   ASSERT (Format     != NULL);
    144 
    145   return FALSE;
    146 }
    147 
    148 
    149 /**
    150   Reports a status code.
    151 
    152   Reports the status code specified by the parameters Type and Value.  Status
    153   code also require an instance, caller ID, and extended data.  This function
    154   passed in a zero instance, NULL extended data, and a caller ID of
    155   gEfiCallerIdGuid, which is the GUID for the module.
    156 
    157   ReportStatusCode()must actively prevent recursion.  If ReportStatusCode()
    158   is called while processing another any other Report Status Code Library function,
    159   then ReportStatusCode() must return immediately.
    160 
    161   @param  Type   The status code type.
    162   @param  Value  The status code value.
    163 
    164   @retval  EFI_SUCCESS       The status code was reported.
    165   @retval  EFI_DEVICE_ERROR  There status code could not be reported due to a
    166                              device error.
    167   @retval  EFI_UNSUPPORTED   The report status code is not supported.
    168 
    169 **/
    170 EFI_STATUS
    171 EFIAPI
    172 ReportStatusCode (
    173   IN EFI_STATUS_CODE_TYPE   Type,
    174   IN EFI_STATUS_CODE_VALUE  Value
    175   )
    176 {
    177   return EFI_SUCCESS;
    178 }
    179 
    180 
    181 /**
    182   Reports a status code with a Device Path Protocol as the extended data.
    183 
    184   Allocates and fills in the extended data section of a status code with the
    185   Device Path Protocol specified by DevicePath.  This function is responsible
    186   for allocating a buffer large enough for the standard header and the device
    187   path.  The standard header is filled in with a GUID of
    188   gEfiStatusCodeSpecificDataGuid.  The status code is reported with a zero
    189   instance and a caller ID of gEfiCallerIdGuid.
    190 
    191   ReportStatusCodeWithDevicePath()must actively prevent recursion.  If
    192   ReportStatusCodeWithDevicePath() is called while processing another any other
    193   Report Status Code Library function, then ReportStatusCodeWithDevicePath()
    194   must return EFI_DEVICE_ERROR immediately.
    195 
    196   If DevicePath is NULL, then ASSERT().
    197 
    198   @param  Type        Status code type.
    199   @param  Value       Status code value.
    200   @param  DevicePath  The pointer to the Device Path Protocol to be reported.
    201 
    202   @retval  EFI_SUCCESS           The status code was reported with the extended
    203                                  data specified by DevicePath.
    204   @retval  EFI_OUT_OF_RESOURCES  There were not enough resources to allocate the
    205                                  extended data section.
    206   @retval  EFI_UNSUPPORTED       The report status code is not supported
    207 
    208 **/
    209 EFI_STATUS
    210 EFIAPI
    211 ReportStatusCodeWithDevicePath (
    212   IN EFI_STATUS_CODE_TYPE            Type,
    213   IN EFI_STATUS_CODE_VALUE           Value,
    214   IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath
    215   )
    216 {
    217   ASSERT (DevicePath != NULL);
    218 
    219   return EFI_SUCCESS;
    220 }
    221 
    222 
    223 /**
    224   Reports a status code with an extended data buffer.
    225 
    226   Allocates and fills in the extended data section of a status code with the
    227   extended data specified by ExtendedData and ExtendedDataSize.  ExtendedData
    228   is assumed to be one of the data structures specified in Related Definitions.
    229   These data structure do not have the standard header, so this function is
    230   responsible for allocating a buffer large enough for the standard header and
    231   the extended data passed into this function.  The standard header is filled
    232   in with a GUID of  gEfiStatusCodeSpecificDataGuid.  The status code is reported
    233   with a zero instance and a caller ID of gEfiCallerIdGuid.
    234 
    235   ReportStatusCodeWithExtendedData()must actively prevent recursion.  If
    236   ReportStatusCodeWithExtendedData() is called while processing another any other
    237   Report Status Code Library function, then ReportStatusCodeWithExtendedData()
    238   must return EFI_DEVICE_ERROR immediately.
    239 
    240   If ExtendedData is NULL, then ASSERT().
    241   If ExtendedDataSize is 0, then ASSERT().
    242 
    243   @param  Type              Status code type.
    244   @param  Value             Status code value.
    245   @param  ExtendedData      The pointer to the extended data buffer to be reported.
    246   @param  ExtendedDataSize  The size, in bytes, of the extended data buffer to
    247                             be reported.
    248 
    249   @retval  EFI_SUCCESS           The status code was reported with the extended
    250                                  data specified by ExtendedData and ExtendedDataSize.
    251   @retval  EFI_OUT_OF_RESOURCES  There were not enough resources to allocate the
    252                                  extended data section.
    253   @retval  EFI_UNSUPPORTED       The report status code is not supported.
    254 
    255 **/
    256 EFI_STATUS
    257 EFIAPI
    258 ReportStatusCodeWithExtendedData (
    259   IN EFI_STATUS_CODE_TYPE   Type,
    260   IN EFI_STATUS_CODE_VALUE  Value,
    261   IN CONST VOID             *ExtendedData,
    262   IN UINTN                  ExtendedDataSize
    263   )
    264 {
    265   ASSERT (ExtendedData     != NULL);
    266   ASSERT (ExtendedDataSize != 0);
    267   return EFI_SUCCESS;
    268 }
    269 
    270 
    271 /**
    272   Reports a status code with full parameters.
    273 
    274   The function reports a status code.  If ExtendedData is NULL and ExtendedDataSize
    275   is 0, then an extended data buffer is not reported.  If ExtendedData is not
    276   NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.
    277   ExtendedData is assumed not have the standard status code header, so this function
    278   is responsible for allocating a buffer large enough for the standard header and
    279   the extended data passed into this function.  The standard header is filled in
    280   with a GUID specified by ExtendedDataGuid.  If ExtendedDataGuid is NULL, then a
    281   GUID of gEfiStatusCodeSpecificDataGuid is used.  The status code is reported with
    282   an instance specified by Instance and a caller ID specified by CallerId.  If
    283   CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.
    284 
    285   ReportStatusCodeEx()must actively prevent recursion.  If ReportStatusCodeEx()
    286   is called while processing another any other Report Status Code Library function,
    287   then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.
    288 
    289   If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
    290   If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().
    291 
    292   @param  Type              The status code type.
    293   @param  Value             The status code value.
    294   @param  Instance          Status code instance number.
    295   @param  CallerId          The pointer to a GUID that identifies the caller of this
    296                             function.  If this parameter is NULL, then a caller
    297                             ID of gEfiCallerIdGuid is used.
    298   @param  ExtendedDataGuid  The pointer to the GUID for the extended data buffer.
    299                             If this parameter is NULL, then a the status code
    300                             standard header is filled in with
    301                             gEfiStatusCodeSpecificDataGuid.
    302   @param  ExtendedData      The pointer to the extended data buffer.  This is an
    303                             optional parameter that may be NULL.
    304   @param  ExtendedDataSize  The size, in bytes, of the extended data buffer.
    305 
    306   @retval  EFI_SUCCESS           The status code was reported.
    307   @retval  EFI_OUT_OF_RESOURCES  There were not enough resources to allocate
    308                                  the extended data section if it was specified.
    309   @retval  EFI_UNSUPPORTED       The report status code is not supported.
    310 
    311 **/
    312 EFI_STATUS
    313 EFIAPI
    314 ReportStatusCodeEx (
    315   IN EFI_STATUS_CODE_TYPE   Type,
    316   IN EFI_STATUS_CODE_VALUE  Value,
    317   IN UINT32                 Instance,
    318   IN CONST EFI_GUID         *CallerId          OPTIONAL,
    319   IN CONST EFI_GUID         *ExtendedDataGuid  OPTIONAL,
    320   IN CONST VOID             *ExtendedData      OPTIONAL,
    321   IN UINTN                  ExtendedDataSize
    322   )
    323 {
    324   return EFI_SUCCESS;
    325 }
    326 
    327 
    328 /**
    329   Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled
    330 
    331   This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED
    332   bit of PcdReportStatusCodeProperyMask is set.  Otherwise FALSE is returned.
    333 
    334   @retval  TRUE   The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
    335                   PcdReportStatusCodeProperyMask is set.
    336   @retval  FALSE  The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
    337                   PcdReportStatusCodeProperyMask is clear.
    338 
    339 **/
    340 BOOLEAN
    341 EFIAPI
    342 ReportProgressCodeEnabled (
    343   VOID
    344   )
    345 {
    346   return FALSE;
    347 }
    348 
    349 
    350 /**
    351   Returns TRUE if status codes of type EFI_ERROR_CODE are enabled
    352 
    353   This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED
    354   bit of PcdReportStatusCodeProperyMask is set.  Otherwise FALSE is returned.
    355 
    356   @retval  TRUE   The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
    357                   PcdReportStatusCodeProperyMask is set.
    358   @retval  FALSE  The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
    359                   PcdReportStatusCodeProperyMask is clear.
    360 
    361 **/
    362 BOOLEAN
    363 EFIAPI
    364 ReportErrorCodeEnabled (
    365   VOID
    366   )
    367 {
    368   return FALSE;
    369 }
    370 
    371 
    372 /**
    373   Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled
    374 
    375   This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED
    376   bit of PcdReportStatusCodeProperyMask is set.  Otherwise FALSE is returned.
    377 
    378   @retval  TRUE   The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
    379                   PcdReportStatusCodeProperyMask is set.
    380   @retval  FALSE  The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
    381                   PcdReportStatusCodeProperyMask is clear.
    382 
    383 **/
    384 BOOLEAN
    385 EFIAPI
    386 ReportDebugCodeEnabled (
    387   VOID
    388   )
    389 {
    390   return FALSE;
    391 }
    392 
    393