From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web10.1378.1589229727767789810 for ; Mon, 11 May 2020 13:42:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fnnl0Pxs; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589229726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O+CHNWEdRJCpxVUksuqGG/T84CqEElLsqXrecLjqvqg=; b=Fnnl0PxsSlF0HmhNLp3+Xk+yzo/wmrtqlMd4HWtJPqMjj8hcGGAu5hLqa5xCkEoPryo5tp 0Q7r1Q6fxZAIJ0KvSWrYKW7d4fgtdlUvOI/tL0JdyIErMVvnlBse98QWVwlJlw8NYvDG3t KOwXF86TuabTSXEA82y5EjuAiKTCE1o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-OR5oVyySMM2NpP0AphYjMw-1; Mon, 11 May 2020 16:42:05 -0400 X-MC-Unique: OR5oVyySMM2NpP0AphYjMw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E56DC100CCC1; Mon, 11 May 2020 20:42:03 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-11.ams2.redhat.com [10.36.113.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C4541000079; Mon, 11 May 2020 20:42:02 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib To: devel@edk2.groups.io, cheptsov@ispras.ru References: <20200511154121.3878-1-cheptsov@ispras.ru> <20200511154121.3878-2-cheptsov@ispras.ru> Cc: Michael Kinney , Liming Gao From: "Laszlo Ersek" Message-ID: <5374f2b7-c952-4a70-ad1f-18bdcd76fcd1@redhat.com> Date: Mon, 11 May 2020 22:42:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200511154121.3878-2-cheptsov@ispras.ru> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ah, one superficial comment: On 05/11/20 17:40, Vitaly Cheptsov wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054 > > This library allows to make a common part of all DebugLib instances > and avoid the need to update every DebugLib on extending a new debug > mask PCD bit. > > Signed-off-by: Vitaly Cheptsov > --- > MdePkg/Include/Library/DebugCommonLib.h | 154 ++++++++++++++++++++ > MdePkg/Include/Library/DebugLib.h | 137 +---------------- > MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf | 39 +++++ > MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni | 16 ++ > MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 113 ++++++++++++++ > MdePkg/MdePkg.dec | 3 + > MdePkg/MdePkg.dsc | 1 + > MdePkg/MdePkg.uni | 3 +- > 8 files changed, 329 insertions(+), 137 deletions(-) > > diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h > new file mode 100644 > index 0000000000..31249f91fa > --- /dev/null > +++ b/MdePkg/Include/Library/DebugCommonLib.h > @@ -0,0 +1,154 @@ > +/** @file > + Provides services to access common debugging features. > + > + The debug common library interface provides common code for all debug libraries. > + > + Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef __DEBUG_COMMON_LIB_H__ > +#define __DEBUG_COMMON_LIB_H__ > + > +// > +// Declare bits for PcdDebugPropertyMask > +// > +#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01 > +#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02 > +#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04 > +#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08 > +#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10 > +#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20 > + > +// > +// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint() > +// > +#define DEBUG_INIT 0x00000001 // Initialization > +#define DEBUG_WARN 0x00000002 // Warnings > +#define DEBUG_LOAD 0x00000004 // Load events > +#define DEBUG_FS 0x00000008 // EFI File system > +#define DEBUG_POOL 0x00000010 // Alloc & Free (pool) > +#define DEBUG_PAGE 0x00000020 // Alloc & Free (page) > +#define DEBUG_INFO 0x00000040 // Informational debug messages > +#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers > +#define DEBUG_VARIABLE 0x00000100 // Variable > +#define DEBUG_BM 0x00000400 // Boot Manager > +#define DEBUG_BLKIO 0x00001000 // BlkIo Driver > +#define DEBUG_NET 0x00004000 // Network Io Driver > +#define DEBUG_UNDI 0x00010000 // UNDI Driver > +#define DEBUG_LOADFILE 0x00020000 // LoadFile > +#define DEBUG_EVENT 0x00080000 // Event messages > +#define DEBUG_GCD 0x00100000 // Global Coherency Database changes > +#define DEBUG_CACHE 0x00200000 // Memory range cachability changes > +#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may > + // significantly impact boot performance > +#define DEBUG_ERROR 0x80000000 // Error > + > +// > +// Aliases of debug message mask bits > +// > +#define EFI_D_INIT DEBUG_INIT > +#define EFI_D_WARN DEBUG_WARN > +#define EFI_D_LOAD DEBUG_LOAD > +#define EFI_D_FS DEBUG_FS > +#define EFI_D_POOL DEBUG_POOL > +#define EFI_D_PAGE DEBUG_PAGE > +#define EFI_D_INFO DEBUG_INFO > +#define EFI_D_DISPATCH DEBUG_DISPATCH > +#define EFI_D_VARIABLE DEBUG_VARIABLE > +#define EFI_D_BM DEBUG_BM > +#define EFI_D_BLKIO DEBUG_BLKIO > +#define EFI_D_NET DEBUG_NET > +#define EFI_D_UNDI DEBUG_UNDI > +#define EFI_D_LOADFILE DEBUG_LOADFILE > +#define EFI_D_EVENT DEBUG_EVENT > +#define EFI_D_VERBOSE DEBUG_VERBOSE > +#define EFI_D_ERROR DEBUG_ERROR > + > +/** > + Returns TRUE if ASSERT() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise, FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugAssertEnabled ( > + VOID > + ); > + > + > +/** > + Returns TRUE if DEBUG() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise, FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugPrintEnabled ( > + VOID > + ); > + > + > +/** > + Returns TRUE if DEBUG_CODE() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise, FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugCodeEnabled ( > + VOID > + ); > + > + > +/** > + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise, FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugClearMemoryEnabled ( > + VOID > + ); > + > + > +/** > + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. > + > + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. > + > + @retval TRUE Current ErrorLevel is supported. > + @retval FALSE Current ErrorLevel is not supported. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugPrintLevelEnabled ( > + IN CONST UINTN ErrorLevel > + ); > + > + > +#endif > diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h > index baab34bf05..a38e0e2904 100644 > --- a/MdePkg/Include/Library/DebugLib.h > +++ b/MdePkg/Include/Library/DebugLib.h > @@ -16,60 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #ifndef __DEBUG_LIB_H__ > #define __DEBUG_LIB_H__ > > -// > -// Declare bits for PcdDebugPropertyMask > -// > -#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01 > -#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02 > -#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04 > -#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08 > -#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10 > -#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20 > - > -// > -// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint() > -// > -#define DEBUG_INIT 0x00000001 // Initialization > -#define DEBUG_WARN 0x00000002 // Warnings > -#define DEBUG_LOAD 0x00000004 // Load events > -#define DEBUG_FS 0x00000008 // EFI File system > -#define DEBUG_POOL 0x00000010 // Alloc & Free (pool) > -#define DEBUG_PAGE 0x00000020 // Alloc & Free (page) > -#define DEBUG_INFO 0x00000040 // Informational debug messages > -#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers > -#define DEBUG_VARIABLE 0x00000100 // Variable > -#define DEBUG_BM 0x00000400 // Boot Manager > -#define DEBUG_BLKIO 0x00001000 // BlkIo Driver > -#define DEBUG_NET 0x00004000 // Network Io Driver > -#define DEBUG_UNDI 0x00010000 // UNDI Driver > -#define DEBUG_LOADFILE 0x00020000 // LoadFile > -#define DEBUG_EVENT 0x00080000 // Event messages > -#define DEBUG_GCD 0x00100000 // Global Coherency Database changes > -#define DEBUG_CACHE 0x00200000 // Memory range cachability changes > -#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may > - // significantly impact boot performance > -#define DEBUG_ERROR 0x80000000 // Error > - > -// > -// Aliases of debug message mask bits > -// > -#define EFI_D_INIT DEBUG_INIT > -#define EFI_D_WARN DEBUG_WARN > -#define EFI_D_LOAD DEBUG_LOAD > -#define EFI_D_FS DEBUG_FS > -#define EFI_D_POOL DEBUG_POOL > -#define EFI_D_PAGE DEBUG_PAGE > -#define EFI_D_INFO DEBUG_INFO > -#define EFI_D_DISPATCH DEBUG_DISPATCH > -#define EFI_D_VARIABLE DEBUG_VARIABLE > -#define EFI_D_BM DEBUG_BM > -#define EFI_D_BLKIO DEBUG_BLKIO > -#define EFI_D_NET DEBUG_NET > -#define EFI_D_UNDI DEBUG_UNDI > -#define EFI_D_LOADFILE DEBUG_LOADFILE > -#define EFI_D_EVENT DEBUG_EVENT > -#define EFI_D_VERBOSE DEBUG_VERBOSE > -#define EFI_D_ERROR DEBUG_ERROR > +#include > > /** > Prints a debug message to the debug output device if the specified error level is enabled. > @@ -198,88 +145,6 @@ DebugClearMemory ( > ); > > > -/** > - Returns TRUE if ASSERT() macros are enabled. > - > - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of > - PcdDebugProperyMask is set. Otherwise, FALSE is returned. > - > - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. > - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. > - > -**/ > -BOOLEAN > -EFIAPI > -DebugAssertEnabled ( > - VOID > - ); > - > - > -/** > - Returns TRUE if DEBUG() macros are enabled. > - > - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of > - PcdDebugProperyMask is set. Otherwise, FALSE is returned. > - > - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. > - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. > - > -**/ > -BOOLEAN > -EFIAPI > -DebugPrintEnabled ( > - VOID > - ); > - > - > -/** > - Returns TRUE if DEBUG_CODE() macros are enabled. > - > - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of > - PcdDebugProperyMask is set. Otherwise, FALSE is returned. > - > - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. > - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. > - > -**/ > -BOOLEAN > -EFIAPI > -DebugCodeEnabled ( > - VOID > - ); > - > - > -/** > - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. > - > - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of > - PcdDebugProperyMask is set. Otherwise, FALSE is returned. > - > - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. > - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. > - > -**/ > -BOOLEAN > -EFIAPI > -DebugClearMemoryEnabled ( > - VOID > - ); > - > -/** > - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. > - > - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. > - > - @retval TRUE Current ErrorLevel is supported. > - @retval FALSE Current ErrorLevel is not supported. > - > -**/ > -BOOLEAN > -EFIAPI > -DebugPrintLevelEnabled ( > - IN CONST UINTN ErrorLevel > - ); > - > /** > Internal worker macro that calls DebugAssert(). > > diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf > new file mode 100644 > index 0000000000..c1f4b0d5a8 > --- /dev/null > +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf > @@ -0,0 +1,39 @@ > +## @file > +# Instance of Debug Common Library interface. > +# It uses PcdLib to provide a common set of Debug Library interface. > +# > +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +# Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +# > +## > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = BaseDebugCommonLib > + MODULE_UNI_FILE = BaseDebugCommonLib.uni > + FILE_GUID = 7CD790D2-E13F-4446-AF4F-813F0B9DEFF8 > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = DebugCommonLib > + > +# > +# VALID_ARCHITECTURES = IA32 X64 EBC > +# I think the VALID_ARCHITECTURES comment should be dropped altogether. At least the current arch list "IA32 X64 EBC" is incorrect; first because ARM and AARCH64 are missing (despite the series -- correctly -- patching Arm*Pkg and such), and second because -- I *think* -- EBC is no longer an arch natively supported by edk2. (Mike and Liming will correct me on that, if needed.) (... Please consider adding Cc: tags to the commit messages, so that each patch email reaches the subject package owners directly too. Anyway that's for the future.) Thanks, Laszlo > + > +[Sources] > + DebugCommonLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + PcdLib > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES > + > diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni > new file mode 100644 > index 0000000000..a5ad34298b > --- /dev/null > +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni > @@ -0,0 +1,16 @@ > +// /** @file > +// Instance of Debug Common Library interface. > +// > +// It uses PcdLib to provide a common set of Debug Library interface. > +// > +// Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.
> +// > +// SPDX-License-Identifier: BSD-2-Clause-Patent > +// > +// **/ > + > + > +#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Common Library interface" > + > +#string STR_MODULE_DESCRIPTION #language en-US "It uses PcdLib to provide a common set of Debug Library interface." > + > diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c > new file mode 100644 > index 0000000000..2291fb5382 > --- /dev/null > +++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c > @@ -0,0 +1,113 @@ > +/** @file > + Instance of Debug Common Library interface. > + It uses PcdLib to provide a common set of Debug Library interface. > + > + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > + > + > +/** > + Returns TRUE if ASSERT() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugAssertEnabled ( > + VOID > + ) > +{ > + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); > +} > + > + > +/** > + Returns TRUE if DEBUG() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugPrintEnabled ( > + VOID > + ) > +{ > + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); > +} > + > + > +/** > + Returns TRUE if DEBUG_CODE() macros are enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugCodeEnabled ( > + VOID > + ) > +{ > + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); > +} > + > + > +/** > + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. > + > + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of > + PcdDebugProperyMask is set. Otherwise FALSE is returned. > + > + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. > + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugClearMemoryEnabled ( > + VOID > + ) > +{ > + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); > +} > + > + > +/** > + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. > + > + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. > + > + @retval TRUE Current ErrorLevel is supported. > + @retval FALSE Current ErrorLevel is not supported. > + > +**/ > +BOOLEAN > +EFIAPI > +DebugPrintLevelEnabled ( > + IN CONST UINTN ErrorLevel > + ) > +{ > + return (BOOLEAN) ((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0); > +} > + > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > index 0b9c4bc40a..a121b9ecab 100644 > --- a/MdePkg/MdePkg.dec > +++ b/MdePkg/MdePkg.dec > @@ -229,6 +229,9 @@ [LibraryClasses] > # library class maps directly on top of the Timer class. > S3StallLib|Include/Library/S3StallLib.h > > + ## @libraryclass Provides services to access common debugging features. > + DebugCommonLib|Include/Library/DebugCommonLib.h > + > ## @libraryclass Defines library APIs used by modules to get/set print error level. > DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h > > diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc > index 6cd38e7ec3..1072322450 100644 > --- a/MdePkg/MdePkg.dsc > +++ b/MdePkg/MdePkg.dsc > @@ -36,6 +36,7 @@ [Components] > MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf > MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > + MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf > MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf > MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf > diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni > index 5c1fa24065..5addb0eaba 100644 > --- a/MdePkg/MdePkg.uni > +++ b/MdePkg/MdePkg.uni > @@ -189,7 +189,8 @@ > "BIT2 - Enable Debug Code.
\n" > "BIT3 - Enable Clear Memory.
\n" > "BIT4 - Enable BreakPoint as ASSERT.
\n" > - "BIT5 - Enable DeadLoop as ASSERT.
" > + "BIT5 - Enable DeadLoop as ASSERT.
\n" > + "BIT6 - Treat constrait violations as ASSERT.
" > > #string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero." > >