Re: [edk2-devel] [PATCH] NanhuDev:Add BOSC NanhuDev platform

2024-03-13 Thread Sunil V L
Hi Ran,

On Mon, Mar 11, 2024 at 12:29:53PM +0800, Ran Wang wrote:
> Hi Sunil,
> 
> On 2024/3/8 19:44, Sunil V L wrote:
> > On Fri, Mar 08, 2024 at 12:31:26AM -0800, WangYang wrote:
> > > Hi,Sunil V L
> > > 
> > >  How about this status.
> > > 
> > > 
> > > > -原始邮件-
> > > > 发件人: WangYang 
> > > > 发送时间: 2024-02-28 14:34:11 (星期三)
> > > > 收件人: devel@edk2.groups.io, suni...@ventanamicro.com
> > > > 抄送: "Yang Wang" , "Ran Wang" , 
> > > > "YunFeng Yang" , "YaXing Guo" 
> > > > , "Bamvor Jian ZHANG" 
> > > > 主题: [edk2-devel] [PATCH] NanhuDev:Add BOSC NanhuDev platform
> > > > 
> > > > This commit adds the initial support for BOSC's
> > > > nanhu platform which provides up to 2 RISC-V RV64
> > > > processor cores.
> > > > 
> > Somehow I missed this when you sent first. What do you mean by "initial
> > support" here?
> > 
> 
> The "initial" means so far we only support minimal system (CPU + UART), will
> integrate more periphrals in the future.
> 
Okay. Can you boot an OS with this minimal support? Why not add full
support itself? Since the structure needs to be reviewed, it would be
better to have complete picture IMO.

> > Looks like you are following old integrated opensbi approach.
> > If so, I recommend you to look at payload design. You can see Sophgo
> > board as reference.
> 
> Thanks for advices, so we need to rebase our work on
> Silicon/Sophgo/SG2042Pkg/Sec/Sec* rather than
> RISC-V/PlatformPkg/Universal/Sec/Riscv64/Sec*, right?
> 
Yes. It is better to use edk2 as a payload for opensbi.

> > Also, please remember to CC all maintainers as per Maintainers.txt.
> 
> Does the "all maintainers" mean all mentioned in Maintainers.txt, or just
> RISC-V related?
> 
You need to copy the overall maintainers for edk2-platforms repo (Mike
and Leif). They need to approve the structure for your platforms. Then
you can copy RISC-V maintainers. Add one patch to update the maintainers
for your platform as well.

Thanks,
Sunil


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




[edk2-devel] [PATCH v3 4/4] DynamicTablesPkg: Adds ACPI SSDT HPET Table generator

2024-03-13 Thread Abdul Lateef Attar via groups.io
From: Abdul Lateef Attar 

Adds generic ACPI SSDT HPET table generator library.
Register/Deregister HPET table.
Adds ACPI namespace object for HPET device.
Adds Address space for HPET device.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Signed-off-by: Abdul Lateef Attar 
---
 DynamicTablesPkg/DynamicTables.dsc.inc|   2 +
 DynamicTablesPkg/Include/AcpiTableGenerator.h |   2 +
 .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 ++
 .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 ++
 4 files changed, 331 insertions(+)
 create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc
index 477dc6b6a9..fc2ac5962e 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -36,6 +36,7 @@
   DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
   DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
   DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
+  DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -46,6 +47,7 @@
   NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
   NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
   NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
