public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access
@ 2021-03-22  8:09 Dandan Bi
  2021-03-22  8:09 ` [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance Dandan Bi
                   ` (28 more replies)
  0 siblings, 29 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Leif Lindholm, Laszlo Ersek, Michael D Kinney,
	Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
RFC: https://edk2.groups.io/g/devel/message/72530

Patch 1 is to add RegisterFilterLib Library Class in edk2 to filter/trace port IO/MMIO/MSR access and add a RegisterFilterLibNull instance.
Patch 2 is to add the MdeLibs.dsc.inc file to MdePkg for some default libraries provided by MdePkg and add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
Last 2 patches are to update APIs in IoLib and BaseLib to filter/trace port IO/MMIO/MSR access.
Remaining patches are to update related dsc files to consume MdeLibs.dsc.inc for RegisterFilterLib.

Will submit patch 1 and 2 firstly.
And then update related dsc files in edk2 and edk2platform repo to consume MdeLibs.dsc.inc for RegisterFilterLib.
At last will submit the patches to update IoLib and BaseLib to filter/trace port IO/MMIO/MSR access.

--
V2:
Introduce MdeLibs.dsc.inc and add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
Update Platform dsc to consume the MdeLibs.dsc.inc.
Add the description for the return flag in FilterBeforeXXXX functions in header file source code.
Extend the years for Intel copyright.
Add mssing change the dsc files in OvmfPkg.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com> 

Dandan Bi (29):
  MdePkg: Add RegisterFilterLib class and NULL instance
  MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  ArmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  ArmPlatformPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  ArmVirtPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  CryptoPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  DynamicTablesPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  EmbeddedPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  EmulatorPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  FatPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  FmpDevicePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  IntelFsp2Pkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  IntelFsp2WrapperPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  MdeModulePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  MdePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  NetworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  OvmfPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  PcAtChipsetPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  RedfishPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  SecurityPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  ShellPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  SignedCapsulePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  SourceLevelDebugPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  StandaloneMmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  UefiPayloadPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  MdePkg/IoLib: Filter/trace port IO/MMIO access
  MdePkg/Baseib: Filter/trace MSR access for IA32/X64

 ArmPkg/ArmPkg.dsc                             |   2 +
 ArmPlatformPkg/ArmPlatformPkg.dsc             |   2 +
 ArmVirtPkg/ArmVirt.dsc.inc                    |   4 +-
 CryptoPkg/CryptoPkg.dsc                       |   4 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc         |   2 +
 EmbeddedPkg/EmbeddedPkg.dsc                   |   4 +-
 EmulatorPkg/EmulatorPkg.dsc                   |   4 +-
 FatPkg/FatPkg.dsc                             |   4 +-
 FmpDevicePkg/FmpDevicePkg.dsc                 |   4 +-
 IntelFsp2Pkg/IntelFsp2Pkg.dsc                 |   4 +-
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc       |   2 +
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc   |   4 +-
 MdeModulePkg/MdeModulePkg.dsc                 |   4 +-
 MdePkg/Include/Library/RegisterFilterLib.h    | 243 ++++++++++++++++
 .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf |   3 +-
 .../BaseIoLibIntrinsicArmVirt.inf             |   3 +-
 .../BaseIoLibIntrinsicInternal.h              |   3 +-
 .../BaseIoLibIntrinsicSev.inf                 |   3 +-
 MdePkg/Library/BaseIoLibIntrinsic/IoLib.c     |  95 ++++--
 .../Library/BaseIoLibIntrinsic/IoLibArmVirt.c |  82 +++++-
 MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c  |  58 +++-
 MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c  |  81 ++++--
 MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c |  74 ++++-
 MdePkg/Library/BaseLib/BaseLib.inf            |   5 +-
 MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c   |  38 ++-
 MdePkg/Library/BaseLib/Ia32/ReadMsr64.c       |  38 ++-
 MdePkg/Library/BaseLib/Ia32/WriteMsr64.c      |  22 +-
 MdePkg/Library/BaseLib/X64/GccInlinePriv.c    |  43 ++-
 MdePkg/Library/BaseLib/X64/ReadMsr64.c        |  15 +-
 MdePkg/Library/BaseLib/X64/WriteMsr64.c       |  13 +-
 .../RegisterFilterLibNull.c                   | 271 ++++++++++++++++++
 .../RegisterFilterLibNull.inf                 |  23 ++
 .../RegisterFilterLibNull.uni                 |  13 +
 MdePkg/MdeLibs.dsc.inc                        |  14 +
 MdePkg/MdePkg.dec                             |   7 +-
 MdePkg/MdePkg.dsc                             |   6 +-
 NetworkPkg/NetworkPkg.dsc                     |   4 +-
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |   4 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                    |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc                       |   4 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |   4 +-
 OvmfPkg/OvmfPkgX64.dsc                        |   4 +-
 OvmfPkg/OvmfXen.dsc                           |   4 +-
 PcAtChipsetPkg/PcAtChipsetPkg.dsc             |   4 +-
 RedfishPkg/RedfishPkg.dsc                     |   4 +-
 SecurityPkg/SecurityPkg.dsc                   |   4 +-
 ShellPkg/ShellPkg.dsc                         |   4 +-
 SignedCapsulePkg/SignedCapsulePkg.dsc         |   4 +-
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc   |   4 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc           |   4 +-
 UefiCpuPkg/UefiCpuPkg.dsc                     |   4 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc             |   4 +-
 .../UnitTestFrameworkPkgTarget.dsc.inc        |   4 +-
 53 files changed, 1120 insertions(+), 145 deletions(-)
 create mode 100644 MdePkg/Include/Library/RegisterFilterLib.h
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
 create mode 100644 MdePkg/MdeLibs.dsc.inc

-- 
2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-23  2:24   ` [edk2-devel] " Abner Chang
  2021-03-22  8:09 ` [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg Dandan Bi
                   ` (27 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

1. Add a new library class (RegisterFilterLib) to filter
and trace port IO/MMIO/MSR access.
2. Add a NULL instance (RegisterFilterLibNull) can be used
to keep current behavior.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdePkg/Include/Library/RegisterFilterLib.h    | 243 ++++++++++++++++
 .../RegisterFilterLibNull.c                   | 271 ++++++++++++++++++
 .../RegisterFilterLibNull.inf                 |  23 ++
 .../RegisterFilterLibNull.uni                 |  13 +
 MdePkg/MdePkg.dec                             |   7 +-
 MdePkg/MdePkg.dsc                             |   4 +-
 6 files changed, 559 insertions(+), 2 deletions(-)
 create mode 100644 MdePkg/Include/Library/RegisterFilterLib.h
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
 create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni

diff --git a/MdePkg/Include/Library/RegisterFilterLib.h b/MdePkg/Include/Library/RegisterFilterLib.h
new file mode 100644
index 0000000000..c4402da7d8
--- /dev/null
+++ b/MdePkg/Include/Library/RegisterFilterLib.h
@@ -0,0 +1,243 @@
+/** @file
+  Public include file for the Port IO/MMIO/MSR RegisterFilterLib.
+
+Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REGISTER_FILTER_LIB_H_
+#define REGISTER_FILTER_LIB_H_
+
+typedef enum {
+  FilterWidth8,
+  FilterWidth16,
+  FilterWidth32,
+  FilterWidth64
+} FILTER_IO_WIDTH;
+
+/**
+  Filter IO read operation before read IO port.
+  It is used to filter IO read operation.
+
+  It will return the flag to decide whether require read real IO port.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+  @retval TRUE         Need to excute the IO read.
+  @retval FALSE        Skip the IO read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeIoRead (
+  IN FILTER_IO_WIDTH   Width,
+  IN UINTN             Address,
+  IN OUT VOID          *Buffer
+  );
+
+/**
+  Trace IO read operation after read IO port.
+  It is used to trace IO operation.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+**/
+VOID
+EFIAPI
+FilterAfterIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+/**
+  Filter IO Write operation before wirte IO port.
+  It is used to filter IO operation.
+
+  It will return the flag to decide whether require read write IO port.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
+
+  @retval TRUE         Need to excute the IO write.
+  @retval FALSE        Skip the IO write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+
+  /**
+  Trace IO Write operation after wirte IO port.
+  It is used to trace IO operation.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
+
+**/
+VOID
+EFIAPI
+FilterAfterIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+
+/**
+  Filter memory IO before Read operation.
+
+  It will return the flag to decide whether require read real MMIO.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+  @retval TRUE         Need to excute the MMIO read.
+  @retval FALSE        Skip the MMIO read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMmIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN OUT VOID         *Buffer
+  );
+
+/**
+  Tracer memory IO after read operation
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+**/
+VOID
+EFIAPI
+FilterAfterMmIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+
+/**
+  Filter memory IO before write operation
+
+  It will return the flag to decide whether require wirte real MMIO.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
+
+  @retval TRUE         Need to excute the MMIO write.
+  @retval FALSE        Skip the MMIO write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMmIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+
+/**
+  Tracer memory IO after write operation
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
+
+**/
+VOID
+EFIAPI
+FilterAfterMmIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  );
+
+/**
+  Filter MSR before read operation.
+
+  It will return the flag to decide whether require read real MSR.
+  It can be used for emulation environment.
+
+  @param  Index                     The 8-bit Machine Specific Register index to BeforeWrite.
+  @param  Value                     The 64-bit value to BeforeRead from the Machine Specific Register.
+
+  @retval TRUE         Need to excute the MSR read.
+  @retval FALSE        Skip the MSR read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMsrRead (
+  IN UINT32           Index,
+  IN OUT UINT64       *Value
+  );
+
+/**
+  Trace MSR after read operation
+
+  @param  Index                     The 8-bit Machine Specific Register index to BeforeWrite.
+  @param  Value                     The 64-bit value to BeforeRead from the Machine Specific Register.
+
+**/
+VOID
+EFIAPI
+FilterAfterMsrRead (
+  IN UINT32            Index,
+  IN UINT64            *Value
+  );
+
+/**
+  Filter MSR before write operation
+
+  It will return the flag to decide whether require write real MSR.
+  It can be used for emulation environment.
+
+  @param  Index                     The 8-bit Machine Specific Register index to BeforeWrite.
+  @param  Value                     The 64-bit value to BeforeWrite to the Machine Specific Register.
+
+  @retval TRUE         Need to excute the MSR write.
+  @retval FALSE        Skip the MSR write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMsrWrite (
+  IN UINT32           Index,
+  IN UINT64           *Value
+  );
+
+/**
+  Trace MSR after write operation
+
+  @param  Index                     The 8-bit Machine Specific Register index to BeforeWrite.
+  @param  Value                     The 64-bit value to BeforeWrite to the Machine Specific Register.
+
+**/
+VOID
+EFIAPI
+FilterAfterMsrWrite (
+  IN UINT32            Index,
+  IN UINT64            *Value
+  );
+
+#endif // REGISTER_FILTER_LIB_H_
diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
new file mode 100644
index 0000000000..7150f1ed5f
--- /dev/null
+++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
@@ -0,0 +1,271 @@
+/** @file
+  Null instance of RegisterFilterLib.
+
+  Copyright (c) 2021 Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/RegisterFilterLib.h>
+
+/**
+  Filter IO read operation before read IO port.
+  It is used to filter IO read operation.
+
+  It will return the flag to decide whether require read real IO port.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in,out]   Buffer   The destination buffer to store the results.
+
+  @retval TRUE         Need to excute the IO read.
+  @retval FALSE        Skip the IO read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN OUT VOID         *Buffer
+  )
+{
+  return TRUE;
+}
+
+/**
+  Trace IO read operation after read IO port.
+  It is used to trace IO operation.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+**/
+VOID
+EFIAPI
+FilterAfterIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return;
+}
+
+/**
+  Filter IO Write operation before wirte IO port.
+  It is used to filter IO operation.
+
+  It will return the flag to decide whether require read write IO port.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The source buffer from which to write data.
+
+  @retval TRUE         Need to excute the IO write.
+  @retval FALSE        Skip the IO write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return TRUE;
+}
+
+  /**
+  Trace IO Write operation after wirte IO port.
+  It is used to trace IO operation.
+
+  @param[in]       Width    Signifies the width of the I/O operation.
+  @param[in]       Address  The base address of the I/O operation.
+  @param[in]       Buffer   The source buffer from which to Write data.
+
+**/
+VOID
+EFIAPI
+FilterAfterIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return;
+}
+
+/**
+  Filter memory IO before Read operation.
+
+  It will return the flag to decide whether require read real MMIO.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in,out]   Buffer   The destination buffer to store the results.
+
+  @retval TRUE         Need to excute the MMIO read.
+  @retval FALSE        Skip the MMIO read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMmIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN OUT VOID         *Buffer
+  )
+{
+  return TRUE;
+}
+
+/**
+  Tracer memory IO after read operation.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The destination buffer to store the results.
+
+**/
+VOID
+EFIAPI
+FilterAfterMmIoRead (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return;
+}
+
+/**
+  Filter memory IO before write operation.
+
+  It will return the flag to decide whether require wirte real MMIO.
+  It can be used for emulation environment.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The source buffer from which to write data.
+
+  @retval TRUE         Need to excute the MMIO write.
+  @retval FALSE        Skip the MMIO write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMmIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return TRUE;
+}
+
+/**
+  Tracer memory IO after write operation.
+
+  @param[in]       Width    Signifies the width of the memory I/O operation.
+  @param[in]       Address  The base address of the memory I/O operation.
+  @param[in]       Buffer   The source buffer from which to write data.
+
+**/
+VOID
+EFIAPI
+FilterAfterMmIoWrite (
+  IN FILTER_IO_WIDTH  Width,
+  IN UINTN            Address,
+  IN VOID             *Buffer
+  )
+{
+  return;
+}
+
+/**
+  Filter MSR before read operation.
+
+  It will return the flag to decide whether require read real MSR.
+  It can be used for emulation environment.
+
+  @param  Index                     The Register index of the MSR.
+  @param  Value                     Point to the data will be read from the MSR.
+
+  @retval TRUE         Need to excute the MSR read.
+  @retval FALSE        Skip the MSR read.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMsrRead (
+  IN UINT32        Index,
+  IN OUT UINT64    *Value
+  )
+{
+  return TRUE;
+}
+
+/**
+  Trace MSR after read operation.
+
+  @param  Index                     The Register index of the MSR.
+  @param  Value                     Point to the data has been be read from the MSR.
+
+**/
+VOID
+EFIAPI
+FilterAfterMsrRead (
+  IN UINT32    Index,
+  IN UINT64    *Value
+  )
+{
+  return;
+}
+
+/**
+  Filter MSR before write operation.
+
+  It will return the flag to decide whether require write real MSR.
+  It can be used for emulation environment.
+
+  @param  Index                     The Register index of the MSR.
+  @param  Value                     Point to the data want to be written to the MSR.
+
+  @retval TRUE         Need to excute the MSR write.
+  @retval FALSE        Skip the MSR write.
+
+**/
+BOOLEAN
+EFIAPI
+FilterBeforeMsrWrite (
+  IN UINT32    Index,
+  IN UINT64    *Value
+  )
+{
+  return TRUE;
+}
+
+/**
+  Trace MSR after write operation.
+
+  @param  Index                     The Register index of the MSR.
+  @param  Value                     Point to the data has been be written to the MSR.
+
+**/
+VOID
+EFIAPI
+FilterAfterMsrWrite (
+  IN UINT32    Index,
+  IN UINT64    *Value
+  )
+{
+  return;
+}
+
diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
new file mode 100644
index 0000000000..a7fc7497ed
--- /dev/null
+++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
@@ -0,0 +1,23 @@
+## @file
+#  Null instance of RegisterFilterLib.
+#
+#  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = FilterLibNull
+  MODULE_UNI_FILE                = FilterLibNull.uni
+  FILE_GUID                      = 9F555194-A410-4AD6-B3FC-53F6E10FA793
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = RegisterFilterLib
+
+[Sources]
+  RegisterFilterLibNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
new file mode 100644
index 0000000000..ed64c7e63d
--- /dev/null
+++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
@@ -0,0 +1,13 @@
+// /** @file
+// Null instance of RegisterFilterLib.
+//
+// Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT              #language en-US "Null instance of RegisterFilterLib."
+#string STR_MODULE_DESCRIPTION           #language en-US "Null instance of RegisterFilterLib."
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 1d2637acc2..65de5c4052 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2,11 +2,11 @@
 # This Package provides all definitions, library classes and libraries instances.
 #
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of
 # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.
 #
-# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 # (C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -260,10 +260,15 @@ [LibraryClasses]
   ##  @libraryclass  This library provides an interface to request non-MMRAM pages to be mapped
   #                  or unblocked from inside MM environment.
   #
   MmUnblockMemoryLib|Include/Library/MmUnblockMemoryLib.h
 
+  ##  @libraryclass  This library provides interfances to filter and trace port IO/MMIO/MSR access.
+  #
+  #
+  RegisterFilterLib|Include/Library/RegisterFilterLib.h
+
 [LibraryClasses.IA32, LibraryClasses.X64]
   ##  @libraryclass  Abstracts both S/W SMI generation and detection.
   ##
   SmmLib|Include/Library/SmmLib.h
 
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 79629e3f93..be89e28eef 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # EFI/PI MdePkg Package
 #
-# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 # (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -125,10 +125,12 @@ [Components]
   MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
 
   MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
 
+  MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
+
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
   #
   # Add UEFI Target Based Unit Tests
   #
   MdePkg/Test/UnitTest/Library/BaseLib/BaseLibUnitTestsUefi.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
  2021-03-22  8:09 ` [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 17:46   ` Laszlo Ersek
  2021-03-26  0:48   ` Michael D Kinney
  2021-03-22  8:09 ` [patch V2 03/29] ArmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib Dandan Bi
                   ` (26 subsequent siblings)
  28 siblings, 2 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Laszlo Ersek

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc is added for some default libraries provided by MdePkg.
Platform can include MdeLibs.dsc.inc file to avoid some potential
incompatible changes to platform dsc file in future.

Only add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
Can update and maintain MdeLibs.dsc.inc gradually later.

"MdeLibs.dsc.inc" for the [LibraryClasses*] section(s)

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdePkg/MdeLibs.dsc.inc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 MdePkg/MdeLibs.dsc.inc

diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
new file mode 100644
index 0000000000..75e516c21a
--- /dev/null
+++ b/MdePkg/MdeLibs.dsc.inc
@@ -0,0 +1,14 @@
+## @file
+# Mde DSC include file for [LibraryClasses*] section of all Architectures.
+#
+# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
+# by using "!include MdePkg/MdeLibs.dsc.inc" to specify the library instances
+# of some EDKII basic/common library classes.
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+#
+#    SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+  RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 03/29] ArmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
  2021-03-22  8:09 ` [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance Dandan Bi
  2021-03-22  8:09 ` [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 04/29] ArmPlatformPkg: " Dandan Bi
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 ArmPkg/ArmPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 7194eb2d3c..5aae9322d2 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -31,10 +31,12 @@ [BuildOptions]
 
 [PcdsFixedAtBuild]
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
 
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 04/29] ArmPlatformPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (2 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 03/29] ArmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 05/29] ArmVirtPkg: " Dandan Bi
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 ArmPlatformPkg/ArmPlatformPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index 88fe1247c0..892b59e762 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -32,10 +32,12 @@ [BuildOptions]
 [PcdsFixedAtBuild]
   gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
   gArmTokenSpaceGuid.PcdFdSize|0x1000
 
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
   ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
   ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
   ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
   ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 05/29] ArmVirtPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (3 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 04/29] ArmPlatformPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 18:30   ` Laszlo Ersek
  2021-03-22  8:09 ` [patch V2 06/29] CryptoPkg: " Dandan Bi
                   ` (23 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Laszlo Ersek, Ard Biesheuvel, Leif Lindholm

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 ArmVirtPkg/ArmVirt.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index d9abadbe70..18b57b61a1 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,9 +1,9 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
 #  Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 #
@@ -33,10 +33,12 @@ [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
   GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
   RVCT:*_*_ARM_DLINK_FLAGS = --scatter $(EDK_TOOLS_PATH)/Scripts/Rvct-Align4K.sct
 
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
 !if $(TARGET) == RELEASE
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
 !else
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
 !endif
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 06/29] CryptoPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (4 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 05/29] ArmVirtPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:20   ` Yao, Jiewen
  2021-03-22  8:09 ` [patch V2 07/29] DynamicTablesPkg: " Dandan Bi
                   ` (22 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Jiewen Yao, Jian J Wang, Xiaoyu Lu, Guomin Jiang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 CryptoPkg/CryptoPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 55383f2722..99d07108c4 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -1,10 +1,10 @@
 ## @file
 #  Cryptographic Library Package for UEFI Security Implementation.
 #  PEIM, DXE Driver, and SMM Driver with all crypto services enabled.
 #
-#  Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -49,10 +49,12 @@ [Defines]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 07/29] DynamicTablesPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (5 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 06/29] CryptoPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 08/29] EmbeddedPkg: " Dandan Bi
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Sami Mujawar, Alexei Fedorov

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 DynamicTablesPkg/DynamicTablesPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 0232bda459..8aa3d64908 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -19,10 +19,12 @@ [Defines]
   SKUID_IDENTIFIER               = DEFAULT
 
 !include DynamicTables.dsc.inc
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 08/29] EmbeddedPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (6 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 07/29] DynamicTablesPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 09/29] EmulatorPkg: " Dandan Bi
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 EmbeddedPkg/EmbeddedPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index 8e83e50c3e..c77e401c10 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -1,10 +1,10 @@
 #/** @file
 # Embedded Package
 #
 #
-# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2012-2015, ARM Ltd. All rights reserved.<BR>
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -39,10 +39,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
 #  DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
 
 
   AndroidBootImgLib|EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 09/29] EmulatorPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (7 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 08/29] EmbeddedPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-25 23:29   ` Ni, Ray
  2021-03-22  8:09 ` [patch V2 10/29] FatPkg: " Dandan Bi
                   ` (19 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Andrew Fish, Ray Ni

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 EmulatorPkg/EmulatorPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index a7ded49000..b8d1d12ace 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -2,11 +2,11 @@
 # UEFI/PI Emulation Platform with UEFI HII interface supported.
 #
 # The Emulation Platform can be used to debug individual modules, prior to creating
 # a real platform. This also provides an example for how an DSC is created.
 #
-# Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.<BR>
 # Copyright (c) Microsoft Corporation.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -43,10 +43,12 @@ [Defines]
 
 [SkuIds]
   0|DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 10/29] FatPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (8 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 09/29] EmulatorPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-25 23:30   ` Ni, Ray
  2021-03-22  8:09 ` [patch V2 11/29] FmpDevicePkg: " Dandan Bi
                   ` (18 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 FatPkg/FatPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index d86256068b..e0264db803 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -1,11 +1,11 @@
 ## @file
 #  Build Binary Enhanced Fat Driver Modules.
 #
 #  This Platform file is used to generate the Binary Fat Drivers
 #  for EDK II Prime release.
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -26,10 +26,12 @@ [BuildOptions]
   MSFT:RELEASE_*_*_CC_FLAGS            = /D MDEPKG_NDEBUG
   RVCT:RELEASE_*_*_CC_FLAGS            = -DMDEPKG_NDEBUG
   *_*_*_CC_FLAGS                       = -D DISABLE_NEW_DEPRECATED_INTERFACES
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry Point Libraries
   #
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   #
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 11/29] FmpDevicePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (9 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 10/29] FatPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 12/29] IntelFsp2Pkg: " Dandan Bi
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 FmpDevicePkg/FmpDevicePkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
index cfeadd8330..24d5272707 100644
--- a/FmpDevicePkg/FmpDevicePkg.dsc
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -5,11 +5,11 @@
 # instance that supports the update of firmware storage devices using UEFI
 # Capsules.  The behavior of the Firmware Management Protocol instance is
 # customized using libraries and PCDs.
 #
 # Copyright (c) Microsoft Corporation.<BR>
-# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -37,10 +37,12 @@ [Defines]
   DEFINE DEVICE_FMP_STORAGE_ACCESS_ENABLE = TRUE
 
 !include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 12/29] IntelFsp2Pkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (10 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 11/29] FmpDevicePkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 13/29] IntelFsp2WrapperPkg: " Dandan Bi
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Star Zeng

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 IntelFsp2Pkg/IntelFsp2Pkg.dsc           | 4 +++-
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index 309411630d..ec28c3dde7 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # Provides driver and definitions to build fsp.
 #
-# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
@@ -15,10 +15,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
diff --git a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
index bc4912313a..65f954fc09 100644
--- a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
+++ b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
@@ -71,10 +71,12 @@ [SkuIds]
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 13/29] IntelFsp2WrapperPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (11 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 12/29] IntelFsp2Pkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 14/29] MdeModulePkg: " Dandan Bi
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Star Zeng

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
index 738342b69b..8acf016903 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # Provides drivers and definitions to support fsp in EDKII bios.
 #
-# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
@@ -15,10 +15,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 14/29] MdeModulePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (12 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 13/29] IntelFsp2WrapperPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-23  1:01   ` Wu, Hao A
  2021-03-22  8:09 ` [patch V2 15/29] MdePkg: " Dandan Bi
                   ` (14 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Hao A Wu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/MdeModulePkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 9272da89a9..76522300cd 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -1,10 +1,10 @@
 ## @file
 # EFI/PI Reference Module Package for All Architectures
 #
 # (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) Microsoft Corporation.
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -18,10 +18,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 15/29] MdePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (13 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 14/29] MdeModulePkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 16/29] NetworkPkg: " Dandan Bi
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdePkg/MdePkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index be89e28eef..32a01326b6 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -28,10 +28,12 @@ [PcdsFixedAtBuild]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
 [Components]
   MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 16/29] NetworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (14 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 15/29] MdePkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 17/29] OvmfPkg: " Dandan Bi
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Maciej Rabeda, Jiaxin Wu, Siyuan Fu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 NetworkPkg/NetworkPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 531da841e9..b7680809be 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -1,10 +1,10 @@
 ## @file
 # UEFI 2.4 Network Module Package for All Architectures
 #
 # (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -19,10 +19,12 @@ [Defines]
   SKUID_IDENTIFIER               = DEFAULT
 
   DEFINE NETWORK_ISCSI_ENABLE    = TRUE
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 17/29] OvmfPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (15 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 16/29] NetworkPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 18:31   ` Laszlo Ersek
  2021-03-22  8:09 ` [patch V2 18/29] PcAtChipsetPkg: " Dandan Bi
                   ` (11 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Laszlo Ersek, Ard Biesheuvel, Jordan Justen

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 4 +++-
 OvmfPkg/Bhyve/BhyveX64.dsc   | 4 +++-
 OvmfPkg/OvmfPkgIa32.dsc      | 4 +++-
 OvmfPkg/OvmfPkgIa32X64.dsc   | 4 +++-
 OvmfPkg/OvmfPkgX64.dsc       | 4 +++-
 OvmfPkg/OvmfXen.dsc          | 4 +++-
 6 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 65c42284d9..7bb94b8e11 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -1,11 +1,11 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform for SEV secure
 #  virtual machine remote attestation and secret injection
 #
 #  Copyright (c) 2020 James Bottomley, IBM Corporation.
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -112,10 +112,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 4a1cdf5aca..3a1a76a3ad 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -1,8 +1,8 @@
 #
 #  Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  Copyright (c) 2014, Pluribus Networks, Inc.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -112,10 +112,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 1eaf3e99c6..7b49e2a648 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -116,10 +116,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 4a5a430147..b60212843b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -120,10 +120,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index d4d601b444..0c06f33782 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -120,10 +120,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 507029404f..92e8d1967c 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  Copyright (c) 2019, Citrix Systems, Inc.
 #  Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -110,10 +110,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf
   ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 18/29] PcAtChipsetPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (16 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 17/29] OvmfPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-25 23:30   ` Ni, Ray
  2021-03-22  8:09 ` [patch V2 19/29] RedfishPkg: " Dandan Bi
                   ` (10 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 3d1fb816f5..8598e689f9 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  PC/AT Chipset Package
 #
-#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -17,10 +17,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 19/29] RedfishPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (17 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 18/29] PcAtChipsetPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-23  2:17   ` Abner Chang
  2021-03-23  2:32   ` Nickle Wang
  2021-03-22  8:09 ` [patch V2 20/29] SecurityPkg: " Dandan Bi
                   ` (9 subsequent siblings)
  28 siblings, 2 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Nickle Wang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 RedfishPkg/RedfishPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index e0052290b5..4af4d0e6bc 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # Redfish Package
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -17,10 +17,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 20/29] SecurityPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (18 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 19/29] RedfishPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 21/29] ShellPkg: " Dandan Bi
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Jiewen Yao, Jian J Wang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 SecurityPkg/SecurityPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index a77665518b..af5807b193 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  Security Module Package for All Architectures.
 #
-# Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
 # (C) Copyright 2015-2020 Hewlett Packard Enterprise Development LP<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -16,10 +16,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 21/29] ShellPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (19 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 20/29] SecurityPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 22/29] SignedCapsulePkg: " Dandan Bi
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Zhichao Gao

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 ShellPkg/ShellPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index a8b6de3342..7659d9895d 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -1,9 +1,9 @@
 ##  @file
 # Shell Package
 #
-# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2018 - 2020, Arm Limited. All rights reserved.<BR>
 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -18,10 +18,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
   UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
 !if $(TARGET) == RELEASE
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 22/29] SignedCapsulePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (20 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 21/29] ShellPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 23/29] SourceLevelDebugPkg: " Dandan Bi
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 SignedCapsulePkg/SignedCapsulePkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc b/SignedCapsulePkg/SignedCapsulePkg.dsc
index c5080ec1dd..e0e2508693 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # This package provides EDKII capsule related support.
 #
-# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -16,10 +16,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = AARCH64|ARM|IA32|X64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 23/29] SourceLevelDebugPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (21 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 22/29] SignedCapsulePkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-23  1:02   ` Wu, Hao A
  2021-03-22  8:09 ` [patch V2 24/29] StandaloneMmPkg: " Dandan Bi
                   ` (5 subsequent siblings)
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Hao A Wu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index 20eb10ba07..ec2e803d6c 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # Source Level Debug Package.
 #
-# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -22,10 +22,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
 [LibraryClasses.common]
+  !include MdePkg/MdeLibs.dsc.inc
+
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 24/29] StandaloneMmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (22 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 23/29] SourceLevelDebugPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 25/29] UefiCpuPkg: " Dandan Bi
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 StandaloneMmPkg/StandaloneMmPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 73f3f0f6b1..0ed9941606 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 # Standalone MM Platform.
 #
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
 # Copyright (C) Microsoft Corporation<BR>
 #
 #    SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -31,10 +31,12 @@ [Defines]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Basic
   #
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (23 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 24/29] StandaloneMmPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 18:32   ` Laszlo Ersek
  2021-03-26  0:32   ` Dong, Eric
  2021-03-22  8:09 ` [patch V2 26/29] UefiPayloadPkg: " Dandan Bi
                   ` (3 subsequent siblings)
  28 siblings, 2 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Laszlo Ersek, Rahul Kumar

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UefiCpuPkg/UefiCpuPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 7db419471d..6c7cc6b273 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  UefiCpuPkg Package
 #
-#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -20,10 +20,12 @@ [Defines]
 #
 # External libraries to build package
 #
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 26/29] UefiPayloadPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (24 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 25/29] UefiCpuPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 14:03   ` Ma, Maurice
  2021-03-23  5:20   ` Guo Dong
  2021-03-22  8:09 ` [patch V2 27/29] UnitTestFrameworkPkg: " Dandan Bi
                   ` (2 subsequent siblings)
  28 siblings, 2 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Maurice Ma, Guo Dong, Benjamin You

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 23edd163e9..11f951ac59 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -1,11 +1,11 @@
 ## @file
 # Bootloader Payload Package
 #
 # Provides drivers and definitions to create uefi payload for bootloaders.
 #
-# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) Microsoft Corporation.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -112,10 +112,12 @@ [SkuIds]
 #
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 ################################################################################
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (25 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 26/29] UefiPayloadPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22 18:25   ` [EXTERNAL] " Bret Barkelew
  2021-03-22  8:09 ` [patch V2 28/29] MdePkg/IoLib: Filter/trace port IO/MMIO access Dandan Bi
  2021-03-22  8:09 ` [patch V2 29/29] MdePkg/Baseib: Filter/trace MSR access for IA32/X64 Dandan Bi
  28 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Sean Brogan, Bret Barkelew

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098..4adb98aff5 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -1,14 +1,16 @@
 ## @file
 # UnitTestFrameworkPkg DSC include file for target based test DSC
 #
-# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 28/29] MdePkg/IoLib: Filter/trace port IO/MMIO access
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (26 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 27/29] UnitTestFrameworkPkg: " Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  2021-03-22  8:09 ` [patch V2 29/29] MdePkg/Baseib: Filter/trace MSR access for IA32/X64 Dandan Bi
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf |  3 +-
 .../BaseIoLibIntrinsicArmVirt.inf             |  3 +-
 .../BaseIoLibIntrinsicInternal.h              |  3 +-
 .../BaseIoLibIntrinsicSev.inf                 |  3 +-
 MdePkg/Library/BaseIoLibIntrinsic/IoLib.c     | 95 ++++++++++++++-----
 .../Library/BaseIoLibIntrinsic/IoLibArmVirt.c | 82 ++++++++++++++--
 MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c  | 58 +++++++++--
 MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c  | 81 ++++++++++++----
 MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c | 74 +++++++++++++--
 9 files changed, 329 insertions(+), 73 deletions(-)

diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
index 690b95d440..97eeada065 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
@@ -5,11 +5,11 @@
 #  for IA-32 and x64.  On IPF, I/O port requests are translated into MMIO requests.
 #  MMIO requests are forwarded directly to memory.  For EBC, I/O port requests
 #  ASSERT(). For ARM, AARCH64 and RISCV64, this I/O library only provides non I/O
 #  read and write.
 #
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
 #  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -64,6 +64,7 @@ [Packages]
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
   DebugLib
   BaseLib
+  RegisterFilterLib
 
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
index ad68f841fb..cea6857926 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Instance of I/O Library using KVM/ARM safe assembler routines
 #
-#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
 #  Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -42,5 +42,6 @@ [Packages]
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
   DebugLib
   BaseLib
