public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, cheptsov@ispras.ru
Cc: Michael Kinney <michael.d.kinney@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib
Date: Mon, 11 May 2020 22:37:43 +0200	[thread overview]
Message-ID: <8eedbe04-abeb-598e-cd78-474e45368859@redhat.com> (raw)
In-Reply-To: <20200511154121.3878-2-cheptsov@ispras.ru>

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 <vit9696@protonmail.com>
> ---
>  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.<BR>
> +  Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +  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 <Library/DebugCommonLib.h>
>  
>  /**
>    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.<BR>
> +#  Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +#
> +#  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
> +#
> +
> +[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.<BR>
> +//
> +// 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.<BR>
> +  Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/DebugCommonLib.h>
> +#include <Library/PcdLib.h>
> +
> +
> +/**
> +  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.<BR>\n"
>                                                                                  "BIT3 - Enable Clear Memory.<BR>\n"
>                                                                                  "BIT4 - Enable BreakPoint as ASSERT.<BR>\n"
> -                                                                                "BIT5 - Enable DeadLoop as ASSERT.<BR>"
> +                                                                                "BIT5 - Enable DeadLoop as ASSERT.<BR>\n"
> +                                                                                "BIT6 - Treat constrait violations as ASSERT.<BR>"
>  
>  #string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero."
>  
> 

I think the very last hunk in this patch belongs in patch#26 ("MdePkg:
Introduce assertion on constraint debug mask bit"), which is where BIT6
is actually defined for PcdDebugPropertyMask.

Other than that, this approach looks good to me. I haven't reviewed the
rest of this series yet, but from this patch, the series seems to
consider bisectability / building at every stage important (which they are).

For this patch:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

(My review is of course no substitute for the MdePkg owners, Mike and
Liming.)

Thanks
Laszlo


  reply	other threads:[~2020-05-11 20:37 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
2020-05-11 20:37   ` Laszlo Ersek [this message]
2020-05-11 20:42   ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:40 ` [PATCH V4 02/27] UnitTestFrameworkPkg: Add support for DebugCommonLib Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 03/27] MdePkg: " Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 04/27] MdeModulePkg: " Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 05/27] ArmPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 06/27] ArmPlatformPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 07/27] ArmVirtPkg: " Vitaly Cheptsov
2020-05-11 20:42   ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 08/27] CryptoPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 09/27] DynamicTablesPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 10/27] EmbeddedPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 11/27] EmulatorPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 12/27] FatPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 13/27] FmpDevicePkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 14/27] IntelFsp2Pkg: " Vitaly Cheptsov
2020-05-12  0:49   ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 15/27] IntelFsp2WrapperPkg: " Vitaly Cheptsov
2020-05-12  0:47   ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 16/27] OvmfPkg: " Vitaly Cheptsov
2020-05-11 20:49   ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 17/27] NetworkPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 18/27] ShellPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 19/27] SecurityPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 20/27] PcAtChipsetPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 21/27] SignedCapsulePkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 22/27] SourceLevelDebugPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 23/27] StandaloneMmPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 24/27] UefiCpuPkg: " Vitaly Cheptsov
2020-05-11 20:52   ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 25/27] UefiPayloadPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit Vitaly Cheptsov
2020-05-11 20:58   ` [edk2-devel] " Laszlo Ersek
2020-05-11 22:12     ` Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString Vitaly Cheptsov
2020-05-11 21:04   ` [edk2-devel] " Laszlo Ersek
2020-05-11 22:40 ` [PATCH V4 00/27] Disabling safe string constraint assertions Michael D Kinney
2020-05-12  9:50   ` Laszlo Ersek
2020-05-12 17:03     ` Vitaly Cheptsov
2020-05-12 18:18     ` [edk2-devel] " Michael D Kinney
2020-05-12 18:57       ` Vitaly Cheptsov
2020-05-13 17:59         ` Liming Gao
2020-05-13 18:37           ` Vitaly Cheptsov
2020-05-13  9:16       ` Laszlo Ersek
2020-05-13 14:41         ` [EXTERNAL] " Bret Barkelew
2020-05-13 20:14           ` Brian J. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8eedbe04-abeb-598e-cd78-474e45368859@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox