]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update DebugLib to provide support for "err" command in the EFI Shell to adjust the...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 10 Mar 2011 22:12:34 +0000 (22:12 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 10 Mar 2011 22:12:34 +0000 (22:12 +0000)
1) Define new DebugPrintErrorLevelLib that produces an API that DebugPrint() APIs in DebugLib implementations can use to retrieve the current mask for filtering DebugPrint() statements.
2) Add a BASE type implementation of the DebugPrintErrorLevelLib that directly accessed PcdDebugPrintErrorLevel to provide backward compatibility with the current EDK II DebugLib behavior.
3) Update description of the DebugPrint() API in the DebugLib to describe the new dependency on the DebugPrintErrorLevelLib that replaces the prior dependency in the PcdDebugPrintErrorLevel PCD.
4) Update the comments in BaseDebugLibNull to match (3).
5) Update BaseDebugLibSerialPort to use DebugPrintErrorLevelLib instead of the PcdDebugPrintErrorLevel PCD.
6) Update UefiDebugLinConOut to use DebugPrintErrorLevelLib instead of the PcdDebugPrintErrorLevel PCD.
7) Update UefiDebugLibStdErr to use DebugPrintErrorLevelLib instead of the PcdDebugPrintErrorLevel PCD.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11365 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/DebugLib.h
MdePkg/Include/Library/DebugPrintErrorLevelLib.h [new file with mode: 0644]
MdePkg/Library/BaseDebugLibNull/DebugLib.c
MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c [new file with mode: 0644]
MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf [new file with mode: 0644]
MdePkg/Library/UefiDebugLibConOut/DebugLib.c
MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf

index 5e02dfd229f08ea74b9a6286b006627572b0ffcd..7bb964faa6401fc160ee765e80c94592fd08c3e9 100644 (file)
@@ -77,9 +77,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\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
diff --git a/MdePkg/Include/Library/DebugPrintErrorLevelLib.h b/MdePkg/Include/Library/DebugPrintErrorLevelLib.h
new file mode 100644 (file)
index 0000000..1e6bd65
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  Debug Print Error Level Library class\r
+\r
+  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  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
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+/**\r
+  Returns the debug print error level mask for the current module.\r
+\r
+  @return  Debug print error level mask for the current module.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+GetDebugPrintErrorLevel (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Sets the global debug print error level mask fpr the entire platform.\r
+\r
+  @retval  TRUE   The debug print error level mask was sucessfully set.\r
+  @retval  FALSE  The debug print error level mask could not be set.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+SetDebugPrintErrorLevel (\r
+  UINT32  ErrorLevel\r
+  );\r
index 648208dc757aee19ed9ad5c07f81739aa5d78d95..4ba62cb448a56227518c06660601ef3d6daccf9c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Null Base Debug Library instance with empty functions.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -18,9 +18,9 @@
 /**\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
index be636c89a2c3d40ad966fd84b126519c887e5aea..61befd688b57a36a509c57164495763434b41521 100644 (file)
@@ -2,7 +2,7 @@
 #  Instance of Debug Library based on Serial Port Library.\r
 #  It uses Print Library to produce formatted output strings.\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -39,9 +39,9 @@
   PcdLib\r
   PrintLib\r
   BaseLib\r
+  DebugPrintErrorLevelLib\r
 \r
 [Pcd]\r
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask\r
 \r
index b54fa15d98b62e86f43e0fc321397b0baa657651..e1674fc25d5786b2203177394f4e6f704a3da445 100644 (file)
@@ -7,7 +7,7 @@
   being blocked.  This may occur if a key(s) are pressed in a terminal emulator\r
   used to monitor the DEBUG() and ASSERT() messages. \r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -25,6 +25,7 @@
 #include <Library/PcdLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/SerialPortLib.h>\r
+#include <Library/DebugPrintErrorLevelLib.h>\r
 \r
 //\r
 // Define the maximum debug and assert message length that this library supports \r
@@ -49,9 +50,9 @@ BaseDebugLibSerialPortConstructor (
 /**\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
@@ -80,7 +81,7 @@ DebugPrint (
   //\r
   // Check driver debug mask value and global mask\r
   //\r
-  if ((ErrorLevel & PcdGet32 (PcdDebugPrintErrorLevel)) == 0) {\r
+  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
     return;\r
   }\r
 \r
diff --git a/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c b/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c
new file mode 100644 (file)
index 0000000..df4612e
--- /dev/null
@@ -0,0 +1,57 @@
+/** @file\r
+  Debug Print Error Level library instance that retrieves the current error \r
+  level from PcdDebugPrintErrorLevel.  This generic library instance does not \r
+  support the setting of the global debug print error level mask for the platform.\r
+\r
+  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  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
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/DebugPrintErrorLevelLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+/**\r
+  Returns the debug print error level mask for the current module.\r
+\r
+  @return  Debug print error level mask for the current module.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+GetDebugPrintErrorLevel (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Retrieve the current debug print error level mask from PcdDebugPrintErrorLevel.\r
+  //\r
+  return PcdGet32 (PcdDebugPrintErrorLevel);\r
+}\r
+\r
+/**\r
+  Sets the global debug print error level mask fpr the entire platform.\r
+\r
+  @retval  TRUE   The debug print error level mask was sucessfully set.\r
+  @retval  FALSE  The debug print error level mask could not be set.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+SetDebugPrintErrorLevel (\r
+  UINT32  ErrorLevel\r
+  )\r
+{\r
+  //\r
+  // This library uinstance does not support setting the global debug print error\r
+  // level mask.\r
+  //\r
+  return FALSE;\r
+}\r
diff --git a/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf b/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
new file mode 100644 (file)
index 0000000..72102e4
--- /dev/null
@@ -0,0 +1,38 @@
+## @file\r
+#  Debug Print Error Level library instance that retrieves the current error \r
+#  level from PcdDebugPrintErrorLevel.  \r
+#\r
+#  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  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
+#  http://opensource.org/licenses/bsd-license.php.\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BaseDebugPrintErrorLevelLib\r
+  FILE_GUID                      = A2C09E18-E4D2-407e-AFCC-628B79113F72\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = DebugPrintErrorLevelLib\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  BaseDebugPrintErrorLevelLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  PcdLib\r
+  \r
+[Pcd]\r
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel\r
index 7893ec675ca28f3d6d4a3c1e3b9e7c1c345bea24..ce4b32426d859c94ddced2e11fa330d50550b548 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Debug Library that sends messages to the Console Output Device in the EFI System Table.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -20,6 +20,7 @@
 #include <Library/PcdLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugPrintErrorLevelLib.h>\r
 \r
 //\r
 // Define the maximum debug and assert message length that this library supports \r
@@ -29,9 +30,9 @@
 /**\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
@@ -60,7 +61,7 @@ DebugPrint (
   //\r
   // Check driver debug mask value and global mask\r
   //\r
-  if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {\r
+  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
     return;\r
   }\r
 \r
index 9774d0a2bc8a34b5432db2dc4d3f3783a7eae06c..0601709490ceb650b63b233276094288698a7916 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 #  Debug Lib that sends messages to the Console Output Device in the EFI System Table.\r
 #\r
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -44,9 +44,9 @@
   PcdLib\r
   PrintLib\r
   UefiBootServicesTableLib\r
+  DebugPrintErrorLevelLib\r
 \r
 [Pcd]\r
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel         ## CONSUMES\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## CONSUMES\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask            ## CONSUMES\r
 \r
index 29a619b14a2a5da6ff566e6cd6b4355966693b42..73c720497cd8193e610e5cb106d3be58b62ab998 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Debug Lib that sends messages to the Standard Error Device in the EFI System Table.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -21,6 +21,7 @@
 #include <Library/PcdLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugPrintErrorLevelLib.h>\r
 \r
 //\r
 // Define the maximum debug and assert message length that this library supports \r
@@ -31,9 +32,9 @@
 /**\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
@@ -62,7 +63,7 @@ DebugPrint (
   //\r
   // Check driver debug mask value and global mask\r
   //\r
-  if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {\r
+  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
     return;\r
   }\r
 \r
index 30a74a5b3cc8c4f931d659442e1b6f264b4ad902..7b93f4c2da6b2744bb2568edebf3e3ce593bbeec 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 #  Debug Lib that sends messages to the the Standard Error Device in the EFI System Table.\r
 #\r
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -42,9 +42,9 @@
   PcdLib\r
   PrintLib\r
   UefiBootServicesTableLib\r
+  DebugPrintErrorLevelLib\r
 \r
 [Pcd]\r
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel    ## CONSUMES\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue   ## CONSUMES\r
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask       ## CONSUMES\r
 \r