Re: [edk2-devel] [PATCH 1/1] OvmfPkg: Add README for TDVF

2022-04-25 Thread Gerd Hoffmann
> +Usage
> +-
> +
> +Assuming TDX-QEMU/TDX-KVM are already built, one can start a TD virtual
> +machine as follows:

Not working (yet) with upstream qemu.  This needs a clarification which
qemu repository you are talking about (and once tdx patches landed
upstream this should be replaced with the minimum qemu version
required).

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89254): https://edk2.groups.io/g/devel/message/89254
Mute This Topic: https://groups.io/mt/90675980/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement.

2022-04-25 Thread Li, Zhihao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3912

UefiCpuPkg define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.

VariableSmm and VariableStandaloneMM driver in MdeModulePkg need
to use this services but MdeModulePkg can't depend on UefiCpuPkg.

Thus, the solution is moving SmmCpuRendezvouslib.h from UefiCpuPkg
to MdePkg and creating SmmCpuRendezvousLib NullLib version
implementation in MdePkg as dependency for the pkg that can't
depend on UefiCpuPkg.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Michael Kubacki 
Cc: Siyuan Fu 

Signed-off-by: Zhihao Li 
---
 MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c   | 29 

 {UefiCpuPkg => MdePkg}/Include/Library/SmmCpuRendezvousLib.h   |  0
 MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf | 26 
++
 MdePkg/MdeLibs.dsc.inc |  3 +-
 MdePkg/MdePkg.dec  |  5 +++-
 MdePkg/MdePkg.dsc  |  3 +-
 UefiCpuPkg/UefiCpuPkg.dec  |  3 --
 7 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c 
b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
new file mode 100644
index ..474195bbb374
--- /dev/null
+++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
@@ -0,0 +1,29 @@
+/** @file

+  SMM CPU Rendezvous sevice implement.

+

+  Copyright (c) 2022, Intel Corporation. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include 

+#include 

+

+/**

+  This routine wait for all AP processors to arrive in SMM.

+

+  @param[in] BlockingMode  Blocking mode or non-blocking mode.

+

+  @retval EFI_SUCCESS  All avaiable APs arrived.

+  @retval EFI_TIMEOUT  Wait for all APs until timeout.

+  @retval OTHERFail to register SMM CPU Rendezvous service Protocol.

+**/

+EFI_STATUS

+EFIAPI

+SmmWaitForAllProcessor (

+  IN BOOLEAN  BlockingMode

+  )

+{

+  ASSERT (FALSE);

+  return EFI_SUCCESS;

+}

diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h 
b/MdePkg/Include/Library/SmmCpuRendezvousLib.h
similarity index 100%
rename from UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h
rename to MdePkg/Include/Library/SmmCpuRendezvousLib.h
diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf 
b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
new file mode 100644
index ..7c9bac9af2ff
--- /dev/null
+++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
@@ -0,0 +1,26 @@
+## @file

+# SMM CPU Rendezvous service lib.

+#

+# This is SMM CPU rendezvous service lib that wait for all

+# APs to enter SMM mode.

+#

+# Copyright (c) 2022, Intel Corporation. All rights reserved.

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+

+[Defines]

+  INF_VERSION= 0x00010005

+  BASE_NAME  = SmmCpuRendezvousLibNull

+  FILE_GUID  = 1e5790ea-d013-4d7b-9047-b4342a762027

+  MODULE_TYPE= DXE_SMM_DRIVER

+  LIBRARY_CLASS  = SmmCpuRendezvousLib|MM_STANDALONE 
DXE_SMM_DRIVER

+

+[Sources]

+  SmmCpuRendezvousLibNull.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+

+[LibraryClasses]

+  DebugLib

diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
index 3c70daf87a0c..9d7b234b8565 100644
--- a/MdePkg/MdeLibs.dsc.inc
+++ b/MdePkg/MdeLibs.dsc.inc
@@ -5,7 +5,7 @@
 # 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.

+# Copyright (c) 2021 - 2022, Intel Corporation. All rights reserved.

 #

 #SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -13,3 +13,4 @@
 

 [LibraryClasses]

   
RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf

+  
SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index faeb28c80cbd..f1ebf9e251c1 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -4,7 +4,7 @@
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of

 # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.

 #

-# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.

+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.

 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.

 # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP

 #

@@ -272,6 +272,9 @@
   #

   CcProbeLib|Include/Library/CcProbeLib.h

 

+  ## @libraryclass  Provides

[edk2-devel] [PATCH v6 1/6] MdeModulePkg/PciHostBridge: io range is not mandatory

2022-04-25 Thread Gerd Hoffmann
io range is not mandatory according to pcie spec,
so allow bridge configurations without io address
space assigned.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Ard Biesheuvel 
---
 MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
index b20bcd310ad5..712662707931 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
@@ -1085,6 +1085,9 @@ NotifyPhase (
   RootBridge->ResAllocNode[Index].Base   = BaseAddress;
   RootBridge->ResAllocNode[Index].Status = ResAllocated;
   DEBUG ((DEBUG_INFO, "Success\n"));
+} else if ((Index == TypeIo) && (RootBridge->Io.Base == 
MAX_UINT64)) {
+  /* optional on PCIe */
+  DEBUG ((DEBUG_INFO, "PCI Root Bridge does not provide IO 
Resources.\n"));
 } else {
   ReturnStatus = EFI_OUT_OF_RESOURCES;
   DEBUG ((DEBUG_ERROR, "Out Of Resource!\n"));
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89256): https://edk2.groups.io/g/devel/message/89256
Mute This Topic: https://groups.io/mt/90681713/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 3/6] OvmfPkg/Platform: unfix PcdPciExpressBaseAddress

2022-04-25 Thread Gerd Hoffmann
Will be set by FdtPciHostBridgeLib, so it can't be an fixed when we
want use that library.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 4 +++-
 OvmfPkg/PlatformPei/PlatformPei.inf | 2 +-
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 4 ++--
 OvmfPkg/Library/PlatformInitLib/Platform.c  | 4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf 
b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
index d0fab5cc1f4f..d2a0bec43452 100644
--- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
+++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
@@ -54,8 +54,10 @@ [LibraryClasses]
 [LibraryClasses.X64]
   TdxLib
 
-[FixedPcd]
+[Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
+
+[FixedPcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 00372fa0ebb5..3cd83e6ec3e5 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -95,6 +95,7 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
@@ -118,7 +119,6 @@ [Pcd]
 [FixedPcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidBase
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidSize
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c 
b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 4c1dedf863c3..83a7b6726bb7 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -61,8 +61,8 @@ PlatformQemuUc32BaseInitialization (
 // [PcdPciExpressBaseAddress, 4GB) range require a very small number of
 // variable MTRRs (preferably 1 or 2).
 //
-ASSERT (FixedPcdGet64 (PcdPciExpressBaseAddress) <= MAX_UINT32);
-PlatformInfoHob->Uc32Base = (UINT32)FixedPcdGet64 
(PcdPciExpressBaseAddress);
+ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <= MAX_UINT32);
+PlatformInfoHob->Uc32Base = (UINT32)PcdGet64 (PcdPciExpressBaseAddress);
 return;
   }
 
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c 
b/OvmfPkg/Library/PlatformInitLib/Platform.c
index 101074f6100d..60a30a01f3b5 100644
--- a/OvmfPkg/Library/PlatformInitLib/Platform.c
+++ b/OvmfPkg/Library/PlatformInitLib/Platform.c
@@ -154,7 +154,7 @@ PlatformMemMapInitialization (
 // The MMCONFIG area is expected to fall between the top of low RAM and
 // the base of the 32-bit PCI host aperture.
 //
-PciExBarBase = FixedPcdGet64 (PcdPciExpressBaseAddress);
+PciExBarBase = PcdGet64 (PcdPciExpressBaseAddress);
 ASSERT (TopOfLowRam <= PciExBarBase);
 ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB);
 PciBase = (UINT32)(PciExBarBase + SIZE_256MB);
@@ -278,7 +278,7 @@ PciExBarInitialization (
   // determined in AddressWidthInitialization(), i.e., 36 bits, will suffice
   // for DXE's page tables to cover the MMCONFIG area.
   //
-  PciExBarBase.Uint64 = FixedPcdGet64 (PcdPciExpressBaseAddress);
+  PciExBarBase.Uint64 = PcdGet64 (PcdPciExpressBaseAddress);
   ASSERT ((PciExBarBase.Uint32[1] & MCH_PCIEXBAR_HIGHMASK) == 0);
   ASSERT ((PciExBarBase.Uint32[0] & MCH_PCIEXBAR_LOWMASK) == 0);
 
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89258): https://edk2.groups.io/g/devel/message/89258
Mute This Topic: https://groups.io/mt/90681715/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 0/6] OvmfPkg/Microvm/pcie: add pcie support

2022-04-25 Thread Gerd Hoffmann
Needs two little tweaks in PCI code because microvm supports mmio only.
Other than that just wire up the existing code (the PCIe host adapter
used by microvm is the same (virtual) hardware used by the arm/aarch64
virtual machines).

v6:
 - codestyle fix (Abner Chang).

v5:
 - codestyle (uncrustify) fix.

v4:
 - update PciHostBridge check (Abner Chang).

v3:
 - rebase to latest master, adapt to PlatformInitLib.
 - rework PhysMemAddressWidth handling for microvm.

v2:
 - rebase to latest master
 - pick up review tags

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3777

Gerd Hoffmann (6):
  MdeModulePkg/PciHostBridge: io range is not mandatory
  OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory
  OvmfPkg/Platform: unfix PcdPciExpressBaseAddress
  OvmfPkg/Microvm/pcie: no vbeshim please
  OvmfPkg/Microvm/pcie: mPhysMemAddressWidth tweak
  OvmfPkg/Microvm/pcie: add pcie support

 OvmfPkg/Microvm/MicrovmX64.dsc| 40 ++---
 .../PlatformInitLib/PlatformInitLib.inf   |  4 +-
 OvmfPkg/PlatformPei/PlatformPei.inf   |  2 +-
 .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c  |  3 ++
 .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++-
 OvmfPkg/Library/PlatformInitLib/MemDetect.c   | 45 ++-
 OvmfPkg/Library/PlatformInitLib/Platform.c|  4 +-
 OvmfPkg/PlatformPei/Platform.c|  2 +-
 OvmfPkg/QemuVideoDxe/VbeShim.c|  2 +
 OvmfPkg/Microvm/README|  2 +-
 10 files changed, 104 insertions(+), 45 deletions(-)

-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89257): https://edk2.groups.io/g/devel/message/89257
Mute This Topic: https://groups.io/mt/90681714/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 5/6] OvmfPkg/Microvm/pcie: mPhysMemAddressWidth tweak

2022-04-25 Thread Gerd Hoffmann
microvm places the 64bit mmio space at the end of the physical address
space.  So mPhysMemAddressWidth must be correct, otherwise the pci host
bridge setup throws an error because it thinks the 64bit mmio window is
not addressable.

On microvm we can simply use standard cpuid to figure the address width
because the host-phys-bits option (-cpu ${name},host-phys-bits=on) is
forced to be enabled.  Side note: For 'pc' and 'q35' this is not the
case for backward compatibility reasons.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 41 +
 OvmfPkg/PlatformPei/Platform.c  |  2 +-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c 
b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 83a7b6726bb7..c28d7601f87e 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -491,6 +491,42 @@ PlatformGetFirstNonAddress (
   return FirstNonAddress;
 }
 
+/*
+ * Use CPUID to figure physical address width.  Does *not* work
+ * reliable on qemu.  For historical reasons qemu returns phys-bits=40
+ * even in case the host machine supports less than that.
+ *
+ * qemu has a cpu property (host-phys-bits={on,off}) to change that
+ * and make sure guest phys-bits are not larger than host phys-bits.,
+ * but it is off by default.  Exception: microvm machine type
+ * hard-wires that property to on.
+ */
+VOID
+EFIAPI
+PlatformAddressWidthFromCpuid (
+  IN OUT EFI_HOB_PLATFORM_INFO  *PlatformInfoHob
+  )
+{
+  UINT32  RegEax;
+
+  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
+  if (RegEax >= 0x8008) {
+AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
+PlatformInfoHob->PhysMemAddressWidth = (UINT8)RegEax;
+  } else {
+PlatformInfoHob->PhysMemAddressWidth = 36;
+  }
+
+  PlatformInfoHob->FirstNonAddress = LShiftU64 (1, 
PlatformInfoHob->PhysMemAddressWidth);
+
+  DEBUG ((
+DEBUG_INFO,
+"%a: cpuid: phys-bits is %d\n",
+__FUNCTION__,
+PlatformInfoHob->PhysMemAddressWidth
+));
+}
+
 /**
   Initialize the PhysMemAddressWidth field in PlatformInfoHob based on guest 
RAM size.
 **/
@@ -503,6 +539,11 @@ PlatformAddressWidthInitialization (
   UINT64  FirstNonAddress;
   UINT8   PhysMemAddressWidth;
 
+  if (PlatformInfoHob->HostBridgeDevId == 0x /* microvm */) {
+PlatformAddressWidthFromCpuid (PlatformInfoHob);
+return;
+  }
+
   //
   // As guest-physical memory size grows, the permanent PEI RAM requirements
   // are dominated by the identity-mapping page tables built by the DXE IPL.
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index f006755d5fdb..009db67ee60a 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -357,12 +357,12 @@ InitializePlatform (
 
   S3Verification ();
   BootModeInitialization (&mPlatformInfoHob);
-  AddressWidthInitialization (&mPlatformInfoHob);
 
   //
   // Query Host Bridge DID
   //
   mPlatformInfoHob.HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+  AddressWidthInitialization (&mPlatformInfoHob);
 
   MaxCpuCountInitialization (&mPlatformInfoHob);
 
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89260): https://edk2.groups.io/g/devel/message/89260
Mute This Topic: https://groups.io/mt/90681717/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 4/6] OvmfPkg/Microvm/pcie: no vbeshim please

2022-04-25 Thread Gerd Hoffmann
Those old windows versions which need the vbeshim hack
will not run on microvm anyway.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/QemuVideoDxe/VbeShim.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c
index 8faa146b6cce..2a048211a823 100644
--- a/OvmfPkg/QemuVideoDxe/VbeShim.c
+++ b/OvmfPkg/QemuVideoDxe/VbeShim.c
@@ -156,6 +156,8 @@ InstallVbeShim (
 case INTEL_Q35_MCH_DEVICE_ID:
   Pam1Address = DRAMC_REGISTER_Q35 (MCH_PAM1);
   break;
+case MICROVM_PSEUDO_DEVICE_ID:
+  return;
 default:
   DEBUG ((
 DEBUG_ERROR,
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89259): https://edk2.groups.io/g/devel/message/89259
Mute This Topic: https://groups.io/mt/90681716/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 6/6] OvmfPkg/Microvm/pcie: add pcie support

2022-04-25 Thread Gerd Hoffmann
Link in pcie and host bridge bits.  Enables support for PCIe in microvm
(qemu-system-x86_64 -M microvm,pcie=on).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3777
Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Microvm/MicrovmX64.dsc | 40 +-
 OvmfPkg/Microvm/README |  2 +-
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index c9c843e116a9..82e3f2195aff 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -336,7 +336,9 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
 !endif
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+#  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+#  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+#  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
 
@@ -353,7 +355,9 @@ [LibraryClasses.common.UEFI_DRIVER]
   DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
 !endif
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -375,7 +379,9 @@ [LibraryClasses.common.DXE_DRIVER]
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
   QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf
@@ -391,7 +397,9 @@ [LibraryClasses.common.UEFI_APPLICATION]
 !else
   DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
 !endif
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
 
 [LibraryClasses.common.DXE_SMM_DRIVER]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -412,7 +420,9 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf
 !endif
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
 
 [LibraryClasses.common.SMM_CORE]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -428,7 +438,9 @@ [LibraryClasses.common.SMM_CORE]
 !else
   DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
 !endif
-  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
 
 

 #
@@ -503,14 +515,6 @@ [PcdsFixedAtBuild]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
 !endif
 
-  # This PCD is used to set the base address of the PCI express hierarchy. It
-  # is only consulted when OVMF runs on Q35. In that case it is programmed into
-  # the PCIEXBAR register.
-  #
-  # On Q35 machine types that QEMU intends to support in the long term, QEMU
-  # never lets the RAM below 4 GB exceed 2816 MB.
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xB000
-
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
 !endif
@@ -576,6 +580,12 @@ [PcdsDynamicDefault]
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|10
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
 
+  # set PcdPciExpres

[edk2-devel] [PATCH v6 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory

2022-04-25 Thread Gerd Hoffmann
io range is not mandatory according to pcie spec,
so allow host bridges without io address space.

Signed-off-by: Gerd Hoffmann 
---
 .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++-
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index 98828e0b262b..14b41a533e96 100644
--- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -292,13 +292,8 @@ ProcessPciHost (
 }
   }
 
-  if ((*IoSize == 0) || (*Mmio32Size == 0)) {
-DEBUG ((
-  DEBUG_ERROR,
-  "%a: %a space empty\n",
-  __FUNCTION__,
-  (*IoSize == 0) ? "IO" : "MMIO32"
-  ));
+  if (*Mmio32Size == 0) {
+DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", __FUNCTION__));
 return EFI_PROTOCOL_ERROR;
   }
 
@@ -333,13 +328,15 @@ ProcessPciHost (
 return Status;
   }
 
-  //
-  // Map the MMIO window that provides I/O access - the PCI host bridge code
-  // is not aware of this translation and so it will only map the I/O view
-  // in the GCD I/O map.
-  //
-  Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);
-  ASSERT_EFI_ERROR (Status);
+  if (*IoSize != 0) {
+//
+// Map the MMIO window that provides I/O access - the PCI host bridge code
+// is not aware of this translation and so it will only map the I/O view
+// in the GCD I/O map.
+//
+Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);
+ASSERT_EFI_ERROR (Status);
+  }
 
   return Status;
 }
@@ -413,17 +410,21 @@ PciHostBridgeGetRootBridges (
 
   AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
 
-  Io.Base   = IoBase;
-  Io.Limit  = IoBase + IoSize - 1;
+  if (IoSize != 0) {
+Io.Base  = IoBase;
+Io.Limit = IoBase + IoSize - 1;
+  } else {
+Io.Base  = MAX_UINT64;
+Io.Limit = 0;
+  }
+
   Mem.Base  = Mmio32Base;
   Mem.Limit = Mmio32Base + Mmio32Size - 1;
 
-  if (sizeof (UINTN) == sizeof (UINT64)) {
-MemAbove4G.Base  = Mmio64Base;
-MemAbove4G.Limit = Mmio64Base + Mmio64Size - 1;
-if (Mmio64Size > 0) {
-  AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
-}
+  if ((sizeof (UINTN) == sizeof (UINT64)) && (Mmio64Size != 0)) {
+MemAbove4G.Base   = Mmio64Base;
+MemAbove4G.Limit  = Mmio64Base + Mmio64Size - 1;
+AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
   } else {
 //
 // UEFI mandates a 1:1 virtual-to-physical mapping, so on a 32-bit
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89262): https://edk2.groups.io/g/devel/message/89262
Mute This Topic: https://groups.io/mt/90681720/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 0/6] OvmfPkg/VirtioGpuDxe: use host display resolution

2022-04-25 Thread Gerd Hoffmann
On Fri, Apr 08, 2022 at 10:23:27AM +0200, Gerd Hoffmann wrote:
> QemuVideoDxe recently got support for picking up
> display resolution configuration from the host.
> This series does the same for VirtioGpuDxe.
> 
> v3:
>  - rebase to latest master.

Ping.  Anything blocking the merge id this series?

thanks,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89263): https://edk2.groups.io/g/devel/message/89263
Mute This Topic: https://groups.io/mt/90331439/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v6 0/6] OvmfPkg/Microvm/pcie: add pcie support

2022-04-25 Thread Ard Biesheuvel
On Mon, 25 Apr 2022 at 12:34, Gerd Hoffmann  wrote:
>
> Needs two little tweaks in PCI code because microvm supports mmio only.
> Other than that just wire up the existing code (the PCIe host adapter
> used by microvm is the same (virtual) hardware used by the arm/aarch64
> virtual machines).
>
> v6:
>  - codestyle fix (Abner Chang).
>
> v5:
>  - codestyle (uncrustify) fix.
>
> v4:
>  - update PciHostBridge check (Abner Chang).
>
> v3:
>  - rebase to latest master, adapt to PlatformInitLib.
>  - rework PhysMemAddressWidth handling for microvm.
>
> v2:
>  - rebase to latest master
>  - pick up review tags
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3777
>
> Gerd Hoffmann (6):
>   MdeModulePkg/PciHostBridge: io range is not mandatory
>   OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory
>   OvmfPkg/Platform: unfix PcdPciExpressBaseAddress
>   OvmfPkg/Microvm/pcie: no vbeshim please
>   OvmfPkg/Microvm/pcie: mPhysMemAddressWidth tweak
>   OvmfPkg/Microvm/pcie: add pcie support
>

Thanks Gerd. I'm happy to take these, but not without an ack from the
MdeModulePkg maintainers.



>  OvmfPkg/Microvm/MicrovmX64.dsc| 40 ++---
>  .../PlatformInitLib/PlatformInitLib.inf   |  4 +-
>  OvmfPkg/PlatformPei/PlatformPei.inf   |  2 +-
>  .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c  |  3 ++
>  .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++-
>  OvmfPkg/Library/PlatformInitLib/MemDetect.c   | 45 ++-
>  OvmfPkg/Library/PlatformInitLib/Platform.c|  4 +-
>  OvmfPkg/PlatformPei/Platform.c|  2 +-
>  OvmfPkg/QemuVideoDxe/VbeShim.c|  2 +
>  OvmfPkg/Microvm/README|  2 +-
>  10 files changed, 104 insertions(+), 45 deletions(-)
>
> --
> 2.35.1
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89264): https://edk2.groups.io/g/devel/message/89264
Mute This Topic: https://groups.io/mt/90681714/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 0/6] OvmfPkg/VirtioGpuDxe: use host display resolution

2022-04-25 Thread Ard Biesheuvel
On Mon, 25 Apr 2022 at 12:36, Gerd Hoffmann  wrote:
>
> On Fri, Apr 08, 2022 at 10:23:27AM +0200, Gerd Hoffmann wrote:
> > QemuVideoDxe recently got support for picking up
> > display resolution configuration from the host.
> > This series does the same for VirtioGpuDxe.
> >
> > v3:
> >  - rebase to latest master.
>
> Ping.  Anything blocking the merge id this series?
>

No, I'll pick these up today.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89265): https://edk2.groups.io/g/devel/message/89265
Mute This Topic: https://groups.io/mt/90331439/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v6 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory

2022-04-25 Thread Abner Chang
Thanks.

Reviewed-by: Abner Chang 

> -Original Message-
> From: Gerd Hoffmann 
> Sent: Monday, April 25, 2022 6:35 PM
> To: devel@edk2.groups.io
> Cc: Jiewen Yao ; Oliver Steffen
> ; Leif Lindholm ; Pawel
> Polawski ; Hao A Wu ;
> Chang, Abner (HPS SW/FW Technologist) ; Liming
> Gao ; Ray Ni ; Jordan Justen
> ; Jian J Wang ; Ard
> Biesheuvel ; Gerd Hoffmann
> 
> Subject: [PATCH v6 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not
> mandatory
> 
> io range is not mandatory according to pcie spec,
> so allow host bridges without io address space.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++-
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> index 98828e0b262b..14b41a533e96 100644
> --- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> +++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> @@ -292,13 +292,8 @@ ProcessPciHost (
>  }
>}
> 
> -  if ((*IoSize == 0) || (*Mmio32Size == 0)) {
> -DEBUG ((
> -  DEBUG_ERROR,
> -  "%a: %a space empty\n",
> -  __FUNCTION__,
> -  (*IoSize == 0) ? "IO" : "MMIO32"
> -  ));
> +  if (*Mmio32Size == 0) {
> +DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n",
> __FUNCTION__));
>  return EFI_PROTOCOL_ERROR;
>}
> 
> @@ -333,13 +328,15 @@ ProcessPciHost (
>  return Status;
>}
> 
> -  //
> -  // Map the MMIO window that provides I/O access - the PCI host bridge
> code
> -  // is not aware of this translation and so it will only map the I/O view
> -  // in the GCD I/O map.
> -  //
> -  Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);
> -  ASSERT_EFI_ERROR (Status);
> +  if (*IoSize != 0) {
> +//
> +// Map the MMIO window that provides I/O access - the PCI host bridge
> code
> +// is not aware of this translation and so it will only map the I/O view
> +// in the GCD I/O map.
> +//
> +Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);
> +ASSERT_EFI_ERROR (Status);
> +  }
> 
>return Status;
>  }
> @@ -413,17 +410,21 @@ PciHostBridgeGetRootBridges (
> 
>AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
> 
> -  Io.Base   = IoBase;
> -  Io.Limit  = IoBase + IoSize - 1;
> +  if (IoSize != 0) {
> +Io.Base  = IoBase;
> +Io.Limit = IoBase + IoSize - 1;
> +  } else {
> +Io.Base  = MAX_UINT64;
> +Io.Limit = 0;
> +  }
> +
>Mem.Base  = Mmio32Base;
>Mem.Limit = Mmio32Base + Mmio32Size - 1;
> 
> -  if (sizeof (UINTN) == sizeof (UINT64)) {
> -MemAbove4G.Base  = Mmio64Base;
> -MemAbove4G.Limit = Mmio64Base + Mmio64Size - 1;
> -if (Mmio64Size > 0) {
> -  AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
> -}
> +  if ((sizeof (UINTN) == sizeof (UINT64)) && (Mmio64Size != 0)) {
> +MemAbove4G.Base   = Mmio64Base;
> +MemAbove4G.Limit  = Mmio64Base + Mmio64Size - 1;
> +AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
>} else {
>  //
>  // UEFI mandates a 1:1 virtual-to-physical mapping, so on a 32-bit
> --
> 2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89266): https://edk2.groups.io/g/devel/message/89266
Mute This Topic: https://groups.io/mt/90681720/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

2022-04-25 Thread Corvin Köhne
Hi,

does it require more review to get merged?


Best regards
Corvin

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075


-Original Message-
From: Corvin Köhne 
Sent: Friday, April 8, 2022 10:15 AM
Cc: Corvin Köhne ; Corvin Köhne ; 
Ard Biesheuvel ; Jordan Justen 
; devel@edk2.groups.io; FreeBSD Virtualization 
; Jiewen Yao ; Gerd 
Hoffmann ; Rebecca Cran ; Peter Grehan 

Subject: [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

From: Corvin Köhne 

QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl
decided to use the same IO ports as QemuFwCfg. It's not possible to use
both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl.

Signed-off-by: Corvin Köhne 
Acked-by: Gerd Hoffmann 
Acked-by: Rebecca Cran 
Acked-by: Peter Grehan 
Acked-by: Jiewen Yao 
CC: Ard Biesheuvel 
CC: Jordan Justen 
CC: devel@edk2.groups.io
CC: FreeBSD Virtualization 
---
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
 OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 ---
 OvmfPkg/Bhyve/BhyveX64.dsc|  4 +--
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 595fd055f9..94c65f32dc 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -43,6 +43,7 @@
   MemoryAllocationLib
   OrderedCollectionLib
   PcdLib
+  QemuFwCfgLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   UefiLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index 8e80aa33e1..e216a21bfa 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -11,6 +11,41 @@
 #include 
 #include 
 #include 
+#include  // QemuFwCfgFindFile()
+
+STATIC
+EFI_STATUS
+EFIAPI
+BhyveGetCpuCount (
+  OUT UINT32  *CpuCount
+  )
+{
+  FIRMWARE_CONFIG_ITEM  Item;
+  UINTN Size;
+
+  if (QemuFwCfgIsAvailable ()) {
+if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
+  return EFI_NOT_FOUND;
+} else if (Size != sizeof (*CpuCount)) {
+  return EFI_BAD_BUFFER_SIZE;
+}
+
+QemuFwCfgSelectItem (Item);
+QemuFwCfgReadBytes (Size, CpuCount);
+
+return EFI_SUCCESS;
+  }
+
+  //
+  // QemuFwCfg not available, try BhyveFwCtl.
+  //
+  Size = sizeof (*CpuCount);
+  if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
+return EFI_SUCCESS;
+  }
+
+  return EFI_UNSUPPORTED;
+}

 STATIC
 EFI_STATUS
@@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
   )
 {
   UINT32   CpuCount;
-  UINTNcSize;
   UINTNNewBufferSize;
   EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
   EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE  *LocalApic;
@@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
   ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));

   // Query the host for the number of vCPUs
-  CpuCount = 0;
-  cSize= sizeof (CpuCount);
-  if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
+  Status = BhyveGetCpuCount (&CpuCount);
+  if (!EFI_ERROR (Status)) {
 DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
 ASSERT (CpuCount >= 1);
   } else {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 5fa08bebd7..14070fd6dd 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,8 +163,7 @@
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
-  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
-  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
   BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -355,6 +354,7 @@
 !endif
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf

 [LibraryClasses.common.UEFI_APPLICATION]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
--
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply 

Re: [edk2-devel] [PATCH] BaseTools: Fix dependency issue in PcdValueInit

2022-04-25 Thread Jake Garver via groups.io
Hello maintainers,

Any interest in accepting this and the "BaseTools/Conf: Fix 
Dynamic-Library-File template" patch?

Thanks,
Jake


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89268): https://edk2.groups.io/g/devel/message/89268
Mute This Topic: https://groups.io/mt/90317701/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2] MdeModulePkg/XhciDxe: Add access xHCI Extended Capabilities Pointer

2022-04-25 Thread ian . chiu
From: Ian Chiu 

Add support process Port Speed field value of PORTSC according to Supported 
Protocol Capability
(new design in xHCI spec 1.2 2019)

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

The value of Port Speed field in PORTSC bit[10:13] (xHCI spec 1.2 2019 section 
5.4.8)
should be change to use this value to query thru Protocol Speed ID (PSI)
(xHCI spec 1.2 2019 section 7.2.1) in xHCI Supported Protocol Capability and
return the value according the Protocol Speed ID (PSIV) Dword.

Cc: Jenny Huang 
Cc: More Shih 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Ian Chiu 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c|  41 --
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h|   2 +
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 147 
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  87 
 4 files changed, 262 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index b79499e225..f5b99210c9 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -398,25 +398,32 @@ XhcGetRootHubPortStatus (
   State = XhcReadOpReg (Xhc, Offset);
 
   //
-  // According to XHCI 1.1 spec November 2017,
-  // bit 10~13 of the root port status register identifies the speed of the 
attached device.
+  // According to XHCI 1.2 spec November 2019,
+  // Section 7.2 xHCI Support Protocol Capability
   //
-  switch ((State & XHC_PORTSC_PS) >> 10) {
-case 2:
-  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
-  break;
+  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & 
XHC_PORTSC_PS) >> 10));
+  if (PortStatus->PortStatus == 0) {
+//
+// According to XHCI 1.1 spec November 2017,
+// bit 10~13 of the root port status register identifies the speed of the 
attached device.
+//
+switch ((State & XHC_PORTSC_PS) >> 10) {
+  case 2:
+PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
+break;
 
-case 3:
-  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
-  break;
+  case 3:
+PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
+break;
 
-case 4:
-case 5:
-  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
-  break;
+  case 4:
+  case 5:
+PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
+break;
 
-default:
-  break;
+  default:
+break;
+}
   }
 
   //
@@ -1820,6 +1827,8 @@ XhcCreateUsbHc (
   Xhc->ExtCapRegBase = ExtCapReg << 2;
   Xhc->UsbLegSupOffset   = XhcGetCapabilityAddr (Xhc, XHC_CAP_USB_LEGACY);
   Xhc->DebugCapSupOffset = XhcGetCapabilityAddr (Xhc, XHC_CAP_USB_DEBUG);
+  Xhc->Usb2SupOffset = XhcGetUsbSupportedCapabilityAddr (Xhc, 
USB_SUPPORT_PROTOCOL_USB2_MAJOR_VER);
+  Xhc->UsbSsSupOffset = XhcGetUsbSupportedCapabilityAddr (Xhc, 
USB_SUPPORT_PROTOCOL_USB3_MAJOR_VER);
 
   DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: Capability length 0x%x\n", 
Xhc->CapLength));
   DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: HcSParams1 0x%x\n", Xhc->HcSParams1));
@@ -1829,6 +1838,8 @@ XhcCreateUsbHc (
   DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: RTSOff 0x%x\n", Xhc->RTSOff));
   DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: UsbLegSupOffset 0x%x\n", 
Xhc->UsbLegSupOffset));
   DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: DebugCapSupOffset 0x%x\n", 
Xhc->DebugCapSupOffset));
+  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: Usb2SupOffset 0x%x\n", 
Xhc->Usb2SupOffset));
+  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: UsbSsSupOffset 0x%x\n", 
Xhc->UsbSsSupOffset));
 
   //
   // Create AsyncRequest Polling Timer
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
index 5054d796b1..7eed7bd15e 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -227,6 +227,8 @@ struct _USB_XHCI_INSTANCE {
   UINT32  ExtCapRegBase;
   UINT32  UsbLegSupOffset;
   UINT32  DebugCapSupOffset;
+  UINT32  Usb2SupOffset;
+  UINT32  UsbSsSupOffset;
   UINT64  *DCBAA;
   VOID*DCBAAMap;
   UINT32  MaxSlotsEn;
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 80be3311d4..5bff698edb 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -564,7 +564,57 @@ XhcGetCapabilityAddr (
 if ((Data & 0xFF) == CapId) {
   return ExtCapOffset;
 }
+//
+// If not, then traverse all of the ext capability registers till finding 
out it.
+//
+NextExtCapReg = (UINT8)((Data >> 8) & 0xFF);
+ExtCapOffset += (NextExtCapReg << 2);
+  } while (NextExtCapReg != 0);
+
+  return 0x;
+}
 
+/**
+  Calculate the offset of the xHCI Supported Protocol Capability.
+
+  @param  Xhc   The XHCI Instance.
+  @param  MajorVersion  The USB Major Version in xHCI Support Protocol 
Capab

Re: [edk2-devel] [edk2-platforms PATCH v1 0/1] BoardModulePkg: Copy device path

2022-04-25 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[Public]

Hi,
   Please review the patch.
Thanks
AbduL

-Original Message-
From: Attar, AbdulLateef (Abdul Lateef) 
Sent: 05 April 2022 11:25
To: devel@edk2.groups.io; Attar, AbdulLateef (Abdul Lateef) 
; Eric Dong ; Liming Gao 

Subject: RE: [edk2-devel] [edk2-platforms PATCH v1 0/1] BoardModulePkg: Copy 
device path

[Public]

Hi,
   Could you please review the patch?
Thanks
AbduL

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Abdul Lateef 
Attar via groups.io
Sent: 15 March 2022 10:16
To: devel@edk2.groups.io
Cc: Eric Dong ; Liming Gao 
Subject: [edk2-devel] [edk2-platforms PATCH v1 0/1] BoardModulePkg: Copy device 
path

[CAUTION: External Email]

(Resending patch with [edk2-platforms] prefix with correct emailid).
GCC compiler puts the DevicePath PCDs to the read-only section. During boot if 
try to process the device path after PtrGetPtr it throws a page fault exception.

Hence making a local copy using DuplicateDevicePath() to avoid the page fault 
exception.

REF : 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fabdattar%2Fedk2-platforms%2Ftree%2FBoardModulePkg&data=04%7C01%7CAbdulLateef.Attar%40amd.com%7Cdd04fc2187754979081008da063ebd5d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637829164332474465%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=MX%2FlzKO2jVyPHaaURb7b8kMyNWFAlMPZ%2B0gK%2Ffrh5xo%3D&reserved=0

Cc: Eric Dong 
Cc: Liming Gao 

Abdul Lateef Attar (1):
  BoardModulePkg: Copy device path before processing

 Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 19 
++-
 1 file changed, 14 insertions(+), 5 deletions(-)

--
2.25.1









-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89270): https://edk2.groups.io/g/devel/message/89270
Mute This Topic: https://groups.io/mt/89792070/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to use untested memory

2022-04-25 Thread Howell, Stacy
Hi all,
Are there any other comments or concerns regarding this patch?

Thanks,
Stacy

-Original Message-
From: Howell, Stacy 
Sent: Friday, January 14, 2022 4:13 PM
To: Kinney, Michael D ; devel@edk2.groups.io; 
spbro...@outlook.com; Gao, Liming 
Cc: Bi, Dandan ; Howell, Stacy 
Subject: RE: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers 
to use untested memory

Hi Sean,
Setting all memory as tested in PEI is a workaround for the issue that this 
patch addresses.  However, promoting all memory in PEI is not a workable 
solution for BIOSes that incorporate full memory testing functionality, as this 
relies on the tested flag to determine which memory regions to test.

This patch addresses a discrepancy in EDK2 core regarding how untested memory 
is treated for allocation by DXE drivers.  In the case where a DXE driver does 
not request a specific memory region DXE Core will promote untested memory if 
necessary to provide memory to the driver.  In the case where a DXE driver 
requests a specific memory range of untested memory, DXE Core will currently 
return an error instead of promoting untested memory to make the region 
available for the driver.

Thanks,
Stacy

-Original Message-
From: Kinney, Michael D 
Sent: Tuesday, January 11, 2022 10:57 AM
To: devel@edk2.groups.io; spbro...@outlook.com; Gao, Liming 
; Howell, Stacy ; Kinney, 
Michael D 
Cc: Bi, Dandan 
Subject: RE: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers 
to use untested memory

Hi Sean,

The auto promotion of memory was only intended as a dev/debug feature to 
maximize platform boot without having to tune what memory is tested in PEI 
phase.

In my opinion, a production platform should never trigger any auto promotions 
of untested to tested memory, and part of production validation should make 
sure this event never occurs in any production boot scenarios.

The specific bug being fix here is that auto promotion was not symmetric across 
all memory allocation types.  It simply aligns this dev/debug feature.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sean
> Sent: Monday, January 10, 2022 6:47 PM
> To: devel@edk2.groups.io; Gao, Liming ; 
> Howell, Stacy 
> Cc: Bi, Dandan 
> Subject: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE 
> Drivers to use untested memory
> 
> if this is auto promotion is happening in the core then what is the
> value of memory testing and tracking that state.   Is memory testing
> state a necessary feature of the Dxe Core?
> 
> 
> I think it makes more sense that if you platform wants to use a given 
> range your platform should either test it and/or mark it as tested.
> 
> OR
> 
> The dxe core should do away with the memory testing tracking.
> 
> 
> On most platforms i have seen in the past few years all memory is 
> marked as tested without doing any testing.  The only value in the 
> flag is keep the initial memory allocations in a given low range (below 4gb).
> 
> 
> 
> 
> On 1/10/2022 5:59 PM, gaoliming wrote:
> > Stacy:
> >This fix covers the case with AllocateAddress allocation type. I 
> > agree this fix. Reviewed-by: Liming Gao 
> >
> > Thanks
> > Liming
> >> -邮件原件-
> >> 发件人: devel@edk2.groups.io  代表 Stacy Howell
> >> 发送时间: 2022年1月8日 3:36
> >> 收件人: devel@edk2.groups.io
> >> 抄送: Stacy Howell ; Dandan Bi 
> >> ; Liming Gao 
> >> 主题: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to 
> >> use untested memory
> >>
> >> REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3795
> >> CC: Dandan Bi 
> >> CC: Liming Gao 
> >>
> >> Updated CoreInternalAllocatePages() to call PromoteMemoryResource() 
> >> and re-attempt the allocation if unable to convert the specified 
> >> memory range
> >>
> >> Signed-off-by: Stacy Howell 
> >> ---
> >>   MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++
> >>   1 file changed, 14 insertions(+)
> >>
> >> diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c
> >> b/MdeModulePkg/Core/Dxe/Mem/Page.c
> >> index 47d4c5d92e..cc0b90ac0d 100644
> >> --- a/MdeModulePkg/Core/Dxe/Mem/Page.c
> >> +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
> >> @@ -1417,6 +1417,20 @@ CoreInternalAllocatePages (
> >>   Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
> >> }
> >>
> >> +  if (EFI_ERROR (Status)) {
> >> +//
> >> +// If requested memory region is unavailable it may be 
> >> + untested
> >> memory
> >> +// Attempt to promote memory resources, then re-attempt the
> >> allocation
> >> +//
> >> +if (PromoteMemoryResource ()) {
> >> +  if (NeedGuard) {
> >> +Status = CoreConvertPagesWithGuard (Start, NumberOfPages,
> >> MemoryType);
> >> +  } else {
> >> +Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
> >> +  }
> >> +}
> >> +  }
> >> +
> >>   Done:
> >> CoreReleaseMemoryLock ();
> >>
> >> --
> >> 2.32.0.windows.2
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 



-=-=-=-=

Re: [edk2-devel] [PATCH 3/4] CryptoPkg: Make EC source file config-able

2022-04-25 Thread PierreGondois

Hello Yi1, Jiewen, and Bob,

As you mentioned in the cover letter, this patch relies on the following patch
bf9230a9f3dd ("BaseTools: Add the FeatureFlagExpression usage to the Source 
Section")
https://github.com/tianocore/edk2/commit/bf9230a9f3dde065c3c8b4175ccd32e44e8f0362

I just wanted to signal that this patch is currently not in
https://github.com/tianocore/edk2-basetools
It is thus not in any edk2basetools python module: the latest version of the 
edk2-basetools python module won't support the new build feature (cf 
pip-requirements.txt).
Thus someone who:
-relies on the edk2basetools python module
-tries to build an edk2 module relying on OpenSSL
will have a build break.

For instance, I get the following error when building:
build -a AARCH64 -t GCC5 -p SecurityPkg/SecurityPkg.dsc
...
"[some_path]/edk2/BaseTools/Bin/gcc_aarch64_linux_extdep/bin/aarch64-none-linux-gnu-gcc"
  
@[some_path]/Build/SbsaQemu/DEBUG_GCC5/AARCH64/CryptoPkg/Library/OpensslLib/OpensslLib/OUTPUT/cc_resp.txt
  -c -o 
[some_path]/Build/SbsaQemu/DEBUG_GCC5/AARCH64/CryptoPkg/Library/OpensslLib/OpensslLib/OUTPUT/openssl/crypto/ec/curve25519.obj
  [some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/curve25519.c
In file included from 
[some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/curve25519.c:11:
[some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/ec_local.h:48:24:
 error: unknown type name ‘EC_GROUP’
   48 | int (*group_init) (EC_GROUP *);

This is due to the build system trying to build a file in 
$(OPENSSL_PATH)/crypto/ec/* even though 
gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled is set to FALSE by default. The new 
Pcd feature to build files conditionally on a Pcd value is not handled yet.
The edk2 CI doesn't seem to build modules relying on OpenSSL due to the 
CONTINUOUS_INTEGRATION flag, explaining why the patch passed the CI I think.

I added Bob as I think he knows more about BaseTools.

Regards,
Pierre

On 4/18/22 15:03, yi1 li via groups.io wrote:

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

Use PCD gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled to config-able
source files list in OpensslLib.inf and OpensslLibCrypto.inf.
If PcdEcEnabled equals to FALSE, this file will not be compiled.

Signed-off-by: yi1 li 
---
  CryptoPkg/CryptoPkg.dec   |  4 +
  .../Library/Include/openssl/opensslconf.h |  7 +-
  CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 95 ++-
  .../Library/OpensslLib/OpensslLibCrypto.inf   | 95 ++-
  4 files changed, 108 insertions(+), 93 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.dec b/CryptoPkg/CryptoPkg.dec
index 5888941bab4c..ebec64050b71 100644
--- a/CryptoPkg/CryptoPkg.dec
+++ b/CryptoPkg/CryptoPkg.dec
@@ -81,5 +81,9 @@
# @ValidList 0x8001 | 0x0001, 0x0002, 0x0004, 0x0008, 
0x0010
gEfiCryptoPkgTokenSpaceGuid.PcdHashApiLibPolicy|0x0002|UINT32|0x0001
  
+  ## Enable/Disable the ECC feature in openssl library. The default is disabled.

+  #  If ECC feature is disabled, all related source files will not be compiled.
+  gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled|FALSE|BOOLEAN|0x003
+
  [UserExtensions.TianoCore."ExtraFiles"]
CryptoPkgExtra.uni
diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h 
b/CryptoPkg/Library/Include/openssl/opensslconf.h
index 7ea976b2252e..1485b8c9f108 100644
--- a/CryptoPkg/Library/Include/openssl/opensslconf.h
+++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
@@ -9,7 +9,7 @@
   * in the file LICENSE in the source distribution or at
   * https://www.openssl.org/source/license.html
   */