+  RegisterFilterLib
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
index 1aae45fa8a..79b2eb3e7b 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
@@ -1,11 +1,11 @@
 /** @file
   Common header file shared by all source files.
 
   This file includes package header files, dependent library classes.
 
-  Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
    SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #ifndef __BASEIOLIB_INTRINSIC_INTERNAL_H_
 #define __BASEIOLIB_INTRINSIC_INTERNAL_H_
@@ -15,7 +15,8 @@
 #include <Base.h>
 
 #include <Library/IoLib.h>
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
+#include <Library/RegisterFilterLib.h>
 
 #endif
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
index 86a07e60f8..34f9d1d106 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
@@ -2,11 +2,11 @@
 #  Instance of I/O Library using compiler intrinsics.
 #
 #  I/O Library that uses compiler intrinsics to perform IN and OUT instructions
 #  for IA-32 and x64.
 #
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -47,6 +47,7 @@ [Packages]
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
   DebugLib
   BaseLib
+  RegisterFilterLib
 
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
index a6bbc92546..d0d7044f09 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
@@ -1,9 +1,9 @@
 /** @file
   Common I/O Library routines.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "BaseIoLibIntrinsicInternal.h"
@@ -80,14 +80,19 @@ EFIAPI
 MmioRead8 (
   IN      UINTN                     Address
   )
 {
   UINT8                             Value;
+  BOOLEAN                           Flag;
 
-  MemoryFence ();
-  Value = *(volatile UINT8*)Address;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    Value = *(volatile UINT8*)Address;
+    MemoryFence ();
+  }
+  FilterAfterMmIoRead (FilterWidth8, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -110,13 +115,19 @@ EFIAPI
 MmioWrite8 (
   IN      UINTN                     Address,
   IN      UINT8                     Value
   )
 {
-  MemoryFence ();
-  *(volatile UINT8*)Address = Value;
-  MemoryFence ();
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    *(volatile UINT8*)Address = Value;
+    MemoryFence ();
+  }
+  FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -139,16 +150,20 @@ EFIAPI
 MmioRead16 (
   IN      UINTN                     Address
   )
 {
   UINT16                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 1) == 0);
-
-  MemoryFence ();
-  Value = *(volatile UINT16*)Address;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    Value = *(volatile UINT16*)Address;
+    MemoryFence ();
+  }
+  FilterAfterMmIoRead (FilterWidth16, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -172,15 +187,21 @@ EFIAPI
 MmioWrite16 (
   IN      UINTN                     Address,
   IN      UINT16                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 1) == 0);
 
-  MemoryFence ();
-  *(volatile UINT16*)Address = Value;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    *(volatile UINT16*)Address = Value;
+    MemoryFence ();
+  }
+  FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -203,16 +224,21 @@ EFIAPI
 MmioRead32 (
   IN      UINTN                     Address
   )
 {
   UINT32                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 3) == 0);
 
-  MemoryFence ();
-  Value = *(volatile UINT32*)Address;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    Value = *(volatile UINT32*)Address;
+    MemoryFence ();
+  }
+  FilterAfterMmIoRead (FilterWidth32, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -236,15 +262,21 @@ EFIAPI
 MmioWrite32 (
   IN      UINTN                     Address,
   IN      UINT32                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 3) == 0);
 
-  MemoryFence ();
-  *(volatile UINT32*)Address = Value;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    *(volatile UINT32*)Address = Value;
+    MemoryFence ();
+  }
+  FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -267,16 +299,21 @@ EFIAPI
 MmioRead64 (
   IN      UINTN                     Address
   )
 {
   UINT64                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 7) == 0);
 
-  MemoryFence ();
-  Value = *(volatile UINT64*)Address;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    Value = *(volatile UINT64*)Address;
+    MemoryFence ();
+  }
+  FilterAfterMmIoRead (FilterWidth64, Address, &Value);
 
   return Value;
 }
 
 /**
@@ -298,14 +335,20 @@ EFIAPI
 MmioWrite64 (
   IN      UINTN                     Address,
   IN      UINT64                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 7) == 0);
 
-  MemoryFence ();
-  *(volatile UINT64*)Address = Value;
-  MemoryFence ();
+  Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
+  if (Flag) {
+    MemoryFence ();
+    *(volatile UINT64*)Address = Value;
+    MemoryFence ();
+  }
+  FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
 
   return Value;
 }
 
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
index 9715705ee0..6140840769 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
@@ -1,9 +1,9 @@
 /** @file
   I/O Library for ARM.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
   Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -544,11 +544,20 @@ UINT8
 EFIAPI
 MmioRead8 (
   IN      UINTN                     Address
   )
 {
-  return MmioRead8Internal (Address);
+  UINT8      Value;
+  BOOLEAN    Flag;
+
+  Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
+  if (Flag) {
+    Value = MmioRead8Internal (Address);
+  }
+  FilterAfterMmIoRead (FilterWidth8, Address, &Value);
+
+  return Value;
 }
 
 /**
   Writes an 8-bit MMIO register.
 
@@ -567,11 +576,18 @@ EFIAPI
 MmioWrite8 (
   IN      UINTN                     Address,
   IN      UINT8                     Value
   )
 {
-  MmioWrite8Internal (Address, Value);
+  BOOLEAN               Flag;
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
+  if (Flag) {
+    MmioWrite8Internal (Address, Value);
+  }
+  FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 16-bit MMIO register.
@@ -591,13 +607,22 @@ UINT16
 EFIAPI
 MmioRead16 (
   IN      UINTN                     Address
   )
 {
+  BOOLEAN    Flag;
+  UINT16     Value;
+
   ASSERT ((Address & 1) == 0);
 
-  return MmioRead16Internal (Address);
+  Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
+  if (Flag) {
+    Value = MmioRead16Internal (Address);
+  }
+  FilterAfterMmIoRead (FilterWidth16, Address, &Value);
+
+  return Value;
 }
 
 /**
   Writes a 16-bit MMIO register.
 
@@ -616,13 +641,20 @@ EFIAPI
 MmioWrite16 (
   IN      UINTN                     Address,
   IN      UINT16                    Value
   )
 {
+  BOOLEAN    Flag;
+
   ASSERT ((Address & 1) == 0);
 
-  MmioWrite16Internal (Address, Value);
+  Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
+  if (Flag) {
+    MmioWrite16Internal (Address, Value);
+  }
+  FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 32-bit MMIO register.
@@ -642,13 +674,22 @@ UINT32
 EFIAPI
 MmioRead32 (
   IN      UINTN                     Address
   )
 {
+  BOOLEAN   Flag;
+  UINT32    Value;
+
   ASSERT ((Address & 3) == 0);
 
-  return MmioRead32Internal (Address);
+  Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
+  if (Flag) {
+    Value = MmioRead32Internal (Address);
+  }
+  FilterAfterMmIoRead (FilterWidth32, Address, &Value);
+
+  return Value;
 }
 
 /**
   Writes a 32-bit MMIO register.
 
@@ -667,13 +708,20 @@ EFIAPI
 MmioWrite32 (
   IN      UINTN                     Address,
   IN      UINT32                    Value
   )
 {
+  BOOLEAN   Flag;
+
   ASSERT ((Address & 3) == 0);
 
-  MmioWrite32Internal (Address, Value);
+  Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
+  if (Flag) {
+    MmioWrite32Internal (Address, Value);
+  }
+  FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 64-bit MMIO register.
@@ -693,13 +741,22 @@ UINT64
 EFIAPI
 MmioRead64 (
   IN      UINTN                     Address
   )
 {
+  BOOLEAN   Flag;
+  UINT64    Value;
+
   ASSERT ((Address & 7) == 0);
 
-  return MmioRead64Internal (Address);
+  Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
+  if (Flag) {
+    Value = MmioRead64Internal (Address);
+  }
+  FilterAfterMmIoRead (FilterWidth64, Address, &Value);
+
+  return Value;
 }
 
 /**
   Writes a 64-bit MMIO register.
 
@@ -718,10 +775,17 @@ EFIAPI
 MmioWrite64 (
   IN      UINTN                     Address,
   IN      UINT64                    Value
   )
 {
+  BOOLEAN   Flag;
+
   ASSERT ((Address & 7) == 0);
 
-  MmioWrite64Internal (Address, Value);
+  Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
+  if (Flag) {
+    MmioWrite64Internal (Address, Value);
+  }
+  FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
+
   return Value;
 }
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
index b3a1a20256..ecf9ed6191 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
@@ -8,11 +8,11 @@
   with EFIAPI assembler.
 
   We don't advocate putting compiler specifics in libraries or drivers but there
   is no other way to make this work.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
@@ -37,12 +37,18 @@ EFIAPI
 IoRead8 (
   IN      UINTN                     Port
   )
 {
   UINT8   Data;
+  BOOLEAN Flag;
+
+  Flag = FilterBeforeIoRead (FilterWidth8, Port, &Data);
+  if (Flag) {
+    __asm__ __volatile__ ("inb %w1,%b0" : "=a" (Data) : "d" ((UINT16)Port));
+  }
+  FilterAfterIoRead (FilterWidth8, Port, &Data);
 
-  __asm__ __volatile__ ("inb %w1,%b0" : "=a" (Data) : "d" ((UINT16)Port));
   return Data;
 }
 
 /**
   Writes an 8-bit I/O port.
@@ -64,11 +70,18 @@ EFIAPI
 IoWrite8 (
   IN      UINTN                     Port,
   IN      UINT8                     Value
   )
 {
-  __asm__ __volatile__ ("outb %b0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+  BOOLEAN Flag;
+
+  Flag = FilterBeforeIoWrite (FilterWidth8, Port, &Value);
+  if (Flag) {
+    __asm__ __volatile__ ("outb %b0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+  }
+  FilterAfterIoWrite (FilterWidth8, Port, &Value);
+
   return Value;;
 }
 
 /**
   Reads a 16-bit I/O port.
@@ -90,13 +103,20 @@ EFIAPI
 IoRead16 (
   IN      UINTN                     Port
   )
 {
   UINT16   Data;
+  BOOLEAN  Flag;
 
   ASSERT ((Port & 1) == 0);
-  __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port));
+
+  Flag = FilterBeforeIoRead (FilterWidth16, Port, &Data);
+  if (Flag) {
+     __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port));
+  }
+  FilterAfterIoRead (FilterWidth16, Port, &Data);
+
   return Data;
 }
 
 /**
   Writes a 16-bit I/O port.
@@ -119,12 +139,21 @@ EFIAPI
 IoWrite16 (
   IN      UINTN                     Port,
   IN      UINT16                    Value
   )
 {
+
+  BOOLEAN Flag;
+
   ASSERT ((Port & 1) == 0);
-  __asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+
+  Flag = FilterBeforeIoWrite (FilterWidth16, Port, &Value);
+  if (Flag) {
+    __asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+  }
+  FilterAfterIoWrite (FilterWidth16, Port, &Value);
+
   return Value;;
 }
 
 /**
   Reads a 32-bit I/O port.
@@ -146,13 +175,20 @@ EFIAPI
 IoRead32 (
   IN      UINTN                     Port
   )
 {
   UINT32   Data;
+  BOOLEAN  Flag;
 
   ASSERT ((Port & 3) == 0);
-  __asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port));
+
+  Flag = FilterBeforeIoRead (FilterWidth32, Port, &Data);
+  if (Flag) {
+    __asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port));
+  }
+  FilterAfterIoRead (FilterWidth32, Port, &Data);
+
   return Data;
 }
 
 /**
   Writes a 32-bit I/O port.
@@ -175,10 +211,18 @@ EFIAPI
 IoWrite32 (
   IN      UINTN                     Port,
   IN      UINT32                    Value
   )
 {
+  BOOLEAN  Flag;
+
   ASSERT ((Port & 3) == 0);
-  __asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+
+  Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value);
+  if (Flag) {
+    __asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+  }
+  FilterAfterIoWrite (FilterWidth32, Port, &Value);
+
   return Value;
 }
 
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
index 769dddfce2..d2bc5f527c 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
@@ -6,11 +6,11 @@
   overhead.
 
   We don't advocate putting compiler specifics in libraries or drivers but there
   is no other way to make this work.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
@@ -64,14 +64,20 @@ EFIAPI
 IoRead8 (
   IN      UINTN                     Port
   )
 {
   UINT8                             Value;
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeIoRead (FilterWidth8, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    Value = (UINT8)_inp ((UINT16)Port);
+    _ReadWriteBarrier ();
+  }
+  FilterAfterIoRead (FilterWidth8, Port, &Value);
 
-  _ReadWriteBarrier ();
-  Value = (UINT8)_inp ((UINT16)Port);
-  _ReadWriteBarrier ();
   return Value;
 }
 
 /**
   Writes an 8-bit I/O port.
@@ -93,13 +99,20 @@ EFIAPI
 IoWrite8 (
   IN      UINTN                     Port,
   IN      UINT8                     Value
   )
 {
-  _ReadWriteBarrier ();
-  (UINT8)_outp ((UINT16)Port, Value);
-  _ReadWriteBarrier ();
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeIoWrite(FilterWidth8, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    (UINT8)_outp ((UINT16)Port, Value);
+    _ReadWriteBarrier ();
+  }
+  FilterAfterIoWrite (FilterWidth8, Port, &Value);
+
   return Value;
 }
 
 /**
   Reads a 16-bit I/O port.
@@ -121,15 +134,22 @@ EFIAPI
 IoRead16 (
   IN      UINTN                     Port
   )
 {
   UINT16                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Port & 1) == 0);
-  _ReadWriteBarrier ();
-  Value = _inpw ((UINT16)Port);
-  _ReadWriteBarrier ();
+
+  Flag = FilterBeforeIoRead (FilterWidth16, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    Value = _inpw ((UINT16)Port);
+    _ReadWriteBarrier ();
+  }
+  FilterBeforeIoRead (FilterWidth16, Port, &Value);
+
   return Value;
 }
 
 /**
   Writes a 16-bit I/O port.
@@ -152,14 +172,22 @@ EFIAPI
 IoWrite16 (
   IN      UINTN                     Port,
   IN      UINT16                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Port & 1) == 0);
-  _ReadWriteBarrier ();
-  _outpw ((UINT16)Port, Value);
-  _ReadWriteBarrier ();
+
+  Flag = FilterBeforeIoWrite(FilterWidth16, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    _outpw ((UINT16)Port, Value);
+    _ReadWriteBarrier ();
+  }
+  FilterAfterIoWrite (FilterWidth16, Port, &Value);
+
   return Value;
 }
 
 /**
   Reads a 32-bit I/O port.
@@ -181,15 +209,22 @@ EFIAPI
 IoRead32 (
   IN      UINTN                     Port
   )
 {
   UINT32                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Port & 3) == 0);
-  _ReadWriteBarrier ();
-  Value = _inpd ((UINT16)Port);
-  _ReadWriteBarrier ();
+
+  Flag = FilterBeforeIoRead(FilterWidth32, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    Value = _inpd ((UINT16)Port);
+    _ReadWriteBarrier ();
+  }
+  FilterAfterIoRead (FilterWidth32, Port, &Value);
+
   return Value;
 }
 
 /**
   Writes a 32-bit I/O port.
@@ -212,11 +247,19 @@ EFIAPI
 IoWrite32 (
   IN      UINTN                     Port,
   IN      UINT32                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Port & 3) == 0);
-  _ReadWriteBarrier ();
-  _outpd ((UINT16)Port, Value);
-  _ReadWriteBarrier ();
+
+  Flag = FilterBeforeIoWrite(FilterWidth32, Port, &Value);
+  if (Flag) {
+    _ReadWriteBarrier ();
+    _outpd ((UINT16)Port, Value);
+    _ReadWriteBarrier ();
+  }
+  FilterAfterIoWrite (FilterWidth32, Port, &Value);
+
   return Value;
 }
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
index a107136a74..937d6c5a55 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
@@ -1,10 +1,10 @@
 /** @file
   I/O library for non I/O read and write access (memory map I/O read and
   write only) architecture, such as ARM and RISC-V processor.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
   Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -406,12 +406,18 @@ EFIAPI
 MmioRead8 (
   IN      UINTN                     Address
   )
 {
   UINT8                             Value;
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
+  if (Flag {
+    Value = *(volatile UINT8*)Address;
+  }
+  FilterAfterMmIoRead (FilterWidth8, Address, &Value);
 
-  Value = *(volatile UINT8*)Address;
   return Value;
 }
 
 /**
   Writes an 8-bit MMIO register.
@@ -431,11 +437,18 @@ EFIAPI
 MmioWrite8 (
   IN      UINTN                     Address,
   IN      UINT8                     Value
   )
 {
-  *(volatile UINT8*)Address = Value;
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
+  if (Flag {
+    *(volatile UINT8*)Address = Value;
+  }
+  FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 16-bit MMIO register.
@@ -456,13 +469,20 @@ EFIAPI
 MmioRead16 (
   IN      UINTN                     Address
   )
 {
   UINT16                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 1) == 0);
-  Value = *(volatile UINT16*)Address;
+
+  Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
+  if (Flag {
+    Value = *(volatile UINT16*)Address;
+  }
+  FilterAfterMmIoRead (FilterWidth16, Address, &Value);
+
   return Value;
 }
 
 /**
   Writes a 16-bit MMIO register.
@@ -482,12 +502,20 @@ EFIAPI
 MmioWrite16 (
   IN      UINTN                     Address,
   IN      UINT16                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 1) == 0);
-  *(volatile UINT16*)Address = Value;
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
+  if (Flag {
+    *(volatile UINT16*)Address = Value;
+  }
+  FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 32-bit MMIO register.
@@ -508,13 +536,20 @@ EFIAPI
 MmioRead32 (
   IN      UINTN                     Address
   )
 {
   UINT32                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 3) == 0);
-  Value = *(volatile UINT32*)Address;
+
+  Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
+  if (Flag {
+    Value = *(volatile UINT32*)Address;
+  }
+  FilterAfterMmIoRead (FilterWidth32, Address, &Value);
+
   return Value;
 }
 
 /**
   Writes a 32-bit MMIO register.
@@ -534,12 +569,20 @@ EFIAPI
 MmioWrite32 (
   IN      UINTN                     Address,
   IN      UINT32                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 3) == 0);
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
+  if (Flag {
   *(volatile UINT32*)Address = Value;
+  }
+  FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
+
   return Value;
 }
 
 /**
   Reads a 64-bit MMIO register.
@@ -560,13 +603,20 @@ EFIAPI
 MmioRead64 (
   IN      UINTN                     Address
   )
 {
   UINT64                            Value;
+  BOOLEAN                           Flag;
 
   ASSERT ((Address & 7) == 0);
-  Value = *(volatile UINT64*)Address;
+
+  Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
+  if (Flag {
+    Value = *(volatile UINT64*)Address;
+  }
+  FilterAfterMmIoRead (FilterWidth64, Address, &Value);
+
   return Value;
 }
 
 /**
   Writes a 64-bit MMIO register.
@@ -586,10 +636,18 @@ EFIAPI
 MmioWrite64 (
   IN      UINTN                     Address,
   IN      UINT64                    Value
   )
 {
+  BOOLEAN                           Flag;
+
   ASSERT ((Address & 7) == 0);
-  *(volatile UINT64*)Address = Value;
+
+  Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
+  if (Flag {
+    *(volatile UINT64*)Address = Value;
+  }
+  FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
+
   return Value;
 }
 
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [patch V2 29/29] MdePkg/Baseib: Filter/trace MSR access for IA32/X64
  2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
                   ` (27 preceding siblings ...)
  2021-03-22  8:09 ` [patch V2 28/29] MdePkg/IoLib: Filter/trace port IO/MMIO access Dandan Bi
@ 2021-03-22  8:09 ` Dandan Bi
  28 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-22  8:09 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdePkg/Library/BaseLib/BaseLib.inf          |  5 ++-
 MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c | 38 +++++++++++-------
 MdePkg/Library/BaseLib/Ia32/ReadMsr64.c     | 38 ++++++++++++++++--
 MdePkg/Library/BaseLib/Ia32/WriteMsr64.c    | 22 +++++++----
 MdePkg/Library/BaseLib/X64/GccInlinePriv.c  | 43 ++++++++++++++-------
 MdePkg/Library/BaseLib/X64/ReadMsr64.c      | 15 ++++++-
 MdePkg/Library/BaseLib/X64/WriteMsr64.c     | 13 ++++++-
 7 files changed, 130 insertions(+), 44 deletions(-)

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf
index 3b85c56c3c..58e29cc7af 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Base Library implementation.
 #
-#  Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -409,10 +409,13 @@ [Packages]
 [LibraryClasses]
   PcdLib
   DebugLib
   BaseMemoryLib
 
+[LibraryClasses.X64, LibraryClasses.IA32]
+  RegisterFilterLib
+
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength      ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength     ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask   ## SOMETIMES_CONSUMES
diff --git a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
index 30aa63243b..40e8c08beb 100644
--- a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
@@ -1,17 +1,18 @@
 /** @file
   GCC inline implementation of BaseLib processor specific functions that use
   privlidged instructions.
 
-  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
 #include "BaseLibInternals.h"
+#include <Library/RegisterFilterLib.h>
 
 /**
   Enables CPU interrupts.
 
   Enables CPU interrupts.
@@ -61,16 +62,21 @@ EFIAPI
 AsmReadMsr64 (
   IN      UINT32                    Index
   )
 {
   UINT64 Data;
-
-  __asm__ __volatile__ (
-    "rdmsr"
-    : "=A" (Data)   // %0
-    : "c"  (Index)  // %1
-    );
+  BOOLEAN Flag;
+
+  Flag = FilterBeforeMsrRead (Index, &Data);
+  if (Flag) {
+    __asm__ __volatile__ (
+      "rdmsr"
+      : "=A" (Data)   // %0
+      : "c"  (Index)  // %1
+      );
+  }
+  FilterAfterMsrRead (Index, &Data);
 
   return Data;
 }
 
 /**
@@ -95,16 +101,22 @@ EFIAPI
 AsmWriteMsr64 (
   IN      UINT32                    Index,
   IN      UINT64                    Value
   )
 {
-  __asm__ __volatile__ (
-    "wrmsr"
-    :
-    : "c" (Index),
-      "A" (Value)
-    );
+  BOOLEAN  Flag;
+
+  Flag = FilterBeforeMsrWrite (Index, &Value);
+  if (Flag) {
+    __asm__ __volatile__ (
+      "wrmsr"
+      :
+      : "c" (Index),
+        "A" (Value)
+      );
+  }
+  FilterAfterMsrWrite (Index, &Value);
 
   return Value;
 }
 
 /**
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
index 6d2394b1a3..afe3aa5bdc 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
@@ -1,15 +1,15 @@
 /** @file
   AsmReadMsr64 function
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
-
+#include <Library/RegisterFilterLib.h>
 
 /**
   Returns a 64-bit Machine Specific Register(MSR).
 
   Reads and returns the 64-bit MSR specified by Index. No parameter checking is
@@ -22,16 +22,46 @@
 
   @return The value of the MSR identified by Index.
 
 **/
 UINT64
