]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/DebugLib.h
Add in a new debug mask bit EFI_D_DEPEX. It is used to enable the debug message relat...
[mirror_edk2.git] / MdePkg / Include / Library / DebugLib.h
index e249e5792588f776131a25d4d192ca88eff015e4..134952c6659b2696a61c11c4e5791afd050cabde 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Public include file for the Debug Library\r
 \r
-  Copyright (c) 2006, Intel Corporation                                                         \r
+  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
   All rights reserved. This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
 //\r
 // Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()\r
 //\r
-#define EFI_D_INIT      0x00000001  // Initialization style messages\r
-#define EFI_D_WARN      0x00000002  // Warnings\r
-#define EFI_D_LOAD      0x00000004  // Load events\r
-#define EFI_D_FS        0x00000008  // EFI File system\r
-#define EFI_D_POOL      0x00000010  // Alloc & Free's\r
-#define EFI_D_PAGE      0x00000020  // Alloc & Free's\r
-#define EFI_D_INFO      0x00000040  // Verbose\r
-#define EFI_D_VARIABLE  0x00000100  // Variable\r
-#define EFI_D_BM        0x00000400  // Boot Manager (BDS)\r
-#define EFI_D_BLKIO     0x00001000  // BlkIo Driver\r
-#define EFI_D_NET       0x00004000  // SNI Driver\r
-#define EFI_D_UNDI      0x00010000  // UNDI Driver\r
-#define EFI_D_LOADFILE  0x00020000  // UNDI Driver\r
-#define EFI_D_EVENT     0x00080000  // Event messages\r
-#define EFI_D_ERROR     0x80000000  // Error\r
+#define DEBUG_INIT      0x00000001  // Initialization\r
+#define DEBUG_WARN      0x00000002  // Warnings\r
+#define DEBUG_LOAD      0x00000004  // Load events\r
+#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_DEPEX     0x00000080  // PEI or DXE Dependency Evaluation\r
+#define DEBUG_VARIABLE  0x00000100  // Variable\r
+#define DEBUG_BM        0x00000400  // Boot Manager\r
+#define DEBUG_BLKIO     0x00001000  // BlkIo Driver\r
+#define DEBUG_NET       0x00004000  // SNI Driver\r
+#define DEBUG_UNDI      0x00010000  // UNDI Driver\r
+#define DEBUG_LOADFILE  0x00020000  // UNDI Driver\r
+#define DEBUG_EVENT     0x00080000  // Event messages\r
+#define DEBUG_ERROR     0x80000000  // Error\r
+\r
+//\r
+// Aliases of debug message mask bits\r
+//\r
+#define EFI_D_INIT      DEBUG_INIT\r
+#define EFI_D_WARN      DEBUG_WARN\r
+#define EFI_D_LOAD      DEBUG_LOAD\r
+#define EFI_D_FS        DEBUG_FS\r
+#define EFI_D_POOL      DEBUG_POOL\r
+#define EFI_D_PAGE      DEBUG_PAGE\r
+#define EFI_D_INFO      DEBUG_INFO\r
+#define EFI_D_DEPEX     DEBUG_DEPEX\r
+#define EFI_D_VARIABLE  DEBUG_VARIABLE\r
+#define EFI_D_BM        DEBUG_BM\r
+#define EFI_D_BLKIO     DEBUG_BLKIO\r
+#define EFI_D_NET       DEBUG_NET\r
+#define EFI_D_UNDI      DEBUG_UNDI\r
+#define EFI_D_LOADFILE  DEBUG_LOADFILE\r
+#define EFI_D_EVENT     DEBUG_EVENT\r
+#define EFI_D_ERROR     DEBUG_ERROR\r
 \r
 /**\r
 \r
@@ -56,6 +77,7 @@
 \r
   @param  ErrorLevel  The error level of the debug message.\r
   @param  Format      Format string for the debug message to print.\r
+  @param  ...         The variable argument list.\r
 \r
 **/\r
 VOID\r
@@ -72,18 +94,18 @@ DebugPrint (
   Prints an assert message containing a filename, line number, and description.  \r
   This may be followed by a breakpoint or a dead loop.\r
 \r
-  Print a message of the form \93ASSERT <FileName>(<LineNumber>): <Description>\n\94 \r
+  Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"\r
   to the debug output device.  If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of \r
   PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if \r
   DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then \r
   CpuDeadLoop() is called.  If neither of these bits are set, then this function \r
   returns immediately after the message is printed to the debug output device.\r
-  DebugAssert() must actively prevent recusrsion.  If DebugAssert() is called while\r
+  DebugAssert() must actively prevent recursion.  If DebugAssert() is called while\r
   processing another DebugAssert(), then DebugAssert() must return immediately.\r
 \r
-  If FileName is NULL, then a <FileName> string of \93(NULL) Filename\94 is printed.\r
+  If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
 \r
-  If Description is NULL, then a <Description> string of \93(NULL) Description\94 is printed.\r
+  If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
 \r
   @param  FileName     Pointer to the name of the source file that generated the assert condition.\r
   @param  LineNumber   The line number in the source file that generated the assert condition\r
@@ -94,7 +116,7 @@ VOID
 EFIAPI\r
 DebugAssert (\r
   IN CONST CHAR8  *FileName,\r
-  IN INTN         LineNumber,\r
+  IN UINTN        LineNumber,\r
   IN CONST CHAR8  *Description\r
   );\r
 \r
@@ -108,12 +130,12 @@ DebugAssert (
 \r
   If Buffer is NULL, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS \96 Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). \r
 \r
-  @param   Buffer  Pointer to the target buffer to fill with PcdDebugClearMemoryValue.\r
+  @param   Buffer  Pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
   @param   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
 \r
-  @return  Buffer\r
+  @return  Buffer  Pointer to the target buffer filled with PcdDebugClearMemoryValue.\r
 \r
 **/\r
 VOID *\r
@@ -182,11 +204,11 @@ DebugCodeEnabled (
   \r
   Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.\r
 \r
-  This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of \r
+  This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of \r
   PcdDebugProperyMask is set.  Otherwise FALSE is returned.\r
 \r
-  @retval  TRUE    The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
-  @retval  FALSE   The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
+  @retval  TRUE    The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
+  @retval  FALSE   The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
 \r
 **/\r
 BOOLEAN\r
@@ -311,21 +333,21 @@ DebugClearMemoryEnabled (
   @param  Guid    Pointer to a protocol GUID.\r
 \r
 **/\r
-#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)                    \\r
-  do {                                                                     \\r
-    if (DebugAssertEnabled ()) {                                           \\r
-      VOID  *Instance;                                                     \\r
-      ASSERT (Guid != NULL);                                               \\r
-      if (Handle == NULL) {                                                \\r
-        if (!EFI_ERROR (gBS->LocateProtocol (Guid, NULL, &Instance))) {    \\r
-          _ASSERT (Guid already installed in database);                    \\r
-        }                                                                  \\r
-      } else {                                                             \\r
-        if (!EFI_ERROR (gBS->LocateProtocol (Guid, Handle, &Instance))) {  \\r
-          _ASSERT (Guid already installed on Handle);                      \\r
-        }                                                                  \\r
-      }                                                                    \\r
-    }                                                                      \\r
+#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)                               \\r
+  do {                                                                                \\r
+    if (DebugAssertEnabled ()) {                                                      \\r
+      VOID  *Instance;                                                                \\r
+      ASSERT (Guid != NULL);                                                          \\r
+      if (Handle == NULL) {                                                           \\r
+        if (!EFI_ERROR (gBS->LocateProtocol ((EFI_GUID *)Guid, NULL, &Instance))) {   \\r
+          _ASSERT (Guid already installed in database);                               \\r
+        }                                                                             \\r
+      } else {                                                                        \\r
+        if (!EFI_ERROR (gBS->HandleProtocol (Handle, (EFI_GUID *)Guid, &Instance))) { \\r
+          _ASSERT (Guid already installed on Handle);                                 \\r
+        }                                                                             \\r
+      }                                                                               \\r
+    }                                                                                 \\r
   } while (FALSE)\r
 \r
 \r
@@ -351,7 +373,7 @@ DebugClearMemoryEnabled (
   are not included in a module.\r
 \r
 **/\r
-#define DEBUG_CODE_END()    __DebugCodeLocal = 0; } } while (FALSE)\r
+#define DEBUG_CODE_END()    __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)\r
 \r
 \r
 /**\r
@@ -411,7 +433,7 @@ DebugClearMemoryEnabled (
   by TYPE is compared to TestSignature.  If the signatures match, then a pointer \r
   to the pointer to a data structure of the type specified by TYPE is returned.  \r
   If the signatures do not match, then DebugAssert() is called with a description \r
-  of \93CR has a bad signature\94 and Record is returned.  \r
+  of "CR has a bad signature" and Record is returned.  \r
 \r
   If the data type specified by TYPE does not contain the field specified by Field, \r
   then the module will not compile.\r