-
+#include 
  #include 
  
  #ifdef  __cplusplus

@@ -55,6 +55,11 @@ extern "C" {
  #ifndef OPENSSL_NO_DSA
  #define OPENSSL_NO_DSA
  #endif
+#if !FixedPcdGetBool (PcdEcEnabled)
+  #ifndef OPENSSL_NO_EC
+#define OPENSSL_NO_EC
+  #endif
+#endif
  #ifndef OPENSSL_NO_IDEA
  #define OPENSSL_NO_IDEA
  #endif
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 1d67ed55e1b1..459ac4864a4e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -199,43 +199,43 @@
$(OPENSSL_PATH)/crypto/dso/dso_vms.c
$(OPENSSL_PATH)/crypto/dso/dso_win32.c
$(OPENSSL_PATH)/crypto/ebcdic.c
-  $(OPENSSL_PATH)/crypto/ec/curve25519.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/arch_32/f_impl.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/curve448.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/curve448_tables.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/eddsa.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/f_generic.c
-  $(OPENSSL_PATH)/crypto/ec/curve448/scalar.c
-  $(OPENSSL_PATH)/crypto/ec/ec2_oct.c
-  $(OPENSSL_PATH)/crypto/ec/ec2_smpl.c
-  $(OPENSSL_PATH)/crypto/ec/ec_ameth.c
-  $(OPENSSL_PATH)/crypto/ec/ec_asn1.c
-  $(OPENSSL_PATH)/crypto/ec/ec_check.c
-  $(OPENSSL_PATH)/crypto/ec/ec_curve.c
-  $(OPENSSL_PATH)/crypto/e

Re: [edk2-devel] [PATCH v4 2/8] MdeModulePkg/VariableFlashInfoLib: Add initial library

2022-04-25 Thread Sami Mujawar

Hi Michael,

I have a minor suggestion marked inline as [SAMI].

Otherwise this patch looks good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote:

From: Michael Kubacki 

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

Adds a new library class VariableFlashInfoLib that abstracts access
to variable flash information. The instance provided first attempts
to retrieve information from the Variable Flash Info HOB. If that
HOB is not present, it falls back to the PCDs defined in
MdeModulePkg.

This fall back behavior provides backward compatibility for platforms
that only provide PCDs but also allows platforms that need to
dynamically provide the information using the Variable Flash Info HOB
to do so at runtime.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
  MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c   | 
178 
  MdeModulePkg/Include/Library/VariableFlashInfoLib.h|  
68 
  MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf |  
48 ++
  MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.uni |  
12 ++
  MdeModulePkg/MdeModulePkg.dec  |  
 4 +
  MdeModulePkg/MdeModulePkg.dsc  |  
 2 +
  6 files changed, 312 insertions(+)

diff --git 
a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c 
b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c
new file mode 100644
index ..a1db97bdf218
--- /dev/null
+++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c
@@ -0,0 +1,178 @@
+/** @file
+  Variable Flash Information Library
+
+  Copyright (c) Microsoft Corporation
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Get the HOB that contains variable flash information.
+
+  @param[out] VariableFlashInfo   Pointer to a pointer to set to the variable 
flash information structure.
+
+  @retval EFI_SUCCESS Variable flash information was found 
successfully.
+  @retval EFI_INVALID_PARAMETER   The VariableFlashInfo pointer given is NULL.
+  @retval EFI_NOT_FOUND   Variable flash information could not be 
found.
+
+**/
+EFI_STATUS
+GetVariableFlashInfoFromHob (
+  OUT VARIABLE_FLASH_INFO  **VariableFlashInfo
+  )

[SAMI] Can this function be made STATIC, please?

+{
+  EFI_HOB_GUID_TYPE  *GuidHob;
+
+  if (VariableFlashInfo == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  GuidHob = GetFirstGuidHob (&gVariableFlashInfoHobGuid);
+  if (GuidHob == NULL) {
+return EFI_NOT_FOUND;
+  }
+
+  *VariableFlashInfo = GET_GUID_HOB_DATA (GuidHob);
+
+  //
+  // Assert if more than one variable flash information HOB is present.
+  //
+  DEBUG_CODE (
+if ((GetNextGuidHob (&gVariableFlashInfoHobGuid, GET_NEXT_HOB (GuidHob)) 
!= NULL)) {
+DEBUG ((DEBUG_ERROR, "ERROR: Found two variable flash information 
HOBs\n"));
+ASSERT (FALSE);
+  }
+
+);
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the NV storage area used for UEFI variable 
storage.
+
+  @param[out] BaseAddressThe NV storage base address.
+  @param[out] Length The NV storage length in bytes.
+
+  @retval EFI_SUCCESS NV storage information was found 
successfully.
+  @retval EFI_INVALID_PARAMETER   A required pointer parameter is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariableFlashNvStorageInfo (
+  OUT EFI_PHYSICAL_ADDRESS  *BaseAddress,
+  OUT UINT64*Length
+  )
+{
+  EFI_STATUS   Status;
+  VARIABLE_FLASH_INFO  *VariableFlashInfo;
+
+  if ((BaseAddress == NULL) || (Length == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
+  if (!EFI_ERROR (Status)) {
+*BaseAddress = VariableFlashInfo->NvVariableBaseAddress;
+*Length  = VariableFlashInfo->NvVariableLength;
+  } else {
+*BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 
(PcdFlashNvStorageVariableBase64) != 0 ?
+  PcdGet64 
(PcdFlashNvStorageVariableBase64) :
+  PcdGet32 
(PcdFlashNvStorageVariableBase)
+  );
+*Length = (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize);
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the fault tolerant write (FTW) spare
+  area used for UEFI variable storage.
+
+  @param[out] BaseAddressThe FTW spare base address.
+  @param[out] Length The FTW spare length in bytes.
+
+  @retval EFI_SUCCESS FTW spare information was found successfully.
+  @retval EFI_INVALID_PARAMETER   A required pointer parameter is NULL.
+  @retval EFI_NOT_FOUND   FTW spare inf

Re: [edk2-devel] [PATCH v4 1/8] MdeModulePkg: Add Variable Flash Info HOB

2022-04-25 Thread Sami Mujawar

Hi Michael,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote:

From: Michael Kubacki 

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

Adds a new GUID that is used to identify a HOB that passes variable
flash information to UEFI variable drivers in HOB consumption phases
such as DXE, Traditional MM, and Standalone MM.

This information was previously passed directly with PCDs such
as EfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
and gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize.

However, the Standalone MM variable driver instance does not have
direct access to the PCD database. Therefore, this HOB will first
be considered as the source for variable flash information and
if platforms do not produce the HOB, reading the information from
the PCDs directly will be a backup to provide backward
compatibility.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
  MdeModulePkg/Include/Guid/VariableFlashInfo.h | 111 
  MdeModulePkg/MdeModulePkg.dec |   4 +
  2 files changed, 115 insertions(+)

diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h 
b/MdeModulePkg/Include/Guid/VariableFlashInfo.h
new file mode 100644
index ..992a0dcdd384
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h
@@ -0,0 +1,111 @@
+/** @file
+  This file defines the GUID and data structure used to pass information about
+  a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules
+  that consume that information such as the DXE and MM UEFI variable drivers.
+
+  The HOB described in this file is currently optional. It is primarily 
provided
+  to allow a platform to dynamically describe the flash information to 
environments
+  such as Standalone MM that cannot access the prior method using dynamic PCDs.
+
+  Even for platforms that use Standalone MM, if the information is only stored
+  statically such as with FixedAtBuild PCDs, the HOB is not required.
+
+  Every point of consumption in this package that uses the PCDs will first 
check
+  for the HOB and use its value if present.
+
+  Early modules such as the PEI UEFI variable driver might also consume this
+  information. For modules such as these, that execute early in the boot flow,
+  at least two approaches are possible depending on platform design.
+
+  1. If the information in the HOB exactly matches the information in the PCDs,
+ (i.e. the HOB values are set using the PCD values), let the driver read
+ the information from the PCD and produce the HOB later in boot.
+
+  2. Produce the HOB very early in boot. For example, the earliest point the 
HOB
+ is currently consumed is in FaultTolerantWritePei. Note that 
FaultTolerantWritePei
+ produces gEdkiiFaultTolerantWriteGuid which is a dependency for 
VariablePei.
+
+ Therefore, attaching a NULL class library to FaultTolerantWritePei with a
+ constructor that produces the HOB will guarantee it is produced before 
the first
+ point of consumption as the constructor is executed before the module 
entry point.
+
+  Copyright (c) Microsoft Corporation.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef VARIABLE_FLASH_INFO_H_
+#define VARIABLE_FLASH_INFO_H_
+
+#define VARIABLE_FLASH_INFO_HOB_GUID \
+  { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 
0x90 }}
+
+#define VARIABLE_FLASH_INFO_HOB_VERSION  1
+
+extern EFI_GUID  gVariableFlashInfoHobGuid;
+
+#pragma pack (push, 1)
+
+///
+/// This structure can be used to describe UEFI variable
+/// flash information.
+///
+typedef struct {
+  ///
+  /// Version of this structure.
+  ///
+  /// Increment the value when the structure is modified.
+  ///
+  UINT32  Version;
+  ///
+  /// Reserved field.
+  ///
+  /// Currently reserved for natural alignment.
+  ///
+  UINT32  Reserved;
+  ///
+  /// Base address of the non-volatile variable range in the flash device.
+  ///
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  EFI_PHYSICAL_ADDRESSNvVariableBaseAddress;
+  ///
+  /// Size of the non-volatile variable range in the flash device.
+  ///
+  /// Note that this value should be less than or equal to FtwSpareLength to 
support reclaim of
+  /// entire variable store area.
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  UINT64  NvVariableLength;
+  ///
+  /// Base address of the FTW spare block range in the flash device.
+  ///
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  EFI_PHYSICAL_ADDRESSFtwSpareBaseAddress;
+  ///
+  /// Size of the FTW spare block range in the flash device.
+  ///
+  /// Note that this value s

Re: [edk2-devel] [PATCH v4 3/8] MdeModulePkg/Variable: Consume Variable Flash Info

2022-04-25 Thread Sami Mujawar

Hi Michael,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote:

From: Michael Kubacki 

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

Updates VariableRuntimeDxe, VariableSmm, and VariableStandaloneMm
to acquire variable flash information from the Variable Flash
Information library.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
  MdeModulePkg/Universal/Variable/Pei/Variable.c  | 14 
+-
  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c| 16 

  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c| 14 
++
  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c| 17 
+
  MdeModulePkg/Universal/Variable/Pei/Variable.h  |  2 ++
  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf |  5 ++---
  MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h   |  7 
++-
  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf   |  5 ++---
  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf  |  5 ++---
  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf |  5 ++---
  10 files changed, 56 insertions(+), 34 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c 
b/MdeModulePkg/Universal/Variable/Pei/Variable.c
index b36dd0de67b2..26a4c73b45a5 100644
--- a/MdeModulePkg/Universal/Variable/Pei/Variable.c
+++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c
@@ -567,11 +567,13 @@ GetVariableStore (
OUT VARIABLE_STORE_INFO  *StoreInfo
)
  {
+  EFI_STATUSStatus;
EFI_HOB_GUID_TYPE *GuidHob;
EFI_FIRMWARE_VOLUME_HEADER*FvHeader;
VARIABLE_STORE_HEADER *VariableStoreHeader;
EFI_PHYSICAL_ADDRESS  NvStorageBase;
UINT32NvStorageSize;
+  UINT64NvStorageSize64;
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA  *FtwLastWriteData;
UINT32BackUpOffset;
  
@@ -591,11 +593,13 @@ GetVariableStore (

  // Emulated non-volatile variable mode is not enabled.
  //
  
-NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize);

-NvStorageBase = (EFI_PHYSICAL_ADDRESS)(PcdGet64 
(PcdFlashNvStorageVariableBase64) != 0 ?
-   PcdGet64 
(PcdFlashNvStorageVariableBase64) :
-   PcdGet32 
(PcdFlashNvStorageVariableBase)
-   );
+Status = GetVariableFlashNvStorageInfo (&NvStorageBase, 
&NvStorageSize64);
+ASSERT_EFI_ERROR (Status);
+
+Status = SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize);
+// This driver currently assumes the size will be UINT32 so assert the 
value is safe for now.
+ASSERT_EFI_ERROR (Status);
+
  ASSERT (NvStorageBase != 0);
  
  //

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
index 03fec3048dc4..d5c409c914d1 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
@@ -423,6 +423,8 @@ FtwNotificationEvent (
EFI_PHYSICAL_ADDRESSVariableStoreBase;
UINT64  VariableStoreLength;
UINTN   FtwMaxBlockSize;
+  UINT32  NvStorageVariableSize;
+  UINT64  NvStorageVariableSize64;
  
//

// Ensure FTW protocol is installed.
@@ -432,14 +434,20 @@ FtwNotificationEvent (
  return;
}
  
+  Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvStorageVariableSize64);

+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUint32 (NvStorageVariableSize64, 
&NvStorageVariableSize);
+  // This driver currently assumes the size will be UINT32 so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
+
+  VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
+
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
if (!EFI_ERROR (Status)) {
-ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
+ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);
}
  
-  NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;

-  VariableStoreBase = NvStorageVariableBase + 
mNvFvHeaderCache->HeaderLength;
-
//
// Let NonVolatileVariableBase point to flash variable store base directly 
after FTW ready.
//
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableN

Re: [edk2-devel] [PATCH v4 4/8] MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info

2022-04-25 Thread Sami Mujawar

Hi Michael,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote:

From: Michael Kubacki 

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

Adds support to the UEFI variable fault tolerant write (FTW) drivers
to receive FTW base and size information dynamically via the Variable
Flash Information library.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
  MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
  | 41 +---
  MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c 
  |  7 +++-
  MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c  
  | 28 -
  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h 
  |  7 +++-
  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
  | 10 +
  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
  | 10 +
  
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 
| 10 +
  MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
  | 10 +
  8 files changed, 63 insertions(+), 60 deletions(-)

diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
index 661e1487673b..f1335870e797 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
@@ -987,22 +987,43 @@ InitFtwDevice (
OUT EFI_FTW_DEVICE  **FtwData
)
  {
-  EFI_FTW_DEVICE  *FtwDevice;
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  WorkSpaceAddress;
+  UINT64Size;
+  UINTN FtwWorkingSize;
+  EFI_FTW_DEVICE*FtwDevice;
+
+  FtwWorkingSize = 0;
+
+  Status = GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUintn (Size, &FtwWorkingSize);
+  // This driver currently assumes the size will be UINTN so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
  
//

// Allocate private data of this driver,
// Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].
//
-  FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + PcdGet32 
(PcdFlashNvStorageFtwWorkingSize));
+  FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + FtwWorkingSize);
if (FtwDevice == NULL) {
  return EFI_OUT_OF_RESOURCES;
}
  
+  FtwDevice->WorkSpaceAddress = WorkSpaceAddress;

+  FtwDevice->WorkSpaceLength  = FtwWorkingSize;
+
+  Status = GetVariableFlashFtwSpareInfo (&FtwDevice->SpareAreaAddress, &Size);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUintn (Size, &FtwDevice->SpareAreaLength);
+  // This driver currently assumes the size will be UINTN so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
+
//
// Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE.
//
-  FtwDevice->WorkSpaceLength = (UINTN)PcdGet32 
(PcdFlashNvStorageFtwWorkingSize);
-  FtwDevice->SpareAreaLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpareSize);
if ((FtwDevice->WorkSpaceLength == 0) || (FtwDevice->SpareAreaLength == 0)) 
{
  DEBUG ((DEBUG_ERROR, "Ftw: Workspace or Spare block does not exist!\n"));
  FreePool (FtwDevice);
@@ -1015,16 +1036,6 @@ InitFtwDevice (
FtwDevice->FtwWorkSpaceLba = (EFI_LBA)(-1);
FtwDevice->FtwSpareLba = (EFI_LBA)(-1);
  
-  FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFtwWorkingBase64);

-  if (FtwDevice->WorkSpaceAddress == 0) {
-FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 
(PcdFlashNvStorageFtwWorkingBase);
-  }
-
-  FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 
(PcdFlashNvStorageFtwSpareBase64);
-  if (FtwDevice->SpareAreaAddress == 0) {
-FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 
(PcdFlashNvStorageFtwSpareBase);
-  }
-
*FtwData = FtwDevice;
return EFI_SUCCESS;
  }
@@ -1277,7 +1288,7 @@ InitFtwProtocol (
FtwDevice->FtwLastWriteHeader = NULL;
FtwDevice->FtwLastWriteRecord = NULL;
  
-  InitializeLocalWorkSpaceHeader ();

+  InitializeLocalWorkSpaceHeader (FtwDevice->WorkSpaceLength);
  
//

// Refresh the working space data from working block
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
index 61e7a92ccea1..fd563643eb63 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
@@ -16,10 +16,13 @@ EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER  
mWorkingBlockHeader = { ZERO_GUID, 0, 0
  
Since Signature and WriteQueueSize have been known, Crc can be calculated out,

then the

Re: [edk2-devel] [PATCH v4 5/8] ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib

2022-04-25 Thread Sami Mujawar

Hi Michael,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, mikub...@linux.microsoft.com wrote:

From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Cc: Gerd Hoffmann 
Cc: Julien Grall 
Signed-off-by: Michael Kubacki 
---
  ArmVirtPkg/ArmVirt.dsc.inc | 1 +
  1 file changed, 1 insertion(+)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index ba711deac025..988c1eb75529 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -177,6 +177,7 @@ [LibraryClasses.common]

AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
  !endif
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf

UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89277): https://edk2.groups.io/g/devel/message/89277
Mute This Topic: https://groups.io/mt/90421975/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1 10/10] PlatformStandaloneMmPkg: Add VariableFlashInfoLib

2022-04-25 Thread Sami Mujawar

Hi Michael,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 20/04/2022 09:44 pm, mikub...@linux.microsoft.com wrote:

From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Sami Mujawar 
Cc: Ilias Apalodimas 
Signed-off-by: Michael Kubacki 
---
  Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 
1 +
  1 file changed, 1 insertion(+)

diff --git 
a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc 
b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
index 33364deb1ef0..653029c52fdb 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
@@ -34,6 +34,7 @@ [LibraryClasses]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf

DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89278): https://edk2.groups.io/g/devel/message/89278
Mute This Topic: https://groups.io/mt/90592933/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1 00/10] Add variableFlashInfoLib

2022-04-25 Thread Sami Mujawar

Hi Michael,

There are other platforms in edk2-platforms that would possibly require 
similar changes.


e.g. Platform\ARM\VExpressPkg\ArmVExpress-FVP-AArch64.dsc, 
Platform\ARM\JunoPkg\ArmJuno.dsc, etc.


Do you plan to submit patches to update these platforms as well?

Regards,

Sami Mujawar

On 20/04/2022 09:44 pm, mikub...@linux.microsoft.com wrote:

From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Note that this series is for an upcoming change in MdeModulePkg
and requires that change to be present locally for testing.

https://edk2.groups.io/g/devel/message/88787

Cc: Abner Chang 
Cc: Ard Biesheuvel 
Cc: Chasel Chiu 
Cc: Daniel Schaefer 
Cc: Eric Dong 
Cc: Gilbert Chen 
Cc: Graeme Gregory 
Cc: Ilias Apalodimas 
Cc: Jeremy Linton 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Masami Hiramatsu 
Cc: Nate DeSimone 
Cc: Radoslaw Biernacki 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 

Michael Kubacki (10):
   OverdriveBoard: Add VariableFlashInfoLib
   BeagleBoardPkg: Add VariableFlashInfoLib
   MinPlatformPkg: Add VariableFlashInfoLib
   CelloBoard: Add VariableFlashInfoLib
   SbsaQemu: Add VariableFlashInfoLib
   RaspberryPi: Add VariableFlashInfoLib
   U5SeriesPkg: Add VariableFlashInfoLib
   Socionext: Add VariableFlashInfoLib
   Softiron: Add VariableFlashInfoLib
   PlatformStandaloneMmPkg: Add VariableFlashInfoLib

  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 
1 +
  Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc | 
1 +
  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc| 
1 +
  Platform/LeMaker/CelloBoard/CelloBoard.dsc | 
1 +
  Platform/Qemu/SbsaQemu/SbsaQemu.dsc| 
1 +
  Platform/RaspberryPi/RPi3/RPi3.dsc | 
1 +
  Platform/RaspberryPi/RPi4/RPi4.dsc | 
1 +
  Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc | 
1 +
  Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc   | 
1 +
  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   | 
1 +
  Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc| 
1 +
  Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 
1 +
  12 files changed, 12 insertions(+)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89279): https://edk2.groups.io/g/devel/message/89279
Mute This Topic: https://groups.io/mt/90592905/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] MdePkg/BaseLib: Add CRC16-ANSI and CRC32c implementations

2022-04-25 Thread Pedro Falcato
Ping. If someone could take a look, it would be much appreciated.

On Thu, Apr 7, 2022 at 11:02 PM Pedro Falcato 
wrote:

> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Add the CRC16-ANSI and CRC32C implementations previously found at
> Features/Ext4Pkg/Ext4Dxe/Crc{16,32c}.c to BaseLib.
>
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
>
> Signed-off-by: Pedro Falcato 
> ---
>  MdePkg/Include/Library/BaseLib.h  |  35 +++-
>  MdePkg/Library/BaseLib/CheckSum.c | 144 ++
>  2 files changed, 178 insertions(+), 1 deletion(-)
>
> diff --git a/MdePkg/Include/Library/BaseLib.h
> b/MdePkg/Include/Library/BaseLib.h
> index 6aa0d972186e..f365de9f74a0 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -4503,6 +4503,40 @@ CalculateCrc32 (
>IN  UINTN  Length
>);
>
> +/**
> +   Calculates the CRC16-ANSI checksum of the given buffer.
> +
> +   @param[in]  BufferPointer to the buffer.
> +   @param[in]  LengthLength of the buffer, in bytes.
> +   @param[in]  InitialValue  Initial value of the CRC.
> +
> +   @return The CRC16-ANSI checksum.
> +**/
> +UINT16
> +EFIAPI
> +CalculateCrc16Ansi (
> +  IN  CONST VOID  *Buffer,
> +  IN  UINTN   Length,
> +  IN  UINT16  InitialValue
> +  );
> +
> +/**
> +   Calculates the CRC32c checksum of the given buffer.
> +
> +   @param[in]  BufferPointer to the buffer.
> +   @param[in]  LengthLength of the buffer, in bytes.
> +   @param[in]  InitialValue  Initial value of the CRC.
> +
> +   @return The CRC32c checksum.
> +**/
> +UINT32
> +EFIAPI
> +CalculateCrc32c (
> +  IN CONST VOID  *Buffer,
> +  IN UINTN   Length,
> +  IN UINT32  InitialValue
> +  );
> +
>  //
>  // Base Library CPU Functions
>  //
> @@ -4512,7 +4546,6 @@ CalculateCrc32 (
>
>@param  Context1Context1 parameter passed into SwitchStack().
>@param  Context2Context2 parameter passed into SwitchStack().
> -
>  **/
>  typedef
>  VOID
> diff --git a/MdePkg/Library/BaseLib/CheckSum.c
> b/MdePkg/Library/BaseLib/CheckSum.c
> index 28dee5ac6a15..b6a076573191 100644
> --- a/MdePkg/Library/BaseLib/CheckSum.c
> +++ b/MdePkg/Library/BaseLib/CheckSum.c
> @@ -3,6 +3,7 @@
>algorithm.
>
>Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> +  Copyright (c) 2022, Pedro Falcato. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
>  **/
> @@ -618,3 +619,146 @@ CalculateCrc32 (
>
>return Crc ^ 0x;
>  }
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT16  mCrc16LookupTable[256]
> =
> +{
> +  0x, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
> +  0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
> +  0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
> +  0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
> +  0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
> +  0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
> +  0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
> +  0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
> +  0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
> +  0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
> +  0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
> +  0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
> +  0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
> +  0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
> +  0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
> +  0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
> +  0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
> +  0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
> +  0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
> +  0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
> +  0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
> +  0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
> +  0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
> +  0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
> +  0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
> +  0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
> +  0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
> +  0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
> +  0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
> +  0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
> +  0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
> +  0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
> +};
> +
> +/**
> +   Calculates the CRC16-ANSI checksum of the given buffer.
> +
> +   @param[in]  BufferPointer to the b

Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib

2022-04-25 Thread Pedro Falcato
Ping. If someone could take a look, it would be much appreciated.

On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato 
wrote:

> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Hi all,
>
> This patch-set attempts to address two open feature requests for Ext4Pkg
> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib
> (id 3871).
>
> The previous patch-set regarding 3871 attempted to merge the different
> crc16 implementations
> but failed because, contrary to what I thought, there are many, many
> different CRC16s which
> are all slightly different. This one (plus the separate edk2 patch)
> attempts to just merge
> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>
> Since this patch set grew to be considerably different from the original,
> I didn't mark it
> as v2 but rather a separate, new patch-set.
>
> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
> the CC's of the MdePkg
> patch.
>
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
>
> Pedro Falcato (3):
>   Ext4Pkg: Replace the CRC implementations with BaseLib
>   Ext4Pkg: Format using uncrustify
>   Ext4Pkg: Add ext2/3 support
>
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c  |  75 -
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c |  84 --
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c|  95 +++---
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h| 417 ++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>  Features/Ext4Pkg/Ext4Dxe/Extents.c|  27 +-
>  Features/Ext4Pkg/Ext4Dxe/File.c   |  19 +-
>  Features/Ext4Pkg/Ext4Dxe/Inode.c  |  33 +-
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>  16 files changed, 640 insertions(+), 487 deletions(-)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>
> --
> 2.35.1
>
>

-- 
Pedro Falcato


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89281): https://edk2.groups.io/g/devel/message/89281
Mute This Topic: https://groups.io/mt/90324099/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] PcAtChipsetPkg: Change the flow of PcRtcInit()

2022-04-25 Thread Zhuoran Chao
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3913

The original flow of PcRtcInit() is like:
1. Guarantee atomic accesses to the RTC time registers and
   read out the value.
2. Program RTC register B. (adopt 12h mode or 24h mode. Current
   bios code sets RTC to 24h mode by default).
3. Then function ConvertRtcTimeToEfiTime converts the RTC time
   value to their 24h mode by checking the hour format bit
   (1:24h mode,0:12h mode).
And here lies the problem: Step3 will fail to adjust the value
if Step2 already sets RTC to 24h mode. The hour value in 12h mode
will not be converted to its 24h mode.

The solution is to program RTC register B a little later when all
the original RTC registers' value is retrieved, adjusted
and validated.

Cc: Ray Ni 

Signed-off-by: Zhuoran Chao 
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 0fbfa4bcee..ea56a66267 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -269,13 +269,6 @@ PcRtcInit (
   Time.Month  = RtcRead (RTC_ADDRESS_MONTH);
   Time.Year   = RtcRead (RTC_ADDRESS_YEAR);
 
-  //
-  // Set RTC configuration after get original time
-  // The value of bit AIE should be reserved.
-  //
-  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | 
(RegisterB.Data & BIT5);
-  RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
-
   //
   // Release RTC Lock.
   //
@@ -330,6 +323,13 @@ PcRtcInit (
 Time.Daylight   = 0;
   }
 
+  //
+  // Set RTC configuration after get original time
+  // The value of bit AIE should be reserved.
+  //
+  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | 
(RegisterB.Data & BIT5);
+  RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
+
   //
   // Reset time value according to new RTC configuration
   //
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89282): https://edk2.groups.io/g/devel/message/89282
Mute This Topic: https://groups.io/mt/90693358/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v5 1/6] MdeModulePkg/PciHostBridge: io range is not mandatory

2022-04-25 Thread Ard Biesheuvel
On Fri, 22 Apr 2022 at 09:37, Gerd Hoffmann  wrote:
>
> io range is not mandatory according to pcie spec,
> so allow bridge configurations without io address
> space assigned.
>
> Signed-off-by: Gerd Hoffmann 
> Reviewed-by: Ard Biesheuvel 

Could one of the MdeModulePkg maintainers please get this reviewed? Thanks.

> ---
>  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c 
> b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
> index b20bcd310ad5..712662707931 100644
> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
> @@ -1085,6 +1085,9 @@ NotifyPhase (
>RootBridge->ResAllocNode[Index].Base   = BaseAddress;
>RootBridge->ResAllocNode[Index].Status = ResAllocated;
>DEBUG ((DEBUG_INFO, "Success\n"));
> +} else if ((Index == TypeIo) && (RootBridge->Io.Base == 
> MAX_UINT64)) {
> +  /* optional on PCIe */
> +  DEBUG ((DEBUG_INFO, "PCI Root Bridge does not provide IO 
> Resources.\n"));
>  } else {
>ReturnStatus = EFI_OUT_OF_RESOURCES;
>DEBUG ((DEBUG_ERROR, "Out Of Resource!\n"));
> --
> 2.35.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89283): https://edk2.groups.io/g/devel/message/89283
Mute This Topic: https://groups.io/mt/90623478/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 0/5] Handling of multiple PCI host bridges

2022-04-25 Thread Ojeda Leon, Nicolas via groups.io
Increased control is provided in Ovmf platforms to define and configure
the specifications of multiple PCI host bridges in the hypervisor. The
host propagates this information to the guest, initially through fw-cfg
interface.

In some AWS EC2 platforms, we expose a PCI topology including several
root bridges portraying information about physical distribution that
enables the guest to optimize accesses. Current PCI driver for Ovmf
enables the explicit definition of multiple root bridges and contains
the logic to fix their resources based on platform-specific PCD
entries. However, we need a way to control, from the hypervisor, how
many and which resources each PCI root bridge can use. For this
reason, this patch series introduces a mechanism to provide PCI host
bridges information like bus number range, attributes, allocation
attributes, PIO aperture as well as 32 and 64- bit prefetchable and
non-prefetchable MMIO ranges through a fw-cfg item created by the
hypervisor and consumed by the guest firmware. In order to offer a
generic and extensible way to disclose non-discoverable hardware
information from the host to the guest, a new library called 
HardwareInfoLib is created in the OvmfPkg. In essence, this library
offers the functionality to parse a generic BLOB into a list as well
as the methods to iterate over such list, including filtering options.
The library is conceived in a generic way so that further hardware
elements can also be described using it. For such purpose the length
of the BLOB is not restricted but instead regarded as a sequence of
header-info elements that allow the parsing during runtime.
Furthermore, specific functionality is provided wrapping
QemuFwCfgReadBytes to extract hardware descriptions, in the
aforementioned format, in a static way so that early in the Pei
stage the library can be used to identify address space requirements.
The core of the library offers enough flexibility to process as many
elements, even from different hardware types (heterogenous), as needed
in a single run. This library is extended for the particular use case
already exposed, PCI host bridges, and this same code offers an
example of how to tailor it for further hardware components.


---
Notes:
  v5:
  - Removed last 3 patches dealing with pre-populated resources to
encapsulate related changes in more manageable chunks and while
pre-populated changes are finalized.
  - Added Acked-by to all commits
  - Re-based on top of latest master and refactored changes in
MemDetect.c to adapt to recently created
PlatformInitLib/MemDetect.c

  v4:
  - Minor modification to use MAX_UINT64 as global invalid base address
when reading PCI host bridge information provided by the host
(Patch 1)
  - Refactor PciHostBridgeUtilityGetRootBridges into a thin wrapper that
calls 2 new function: one (BusScan) that performs the legacy bus
scan population process and a new one (HostProvided) that populates
Root Bridges with host provided values. (Patch 5)
  - Move code that sets value of PcdPciPreservePopulatedMappings token
based on host-provided fw-cfg file into the function that populates
root bridges with host provided data (Patch 6)
  - Restructured base address retrieval to leave PCI Resource Allocation
protocol untouched and instead augment the existing services to
enable base address retrieval before allocation. (Patch 7)
  - Use new method to retrieve Root Bridge base addresses before
allocation and use that to handle pre-populated BARs (Patch 8)


Nicolas Ojeda Leon (5):
  OvmfPkg/Library: Create base HardwareInfoLib for PCI Host Bridges
  Ovmf/HardwareInfoLib: Create Pei lib to parse directly from fw-cfg
  Ovmf/HardwareInfoLib: Add Dxe lib to dynamically parse heterogenous
data
  Ovmf/PlatformPei: Use host-provided GPA end if available
  OvmfPkg/PciHostBridgeUtilityLib: Initialize RootBridges apertures with
spec

 OvmfPkg/Include/Library/HardwareInfoLib.h | 165 ++
 .../HardwareInfoLib/DxeHardwareInfoLib.inf|  43 ++
 .../Library/HardwareInfoLib/HardwareInfoDxe.c | 255 +
 .../HardwareInfoPciHostBridgeLib.c| 514 ++
 .../HardwareInfoPciHostBridgeLib.h| 262 +
 .../Library/HardwareInfoLib/HardwareInfoPei.c |  85 +++
 .../HardwareInfoLib/HardwareInfoTypesLib.h|  64 +++
 .../HardwareInfoLib/PeiHardwareInfoLib.inf|  43 ++
 .../QemuFwCfgHardwareInfoLib.c|  89 +++
 .../PciHostBridgeUtilityLib.c | 316 ++-
 .../PciHostBridgeUtilityLib.inf   |   1 +
 OvmfPkg/Library/PlatformInitLib/MemDetect.c   | 148 -
 OvmfPkg/OvmfPkgX64.dsc|   2 +
 OvmfPkg/PlatformPei/PlatformPei.inf   |   1 +
 14 files changed, 1976 insertions(+), 12 deletions(-)
 create mode 100644 OvmfPkg/Include/Library/HardwareInfoLib.h
 create mode 100644 OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
 create mode 100644 OvmfPkg/Library/HardwareI

[edk2-devel] [PATCH v5 2/5] Ovmf/HardwareInfoLib: Create Pei lib to parse directly from fw-cfg

2022-04-25 Thread Ojeda Leon, Nicolas via groups.io
Define the HardwareInfoLib API and create the PeiHardwareInfoLib
which implements it, specifically for Pei usage, supporting
only static accesses to parse data directly from a fw-cfg file.
All list-like APIs are implemented as unsupported and only a
fw-cfg wrapper to read hardware info elements is provided.

The Hardware Info library is intended to describe non-discoverable
hardware information and share that from the host to the guest in Ovmf
platforms. The QEMU fw-cfg extension for this library provides a first
variation to parse hardware info by reading it directly from a fw-cfg
file. This library offers a wrapper function to the plain
QmeuFwCfgReadBytes which, specifically, parses header-data pairs out
of the binary values in the file. For this purpose, the approach is
incremental, reading the file block by block and outputting the values
only for a specific known hardware type (e.g. PCI host bridges). One
element is returned in each call until the end of the file is reached.

Considering fw-cfg as the first means to transport hardware info from
the host to the guest, this wrapping library offers the possibility
to statically, and in steps, read a specific type of hardware info
elements out of the file. This method reads one hardware element of a
specific type at a time, without the need to pre-allocate memory and
read the whole file or dynamically allocate memory for each new
element found.

As a usage example, the static approach followed by this library
enables early UEFI stages to use and read hardware information
supplied by the host. For instance, in early times of the PEI stage,
hardware information can be parsed out from a fw-cfg file prescinding
from memory services, that may not yet be available, and avoiding
dynamic memory allocations.

Cc: Alexander Graf 
Cc: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
Signed-off-by: Nicolas Ojeda Leon 
---
 OvmfPkg/Include/Library/HardwareInfoLib.h | 165 ++
 .../Library/HardwareInfoLib/HardwareInfoPei.c |  85 +
 .../HardwareInfoLib/PeiHardwareInfoLib.inf|  43 +
 .../QemuFwCfgHardwareInfoLib.c|  89 ++
 OvmfPkg/OvmfPkgX64.dsc|   1 +
 5 files changed, 383 insertions(+)
 create mode 100644 OvmfPkg/Include/Library/HardwareInfoLib.h
 create mode 100644 OvmfPkg/Library/HardwareInfoLib/HardwareInfoPei.c
 create mode 100644 OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
 create mode 100644 OvmfPkg/Library/HardwareInfoLib/QemuFwCfgHardwareInfoLib.c

diff --git a/OvmfPkg/Include/Library/HardwareInfoLib.h 
b/OvmfPkg/Include/Library/HardwareInfoLib.h
new file mode 100644
index 00..9a8149bf20
--- /dev/null
+++ b/OvmfPkg/Include/Library/HardwareInfoLib.h
@@ -0,0 +1,165 @@
+/*/@file
+  Hardware info parsing functions.
+  Binary data is expected as a consecutive series of header - object pairs.
+  Complete library providing static Qemu fw-cfg wrappers as well as list-like
+  interface to dynamically manipulate hardware info objects and parsing from
+  a generic blob.
+
+  Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef __HARDWARE_INFO_LIB_H__
+#define __HARDWARE_INFO_LIB_H__
+
+#include "../Library/HardwareInfoLib/HardwareInfoTypesLib.h"
+
+/**
+  Read, if available, the next Type element in the FwCfg file.
+  The FwCfg item must already be selected, this is a wrapper around
+  QemuFwCfgReadBytes and the Data pointer should be set to an existent
+  memory location with TypeSize bytes allocated for the date to be
+  properly written. If a Type element is found in the file which has a
+  size (in the header) greater than TypeSize, it is skipped.
+
+  @param[in]Type Hardware Info Type to search for
+  @param[in]TypeSize Size (in bytes) of the structure intended to
+ be used to dereference the data
+  @param[in]TotalFileSizeTotal size (in bytes) of the FwCfg file from
+ which the data is read.
+  @param[out]   Data Pointer to a memory allocated instance into
+ which the data is written to.
+  @param[out]   DataSize Size in bytes of the actually filled
+ data available in the Data object after a
+ successful operation
+  @param[inout] ReadIndexIndex of the next byte to be read. Incremented
+ accordingly after a read operation to reflect
+ up 

[edk2-devel] [PATCH v5 4/5] Ovmf/PlatformPei: Use host-provided GPA end if available

2022-04-25 Thread Ojeda Leon, Nicolas via groups.io
Read the "hardware-info" item from fw-cfg to extract specifications
of PCI host bridges and analyze the 64-bit apertures of them to
find out the highest 64-bit MMIO address required which determines
the address space required by the guest, and, consequently, the
FirstNonAddress used to calculate size of physical addresses.

Using the static PeiHardwareInfoLib, read the fw-cfg file of
hardware information to extract, one by one, all the host
bridges. Find the last 64-bit MMIO address of each host bridge,
using the HardwareInfoPciHostBridgeLib API, and compare it to an
accumulate value to discover the highest address used, which
corresponds to the highest value that must be included in the
guest's physical address space.

Given that platforms with multiple host bridges may provide the PCI
apertures' addresses, the memory detection logic must take into
account that, if the host provided the MMIO windows that can and must
be used, the guest needs to take those values. Therefore, if the
MMIO windows are found in the host-provided fw-cfg file, skip all the
logic calculating the physical address size and just use the value
provided. Since each PCI host bridge corresponds to an element in
the information provided by the host, each of these must be analyzed
looking for the highest address used.

Cc: Alexander Graf 
Cc: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
Signed-off-by: Nicolas Ojeda Leon 
---
Notes:
  v5:
  - Moved all changes from MemDetect.c into recently created
PlatformInitLib/MemDetect.c effectively re-basing this patch
onto latest master
  - Adapted function name to use Platform convention without
any changes in the logic

 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 148 +++-
 OvmfPkg/PlatformPei/PlatformPei.inf |   1 +
 2 files changed, 142 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c 
b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 4c1dedf863..daca619c11 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -27,6 +27,7 @@ Module Name:
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -491,6 +492,126 @@ PlatformGetFirstNonAddress (
   return FirstNonAddress;
 }
 
+/**
+  Iterate over the PCI host bridges resources information optionally provided
+  in fw-cfg and find the highest address contained in the PCI MMIO windows. If
+  the information is found, return the exclusive end; one past the last usable
+  address.
+
+  @param[out] PciMmioAddressEnd Pointer to one-after End Address updated with
+information extracted from host-provided data
+or zero if no information available or an
+error happened
+
+  @retval EFI_SUCCESS   PCI information was read and the output
+parameter updated with the last valid
+address in the 64-bit MMIO range.
+  @retval EFI_INVALID_PARAMETER Pointer parameter is invalid
+  @retval EFI_INCOMPATIBLE_VERSION  Hardware information found in fw-cfg
+has an incompatible format
+  @retval EFI_UNSUPPORTED   Fw-cfg is not supported, thus host
+provided information, if any, cannot be
+read
+  @retval EFI_NOT_FOUND No PCI host bridge information provided
+by the host.
+**/
+STATIC
+EFI_STATUS
+PlatformScanHostProvided64BitPciMmioEnd (
+  OUT UINT64  *PciMmioAddressEnd
+  )
+{
+  EFI_STATUSStatus;
+  HOST_BRIDGE_INFO  HostBridge;
+  FIRMWARE_CONFIG_ITEM  FwCfgItem;
+  UINTN FwCfgSize;
+  UINTN FwCfgReadIndex;
+  UINTN ReadDataSize;
+  UINT64Above4GMmioEnd;
+
+  if (PciMmioAddressEnd == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  *PciMmioAddressEnd = 0;
+  Above4GMmioEnd = 0;
+
+  Status = QemuFwCfgFindFile ("etc/hardware-info", &FwCfgItem, &FwCfgSize);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  QemuFwCfgSelectItem (FwCfgItem);
+
+  FwCfgReadIndex = 0;
+  while (FwCfgReadIndex < FwCfgSize) {
+Status = QemuFwCfgReadNextHardwareInfoByType (
+   HardwareInfoTypeHostBridge,
+   sizeof (HostBridge),
+   FwCfgSize,
+   &HostBridge,
+   &ReadDataSize,
+   &FwCfgReadIndex
+   );
+
+if (Status != EFI_SUCCESS) {
+  //
+  // No more data available to read in the file, break
+  // loop and finish process
+  //
+  break;
+}
+
+Status = HardwareInfoPciHostBridgeLastMmioAddress (
+   &HostBridge,
+   ReadDataSize,
+   TRUE,
+   &Above4GMmioEnd
+   );
+
+if (Status != EFI_SUCCESS) {
+  //
+  // Erro

[edk2-devel] [PATCH v5 5/5] OvmfPkg/PciHostBridgeUtilityLib: Initialize RootBridges apertures with spec

2022-04-25 Thread Ojeda Leon, Nicolas via groups.io
Consume the host-provided specification of PCI host bridges if
available. Using the DxeHardwareInfoLib, populate a list of
hardware descriptors based on the content of the "hardware-info"
fw-cfg file, if provided. In the affirmative case, use the
resources and attributes specified by the hypervisor for each
Host Bridge to create the RootBridge elements.

In Ovmf platforms, the host can provide the specification of
non-discoverable hardware resources like PCI host bridges. If the
proper fw-cfg file is found, parse the contents provided by the
host into a linked list by using the Hardware Info library. Then,
using the list of PCI host bridges' descriptions, populate the
PCI_ROOT_BRIDGES array with the resources and attributes specified
by the host. If the file is not provided or no Host Bridge is found
in it, fold back to the legacy method based on pre-defined
apertures and rules.

In some use cases, the host requires additional control over the
hardware resources' configurations in the guest for performance and
discoverability reasons. For instance, to disclose information about
the PCI hierarchy to the guest so that this can profit from
optimized accesses. In this case, the host can decide to describe
multiple PCI Host Bridges and provide a specific set of resources
(e.g. MMIO apertures) so that the guest uses the values provided.
Using the provided values may entitle the guest to added performance,
for example by using specific MMIO mappings that can enable peer-to-peer
communication across the PCI hierarchy or by allocating memory closer
to a device for faster DMA transactions.

Cc: Alexander Graf 
Cc: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
Signed-off-by: Nicolas Ojeda Leon 
---
Notes:
  v5:
  - Added "Acked-by" tag

 .../PciHostBridgeUtilityLib.c | 316 +-
 .../PciHostBridgeUtilityLib.inf   |   1 +
 2 files changed, 312 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
index 92e1ea812f..4bd4671f10 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
@@ -12,13 +12,16 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #pragma pack(1)
 typedef struct {
@@ -189,7 +192,9 @@ PciHostBridgeUtilityUninitRootBridge (
 }
 
 /**
-  Utility function to return all the root bridge instances in an array.
+  Utility function to scan PCI root bridges and create instances for those
+  that are found not empty. Populate their resources from the default
+  provided parameters and return all the root bridge instances in an array.
 
   @param[out] Count  The number of root bridge instances.
 
@@ -217,9 +222,9 @@ PciHostBridgeUtilityUninitRootBridge (
 
   @returnAll the root bridge instances in an array.
 **/
+STATIC
 PCI_ROOT_BRIDGE *
-EFIAPI
-PciHostBridgeUtilityGetRootBridges (
+PciHostBridgeUtilityGetRootBridgesBusScan (
   OUT UINTN *Count,
   IN  UINT64Attributes,
   IN  UINT64AllocationAttributes,
@@ -243,8 +248,6 @@ PciHostBridgeUtilityGetRootBridges (
   UINTN LastRootBridgeNumber;
   UINTN RootBridgeNumber;
 
-  *Count = 0;
-
   if ((BusMin > BusMax) || (BusMax > PCI_MAX_BUS)) {
 DEBUG ((
   DEBUG_ERROR,
@@ -403,6 +406,309 @@ FreeBridges:
   return NULL;
 }
 
+/**
+  Utility function to read root bridges information from host-provided fw-cfg
+  file and return them in an array.
+
+  @param[out] Count   The number of root bridge instances.
+
+  @return All the root bridge instances in an array parsed from
+  host-provided fw-cfg file (hardware-info).
+**/
+STATIC
+PCI_ROOT_BRIDGE *
+PciHostBridgeUtilityGetRootBridgesHostProvided (
+  OUT UINTN  *Count
+  )
+{
+  EFI_STATUSStatus;
+  FIRMWARE_CONFIG_ITEM  FwCfgItem;
+  UINTN FwCfgSize;
+  PCI_ROOT_BRIDGE   *Bridges;
+  UINTN Initialized;
+  UINTN LastRootBridgeNumber;
+  UINTN RootBridgeNumber;
+  UINTN PciHostBridgeCount;
+  UINT8 *HardwareInfoBlob;
+  LIST_ENTRYHwInfoList;
+  LIST_ENTRY*HwLink;
+  HARDWARE_INFO *HwInfo;
+  UINT64Attributes;
+  UINT64AllocationAttributes;
+  BOOLEAN   DmaAbove4G;
+  BOOLEAN   NoExtendedConfigSpace;
+  BOOLEAN   CombineMemPMem;
+  PCI_ROOT_BRIDGE_APERTURE  Io;
+  PCI_ROOT_BRIDGE_APERTURE  Mem;
+  PCI_ROOT_BRIDGE_APERTURE  MemAbove4G;
+  PCI_ROOT_BRIDGE_APERTURE  PMem;
+  PCI_ROOT_BRIDGE_APERTURE  PMemAbove4G;
+
+  //
+  // Initialize 

Re: [edk2-devel] [edk2-platforms][PATCH v1 00/10] Add variableFlashInfoLib

2022-04-25 Thread Michael Kubacki
Thanks for pointing those out. It looks like ArmVExpress.dsc.inc can 
include it for both of those platforms. I'll add that in a V2.


Regards,
Michael

On 4/25/2022 12:06 PM, Sami Mujawar wrote:

Hi Michael,

There are other platforms in edk2-platforms that would possibly require 
similar changes.


e.g. Platform\ARM\VExpressPkg\ArmVExpress-FVP-AArch64.dsc, 
Platform\ARM\JunoPkg\ArmJuno.dsc, etc.


Do you plan to submit patches to update these platforms as well?

Regards,

Sami Mujawar

On 20/04/2022 09:44 pm, mikub...@linux.microsoft.com wrote:

From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Note that this series is for an upcoming change in MdeModulePkg
and requires that change to be present locally for testing.

https://edk2.groups.io/g/devel/message/88787

Cc: Abner Chang 
Cc: Ard Biesheuvel 
Cc: Chasel Chiu 
Cc: Daniel Schaefer 
Cc: Eric Dong 
Cc: Gilbert Chen 
Cc: Graeme Gregory 
Cc: Ilias Apalodimas 
Cc: Jeremy Linton 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Masami Hiramatsu 
Cc: Nate DeSimone 
Cc: Radoslaw Biernacki 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 

Michael Kubacki (10):
   OverdriveBoard: Add VariableFlashInfoLib
   BeagleBoardPkg: Add VariableFlashInfoLib
   MinPlatformPkg: Add VariableFlashInfoLib
   CelloBoard: Add VariableFlashInfoLib
   SbsaQemu: Add VariableFlashInfoLib
   RaspberryPi: Add VariableFlashInfoLib
   U5SeriesPkg: Add VariableFlashInfoLib
   Socionext: Add VariableFlashInfoLib
   Softiron: Add VariableFlashInfoLib
   PlatformStandaloneMmPkg: Add VariableFlashInfoLib

  
Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
| 1 +
  
Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc 
| 1 +
  
Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
| 1 +
  
Platform/LeMaker/CelloBoard/CelloBoard.dsc 
| 1 +
  
Platform/Qemu/SbsaQemu/SbsaQemu.dsc
| 1 +
  
Platform/RaspberryPi/RPi3/RPi3.dsc 
| 1 +
  
Platform/RaspberryPi/RPi4/RPi4.dsc 
| 1 +
  
Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc 
| 1 +
  
Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc   
| 1 +
  
Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   
| 1 +
  
Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
| 1 +
  
Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc 
| 1 +

  12 files changed, 12 insertions(+)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89290): https://edk2.groups.io/g/devel/message/89290
Mute This Topic: https://groups.io/mt/90592905/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 2/8] MdeModulePkg/VariableFlashInfoLib: Add initial library

2022-04-25 Thread Michael Kubacki

Thanks for your review. I will make that change.

Regards,
Michael

On 4/25/2022 12:05 PM, Sami Mujawar wrote:

Hi Michael,

I have a minor suggestion marked inline as [SAMI].

Otherwise this patch looks good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote:

From: Michael Kubacki 

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

Adds a new library class VariableFlashInfoLib that abstracts access
to variable flash information. The instance provided first attempts
to retrieve information from the Variable Flash Info HOB. If that
HOB is not present, it falls back to the PCDs defined in
MdeModulePkg.

This fall back behavior provides backward compatibility for platforms
that only provide PCDs but also allows platforms that need to
dynamically provide the information using the Variable Flash Info HOB
to do so at runtime.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
  
MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c   
| 178 
  
MdeModulePkg/Include/Library/VariableFlashInfoLib.h
|  68 
  
MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf 
|  48 ++
  
MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.uni 
|  12 ++
  
MdeModulePkg/MdeModulePkg.dec  
|   4 +
  
MdeModulePkg/MdeModulePkg.dsc  
|   2 +

  6 files changed, 312 insertions(+)

diff --git 
a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c 
b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c 


new file mode 100644
index ..a1db97bdf218
--- /dev/null
+++ 
b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c 


@@ -0,0 +1,178 @@
+/** @file
+  Variable Flash Information Library
+
+  Copyright (c) Microsoft Corporation
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Get the HOB that contains variable flash information.
+
+  @param[out] VariableFlashInfo   Pointer to a pointer to set to the 
variable flash information structure.

+
+  @retval EFI_SUCCESS Variable flash information was 
found successfully.
+  @retval EFI_INVALID_PARAMETER   The VariableFlashInfo pointer given 
is NULL.
+  @retval EFI_NOT_FOUND   Variable flash information could 
not be found.

+
+**/
+EFI_STATUS
+GetVariableFlashInfoFromHob (
+  OUT VARIABLE_FLASH_INFO  **VariableFlashInfo
+  )

[SAMI] Can this function be made STATIC, please?

+{
+  EFI_HOB_GUID_TYPE  *GuidHob;
+
+  if (VariableFlashInfo == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  GuidHob = GetFirstGuidHob (&gVariableFlashInfoHobGuid);
+  if (GuidHob == NULL) {
+    return EFI_NOT_FOUND;
+  }
+
+  *VariableFlashInfo = GET_GUID_HOB_DATA (GuidHob);
+
+  //
+  // Assert if more than one variable flash information HOB is present.
+  //
+  DEBUG_CODE (
+    if ((GetNextGuidHob (&gVariableFlashInfoHobGuid, GET_NEXT_HOB 
(GuidHob)) != NULL)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: Found two variable flash information 
HOBs\n"));

+    ASSERT (FALSE);
+  }
+
+    );
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the NV storage area used for UEFI 
variable storage.

+
+  @param[out] BaseAddress    The NV storage base address.
+  @param[out] Length The NV storage length in bytes.
+
+  @retval EFI_SUCCESS NV storage information was found 
successfully.

+  @retval EFI_INVALID_PARAMETER   A required pointer parameter is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariableFlashNvStorageInfo (
+  OUT EFI_PHYSICAL_ADDRESS  *BaseAddress,
+  OUT UINT64    *Length
+  )
+{
+  EFI_STATUS   Status;
+  VARIABLE_FLASH_INFO  *VariableFlashInfo;
+
+  if ((BaseAddress == NULL) || (Length == NULL)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
+  if (!EFI_ERROR (Status)) {
+    *BaseAddress = VariableFlashInfo->NvVariableBaseAddress;
+    *Length  = VariableFlashInfo->NvVariableLength;
+  } else {
+    *BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 
(PcdFlashNvStorageVariableBase64) != 0 ?
+  PcdGet64 
(PcdFlashNvStorageVariableBase64) :
+  PcdGet32 
(PcdFlashNvStorageVariableBase)

+  );
+    *Length = (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize);
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the fault tolerant write (FTW) spare
+  area used for UEFI variable storage.
+
+  @param[out] BaseAddress    The FTW spare base address.
+  @param[out] Length The FTW spare length in bytes.
+
+  @retval EFI_SUCCESS FTW spare information was found 
s

[edk2-devel] Now: Tools, CI, Code base construction meeting series - 04/25/2022 #cal-notice

2022-04-25 Thread devel@edk2.groups.io Calendar
*Tools, CI, Code base construction meeting series*

*When:*
04/25/2022
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://github.com/tianocore/edk2/discussions/2614

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1475883 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89292): https://edk2.groups.io/g/devel/message/89292
Mute This Topic: https://groups.io/mt/90697719/21656
Mute #cal-notice:https://edk2.groups.io/g/devel/mutehashtag/cal-notice
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/2] ShellPkg/SmbiosView: Print BIOS extension size

2022-04-25 Thread Abner Chang
Hi Roger,
There is an update for SMBIOS type 0 at commit ID fdfbf1fd-a85ae8d9. Please 
rebase the changes to edk2 master branch and send out the patch V2.
Thanks
Abner


From: Hsu, Roger (HPE ISS SW) 
Sent: Friday, April 22, 2022 2:55 PM
To: devel@edk2.groups.io 
Cc: Ray Ni ; Zhichao Gao ; Chang, 
Abner (HPS SW/FW Technologist) 
Subject: [PATCH 2/2] ShellPkg/SmbiosView: Print BIOS extension size

Update for printing BIOS extension size information.

Signed-off-by: Roger Hsu 
Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Abner Chang 
---
 .../SmbiosView/PrintInfo.c   | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index b144600a25..ee0dbc19be 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -3,7 +3,7 @@


   Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.

   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.

-  (C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP

+  (C) Copyright 2015-2022 Hewlett Packard Enterprise Development LP

   SPDX-License-Identifier: BSD-2-Clause-Patent



 **/

@@ -338,7 +338,15 @@ SmbiosPrintStructure (
   PRINT_PENDING_STRING (Struct, Type0, BiosVersion);

   PRINT_STRUCT_VALUE_H (Struct, Type0, BiosSegment);

   PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate);

-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * 
(Struct->Type0->BiosSize + 1));

+  if (Struct->Type0->BiosSize == EXCEED_BIOS_ROM_SIZE) {

+if (Struct->Type0->ExtendedBiosSize.Unit == 
BIOS_ROM_SIZE_IN_MEGABYTES) {

+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 
(BYTES_IN_MEGABYTES * (Struct->Type0->ExtendedBiosSize.Size)) / 
BYTES_IN_KILOBYTES);

+} else if (Struct->Type0->ExtendedBiosSize.Unit == 
BIOS_ROM_SIZE_IN_GIGABYTES) {

+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 
(BYTES_IN_GIGABYTES *(Struct->Type0->ExtendedBiosSize.Size)) / 
BYTES_IN_KILOBYTES);

+}

+  } else {

+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * 
(Struct->Type0->BiosSize + 1));

+  }



   DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 
*)(UINTN)&(Struct->Type0->BiosCharacteristics)), Option);



--
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89293): https://edk2.groups.io/g/devel/message/89293
Mute This Topic: https://groups.io/mt/90628978/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 0/1] SMM memory management: Inspect memory guarded with pool headers

2022-04-25 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3488

This patch series is a follow up of previous submission:
https://edk2.groups.io/g/devel/message/87618

v2 patches mainly focus on feedback for commits submitted in v1 patches:
a. Added reviewed-by tags;

Patch v2 branch: https://github.com/kuqin12/edk2/tree/mm_zero_sized_pool_v2

Cc: Jiewen Yao 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 

Kun Qin (1):
  MdeModulePkg: PiSmmCore: Inspect memory guarded with pool headers

 MdeModulePkg/Core/PiSmmCore/Pool.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.35.1.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89294): https://edk2.groups.io/g/devel/message/89294
Mute This Topic: https://groups.io/mt/90699122/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/1] MdeModulePkg: PiSmmCore: Inspect memory guarded with pool headers

2022-04-25 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3488

Current free pool routine from PiSmmCore will inspect memory guard status
for target buffer without considering pool headers. This could lead to
`IsMemoryGuarded` function to return incorrect results.

In that sense, allocating a 0 sized pool could cause an allocated buffer
directly points into a guard page, which is legal. However, trying to
free this pool will cause the routine changed in this commit to read XP
pages, which leads to page fault.

This change will inspect memory guarded with pool headers. This can avoid
errors when a pool content happens to be on a page boundary.

Cc: Jiewen Yao 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 

Signed-off-by: Kun Qin 
Reviewed-by: Jian J Wang 
Reviewed-by: Liming Gao 
---

Notes:
v2:
- Added reviewed-by tag [Jian]
- Added reviewed-by tag [Liming]

 MdeModulePkg/Core/PiSmmCore/Pool.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c 
b/MdeModulePkg/Core/PiSmmCore/Pool.c
index 96ebe811c669..e1ff40a8ea55 100644
--- a/MdeModulePkg/Core/PiSmmCore/Pool.c
+++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
@@ -382,11 +382,6 @@ SmmInternalFreePool (
 return EFI_INVALID_PARAMETER;
   }
 
-  MemoryGuarded = IsHeapGuardEnabled () &&
-  IsMemoryGuarded ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer);
-  HasPoolTail = !(MemoryGuarded &&
-  ((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
-
   FreePoolHdr = (FREE_POOL_HEADER *)((POOL_HEADER *)Buffer - 1);
   ASSERT (FreePoolHdr->Header.Signature == POOL_HEAD_SIGNATURE);
   ASSERT (!FreePoolHdr->Header.Available);
@@ -394,6 +389,11 @@ SmmInternalFreePool (
 return EFI_INVALID_PARAMETER;
   }
 
+  MemoryGuarded = IsHeapGuardEnabled () &&
+  IsMemoryGuarded ((EFI_PHYSICAL_ADDRESS)(UINTN)FreePoolHdr);
+  HasPoolTail = !(MemoryGuarded &&
+  ((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
+
   if (HasPoolTail) {
 PoolTail = HEAD_TO_TAIL (&FreePoolHdr->Header);
 ASSERT (PoolTail->Signature == POOL_TAIL_SIGNATURE);
-- 
2.35.1.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89295): https://edk2.groups.io/g/devel/message/89295
Mute This Topic: https://groups.io/mt/90699123/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 0/8] Add Variable Flash Info HOB

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Platforms: This series introduces a new library class called
VariableFlashInfoLib. Platforms using the variable modules will
need to specify these library classes. See the patches at the
end of this series for examples of the change needed in the
platform DSC file. I have attempted to update all open-source
platforms in edk2 and edk2-platforms in this series and
https://edk2.groups.io/g/devel/message/89148.

The UEFI variable drivers such as VariableRuntimeDxe, VariableSmm,
VariableStandaloneMm, etc. (and their dependent protocol/library
stack), typically acquire UEFI variable store flash information
with PCDs declared in MdeModulePkg.

For example:
[Pcd]
  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize

These PCDs work as-is in the StandaloneMm driver if they are not
dynamic such as Dynamic or DynamicEx because PCD services are not
readily available in the Standalone MM environment. Platforms that
use Standalone MM today, must define these PCDs as FixedAtBuild in
their platform build. However, the PCDs do allow platforms to treat
the PCDs as Dynamic/DynamicEx and being able to support that is
currently a gap for Standalone MM.

This patch series introduces a HOB that can be produced by the
platform to provide the same information. The HOB list is
available to Standalone MM.

The PCD declarations are left as-is in MdeModulePkg for backward
compatibility. This means unless a platform wants to use the HOB,
their code will continue to work with no change (they do not need
to produce the HOB). Only if the HOB is found, is its value used
instead of the PCDs.

Due to the large number of consumers of this information, access
to the base address and size values is abstracted in a new library
class (as requested in the v1 series) called VariableFlashInfoLib.

The API of VariableFlashInfoLib does not bind the underlying data
structure to the information returned to library users to allow
flexibility in the library implementation in the future.

V5 changes.
1. Made GetVariableFlashInfoFromHob() in BaseVariableFlashInfoLib.c
   STATIC.
2. Added a section in commit v5 [3/8] to explicitly state that the
   commit introduces a dependency that requires a change in platform
   build.  Please see patches v5 [5/8] - v5 [8/8] for examples of
   how to integrate this change (add VariableFlashInfoLib library
   to DSC file).

V4 changes:
1. Add a UINT32 "Reserved" field to VARIABLE_FLASH_INFO.
2. Add a descriptive comment to VariableFlashInfo.h to explain
   HOB usage.

V3 changes:
1. To better clarify usage, renamed the members
   "NvStorageBaseAddress" and "NvStorageLength" in
   "VARIABLE_FLASH_INFO" to "NvVariableBaseAddress" and
   "NvVariableLength".
2. Added description comments to the fields in "VARIABLE_FLASH_INFO".

V2 changes:
1. Abstracted flash info data access with VariableFlashInfoLib.
2. Updated package builds in the repo that build the variable and
   FTW drivers to include VariableFlashInfoLib.
3. Removed a redundant variable assignment in VariableSmm.c.
4. Updated comments in FtwMisc.c and FaultTolerantWritePei.c to
   indicate driver assumption is UINTN (not UINT32)
5. Added a version field to the VARIABLE_FLASH_INFO structure.

Cc: Abner Chang 
Cc: Andrew Fish 
Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Benjamin You 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: Guo Dong 
Cc: Hao A Wu 
Cc: James Bottomley 
Cc: Jian J Wang 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Maurice Ma 
Cc: Min Xu 
Cc: Nickle Wang 
Cc: Peter Grehan 
Cc: Ray Ni 
Cc: Rebecca Cran 
Cc: Sami Mujawar 
Cc: Sean Rhodes 
Cc: Sebastien Boeuf 
Cc: Tom Lendacky 
Signed-off-by: Michael Kubacki 

Michael Kubacki (8):
  MdeModulePkg: Add Variable Flash Info HOB
  MdeModulePkg/VariableFlashInfoLib: Add initial library
  MdeModulePkg/Variable: Consume Variable Flash Info
  MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info
  ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib
  EmulatorPkg: Add VariableFlashInfoLib
  OvmfPkg: Add VariableFlashInfoLib
  UefiPayloadPkg: Add VariableFlashInfoLib

 MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c   
 | 179 
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
 |  41 +++--
 MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c  
 |   7 +-
 MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c   
 |  28 +--
 MdeModulePkg/Universal/Variable/Pei/Variable.c 
 |  14 +-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c   
 |  16 +-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c   
 |  14 +-
 MdeModulePkg/Univ

[edk2-devel] [PATCH v5 1/8] MdeModulePkg: Add Variable Flash Info HOB

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds a new GUID that is used to identify a HOB that passes variable
flash information to UEFI variable drivers in HOB consumption phases
such as DXE, Traditional MM, and Standalone MM.

This information was previously passed directly with PCDs such
as EfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
and gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize.

However, the Standalone MM variable driver instance does not have
direct access to the PCD database. Therefore, this HOB will first
be considered as the source for variable flash information and
if platforms do not produce the HOB, reading the information from
the PCDs directly will be a backup to provide backward
compatibility.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Sami Mujawar 
---
 MdeModulePkg/Include/Guid/VariableFlashInfo.h | 111 
 MdeModulePkg/MdeModulePkg.dec |   4 +
 2 files changed, 115 insertions(+)

diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h 
b/MdeModulePkg/Include/Guid/VariableFlashInfo.h
new file mode 100644
index ..992a0dcdd384
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h
@@ -0,0 +1,111 @@
+/** @file
+  This file defines the GUID and data structure used to pass information about
+  a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules
+  that consume that information such as the DXE and MM UEFI variable drivers.
+
+  The HOB described in this file is currently optional. It is primarily 
provided
+  to allow a platform to dynamically describe the flash information to 
environments
+  such as Standalone MM that cannot access the prior method using dynamic PCDs.
+
+  Even for platforms that use Standalone MM, if the information is only stored
+  statically such as with FixedAtBuild PCDs, the HOB is not required.
+
+  Every point of consumption in this package that uses the PCDs will first 
check
+  for the HOB and use its value if present.
+
+  Early modules such as the PEI UEFI variable driver might also consume this
+  information. For modules such as these, that execute early in the boot flow,
+  at least two approaches are possible depending on platform design.
+
+  1. If the information in the HOB exactly matches the information in the PCDs,
+ (i.e. the HOB values are set using the PCD values), let the driver read
+ the information from the PCD and produce the HOB later in boot.
+
+  2. Produce the HOB very early in boot. For example, the earliest point the 
HOB
+ is currently consumed is in FaultTolerantWritePei. Note that 
FaultTolerantWritePei
+ produces gEdkiiFaultTolerantWriteGuid which is a dependency for 
VariablePei.
+
+ Therefore, attaching a NULL class library to FaultTolerantWritePei with a
+ constructor that produces the HOB will guarantee it is produced before 
the first
+ point of consumption as the constructor is executed before the module 
entry point.
+
+  Copyright (c) Microsoft Corporation.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef VARIABLE_FLASH_INFO_H_
+#define VARIABLE_FLASH_INFO_H_
+
+#define VARIABLE_FLASH_INFO_HOB_GUID \
+  { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 
0x90 }}
+
+#define VARIABLE_FLASH_INFO_HOB_VERSION  1
+
+extern EFI_GUID  gVariableFlashInfoHobGuid;
+
+#pragma pack (push, 1)
+
+///
+/// This structure can be used to describe UEFI variable
+/// flash information.
+///
+typedef struct {
+  ///
+  /// Version of this structure.
+  ///
+  /// Increment the value when the structure is modified.
+  ///
+  UINT32  Version;
+  ///
+  /// Reserved field.
+  ///
+  /// Currently reserved for natural alignment.
+  ///
+  UINT32  Reserved;
+  ///
+  /// Base address of the non-volatile variable range in the flash device.
+  ///
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  EFI_PHYSICAL_ADDRESSNvVariableBaseAddress;
+  ///
+  /// Size of the non-volatile variable range in the flash device.
+  ///
+  /// Note that this value should be less than or equal to FtwSpareLength to 
support reclaim of
+  /// entire variable store area.
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  UINT64  NvVariableLength;
+  ///
+  /// Base address of the FTW spare block range in the flash device.
+  ///
+  /// Note that this address should align with the block size requirements of 
the flash device.
+  ///
+  EFI_PHYSICAL_ADDRESSFtwSpareBaseAddress;
+  ///
+  /// Size of the FTW spare block range in the flash device.
+  ///
+  /// Note that this value should be greater than or equal to NvVariableLength.
+  /// Note that this address should align with the block si

[edk2-devel] [PATCH v5 2/8] MdeModulePkg/VariableFlashInfoLib: Add initial library

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds a new library class VariableFlashInfoLib that abstracts access
to variable flash information. The instance provided first attempts
to retrieve information from the Variable Flash Info HOB. If that
HOB is not present, it falls back to the PCDs defined in
MdeModulePkg.

This fall back behavior provides backward compatibility for platforms
that only provide PCDs but also allows platforms that need to
dynamically provide the information using the Variable Flash Info HOB
to do so at runtime.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Sami Mujawar 
---
 MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c   | 
179 
 MdeModulePkg/Include/Library/VariableFlashInfoLib.h|  
68 
 MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf |  
48 ++
 MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.uni |  
12 ++
 MdeModulePkg/MdeModulePkg.dec  |   
4 +
 MdeModulePkg/MdeModulePkg.dsc  |   
2 +
 6 files changed, 313 insertions(+)

diff --git 
a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c 
b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c
new file mode 100644
index ..d5897225897b
--- /dev/null
+++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c
@@ -0,0 +1,179 @@
+/** @file
+  Variable Flash Information Library
+
+  Copyright (c) Microsoft Corporation
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Get the HOB that contains variable flash information.
+
+  @param[out] VariableFlashInfo   Pointer to a pointer to set to the variable 
flash information structure.
+
+  @retval EFI_SUCCESS Variable flash information was found 
successfully.
+  @retval EFI_INVALID_PARAMETER   The VariableFlashInfo pointer given is NULL.
+  @retval EFI_NOT_FOUND   Variable flash information could not be 
found.
+
+**/
+STATIC
+EFI_STATUS
+GetVariableFlashInfoFromHob (
+  OUT VARIABLE_FLASH_INFO  **VariableFlashInfo
+  )
+{
+  EFI_HOB_GUID_TYPE  *GuidHob;
+
+  if (VariableFlashInfo == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  GuidHob = GetFirstGuidHob (&gVariableFlashInfoHobGuid);
+  if (GuidHob == NULL) {
+return EFI_NOT_FOUND;
+  }
+
+  *VariableFlashInfo = GET_GUID_HOB_DATA (GuidHob);
+
+  //
+  // Assert if more than one variable flash information HOB is present.
+  //
+  DEBUG_CODE (
+if ((GetNextGuidHob (&gVariableFlashInfoHobGuid, GET_NEXT_HOB (GuidHob)) 
!= NULL)) {
+DEBUG ((DEBUG_ERROR, "ERROR: Found two variable flash information 
HOBs\n"));
+ASSERT (FALSE);
+  }
+
+);
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the NV storage area used for UEFI variable 
storage.
+
+  @param[out] BaseAddressThe NV storage base address.
+  @param[out] Length The NV storage length in bytes.
+
+  @retval EFI_SUCCESS NV storage information was found 
successfully.
+  @retval EFI_INVALID_PARAMETER   A required pointer parameter is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariableFlashNvStorageInfo (
+  OUT EFI_PHYSICAL_ADDRESS  *BaseAddress,
+  OUT UINT64*Length
+  )
+{
+  EFI_STATUS   Status;
+  VARIABLE_FLASH_INFO  *VariableFlashInfo;
+
+  if ((BaseAddress == NULL) || (Length == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
+  if (!EFI_ERROR (Status)) {
+*BaseAddress = VariableFlashInfo->NvVariableBaseAddress;
+*Length  = VariableFlashInfo->NvVariableLength;
+  } else {
+*BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 
(PcdFlashNvStorageVariableBase64) != 0 ?
+  PcdGet64 
(PcdFlashNvStorageVariableBase64) :
+  PcdGet32 
(PcdFlashNvStorageVariableBase)
+  );
+*Length = (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize);
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Get the base address and size for the fault tolerant write (FTW) spare
+  area used for UEFI variable storage.
+
+  @param[out] BaseAddressThe FTW spare base address.
+  @param[out] Length The FTW spare length in bytes.
+
+  @retval EFI_SUCCESS FTW spare information was found successfully.
+  @retval EFI_INVALID_PARAMETER   A required pointer parameter is NULL.
+  @retval EFI_NOT_FOUND   FTW spare information could not be found.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariableFlashFtwSpareInfo (
+  OUT EFI_PHYSICAL_ADDRESS  *BaseAddress,
+  OUT UINT64*Length
+  )
+{
+  EFI_STATUS   

[edk2-devel] [PATCH v5 3/8] MdeModulePkg/Variable: Consume Variable Flash Info

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Updates VariableRuntimeDxe, VariableSmm, and VariableStandaloneMm
to acquire variable flash information from the Variable Flash
Information library.

Note: This introduces a dependency on VariableFlashInfoLib in these
modules. Therefore, a platform building the variable modules must
specify an instance of VariableFlashInfoLib in their platform build.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Sami Mujawar 
---
 MdeModulePkg/Universal/Variable/Pei/Variable.c  | 14 
+-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c| 16 

 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c| 14 
++
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c| 17 
+
 MdeModulePkg/Universal/Variable/Pei/Variable.h  |  2 ++
 MdeModulePkg/Universal/Variable/Pei/VariablePei.inf |  5 ++---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h   |  7 
++-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf   |  5 ++---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf  |  5 ++---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf |  5 ++---
 10 files changed, 56 insertions(+), 34 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c 
b/MdeModulePkg/Universal/Variable/Pei/Variable.c
index b36dd0de67b2..26a4c73b45a5 100644
--- a/MdeModulePkg/Universal/Variable/Pei/Variable.c
+++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c
@@ -567,11 +567,13 @@ GetVariableStore (
   OUT VARIABLE_STORE_INFO  *StoreInfo
   )
 {
+  EFI_STATUSStatus;
   EFI_HOB_GUID_TYPE *GuidHob;
   EFI_FIRMWARE_VOLUME_HEADER*FvHeader;
   VARIABLE_STORE_HEADER *VariableStoreHeader;
   EFI_PHYSICAL_ADDRESS  NvStorageBase;
   UINT32NvStorageSize;
+  UINT64NvStorageSize64;
   FAULT_TOLERANT_WRITE_LAST_WRITE_DATA  *FtwLastWriteData;
   UINT32BackUpOffset;
 
@@ -591,11 +593,13 @@ GetVariableStore (
 // Emulated non-volatile variable mode is not enabled.
 //
 
-NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize);
-NvStorageBase = (EFI_PHYSICAL_ADDRESS)(PcdGet64 
(PcdFlashNvStorageVariableBase64) != 0 ?
-   PcdGet64 
(PcdFlashNvStorageVariableBase64) :
-   PcdGet32 
(PcdFlashNvStorageVariableBase)
-   );
+Status = GetVariableFlashNvStorageInfo (&NvStorageBase, 
&NvStorageSize64);
+ASSERT_EFI_ERROR (Status);
+
+Status = SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize);
+// This driver currently assumes the size will be UINT32 so assert the 
value is safe for now.
+ASSERT_EFI_ERROR (Status);
+
 ASSERT (NvStorageBase != 0);
 
 //
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
index 03fec3048dc4..d5c409c914d1 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
@@ -423,6 +423,8 @@ FtwNotificationEvent (
   EFI_PHYSICAL_ADDRESSVariableStoreBase;
   UINT64  VariableStoreLength;
   UINTN   FtwMaxBlockSize;
+  UINT32  NvStorageVariableSize;
+  UINT64  NvStorageVariableSize64;
 
   //
   // Ensure FTW protocol is installed.
@@ -432,14 +434,20 @@ FtwNotificationEvent (
 return;
   }
 
+  Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, 
&NvStorageVariableSize64);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUint32 (NvStorageVariableSize64, 
&NvStorageVariableSize);
+  // This driver currently assumes the size will be UINT32 so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
+
+  VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
+
   Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
   if (!EFI_ERROR (Status)) {
-ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
+ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);
   }
 
-  NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;
-  VariableStoreBase = NvStorageVariableBase + 
mNvFvHeaderCache->HeaderLength;
-
   //
   // Let NonVolatileVariableBase point to flash variable store base directly 
after FTW ready.
   //
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c 
b/MdeMod

[edk2-devel] [PATCH v5 4/8] MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds support to the UEFI variable fault tolerant write (FTW) drivers
to receive FTW base and size information dynamically via the Variable
Flash Information library.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Sami Mujawar 
---
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
 | 41 +---
 MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c  
 |  7 +++-
 MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c   
 | 28 -
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h  
 |  7 +++-
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 | 10 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf 
 | 10 +
 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 
| 10 +
 MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf 
 | 10 +
 8 files changed, 63 insertions(+), 60 deletions(-)

diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
index 661e1487673b..f1335870e797 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
@@ -987,22 +987,43 @@ InitFtwDevice (
   OUT EFI_FTW_DEVICE  **FtwData
   )
 {
-  EFI_FTW_DEVICE  *FtwDevice;
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  WorkSpaceAddress;
+  UINT64Size;
+  UINTN FtwWorkingSize;
+  EFI_FTW_DEVICE*FtwDevice;
+
+  FtwWorkingSize = 0;
+
+  Status = GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUintn (Size, &FtwWorkingSize);
+  // This driver currently assumes the size will be UINTN so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
 
   //
   // Allocate private data of this driver,
   // Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].
   //
-  FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + PcdGet32 
(PcdFlashNvStorageFtwWorkingSize));
+  FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + FtwWorkingSize);
   if (FtwDevice == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
+  FtwDevice->WorkSpaceAddress = WorkSpaceAddress;
+  FtwDevice->WorkSpaceLength  = FtwWorkingSize;
+
+  Status = GetVariableFlashFtwSpareInfo (&FtwDevice->SpareAreaAddress, &Size);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = SafeUint64ToUintn (Size, &FtwDevice->SpareAreaLength);
+  // This driver currently assumes the size will be UINTN so assert the value 
is safe for now.
+  ASSERT_EFI_ERROR (Status);
+
   //
   // Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE.
   //
-  FtwDevice->WorkSpaceLength = (UINTN)PcdGet32 
(PcdFlashNvStorageFtwWorkingSize);
-  FtwDevice->SpareAreaLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpareSize);
   if ((FtwDevice->WorkSpaceLength == 0) || (FtwDevice->SpareAreaLength == 0)) {
 DEBUG ((DEBUG_ERROR, "Ftw: Workspace or Spare block does not exist!\n"));
 FreePool (FtwDevice);
@@ -1015,16 +1036,6 @@ InitFtwDevice (
   FtwDevice->FtwWorkSpaceLba = (EFI_LBA)(-1);
   FtwDevice->FtwSpareLba = (EFI_LBA)(-1);
 
-  FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 
(PcdFlashNvStorageFtwWorkingBase64);
-  if (FtwDevice->WorkSpaceAddress == 0) {
-FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 
(PcdFlashNvStorageFtwWorkingBase);
-  }
-
-  FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 
(PcdFlashNvStorageFtwSpareBase64);
-  if (FtwDevice->SpareAreaAddress == 0) {
-FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 
(PcdFlashNvStorageFtwSpareBase);
-  }
-
   *FtwData = FtwDevice;
   return EFI_SUCCESS;
 }
@@ -1277,7 +1288,7 @@ InitFtwProtocol (
   FtwDevice->FtwLastWriteHeader = NULL;
   FtwDevice->FtwLastWriteRecord = NULL;
 
-  InitializeLocalWorkSpaceHeader ();
+  InitializeLocalWorkSpaceHeader (FtwDevice->WorkSpaceLength);
 
   //
   // Refresh the working space data from working block
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
index 61e7a92ccea1..fd563643eb63 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
@@ -16,10 +16,13 @@ EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER  
mWorkingBlockHeader = { ZERO_GUID, 0, 0
 
   Since Signature and WriteQueueSize have been known, Crc can be calculated 
out,
   then the work space header will be fixed.
+
+  @param[in]  WorkSpaceLength Length in bytes of the FTW workspace area.
+
 **/
 VOID
 InitializeLocalWorkSpaceHead

[edk2-devel] [PATCH v5 5/8] ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Cc: Gerd Hoffmann 
Cc: Julien Grall 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Sami Mujawar 
---
 ArmVirtPkg/ArmVirt.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index ba711deac025..988c1eb75529 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -177,6 +177,7 @@ [LibraryClasses.common]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89302): https://edk2.groups.io/g/devel/message/89302
Mute This Topic: https://groups.io/mt/90699681/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 04/26/2022 #cal-reminder

2022-04-25 Thread devel@edk2.groups.io Calendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Groups.io Inc//Groups.io Calendar//EN
METHOD:PUBLISH
REFRESH-INTERVAL;VALUE=DURATION:PT1H
X-PUBLISHED-TTL:PT1H
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
LAST-MODIFIED:20220317T223602Z
TZURL:http://tzurl.org/zoneinfo-outlook/America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZNAME:PDT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
DTSTART:19700308T02
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:PST
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
DTSTART:19701101T02
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
X-GIOIDS:Event:1238724 
UID:mlda.1580078539586725120.r...@groups.io
DTSTAMP:20220426T013002Z
ORGANIZER;CN=Liming Gao:mailto:gaolim...@byosoft.com.cn
DTSTART:20220427T013000Z
DTEND:20220427T023000Z
SUMMARY:TianoCore Bug Triage - APAC / NAMO
DESCRIPTION:TianoCore Bug Triage - APAC / NAMO\n\nHosted by Liming Gao\n\
 n
 \n\nMicrosoft Teams meeting\n\n*Join on your computer or mobile a
 pp*\n\nClick here to join the meeting ( https://teams.microsoft.com/l/mee
 tup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40
 thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255
 d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d )\n\n*Jo
 in with a video conferencing device*\n\nte...@conf.intel.com\n\nVideo Con
 ference ID: 116 062 094 0\n\nAlternate VTC dialing instructions ( https:/
 /conf.intel.com/teams/?conf=1160620940&ivr=teams&d=conf.intel.com&test=te
 st_call )\n\n*Or call in (audio only)*\n\n+1 916-245-6934\,\,77463821# ( 
 tel:+19162456934\,\,77463821# ) United States\, Sacramento\n\nPhone Confe
 rence ID: 774 638 21#\n\nFind a local number ( https://dialin.teams.micro
 soft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821 ) | Reset PIN (
  https://mysettings.lync.com/pstnconferencing )\n\nLearn More ( https://a
 ka.ms/JoinTeamsMeeting ) | Meeting options ( https://teams.microsoft.com/
 meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e&tenantId
 =46c98d88-e344-4ed4-8496-4ed7712e255d&threadId=19_meeting_OTUyZTg2NjgtNDh
 lNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2&messageId=0&language=en-US )
LOCATION:https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN
 2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%2
 2%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-
 1242-431b-9a51-92cd01a5df3c%22%7d
SEQUENCE:2
END:VEVENT
END:VCALENDAR


invite.ics
Description: application/ics


[edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Min Xu 
Cc: Peter Grehan 
Cc: Rebecca Cran 
Cc: Sebastien Boeuf 
Cc: Tom Lendacky 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Rebecca Cran 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 1 +
 OvmfPkg/Bhyve/BhyveX64.dsc   | 1 +
 OvmfPkg/CloudHv/CloudHvX64.dsc   | 1 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 +
 OvmfPkg/Microvm/MicrovmX64.dsc   | 1 +
 OvmfPkg/OvmfPkgIa32.dsc  | 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc   | 1 +
 OvmfPkg/OvmfPkgX64.dsc   | 1 +
 OvmfPkg/OvmfXen.dsc  | 1 +
 9 files changed, 9 insertions(+)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index f0700035c116..bead9722eab8 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -196,6 +196,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
 !if $(BUILD_SHELL) == TRUE
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index a8fa4d38ab60..d33728cbe773 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -207,6 +207,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
   #
   # Network libraries
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index d1c85f60c768..92664f319be2 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -217,6 +217,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
 
   #
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 73a6c30096a8..01e0ae0ad40a 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -185,6 +185,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 20c3c9c4d862..f8fc977cb205 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -207,6 +207,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index f02b371f7427..892ed6c64cf1 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -214,6 +214,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
 
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index cb68e612bd35..d3a80cb56892 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -218,6 +218,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib

[edk2-devel] [PATCH v5 6/8] EmulatorPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Abner Chang 
---
 EmulatorPkg/EmulatorPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 554c13ddb500..4cf886b9eac7 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -122,6 +122,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89303): https://edk2.groups.io/g/devel/message/89303
Mute This Topic: https://groups.io/mt/90699683/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 8/8] UefiPayloadPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Guo Dong 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 17b30589e77c..4d9bbc80c866 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -272,6 +272,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89305): https://edk2.groups.io/g/devel/message/89305
Mute This Topic: https://groups.io/mt/90699686/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 3/4] CryptoPkg: Make EC source file config-able

2022-04-25 Thread yi1 li
Hi Pierre,

Python Basetools module has enabled this feature recently, and this modules has 
updated to 0.17, just as pip-requirements.txt:
https://github.com/tianocore/edk2-basetools/commit/74460f5e33ef3e3790797e069095fc12003f0d00
https://github.com/tianocore/edk2/commit/c411566fad3d6d61a97edfa6e97a91688b175201

Please make sure your code is latest, and the python pip module is updated.

Regards,
Yi 

-Original Message-
From: Pierre Gondois  
Sent: Monday, April 25, 2022 11:53 PM
To: devel@edk2.groups.io; Li, Yi1 ; Yao, Jiewen 
; Feng, Bob C ; Sami Mujawar 

Subject: Re: [edk2-devel] [PATCH 3/4] CryptoPkg: Make EC source file config-able

Hello Yi1, Jiewen, and Bob,

As you mentioned in the cover letter, this patch relies on the following patch 
bf9230a9f3dd ("BaseTools: Add the FeatureFlagExpression usage to the Source 
Section")
https://github.com/tianocore/edk2/commit/bf9230a9f3dde065c3c8b4175ccd32e44e8f0362

I just wanted to signal that this patch is currently not in 
https://github.com/tianocore/edk2-basetools
It is thus not in any edk2basetools python module: the latest version of the 
edk2-basetools python module won't support the new build feature (cf 
pip-requirements.txt).
Thus someone who:
-relies on the edk2basetools python module -tries to build an edk2 module 
relying on OpenSSL will have a build break.

For instance, I get the following error when building:
build -a AARCH64 -t GCC5 -p SecurityPkg/SecurityPkg.dsc ...
"[some_path]/edk2/BaseTools/Bin/gcc_aarch64_linux_extdep/bin/aarch64-none-linux-gnu-gcc"
  
@[some_path]/Build/SbsaQemu/DEBUG_GCC5/AARCH64/CryptoPkg/Library/OpensslLib/OpensslLib/OUTPUT/cc_resp.txt
  -c -o 
[some_path]/Build/SbsaQemu/DEBUG_GCC5/AARCH64/CryptoPkg/Library/OpensslLib/OpensslLib/OUTPUT/openssl/crypto/ec/curve25519.obj
  [some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/curve25519.c
In file included from 
[some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/curve25519.c:11:
[some_path]/edk2/CryptoPkg/Library/OpensslLib/openssl/crypto/ec/ec_local.h:48:24:
 error: unknown type name ‘EC_GROUP’
48 | int (*group_init) (EC_GROUP *);

This is due to the build system trying to build a file in 
$(OPENSSL_PATH)/crypto/ec/* even though 
gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled is set to FALSE by default. The new 
Pcd feature to build files conditionally on a Pcd value is not handled yet.
The edk2 CI doesn't seem to build modules relying on OpenSSL due to the 
CONTINUOUS_INTEGRATION flag, explaining why the patch passed the CI I think.

I added Bob as I think he knows more about BaseTools.

Regards,
Pierre

On 4/18/22 15:03, yi1 li via groups.io wrote:
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828
> 
> Use PCD gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled to config-able source 
> files list in OpensslLib.inf and OpensslLibCrypto.inf.
> If PcdEcEnabled equals to FALSE, this file will not be compiled.
> 
> Signed-off-by: yi1 li 
> ---
>   CryptoPkg/CryptoPkg.dec   |  4 +
>   .../Library/Include/openssl/opensslconf.h |  7 +-
>   CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 95 ++-
>   .../Library/OpensslLib/OpensslLibCrypto.inf   | 95 ++-
>   4 files changed, 108 insertions(+), 93 deletions(-)
> 
> diff --git a/CryptoPkg/CryptoPkg.dec b/CryptoPkg/CryptoPkg.dec index 
> 5888941bab4c..ebec64050b71 100644
> --- a/CryptoPkg/CryptoPkg.dec
> +++ b/CryptoPkg/CryptoPkg.dec
> @@ -81,5 +81,9 @@
> # @ValidList 0x8001 | 0x0001, 0x0002, 0x0004, 0x0008, 
> 0x0010
> 
> gEfiCryptoPkgTokenSpaceGuid.PcdHashApiLibPolicy|0x0002|UINT32|0x00
> 01
>   
> +  ## Enable/Disable the ECC feature in openssl library. The default is 
> disabled.
> +  #  If ECC feature is disabled, all related source files will not be 
> compiled.
> +  gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled|FALSE|BOOLEAN|0x003
> +
>   [UserExtensions.TianoCore."ExtraFiles"]
> CryptoPkgExtra.uni
> diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h 
> b/CryptoPkg/Library/Include/openssl/opensslconf.h
> index 7ea976b2252e..1485b8c9f108 100644
> --- a/CryptoPkg/Library/Include/openssl/opensslconf.h
> +++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
> @@ -9,7 +9,7 @@
>* in the file LICENSE in the source distribution or at
>* https://www.openssl.org/source/license.html
>*/
> -
> +#include 
>   #include 
>   
>   #ifdef  __cplusplus
> @@ -55,6 +55,11 @@ extern "C" {
>   #ifndef OPENSSL_NO_DSA
>   #define OPENSSL_NO_DSA
>   #endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +  #ifndef OPENSSL_NO_EC
> +#define OPENSSL_NO_EC
> +  #endif
> +#endif
>   #ifndef OPENSSL_NO_IDEA
>   #define OPENSSL_NO_IDEA
>   #endif
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
> b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> index 1d67ed55e1b1..459ac4864a4e 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +++ b/Cryp

Re: [edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib

2022-04-25 Thread Yao, Jiewen
Reviewed-by: Jiewen Yao 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> Kubacki
> Sent: Tuesday, April 26, 2022 9:29 AM
> To: devel@edk2.groups.io
> Cc: Anthony Perard ; Ard Biesheuvel
> ; Brijesh Singh ; Aktas,
> Erdem ; Gerd Hoffmann ;
> James Bottomley ; Yao, Jiewen ;
> Justen, Jordan L ; Julien Grall ; 
> Xu,
> Min M ; Peter Grehan ; Rebecca
> Cran ; Boeuf, Sebastien ;
> Tom Lendacky ; Ard Biesheuvel
> ; Gao, Liming 
> Subject: [edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib
> 
> From: Michael Kubacki 
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479
> 
> Adds an instance of VariableFlashInfoLib to the platform build as
> it is a new library class introduced in MdeModulePkg.
> 
> Cc: Anthony Perard 
> Cc: Ard Biesheuvel 
> Cc: Brijesh Singh 
> Cc: Erdem Aktas 
> Cc: Gerd Hoffmann 
> Cc: James Bottomley 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Julien Grall 
> Cc: Min Xu 
> Cc: Peter Grehan 
> Cc: Rebecca Cran 
> Cc: Sebastien Boeuf 
> Cc: Tom Lendacky 
> Signed-off-by: Michael Kubacki 
> Acked-by: Ard Biesheuvel 
> Reviewed-by: Liming Gao 
> Reviewed-by: Rebecca Cran 
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc | 1 +
>  OvmfPkg/Bhyve/BhyveX64.dsc   | 1 +
>  OvmfPkg/CloudHv/CloudHvX64.dsc   | 1 +
>  OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 +
>  OvmfPkg/Microvm/MicrovmX64.dsc   | 1 +
>  OvmfPkg/OvmfPkgIa32.dsc  | 1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc   | 1 +
>  OvmfPkg/OvmfPkgX64.dsc   | 1 +
>  OvmfPkg/OvmfXen.dsc  | 1 +
>  9 files changed, 9 insertions(+)
> 
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc
> b/OvmfPkg/AmdSev/AmdSevX64.dsc
> index f0700035c116..bead9722eab8 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc
> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
> @@ -196,6 +196,7 @@ [LibraryClasses]
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
> f
> 
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
> lePolicyHelperLib.inf
> +
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
> iableFlashInfoLib.inf
> 
>  !if $(BUILD_SHELL) == TRUE
>ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index a8fa4d38ab60..d33728cbe773 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -207,6 +207,7 @@ [LibraryClasses]
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
> f
> 
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
> lePolicyHelperLib.inf
> +
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
> iableFlashInfoLib.inf
> 
>#
># Network libraries
> diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> b/OvmfPkg/CloudHv/CloudHvX64.dsc
> index d1c85f60c768..92664f319be2 100644
> --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> @@ -217,6 +217,7 @@ [LibraryClasses]
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
> f
> 
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
> lePolicyHelperLib.inf
> +
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
> iableFlashInfoLib.inf
> 
> 
>#
> diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
> b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
> index 73a6c30096a8..01e0ae0ad40a 100644
> --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
> +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
> @@ -185,6 +185,7 @@ [LibraryClasses]
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
> f
> 
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
> lePolicyHelperLib.inf
> +
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
> iableFlashInfoLib.inf
> 
>ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
>ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
> diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc
> b/OvmfPkg/Microvm/MicrovmX64.dsc
> index 20c3c9c4d862..f8fc977cb205 100644
> --- a/OvmfPkg/Microvm/MicrovmX64.dsc
> +++ b/OvmfPkg/Microvm/MicrovmX64.dsc
> @@ -207,6 +207,7 @@ [LibraryClasses]
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
> f
> 
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
> lePolicyHelperLib.inf
> +
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
> iableFlashInfoLib.inf
> 
> 
>#
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index f02b371f7427..892ed6c64cf1 100644
> --- a/OvmfPkg/Ovm

[edk2-devel] [edk2-platforms][PATCH v2 00/11] Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Note that this series is for an upcoming change in MdeModulePkg
and requires that change to be present locally for testing.

https://edk2.groups.io/g/devel/message/89296

V2 Changes:
- Add patch "VExpressPkg: Add VariableFlashInfoLib"

Cc: Abner Chang 
Cc: Ard Biesheuvel 
Cc: Chasel Chiu 
Cc: Daniel Schaefer 
Cc: Eric Dong 
Cc: Gilbert Chen 
Cc: Graeme Gregory 
Cc: Ilias Apalodimas 
Cc: Jeremy Linton 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Masami Hiramatsu 
Cc: Nate DeSimone 
Cc: Radoslaw Biernacki 
Cc: Sami Mujawar 
Cc: Thomas Abraham 
Signed-off-by: Michael Kubacki 

Michael Kubacki (11):
  OverdriveBoard: Add VariableFlashInfoLib
  BeagleBoardPkg: Add VariableFlashInfoLib
  MinPlatformPkg: Add VariableFlashInfoLib
  CelloBoard: Add VariableFlashInfoLib
  SbsaQemu: Add VariableFlashInfoLib
  RaspberryPi: Add VariableFlashInfoLib
  U5SeriesPkg: Add VariableFlashInfoLib
  Socionext: Add VariableFlashInfoLib
  Softiron: Add VariableFlashInfoLib
  PlatformStandaloneMmPkg: Add VariableFlashInfoLib
  VExpressPkg: Add VariableFlashInfoLib

 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 1 
+
 Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc   | 1 
+
 Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc | 1 
+
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc| 1 
+
 Platform/LeMaker/CelloBoard/CelloBoard.dsc | 1 
+
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc| 1 
+
 Platform/RaspberryPi/RPi3/RPi3.dsc | 1 
+
 Platform/RaspberryPi/RPi4/RPi4.dsc | 1 
+
 Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc | 1 
+
 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc   | 1 
+
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   | 1 
+
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc| 1 
+
 Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 1 
+
 13 files changed, 13 insertions(+)

-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89308): https://edk2.groups.io/g/devel/message/89308
Mute This Topic: https://groups.io/mt/90700334/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 01/11] OverdriveBoard: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index fceb8b64dfde..236e8f1db3dd 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -125,6 +125,7 @@ [LibraryClasses.common]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
 
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89309): https://edk2.groups.io/g/devel/message/89309
Mute This Topic: https://groups.io/mt/90700335/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 02/11] BeagleBoardPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc
index 7df306045d12..2de49fc0932c 100644
--- a/Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/Platform/BeagleBoard/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -137,6 +137,7 @@ [LibraryClasses.common]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89310): https://edk2.groups.io/g/devel/message/89310
Mute This Topic: https://groups.io/mt/90700336/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 03/11] MinPlatformPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
index c3d05fc913a7..58a18fae6ec8 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
@@ -169,5 +169,6 @@ [LibraryClasses.common]
   
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
 
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89311): https://edk2.groups.io/g/devel/message/89311
Mute This Topic: https://groups.io/mt/90700337/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 04/11] CelloBoard: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/LeMaker/CelloBoard/CelloBoard.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc 
b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
index 11d989cf3463..6be8062e60f6 100644
--- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
+++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
@@ -119,6 +119,7 @@ [LibraryClasses.common]
   
RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
   TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
 
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89312): https://edk2.groups.io/g/devel/message/89312
Mute This Topic: https://groups.io/mt/90700340/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 05/11] SbsaQemu: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Graeme Gregory 
Cc: Radoslaw Biernacki 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index 1d1a25196e22..97014e2fb630 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -163,6 +163,7 @@ [LibraryClasses.common]
   PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
 
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89313): https://edk2.groups.io/g/devel/message/89313
Mute This Topic: https://groups.io/mt/90700342/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 06/11] RaspberryPi: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Jeremy Linton 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
Tested-by: Jeremy Linton 
Reviewed-by: Jeremy Linton 
---
 Platform/RaspberryPi/RPi3/RPi3.dsc | 1 +
 Platform/RaspberryPi/RPi4/RPi4.dsc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc 
b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 6dc48dc23302..0eed03c097f8 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -174,6 +174,7 @@ [LibraryClasses.common]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc 
b/Platform/RaspberryPi/RPi4/RPi4.dsc
index a9c0c36bb12b..eabddd7382cf 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -174,6 +174,7 @@ [LibraryClasses.common]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89314): https://edk2.groups.io/g/devel/message/89314
Mute This Topic: https://groups.io/mt/90700344/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 07/11] U5SeriesPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Abner Chang 
Cc: Gilbert Chen 
Cc: Daniel Schaefer 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
Reviewed-by: Abner Chang 
---
 Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc   | 1 +
 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc 
b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
index 318851332a7f..7b36b2c885e0 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
@@ -100,6 +100,7 @@ [LibraryClasses]
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 # RISC-V Platform Library
diff --git 
a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc 
b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
index 98a6a69ca3ec..26895a75ec2f 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
@@ -100,6 +100,7 @@ [LibraryClasses]
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 # RISC-V Platform Library
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89315): https://edk2.groups.io/g/devel/message/89315
Mute This Topic: https://groups.io/mt/90700346/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 08/11] Socionext: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Masami Hiramatsu 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
index 690cdef9d91c..a052de49c958 100644
--- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
+++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
@@ -128,6 +128,7 @@ [LibraryClasses.common]
 
   NorFlashInfoLib|EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
 
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.common.SEC]
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89316): https://edk2.groups.io/g/devel/message/89316
Mute This Topic: https://groups.io/mt/90700347/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 09/11] Softiron: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
---
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc 
b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
index 25fafca51852..37ce04f6a9e3 100644
--- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
+++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
@@ -121,6 +121,7 @@ [LibraryClasses.common]
   
RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
   TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
 
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89317): https://edk2.groups.io/g/devel/message/89317
Mute This Topic: https://groups.io/mt/90700349/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v2 10/11] PlatformStandaloneMmPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Sami Mujawar 
Cc: Ilias Apalodimas 
Signed-off-by: Michael Kubacki 
Reviewed-by: Michael D Kinney 
Reviewed-by: Sami Mujawar 
---
 Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 1 
+
 1 file changed, 1 insertion(+)

diff --git 
a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc 
b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
index 33364deb1ef0..653029c52fdb 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
@@ -34,6 +34,7 @@ [LibraryClasses]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89318): https://edk2.groups.io/g/devel/message/89318
Mute This Topic: https://groups.io/mt/90700350/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

2022-04-25 Thread Yao, Jiewen
Hi Corvin
According to the process, we need
1) Reviewed-by from package maintainer. (or)
2) Reviewed-by from feature review + Acked-by from package maintainer.

You got 4 Acked-by now, including package maintainer.
We need one Reviewed-by at least, from either Bhyve reviewer or Ovmf maintainer.

Since I do not know enough on Bhyve, I will delegate to Bhyve reviewer or Ard.

Thank you
Yao Jiewen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Corvin
> Köhne
> Sent: Monday, April 25, 2022 7:54 PM
> Cc: Ard Biesheuvel ; Justen, Jordan L
> ; devel@edk2.groups.io; FreeBSD Virtualization
> ; Yao, Jiewen ;
> Gerd Hoffmann ; Rebecca Cran ;
> Peter Grehan 
> Subject: Re: [edk2-devel] [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for
> QemuFwCfg
> 
> Hi,
> 
> does it require more review to get merged?
> 
> 
> Best regards
> Corvin
> 
> Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans
> Beckhoff
> Registered office: Verl, Germany | Register court: Guetersloh HRA 7075
> 
> 
> -Original Message-
> From: Corvin Köhne 
> Sent: Friday, April 8, 2022 10:15 AM
> Cc: Corvin Köhne ; Corvin Köhne
> ; Ard Biesheuvel ;
> Jordan Justen ; devel@edk2.groups.io; FreeBSD
> Virtualization ; Jiewen Yao
> ; Gerd Hoffmann ; Rebecca Cran
> ; Peter Grehan 
> Subject: [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg
> 
> From: Corvin Köhne 
> 
> QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl
> decided to use the same IO ports as QemuFwCfg. It's not possible to use
> both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl.
> 
> Signed-off-by: Corvin Köhne 
> Acked-by: Gerd Hoffmann 
> Acked-by: Rebecca Cran 
> Acked-by: Peter Grehan 
> Acked-by: Jiewen Yao 
> CC: Ard Biesheuvel 
> CC: Jordan Justen 
> CC: devel@edk2.groups.io
> CC: FreeBSD Virtualization 
> ---
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
>  OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 -
> --
>  OvmfPkg/Bhyve/BhyveX64.dsc|  4 +--
>  3 files changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
> b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
> index 595fd055f9..94c65f32dc 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
> @@ -43,6 +43,7 @@
>MemoryAllocationLib
>OrderedCollectionLib
>PcdLib
> +  QemuFwCfgLib
>UefiBootServicesTableLib
>UefiDriverEntryPoint
>UefiLib
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> index 8e80aa33e1..e216a21bfa 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> @@ -11,6 +11,41 @@
>  #include 
>  #include 
>  #include 
> +#include  // QemuFwCfgFindFile()
> +
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +BhyveGetCpuCount (
> +  OUT UINT32  *CpuCount
> +  )
> +{
> +  FIRMWARE_CONFIG_ITEM  Item;
> +  UINTN Size;
> +
> +  if (QemuFwCfgIsAvailable ()) {
> +if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
> +  return EFI_NOT_FOUND;
> +} else if (Size != sizeof (*CpuCount)) {
> +  return EFI_BAD_BUFFER_SIZE;
> +}
> +
> +QemuFwCfgSelectItem (Item);
> +QemuFwCfgReadBytes (Size, CpuCount);
> +
> +return EFI_SUCCESS;
> +  }
> +
> +  //
> +  // QemuFwCfg not available, try BhyveFwCtl.
> +  //
> +  Size = sizeof (*CpuCount);
> +  if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
> +return EFI_SUCCESS;
> +  }
> +
> +  return EFI_UNSUPPORTED;
> +}
> 
>  STATIC
>  EFI_STATUS
> @@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
>)
>  {
>UINT32   CpuCount;
> -  UINTNcSize;
>UINTNNewBufferSize;
>EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
>EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE  *LocalApic;
> @@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
>ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
> 
>// Query the host for the number of vCPUs
> -  CpuCount = 0;
> -  cSize= sizeof (CpuCount);
> -  if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
> +  Status = BhyveGetCpuCount (&CpuCount);
> +  if (!EFI_ERROR (Status)) {
>  DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
>  ASSERT (CpuCount >= 1);
>} else {
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 5fa08bebd7..14070fd6dd 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -163,8 +163,7 @@
> 
> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/D
> xeSecurityManagementLib.inf
>UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
> 
> SerializeVariablesLib|OvmfPkg/Library/Serializ

[edk2-devel] [edk2-platforms][PATCH v2 11/11] VExpressPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
From: Michael Kubacki 

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

Adds an instance for the library class VariableFlashInfoLib that
was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform
changes.

Cc: Ard Biesheuvel 
Cc: Thomas Abraham 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 
---
 Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
index 3866b785..e637f8933f79 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
@@ -155,6 +155,7 @@ [LibraryClasses.common]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89320): https://edk2.groups.io/g/devel/message/89320
Mute This Topic: https://groups.io/mt/90700352/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib

2022-04-25 Thread Michael Kubacki
Thanks Jiewen. I added this R-b (and all others) to the V5 PR here: 
https://github.com/tianocore/edk2/pull/2828


Regards,
Michael

On 4/25/2022 10:14 PM, Yao, Jiewen wrote:

Reviewed-by: Jiewen Yao 


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael
Kubacki
Sent: Tuesday, April 26, 2022 9:29 AM
To: devel@edk2.groups.io
Cc: Anthony Perard ; Ard Biesheuvel
; Brijesh Singh ; Aktas,
Erdem ; Gerd Hoffmann ;
James Bottomley ; Yao, Jiewen ;
Justen, Jordan L ; Julien Grall ; Xu,
Min M ; Peter Grehan ; Rebecca
Cran ; Boeuf, Sebastien ;
Tom Lendacky ; Ard Biesheuvel
; Gao, Liming 
Subject: [edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib

From: Michael Kubacki 

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

Adds an instance of VariableFlashInfoLib to the platform build as
it is a new library class introduced in MdeModulePkg.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Min Xu 
Cc: Peter Grehan 
Cc: Rebecca Cran 
Cc: Sebastien Boeuf 
Cc: Tom Lendacky 
Signed-off-by: Michael Kubacki 
Acked-by: Ard Biesheuvel 
Reviewed-by: Liming Gao 
Reviewed-by: Rebecca Cran 
---
  OvmfPkg/AmdSev/AmdSevX64.dsc | 1 +
  OvmfPkg/Bhyve/BhyveX64.dsc   | 1 +
  OvmfPkg/CloudHv/CloudHvX64.dsc   | 1 +
  OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 +
  OvmfPkg/Microvm/MicrovmX64.dsc   | 1 +
  OvmfPkg/OvmfPkgIa32.dsc  | 1 +
  OvmfPkg/OvmfPkgIa32X64.dsc   | 1 +
  OvmfPkg/OvmfPkgX64.dsc   | 1 +
  OvmfPkg/OvmfXen.dsc  | 1 +
  9 files changed, 9 insertions(+)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc
b/OvmfPkg/AmdSev/AmdSevX64.dsc
index f0700035c116..bead9722eab8 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -196,6 +196,7 @@ [LibraryClasses]
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
f

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
lePolicyHelperLib.inf
+
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
iableFlashInfoLib.inf

  !if $(BUILD_SHELL) == TRUE
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index a8fa4d38ab60..d33728cbe773 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -207,6 +207,7 @@ [LibraryClasses]
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
f

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
lePolicyHelperLib.inf
+
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
iableFlashInfoLib.inf

#
# Network libraries
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
b/OvmfPkg/CloudHv/CloudHvX64.dsc
index d1c85f60c768..92664f319be2 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -217,6 +217,7 @@ [LibraryClasses]
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
f

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
lePolicyHelperLib.inf
+
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
iableFlashInfoLib.inf


#
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 73a6c30096a8..01e0ae0ad40a 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -185,6 +185,7 @@ [LibraryClasses]
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
f

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
lePolicyHelperLib.inf
+
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
iableFlashInfoLib.inf

ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc
b/OvmfPkg/Microvm/MicrovmX64.dsc
index 20c3c9c4d862..f8fc977cb205 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -207,6 +207,7 @@ [LibraryClasses]
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.in
f

VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Variab
lePolicyHelperLib.inf
+
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVar
iableFlashInfoLib.inf


#
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index f02b371f7427..892ed6c64cf1 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -214,6 +214,7 @@ [LibraryClasses]
VarCheckLib|MdeModu

Re: [edk2-devel] [PATCH v4] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

2022-04-25 Thread Rebecca Cran

Reviewed-by: Rebecca Cran 


Maybe I'm misunderstanding, but the commit message looks wrong: there's 
no OvmfPkg/BhyveBhfPkg - it's OvmfPkg/Bhyve .


--
Rebecca Cran

On 4/8/22 02:15, Corvin Köhne wrote:

From: Corvin Köhne 

QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl
decided to use the same IO ports as QemuFwCfg. It's not possible to use
both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl.

Signed-off-by: Corvin Köhne 
Acked-by: Gerd Hoffmann 
Acked-by: Rebecca Cran 
Acked-by: Peter Grehan 
Acked-by: Jiewen Yao 
CC: Ard Biesheuvel 
CC: Jordan Justen 
CC: devel@edk2.groups.io
CC: FreeBSD Virtualization 
---
  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
  OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 ---
  OvmfPkg/Bhyve/BhyveX64.dsc|  4 +--
  3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 595fd055f9..94c65f32dc 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -43,6 +43,7 @@
MemoryAllocationLib
OrderedCollectionLib
PcdLib
+  QemuFwCfgLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index 8e80aa33e1..e216a21bfa 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -11,6 +11,41 @@
  #include 
  #include 
  #include 
+#include  // QemuFwCfgFindFile()
+
+STATIC
+EFI_STATUS
+EFIAPI
+BhyveGetCpuCount (
+  OUT UINT32  *CpuCount
+  )
+{
+  FIRMWARE_CONFIG_ITEM  Item;
+  UINTN Size;
+
+  if (QemuFwCfgIsAvailable ()) {
+if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
+  return EFI_NOT_FOUND;
+} else if (Size != sizeof (*CpuCount)) {
+  return EFI_BAD_BUFFER_SIZE;
+}
+
+QemuFwCfgSelectItem (Item);
+QemuFwCfgReadBytes (Size, CpuCount);
+
+return EFI_SUCCESS;
+  }
+
+  //
+  // QemuFwCfg not available, try BhyveFwCtl.
+  //
+  Size = sizeof (*CpuCount);
+  if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
+return EFI_SUCCESS;
+  }
+
+  return EFI_UNSUPPORTED;
+}
  
  STATIC

  EFI_STATUS
@@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
)
  {
UINT32   CpuCount;
-  UINTNcSize;
UINTNNewBufferSize;
EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE  *LocalApic;
@@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
  
// Query the host for the number of vCPUs

-  CpuCount = 0;
-  cSize= sizeof (CpuCount);
-  if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
+  Status = BhyveGetCpuCount (&CpuCount);
+  if (!EFI_ERROR (Status)) {
  DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
  ASSERT (CpuCount >= 1);
} else {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 5fa08bebd7..14070fd6dd 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,8 +163,7 @@

SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf

SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
-  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
-  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf

MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -355,6 +354,7 @@
  !endif
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
  
  [LibraryClasses.common.UEFI_APPLICATION]

PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89322): https://edk2.groups.io/g/devel/message/89322
Mute This Topic: https://groups.io/mt/90331362/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add FADT duty offset and width PCDs

2022-04-25 Thread Michael Kubacki
Thanks Chasel. I pushed a branch rebased on the latest master branch 
with R-b tags here in case that helps with merging:


https://github.com/makubacki/edk2-platforms/commits/active/add_duty_pcds_minplatformpkg_v1_rb1

Regards,
Michael

On 4/25/2022 12:08 AM, Chiu, Chasel wrote:


Thanks Michael!
For this patch series: Reviewed-by: Chasel Chiu 



-Original Message-
From: mikub...@linux.microsoft.com 
Sent: Tuesday, April 12, 2022 4:58 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L
; Gao, Liming
; Dong, Eric 
Subject: [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add FADT duty
offset and width PCDs

From: Michael Kubacki 

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

Adds PCDs to the MinPlatformPkg DEC file so MinPlatformPkg consumers
(board packages) can customize the DUTY_OFFSET and DUTY_CYCLE values
in their build files.

The copy of AcpiPlatform in SimicsOpenBoardPkg is also updated to keep
the change in sync with the source MinPlatformPkg module.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 

Michael Kubacki (3):
   MinPlatformPkg: Add FADT duty offset and duty width PCDs
   MinPlatformPkg/AcpiPlatform: Use FADT duty offset and width PCDs
   SimicsOpenBoardPkg/AcpiPlatform: Use FADT duty offset and width PCDs

  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
|  3 +++
  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c
|  4 ++--

Platform/Intel/SimicsOpenBoardPkg/AcpiTables/MinPlatformAcpiTables/Ac
piPlatform.c   |  3 +++

Platform/Intel/SimicsOpenBoardPkg/AcpiTables/MinPlatformAcpiTables/Fa
dt/Fadt.c  |  4 ++--
  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
|  2 ++
  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec  
  |
15 +++

Platform/Intel/SimicsOpenBoardPkg/AcpiTables/MinPlatformAcpiTables/Ac
piPlatform.inf |  2 ++
  7 files changed, 29 insertions(+), 4 deletions(-)

--
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89323): https://edk2.groups.io/g/devel/message/89323
Mute This Topic: https://groups.io/mt/90405218/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] BaseTools/Conf: Fix Dynamic-Library-File template

2022-04-25 Thread Bob Feng
This patch looks good to me.

Reviewed-by: Bob Feng 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Jake Garver via 
groups.io
Sent: Friday, April 8, 2022 1:04 AM
To: devel@edk2.groups.io; jbra...@nvidia.com; ashishsin...@nvidia.com
Cc: Jake Garver 
Subject: [edk2-devel] [PATCH] BaseTools/Conf: Fix Dynamic-Library-File template

In the Dynamic-Library-File template, add missing output file declarations.  
These files are generated by the template and other rules explicitly depend on 
them.

This change resolves missing dependency issues we encountered while running a 
recursive make with job control.

Signed-off-by: Jake Garver 
---
 BaseTools/Conf/build_rule.template | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index f401182344..4356623512 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -366,6 +366,8 @@
 
 
 $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
+$(DEBUG_DIR)(+)$(MODULE_NAME).efi
+$(OUTPUT_DIR)(+)$(MODULE_NAME).map
 
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
--
2.17.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89324): https://edk2.groups.io/g/devel/message/89324
Mute This Topic: https://groups.io/mt/90317800/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] Bug 3898 - S3 Resume result in executing garbage address

2022-04-25 Thread Wang, Jian J
Reviewed-by: Jian J Wang 

Regards,
Jian

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of cbduggap
> Sent: Monday, April 25, 2022 12:39 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH] Bug 3898 - S3 Resume result in executing garbage
> address
> 
> In Release Build, Trying to execute ppi Function even after
> Locate ppi failed.
> 
> Signed-off-by: cbduggap 
> ---
>  MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
> b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
> index 2c19f1a507..d7f02df5f5 100644
> --- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
> +++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
> @@ -288,6 +288,7 @@ DxeLoadCore (
>  EFI_ERROR_CODE | EFI_ERROR_MAJOR,
> 
>  (EFI_SOFTWARE_PEI_MODULE |
> EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND)
> 
>  );
> 
> +  CpuDeadLoop ();
> 
>  }
> 
> 
> 
>  ASSERT_EFI_ERROR (Status);
> 
> --
> 2.36.0.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#89252): https://edk2.groups.io/g/devel/message/89252
> Mute This Topic: https://groups.io/mt/90678471/1768734
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [jian.j.w...@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89325): https://edk2.groups.io/g/devel/message/89325
Mute This Topic: https://groups.io/mt/90678471/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 0/6] OvmfPkg/VirtioGpuDxe: use host display resolution

2022-04-25 Thread Ard Biesheuvel
On Mon, 25 Apr 2022 at 12:38, Ard Biesheuvel  wrote:
>
> On Mon, 25 Apr 2022 at 12:36, Gerd Hoffmann  wrote:
> >
> > On Fri, Apr 08, 2022 at 10:23:27AM +0200, Gerd Hoffmann wrote:
> > > QemuVideoDxe recently got support for picking up
> > > display resolution configuration from the host.
> > > This series does the same for VirtioGpuDxe.
> > >
> > > v3:
> > >  - rebase to latest master.
> >
> > Ping.  Anything blocking the merge id this series?
> >
>
> No, I'll pick these up today.

Merged as #2826

Thanks,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89326): https://edk2.groups.io/g/devel/message/89326
Mute This Topic: https://groups.io/mt/90331439/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-