EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Debug.c

Go to the documentation of this file.
00001 /*++
00002 
00003 Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
00004 This program and the accompanying materials                          
00005 are licensed and made available under the terms and conditions of the BSD License         
00006 which accompanies this distribution.  The full text of the license may be found at        
00007 http://opensource.org/licenses/bsd-license.php                                            
00008                                                                                           
00009 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
00010 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
00011 
00012 Module Name:
00013 
00014   Debug.c
00015 
00016 Abstract:
00017 
00018   Support for Debug primatives. 
00019 
00020 --*/
00021 
00022 #include "Tiano.h"
00023 #include "EfiRuntimeLib.h"
00024 #include EFI_GUID_DEFINITION (StatusCodeCallerId)
00025 #include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
00026 
00027 #define EFI_STATUS_CODE_DATA_MAX_SIZE64 (EFI_STATUS_CODE_DATA_MAX_SIZE / 8)
00028 
00029 VOID
00030 EfiDebugAssert (
00031   IN CHAR8    *FileName,
00032   IN INTN     LineNumber,
00033   IN CHAR8    *Description
00034   )
00035 /*++
00036 
00037 Routine Description:
00038 
00039   Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT
00040   information. If Error Logging hub is not loaded BREAKPOINT ().
00041   
00042 Arguments:
00043 
00044   FileName    - File name of failing routine.
00045 
00046   LineNumber  - Line number of failing ASSERT ().
00047 
00048   Description - Description, usually the assertion,
00049   
00050 Returns:
00051   
00052   None
00053 
00054 --*/
00055 {
00056   UINT64  Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE64];
00057 
00058   EfiDebugAssertWorker (FileName, LineNumber, Description, sizeof (Buffer), Buffer);
00059 
00060   EfiReportStatusCode (
00061     (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
00062     (EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),
00063     0,
00064     &gEfiCallerIdGuid,
00065     (EFI_STATUS_CODE_DATA *) Buffer
00066     );
00067 
00068   //
00069   // Put dead loop in module that contained the error.
00070   //
00071   EFI_DEADLOOP ();
00072 }
00073 
00074 VOID
00075 EfiDebugVPrint (
00076   IN  UINTN   ErrorLevel,
00077   IN  CHAR8   *Format,
00078   IN  VA_LIST Marker
00079   )
00080 /*++
00081 
00082 Routine Description:
00083 
00084   Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT
00085   information. If Error Logging hub is not loaded do nothing.
00086   
00087 Arguments:
00088 
00089   ErrorLevel - If error level is set do the debug print.
00090 
00091   Format     - String to use for the print, followed by Print arguments.
00092 
00093   Marker     - VarArgs
00094   
00095 Returns:
00096   
00097   None
00098 
00099 --*/
00100 {
00101   UINT64  Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE64];
00102 
00103   if (!(gRtErrorLevel & ErrorLevel)) {
00104     return ;
00105   }
00106 
00107   EfiDebugVPrintWorker (ErrorLevel, Format, Marker, sizeof (Buffer), Buffer);
00108 
00109   EfiReportStatusCode (
00110     EFI_DEBUG_CODE,
00111     (EFI_SOFTWARE_DXE_RT_DRIVER | EFI_DC_UNSPECIFIED),
00112     (UINT32) ErrorLevel,
00113     &gEfiCallerIdGuid,
00114     (EFI_STATUS_CODE_DATA *) Buffer
00115     );
00116 
00117   return ;
00118 }
00119 
00120 VOID
00121 EfiDebugPrint (
00122   IN  UINTN                   ErrorLevel,
00123   IN  CHAR8                   *Format,
00124   ...
00125   )
00126 /*++
00127 
00128 Routine Description:
00129 
00130   Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT
00131   information. If Error Logging hub is not loaded do nothing.
00132 
00133   We use UINT64 buffers due to IPF alignment concerns.
00134 
00135 Arguments:
00136 
00137   ErrorLevel - If error level is set do the debug print.
00138 
00139   Format     - String to use for the print, followed by Print arguments.
00140 
00141   ...        - VAR args for Format
00142   
00143 Returns:
00144   
00145   None
00146 
00147 --*/
00148 {
00149   VA_LIST Marker;
00150 
00151   VA_START (Marker, Format);
00152   EfiDebugVPrint (ErrorLevel, Format, Marker);
00153   VA_END (Marker);
00154 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines