]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/DebugLib.h
MdeModulePkg/NvmExpress: Fix uninitialized field used in NVMe DiskInfo
[mirror_edk2.git] / MdePkg / Include / Library / DebugLib.h
index 3030be459a4f24598b3ee4c1aee532c78dfe06ce..219d147f1c679825a962a987c7b28691d970f79f 100644 (file)
@@ -8,7 +8,7 @@
   of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is\r
   defined, then debug and assert related macros wrapped by it are the NULL implementations.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -41,7 +41,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define DEBUG_FS        0x00000008  // EFI File system\r
 #define DEBUG_POOL      0x00000010  // Alloc & Free's\r
 #define DEBUG_PAGE      0x00000020  // Alloc & Free's\r
-#define DEBUG_INFO      0x00000040  // Verbose\r
+#define DEBUG_INFO      0x00000040  // Informational debug messages\r
 #define DEBUG_DISPATCH  0x00000080  // PEI/DXE/SMM Dispatchers\r
 #define DEBUG_VARIABLE  0x00000100  // Variable\r
 #define DEBUG_BM        0x00000400  // Boot Manager\r
@@ -52,6 +52,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define DEBUG_EVENT     0x00080000  // Event messages\r
 #define DEBUG_GCD       0x00100000  // Global Coherency Database changes\r
 #define DEBUG_CACHE     0x00200000  // Memory range cachability changes\r
+#define DEBUG_VERBOSE   0x00400000  // Detailed debug messages that may significantly impact boot performance\r
 #define DEBUG_ERROR     0x80000000  // Error\r
 \r
 //\r
@@ -72,14 +73,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define EFI_D_UNDI      DEBUG_UNDI\r
 #define EFI_D_LOADFILE  DEBUG_LOADFILE\r
 #define EFI_D_EVENT     DEBUG_EVENT\r
+#define EFI_D_VERBOSE   DEBUG_VERBOSE\r
 #define EFI_D_ERROR     DEBUG_ERROR\r
 \r
 /**\r
   Prints a debug message to the debug output device if the specified error level is enabled.\r
 \r
-  If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r
-  the message specified by Format and the associated variable argument list to \r
-  the debug output device.\r
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function \r
+  GetDebugPrintErrorLevel (), then print the message specified by Format and the \r
+  associated variable argument list to the debug output device.\r
 \r
   If Format is NULL, then ASSERT().\r
 \r
@@ -218,6 +220,20 @@ DebugClearMemoryEnabled (
   VOID\r
   );\r
 \r
+/**\r
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
+\r
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
+\r
+  @retval  TRUE    Current ErrorLevel is supported.\r
+  @retval  FALSE   Current ErrorLevel is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugPrintLevelEnabled (\r
+  IN  CONST UINTN        ErrorLevel\r
+  );\r
 \r
 /**  \r
   Internal worker macro that calls DebugAssert().\r
@@ -236,13 +252,25 @@ DebugClearMemoryEnabled (
 \r
   This macro calls DebugPrint() passing in the debug error level, a format \r
   string, and a variable argument list.\r
+  __VA_ARGS__ is not supported by EBC compiler, Microsoft Visual Studio .NET 2003\r
+  and Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830.\r
 \r
   @param  Expression  Expression containing an error level, a format string, \r
                       and a variable argument list based on the format string.\r
 \r
 **/\r
-#define _DEBUG(Expression)   DebugPrint Expression\r
 \r
+#if !defined(MDE_CPU_EBC) && (!defined (_MSC_VER) || _MSC_VER > 1400)\r
+  #define _DEBUG_PRINT(PrintLevel, ...)              \\r
+    do {                                             \\r
+      if (DebugPrintLevelEnabled (PrintLevel)) {     \\r
+        DebugPrint (PrintLevel, ##__VA_ARGS__);      \\r
+      }                                              \\r
+    } while (FALSE)\r
+  #define _DEBUG(Expression)   _DEBUG_PRINT Expression\r
+#else\r
+#define _DEBUG(Expression)   DebugPrint Expression\r
+#endif\r
 \r
 /**  \r
   Macro that calls DebugAssert() if an expression evaluates to FALSE.\r