-EFIAPI
-AsmReadMsr64 (
+AsmReadMsr64Internal (
   IN UINT32  Index
   )
 {
   _asm {
     mov     ecx, Index
     rdmsr
   }
 }
 
+/**
+  Returns a 64-bit Machine Specific Register(MSR).
+
+  Reads and returns the 64-bit MSR specified by Index. No parameter checking is
+  performed on Index, and some Index values may cause CPU exceptions. The
+  caller must either guarantee that Index is valid, or the caller must set up
+  exception handlers to catch the exceptions. This function is only available
+  on IA-32 and x64.
+
+  @param  Index The 32-bit MSR index to read.
+
+  @return The value of the MSR identified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadMsr64 (
+  IN UINT32  Index
+  )
+{
+  UINT64                            Value;
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMsrRead (Index, &Value);
+  if (Flag) {
+    Value = AsmReadMsr64Internal (Index);
+  }
+  FilterAfterMsrRead (Index, &Value);
+
+  return Value;
+}
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
index badf1d8e58..ba0cf3f74c 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
@@ -1,15 +1,15 @@
 /** @file
   AsmWriteMsr64 function
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
-
+#include <Library/RegisterFilterLib.h>
 
 /**
   Writes a 64-bit value to a Machine Specific Register(MSR), and returns the
   value.
 
@@ -31,13 +31,21 @@ EFIAPI
 AsmWriteMsr64 (
   IN UINT32  Index,
   IN UINT64  Value
   )
 {
-  _asm {
-    mov     edx, dword ptr [Value + 4]
-    mov     eax, dword ptr [Value + 0]
-    mov     ecx, Index
-    wrmsr
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMsrWrite (Index, &Value);
+  if (Flag) {
+    _asm {
+      mov     edx, dword ptr [Value + 4]
+      mov     eax, dword ptr [Value + 0]
+      mov     ecx, Index
+      wrmsr
+    }
   }
+  FilterAfterMsrWrite (Index, &Value);
+
+  return Value;
 }
 
diff --git a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
index 98be19b3c7..e4920f2116 100644
--- a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
@@ -1,17 +1,18 @@
 /** @file
   GCC inline implementation of BaseLib processor specific functions that use
   privlidged instructions.
 
-  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 
 #include "BaseLibInternals.h"
+#include <Library/RegisterFilterLib.h>
 
 /**
   Enables CPU interrupts.
 
   Enables CPU interrupts.
@@ -62,17 +63,24 @@ AsmReadMsr64 (
   IN      UINT32                    Index
   )
 {
   UINT32 LowData;
   UINT32 HighData;
-
-  __asm__ __volatile__ (
-    "rdmsr"
-    : "=a" (LowData),   // %0
-      "=d" (HighData)   // %1
-    : "c"  (Index)      // %2
-    );
+  UINT64 Value;
+  BOOLEAN Flag;
+
+  Flag = FilterBeforeMsrRead (Index, &Value);
+  if (Flag) {
+    __asm__ __volatile__ (
+      "rdmsr"
+      : "=a" (LowData),   // %0
+        "=d" (HighData)   // %1
+      : "c"  (Index)      // %2
+      );
+    Value = (((UINT64)HighData) << 32) | LowData;
+  }
+  FilterAfterMsrRead (Index, &Value);
 
   return (((UINT64)HighData) << 32) | LowData;
 }
 
 /**
@@ -99,21 +107,26 @@ AsmWriteMsr64 (
   IN      UINT64                    Value
   )
 {
   UINT32 LowData;
   UINT32 HighData;
+  BOOLEAN Flag;
 
   LowData  = (UINT32)(Value);
   HighData = (UINT32)(Value >> 32);
 
-  __asm__ __volatile__ (
-    "wrmsr"
-    :
-    : "c" (Index),
-      "a" (LowData),
-      "d" (HighData)
-    );
+  Flag = FilterBeforeMsrWrite (Index, &Value);
+  if (Flag) {
+    __asm__ __volatile__ (
+      "wrmsr"
+      :
+      : "c" (Index),
+        "a" (LowData),
+        "d" (HighData)
+      );
+  }
+  FilterAfterMsrWrite (Index, &Value);
 
   return Value;
 }
 
 /**
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.c b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
index 5ee7ca53f3..36a349432c 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
@@ -1,17 +1,19 @@
 /** @file
   CpuBreakpoint function.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 /**
   Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
 **/
 
+#include <Library/RegisterFilterLib.h>
+
 unsigned __int64 __readmsr (int register);
 
 #pragma intrinsic(__readmsr)
 
 /**
@@ -26,8 +28,17 @@ UINT64
 EFIAPI
 AsmReadMsr64 (
   IN UINT32  Index
   )
 {
-  return __readmsr (Index);
+  UINT64                            Value;
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMsrRead (Index, &Value);
+  if (Flag) {
+    Value = __readmsr (Index);
+  }
+  FilterAfterMsrRead (Index, &Value);
+
+  return Value;
 }
 
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.c b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
index 98c5458d8a..bb030832c4 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
@@ -1,17 +1,19 @@
 /** @file
   CpuBreakpoint function.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 /**
   Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
 **/
 
+#include <Library/RegisterFilterLib.h>
+
 void __writemsr (unsigned long Register, unsigned __int64 Value);
 
 #pragma intrinsic(__writemsr)
 
 /**
@@ -28,9 +30,16 @@ EFIAPI
 AsmWriteMsr64 (
   IN UINT32  Index,
   IN UINT64  Value
   )
 {
-  __writemsr (Index, Value);
+  BOOLEAN                           Flag;
+
+  Flag = FilterBeforeMsrWrite (Index, &Value);
+  if (Flag) {
+    __writemsr (Index, Value);
+  }
+  FilterAfterMsrWrite (Index, &Value);
+
   return Value;
 }
 
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 06/29] CryptoPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 06/29] CryptoPkg: " Dandan Bi
@ 2021-03-22  8:20   ` Yao, Jiewen
  0 siblings, 0 replies; 55+ messages in thread
From: Yao, Jiewen @ 2021-03-22  8:20 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Wang, Jian J, Lu, XiaoyuX, Jiang, Guomin

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 4:09 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> Lu, XiaoyuX <xiaoyux.lu@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>
> Subject: [patch V2 06/29] CryptoPkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  CryptoPkg/CryptoPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
> index 55383f2722..99d07108c4 100644
> --- a/CryptoPkg/CryptoPkg.dsc
> +++ b/CryptoPkg/CryptoPkg.dsc
> @@ -1,10 +1,10 @@
>  ## @file
>  #  Cryptographic Library Package for UEFI Security Implementation.
>  #  PEIM, DXE Driver, and SMM Driver with all crypto services enabled.
>  #
> -#  Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.<BR>
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> 
> @@ -49,10 +49,12 @@ [Defines]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
> 
> #################################################################
> ###############
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> 
> UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootS
> ervicesTableLib.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 26/29] UefiPayloadPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 26/29] UefiPayloadPkg: " Dandan Bi
@ 2021-03-22 14:03   ` Ma, Maurice
  2021-03-23  5:20   ` Guo Dong
  1 sibling, 0 replies; 55+ messages in thread
From: Ma, Maurice @ 2021-03-22 14:03 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Dong, Guo, You, Benjamin

Reviewed-by:  Maurice Ma <maurice.ma@intel.com>


> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 1:10
> To: devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Dong, Guo
> <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
> Subject: [patch V2 26/29] UefiPayloadPkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library instances provided
> by MdePkg and RegisterFilterLibNull Library was also added into it as the first
> version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for RegisterFilterLibNull
> which will be consumed by IoLib and BaseLib.
> 
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 23edd163e9..11f951ac59 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -1,11 +1,11 @@
>  ## @file
>  # Bootloader Payload Package
>  #
>  # Provides drivers and definitions to create uefi payload for bootloaders.
>  #
> -# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights
> +reserved.<BR>
>  # Copyright (c) Microsoft Corporation.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  ##
> 
> @@ -112,10 +112,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
> 
> ##########################################################
> ######################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    #
>    # Entry point
>    #
> 
> DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint
> .inf
> 
> UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry
> Point.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-22  8:09 ` [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg Dandan Bi
@ 2021-03-22 17:46   ` Laszlo Ersek
  2021-03-23  3:40     ` [edk2-devel] " Ni, Ray
  2021-03-26  0:48   ` Michael D Kinney
  1 sibling, 1 reply; 55+ messages in thread
From: Laszlo Ersek @ 2021-03-22 17:46 UTC (permalink / raw)
  To: Dandan Bi, devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

On 03/22/21 09:09, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc is added for some default libraries provided by MdePkg.
> Platform can include MdeLibs.dsc.inc file to avoid some potential
> incompatible changes to platform dsc file in future.
> 
> Only add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
> Can update and maintain MdeLibs.dsc.inc gradually later.
> 
> "MdeLibs.dsc.inc" for the [LibraryClasses*] section(s)
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  MdePkg/MdeLibs.dsc.inc | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>  create mode 100644 MdePkg/MdeLibs.dsc.inc
> 
> diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
> new file mode 100644
> index 0000000000..75e516c21a
> --- /dev/null
> +++ b/MdePkg/MdeLibs.dsc.inc
> @@ -0,0 +1,14 @@
> +## @file
> +# Mde DSC include file for [LibraryClasses*] section of all Architectures.
> +#
> +# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
> +# by using "!include MdePkg/MdeLibs.dsc.inc" to specify the library instances
> +# of some EDKII basic/common library classes.

I think Liming or Mike might want to propose improved wording for
"basic/common". Personally I'm fine with "basic/common", I just think a
more precise definition for MdePkg's content / scope might exist.

With or without a more precise expression for "basic/common":

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

Thanks
Laszlo

> +#
> +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +#
> +#    SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +  RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> 


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 27/29] UnitTestFrameworkPkg: " Dandan Bi
@ 2021-03-22 18:25   ` Bret Barkelew
  2021-03-23  1:52     ` Dandan Bi
  0 siblings, 1 reply; 55+ messages in thread
From: Bret Barkelew @ 2021-03-22 18:25 UTC (permalink / raw)
  To: Dandan Bi, devel@edk2.groups.io; +Cc: Kinney, Michael D, Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

Is there a PR somewhere that has a branch with all these changes applied? I’d like to poke around a little.

Thanks!

- Bret

From: Dandan Bi<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 1:10 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>; Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&amp;data=04%7C01%7CBret.Barkelew%40microsoft.com%7C77dd99e3296941afb9b408d8ed09fd3c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637519974445661033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oDafPDNi1k2MRYGrp%2Frhy1dB43tk%2B0YwF8%2FxdLqBXt8%3D&amp;reserved=0

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098..4adb98aff5 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -1,14 +1,16 @@
 ## @file
 # UnitTestFrameworkPkg DSC include file for target based test DSC
 #
-# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
--
2.18.0.windows.1


[-- Attachment #2: Type: text/html, Size: 5164 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 05/29] ArmVirtPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 05/29] ArmVirtPkg: " Dandan Bi
@ 2021-03-22 18:30   ` Laszlo Ersek
  0 siblings, 0 replies; 55+ messages in thread
From: Laszlo Ersek @ 2021-03-22 18:30 UTC (permalink / raw)
  To: Dandan Bi, devel; +Cc: Ard Biesheuvel, Leif Lindholm

On 03/22/21 09:09, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index d9abadbe70..18b57b61a1 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -1,9 +1,9 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
>  #  Copyright (c) Microsoft Corporation.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  #
> @@ -33,10 +33,12 @@ [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
>    GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
>    GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
>    RVCT:*_*_ARM_DLINK_FLAGS = --scatter $(EDK_TOOLS_PATH)/Scripts/Rvct-Align4K.sct
>  
>  [LibraryClasses.common]
> +  !include MdePkg/MdeLibs.dsc.inc
> +

For consistency with the existent line:

!include NetworkPkg/NetworkLibs.dsc.inc

please un-indent this new line as well, by two spaces.

With that:

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

Thanks
Laszlo

>  !if $(TARGET) == RELEASE
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>  !else
>    DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
>  !endif
> 


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 17/29] OvmfPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 17/29] OvmfPkg: " Dandan Bi
@ 2021-03-22 18:31   ` Laszlo Ersek
  0 siblings, 0 replies; 55+ messages in thread
From: Laszlo Ersek @ 2021-03-22 18:31 UTC (permalink / raw)
  To: Dandan Bi, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 03/22/21 09:09, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc | 4 +++-
>  OvmfPkg/Bhyve/BhyveX64.dsc   | 4 +++-
>  OvmfPkg/OvmfPkgIa32.dsc      | 4 +++-
>  OvmfPkg/OvmfPkgIa32X64.dsc   | 4 +++-
>  OvmfPkg/OvmfPkgX64.dsc       | 4 +++-
>  OvmfPkg/OvmfXen.dsc          | 4 +++-
>  6 files changed, 18 insertions(+), 6 deletions(-)

Same comment (for all 6 DSC files) as under the ArmVirtPkg patch --
please un-indent the !include directives. With that:

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

Thanks
Laszlo

> 
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
> index 65c42284d9..7bb94b8e11 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc
> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
> @@ -1,11 +1,11 @@
>  ## @file
>  #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform for SEV secure
>  #  virtual machine remote attestation and secret injection
>  #
>  #  Copyright (c) 2020 James Bottomley, IBM Corporation.
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -112,10 +112,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 4a1cdf5aca..3a1a76a3ad 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -1,8 +1,8 @@
>  #
>  #  Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  Copyright (c) 2014, Pluribus Networks, Inc.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -112,10 +112,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 1eaf3e99c6..7b49e2a648 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
>  #
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  Copyright (c) Microsoft Corporation.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -116,10 +116,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 4a5a430147..b60212843b 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
>  #
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  Copyright (c) Microsoft Corporation.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -120,10 +120,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index d4d601b444..0c06f33782 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
>  #
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  Copyright (c) Microsoft Corporation.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -120,10 +120,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
> diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
> index 507029404f..92e8d1967c 100644
> --- a/OvmfPkg/OvmfXen.dsc
> +++ b/OvmfPkg/OvmfXen.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
>  #
> -#  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  Copyright (c) 2019, Citrix Systems, Inc.
>  #  Copyright (c) Microsoft Corporation.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -110,10 +110,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
>  ################################################################################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>    TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf
>    ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
> 


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 25/29] UefiCpuPkg: " Dandan Bi
@ 2021-03-22 18:32   ` Laszlo Ersek
  2021-03-25 23:32     ` [edk2-devel] " Ni, Ray
  2021-03-26  0:32   ` Dong, Eric
  1 sibling, 1 reply; 55+ messages in thread
From: Laszlo Ersek @ 2021-03-22 18:32 UTC (permalink / raw)
  To: Dandan Bi, devel; +Cc: Eric Dong, Ray Ni, Rahul Kumar

On 03/22/21 09:09, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  UefiCpuPkg/UefiCpuPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
> index 7db419471d..6c7cc6b273 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  UefiCpuPkg Package
>  #
> -#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
>  
> @@ -20,10 +20,12 @@ [Defines]
>  #
>  # External libraries to build package
>  #
>  
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>    SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
> 

I would suggest un-indenting the !include directive here as well.

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

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 14/29] MdeModulePkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 14/29] MdeModulePkg: " Dandan Bi
@ 2021-03-23  1:01   ` Wu, Hao A
  0 siblings, 0 replies; 55+ messages in thread
From: Wu, Hao A @ 2021-03-23  1:01 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Wang, Jian J

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 4:09 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> Subject: [patch V2 14/29] MdeModulePkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library instances provided
> by MdePkg and RegisterFilterLibNull Library was also added into it as the first
> version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for RegisterFilterLibNull
> which will be consumed by IoLib and BaseLib.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  MdeModulePkg/MdeModulePkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.dsc
> b/MdeModulePkg/MdeModulePkg.dsc index 9272da89a9..76522300cd
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dsc
> +++ b/MdeModulePkg/MdeModulePkg.dsc
> @@ -1,10 +1,10 @@
>  ## @file
>  # EFI/PI Reference Module Package for All Architectures  #  # (C) Copyright
> 2014 Hewlett-Packard Development Company, L.P.<BR> -# Copyright (c) 2007
> - 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2007 - 2021, Intel Corporation. All rights
> +reserved.<BR>
>  # Copyright (c) Microsoft Corporation.
>  #
>  #    SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -18,10 +18,12 @@ [Defines]
>    SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64|RISCV64
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
> 
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


>    #
>    # Entry point
>    #
> 
> PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.in
> f
>    PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 23/29] SourceLevelDebugPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 23/29] SourceLevelDebugPkg: " Dandan Bi
@ 2021-03-23  1:02   ` Wu, Hao A
  0 siblings, 0 replies; 55+ messages in thread
From: Wu, Hao A @ 2021-03-23  1:02 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 4:10 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>
> Subject: [patch V2 23/29] SourceLevelDebugPkg: Consume MdeLibs.dsc.inc
> for RegisterFilterLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library instances provided
> by MdePkg and RegisterFilterLibNull Library was also added into it as the first
> version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for RegisterFilterLibNull
> which will be consumed by IoLib and BaseLib.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> index 20eb10ba07..ec2e803d6c 100644
> --- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> +++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  # Source Level Debug Package.
>  #
> -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2010 - 2021, Intel Corporation. All rights
> +reserved.<BR>
>  # Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>  #
>  #    SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -22,10 +22,12 @@ [Defines]
>    SUPPORTED_ARCHITECTURES        = IA32|X64
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
> 
>  [LibraryClasses.common]
> +  !include MdePkg/MdeLibs.dsc.inc
> +


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.
> inf
> 
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Bas
> eDebugPrintErrorLevelLib.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>    PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22 18:25   ` [EXTERNAL] " Bret Barkelew
@ 2021-03-23  1:52     ` Dandan Bi
  2021-03-25 18:35       ` Bret Barkelew
  0 siblings, 1 reply; 55+ messages in thread
From: Dandan Bi @ 2021-03-23  1:52 UTC (permalink / raw)
  To: Bret Barkelew, devel@edk2.groups.io; +Cc: Kinney, Michael D, Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 3197 bytes --]

Hi Bret,

Here is the branch and PR I just created for this change, please help review. Thanks.
https://github.com/dandanbi/edk2/tree/RegisterFilterLibV2
https://github.com/tianocore/edk2/pull/1509



Thanks,
Dandan

From: Bret Barkelew <Bret.Barkelew@microsoft.com>
Sent: Tuesday, March 23, 2021 2:25 AM
To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Is there a PR somewhere that has a branch with all these changes applied? I'd like to poke around a little.

Thanks!

- Bret

From: Dandan Bi<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 1:10 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>; Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&amp;data=04%7C01%7CBret.Barkelew%40microsoft.com%7C77dd99e3296941afb9b408d8ed09fd3c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637519974445661033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oDafPDNi1k2MRYGrp%2Frhy1dB43tk%2B0YwF8%2FxdLqBXt8%3D&amp;reserved=0

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com<mailto:Bret.Barkelew@microsoft.com>>
Signed-off-by: Dandan Bi <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098..4adb98aff5 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -1,14 +1,16 @@
 ## @file
 # UnitTestFrameworkPkg DSC include file for target based test DSC
 #
-# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
--
2.18.0.windows.1


[-- Attachment #2: Type: text/html, Size: 7198 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 19/29] RedfishPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 19/29] RedfishPkg: " Dandan Bi
@ 2021-03-23  2:17   ` Abner Chang
  2021-03-23  2:32   ` Nickle Wang
  1 sibling, 0 replies; 55+ messages in thread
From: Abner Chang @ 2021-03-23  2:17 UTC (permalink / raw)
  To: Dandan Bi, devel@edk2.groups.io; +Cc: Wang, Nickle (HPS SW)


We can remove the indent (as Laszlo mentioned) to make all changes in consistent.

Reviewed-by: Abner Chang <abner.chang@hpe.com>


> -----Original Message-----
> From: Dandan Bi [mailto:dandan.bi@intel.com]
> Sent: Monday, March 22, 2021 4:10 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> Wang, Nickle (HPS SW) <nickle.wang@hpe.com>
> Subject: [patch V2 19/29] RedfishPkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246&d=DwIBAg&c=C5b8zRQO1miGmBeVZ2LFWg&r=_SN6FZBN4Vgi4Ulks
> kz6qU3NYRO03nHp9P7Z5q59A3E&m=9oO-V9aX-
> W1JOPgBsHUeqx92B2q1ezHFVggs6aGHyP0&s=iNK_snqdnGVjJ06V409L6yAkJ
> lpkxymaYEzvCwjcpJ0&e=
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Nickle Wang <nickle.wang@hpe.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  RedfishPkg/RedfishPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
> index e0052290b5..4af4d0e6bc 100644
> --- a/RedfishPkg/RedfishPkg.dsc
> +++ b/RedfishPkg/RedfishPkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  # Redfish Package
>  #
> -# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
>  # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
>  #
>  #    SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -17,10 +17,12 @@ [Defines]
>    SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64|RISCV64
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
> 
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
> 
> UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry
> Point.inf
> 
> UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo
> otServicesTableLib.inf
>    UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
> 
> UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
> /UefiRuntimeServicesTableLib.inf
> 
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
> ryAllocationLib.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [edk2-devel] [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance
  2021-03-22  8:09 ` [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance Dandan Bi
@ 2021-03-23  2:24   ` Abner Chang
  0 siblings, 0 replies; 55+ messages in thread
From: Abner Chang @ 2021-03-23  2:24 UTC (permalink / raw)
  To: devel@edk2.groups.io, dandan.bi@intel.com
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu

Reviewed-by: Abner Chang <abner.chang@hpe.com>

Thanks for adding description of return values.


> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Dandan Bi
> Sent: Monday, March 22, 2021 4:09 PM
> To: devel@edk2.groups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [patch V2 01/29] MdePkg: Add RegisterFilterLib class
> and NULL instance
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246&d=DwIBAg&c=C5b8zRQO1miGmBeVZ2LFWg&r=_SN6FZBN4Vgi4Ulks
> kz6qU3NYRO03nHp9P7Z5q59A3E&m=0EinCfro8QrVJOUHqC9SQrGFKTLw_fpn
> ApwpgZrJTFI&s=fInsRu_7K_UxMpaoSvL_C5dtlLIZ8c8g12wuPvHoi-4&e=
> 
> 1. Add a new library class (RegisterFilterLib) to filter
> and trace port IO/MMIO/MSR access.
> 2. Add a NULL instance (RegisterFilterLibNull) can be used
> to keep current behavior.
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  MdePkg/Include/Library/RegisterFilterLib.h    | 243 ++++++++++++++++
>  .../RegisterFilterLibNull.c                   | 271 ++++++++++++++++++
>  .../RegisterFilterLibNull.inf                 |  23 ++
>  .../RegisterFilterLibNull.uni                 |  13 +
>  MdePkg/MdePkg.dec                             |   7 +-
>  MdePkg/MdePkg.dsc                             |   4 +-
>  6 files changed, 559 insertions(+), 2 deletions(-)
>  create mode 100644 MdePkg/Include/Library/RegisterFilterLib.h
>  create mode 100644
> MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
>  create mode 100644
> MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
>  create mode 100644
> MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
> 
> diff --git a/MdePkg/Include/Library/RegisterFilterLib.h
> b/MdePkg/Include/Library/RegisterFilterLib.h
> new file mode 100644
> index 0000000000..c4402da7d8
> --- /dev/null
> +++ b/MdePkg/Include/Library/RegisterFilterLib.h
> @@ -0,0 +1,243 @@
> +/** @file
> +  Public include file for the Port IO/MMIO/MSR RegisterFilterLib.
> +
> +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REGISTER_FILTER_LIB_H_
> +#define REGISTER_FILTER_LIB_H_
> +
> +typedef enum {
> +  FilterWidth8,
> +  FilterWidth16,
> +  FilterWidth32,
> +  FilterWidth64
> +} FILTER_IO_WIDTH;
> +
> +/**
> +  Filter IO read operation before read IO port.
> +  It is used to filter IO read operation.
> +
> +  It will return the flag to decide whether require read real IO port.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +  @retval TRUE         Need to excute the IO read.
> +  @retval FALSE        Skip the IO read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeIoRead (
> +  IN FILTER_IO_WIDTH   Width,
> +  IN UINTN             Address,
> +  IN OUT VOID          *Buffer
> +  );
> +
> +/**
> +  Trace IO read operation after read IO port.
> +  It is used to trace IO operation.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +/**
> +  Filter IO Write operation before wirte IO port.
> +  It is used to filter IO operation.
> +
> +  It will return the flag to decide whether require read write IO port.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
> +
> +  @retval TRUE         Need to excute the IO write.
> +  @retval FALSE        Skip the IO write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +
> +  /**
> +  Trace IO Write operation after wirte IO port.
> +  It is used to trace IO operation.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +
> +/**
> +  Filter memory IO before Read operation.
> +
> +  It will return the flag to decide whether require read real MMIO.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +  @retval TRUE         Need to excute the MMIO read.
> +  @retval FALSE        Skip the MMIO read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMmIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN OUT VOID         *Buffer
> +  );
> +
> +/**
> +  Tracer memory IO after read operation
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMmIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +
> +/**
> +  Filter memory IO before write operation
> +
> +  It will return the flag to decide whether require wirte real MMIO.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
> +
> +  @retval TRUE         Need to excute the MMIO write.
> +  @retval FALSE        Skip the MMIO write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMmIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +
> +/**
> +  Tracer memory IO after write operation
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The source buffer from which to BeforeWrite data.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMmIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  );
> +
> +/**
> +  Filter MSR before read operation.
> +
> +  It will return the flag to decide whether require read real MSR.
> +  It can be used for emulation environment.
> +
> +  @param  Index                     The 8-bit Machine Specific Register index to
> BeforeWrite.
> +  @param  Value                     The 64-bit value to BeforeRead from the
> Machine Specific Register.
> +
> +  @retval TRUE         Need to excute the MSR read.
> +  @retval FALSE        Skip the MSR read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMsrRead (
> +  IN UINT32           Index,
> +  IN OUT UINT64       *Value
> +  );
> +
> +/**
> +  Trace MSR after read operation
> +
> +  @param  Index                     The 8-bit Machine Specific Register index to
> BeforeWrite.
> +  @param  Value                     The 64-bit value to BeforeRead from the
> Machine Specific Register.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMsrRead (
> +  IN UINT32            Index,
> +  IN UINT64            *Value
> +  );
> +
> +/**
> +  Filter MSR before write operation
> +
> +  It will return the flag to decide whether require write real MSR.
> +  It can be used for emulation environment.
> +
> +  @param  Index                     The 8-bit Machine Specific Register index to
> BeforeWrite.
> +  @param  Value                     The 64-bit value to BeforeWrite to the Machine
> Specific Register.
> +
> +  @retval TRUE         Need to excute the MSR write.
> +  @retval FALSE        Skip the MSR write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMsrWrite (
> +  IN UINT32           Index,
> +  IN UINT64           *Value
> +  );
> +
> +/**
> +  Trace MSR after write operation
> +
> +  @param  Index                     The 8-bit Machine Specific Register index to
> BeforeWrite.
> +  @param  Value                     The 64-bit value to BeforeWrite to the Machine
> Specific Register.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMsrWrite (
> +  IN UINT32            Index,
> +  IN UINT64            *Value
> +  );
> +
> +#endif // REGISTER_FILTER_LIB_H_
> diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
> b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
> new file mode 100644
> index 0000000000..7150f1ed5f
> --- /dev/null
> +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
> @@ -0,0 +1,271 @@
> +/** @file
> +  Null instance of RegisterFilterLib.
> +
> +  Copyright (c) 2021 Intel Corporation. All rights reserved.<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Library/RegisterFilterLib.h>
> +
> +/**
> +  Filter IO read operation before read IO port.
> +  It is used to filter IO read operation.
> +
> +  It will return the flag to decide whether require read real IO port.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in,out]   Buffer   The destination buffer to store the results.
> +
> +  @retval TRUE         Need to excute the IO read.
> +  @retval FALSE        Skip the IO read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN OUT VOID         *Buffer
> +  )
> +{
> +  return TRUE;
> +}
> +
> +/**
> +  Trace IO read operation after read IO port.
> +  It is used to trace IO operation.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return;
> +}
> +
> +/**
> +  Filter IO Write operation before wirte IO port.
> +  It is used to filter IO operation.
> +
> +  It will return the flag to decide whether require read write IO port.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The source buffer from which to write data.
> +
> +  @retval TRUE         Need to excute the IO write.
> +  @retval FALSE        Skip the IO write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return TRUE;
> +}
> +
> +  /**
> +  Trace IO Write operation after wirte IO port.
> +  It is used to trace IO operation.
> +
> +  @param[in]       Width    Signifies the width of the I/O operation.
> +  @param[in]       Address  The base address of the I/O operation.
> +  @param[in]       Buffer   The source buffer from which to Write data.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return;
> +}
> +
> +/**
> +  Filter memory IO before Read operation.
> +
> +  It will return the flag to decide whether require read real MMIO.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in,out]   Buffer   The destination buffer to store the results.
> +
> +  @retval TRUE         Need to excute the MMIO read.
> +  @retval FALSE        Skip the MMIO read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMmIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN OUT VOID         *Buffer
> +  )
> +{
> +  return TRUE;
> +}
> +
> +/**
> +  Tracer memory IO after read operation.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The destination buffer to store the results.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMmIoRead (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return;
> +}
> +
> +/**
> +  Filter memory IO before write operation.
> +
> +  It will return the flag to decide whether require wirte real MMIO.
> +  It can be used for emulation environment.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The source buffer from which to write data.
> +
> +  @retval TRUE         Need to excute the MMIO write.
> +  @retval FALSE        Skip the MMIO write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMmIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return TRUE;
> +}
> +
> +/**
> +  Tracer memory IO after write operation.
> +
> +  @param[in]       Width    Signifies the width of the memory I/O operation.
> +  @param[in]       Address  The base address of the memory I/O operation.
> +  @param[in]       Buffer   The source buffer from which to write data.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMmIoWrite (
> +  IN FILTER_IO_WIDTH  Width,
> +  IN UINTN            Address,
> +  IN VOID             *Buffer
> +  )
> +{
> +  return;
> +}
> +
> +/**
> +  Filter MSR before read operation.
> +
> +  It will return the flag to decide whether require read real MSR.
> +  It can be used for emulation environment.
> +
> +  @param  Index                     The Register index of the MSR.
> +  @param  Value                     Point to the data will be read from the MSR.
> +
> +  @retval TRUE         Need to excute the MSR read.
> +  @retval FALSE        Skip the MSR read.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMsrRead (
> +  IN UINT32        Index,
> +  IN OUT UINT64    *Value
> +  )
> +{
> +  return TRUE;
> +}
> +
> +/**
> +  Trace MSR after read operation.
> +
> +  @param  Index                     The Register index of the MSR.
> +  @param  Value                     Point to the data has been be read from the MSR.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMsrRead (
> +  IN UINT32    Index,
> +  IN UINT64    *Value
> +  )
> +{
> +  return;
> +}
> +
> +/**
> +  Filter MSR before write operation.
> +
> +  It will return the flag to decide whether require write real MSR.
> +  It can be used for emulation environment.
> +
> +  @param  Index                     The Register index of the MSR.
> +  @param  Value                     Point to the data want to be written to the MSR.
> +
> +  @retval TRUE         Need to excute the MSR write.
> +  @retval FALSE        Skip the MSR write.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FilterBeforeMsrWrite (
> +  IN UINT32    Index,
> +  IN UINT64    *Value
> +  )
> +{
> +  return TRUE;
> +}
> +
> +/**
> +  Trace MSR after write operation.
> +
> +  @param  Index                     The Register index of the MSR.
> +  @param  Value                     Point to the data has been be written to the MSR.
> +
> +**/
> +VOID
> +EFIAPI
> +FilterAfterMsrWrite (
> +  IN UINT32    Index,
> +  IN UINT64    *Value
> +  )
> +{
> +  return;
> +}
> +
> diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> new file mode 100644
> index 0000000000..a7fc7497ed
> --- /dev/null
> +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> @@ -0,0 +1,23 @@
> +## @file
> +#  Null instance of RegisterFilterLib.
> +#
> +#  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = FilterLibNull
> +  MODULE_UNI_FILE                = FilterLibNull.uni
> +  FILE_GUID                      = 9F555194-A410-4AD6-B3FC-53F6E10FA793
> +  MODULE_TYPE                    = BASE
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = RegisterFilterLib
> +
> +[Sources]
> +  RegisterFilterLibNull.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
> b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
> new file mode 100644
> index 0000000000..ed64c7e63d
> --- /dev/null
> +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni
> @@ -0,0 +1,13 @@
> +// /** @file
> +// Null instance of RegisterFilterLib.
> +//
> +// Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +// **/
> +
> +
> +#string STR_MODULE_ABSTRACT              #language en-US "Null instance of
> RegisterFilterLib."
> +#string STR_MODULE_DESCRIPTION           #language en-US "Null instance of
> RegisterFilterLib."
> +
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 1d2637acc2..65de5c4052 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -2,11 +2,11 @@
>  # This Package provides all definitions, library classes and libraries instances.
>  #
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of
>  # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.
>  #
> -# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
>  # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>  # (C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -260,10 +260,15 @@ [LibraryClasses]
>    ##  @libraryclass  This library provides an interface to request non-MMRAM
> pages to be mapped
>    #                  or unblocked from inside MM environment.
>    #
>    MmUnblockMemoryLib|Include/Library/MmUnblockMemoryLib.h
> 
> +  ##  @libraryclass  This library provides interfances to filter and trace port
> IO/MMIO/MSR access.
> +  #
> +  #
> +  RegisterFilterLib|Include/Library/RegisterFilterLib.h
> +
>  [LibraryClasses.IA32, LibraryClasses.X64]
>    ##  @libraryclass  Abstracts both S/W SMI generation and detection.
>    ##
>    SmmLib|Include/Library/SmmLib.h
> 
> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
> index 79629e3f93..be89e28eef 100644
> --- a/MdePkg/MdePkg.dsc
> +++ b/MdePkg/MdePkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  # EFI/PI MdePkg Package
>  #
> -# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
>  # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>  # (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
>  #
>  #    SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -125,10 +125,12 @@ [Components]
> 
> MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.
> inf
> 
> 
> MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntry
> Point.inf
> 
> MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTab
> leLib.inf
> 
> +  MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> +
>  [Components.IA32, Components.X64, Components.ARM,
> Components.AARCH64]
>    #
>    # Add UEFI Target Based Unit Tests
>    #
>    MdePkg/Test/UnitTest/Library/BaseLib/BaseLibUnitTestsUefi.inf
> --
> 2.18.0.windows.1
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 19/29] RedfishPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 19/29] RedfishPkg: " Dandan Bi
  2021-03-23  2:17   ` Abner Chang
@ 2021-03-23  2:32   ` Nickle Wang
  1 sibling, 0 replies; 55+ messages in thread
From: Nickle Wang @ 2021-03-23  2:32 UTC (permalink / raw)
  To: Dandan Bi, devel@edk2.groups.io; +Cc: Chang, Abner (HPS SW/FW Technologist)

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

> -----Original Message-----
> From: Dandan Bi <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 4:10 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> Wang, Nickle (HPS SW) <nickle.wang@hpe.com>
> Subject: [patch V2 19/29] RedfishPkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246&d=DwIBAg&c=C5b8zRQO1miGmBeVZ2LFWg&r=EyDVgu7wEWp3Fu
> WhtKB5mKTlF7DSyiKCS3SYOqNSrkM&m=d8pio_htEw5V07kdxFZCyG8T98cQT
> kJbfW58j17l7bg&s=G0MecFZwFJISbpHnfQxfutOVSIyxUVMiJnXSCxNwYps&e
> =
> 
> MdeLibs.dsc.inc was added for some basic/default library instances provided
> by MdePkg and RegisterFilterLibNull Library was also added into it as the first
> version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for RegisterFilterLibNull
> which will be consumed by IoLib and BaseLib.
> 
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Nickle Wang <nickle.wang@hpe.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  RedfishPkg/RedfishPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc index
> e0052290b5..4af4d0e6bc 100644
> --- a/RedfishPkg/RedfishPkg.dsc
> +++ b/RedfishPkg/RedfishPkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  # Redfish Package
>  #
> -# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2019 - 2021, Intel Corporation. All rights
> +reserved.<BR>
>  # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
>  #
>  #    SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -17,10 +17,12 @@ [Defines]
>    SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64|RISCV64
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
> 
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
> 
> UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry
> Point.inf
> 
> UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo
> otServicesTableLib.inf
>    UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
> 
> UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
> /UefiRuntimeServicesTableLib.inf
> 
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
> ryAllocationLib.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [edk2-devel] [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-22 17:46   ` Laszlo Ersek
@ 2021-03-23  3:40     ` Ni, Ray
  0 siblings, 0 replies; 55+ messages in thread
From: Ni, Ray @ 2021-03-23  3:40 UTC (permalink / raw)
  To: Laszlo Ersek, devel

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Dandan,
The MdeLibs.dsc.inc is almost empty with this patch. And the DSCs in consumer pkgs are not significantly simplified with this DSC header.

Can you please submit a Bugzilla to capture the task that lists libs in MdeLibs.dsc.inc and simplifies all existing consumer pkgs?

[-- Attachment #2: Type: text/html, Size: 296 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 26/29] UefiPayloadPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 26/29] UefiPayloadPkg: " Dandan Bi
  2021-03-22 14:03   ` Ma, Maurice
@ 2021-03-23  5:20   ` Guo Dong
  1 sibling, 0 replies; 55+ messages in thread
From: Guo Dong @ 2021-03-23  5:20 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Ma, Maurice, You, Benjamin


Reviewed-by: Guo Dong <guo.dong@intel.com>

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 1:10 AM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>;
> You, Benjamin <benjamin.you@intel.com>
> Subject: [patch V2 26/29] UefiPayloadPkg: Consume MdeLibs.dsc.inc for
> RegisterFilterLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
> 
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
> 
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 23edd163e9..11f951ac59 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -1,11 +1,11 @@
>  ## @file
>  # Bootloader Payload Package
>  #
>  # Provides drivers and definitions to create uefi payload for bootloaders.
>  #
> -# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
>  # Copyright (c) Microsoft Corporation.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> 
> @@ -112,10 +112,12 @@ [SkuIds]
>  #
>  # Library Class section - list of all Library Classes needed by this Platform.
>  #
> 
> ################################################################
> ################
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    #
>    # Entry point
>    #
> 
> DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> 
> UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoi
> nt.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-23  1:52     ` Dandan Bi
@ 2021-03-25 18:35       ` Bret Barkelew
  2021-03-26  7:36         ` Dandan Bi
  0 siblings, 1 reply; 55+ messages in thread
From: Bret Barkelew @ 2021-03-25 18:35 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Kinney, Michael D, Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 5188 bytes --]

Thanks, Dandan!

Apologies if this has already been asked, but is this necessary because C doesn’t have any options for symbol namespacing?
In other words, would it be just as easy to do this with a new implementation of IoLib if we didn’t have to worry about the symbol collisions?

- Bret

From: Bi, Dandan<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 6:52 PM
To: Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Hi Bret,

Here is the branch and PR I just created for this change, please help review. Thanks.
https://github.com/dandanbi/edk2/tree/RegisterFilterLibV2<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdandanbi%2Fedk2%2Ftree%2FRegisterFilterLibV2&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578049825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pQod4S5%2FehDSDOmGgRjK8j%2FQN%2FbQDpeLzSdEu%2BpqTwM%3D&reserved=0>
https://github.com/tianocore/edk2/pull/1509<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fpull%2F1509&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578059781%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=H2K3NDJvmXCY5BpE8pbgWvKYWfXN8Djgef8VKhWEaM0%3D&reserved=0>



Thanks,
Dandan

From: Bret Barkelew <Bret.Barkelew@microsoft.com>
Sent: Tuesday, March 23, 2021 2:25 AM
To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Is there a PR somewhere that has a branch with all these changes applied? I’d like to poke around a little.

Thanks!

- Bret

From: Dandan Bi<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 1:10 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>; Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&amp;data=04%7C01%7CBret.Barkelew%40microsoft.com%7C77dd99e3296941afb9b408d8ed09fd3c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637519974445661033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oDafPDNi1k2MRYGrp%2Frhy1dB43tk%2B0YwF8%2FxdLqBXt8%3D&amp;reserved=0<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578059781%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ms0PFIBmyzAuNFKWcMW9cPV28mOpcrJYL8%2F8y%2FCn6G0%3D&reserved=0>

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com<mailto:Bret.Barkelew@microsoft.com>>
Signed-off-by: Dandan Bi <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098..4adb98aff5 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -1,14 +1,16 @@
 ## @file
 # UnitTestFrameworkPkg DSC include file for target based test DSC
 #
-# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
--
2.18.0.windows.1



[-- Attachment #2: Type: text/html, Size: 8901 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 09/29] EmulatorPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 09/29] EmulatorPkg: " Dandan Bi
@ 2021-03-25 23:29   ` Ni, Ray
  0 siblings, 0 replies; 55+ messages in thread
From: Ni, Ray @ 2021-03-25 23:29 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Andrew Fish

[-- Attachment #1: Type: text/plain, Size: 2022 bytes --]

Reviewed-by: ray.ni@intel.com

thanks,
ray
________________________________
From: Bi, Dandan <dandan.bi@intel.com>
Sent: Monday, March 22, 2021 4:09:21 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
Subject: [patch V2 09/29] EmulatorPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 EmulatorPkg/EmulatorPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index a7ded49000..b8d1d12ace 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -2,11 +2,11 @@
 # UEFI/PI Emulation Platform with UEFI HII interface supported.
 #
 # The Emulation Platform can be used to debug individual modules, prior to creating
 # a real platform. This also provides an example for how an DSC is created.
 #
-# Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.<BR>
 # Copyright (c) Microsoft Corporation.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -43,10 +43,12 @@ [Defines]

 [SkuIds]
   0|DEFAULT

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
--
2.18.0.windows.1


[-- Attachment #2: Type: text/html, Size: 3212 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 10/29] FatPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 10/29] FatPkg: " Dandan Bi
@ 2021-03-25 23:30   ` Ni, Ray
  0 siblings, 0 replies; 55+ messages in thread
From: Ni, Ray @ 2021-03-25 23:30 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 1966 bytes --]

Reviewed-by: ray.ni@intel.com<mailto:ray.ni@intel.com>

thanks,
ray
________________________________
From: Bi, Dandan <dandan.bi@intel.com>
Sent: Monday, March 22, 2021 4:09:22 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>
Subject: [patch V2 10/29] FatPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 FatPkg/FatPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index d86256068b..e0264db803 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -1,11 +1,11 @@
 ## @file
 #  Build Binary Enhanced Fat Driver Modules.
 #
 #  This Platform file is used to generate the Binary Fat Drivers
 #  for EDK II Prime release.
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -26,10 +26,12 @@ [BuildOptions]
   MSFT:RELEASE_*_*_CC_FLAGS            = /D MDEPKG_NDEBUG
   RVCT:RELEASE_*_*_CC_FLAGS            = -DMDEPKG_NDEBUG
   *_*_*_CC_FLAGS                       = -D DISABLE_NEW_DEPRECATED_INTERFACES

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry Point Libraries
   #
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   #
--
2.18.0.windows.1


[-- Attachment #2: Type: text/html, Size: 3620 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 18/29] PcAtChipsetPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 18/29] PcAtChipsetPkg: " Dandan Bi
@ 2021-03-25 23:30   ` Ni, Ray
  0 siblings, 0 replies; 55+ messages in thread
From: Ni, Ray @ 2021-03-25 23:30 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

Reviewed-by: ray.ni@intel.com<mailto:ray.ni@intel.com>

thanks,
ray
________________________________
From: Bi, Dandan <dandan.bi@intel.com>
Sent: Monday, March 22, 2021 4:09:30 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>
Subject: [patch V2 18/29] PcAtChipsetPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 3d1fb816f5..8598e689f9 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  PC/AT Chipset Package
 #
-#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -17,10 +17,12 @@ [Defines]
   SUPPORTED_ARCHITECTURES        = IA32|X64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
--
2.18.0.windows.1


[-- Attachment #2: Type: text/html, Size: 3671 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [edk2-devel] [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22 18:32   ` Laszlo Ersek
@ 2021-03-25 23:32     ` Ni, Ray
  0 siblings, 0 replies; 55+ messages in thread
From: Ni, Ray @ 2021-03-25 23:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com, Bi, Dandan
  Cc: Dong, Eric, Kumar, Rahul1

[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]

Reviewed-by: ray.ni@intel.com<mailto:ray.ni@intel.com>

thanks,
ray
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Laszlo Ersek <lersek@redhat.com>
Sent: Tuesday, March 23, 2021 2:32:02 AM
To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
Subject: Re: [edk2-devel] [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

On 03/22/21 09:09, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
>
> MdeLibs.dsc.inc was added for some basic/default library
> instances provided by MdePkg and RegisterFilterLibNull Library
> was also added into it as the first version of MdeLibs.dsc.inc.
>
> So update platform dsc to consume MdeLibs.dsc.inc for
> RegisterFilterLibNull which will be consumed by IoLib and BaseLib.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  UefiCpuPkg/UefiCpuPkg.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
> index 7db419471d..6c7cc6b273 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> @@ -1,9 +1,9 @@
>  ## @file
>  #  UefiCpuPkg Package
>  #
> -#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
>
> @@ -20,10 +20,12 @@ [Defines]
>  #
>  # External libraries to build package
>  #
>
>  [LibraryClasses]
> +  !include MdePkg/MdeLibs.dsc.inc
> +
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>    SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
>

I would suggest un-indenting the !include directive here as well.

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

Thanks
Laszlo







[-- Attachment #2: Type: text/html, Size: 4028 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-22  8:09 ` [patch V2 25/29] UefiCpuPkg: " Dandan Bi
  2021-03-22 18:32   ` Laszlo Ersek
@ 2021-03-26  0:32   ` Dong, Eric
  1 sibling, 0 replies; 55+ messages in thread
From: Dong, Eric @ 2021-03-26  0:32 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Ni, Ray, Laszlo Ersek, Kumar, Rahul1

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan <dandan.bi@intel.com> 
Sent: Monday, March 22, 2021 4:10 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
Subject: [patch V2 25/29] UefiCpuPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246

MdeLibs.dsc.inc was added for some basic/default library instances provided by MdePkg and RegisterFilterLibNull Library was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UefiCpuPkg/UefiCpuPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 7db419471d..6c7cc6b273 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -1,9 +1,9 @@
 ## @file
 #  UefiCpuPkg Package
 #
-#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2021, Intel Corporation. All rights 
+reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent  #  ##
 
@@ -20,10 +20,12 @@ [Defines]
 #
 # External libraries to build package
 #
 
 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
--
2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-22  8:09 ` [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg Dandan Bi
  2021-03-22 17:46   ` Laszlo Ersek
@ 2021-03-26  0:48   ` Michael D Kinney
  2021-03-26  1:51     ` Dandan Bi
  2021-03-26  7:39     ` Dandan Bi
  1 sibling, 2 replies; 55+ messages in thread
From: Michael D Kinney @ 2021-03-26  0:48 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io, Kinney, Michael D
  Cc: Liming Gao, Liu, Zhiguang, Laszlo Ersek

Dandan,

I have a concern about the context of the dsc.inc file.

You assume that the MdeLibs.dsc.inc file will be included from
the common [LibraryClasses] section.

This means that this dsc.inc file can not be extended to support
CPU arch specific lib mappings.

I recommend this dsc.inc file contain the [LibraryClasses] 
line and that the MdeLibs.dsc.inc file be included just before
the [LibraryClasses] line in the consuming DSC files.

For example, there are some required library class mappings
for ARM and AARCH64 that are the same in every DSC file.
I want to have the option to add CPU or module specific 
lib mappings to MdeLibs.dsc.inc.

[LibraryClasses.ARM, LibraryClasses.AARCH64]
  #
  # It is not possible to prevent ARM compiler calls to generic intrinsic functions.
  # This library provides the instrinsic functions generated by a given compiler.
  # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
  #
  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

  #
  # Since software stack checking may be heuristically enabled by the compiler
  # include BaseStackCheckLib unconditionally.
  #
  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf


Mike

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, March 22, 2021 1:09 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> 
> MdeLibs.dsc.inc is added for some default libraries provided by MdePkg.
> Platform can include MdeLibs.dsc.inc file to avoid some potential
> incompatible changes to platform dsc file in future.
> 
> Only add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
> Can update and maintain MdeLibs.dsc.inc gradually later.
> 
> "MdeLibs.dsc.inc" for the [LibraryClasses*] section(s)
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  MdePkg/MdeLibs.dsc.inc | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>  create mode 100644 MdePkg/MdeLibs.dsc.inc
> 
> diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
> new file mode 100644
> index 0000000000..75e516c21a
> --- /dev/null
> +++ b/MdePkg/MdeLibs.dsc.inc
> @@ -0,0 +1,14 @@
> +## @file
> +# Mde DSC include file for [LibraryClasses*] section of all Architectures.
> +#
> +# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
> +# by using "!include MdePkg/MdeLibs.dsc.inc" to specify the library instances
> +# of some EDKII basic/common library classes.
> +#
> +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +#
> +#    SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +  RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-26  0:48   ` Michael D Kinney
@ 2021-03-26  1:51     ` Dandan Bi
  2021-03-26  7:39     ` Dandan Bi
  1 sibling, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-26  1:51 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Liming Gao, Liu, Zhiguang, Laszlo Ersek

Thanks Mike.
I will submit a new version to address that.


Thanks,
Dandan
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Friday, March 26, 2021 8:49 AM
> To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: RE: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
> 
> Dandan,
> 
> I have a concern about the context of the dsc.inc file.
> 
> You assume that the MdeLibs.dsc.inc file will be included from the common
> [LibraryClasses] section.
> 
> This means that this dsc.inc file can not be extended to support CPU arch
> specific lib mappings.
> 
> I recommend this dsc.inc file contain the [LibraryClasses] line and that the
> MdeLibs.dsc.inc file be included just before the [LibraryClasses] line in the
> consuming DSC files.
> 
> For example, there are some required library class mappings for ARM and
> AARCH64 that are the same in every DSC file.
> I want to have the option to add CPU or module specific lib mappings to
> MdeLibs.dsc.inc.
> 
> [LibraryClasses.ARM, LibraryClasses.AARCH64]
>   #
>   # It is not possible to prevent ARM compiler calls to generic intrinsic
> functions.
>   # This library provides the instrinsic functions generated by a given compiler.
>   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
>   #
>   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
> 
>   #
>   # Since software stack checking may be heuristically enabled by the
> compiler
>   # include BaseStackCheckLib unconditionally.
>   #
>   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> 
> 
> Mike
> 
> > -----Original Message-----
> > From: Bi, Dandan <dandan.bi@intel.com>
> > Sent: Monday, March 22, 2021 1:09 AM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> > Laszlo Ersek <lersek@redhat.com>
> > Subject: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> >
> > MdeLibs.dsc.inc is added for some default libraries provided by MdePkg.
> > Platform can include MdeLibs.dsc.inc file to avoid some potential
> > incompatible changes to platform dsc file in future.
> >
> > Only add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
> > Can update and maintain MdeLibs.dsc.inc gradually later.
> >
> > "MdeLibs.dsc.inc" for the [LibraryClasses*] section(s)
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > ---
> >  MdePkg/MdeLibs.dsc.inc | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >  create mode 100644 MdePkg/MdeLibs.dsc.inc
> >
> > diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc new file
> > mode 100644 index 0000000000..75e516c21a
> > --- /dev/null
> > +++ b/MdePkg/MdeLibs.dsc.inc
> > @@ -0,0 +1,14 @@
> > +## @file
> > +# Mde DSC include file for [LibraryClasses*] section of all Architectures.
> > +#
> > +# This file can be included to the [LibraryClasses*] section(s) of a
> > +platform DSC file # by using "!include MdePkg/MdeLibs.dsc.inc" to
> > +specify the library instances # of some EDKII basic/common library classes.
> > +#
> > +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> #
> > +#    SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +##
> > +
> > +
> > + RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilte
> > + rLibNull.inf
> > --
> > 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib
  2021-03-25 18:35       ` Bret Barkelew
@ 2021-03-26  7:36         ` Dandan Bi
  0 siblings, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-26  7:36 UTC (permalink / raw)
  To: Bret Barkelew, devel@edk2.groups.io; +Cc: Kinney, Michael D, Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 5983 bytes --]

Hi Bret,


  1.  We don't want to introduce duplicated codes and too many instances will also make people confused to consume.
  2.  If we add a new instance of IoLib, consumer will also only use one, I think should not have the symbol collision issue.


Thanks,
Dandan
From: Bret Barkelew <Bret.Barkelew@microsoft.com>
Sent: Friday, March 26, 2021 2:35 AM
To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Thanks, Dandan!

Apologies if this has already been asked, but is this necessary because C doesn't have any options for symbol namespacing?
In other words, would it be just as easy to do this with a new implementation of IoLib if we didn't have to worry about the symbol collisions?

- Bret

From: Bi, Dandan<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 6:52 PM
To: Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Hi Bret,

Here is the branch and PR I just created for this change, please help review. Thanks.
https://github.com/dandanbi/edk2/tree/RegisterFilterLibV2<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdandanbi%2Fedk2%2Ftree%2FRegisterFilterLibV2&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578049825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pQod4S5%2FehDSDOmGgRjK8j%2FQN%2FbQDpeLzSdEu%2BpqTwM%3D&reserved=0>
https://github.com/tianocore/edk2/pull/1509<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fpull%2F1509&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578059781%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=H2K3NDJvmXCY5BpE8pbgWvKYWfXN8Djgef8VKhWEaM0%3D&reserved=0>



Thanks,
Dandan

From: Bret Barkelew <Bret.Barkelew@microsoft.com<mailto:Bret.Barkelew@microsoft.com>>
Sent: Tuesday, March 23, 2021 2:25 AM
To: Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>
Subject: RE: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

Is there a PR somewhere that has a branch with all these changes applied? I'd like to poke around a little.

Thanks!

- Bret

From: Dandan Bi<mailto:dandan.bi@intel.com>
Sent: Monday, March 22, 2021 1:10 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>; Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] [patch V2 27/29] UnitTestFrameworkPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&amp;data=04%7C01%7CBret.Barkelew%40microsoft.com%7C77dd99e3296941afb9b408d8ed09fd3c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637519974445661033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oDafPDNi1k2MRYGrp%2Frhy1dB43tk%2B0YwF8%2FxdLqBXt8%3D&amp;reserved=0<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3246&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C94c3c217435d4f4e19e408d8ed9e5501%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637520611578059781%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ms0PFIBmyzAuNFKWcMW9cPV28mOpcrJYL8%2F8y%2FCn6G0%3D&reserved=0>

MdeLibs.dsc.inc was added for some basic/default library
instances provided by MdePkg and RegisterFilterLibNull Library
was also added into it as the first version of MdeLibs.dsc.inc.

So update platform dsc to consume MdeLibs.dsc.inc for
RegisterFilterLibNull which will be consumed by IoLib and BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Cc: Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com<mailto:Bret.Barkelew@microsoft.com>>
Signed-off-by: Dandan Bi <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098..4adb98aff5 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -1,14 +1,16 @@
 ## @file
 # UnitTestFrameworkPkg DSC include file for target based test DSC
 #
-# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##

 [LibraryClasses]
+  !include MdePkg/MdeLibs.dsc.inc
+
   #
   # Entry point
   #
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
--
2.18.0.windows.1



[-- Attachment #2: Type: text/html, Size: 12596 bytes --]

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
  2021-03-26  0:48   ` Michael D Kinney
  2021-03-26  1:51     ` Dandan Bi
@ 2021-03-26  7:39     ` Dandan Bi
  1 sibling, 0 replies; 55+ messages in thread
From: Dandan Bi @ 2021-03-26  7:39 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Liming Gao, Liu, Zhiguang, Laszlo Ersek

Hi Mike and Liming,

V3 version was sent out, please help review it.


Thanks,
Dandan
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Friday, March 26, 2021 8:49 AM
> To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: RE: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
> 
> Dandan,
> 
> I have a concern about the context of the dsc.inc file.
> 
> You assume that the MdeLibs.dsc.inc file will be included from the common
> [LibraryClasses] section.
> 
> This means that this dsc.inc file can not be extended to support CPU arch
> specific lib mappings.
> 
> I recommend this dsc.inc file contain the [LibraryClasses] line and that the
> MdeLibs.dsc.inc file be included just before the [LibraryClasses] line in the
> consuming DSC files.
> 
> For example, there are some required library class mappings for ARM and
> AARCH64 that are the same in every DSC file.
> I want to have the option to add CPU or module specific lib mappings to
> MdeLibs.dsc.inc.
> 
> [LibraryClasses.ARM, LibraryClasses.AARCH64]
>   #
>   # It is not possible to prevent ARM compiler calls to generic intrinsic
> functions.
>   # This library provides the instrinsic functions generated by a given compiler.
>   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
>   #
>   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
> 
>   #
>   # Since software stack checking may be heuristically enabled by the
> compiler
>   # include BaseStackCheckLib unconditionally.
>   #
>   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> 
> 
> Mike
> 
> > -----Original Message-----
> > From: Bi, Dandan <dandan.bi@intel.com>
> > Sent: Monday, March 22, 2021 1:09 AM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> > Laszlo Ersek <lersek@redhat.com>
> > Subject: [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> >
> > MdeLibs.dsc.inc is added for some default libraries provided by MdePkg.
> > Platform can include MdeLibs.dsc.inc file to avoid some potential
> > incompatible changes to platform dsc file in future.
> >
> > Only add RegisterFilterLib into it as the first version of MdeLibs.dsc.inc.
> > Can update and maintain MdeLibs.dsc.inc gradually later.
> >
> > "MdeLibs.dsc.inc" for the [LibraryClasses*] section(s)
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > ---
> >  MdePkg/MdeLibs.dsc.inc | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >  create mode 100644 MdePkg/MdeLibs.dsc.inc
> >
> > diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc new file
> > mode 100644 index 0000000000..75e516c21a
> > --- /dev/null
> > +++ b/MdePkg/MdeLibs.dsc.inc
> > @@ -0,0 +1,14 @@
> > +## @file
> > +# Mde DSC include file for [LibraryClasses*] section of all Architectures.
> > +#
> > +# This file can be included to the [LibraryClasses*] section(s) of a
> > +platform DSC file # by using "!include MdePkg/MdeLibs.dsc.inc" to
> > +specify the library instances # of some EDKII basic/common library classes.
> > +#
> > +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> #
> > +#    SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +##
> > +
> > +
> > + RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilte
> > + rLibNull.inf
> > --
> > 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2021-03-26  7:39 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-22  8:09 [patch V2 00/29] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Dandan Bi
2021-03-22  8:09 ` [patch V2 01/29] MdePkg: Add RegisterFilterLib class and NULL instance Dandan Bi
2021-03-23  2:24   ` [edk2-devel] " Abner Chang
2021-03-22  8:09 ` [patch V2 02/29] MdePkg: Add MdeLibs.dsc.inc file to MdePkg Dandan Bi
2021-03-22 17:46   ` Laszlo Ersek
2021-03-23  3:40     ` [edk2-devel] " Ni, Ray
2021-03-26  0:48   ` Michael D Kinney
2021-03-26  1:51     ` Dandan Bi
2021-03-26  7:39     ` Dandan Bi
2021-03-22  8:09 ` [patch V2 03/29] ArmPkg: Consume MdeLibs.dsc.inc for RegisterFilterLib Dandan Bi
2021-03-22  8:09 ` [patch V2 04/29] ArmPlatformPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 05/29] ArmVirtPkg: " Dandan Bi
2021-03-22 18:30   ` Laszlo Ersek
2021-03-22  8:09 ` [patch V2 06/29] CryptoPkg: " Dandan Bi
2021-03-22  8:20   ` Yao, Jiewen
2021-03-22  8:09 ` [patch V2 07/29] DynamicTablesPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 08/29] EmbeddedPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 09/29] EmulatorPkg: " Dandan Bi
2021-03-25 23:29   ` Ni, Ray
2021-03-22  8:09 ` [patch V2 10/29] FatPkg: " Dandan Bi
2021-03-25 23:30   ` Ni, Ray
2021-03-22  8:09 ` [patch V2 11/29] FmpDevicePkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 12/29] IntelFsp2Pkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 13/29] IntelFsp2WrapperPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 14/29] MdeModulePkg: " Dandan Bi
2021-03-23  1:01   ` Wu, Hao A
2021-03-22  8:09 ` [patch V2 15/29] MdePkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 16/29] NetworkPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 17/29] OvmfPkg: " Dandan Bi
2021-03-22 18:31   ` Laszlo Ersek
2021-03-22  8:09 ` [patch V2 18/29] PcAtChipsetPkg: " Dandan Bi
2021-03-25 23:30   ` Ni, Ray
2021-03-22  8:09 ` [patch V2 19/29] RedfishPkg: " Dandan Bi
2021-03-23  2:17   ` Abner Chang
2021-03-23  2:32   ` Nickle Wang
2021-03-22  8:09 ` [patch V2 20/29] SecurityPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 21/29] ShellPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 22/29] SignedCapsulePkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 23/29] SourceLevelDebugPkg: " Dandan Bi
2021-03-23  1:02   ` Wu, Hao A
2021-03-22  8:09 ` [patch V2 24/29] StandaloneMmPkg: " Dandan Bi
2021-03-22  8:09 ` [patch V2 25/29] UefiCpuPkg: " Dandan Bi
2021-03-22 18:32   ` Laszlo Ersek
2021-03-25 23:32     ` [edk2-devel] " Ni, Ray
2021-03-26  0:32   ` Dong, Eric
2021-03-22  8:09 ` [patch V2 26/29] UefiPayloadPkg: " Dandan Bi
2021-03-22 14:03   ` Ma, Maurice
2021-03-23  5:20   ` Guo Dong
2021-03-22  8:09 ` [patch V2 27/29] UnitTestFrameworkPkg: " Dandan Bi
2021-03-22 18:25   ` [EXTERNAL] " Bret Barkelew
2021-03-23  1:52     ` Dandan Bi
2021-03-25 18:35       ` Bret Barkelew
2021-03-26  7:36         ` Dandan Bi
2021-03-22  8:09 ` [patch V2 28/29] MdePkg/IoLib: Filter/trace port IO/MMIO access Dandan Bi
2021-03-22  8:09 ` [patch V2 29/29] MdePkg/Baseib: Filter/trace MSR access for IA32/X64 Dandan Bi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox