]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseDebugLibNull/DebugLib.c
Code scrub for the Debug library, PostCode library, Print library, and ExtractGuidedS...
[mirror_edk2.git] / MdePkg / Library / BaseDebugLibNull / DebugLib.c
index 1440f8f127f0c61eb44273b7e56901a3503e99f0..a540411bcaa872e1b8546e0233c8df468423ee98 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Base Debug Library that uses PrintLib to print messages to a memory buffer.\r
+  Null Base Debug Library instance with empty functions.\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
 **/\r
 \r
+\r
+#include <Base.h>\r
+\r
 //\r
-// Define the maximum debug and assert message length that this library supports \r
+// The Library classes this module produced\r
 //\r
-#define MAX_DEBUG_MESSAGE_LENGTH  0x100\r
+#include <Library/DebugLib.h>\r
 \r
 /**\r
 \r
   the message specified by Format and the associated variable argument list to \r
   the debug output device.\r
 \r
-  If Format is NULL, then ASSERT().\r
-\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
 EFIAPI\r
 DebugPrint (\r
-  IN  UINTN ErrorLevel,\r
-  IN  CHAR8 *Format,\r
+  IN  UINTN        ErrorLevel,\r
+  IN  CONST CHAR8  *Format,\r
   ...\r
   )\r
 {\r
-  CHAR8    Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
-  VA_LIST  Marker;\r
-\r
-  //\r
-  // If Format is NULL, then ASSERT().\r
-  //\r
-  ASSERT (Format != NULL);\r
-\r
-  //\r
-  // Print the assert message to a buffer\r
-  //\r
-  VA_START (Marker, Format);\r
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
-  VA_END (Marker);\r
 }\r
 \r
 \r
@@ -61,7 +49,7 @@ 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
@@ -70,9 +58,9 @@ DebugPrint (
   DebugAssert() must actively prevent recusrsion.  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
@@ -82,26 +70,11 @@ DebugPrint (
 VOID\r
 EFIAPI\r
 DebugAssert (\r
-  IN CHAR8  *FileName,\r
-  IN INTN   LineNumber,\r
-  IN CHAR8  *Description\r
+  IN CONST CHAR8  *FileName,\r
+  IN UINTN        LineNumber,\r
+  IN CONST CHAR8  *Description\r
   )\r
 {\r
-  CHAR8  Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
-\r
-  //\r
-  // Print the assert message to a buffer\r
-  //\r
-  AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %s(%d): %s\n", FileName, LineNumber, Description);\r
-\r
-  //\r
-  // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
-  //\r
-  if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
-    CpuBreakpoint ();\r
-  } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
-    CpuDeadLoop ();\r
-  }\r
 }\r
 \r
 \r
@@ -114,12 +87,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   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
 \r
-  @return  Buffer\r
+  @return  Buffer filled with PcdDebugClearMemoryValue.\r
 \r
 **/\r
 VOID *\r
@@ -129,15 +102,7 @@ DebugClearMemory (
   IN UINTN  Length\r
   )\r
 {\r
-  //\r
-  // If Buffer is NULL, then ASSERT().\r
-  //\r
-  ASSERT (Buffer != NULL);\r
-\r
-  //\r
-  // SetMem() checks for the the ASSERT() condition on Length and returns Buffer\r
-  //\r
-  return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));\r
+  return Buffer;\r
 }\r
 \r
 \r
@@ -150,6 +115,8 @@ DebugClearMemory (
 \r
   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.\r
   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.\r
+  \r
+  @return  Always return FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -158,7 +125,7 @@ DebugAssertEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+  return FALSE;\r
 }\r
 \r
 \r
@@ -171,6 +138,8 @@ DebugAssertEnabled (
 \r
   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.\r
   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.\r
+  \r
+  @return Always return FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -179,7 +148,7 @@ DebugPrintEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+  return FALSE;\r
 }\r
 \r
 \r
@@ -192,6 +161,8 @@ DebugPrintEnabled (
 \r
   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.\r
   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.\r
+  \r
+  @return  Always return FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -200,7 +171,7 @@ DebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return FALSE;\r
 }\r
 \r
 \r
@@ -208,11 +179,13 @@ 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
+  @return  Always return FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -221,5 +194,5 @@ DebugClearMemoryEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+  return FALSE;\r
 }\r