+  NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
   }
 
 [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h 
b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index a32ef46ecb..ef651aa2aa 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,7 @@
 /** @file
 
   Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -101,6 +102,7 @@ typedef enum StdAcpiTableId {
   EStdAcpiTableIdPcct,  ///< PCCT Generator
   EStdAcpiTableIdHpet,  ///< HPET Generator
   EStdAcpiTableIdWsmt,  ///< WSMT Generator
+  EStdAcpiTableIdSsdtHpet,  ///< SSDT HPET Generator
   EStdAcpiTableIdMax
 } ESTD_ACPI_TABLE_ID;
 
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf 
b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
new file mode 100644
index 00..4dd0a60baf
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
@@ -0,0 +1,32 @@
+## @file
+#  SSDT HPET Table Generator
+#
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 1.27
+  BASE_NAME  = AcpiSsdtHpetLib
+  FILE_GUID  = 85262912-AD7F-4EE0-8BB1-EE177275A54E
+  VERSION_STRING = 1.0
+  MODULE_TYPE= DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR= AcpiSsdtHpetLibConstructor
+  DESTRUCTOR = AcpiSsdtHpetLibDestructor
+
+[Sources]
+  SsdtHpetGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  AcpiHelperLib
+  AmlLib
+  BaseLib
+  DebugLib
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c 
b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
new file mode 100644
index 00..5e4f935af8
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
@@ -0,0 +1,295 @@
+/** @file
+  SSDT HPET Table Generator
+
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Reference(s):
+  - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+#define SB_SCOPE  "\\_SB_"
+
+/** This macro expands to a function that retrieves the
+HPET base address from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceArch,
+  EArchObjHpetBaseAddress,
+  CM_ARCH_HPET_BASE_ADDRESS
+  );
+
+/** Construct the SSDT HPET devices Table.
+
+  This function invokes the Configuration Manager protocol interface
+  to get the required hardware information for generating the ACPI
+  table if required.
+
+  If this function allocates any resources then they must be freed
+  in the FreeTableResources function.
+
+  @param [in]  This   Pointer to the 

[edk2-devel] [PATCH v3 3/4] DynamicTablesPkg: Adds ACPI WSMT Table generator

2024-03-13 Thread Abdul Lateef Attar via groups.io
From: Abdul Lateef Attar 

Adds generic ACPI WSMT table generator library.
Register/Deregister WSMT table.
Update the WSMT table during boot as per specification.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Signed-off-by: Abdul Lateef Attar 
---
 DynamicTablesPkg/DynamicTables.dsc.inc|   2 +
 DynamicTablesPkg/Include/AcpiTableGenerator.h |   1 +
 .../Include/ArchNameSpaceObjects.h|  11 +
 .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +++
 .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++
 5 files changed, 287 insertions(+)
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc
index b2ef36eb8a..477dc6b6a9 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -35,6 +35,7 @@
   #
   DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
   DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
+  DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -44,6 +45,7 @@
 
   NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
   NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
+  NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
   }
 
 [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h 
b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index 18b5f99f47..a32ef46ecb 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -100,6 +100,7 @@ typedef enum StdAcpiTableId {
   EStdAcpiTableIdSsdtPciExpress,///< SSDT Pci Express Generator
   EStdAcpiTableIdPcct,  ///< PCCT Generator
   EStdAcpiTableIdHpet,  ///< HPET Generator
+  EStdAcpiTableIdWsmt,  ///< WSMT Generator
   EStdAcpiTableIdMax
 } ESTD_ACPI_TABLE_ID;
 
diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
index b90e573a88..8b16056ba1 100644
--- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -40,6 +40,7 @@ typedef enum ArchObjectID {
   EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity 
information
   EArchObjFadtMiscInfo,   ///< 13 - Legacy fields; RTC, latency, flush 
stride, etc
   EArchObjHpetBaseAddress,///< 14 - HPET Base Address
+  EArchObjWsmtProtectionFlags,///< 15 - WSMT protection flags
   EArchObjMax
 } E_ARCH_OBJECT_ID;
 
@@ -223,4 +224,14 @@ typedef struct CmArchFadtMiscInfo {
 typedef struct CmArchHpetBaseAddress {
   UINT64BaseAddress;
 } CM_ARCH_HPET_BASE_ADDRESS;
+
+/** A structure that describes the
+protection flags for the WSMT fields information.
+
+ID: EArchObjWsmtProtectionFlags
+*/
+typedef struct CmArchWsmtProtectionFlags {
+  UINT32ProtectionFlags;
+} CM_ARCH_WSMT_PROTECTION_FLAGS;
+
 #endif
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf 
b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
new file mode 100644
index 00..80ddaf0ab4
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
@@ -0,0 +1,30 @@
+## @file
+#  WSMT Table Generator
+#
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 1.27
+  BASE_NAME  = AcpiWsmtLib
+  FILE_GUID  = D6C34086-C914-4F8E-B56A-08329B4D1271
+  VERSION_STRING = 1.0
+  MODULE_TYPE= DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR= AcpiWsmtLibConstructor
+  DESTRUCTOR = AcpiWsmtLibDestructor
+
+[Sources]
+  WsmtGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c 
b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
new file mode 100644
index 00..a63b4b4859
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
@@ -0,0 +1,243 @@
+/** @file
+  WSMT Table Generator
+
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Reference(s):
+  - ACPI 6.5 Specification, Aug 29, 2022
+  - WSMT spec, version 1.0, April 18, 2016
+
https://msdn.microsoft.com/windows/hardware/drivers/bringup/acpi-system-description-tables#wsmt
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table 

[edk2-devel] [PATCH v3 1/4] DynamicTablesPkg: Adds ACPI FADT Table generator

2024-03-13 Thread Abdul Lateef Attar via groups.io
From: Abdul Lateef Attar 

Adds generic ACPI FADT table generator library.
Register/Deregister FADT table.
Adds Arch namespace ids.
Update the FADT table during boot as per specification.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Signed-off-by: Abdul Lateef Attar 
---
 DynamicTablesPkg/DynamicTables.dsc.inc|  10 +-
 DynamicTablesPkg/DynamicTablesPkg.ci.yaml |   4 +-
 .../Include/ArchNameSpaceObjects.h| 217 +
 .../Include/ConfigurationManagerObject.h  |   6 +
 .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf  |  36 +
 .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
 .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++
 .../Library/Acpi/AcpiFadtLib/FadtUpdate.h |  26 +
 .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
 9 files changed, 1113 insertions(+), 2 deletions(-)
 create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc
index 19ca62d6a8..92f3a138e4 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -30,11 +30,19 @@
   #
   DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
 
+  #
+  # Generators
+  #
+  DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+
 [Components.IA32, Components.X64]
   #
   # Dynamic Table Factory Dxe
   #
-  DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+  DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
+
+  NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+  }
 
 [Components.ARM, Components.AARCH64]
   #
diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml 
b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
index 42829f393e..1ad5540e24 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
+++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
@@ -128,7 +128,9 @@
"TABLEEX",
"TNSID",
"Vatos",
-   "WBINVD"
+   "WBINVD",
+   "NAMESPACEID",
+   "aswell"
],   # words to extend to the dictionary for this package
 "IgnoreStandardPaths": [],   # Standard Plugin defined paths that
  # should be ignore
diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
new file mode 100644
index 00..b421c4cd29
--- /dev/null
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -0,0 +1,217 @@
+/** @file
+  ARCH Name space object definations.
+
+  Defines namespace objects which are common across platform.
+  Platform can implements these optional namespace depends on
+  their requirements.
+
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+- Std or STD - Standard
+**/
+
+#ifndef ARCH_NAMESPACE_OBJECTS_H_
+#define ARCH_NAMESPACE_OBJECTS_H_
+
+#include 
+#include 
+
+/** The E_ARCH_OBJECT_ID enum describes the Object IDs
+in the ARCH Namespace
+*/
+typedef enum ArchObjectID {
+  EArchObjReserved,   ///<  0 - Reserved
+  EArchObjFadtPreferredPmProfile, ///<  1 - Preferred Power Management Profile 
Info
+  EArchObjFadtSciInterrupt,   ///<  2 - SCI Interrupt information
+  EArchObjFadtSciCmdInfo, ///<  3 - SCI CMD information
+  EArchObjFadtPmBlockInfo,///<  4 - Power management block info
+  EArchObjFadtGpeBlockInfo,   ///<  5 - GPE block info
+  EArchObjFadtXpmBlockInfo,   ///<  6 - 64-bit Power Management block info
+  EArchObjFadtXgpeBlockInfo,  ///<  7 - 64-bit GPE block info
+  EArchObjFadtSleepBlockInfo, ///<  8 - SLEEP block info
+  EArchObjFadtResetBlockInfo, ///<  9 - Reset block info
+  EArchObjFadtFlags,  ///< 10 - FADT flags
+  EArchObjFadtArmBootArch,///< 11 - ARM boot arch information
+  EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity 
information
+  EArchObjFadtMiscInfo,   ///< 13 - Legacy fields; RTC, latency, flush 
stride, etc
+  EArchObjMax
+} E_ARCH_OBJECT_ID;
+
+/** A structure that describes the
+Power Management Profile Information for the Platform.
+
+ID: EArchObjFadtPreferredPmProfile
+*/
+typedef struct CmArchPreferredPmProfile {
+  /** This is the Preferred_PM_Profile field of the FADT Table
+  described in the ACPI Specification
+  */
+  UINT8PreferredPmProfile;
+} CM_ARCH_FADT_PREFERRED_PM_PROFILE;
+
+/** A 

[edk2-devel] [PATCH v3 2/4] DynamicTablesPkg: Adds ACPI HPET Table generator

2024-03-13 Thread Abdul Lateef Attar via groups.io
From: Abdul Lateef Attar 

Adds generic ACPI HPET table generator library.
Register/Deregister HPET table.
Update the HPET table during boot as per specification.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Signed-off-by: Abdul Lateef Attar 
---
 DynamicTablesPkg/DynamicTables.dsc.inc|   2 +
 DynamicTablesPkg/Include/AcpiTableGenerator.h |   1 +
 .../Include/ArchNameSpaceObjects.h|   9 +
 .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +++
 .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++
 5 files changed, 289 insertions(+)
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc
index 92f3a138e4..b2ef36eb8a 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -34,6 +34,7 @@
   # Generators
   #
   DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+  DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -42,6 +43,7 @@
   DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
 
   NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+  NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
   }
 
 [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h 
b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index d0eda011c3..18b5f99f47 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -99,6 +99,7 @@ typedef enum StdAcpiTableId {
   EStdAcpiTableIdSsdtCpuTopology,   ///< SSDT Cpu Topology
   EStdAcpiTableIdSsdtPciExpress,///< SSDT Pci Express Generator
   EStdAcpiTableIdPcct,  ///< PCCT Generator
+  EStdAcpiTableIdHpet,  ///< HPET Generator
   EStdAcpiTableIdMax
 } ESTD_ACPI_TABLE_ID;
 
diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
index b421c4cd29..b90e573a88 100644
--- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -39,6 +39,7 @@ typedef enum ArchObjectID {
   EArchObjFadtArmBootArch,///< 11 - ARM boot arch information
   EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity 
information
   EArchObjFadtMiscInfo,   ///< 13 - Legacy fields; RTC, latency, flush 
stride, etc
+  EArchObjHpetBaseAddress,///< 14 - HPET Base Address
   EArchObjMax
 } E_ARCH_OBJECT_ID;
 
@@ -214,4 +215,12 @@ typedef struct CmArchFadtMiscInfo {
   UINT8 Century;
 } CM_ARCH_FADT_MISC_INFO;
 
+/** A structure that describes the
+HPET Base Address.
+
+ID: EArchObjHpetBaseAddress
+*/
+typedef struct CmArchHpetBaseAddress {
+  UINT64BaseAddress;
+} CM_ARCH_HPET_BASE_ADDRESS;
 #endif
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf 
b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
new file mode 100644
index 00..f0441107fc
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
@@ -0,0 +1,31 @@
+## @file
+#  HPET Table Generator
+#
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 1.27
+  BASE_NAME  = AcpiHpetLib
+  FILE_GUID  = 4E75F653-C356-48B3-B32C-D1B901ECF90A
+  VERSION_STRING = 1.0
+  MODULE_TYPE= DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR= AcpiHpetLibConstructor
+  DESTRUCTOR = AcpiHpetLibDestructor
+
+[Sources]
+  HpetGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c 
b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
new file mode 100644
index 00..937879b7b3
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
@@ -0,0 +1,246 @@
+/** @file
+  HPET Table Generator
+
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Reference(s):
+  - ACPI 6.5 Specification, Aug 29, 2022
+  - HPET spec, version 1.0a
+
http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/software-developers-hpet-spec-1-0a.pdf
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+///
+/// HPET General Register Offsets
+///
+#define HPET_GENERAL_CAPABILITIES_ID_OFFSET  0x000
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table 

[edk2-devel] [PATCH v3 0/4] Adds generic FADT, HPET and WSMT table generators

2024-03-13 Thread Abdul Lateef Attar via groups.io
From: Abdul Lateef Attar 

PR: https://github.com/tianocore/edk2/pull/5468

V3: delta changes
  Restructure the code as the review comments.
  Added sanity check for WSMT flags.
  Added CM object for HPET base address.
V2: delta changes
  Addressed review comments
  Adds ACPI HPET table to add HPET to ACPI namespace
V1:
Adds new space for ArchNameSpaceObjects.
Adds generic FADT table generator.
Adds generic HPET table generator.
Adds generic WSMT table generator.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Cc: Abdul Lateef Attar 

Abdul Lateef Attar (4):
  DynamicTablesPkg: Adds ACPI FADT Table generator
  DynamicTablesPkg: Adds ACPI HPET Table generator
  DynamicTablesPkg: Adds ACPI WSMT Table generator
  DynamicTablesPkg: Adds ACPI SSDT HPET Table generator

 DynamicTablesPkg/DynamicTables.dsc.inc|  16 +-
 DynamicTablesPkg/DynamicTablesPkg.ci.yaml |   4 +-
 DynamicTablesPkg/Include/AcpiTableGenerator.h |   4 +
 .../Include/ArchNameSpaceObjects.h| 237 ++
 .../Include/ConfigurationManagerObject.h  |   6 +
 .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf  |  36 +
 .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
 .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++
 .../Library/Acpi/AcpiFadtLib/FadtUpdate.h |  26 +
 .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
 .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +
 .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++
 .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 +
 .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 +++
 .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +
 .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++
 16 files changed, 2020 insertions(+), 2 deletions(-)
 create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
 create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c

-- 
2.34.1



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




Re: [edk2-devel] [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Du Lin
> Sent: Thursday, March 14, 2024 10:02 AM
> To: devel@edk2.groups.io
> Cc: Lin, Du ; S, Ashraf Ali ; Chiu,
> Chasel ; Chen, Gang C ;
> Duggapu, Chinni B ; Desimone, Nathaniel L
> ; Zeng, Star ;
> Mohapatra, Susovan ; Kuo, Ted
> 
> Subject: [edk2-devel] [PATCH v2] IntelFsp2WrapperPkg: Error handling of
> FspmWrapperInit()
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701
> 
> The error handling of FspmWrapperInit() is limited to ASSERT
> statements only, which only works in debug builds, but not in
> release builds.
> Fix the issue by enhancing the error handling of FspmWrapperInit()
> to cover both debug builds and release builds.
> 
> Signed-off-by: Du Lin 
> Cc: Ashraf Ali S 
> Cc: Chasel Chiu 
> Cc: Chen Gang C 
> Cc: Duggapu Chinni B 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> Cc: Susovan Mohapatra 
> Cc: Ted Kuo 
> ---
>  IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c | 8
> 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> index ba0c742fea..7f1deb9542 100644
> --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> @@ -197,12 +197,20 @@ FspmWrapperInit (
> 
>MeasurementExcludedFvPpi = AllocatePool (sizeof
> (*MeasurementExcludedFvPpi));
>ASSERT (MeasurementExcludedFvPpi != NULL);
> +  if (MeasurementExcludedFvPpi == NULL) {
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +
>MeasurementExcludedFvPpi->Count  = 1;
>MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32
> (PcdFspmBaseAddress);
>MeasurementExcludedFvPpi->Fv[0].FvLength =
> ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32
> (PcdFspmBaseAddress))->FvLength;
> 
>MeasurementExcludedPpiList = AllocatePool (sizeof
> (*MeasurementExcludedPpiList));
>ASSERT (MeasurementExcludedPpiList != NULL);
> +  if (MeasurementExcludedPpiList == NULL) {
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +
>MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
>MeasurementExcludedPpiList->Guid  =
> 
>MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi;
> --
> 2.44.0.windows.1
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Du Lin
This patch has been updated to address Ray's comment. For more details, please 
check [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit() 
(groups.io) ( https://edk2.groups.io/g/devel/message/116723 ). Thanks Ray for 
the comment.


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




Re: [edk2-devel] [PATCH v1 00/26] Part 2 patch set to enable LoongArch virtual machine in edk2

2024-03-13 Thread Chao Li

Hi All,

I submitted this version a few days ago and any comments are very 
welcome, can you review this series?



Thanks,
Chao
On 2024/3/11 17:36, Chao Li wrote:

This patch set is the part 2 of enable LoongArch virtual machine and is
a continuation of the first patch series v8 submitted at:
https://edk2.groups.io/g/devel/message/114526.

Patch1-Patch4: Reorder some INF files located in UefiCpuPkg
alphabetically.

Patch5-Patch14: Added Timer, CpuMmuLib, CpuMmuInitLib, MpInitLib, CpuDxe
for LoongArch, and added some PCD and header files requested by the
above libraries and drivers.

Patch15-Patch25: LoongArch QEMU virtual machine private code, include
SEC and PEI phase, some libraries and drivers.

Patch26: Added LoongArchVirt's self introduction-file.

Modfied modules: UefiCpuPkg and OvmfPkg

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4584

PR:https://github.com/tianocore/edk2/pull/5208

Cc: Ray Ni
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Gerd Hoffmann
Cc: Leif Lindholm
Cc: Sami Mujawar
Cc: Sunil V L
Cc: Bibo Mao
Cc: Dongyan Qian

Chao Li (26):
   UefiCpuPkg/CpuTimerLib: Reorder the INF file alphabetically
   UefiCpuPkg/CpuExceptionHandlerLib: Reorder the INF files
 alphabetically
   UefiCpuPkg/MpInitLib: Reorder the INF files alphabetically
   UefiCpuPkg/CpuDxe: Reorder the INF file alphabetically
   UefiCpuPkg: Add LoongArch64 CPU Timer instance
   UefiCpuPkg: Add CPU exception library for LoongArch
   UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
   UefiCpuPkg: Added a new PCD named PcdCpuExceptionVectorBaseAddress
   UefiCpuPkg: Added a new PCD named PcdCpuMmuIsEnabled
   UefiCpuPkg: Add CpuMmuLib to UefiCpuPkg
   UefiCpuPkg: Add CpuMmuInitLib.h to UefiCpuPkg
   UefiCpuPkg: Add CpuMmuInitLib to UefiCpuPkg
   UefiCpuPkg: Add multiprocessor library for LoongArch64
   UefiCpuPkg: Add CpuDxe driver for LoongArch64
   OvmfPkg/LoongArchVirt: Add stable timer driver
   OvmfPkg/LoongArchVirt: Add a NULL library named
 CollectApResouceLibNull
   OvmfPkg/LoongArchVirt: Add serial port hook library
   OvmfPkg/LoongArchVirt: Add the early serial port output library
   OvmfPkg/LoongArchVirt: Add real time clock library
   OvmfPkg/LoongArchVirt: Add NorFlashQemuLib
   OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib
   OvmfPkg/LoongArchVirt: Add reset system library
   OvmfPkg/LoongArchVirt: Support SEC phase
   OvmfPkg/LoongArchVirt: Support PEI phase
   OvmfPkg/LoongArchVirt: Add build file
   OvmfPkg/LoongArchVirt: Add self introduction file

  .../Drivers/StableTimerDxe/Timer.c|  381 
  .../Drivers/StableTimerDxe/Timer.h|  127 ++
  .../Drivers/StableTimerDxe/TimerDxe.inf   |   41 +
  .../CollectApResourceLibNull.c|   38 +
  .../CollectApResourceLibNull.inf  |   31 +
  .../CollectApResourceLibNull.uni  |9 +
  .../EarlyFdtSerialPortLib16550.c  |  815 +
  .../EarlyFdtSerialPortLib16550.inf|   46 +
  .../EarlyFdt16550SerialPortHookLib.c  |   52 +
  .../EarlyFdt16550SerialPortHookLib.inf|   37 +
  .../Fdt16550SerialPortHookLib.c   |   39 +
  .../Fdt16550SerialPortHookLib.inf |   33 +
  .../Fdt16550SerialPortHookLib.uni |   14 +
  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c  |  504 +
  .../FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf|   42 +
  .../FdtQemuFwCfgLib/QemuFwCfgLibInternal.h|   73 +
  .../Library/FdtQemuFwCfgLib/QemuFwCfgPei.c|  117 ++
  .../DxeLsRealTimeClockLib.c   |  327 
  .../DxeLsRealTimeClockLib.inf |   41 +
  .../LsRealTimeClockLib/LsRealTimeClock.h  |   47 +
  .../PeiLsRealTimeClockLib.c   |   31 +
  .../PeiLsRealTimeClockLib.inf |   29 +
  .../Library/NorFlashQemuLib/NorFlashQemuLib.c |  140 ++
  .../NorFlashQemuLib/NorFlashQemuLib.inf   |   43 +
  .../BaseResetSystemAcpiGed.c  |  148 ++
  .../BaseResetSystemAcpiGedLib.inf |   36 +
  .../DxeResetSystemAcpiGed.c   |  259 +++
  .../DxeResetSystemAcpiGedLib.inf  |   41 +
  .../ResetSystemAcpiLib/ResetSystemAcpiGed.c   |  125 ++
  .../ResetSystemAcpiLib/ResetSystemAcpiGed.h   |   23 +
  OvmfPkg/LoongArchVirt/LoongArchVirt.fdf.inc   |   34 +
  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc   |  680 +++
  OvmfPkg/LoongArchVirt/LoongArchVirtQemu.fdf   |  313 
  OvmfPkg/LoongArchVirt/PlatformPei/Fv.c|   39 +
  OvmfPkg/LoongArchVirt/PlatformPei/MemDetect.c |  202 ++
  OvmfPkg/LoongArchVirt/PlatformPei/Platform.c  |  393 
  OvmfPkg/LoongArchVirt/PlatformPei/Platform.h  |  128 ++
  .../LoongArchVirt/PlatformPei/PlatformPei.inf |   72 +
  OvmfPkg/LoongArchVirt/Readme.md   |   69 +
  OvmfPkg/LoongArchVirt/Sec/LoongArch64/Start.S |  184 ++
  OvmfPkg/LoongArchVirt/Sec/SecMain.c   |  506 +
  OvmfPkg/LoongArchVirt/Sec/SecMain.inf |   53 +
  OvmfPkg/LoongArchVirt/VarStore.fdf.inc  

[edk2-devel] [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Du Lin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701

The error handling of FspmWrapperInit() is limited to ASSERT
statements only, which only works in debug builds, but not in
release builds.
Fix the issue by enhancing the error handling of FspmWrapperInit()
to cover both debug builds and release builds.

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index ba0c742fea..7f1deb9542 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -197,12 +197,20 @@ FspmWrapperInit (
 
   MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
   ASSERT (MeasurementExcludedFvPpi != NULL);
+  if (MeasurementExcludedFvPpi == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedFvPpi->Count  = 1;
   MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32 (PcdFspmBaseAddress);
   MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER 
*)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
 
   MeasurementExcludedPpiList = AllocatePool (sizeof 
(*MeasurementExcludedPpiList));
   ASSERT (MeasurementExcludedPpiList != NULL);
+  if (MeasurementExcludedPpiList == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
   MeasurementExcludedPpiList->Guid  = 

   MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi;
-- 
2.44.0.windows.1



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




Re: [edk2-devel] [PATCH 0/4][edk2-redfish-client] RedfishClientPkg: fix deallocation of C-structures

2024-03-13 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Done. Thanks!

> -Original Message-
> From: Mike Maslenkin 
> Sent: Thursday, March 14, 2024 2:41 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nickle Wang 
> Subject: Re: [PATCH 0/4][edk2-redfish-client] RedfishClientPkg: fix
> deallocation of C-structures
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Sun, Mar 10, 2024 at 1:41 PM Mike Maslenkin
>  wrote:
> >
> > This set contains fixes for proper deallocation of the structures
> > returned by JsonStructProtocol->ToStructure().
> >
> > PR: https://github.com/tianocore/edk2-redfish-client/pull/82
> >
> > Cc: Abner Chang 
> > Cc: Igor Kulchytskyy 
> > Cc: Nickle Wang 
> > Signed-off-by: Mike Maslenkin 
>
> I have updated patches with R-b and pushed it to PR.
>
> Thank you for review!
>
> Regards,
> Mike


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




Re: [edk2-devel] [PATCH 0/4][edk2-redfish-client] RedfishClientPkg: fix deallocation of C-structures

2024-03-13 Thread Mike Maslenkin
On Sun, Mar 10, 2024 at 1:41 PM Mike Maslenkin  wrote:
>
> This set contains fixes for proper deallocation of the structures
> returned by JsonStructProtocol->ToStructure().
>
> PR: https://github.com/tianocore/edk2-redfish-client/pull/82
>
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nickle Wang 
> Signed-off-by: Mike Maslenkin 

I have updated patches with R-b and pushed it to PR.

Thank you for review!

Regards,
Mike


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116721): https://edk2.groups.io/g/devel/message/116721
Mute This Topic: https://groups.io/mt/104841891/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/3] Fix Runtime Granularity Issues

2024-03-13 Thread Oliver Smith-Denny

Hi Ray and Mike,

Can you help get this patchset reviewed and merged? It contains a fix
for a UEFI spec violation and it has been sitting on the mailing list
for a month. Unfortunately Liming has not reviewed after weekly
friendly pings and he is the only main level MdeModulePkg
maintainer. Liming, perhaps you could use a co-maintainer from the
community to help balance the load? I totally understand that being
a maintainer is a large burden, but I also have several patchsets up
that need reviews and merging for over a month.

Thanks,
Oliver

On 3/9/2024 11:06 AM, Oliver Smith-Denny wrote:

This patch series is the third version of
MdeModulePkg: DxeCore: Don't Guard Large Runtime Granularity Allocations​.
The subject line has been updated because this went from a one commit
patch with no cover letter to a multi-commit patch.

The commit messages cover the vast amount of detail here, but this
patchset fixes three issues:
- a UEFI spec violation for which memory types require runtime page
allocation granularity alignment
- An incompatibility of the heap guard system to guard these regions
that require runtime page allocation granularities greater than
the EFI_PAGE_SIZE.
- A CodeQL error that fails CI when updating the Page.c code

v3:
- edit comments for readability

v2:
- Add commit to fix UEFI spec violation
- Add commit to fix newly flagged CodeQL error
- Update guard commit message, comments, and static assert to use
the correct types

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Liming Gao 

Oliver Smith-Denny (3):
   MdeModulePkg: DxeCore: Fix CodeQL Error in FreePages
   MdeModulePkg: DxeCore: Correct Runtime Granularity Memory Type
   MdeModulePkg: DxeCore: Do Not Apply Guards to Unsupported Types

  MdeModulePkg/MdeModulePkg.dec | 10 +
  MdeModulePkg/Core/Dxe/Mem/HeapGuard.h | 14 +
  MdeModulePkg/Core/Dxe/Mem/Page.c  | 22 +---
  MdeModulePkg/Core/Dxe/Mem/Pool.c  | 15 +++--
  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c |  4 ++--
  MdeModulePkg/Core/Pei/Memory/MemoryServices.c |  2 +-
  6 files changed, 59 insertions(+), 8 deletions(-)




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




Re: [edk2-devel] [PATCH v2 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes

2024-03-13 Thread Oliver Smith-Denny

Hi Liming,

Friendly ping, can you please review this patchset?

Thanks,
Oliver

On 3/11/2024 2:29 PM, Oliver Smith-Denny wrote:

ImagePropertiesRecordLib is currently creating Image Records that
are not accurate. It is setting the CodeSegmentSize to be the size
of the raw data in the image file, however, when the image is
loaded into memory, the raw data size is aligned to the
section alignment. This caused the memory attributes table to
have incorrect entries for systems, like ARM64, where the section
alignment is not 4k for all modules.

In fixing this, I noticed that MemoryProtection.c is using its own
version of image record creation where this logic was actually
correct. ImagePropertiesRecordLib was created to consolidate the
logic around creating and managing image records, so this patchset
also updates MemoryProtection.c to use ImagePropertiesRecordsLib
after making a few small adjustments to ensure the same functionality
is present.

This patchset was tested on ArmVirtQemu to ensure that all image
records were the same before and after this, other than fixing
the CodeSegmentSize.

v2:
- Align VirtualSize instead of SizeOfRawData

Github PR: https://github.com/tianocore/edk2/pull/5402

Cc: Liming Gao 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Taylor Beebe 

Oliver Smith-Denny (3):
   MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
 CodeSize
   MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
   MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib

  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c| 
241 +++-
  MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c |  
86 +--
  2 files changed, 94 insertions(+), 233 deletions(-)




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




Re: [edk2-devel] [PATCH] AMD/AmdPlatformPkg: Update AMD Vangogh platform reference code

2024-03-13 Thread Yao, Ken via groups.io
[AMD Official Use Only - General]

[AMD Official Use Only - General]

Below changes are reviewed and verified.

Reviewed-by: Ken Yao 

-Original Message-
From: Zhai, MingXin (Duke) 
Sent: Tuesday, March 12, 2024 11:06 AM
To: devel@edk2.groups.io
Cc: Yao, Ken ; Fu, Igniculus ; Chang, 
Abner ; Xing, Eric 
Subject: [PATCH] AMD/AmdPlatformPkg: Update AMD Vangogh platform reference code

From: Duke Zhai 

BZ #:4728

1.Use HPET timer to replace 8254 timer
2.Fix Bug Microcode version cannot show correctly at BIOS setup 3.Enable 
capsule at linux build 4.Update FspWrapper UPD table for BIOS setup options

Cc: Ken Yao 
Cc: Igniculus Fu 
Reviewed-by: Abner Chang 
Reviewed-by: Eric Xing 
Signed-off-by: Duke Zhai 
---
 .../BIOSImageDirectory32M.xml |  2 +-
 .../ChachaniBoardPkg/GenCapsule.bat   |  2 +-
 .../VanGoghBoard/ChachaniBoardPkg/Project.dsc |  2 -  
.../VanGoghBoard/ChachaniBoardPkg/Project.fdf |  3 +-
 .../VanGoghBoard/ChachaniBoardPkg/build.sh| 22 +-
 .../edk2/Fsp2WrapperPkg/Include/FspmUpd.h | 71 ++-
 .../FspWrapperPlatformLibSample.c | 29 
 7 files changed, 59 insertions(+), 72 deletions(-)

diff --git 
a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32M.xml 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32M.xml
index 22af6623e2..585e12d487 100644
--- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32M.xml
+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32M.x
+++ ml
@@ -57,7 +57,7 @@
 
 
 
-
+
 
   
 
diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
index 7dca22a4e3..c55f561772 100644
--- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
@@ -36,7 +36,7 @@ if not exist %WORKSPACE%\%BIOS_FILE_NAME% (
   goto ERROR
 )

- Setup OpenSSL Command Line Environment
+echo Setup OpenSSL Command Line Environment
 if not "%OPENSSL_PATH%" == "" (
   set OPENSSL_PATH_TEMP=%OPENSSL_PATH%
 )
diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
index 510ce10c0c..20f06dd851 100644
--- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
@@ -745,8 +745,6 @@
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   FatPkg/EnhancedFatDxe/Fat.inf
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
-  OvmfPkg/8259InterruptControllerDxe/8259.inf
-  OvmfPkg/8254TimerDxe/8254Timer.inf
   
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
   
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf

diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
index 5194a8c10d..0d844689b3 100644
--- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
@@ -416,8 +416,7 @@ NumBlocks = 0x100
   # Platform
   #
   INF  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
-  INF  OvmfPkg/8259InterruptControllerDxe/8259.inf
-  INF  OvmfPkg/8254TimerDxe/8254Timer.inf
+  INF  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf

   #
   # ACPI
diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
index f4652e91c6..0984876ef2 100644
--- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
 ## @file
 # Linux build script file to launch Chachani Board BIOS build  # @@ -22,6 
+23,7 @@ export OemBoard=Chachani  export 
PLATFORM_PATH=edk2-platforms/Platform/AMD/VanGoghBoard
 export BUILD_TYPE=RELEASE
 export TOOLCHAIN_TAG=CLANGPDB
+export OTA_CAPSULE_NAME=OTACAPSULE # You need to keep this name sync
+with PlatformCapsule.fdf
 #TRUE / FALSE
 export COMPRESS_FSP_REGION=TRUE
 export KEY_MODE=TK
@@ -35,16 +37,25 @@ export NASM_PREFIX=
 export GCC5_BIN=
 #CLANG_BIN shall end with a slash.
 export CLANG_BIN=
+#OPENSSL_PATH shall end with a slash.
+export OPENSSL_PATH=

 echo "Building for ${OemBoard} board, ${BUILD_TYPE} mode with 
${TOOLCHAIN_TAG}."
-echo "IASL: ${IASL_PREFIX}iasl, NASM: ${NASM_PREFIX}nasm, GCC: ${GCC5_BIN}gcc, 
CLANG:${CLANG_BIN}clang."
+echo "IASL: ${IASL_PREFIX}iasl, NASM: ${NASM_PREFIX}nasm, GCC: ${GCC5_BIN}gcc, 
CLANG:${CLANG_BIN}clang, OPENSSL:${OPENSSL_PATH}openssl."
 [[ ${COMPRESS_FSP_REGION} == "TRUE" ]] && echo "FSP will be built with 
compress support."
 # Env check
 echo_section "Checking compilation environment"
 [[ "${IASL_PREFIX}" == "" ]] && export IASL_PREFIX=$(dirname $(which iasl))/  
[[ "${NASM_PREFIX}" == "" ]] && export NASM_PREFIX=$(dirname $(which nasm))/
+[[ "${OPENSSL_PATH}" == "" ]] && export OPENSSL_PATH=$(dirname $(which

[edk2-devel] [PATCH v1 1/1] BaseTools: InfBuildData: Fix Private value retrieval

2024-03-13 Thread Joey Vagedes via groups.io
Update retrieval of private guids, protocols, or ppis from a package's
declaration file to use the original path of the module's INF file
rather than the current path. When building the same module multiple
times in the same INF (by override the define's FILE_GUID), a temporary
instance of the module is generated outside the package, causing the
retrieval of private values to fail as the check to access private
values is done by verifying the module to build, is inside the package.

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

Signed-off-by: Joey Vagedes 

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
---
 BaseTools/Source/Python/Workspace/InfBuildData.py | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index e4ff1c668666..6339e494ca87 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -592,7 +592,7 @@ class InfBuildData(ModuleBuildClassObject):
 RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, 
self._Platform]
 for Record in RecordList:
 CName = Record[0]
-Value = _ProtocolValue(CName, self.Packages, self.MetaFile.Path)
+Value = _ProtocolValue(CName, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
 PackageList = "\n\t".join(str(P) for P in self.Packages)
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
@@ -616,7 +616,7 @@ class InfBuildData(ModuleBuildClassObject):
 RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]
 for Record in RecordList:
 CName = Record[0]
-Value = _PpiValue(CName, self.Packages, self.MetaFile.Path)
+Value = _PpiValue(CName, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
 PackageList = "\n\t".join(str(P) for P in self.Packages)
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
@@ -640,7 +640,7 @@ class InfBuildData(ModuleBuildClassObject):
 RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]
 for Record in RecordList:
 CName = Record[0]
-Value = GuidValue(CName, self.Packages, self.MetaFile.Path)
+Value = GuidValue(CName, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
 PackageList = "\n\t".join(str(P) for P in self.Packages)
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
@@ -655,7 +655,7 @@ class InfBuildData(ModuleBuildClassObject):
 for TokenSpaceGuid, _, _, _, _, _, LineNo in RecordList:
 # get the guid value
 if TokenSpaceGuid not in RetVal:
-Value = GuidValue(TokenSpaceGuid, self.Packages, 
self.MetaFile.Path)
+Value = GuidValue(TokenSpaceGuid, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
 PackageList = "\n\t".join(str(P) for P in 
self.Packages)
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
@@ -818,11 +818,11 @@ class InfBuildData(ModuleBuildClassObject):
 Value = Token
 else:
 # get the GUID value now
-Value = _ProtocolValue(Token, self.Packages, 
self.MetaFile.Path)
+Value = _ProtocolValue(Token, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
-Value = _PpiValue(Token, self.Packages, 
self.MetaFile.Path)
+Value = _PpiValue(Token, self.Packages, 
self.MetaFile.OriginalPath.Path)
 if Value is None:
-Value = GuidValue(Token, self.Packages, 
self.MetaFile.Path)
+Value = GuidValue(Token, self.Packages, 
self.MetaFile.OriginalPath.Path)
 
 if Value is None:
 PackageList = "\n\t".join(str(P) for P in 
self.Packages)
-- 
2.40.1.vfs.0.0



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




Re: [edk2-devel] [PATCH v2] DynamicTablesPkg/SSDT: Require Package node in hierarchy

2024-03-13 Thread Sami Mujawar
Merged at 
https://github.com/tianocore/edk2/commit/308e6e0936c43063551babb4a71c46775b1dc01c

Thanks.

Regards,

Sami Mujawar

On 12/03/2024, 16:14, "Sami Mujawar" mailto:sami.muja...@arm.com>> wrote:


Hi Jeshua,


Apologies, I somehow missed getting this merged.
I will get this in before end of this week.


Regards,


Sami Mujawar


On 12/03/2024, 16:12, "Jeshua Smith" mailto:jesh...@nvidia.com> >> wrote:




Can we get this reviewed/merged?




> -Original Message-
> From: Jeshua Smith mailto:jesh...@nvidia.com> 
> >>
> Sent: Monday, February 5, 2024 12:01 PM
> To: devel@edk2.groups.io  
> >
> Cc: ardb+tianoc...@kernel.org  
> >; 
> quic_llind...@quicinc.com  
> >;
> pierre.gond...@arm.com  
> >; 
> sami.muja...@arm.com  
> >; Jeshua Smith
> mailto:jesh...@nvidia.com>  >>
> Subject: [PATCH v2] DynamicTablesPkg/SSDT: Require Package node in
> hierarchy
> 
> The code was incorrectly assuming that root nodes had to be physical package
> nodes and vice versa. This is not always true, so update the check to simply
> require exactly one package node somewhere in the hierarchy.
> 
> Signed-off-by: Jeshua Smith mailto:jesh...@nvidia.com> 
> >>
> Reviewed-by: Pierre Gondois    >>
> ---
> Note: This is a complete replacement for [PATCH] DynamicTablesPkg/SSDT:
> Remove incorrect root node check
> 
> Version 2: added documentation for the PackageNodeSeen parameter
> 
> .../SsdtCpuTopologyGenerator.c | 32 +--
> 1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git
> a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpu
> TopologyGenerator.c
> b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpu
> TopologyGenerator.c
> index 9e3efb49e6..40ed10eae6 100644
> ---
> a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpu
> TopologyGenerator.c
> +++
> b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCp
> +++ uTopologyGenerator.c
> @@ -1072,6 +1072,7 @@ CreateAmlProcessorContainer (
> @param [in] IsLeaf The ProcNode is a leaf.
> @param [in] NodeToken NodeToken of the ProcNode.
> @param [in] ParentNodeToken Parent NodeToken of the ProcNode.
> + @param [in] PackageNodeSeen A parent of the ProcNode has the physical
> package flag set.
> 
> @retval EFI_SUCCESS Success.
> @retval EFI_INVALID_PARAMETER Invalid parameter.
> @@ -1083,23 +1084,24 @@ CheckProcNode (
> UINT32 NodeFlags,
> BOOLEAN IsLeaf,
> CM_OBJECT_TOKEN NodeToken,
> - CM_OBJECT_TOKEN ParentNodeToken
> + CM_OBJECT_TOKEN ParentNodeToken,
> + BOOLEAN PackageNodeSeen
> )
> {
> BOOLEAN InvalidFlags;
> BOOLEAN HasPhysicalPackageBit;
> - BOOLEAN IsTopLevelNode;
> 
> HasPhysicalPackageBit = (NodeFlags &
> EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
> EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
> - IsTopLevelNode = (ParentNodeToken == CM_NULL_TOKEN);
> 
> - // A top-level node is a Physical Package and conversely.
> - InvalidFlags = HasPhysicalPackageBit ^ IsTopLevelNode;
> + // Only one Physical Package flag is allowed in the hierarchy
> + InvalidFlags = HasPhysicalPackageBit && PackageNodeSeen;
> 
> // Check Leaf specific flags.
> if (IsLeaf) {
> InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != PPTT_LEAF_MASK);
> + // Must have Physical Package flag somewhere in the hierarchy
> + InvalidFlags |= !(HasPhysicalPackageBit || PackageNodeSeen);
> } else {
> InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != 0);
> }
> @@ -1130,6 +1132,7 @@ CheckProcNode (
> node to.
> @param [in,out] ProcContainerIndex Pointer to the current processor
> container
> index to be used as UID.
> + @param [in] PackageNodeSeen A parent of the ProcNode has the
> physical package flag set.
> 
> @retval EFI_SUCCESS Success.
> @retval EFI_INVALID_PARAMETER Invalid parameter.
> @@ -1143,7 +1146,8 @@ CreateAmlCpuTopologyTree (
> IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST
> CfgMgrProtocol,
> IN CM_OBJECT_TOKEN NodeToken,
> IN AML_NODE_HANDLE ParentNode,
> - IN OUT UINT32 *ProcContainerIndex
> + IN OUT UINT32 *ProcContainerIndex,
> + IN BOOLEAN PackageNodeSeen
> )
> {
> EFI_STATUS Status;
> @@ -1153,6 +1157,7 @@ CreateAmlCpuTopologyTree (
> AML_OBJECT_NODE_HANDLE ProcContainerNode;
> UINT32 Uid;
> UINT16 Name;
> + BOOLEAN 

Re: [edk2-devel] [PATCH 0/2] ArmPkg/MdePkg: Move Chipset/* files to MdePkg

2024-03-13 Thread PierreGondois

Hello Michael,

On 3/12/24 17:53, Kinney, Michael D wrote:

The MdePkg does have a standard location for CPU specific register
related includes.

Did you consider moving some of the content into

* MdePkg/Include/Register/Arm
* MdePkg/Include/Register/AArch64


Yes right, this should be a better location,

Regards,
Pierre



Thanks,

Mike


-Original Message-
From: Leif Lindholm 
Sent: Tuesday, March 12, 2024 9:47 AM
To: Pierre Gondois ; devel@edk2.groups.io
Cc: Ard Biesheuvel ; Gerd Hoffmann
; Yao, Jiewen ; Liming Gao
; Kinney, Michael D ;
Sami Mujawar ; Liu, Zhiguang 
Subject: Re: [PATCH 0/2] ArmPkg/MdePkg: Move Chipset/* files to MdePkg

On 2024-03-12 02:18, Pierre Gondois wrote:

This patch relies on [1].

Following the RFC v1: ArmPkg,MdePkg: move ArmLib.h to MdePkg [1],
move the Chipset/* files to the MdePkg as the Armlib.h relies on
them.

These patches span over multiple packages as these Chipset/* files
are relocated to a new directory and include paths must be updated.


I like this!
Traveling this week, so unable to test until Wednesday next week at the
earliest, which I would like to do for something this core before giving
a Reviewed-by. So for now, for the series:
Acked-by: Leif Lindholm 


[1] https://edk2.groups.io/g/devel/message/111566

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Pierre Gondois 
Cc: Sami Mujawar 
Cc: Zhiguang Liu 

Pierre Gondois (2):
ArmPkg,MdePkg: Move ArmPkg/Chipset/ArmV7[|Mmu].h to MdePkg
ArmPkg,MdePkg: Move ArmPkg/Chipset/Aarch64[|Mmu].h to MdePkg

   ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c | 2 +-
   ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S | 2 +-
   ArmPkg/Library/ArmExceptionLib/Arm/ArmException.c | 2 +-
   ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c| 2 +-
   ArmPkg/Library/ArmLib/AArch64/AArch64Support.S| 2 +-
   ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c  | 2 +-
   ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c  | 2 +-
   ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibConvert.c   | 2 +-
   ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c  | 2 +-
   ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c| 2 +-
   ArmPlatformPkg/PrePeiCore/AArch64/Exception.S | 2 +-
   ArmPlatformPkg/PrePeiCore/AArch64/Helper.S| 2 +-
   ArmPlatformPkg/PrePi/AArch64/ArchPrePi.c  | 2 +-
   ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S   | 2 +-
   ArmVirtPkg/PrePi/AArch64/ArchPrePi.c  | 2 +-
   {ArmPkg/Include/Chipset => MdePkg/Include/AArch64}/AArch64.h  | 2 +-
   .../Include/Chipset => MdePkg/Include/AArch64}/AArch64Mmu.h   | 0
   .../Include/Chipset/ArmV7.h => MdePkg/Include/Arm/AArch32.h   | 2 +-
   .../Chipset/ArmV7Mmu.h => MdePkg/Include/Arm/AArch32Mmu.h | 0
   MdePkg/Include/Library/ArmLib.h   | 4 ++--
   20 files changed, 19 insertions(+), 19 deletions(-)
   rename {ArmPkg/Include/Chipset => MdePkg/Include/AArch64}/AArch64.h

(94%)

   rename {ArmPkg/Include/Chipset => MdePkg/Include/AArch64}/AArch64Mmu.h

(100%)

   rename ArmPkg/Include/Chipset/ArmV7.h => MdePkg/Include/Arm/AArch32.h

(95%)

   rename ArmPkg/Include/Chipset/ArmV7Mmu.h =>

MdePkg/Include/Arm/AArch32Mmu.h (100%)







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




Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Ni, Ray
> -  ASSERT (MeasurementExcludedFvPpi != NULL);
> +  if (MeasurementExcludedFvPpi == NULL) {
> +ASSERT (FALSE);

I prefer the original meaningful assertion instead of ASSERT (FALSE).
Adding if-check is a good change to me.


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




Re: [edk2-devel] [PATCH v2 4/4] DynamicTablesPkg: Adds ACPI SSDT HPET Table generator

2024-03-13 Thread Abdul Lateef Attar via groups.io

Thanks Pierre for the review, I'll address the review comments.

Please see inline for my reply

On 11-03-2024 19:46, Pierre Gondois wrote:
Caution: This message originated from an External Source. Use proper 
caution when opening attachments, clicking links, or responding.



Hello Abdul,

On 3/4/24 16:43, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

Adds generic ACPI SSDT HPET table generator library.
Register/Deregister HPET table.
Adds ACPI namespace object for HPET device.
Adds Address space for HPET device.

Cc: Sami Mujawar 
Cc: Pierre Gondois 
Signed-off-by: Abdul Lateef Attar `
---
  DynamicTablesPkg/DynamicTables.dsc.inc    |   2 +
  DynamicTablesPkg/Include/AcpiTableGenerator.h |   2 +
  .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  36 +++
  .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 266 ++
  4 files changed, 306 insertions(+)
  create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
  create mode 100644 
DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c


diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc

index 477dc6b6a9..fc2ac5962e 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -36,6 +36,7 @@
    DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
    DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
    DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
+ DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf


(note for later):
The HPET table seems to be intel specific actually,



  [Components.IA32, Components.X64]
    #
@@ -46,6 +47,7 @@
NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
    }

  [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h 
b/DynamicTablesPkg/Include/AcpiTableGenerator.h

index a32ef46ecb..ef651aa2aa 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,7 @@
  /** @file

    Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

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

@@ -101,6 +102,7 @@ typedef enum StdAcpiTableId {
    EStdAcpiTableIdPcct,  ///< PCCT Generator
    EStdAcpiTableIdHpet,  ///< HPET Generator
    EStdAcpiTableIdWsmt,  ///< WSMT Generator
+  EStdAcpiTableIdSsdtHpet,  ///< SSDT HPET 
Generator

    EStdAcpiTableIdMax
  } ESTD_ACPI_TABLE_ID;

diff --git 
a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf 
b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf

new file mode 100644
index 00..7586b31adf
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
@@ -0,0 +1,36 @@
+## @file
+#  SSDT HPET Table Generator
+#
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION    = 1.27
+  BASE_NAME  = AcpiSsdtHpetLib
+  FILE_GUID  = 85262912-AD7F-4EE0-8BB1-EE177275A54E
+  VERSION_STRING = 1.0
+  MODULE_TYPE    = DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR    = AcpiSsdtHpetLibConstructor
+  DESTRUCTOR = AcpiSsdtHpetLibDestructor
+
+[Sources]
+  SsdtHpetGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  PcAtChipsetPkg/PcAtChipsetPkg.dec
+
+[LibraryClasses]
+  AcpiHelperLib
+  AmlLib
+  BaseLib
+  DebugLib
+  PcdLib
+
+[Pcd]
+  gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress


Cf. [1], I think this should be removed along the dependency over the
PcAtChipsetPkg dependency.

diff --git 
a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c 
b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c

new file mode 100644
index 00..3d401204ae
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
@@ -0,0 +1,266 @@
+/** @file
+  SSDT HPET Table Generator
+
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Reference(s):
+  - ACPI 6.5 Specification, Aug 29, 2022


Is it possible to reference the HPET spec. with a link aswell if 
possible ?

Same comment for the other generators with their respective spec.


+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI 

Re: [edk2-devel] [PATCH V1 1/1] OvmfPkg/QemuBootOrderLib: Measure the etc/boot-menu-wait

2024-03-13 Thread sunceping
On Tuesday, March 12, 2024 7:04 PM Gerd Hoffmann wrote:
> On Wed, Mar 13, 2024 at 07:51:46AM +0800, Ceping Sun wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4415
> >
> > Refer to the section 8.3.4 of tdx-virtual-firmware-design-guide 
> > spec, OVMF would uses FW_CFG_IO_SELECTOR(0x510) and
> FW_CFG_IO_DATA(0x511) to
> > get configuration data from QEMU. From the security perspective, if 
> > TDVF uses this method, configuration data must be measured into 
> > RTMR[0].
> >
> > Currently, the etc/boot-menu-wait is using in TDVF, it required to 
> > be measured into RTMR[0].
> 
> That config item doesn't change the control flow.
> Do we have to measure it?
> 
 For TD-Guest, VMM is out of TCB, the configuration is untrusted data.
 From the security perspective, it must be measured into RTMR[0]

> > This is the first patch and will continue to be updated to measure 
> > additional configuration data.
> 
> What else is in the pipeline?  At least ACPI and smbios tables I assume?
> 
The ACPI tables from QEMU has been measured in edk2 .
There are detail message : https://edk2.groups.io/g/devel/message/99441

For smbios tables, we would double check it and update in next version.

> I'd like to have a more complete picture first.  Also I think it makes 
> sense to have a single patch series implementing all of it instead of 
> merging it piece by piece, to avoid having multiple edk2 releases 
> where the measurements are changing.
Yes , that's good idea. 
We would prepare the patch series in next version.

> 
> Note that the current code (looking at a non-tdx build) reads several 
> fw_cfg items multiple times.  Entries 0 and 1 (used for probing fw_cfg 
> presence), 0x19 (file directory) are read most frequently.  etc/e820 
> is scanned multiple times too; tvdf in tdx mode wouldn't use it though.
For etc/e820 , it is used in TD-Guest,  PlatformInfoHob->LowMemory would be 
updated with the low memory size now.

> If we are going to measure the fw_cfg bits used by ovmf / tdvf I think 
> we have
> to:
> 
>   (1) Make sure we read + measure the data once.
Yes,  agree.

>   (2) Make sure we measure the fw_cfg entries in a deterministic
>   order so the measurements are stable.
Yes,  agree.

>   (3) Cache the measured data somewhere if needed multiple times
>   (or simply cache unconditionally).
> 
Yes, agree.
Cache the measured data into HOB in the PEI phase 
and cache the measured data into the global variables in the DXE phase.
How about this?

> We probably wouldn't measure all fw_cfg entries.  The ones used by 
> direct kernel boot can be skipped for example.  The kernel image will 
> be measured anyway before it is launched.
Yes,  agree.

> 
> > +#define EV_POSTCODE_INFO_QEMU_BOOTMENU_WAIT_TIME_DATA
> "QEMU BOOTMENU WAIT TIME"
> 
> "QEMU FW CFG" ?
> 
> I think it makes sense to have one name and one struct for all qemu 
> fw_cfg items.  Or maybe two, one for the file-name based entries and 
> one for the others.
Yes,  we would update in next version.

Thanks
Ceping


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




Re: [edk2-devel] [PATCH V1 1/1] OvmfPkg/QemuBootOrderLib: Measure the etc/boot-menu-wait

2024-03-13 Thread sunceping
On Tuesday, March 12, 2024 3:58 PM Yao, Jiewen wrote:
> Subject: RE: [PATCH V1 1/1] OvmfPkg/QemuBootOrderLib: Measure the 
> etc/boot-menu-wait
> 
> Thanks for the patch.
> 
> Is this the only missing configuration data?
> Or do you have more on the way?
> 
This is not the only missing configuration data.
There are other configurations need to be measured.
We have a draft PR(https://github.com/tianocore/edk2/pull/5440)
 to measure the below items:
etc/system-states
opt/ovmf/X-PciMmio64Mb
etc/reserved-memory-end
etc/boot-menu-wait
etc./extra-pci-roots

According to Hoffmann's comments,  
we would prepare a single patch series with all measurements in next version.

Thanks
Ceping
> 
> > -Original Message-
> > From: Sun, CepingX 
> > Sent: Wednesday, March 13, 2024 7:52 AM
> > To: devel@edk2.groups.io
> > Cc: Sun, CepingX ; Aktas, Erdem
> > ; Yao, Jiewen ; Xu, Min
> M
> > ; Gerd Hoffmann ; Reshetova,
> > Elena 
> > Subject: [PATCH V1 1/1] OvmfPkg/QemuBootOrderLib: Measure the
> > etc/boot- menu-wait
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4415
> >
> > Refer to the section 8.3.4 of tdx-virtual-firmware-design-guide spec,
> > OVMF would uses FW_CFG_IO_SELECTOR(0x510) and
> FW_CFG_IO_DATA(0x511) to
> > get configuration data from QEMU. From the security perspective, if
> > TDVF uses this method, configuration data must be measured into
> > RTMR[0].
> >
> > Currently, the etc/boot-menu-wait is using in TDVF, it required to be
> > measured into RTMR[0].
> >
> > This is the first patch and will continue to be updated to measure
> > additional configuration data.
> >
> > Refernce:
> > spec: https://cdrdv2.intel.com/v1/dl/getContent/733585
> >
> > Cc: Erdem Aktas 
> > Cc: Jiewen Yao 
> > Cc: Min Xu 
> > Cc: Gerd Hoffmann 
> > Cc: Elena Reshetova 
> > Signed-off-by: Ceping Sun 
> > ---
> >  .../QemuBootOrderLib/QemuBootOrderLib.c   | 21
> ++-
> >  .../QemuBootOrderLib/QemuBootOrderLib.inf |  1 +
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> > b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> > index 2fe6ab30c032..63a290712002 100644
> > --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> > +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> > @@ -20,6 +20,8 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >
> >  #include "ExtraRootBusMap.h"
> >
> > @@ -41,6 +43,9 @@
> >  #define REQUIRED_MMIO_OFW_NODES  1
> >  #define EXAMINED_OFW_NODES   6
> >
> > +#define EV_POSTCODE_INFO_QEMU_BOOTMENU_WAIT_TIME_DATA
> "QEMU
> > BOOTMENU WAIT TIME"
> > +#define QEMU_BOOTMENU_WAIT_DATA_LEN
> > (sizeof(EV_POSTCODE_INFO_QEMU_BOOTMENU_WAIT_TIME_DATA) - 1)
> > +
> >  /**
> >Simple character classification routines, corresponding to POSIX class
> names
> >and ASCII encoding.
> > @@ -2418,5 +2423,19 @@ GetFrontPageTimeoutFromQemu (
> >// seconds, round N up.
> >//
> >QemuFwCfgSelectItem (BootMenuWaitItem);
> > -  return (UINT16)((QemuFwCfgRead16 () + 999) / 1000);
> > +  Timeout = QemuFwCfgRead16 ();
> > +  //
> > +  // Measure the Timeout which is downloaded from QEMU.
> > +  // It has to be done before it is consumed.
> > +  //
> > +  TpmMeasureAndLogData (
> > +1,
> > +EV_PLATFORM_CONFIG_FLAGS,
> > +EV_POSTCODE_INFO_QEMU_BOOTMENU_WAIT_TIME_DATA,
> > +QEMU_BOOTMENU_WAIT_DATA_LEN,
> > +(VOID *)(UINTN),
> > +BootMenuWaitSize
> > +);
> > +
> > +  return (UINT16)((Timeout + 999) / 1000);
> >  }
> > diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
> > b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
> > index 6e320e3e8514..0231c9d5c5b8 100644
> > --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
> > +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
> > @@ -45,6 +45,7 @@
> >DevicePathLib
> >BaseMemoryLib
> >OrderedCollectionLib
> > +  TpmMeasurementLib
> >
> >  [Guids]
> >gEfiGlobalVariableGuid
> > --
> > 2.34.1



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




Re: [edk2-devel] [PATCH V1 1/3] MdePkg/BaseLib: Update TDVMCALL_EXPOSE_REGS_MASK

2024-03-13 Thread sunceping
@Liming Gao @Kinney, Michael D
This patch has been submitted for review over two weeks. 
May I have your comments about the patch?

Thanks
Ceping

> -Original Message-
> From: Sun, CepingX 
> Sent: Monday, March 4, 2024 11:23 AM
> To: Liming Gao ; Kinney, Michael D
> ; devel@edk2.groups.io; Sun, CepingX
> 
> Cc: Aktas, Erdem ; James Bottomley
> ; Yao, Jiewen ; Xu, Min M
> ; Tom Lendacky ;
> Michael Roth ; Yamahata, Isaku
> 
> Subject: RE: [PATCH V1 1/3] MdePkg/BaseLib: Update
> TDVMCALL_EXPOSE_REGS_MASK
> 
> Ping @Gao, Liming, @Kinney, Michael D
> Hi Liming and Mike
> Would you please review the MdePkg update?
> 
> Thanks
> Ceping
> 
> > -Original Message-
> > From: Sun, CepingX 
> > Sent: Tuesday, February 27, 2024 5:19 AM
> > To: devel@edk2.groups.io
> > Cc: Sun, CepingX ; Liming Gao
> > ; Kinney, Michael D
> > ; Aktas, Erdem ;
> > James Bottomley ; Yao, Jiewen
> > ; Xu, Min M ; Tom Lendacky
> > ; Michael Roth ;
> > Yamahata, Isaku 
> > Subject: [PATCH V1 1/3] MdePkg/BaseLib: Update
> > TDVMCALL_EXPOSE_REGS_MASK
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4696
> >
> > Refer to the [GHCI] spec, TDVF should clear the BIT5 for RBP in the mask.
> >
> > Reference:
> > [GHCI]: TDX Guest-Host-Communication Interface v1.5
> > https://cdrdv2.intel.com/v1/dl/getContent/726792
> >
> > Cc: Liming Gao 
> > Cc: Michael D Kinney 
> > Cc: Erdem Aktas 
> > Cc: James Bottomley 
> > Cc: Jiewen Yao 
> > Cc: Min Xu 
> > Cc: Tom Lendacky 
> > Cc: Michael Roth 
> > Cc: Isaku Yamahata 
> > Signed-off-by: Ceping Sun 
> > ---
> >  MdePkg/Library/BaseLib/X64/TdVmcall.nasm | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
> > b/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
> > index 8dd9bfcbfa14..b20724a37015 100644
> > --- a/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
> > +++ b/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
> > @@ -9,7 +9,7 @@
> >  DEFAULT REL
> >  SECTION .text
> >
> > -%define TDVMCALL_EXPOSE_REGS_MASK   0xffec
> > +%define TDVMCALL_EXPOSE_REGS_MASK   0xffcc
> >  %define TDVMCALL0x0
> >
> >  %macro tdcall 0
> > --
> > 2.34.1



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




Re: [edk2-devel] [PATCH] AMD/AmdPlatformPkg: Update AMD Vangogh platform reference code

2024-03-13 Thread Xing, Eric via groups.io
[AMD Official Use Only - General]

Below changes are reviewed and verified.

Reviewed-by: Eric Xing 

> -Original Message-
> From: Zhai, MingXin (Duke) 
> Sent: Tuesday, March 12, 2024 11:06 AM
> To: devel@edk2.groups.io
> Cc: Yao, Ken ; Fu, Igniculus ;
> Chang, Abner ; Xing, Eric 
> Subject: [PATCH] AMD/AmdPlatformPkg: Update AMD Vangogh platform
> reference code
>
> From: Duke Zhai 
>
> BZ #:4728
>
> 1.Use HPET timer to replace 8254 timer
> 2.Fix Bug Microcode version cannot show correctly at BIOS setup 3.Enable
> capsule at linux build 4.Update FspWrapper UPD table for BIOS setup options
>
> Cc: Ken Yao 
> Cc: Igniculus Fu 
> Reviewed-by: Abner Chang 
> Reviewed-by: Eric Xing 
> Signed-off-by: Duke Zhai 
> ---
>  .../BIOSImageDirectory32M.xml |  2 +-
>  .../ChachaniBoardPkg/GenCapsule.bat   |  2 +-
>  .../VanGoghBoard/ChachaniBoardPkg/Project.dsc |  2 -
>   .../VanGoghBoard/ChachaniBoardPkg/Project.fdf |  3 +-
>  .../VanGoghBoard/ChachaniBoardPkg/build.sh| 22 +-
>  .../edk2/Fsp2WrapperPkg/Include/FspmUpd.h | 71 ++-
>  .../FspWrapperPlatformLibSample.c | 29 
>  7 files changed, 59 insertions(+), 72 deletions(-)
>
> diff --git
> a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32
> M.xml
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32
> M.xml
> index 22af6623e2..585e12d487 100644
> ---
> a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32
> M.xml
> +++
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/BIOSImageDirectory32
> M.x
> +++ ml
> @@ -57,7 +57,7 @@
>   File="TypeId0x65D0.csbin" />
>   File="TypeId0x64L1.csbin" />
>   File="TypeId0x65D1.csbin" />
> -
> +
>  
>
>  
> diff --git
> a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
> index 7dca22a4e3..c55f561772 100644
> --- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
> +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/GenCapsule.bat
> @@ -36,7 +36,7 @@ if not exist %WORKSPACE%\%BIOS_FILE_NAME% (
>goto ERROR
>  )
>
> - Setup OpenSSL Command Line Environment
> +echo Setup OpenSSL Command Line Environment
>  if not "%OPENSSL_PATH%" == "" (
>set OPENSSL_PATH_TEMP=%OPENSSL_PATH%
>  )
> diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
> index 510ce10c0c..20f06dd851 100644
> --- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
> +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.dsc
> @@ -745,8 +745,6 @@
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>FatPkg/EnhancedFatDxe/Fat.inf
>PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> -  OvmfPkg/8259InterruptControllerDxe/8259.inf
> -  OvmfPkg/8254TimerDxe/8254Timer.inf
>
> MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Firmwa
> rePerformanceDxe.inf
>
> MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Firmw
> arePerformanceSmm.inf
>
> diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
> index 5194a8c10d..0d844689b3 100644
> --- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
> +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Project.fdf
> @@ -416,8 +416,7 @@ NumBlocks = 0x100
># Platform
>#
>INF  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> -  INF  OvmfPkg/8259InterruptControllerDxe/8259.inf
> -  INF  OvmfPkg/8254TimerDxe/8254Timer.inf
> +  INF  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
>
>#
># ACPI
> diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
> index f4652e91c6..0984876ef2 100644
> --- a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
> +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/build.sh
> @@ -1,3 +1,4 @@
> +#!/bin/bash
>  ## @file
>  # Linux build script file to launch Chachani Board BIOS build  # @@ -22,6
> +23,7 @@ export OemBoard=Chachani  export PLATFORM_PATH=edk2-
> platforms/Platform/AMD/VanGoghBoard
>  export BUILD_TYPE=RELEASE
>  export TOOLCHAIN_TAG=CLANGPDB
> +export OTA_CAPSULE_NAME=OTACAPSULE # You need to keep this name
> sync
> +with PlatformCapsule.fdf
>  #TRUE / FALSE
>  export COMPRESS_FSP_REGION=TRUE
>  export KEY_MODE=TK
> @@ -35,16 +37,25 @@ export NASM_PREFIX=
>  export GCC5_BIN=
>  #CLANG_BIN shall end with a slash.
>  export CLANG_BIN=
> +#OPENSSL_PATH shall end with a slash.
> +export OPENSSL_PATH=
>
>  echo "Building for ${OemBoard} board, ${BUILD_TYPE} mode with
> ${TOOLCHAIN_TAG}."
> -echo "IASL: ${IASL_PREFIX}iasl, NASM: ${NASM_PREFIX}nasm, GCC:
> ${GCC5_BIN}gcc, CLANG:${CLANG_BIN}clang."
> +echo "IASL: ${IASL_PREFIX}iasl, NASM: ${NASM_PREFIX}nasm, GCC:
> ${GCC5_BIN}gcc, CLANG:${CLANG_BIN}clang,
> OPENSSL:${OPENSSL_PATH}openssl."
>  [[ ${COMPRESS_FSP_REGION} == "TRUE" ]] && echo "FSP will be built with
> 

Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Ashraf Ali S
Reviewed-by: S, Ashraf Ali 

Thanks.,
S, Ashraf Ali

-Original Message-
From: Lin, Du  
Sent: Tuesday, March 12, 2024 2:58 PM
To: devel@edk2.groups.io
Cc: Lin, Du ; S, Ashraf Ali ; Chiu, 
Chasel ; Chen, Gang C ; Duggapu, 
Chinni B ; Desimone, Nathaniel L 
; Zeng, Star ; Mohapatra, 
Susovan ; Kuo, Ted 
Subject: [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

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

The error handling of FspmWrapperInit() is limited to ASSERT statements only, 
which only works in debug builds, but not in release builds.
Fix the issue by enhancing the error handling of FspmWrapperInit() to cover 
both debug builds and release builds.

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 .../FspmWrapperPeim/FspmWrapperPeim.c| 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index ba0c742fea..356baeeccf 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -196,13 +196,21 @@ FspmWrapperInit (
   EFI_PEI_PPI_DESCRIPTOR 
*MeasurementExcludedPpiList;
 
   MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
-  ASSERT (MeasurementExcludedFvPpi != NULL);
+  if (MeasurementExcludedFvPpi == NULL) {
+ASSERT (FALSE);
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedFvPpi->Count  = 1;
   MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32 (PcdFspmBaseAddress);
   MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER 
*)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
 
   MeasurementExcludedPpiList = AllocatePool (sizeof 
(*MeasurementExcludedPpiList));
-  ASSERT (MeasurementExcludedPpiList != NULL);
+  if (MeasurementExcludedPpiList == NULL) {
+ASSERT (FALSE);
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
   MeasurementExcludedPpiList->Guid  = 

   MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi;
--
2.44.0.windows.1



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




Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of TpmMeasureAndLogDataWithFlags()

2024-03-13 Thread Ashraf Ali S
Reviewed-by: S, Ashraf Ali 

Thanks.,
S, Ashraf Ali

-Original Message-
From: Lin, Du  
Sent: Tuesday, March 12, 2024 2:50 PM
To: devel@edk2.groups.io
Cc: Lin, Du ; S, Ashraf Ali ; Chiu, 
Chasel ; Chen, Gang C ; Duggapu, 
Chinni B ; Desimone, Nathaniel L 
; Zeng, Star ; Mohapatra, 
Susovan ; Kuo, Ted 
Subject: [PATCH] IntelFsp2WrapperPkg: Error handling of 
TpmMeasureAndLogDataWithFlags()

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

TpmMeasureAndLogDataWithFlags() computes the measure the code and log it into 
PCR 0. TpmMeasureAndLogData() computes the hash for the configuration. The same 
"Status" variable is used to store the return values for both of the functions. 
There is no error handling if
TpmMeasureAndLogDataWithFlags() returns an error Status.
Fix the issue by adding error handling for TpmMeasureAndLogDataWithFlags().

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 .../Library/BaseFspMeasurementLib/FspMeasurementLib.c | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c 
b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
index 2c017a4250..228277649b 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLi
+++ b.c
@@ -197,6 +197,10 @@ MeasureFspFirmwareBlobWithCfg (
  (UINTN)sizeof (DigestList),
  EDKII_TCG_PRE_HASH_LOG_ONLY
  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "TpmMeasureAndLogDataWithFlags failed - %r\n", 
Status));
+return Status;
+  }
 
   Status = TpmMeasureAndLogData (
  1,
--
2.26.2.windows.1



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