Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSPI_UPD is not mandatory.

2022-07-27 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: Chiu, Chasel  
Sent: Thursday, July 28, 2022 1:15 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Zeng, Star 
Subject: [PATCH v2] IntelFsp2Pkg: FSPI_UPD is not mandatory.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/Include/FspGlobalData.h | 43 
+--
 IntelFsp2Pkg/Tools/GenCfgOpt.py  | 14 ++
 2 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h 
b/IntelFsp2Pkg/Include/FspGlobalData.h
index cf94f7b6a5..32c6d460e4 100644
--- a/IntelFsp2Pkg/Include/FspGlobalData.h
+++ b/IntelFsp2Pkg/Include/FspGlobalData.h
@@ -42,58 +42,57 @@ typedef struct  {
 #define FSP_PERFORMANCE_DATA_TIMER_MASK  0xFF

 

 typedef struct  {

-  UINT32Signature;

-  UINT8 Version;

-  UINT8 Reserved1[3];

+  UINT32 Signature;

+  UINT8  Version;

+  UINT8  Reserved1[3];

   ///

   /// Offset 0x08

   ///

-  UINTN CoreStack;

-  UINTN Reserved2;

+  UINTN  CoreStack;

+  VOID   *SmmInitUpdPtr;

   ///

   /// IA32: Offset 0x10; X64: Offset 0x18

   ///

-  UINT32StatusCode;

-  UINT8 ApiIdx;

+  UINT32 StatusCode;

+  UINT8  ApiIdx;

   ///

   /// 0: FSP in API mode; 1: FSP in DISPATCH mode

   ///

-  UINT8 FspMode;

-  UINT8 OnSeparateStack;

-  UINT8 Reserved3;

-  UINT32NumberOfPhases;

-  UINT32PhasesExecuted;

-  UINT32Reserved4[8];

+  UINT8  FspMode;

+  UINT8  OnSeparateStack;

+  UINT8  Reserved2;

+  UINT32 NumberOfPhases;

+  UINT32 PhasesExecuted;

+  UINT32 Reserved3[8];

   ///

   /// IA32: Offset 0x40; X64: Offset 0x48

   /// Start of UINTN and pointer section

-  /// All UINTN and pointer members must be put in this section

-  /// except CoreStack and Reserved2. In addition, the number of

-  /// UINTN and pointer members must be even for natural alignment

-  /// in both IA32 and X64.

+  /// All UINTN and pointer members are put in this section

+  /// for maintaining natural alignment for both IA32 and X64 builds.

   ///

   FSP_PLAT_DATA  PlatformData;

   VOID   *TempRamInitUpdPtr;

   VOID   *MemoryInitUpdPtr;

   VOID   *SiliconInitUpdPtr;

-  VOID   *SmmInitUpdPtr;

   ///

-  /// IA32: Offset 0x68; X64: Offset 0x98

+  /// IA32: Offset 0x64; X64: Offset 0x90

   /// To store function parameters pointer

   /// so it can be retrieved after stack switched.

   ///

   VOID   *FunctionParameterPtr;

   FSP_INFO_HEADER*FspInfoHeader;

   VOID   *UpdDataPtr;

-  UINTN  Reserved5;

   ///

   /// End of UINTN and pointer section

+  /// At this point, next field offset must be either *0h or *8h to

+  /// meet natural alignment requirement.

   ///

-  UINT8  Reserved6[16];

+  UINT8  Reserved4[16];

   UINT32 PerfSig;

   UINT16 PerfLen;

-  UINT16 Reserved7;

+  UINT16 Reserved5;

   UINT32 PerfIdx;

+  UINT32 Reserved6;

   UINT64 PerfData[32];

 } FSP_GLOBAL_DATA;

 

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 128b896592..71c48f10e0 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -959,8 +959,13 @@ EndList
 UpdTxtFile = ''

 FvDir = self._FvDir

 if GuidList[Index] not in self._MacroDict:

-self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])

-return 1

+NoFSPI = False

+if GuidList[Index] == 'FSP_I_UPD_TOOL_GUID':

+NoFSPI = True

+continue

+else:

+self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])

+return 1

 

 if UpdTxtFile == '':

 UpdTxtFile = os.path.join(FvDir, 
self._MacroDict[GuidList[Index]] + '.txt')

@@ -1296,7 +1301,8 @@ EndList
elif '_S' in SignatureStr[6:6+2]:

TxtBody.append("#define FSPS_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))

elif '_I' in SignatureStr[6:6+2]:

-   TxtBody.append("#define FSPI_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))

+ 

[edk2-devel] [PATCH v2] IntelFsp2Pkg: FSPI_UPD is not mandatory.

2022-07-27 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/Include/FspGlobalData.h | 43 
+--
 IntelFsp2Pkg/Tools/GenCfgOpt.py  | 14 ++
 2 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h 
b/IntelFsp2Pkg/Include/FspGlobalData.h
index cf94f7b6a5..32c6d460e4 100644
--- a/IntelFsp2Pkg/Include/FspGlobalData.h
+++ b/IntelFsp2Pkg/Include/FspGlobalData.h
@@ -42,58 +42,57 @@ typedef struct  {
 #define FSP_PERFORMANCE_DATA_TIMER_MASK  0xFF
 
 typedef struct  {
-  UINT32Signature;
-  UINT8 Version;
-  UINT8 Reserved1[3];
+  UINT32 Signature;
+  UINT8  Version;
+  UINT8  Reserved1[3];
   ///
   /// Offset 0x08
   ///
-  UINTN CoreStack;
-  UINTN Reserved2;
+  UINTN  CoreStack;
+  VOID   *SmmInitUpdPtr;
   ///
   /// IA32: Offset 0x10; X64: Offset 0x18
   ///
-  UINT32StatusCode;
-  UINT8 ApiIdx;
+  UINT32 StatusCode;
+  UINT8  ApiIdx;
   ///
   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
   ///
-  UINT8 FspMode;
-  UINT8 OnSeparateStack;
-  UINT8 Reserved3;
-  UINT32NumberOfPhases;
-  UINT32PhasesExecuted;
-  UINT32Reserved4[8];
+  UINT8  FspMode;
+  UINT8  OnSeparateStack;
+  UINT8  Reserved2;
+  UINT32 NumberOfPhases;
+  UINT32 PhasesExecuted;
+  UINT32 Reserved3[8];
   ///
   /// IA32: Offset 0x40; X64: Offset 0x48
   /// Start of UINTN and pointer section
-  /// All UINTN and pointer members must be put in this section
-  /// except CoreStack and Reserved2. In addition, the number of
-  /// UINTN and pointer members must be even for natural alignment
-  /// in both IA32 and X64.
+  /// All UINTN and pointer members are put in this section
+  /// for maintaining natural alignment for both IA32 and X64 builds.
   ///
   FSP_PLAT_DATA  PlatformData;
   VOID   *TempRamInitUpdPtr;
   VOID   *MemoryInitUpdPtr;
   VOID   *SiliconInitUpdPtr;
-  VOID   *SmmInitUpdPtr;
   ///
-  /// IA32: Offset 0x68; X64: Offset 0x98
+  /// IA32: Offset 0x64; X64: Offset 0x90
   /// To store function parameters pointer
   /// so it can be retrieved after stack switched.
   ///
   VOID   *FunctionParameterPtr;
   FSP_INFO_HEADER*FspInfoHeader;
   VOID   *UpdDataPtr;
-  UINTN  Reserved5;
   ///
   /// End of UINTN and pointer section
+  /// At this point, next field offset must be either *0h or *8h to
+  /// meet natural alignment requirement.
   ///
-  UINT8  Reserved6[16];
+  UINT8  Reserved4[16];
   UINT32 PerfSig;
   UINT16 PerfLen;
-  UINT16 Reserved7;
+  UINT16 Reserved5;
   UINT32 PerfIdx;
+  UINT32 Reserved6;
   UINT64 PerfData[32];
 } FSP_GLOBAL_DATA;
 
diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 128b896592..71c48f10e0 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -959,8 +959,13 @@ EndList
 UpdTxtFile = ''
 FvDir = self._FvDir
 if GuidList[Index] not in self._MacroDict:
-self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])
-return 1
+NoFSPI = False
+if GuidList[Index] == 'FSP_I_UPD_TOOL_GUID':
+NoFSPI = True
+continue
+else:
+self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])
+return 1
 
 if UpdTxtFile == '':
 UpdTxtFile = os.path.join(FvDir, 
self._MacroDict[GuidList[Index]] + '.txt')
@@ -1296,7 +1301,8 @@ EndList
elif '_S' in SignatureStr[6:6+2]:
TxtBody.append("#define FSPS_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))
elif '_I' in SignatureStr[6:6+2]:
-   TxtBody.append("#define FSPI_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))
+   if NoFSPI == True:
+   TxtBody.append("#define FSPI_UPD_SIGNATURE  
 %s/* '%s' */\n\n" % (Item['value'], SignatureStr))
 TxtBody.append("\n")
 
 for Region in ['UPD']:
@@ -1702,7 +1708,7 @@ EndList
 
 
 def Usage():
-print ("GenCfgOpt Version 0.58")
+print ("GenCfgOpt Version 

[edk2-devel] [PATCH v2 6/6] DynamicTablesPkg: AcpiSsdtPcieLibArm: Added case handling for PCI config

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3998

This change added a switch case handling for PCI_SS_CONFIG during SSDT
generation. This will allow PCI config case return EFI_SUCCESS instead of
EFI_INVALID_PARAMETER.

Cc: Sami Mujawar 
Cc: Alexei Fedorov 

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
Reviewed-by: Pierre Gondois 
---

Notes:
v2:
- Added Reviewed-by tag [Pierre]

 DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 5 
+
 1 file changed, 5 insertions(+)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index c03550baabf2..2749cfabed6c 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -603,6 +603,11 @@ GeneratePciCrs (
);
 break;
 
+  case PCI_SS_CONFIG:
+// Do nothing
+Status = EFI_SUCCESS;
+break;
+
   default:
 Status = EFI_INVALID_PARAMETER;
 } // switch
-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH v2 3/6] DynamicTablesPkg: DynamicPlatRepoLib: Adding more token fixers

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3996

This change added more token fixers for other node types, including
NamedComponentNode, RootComplexNode, and SmmuV3Node.

The corresponding entries for tokenFixer functions table is also updated.

Cc: Sami Mujawar 
Cc: Alexei Fedorov 

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
Reviewed-by: Sami Mujawar 
Reviewed-by: Pierre Gondois 
---

Notes:
v2:
- Added Reviewed-by tag [Sami]
- Added Reviewed-by tag [Pierre]

 DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c | 78 
+++-
 1 file changed, 75 insertions(+), 3 deletions(-)

diff --git 
a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c 
b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
index 84e4bb7e3bc8..345acab53f74 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
@@ -64,6 +64,78 @@ TokenFixerItsGroup (
   return EFI_SUCCESS;
 }
 
+/** EArmObjNamedComponent token fixer.
+
+  CmObjectToken fixer function that updates the Tokens in the CmObjects.
+
+  @param [in]  CmObjectPointer to the Configuration Manager Object.
+  @param [in]  Token   Token to be updated in the CmObject.
+
+  @retval EFI_SUCCESS   Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_UNSUPPORTED   Not supported.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+TokenFixerNamedComponentNode (
+  IN  CM_OBJ_DESCRIPTOR  *CmObject,
+  IN  CM_OBJECT_TOKENToken
+  )
+{
+  ASSERT (CmObject != NULL);
+  ((CM_ARM_NAMED_COMPONENT_NODE *)CmObject->Data)->Token = Token;
+  return EFI_SUCCESS;
+}
+
+/** EArmObjRootComplex token fixer.
+
+  CmObjectToken fixer function that updates the Tokens in the CmObjects.
+
+  @param [in]  CmObjectPointer to the Configuration Manager Object.
+  @param [in]  Token   Token to be updated in the CmObject.
+
+  @retval EFI_SUCCESS   Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_UNSUPPORTED   Not supported.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+TokenFixerRootComplexNode (
+  IN  CM_OBJ_DESCRIPTOR  *CmObject,
+  IN  CM_OBJECT_TOKENToken
+  )
+{
+  ASSERT (CmObject != NULL);
+  ((CM_ARM_ROOT_COMPLEX_NODE *)CmObject->Data)->Token = Token;
+  return EFI_SUCCESS;
+}
+
+/** EArmObjSmmuV3 token fixer.
+
+  CmObjectToken fixer function that updates the Tokens in the CmObjects.
+
+  @param [in]  CmObjectPointer to the Configuration Manager Object.
+  @param [in]  Token   Token to be updated in the CmObject.
+
+  @retval EFI_SUCCESS   Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_UNSUPPORTED   Not supported.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+TokenFixerSmmuV3Node (
+  IN  CM_OBJ_DESCRIPTOR  *CmObject,
+  IN  CM_OBJECT_TOKENToken
+  )
+{
+  ASSERT (CmObject != NULL);
+  ((CM_ARM_SMMUV3_NODE *)CmObject->Data)->Token = Token;
+  return EFI_SUCCESS;
+}
+
 /** TokenFixer functions table.
 
   A CmObj having a CM_OBJECT_TOKEN field might need to have its
@@ -90,10 +162,10 @@ CM_OBJECT_TOKEN_FIXER  TokenFixer[EArmObjMax] = {
   NULL, ///< 16 - Hypervisor Vendor Id
   NULL, ///< 17 - Fixed feature flags for FADT
   TokenFixerItsGroup,   ///< 18 - ITS Group
-  TokenFixerNotImplemented, ///< 19 - Named Component
-  TokenFixerNotImplemented, ///< 20 - Root Complex
+  TokenFixerNamedComponentNode, ///< 19 - Named Component
+  TokenFixerRootComplexNode,///< 20 - Root Complex
   TokenFixerNotImplemented, ///< 21 - SMMUv1 or SMMUv2
-  TokenFixerNotImplemented, ///< 22 - SMMUv3
+  TokenFixerSmmuV3Node, ///< 22 - SMMUv3
   TokenFixerNotImplemented, ///< 23 - PMCG
   NULL, ///< 24 - GIC ITS Identifier Array
   NULL, ///< 25 - ID Mapping Array
-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH v2 5/6] DynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM space

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3998

Certain OSes will complain if the ECAM config space is not reserved in
the ACPI namespace.

This change adds a function to reserve PNP motherboard resources for a
given PCI node.

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
---

Notes:
v2:
- Only create RES0 after config space checking [Pierre]

 DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 169 

 1 file changed, 169 insertions(+)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index ceffe2838c03..c03550baabf2 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -616,6 +616,167 @@ GeneratePciCrs (
   return Status;
 }
 
+/** Generate a Pci Resource Template to hold Address Space Info
+
+  @param [in]   PciNode   RootNode of the AML tree.
+  @param [in, out]  CrsNode   CRS node of the AML tree to populate.
+
+  @retval EFI_SUCCESS The function completed successfully.
+  @retval EFI_INVALID_PARAMETER   Invalid input parameter.
+  @retval EFI_OUT_OF_RESOURCESCould not allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+PopulateBasicPciResObjects (
+  INAML_OBJECT_NODE_HANDLE  PciNode,
+  IN  OUT   AML_OBJECT_NODE_HANDLE  *CrsNode
+  )
+{
+  EFI_STATUS  Status;
+  UINT32  EisaId;
+  AML_OBJECT_NODE_HANDLE  ResNode;
+
+  if (CrsNode == NULL) {
+ASSERT (0);
+return EFI_INVALID_PARAMETER;
+  }
+
+  // ASL: Device (PCIx) {}
+  Status = AmlCodeGenDevice ("RES0", PciNode, );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  // ASL: Name (_HID, EISAID ("PNP0C02"))
+  Status = AmlGetEisaIdFromString ("PNP0C02", ); /* PNP Motherboard 
Resources */
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlCodeGenNameInteger ("_HID", EisaId, ResNode, NULL);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  // ASL: Name (_CRS, ResourceTemplate () {})
+  Status = AmlCodeGenNameResourceTemplate ("_CRS", ResNode, CrsNode);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  return Status;
+}
+
+/** Generate a Pci Resource Template to hold Address Space Info
+
+  @param [in]   Generator   The SSDT Pci generator.
+  @param [in]   CfgMgrProtocol  Pointer to the Configuration Manager
+Protocol interface.
+  @param [in]   PciInfo Pci device information.
+  @param [in, out]  PciNode RootNode of the AML tree to populate.
+
+  @retval EFI_SUCCESS The function completed successfully.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESCould not allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+GeneratePciRes (
+  INACPI_PCI_GENERATOR*Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN  CONST CM_ARM_PCI_CONFIG_SPACE_INFO  *PciInfo,
+  IN  OUT   AML_OBJECT_NODE_HANDLEPciNode
+  )
+{
+  EFI_STATUS   Status;
+  AML_OBJECT_NODE_HANDLE   CrsNode;
+  BOOLEAN  Translation;
+  UINT32   Index;
+  CM_ARM_OBJ_REF   *RefInfo;
+  UINT32   RefCount;
+  CM_ARM_PCI_ADDRESS_MAP_INFO  *AddrMapInfo;
+  BOOLEAN  IsPosDecode;
+
+  // Get the array of CM_ARM_OBJ_REF referencing the
+  // CM_ARM_PCI_ADDRESS_MAP_INFO objects.
+  Status = GetEArmObjCmRef (
+ CfgMgrProtocol,
+ PciInfo->AddressMapToken,
+ ,
+ 
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  for (Index = 0; Index < RefCount; Index++) {
+// Get CM_ARM_PCI_ADDRESS_MAP_INFO structures one by one.
+Status = GetEArmObjPciAddressMapInfo (
+   CfgMgrProtocol,
+   RefInfo[Index].ReferenceToken,
+   ,
+   NULL
+   );
+if (EFI_ERROR (Status)) {
+  ASSERT (0);
+  return Status;
+}
+
+Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress);
+if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) {
+  IsPosDecode = TRUE;
+} else {
+  IsPosDecode = FALSE;
+}
+
+switch (AddrMapInfo->SpaceCode) {
+  case PCI_SS_CONFIG:
+Status = PopulateBasicPciResObjects (PciNode, );
+if (EFI_ERROR (Status)) {
+  ASSERT (0);
+  break;
+}
+
+Status = AmlCodeGenRdQWordMemory (
+   FALSE,
+   IsPosDecode,
+   TRUE,
+   TRUE,
+   FALSE, // non-cacheable
+

[edk2-devel] [PATCH v2 4/6] DynamicTablesPkg: DynamicTableManagerDxe: Added check for installed tables

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3997

This change added an extra step to allow check for installed ACPI tables.

For FADT, MADT, GTDT, DSDT, DBG2 and SPCR tables, either pre-installed or
supplied through AcpiTableInfo can be accepted.

An extra check for FADT ACPI table existence during installation step is
also added.

Cc: Sami Mujawar 
Cc: Alexei Fedorov 

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
---

Notes:
v2:
- Function description updates [Sami]
- Refactorized the table verification [Pierre]

 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c   | 
182 +++-
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf |   
1 +
 2 files changed, 103 insertions(+), 80 deletions(-)

diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c 
b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
index ed62299f9bbd..4ad7c0c8dbfa 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // Module specific include files.
@@ -22,6 +23,29 @@
 #include 
 #include 
 
+#define ACPI_TABLE_PRESENT_INFO_LIST  BIT0
+#define ACPI_TABLE_PRESENT_INSTALLED  BIT1
+
+#define ACPI_TABLE_VERIFY_FADT   0
+#define ACPI_TABLE_VERIFY_COUNT  6
+
+typedef struct {
+  ESTD_ACPI_TABLE_IDEstdTableId;
+  UINT32AcpiTableSignature;
+  CHAR8 AcpiTableName[sizeof (UINT32) + 1];
+  BOOLEAN   IsMandatory;
+  UINT16Presence;
+} ACPI_TABLE_PRESENCE_INFO;
+
+ACPI_TABLE_PRESENCE_INFO  mAcpiVerifyTables[ACPI_TABLE_VERIFY_COUNT] = {
+  { EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,  
  "FADT", TRUE,  0 },
+  { EStdAcpiTableIdMadt, 
EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE,  
0 },
+  { EStdAcpiTableIdGtdt, 
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE,  
0 },
+  { EStdAcpiTableIdDsdt, 
EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE,  
0 },
+  { EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
  "DBG2", FALSE, 0 },
+  { EStdAcpiTableIdSpcr, 
EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,   "SPCR", FALSE, 
0 },
+};
+
 /** This macro expands to a function that retrieves the ACPI Table
 List from the Configuration Manager.
 */
@@ -395,6 +419,7 @@ BuildAndInstallAcpiTable (
 
   @retval EFI_SUCCESS   Success.
   @retval EFI_NOT_FOUND If mandatory table is not found.
+  @retval EFI_ALREADY_STARTED   If mandatory table found in AcpiTableInfo is 
already installed.
 **/
 STATIC
 EFI_STATUS
@@ -404,75 +429,68 @@ VerifyMandatoryTablesArePresent (
   IN   UINT32  AcpiTableCount
   )
 {
-  EFI_STATUS  Status;
-  BOOLEAN FadtFound;
-  BOOLEAN MadtFound;
-  BOOLEAN GtdtFound;
-  BOOLEAN DsdtFound;
-  BOOLEAN Dbg2Found;
-  BOOLEAN SpcrFound;
+  EFI_STATUS   Status;
+  UINTNHandle;
+  UINTNIndex;
+  UINTNInstalledTableIndex;
+  EFI_ACPI_DESCRIPTION_HEADER  *DescHeader;
+  EFI_ACPI_TABLE_VERSION   Version;
+  EFI_ACPI_SDT_PROTOCOL*AcpiSdt;
 
-  Status= EFI_SUCCESS;
-  FadtFound = FALSE;
-  MadtFound = FALSE;
-  GtdtFound = FALSE;
-  DsdtFound = FALSE;
-  Dbg2Found = FALSE;
-  SpcrFound = FALSE;
   ASSERT (AcpiTableInfo != NULL);
 
+  Status = EFI_SUCCESS;
+
+  // Check against the statically initialized ACPI tables to see if they are 
in ACPI info list
   while (AcpiTableCount-- != 0) {
-switch (AcpiTableInfo[AcpiTableCount].AcpiTableSignature) {
-  case EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
-FadtFound = TRUE;
-break;
-  case EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
-MadtFound = TRUE;
-break;
-  case EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE:
-GtdtFound = TRUE;
-break;
-  case EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
-DsdtFound = TRUE;
-break;
-  case EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE:
-Dbg2Found = TRUE;
-break;
-  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
-SpcrFound = TRUE;
-break;
-  default:
-break;
+for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
+  if (AcpiTableInfo[AcpiTableCount].AcpiTableSignature == 
mAcpiVerifyTables[Index].AcpiTableSignature) {
+mAcpiVerifyTables[Index].Presence |= ACPI_TABLE_PRESENT_INFO_LIST;
+  }
 }
   }
 
-  // We need at least the FADT, MADT, GTDT and the DSDT tables to boot
-  if (!FadtFound) {
-DEBUG ((DEBUG_ERROR, 

[edk2-devel] [PATCH v2 1/6] DynamicTablesPkg: DynamicPlatRepoLib: Added MemoryAllocationLib to inf

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3996

The DynamicPlatRepoLib has multiple reference to MemoryAllocationLib,
such as DynamicPlatRepo.c and TokenMapper.c. Not including it in the
library inf file could lead to potential build break.

This change added the MemoryAllocationLib into this inf file.

Cc: Sami Mujawar 
Cc: Alexei Fedorov 

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
Reviewed-by: Sami Mujawar 
Reviewed-by: Pierre Gondois 
---

Notes:
v2:
- Added Reviewed-by tag [Sami]
- Added Reviewed-by tag [Pierre]

 DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf 
b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
index 9a3cc87fd91d..8423352550c2 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
@@ -31,3 +31,4 @@ [Packages]
 [LibraryClasses]
   AcpiHelperLib
   BaseLib
+  MemoryAllocationLib
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91927): https://edk2.groups.io/g/devel/message/91927
Mute This Topic: https://groups.io/mt/92664645/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/6] Enhance DynamicTablesPkg modules

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3996
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3997
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3998

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

The main changes between v1 and v2 patches are:
  - Added reviewed-by collected from previous iteration
  - Updated mandatory tables presence verification routine
  - Added checks of config space before creating RES0 nodes

Current DynamicTablesPkg provide great support for creating dynamic ACPI
tables during boot time.

However, there are some modules needs minor tweaks to expand support and
compatibility for OS requirements and platform needs.

This patch series proposes a few fixes to resolve minor issues discovered
in DynamicPlatRepoLib, AcpiSsdtPcieLibArm and DynamicTableManagerDxe.

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

Cc: Sami Mujawar 
Cc: Alexei Fedorov 
Cc: Pierre Gondois 

Kun Qin (6):
  DynamicTablesPkg: DynamicPlatRepoLib: Added MemoryAllocationLib to inf
  DynamicTablesPkg: DynamicPlatRepoLib: Fix incorrect dereferencing
  DynamicTablesPkg: DynamicPlatRepoLib: Adding more token fixers
  DynamicTablesPkg: DynamicTableManagerDxe: Added check for installed
tables
  DynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM
space
  DynamicTablesPkg: AcpiSsdtPcieLibArm: Added case handling for PCI
config

 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c   | 
182 +++-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c   | 
174 +++
 DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c|  
80 -
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf |   
1 +
 DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf  |   
1 +
 5 files changed, 354 insertions(+), 84 deletions(-)

-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH v2 2/6] DynamicTablesPkg: DynamicPlatRepoLib: Fix incorrect dereferencing

2022-07-27 Thread Kun Qin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3996

The content of token should be derived from the data section of the
`CmObject` instead of the object itself.

This change fixed the issue by dereferencing the token value from the
data buffer of input CmObject.

Cc: Sami Mujawar 
Cc: Alexei Fedorov 

Co-authored-by: Joe Lopez 
Signed-off-by: Kun Qin 
Reviewed-by: Sami Mujawar 
Reviewed-by: Pierre Gondois 
---

Notes:
v2:
- Added Reviewed-by tag [Sami]
- Added Reviewed-by tag [Pierre]

 DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c 
b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
index 80d0aa17bc1a..84e4bb7e3bc8 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
@@ -60,7 +60,7 @@ TokenFixerItsGroup (
   )
 {
   ASSERT (CmObject != NULL);
-  ((CM_ARM_ITS_GROUP_NODE *)CmObject)->Token = Token;
+  ((CM_ARM_ITS_GROUP_NODE *)CmObject->Data)->Token = Token;
   return EFI_SUCCESS;
 }
 
-- 
2.37.1.windows.1



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




Re: [edk2-devel] [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: Introduce Bios feature driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg:
> Introduce Bios feature driver
> 
> [CAUTION: External Email]
> 
> Introduce new feature driver to support Bios version 1.0.9 schema.
> Update corresponding FDF and DSC file to enable this feature driver.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../Features/Bios/v1_0_9/Common/BiosCommon.c  | 741
> 
>  .../Features/Bios/v1_0_9/Common/BiosCommon.h  |  30 +
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c| 789 ++
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf  |  52 ++
>  RedfishClientPkg/RedfishClient.fdf.inc|   2 +
>  .../RedfishClientComponents.dsc.inc   |   2 +
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|   6 +-
>  7 files changed, 1621 insertions(+), 1 deletion(-)
>  create mode 100644
> RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>  create mode 100644
> RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h
>  create mode 100644 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
>  create mode 100644
> RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
> 
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> new file mode 100644
> index 00..d910d0d8a9
> --- /dev/null
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> @@ -0,0 +1,741 @@
> +/** @file
> +  Redfish feature driver implementation - common functions
> +
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "BiosCommon.h"
> +
> +CHAR8 BiosEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\":
> \"#Bios.v1_0_9.Bios\", \"Id\": \"\", \"Name\": \"\", \"Attributes\":{}}";
> +
> +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =
> NULL;
> +
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   ThisPointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   JsonThe JSON to consume.
> +  @param[in]   HeaderEtag  The Etag string returned in HTTP header.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishConsumeResourceCommon (
> +  IN  REDFISH_RESOURCE_COMMON_PRIVATE *Private,
> +  IN  CHAR8   *Json,
> +  IN  CHAR8   *HeaderEtag OPTIONAL
> +  )
> +{
> +  EFI_STATUS   Status;
> +  EFI_REDFISH_BIOS_V1_0_9 *Bios;
> +  EFI_REDFISH_BIOS_V1_0_9_CS  *BiosCs;
> +  EFI_STRING   ConfigureLang;
> +  RedfishCS_Type_EmptyProp_CS_Data   *EmptyPropCs;
> +
> +
> +  if (Private == NULL || IS_EMPTY_STRING (Json)) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  Bios = NULL;
> +  BiosCs = NULL;
> +  ConfigureLang = NULL;
> +
> +  Status = Private->JsonStructProtocol->ToStructure (
> +  Private->JsonStructProtocol,
> +  NULL,
> +  Json,
> +  (EFI_REST_JSON_STRUCTURE_HEADER 
> **)
> +  );
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n",
> __FUNCTION__, Status));
> +return Status;
> +  }
> +
> +  BiosCs = Bios->Bios;
> +
> +  //
> +  // Check ETAG to see if we need to consume it
> +  //
> +  if (CheckEtag (Private->Uri, HeaderEtag, BiosCs->odata_etag)) {
> +//
> +// No change
> +//
> +DEBUG ((DEBUG_INFO, "%a, ETAG: %s has no change, ignore consume
> action\n", __FUNCTION__, Private->Uri));
> +Status = EFI_ALREADY_STARTED;
> +goto ON_RELEASE;
> +  }
> +
> +  //
> +  // Handle ATTRIBUTEREGISTRY
> +  //
> +  if (BiosCs->AttributeRegistry != NULL) {
> +//
> +// Find corresponding configure language for collection resource.
> +//
> +ConfigureLang = GetConfigureLang (BiosCs->odata_id,
> "AttributeRegistry");
> +if (ConfigureLang != NULL) {
> +  Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA,
> RESOURCE_SCHEMA_VERSION, ConfigureLang, BiosCs->AttributeRegistry);
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n",
> __FUNCTION__, ConfigureLang, Status));
> +  }
> +
> +  FreePool (ConfigureLang);
> +} else {
> +  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI:
> %s\n", __FUNCTION__, Private->Uri));
> +}
> +  }
> +
> +  //
> +  // Handle ATTRIBUTES
> +  //
> +  if (BiosCs->Attributes 

Re: [edk2-devel] [edk2-staging][PATCH v3 14/15] edk2-staging/RedfishClientPkg: Introduce Computer System feature driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 14/15] edk2-staging/RedfishClientPkg:
> Introduce Computer System feature driver
> 
> [CAUTION: External Email]
> 
> Introduce new feature driver to support Computer System version 1.5.0
> schema. Update corresponding FDF and DSC file to enable this feature
> driver.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../v1_5_0/Common/ComputerSystemCommon.c  | 1614
> +
>  .../v1_5_0/Common/ComputerSystemCommon.h  |   27 +
>  .../v1_5_0/Dxe/ComputerSystemDxe.c|  645 +++
>  .../v1_5_0/Dxe/ComputerSystemDxe.inf  |   51 +
>  RedfishClientPkg/RedfishClient.fdf.inc|2 +
>  .../RedfishClientComponents.dsc.inc   |7 +-
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|1 +
>  7 files changed, 2346 insertions(+), 1 deletion(-)
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSy
> stemCommon.c
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSy
> stemCommon.h
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystem
> Dxe.c
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystem
> Dxe.inf
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> new file mode 100644
> index 00..0a9c746f3b
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> @@ -0,0 +1,1614 @@
> +/** @file
> +  Redfish feature driver implementation - common functions
> +
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "ComputerSystemCommon.h"
> +
> +CHAR8 ComputerSystemEmptyJson[] = "{\"@odata.id\": \"\",
> \"@odata.type\": \"#ComputerSystem.v1_5_0.ComputerSystem\", \"Id\":
> \"\", \"Name\": \"\", \"Boot\":{}}";
> +
> +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =
> NULL;
> +
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   ThisPointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   JsonThe JSON to consume.
> +  @param[in]   HeaderEtag  The Etag string returned in HTTP header.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishConsumeResourceCommon (
> +  IN  REDFISH_RESOURCE_COMMON_PRIVATE *Private,
> +  IN  CHAR8   *Json,
> +  IN  CHAR8   *HeaderEtag OPTIONAL
> +  )
> +{
> +  EFI_STATUS   Status;
> +  EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem;
> +  EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS  *ComputerSystemCs;
> +  EFI_STRING   ConfigureLang;
> +
> +
> +  if (Private == NULL || IS_EMPTY_STRING (Json)) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  ComputerSystem = NULL;
> +  ComputerSystemCs = NULL;
> +  ConfigureLang = NULL;
> +
> +  Status = Private->JsonStructProtocol->ToStructure (
> +  Private->JsonStructProtocol,
> +  NULL,
> +  Json,
> +  (EFI_REST_JSON_STRUCTURE_HEADER
> **)
> +  );
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n",
> __FUNCTION__, Status));
> +return Status;
> +  }
> +
> +  ComputerSystemCs = ComputerSystem->ComputerSystem;
> +
> +  //
> +  // Check ETAG to see if we need to consume it
> +  //
> +  if (CheckEtag (Private->Uri, HeaderEtag, NULL)) {
> +//
> +// No change
> +//
> +DEBUG ((DEBUG_INFO, "%a, ETAG: %s has no change, ignore consume
> action\n", __FUNCTION__, Private->Uri));
> +Status = EFI_ALREADY_STARTED;
> +goto ON_RELEASE;
> +  }
> +
> +  //
> +  // Handle ASSETTAG
> +  //
> +  if (ComputerSystemCs->AssetTag != NULL) {
> +//
> +// Find corresponding configure language for collection resource.
> +//
> +ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id,
> "AssetTag");
> +if (ConfigureLang != NULL) {
> +  Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA,
> RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs-
> >AssetTag);
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n",
> __FUNCTION__, ConfigureLang, Status));
> +  }
> +
> +  

Re: [edk2-devel] [edk2-staging][PATCH v3 13/15] edk2-staging/RedfishClientPkg: Introduce Computer System collection driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 13/15] edk2-staging/RedfishClientPkg:
> Introduce Computer System collection driver
> 
> [CAUTION: External Email]
> 
> Introduce new feature driver to support Computer System Collection
> schema. Update corresponding FDF and DSC file to enable this feature driver.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../ComputerSystemCollectionDxe.c | 667 ++
>  .../ComputerSystemCollectionDxe.h |  21 +
>  .../ComputerSystemCollectionDxe.inf   |  56 ++
>  RedfishClientPkg/RedfishClient.fdf.inc|   2 +
>  .../RedfishClientComponents.dsc.inc   |   2 +
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|   1 +
>  6 files changed, 749 insertions(+)
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.h
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.inf
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.c
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.c
> new file mode 100644
> index 00..dbf5ab3395
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> +++ emCollectionDxe.c
> @@ -0,0 +1,667 @@
> +/** @file
> +
> +  Redfish feature driver implementation - ComputerSystemCollection
> +
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "ComputerSystemCollectionDxe.h"
> +
> +REDFISH_COLLECTION_PRIVATE *mRedfishCollectionPrivate = NULL;
> +
> +EFI_STATUS
> +HandleResource (
> +  IN  REDFISH_COLLECTION_PRIVATE *Private,
> +  IN  EFI_STRING Uri
> +  )
> +{
> +  EFI_STATUS  Status;
> +  REDFISH_SCHEMA_INFO SchemaInfo;
> +  EFI_STRING  ConfigLang;
> +  EFI_STRING  ReturnedConfigLang;
> +  UINTN   Index;
> +
> +  if (Private == NULL || IS_EMPTY_STRING (Uri)) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  //
> +  // Resource match
> +  //
> +
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n",
> + __FUNCTION__, Uri));
> +
> +  Status = GetRedfishSchemaInfo (Private->RedfishService,
> + Private->JsonStructProtocol, Uri, );  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s
> %r\n", __FUNCTION__, Uri, Status));
> +return Status;
> +  }
> +  //
> +  // Check and see if this is target resource that we want to handle.
> +  // Some resource is handled by other provider so we have to make sure
> this first.
> +  //
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%s Identify for %s\n", __FUNCTION__,
> + Uri));  ConfigLang = RedfishGetConfigLanguage (Uri);  if (ConfigLang
> + == NULL) {
> +Status = EdkIIRedfishResourceConfigIdentify (, Uri, Private-
> >InformationExchange);
> +if (EFI_ERROR (Status)) {
> +  if (Status == EFI_UNSUPPORTED) {
> +DEBUG ((DEBUG_INFO, "%a, \"%s\" is not handled by us\n",
> __FUNCTION__, Uri));
> +return EFI_SUCCESS;
> +  }
> +
> +  DEBUG ((DEBUG_ERROR, "%a, fail to identify resource: \"%s\": %r\n",
> __FUNCTION__, Uri, Status));
> +  return Status;
> +}
> +  } else {
> +DEBUG ((REDFISH_DEBUG_TRACE, "%a, history record found: %s\n",
> __FUNCTION__, ConfigLang));
> +//
> +// Set exchange information
> +//
> +Status = GetArrayIndexFromArrayTypeConfigureLang (ConfigLang,
> , );
> +if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) {
> +  Private->InformationExchange->ReturnedInformation.Type =
> InformationTypeCollectionMemberConfigLanguage;
> +  Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.Count = 1;
> +  Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List =
> +AllocateZeroPool(sizeof
> + (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG));
> +
> +  if (Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List == NULL) {
> +DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for
> REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __FUNCTION__));
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +  Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List [0].Index = Index;
> +  Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List 

Re: [edk2-devel] [edk2-staging][PATCH v3 12/15] edk2-staging/RedfishClientPkg: Rename Memory feature driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

This is the auto-gen file. I just give my review tag.

Reviewed-by:  Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 12/15] edk2-staging/RedfishClientPkg:
> Rename Memory feature driver
> 
> [CAUTION: External Email]
> 
> Rename Memory driver by removing Redfish prefix. Update memory feature
> driver and support all properties under Memory schema. Also support
> "Identify" action in this driver. Corresponding changes are made to
> honor newly introduced library and protocol.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../{RedfishMemoryCommon.c => MemoryCommon.c} | 1194 ++-
> --
>  .../{RedfishMemoryCommon.h => MemoryCommon.h} |2 +-
>  .../Dxe/{RedfishMemoryDxe.c => MemoryDxe.c}   |  138 +-
>  .../{RedfishMemoryDxe.inf => MemoryDxe.inf}   |   21 +-
>  .../Include/RedfishResourceCommon.h   |   38 +-
>  RedfishClientPkg/RedfishClient.fdf.inc|2 +-
>  .../RedfishClientComponents.dsc.inc   |2 +-
>  7 files changed, 839 insertions(+), 558 deletions(-)
>  rename
> RedfishClientPkg/Features/Memory/V1_7_1/Common/{RedfishMemoryCo
> mmon.c => MemoryCommon.c} (64%)
>  rename
> RedfishClientPkg/Features/Memory/V1_7_1/Common/{RedfishMemoryCo
> mmon.h => MemoryCommon.h} (89%)
>  rename
> RedfishClientPkg/Features/Memory/V1_7_1/Dxe/{RedfishMemoryDxe.c =>
> MemoryDxe.c} (75%)
>  rename
> RedfishClientPkg/Features/Memory/V1_7_1/Dxe/{RedfishMemoryDxe.inf
> => MemoryDxe.inf} (57%)
> 
> diff --git
> a/RedfishClientPkg/Features/Memory/V1_7_1/Common/RedfishMemoryCo
> mmon.c
> b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.
> c
> similarity index 64%
> rename from
> RedfishClientPkg/Features/Memory/V1_7_1/Common/RedfishMemoryCom
> mon.c
> rename to
> RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> index 11f738f71c..745c5f9847 100644
> ---
> a/RedfishClientPkg/Features/Memory/V1_7_1/Common/RedfishMemoryCo
> mmon.c
> +++
> b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.
> c
> @@ -1,45 +1,54 @@
>  /** @file
>Redfish feature driver implementation - common functions
> 
> -  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
> -#include "RedfishMemoryCommon.h"
> +#include "MemoryCommon.h"
> 
>  CHAR8 MemoryEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\":
> \"#Memory.v1_7_1.Memory\", \"Id\": \"\", \"Name\": \"\"}";
> 
>  REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =
> NULL;
> 
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   ThisPointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   JsonThe JSON to consume.
> +  @param[in]   HeaderEtag  The Etag string returned in HTTP header.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
>  EFI_STATUS
>  RedfishConsumeResourceCommon (
>IN  REDFISH_RESOURCE_COMMON_PRIVATE *Private,
> -  IN  CHAR8 *MemoryJson
> +  IN  CHAR8   *Json,
> +  IN  CHAR8   *HeaderEtag OPTIONAL
>)
>  {
> -  EFI_STATUSStatus;
> +  EFI_STATUS   Status;
>EFI_REDFISH_MEMORY_V1_7_1 *Memory;
>EFI_REDFISH_MEMORY_V1_7_1_CS  *MemoryCs;
> -  EFI_STRINGConfigureLang;
> -  CHAR8 *Arraykey;
> -  CHAR8 *EtagInDb;
> +  EFI_STRING   ConfigureLang;
> +
> 
> -  if (Private == NULL || IS_EMPTY_STRING (MemoryJson)) {
> +  if (Private == NULL || IS_EMPTY_STRING (Json)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  Memory= NULL;
> +  Memory = NULL;
>MemoryCs = NULL;
>ConfigureLang = NULL;
> -  Arraykey = NULL;
> -  EtagInDb = NULL;
> 
>Status = Private->JsonStructProtocol->ToStructure (
>Private->JsonStructProtocol,
>NULL,
> -  MemoryJson,
> +  Json,
>(EFI_REST_JSON_STRUCTURE_HEADER 
> **)
>);
>if (EFI_ERROR (Status)) {
> @@ -52,24 +61,13 @@ RedfishConsumeResourceCommon (
>//
>// Check ETAG to see if we need to consume it
>//
> -  EtagInDb = GetEtagWithUri (Private->Uri);
> -  if (EtagInDb != NULL && MemoryCs->odata_etag != NULL) {
> -if (AsciiStrCmp (EtagInDb, MemoryCs->odata_etag) == 0) {
> -  //
> -  // No change
> -  //
> -  DEBUG ((DEBUG_INFO, 

Re: [edk2-devel] [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg: Rename RedfishMemoryCollection driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg:
> Rename RedfishMemoryCollection driver
> 
> [CAUTION: External Email]
> 
> Rename RedfishMemoryCollectionDxe by removing Redfish prefix. Update
> memory collection driver to support "Identify" action and also have code
> refactoring to support Redfish operation.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../MemoryCollectionDxe.c}| 259 +-
>  .../MemoryCollectionDxe.h}|   7 +-
>  .../MemoryCollectionDxe.inf}  |  19 +-
>  .../Include/RedfishCollectionCommon.h |  14 +-
>  RedfishClientPkg/RedfishClient.fdf.inc|   2 +-
>  .../RedfishClientComponents.dsc.inc   |   2 +-
>  6 files changed, 164 insertions(+), 139 deletions(-)  rename
> RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC
> ollectionDxe.c => MemoryCollectionDxe/MemoryCollectionDxe.c} (66%)
> rename
> RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC
> ollectionDxe.h => MemoryCollectionDxe/MemoryCollectionDxe.h} (64%)
> rename
> RedfishClientPkg/Features/{RedfishMemoryCollectionDxe/RedfishMemoryC
> ollectionDxe.inf => MemoryCollectionDxe/MemoryCollectionDxe.inf} (71%)
> 
> diff --git
> a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory
> CollectionDxe.c
> b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.
> c
> similarity index 66%
> rename from
> RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemoryC
> ollectionDxe.c
> rename to
> RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
> index d97f0f161e..43426a78af 100644
> ---
> a/RedfishClientPkg/Features/RedfishMemoryCollectionDxe/RedfishMemory
> CollectionDxe.c
> +++
> b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.
> +++ c
> @@ -1,67 +1,98 @@
>  /** @file
> -  Redfish feature driver implementation - memory collection
> 
> -  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> +  Redfish feature driver implementation - MemoryCollection
> +
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
> -#include "RedfishMemoryCollectionDxe.h"
> +#include "MemoryCollectionDxe.h"
> 
>  REDFISH_COLLECTION_PRIVATE *mRedfishCollectionPrivate = NULL;
> 
>  EFI_STATUS
> -ProcessResource (
> +HandleResource (
>IN  REDFISH_COLLECTION_PRIVATE *Private,
> -  IN  CHAR8  *Uri
> +  IN  EFI_STRING Uri
>)
>  {
> -  EFI_STATUSStatus;
> -  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> *RedfishResrouceProtocol;
> -  REDFISH_SCHEMA_INFO   SchemaInfo;
> +  EFI_STATUS  Status;
> +  REDFISH_SCHEMA_INFO SchemaInfo;
> +  EFI_STRING  ConfigLang;
> +  EFI_STRING  ReturnedConfigLang;
> +  UINTN   Index;
> 
>if (Private == NULL || IS_EMPTY_STRING (Uri)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %a\n",
> __FUNCTION__, Uri));
> +  //
> +  // Resource match
> +  //
> +
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n",
> + __FUNCTION__, Uri));
> 
>Status = GetRedfishSchemaInfo (Private->RedfishService, Private-
> >JsonStructProtocol, Uri, );
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %a
> %r\n", __FUNCTION__, Uri, Status));
> +DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s
> + %r\n", __FUNCTION__, Uri, Status));
>  return Status;
>}
> +  //
> +  // Check and see if this is target resource that we want to handle.
> +  // Some resource is handled by other provider so we have to make sure
> this first.
> +  //
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%s Identify for %s\n", __FUNCTION__,
> + Uri));  ConfigLang = RedfishGetConfigLanguage (Uri);  if (ConfigLang
> + == NULL) {
> +Status = EdkIIRedfishResourceConfigIdentify (, Uri, Private-
> >InformationExchange);
> +if (EFI_ERROR (Status)) {
> +  if (Status == EFI_UNSUPPORTED) {
> +DEBUG ((DEBUG_INFO, "%a, \"%s\" is not handled by us\n",
> __FUNCTION__, Uri));
> +return EFI_SUCCESS;
> +  }
> 
> -  RedfishResrouceProtocol = GetRedfishResourceConfigProtocol (
> -  SchemaInfo.Schema,
> -  SchemaInfo.Major,
> -  SchemaInfo.Minor,
> -  SchemaInfo.Errata
> -  );
> -  if 

Re: [edk2-devel] [PATCH v2 1/2] MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition

2022-07-27 Thread Wu, Hao A
As previously mentioned in https://edk2.groups.io/g/devel/message/90345, the 
PPI interface looks good from the device controllers perspective:
Reviewed-by: Hao A Wu 

Sorry Ray and Liming, do you have additional comments for this newly introduced 
EDKII_PCI_DEVICE_PPI?

Best Regards,
Hao Wu

> -Original Message-
> From: Czajkowski, Maciej 
> Sent: Wednesday, July 27, 2022 8:28 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A ; Ni, Ray ; Gao,
> Liming 
> Subject: [PATCH v2 1/2] MdeModulePkg: Add EDKII_PCI_DEVICE_PPI
> definition
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907
> 
> This commit introduces EDKII_PCI_DEVICE_PPI. The purpose of this PPI is to
> provide a way of accessing PCI devices to drvice drivers such as
> NvmExpressPei or AhciPei.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Liming Gao 
> Signed-off-by: Maciej Czajkowski 
> Acked-by: Hao A Wu 
> ---
> 
> Notes:
> v2 changes:
> - added acked-by tag
> - minor change - modified header guard to follow coding style
> 
>  MdeModulePkg/Include/Ppi/PciDevice.h | 32 
>  MdeModulePkg/MdeModulePkg.dec|  3 ++
>  2 files changed, 35 insertions(+)
> 
> diff --git a/MdeModulePkg/Include/Ppi/PciDevice.h
> b/MdeModulePkg/Include/Ppi/PciDevice.h
> new file mode 100644
> index ..6750ae6ce394
> --- /dev/null
> +++ b/MdeModulePkg/Include/Ppi/PciDevice.h
> @@ -0,0 +1,32 @@
> +/** @file++  Copyright (c) 2022, Intel Corporation. All rights reserved.+
> SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#ifndef
> EDKII_PCI_DEVICE_PPI_H_+#define EDKII_PCI_DEVICE_PPI_H_++#include
> +#include ++///+/// Global ID for
> the EDKII_PCI_DEVICE_PPI_GUID.+///+#define
> EDKII_PCI_DEVICE_PPI_GUID \+  { \+0x1597ab4f, 0xd542, 0x4efe, { 0x9a,
> 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 0x0b } \+  }++///+/// PCI Device PPI
> structure.+///+typedef struct {+  EFI_PCI_IO_PROTOCOL PciIo;+
> EFI_DEVICE_PATH_PROTOCOL*DevicePath;+}
> EDKII_PCI_DEVICE_PPI;++extern EFI_GUID
> gEdkiiPeiPciDevicePpiGuid;++#endif // EDKII_PCI_DEVICE_PPI_H_diff --git
> a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index 2bcb9f9453af..7d989108324a 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -509,6 +509,9 @@ [Ppis]
>## Include/Ppi/NvmExpressPassThru.h
> gEdkiiPeiNvmExpressPassThruPpiGuid= { 0x6af31b2c, 0x3be, 0x46c1, { 0xb1,
> 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } } +  ## Include/Ppi/PciDevice.h+
> gEdkiiPeiPciDevicePpiGuid = { 0x1597ab4f, 0xd542, 0x4efe, { 
> 0x9a,
> 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 0x0b } }+   ## Include/Ppi/CapsuleOnDisk.h
> gEdkiiPeiCapsuleOnDiskPpiGuid = { 0x71a9ea61, 0x5a35, 0x4a5d, { 
> 0xac,
> 0xef, 0x9c, 0xf8, 0x6d, 0x6d, 0x67, 0xe0 } }
> gEdkiiPeiBootInCapsuleOnDiskModePpiGuid   = { 0xb08a11e4, 0xe2b7,
> 0x4b75, { 0xb5, 0x15, 0xaf, 0x61, 0x6, 0x68, 0xbf, 0xd1  } }--
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91920): https://edk2.groups.io/g/devel/message/91920
Mute This Topic: https://groups.io/mt/92647829/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 2/2] MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device

2022-07-27 Thread Wu, Hao A
1. In the AHCI PEIM entrypoint, after registering the PPI callbacks for:
* gEdkiiPeiAtaAhciHostControllerPpiGuid and
* gEdkiiPeiPciDevicePpiGuid
My take is that there is no need to locate above PPI instances already 
installed within system (codes in entry point that come after the callback 
registration).
The current implementation of PeiServicesNotifyPpi (details can be referred at 
MdeModulePkg\Core\Pei\Ppi\Ppi.c - InternalPeiNotifyPpi) will invoke the 
callback functions for all the matched PPI instances already installed.
Could you help to double confirm on this in your unit test? Sorry for missing 
this on the V1 patch.

2. Please help to move the function declaration for:
AtaAhciHostControllerPpiInstallationCallback()
AtaAhciPciDevicePpiInstallationCallback()
from AhciPei.c to AhciPei.h to keep consistency.

3. The function description comments for:
AtaAhciHostControllerPpiInstallationCallback()
AtaAhciPciDevicePpiInstallationCallback()
do not exactly match between their declaration and definition.

4. During the enabling of the HC in function 
AtaAhciInitPrivateDataFromPciDevice():
  Status = PciDevice->PciIo.Attributes (
  >PciIo,
  EfiPciIoAttributeOperationSet,
  EFI_PCI_DEVICE_ENABLE,
  NULL
  );
Could you help to update the flow to align with AtaAtapiPassThru DXE 
counterpart when enabling the controller?
MdeModulePkg\Bus\Ata\AtaAtapiPassThru\AtaAtapiPassThru.c - 
AtaAtapiPassThruStart():
  Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationSupported,
0,

);
  if (!EFI_ERROR (Status)) {
EnabledPciAttributes &= (UINT64)EFI_PCI_DEVICE_ENABLE;
Status= PciIo->Attributes (
 PciIo,
 EfiPciIoAttributeOperationEnable,
 EnabledPciAttributes,
 NULL
 );
  }

5. DEBUG ((DEBUG_ERROR, "%a: Using AtaAhciHostControllerPpi to initialize 
private data.\n", __FUNCTION__));
-> DEBUG ((DEBUG_INFO, "%a: Using AtaAhciHostControllerPpi to initialize 
private data.\n", __FUNCTION__));

6. I think for AtaAhciInitPrivateDataFromPciDevices(), the below code snippet:
//
// Override the status to continue the for loop
//
Status = EFI_SUCCESS;
is no longer needed. Could you help to check?


Best Regards,
Hao Wu

> -Original Message-
> From: Czajkowski, Maciej 
> Sent: Wednesday, July 27, 2022 8:28 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A ; Ni, Ray ; Gao,
> Liming 
> Subject: [PATCH v2 2/2] MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to
> manage AHCI device
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907
> 
> This change modifies AhciPei library to allow usage both
> EDKII_PCI_DEVICE_PPI and EDKII_PEI_ATA_AHCI_HOST_CONTROLLER_PPI
> to manage ATA HDD working under AHCI mode.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Liming Gao 
> Signed-off-by: Maciej Czajkowski 
> ---
> 
> Notes:
> v2 changes:
> - added missing function descriptions
> - moved controller initialization from PCI_DEVICE_PPI to seperate funciton
> in order to reduce code duplication
> - added DevicePathLib BASE instance to the MdeModulePkg.dec to allow
> PEIMs to consume it
> 
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c| 585 ++--
>  MdeModulePkg/Bus/Ata/AhciPei/DevicePath.c |  44 --
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  17 +-
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.inf  |   5 +-
>  MdeModulePkg/MdeModulePkg.dsc |   1 +
>  5 files changed, 430 insertions(+), 222 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> index 208b7e9a3606..8ad98dc76bc1 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> @@ -9,6 +9,47 @@
>  **/  #include "AhciPei.h"+#include +#include
> +#include ++/**+
> Callback for EDKII_ATA_AHCI_HOST_CONTROLLER_PPI installation.++
> @param[in] PeiServices Pointer to PEI Services Table.+  @param[in]
> NotifyDescriptorPointer to the descriptor for the Notification+
> event that caused this function to execute.+  @param[in] Ppi 
> Pointer
> to the PPI data associated with this function.++  @retval EFI_SUCCESSThe
> function completes
> successfully++**/+EFI_STATUS+EFIAPI+AtaAhciHostControllerPpiInstallation
> Callback (+  IN EFI_PEI_SERVICES   **PeiServices,+  IN
> EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,+  IN VOID
> *Ppi+  );++/**+  Callback for EDKII_PCI_DEVICE_PPI installation.++
> @param[in] PeiServices Pointer to PEI Services Table.+  @param[in]
> NotifyDescriptorPointer to the descriptor for the Notification+
> event that caused this 

Re: [edk2-devel] [edk2-staging][PATCH v3 09/15] edk2-staging/RedfishClientPkg: Update RedfishLib

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 09/15] edk2-staging/RedfishClientPkg:
> Update RedfishLib
> 
> [CAUTION: External Email]
> 
> RedfishLib has no capability to return HTTP header in response.
> However, feature driver needs to know the information like "ETag" or
> "Location" in HTTP response header per Redfish specification. Add
> corresponding function to return HTTP header in response data.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../PrivateLibrary/RedfishLib/RedfishLib.c|  12 +-
>  .../edk2libredfish/include/redfishPayload.h   |   5 +-
>  .../edk2libredfish/include/redfishService.h   |   5 +-
>  .../RedfishLib/edk2libredfish/src/payload.c   |  90 ++-
>  .../RedfishLib/edk2libredfish/src/service.c   | 554 +-
>  5 files changed, 657 insertions(+), 9 deletions(-)
> 
> diff --git a/RedfishClientPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> b/RedfishClientPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> index 18aa4646e8..b8ca493e24 100644
> --- a/RedfishClientPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> +++ b/RedfishClientPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> @@ -3,7 +3,7 @@
>(CRUD) Redfish resources and provide basic query.
> 
>Copyright (c) 2019, Intel Corporation. All rights reserved.
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -323,7 +323,7 @@ RedfishGetByUri (
> 
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> 
> -  JsonValue = getUriFromService (RedfishService, Uri, 
> >StatusCode);
> +  JsonValue = getUriFromServiceEx (RedfishService, Uri,
> + >Headers, >HeaderCount,
> + >StatusCode);
>RedResponse->Payload = createRedfishPayload(JsonValue, RedfishService);
> 
>//
> @@ -541,9 +541,11 @@ RedfishPatchToPayload (
> 
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> 
> -  RedResponse->Payload = (REDFISH_PAYLOAD) patchPayload (
> +  RedResponse->Payload = (REDFISH_PAYLOAD) patchPayloadEx (
>   Target,
>   Payload,
> + >Headers,
> + >HeaderCount,
>   &(RedResponse->StatusCode)
>   );
> 
> @@ -607,9 +609,11 @@ RedfishPostToPayload (
> 
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> 
> -  RedResponse->Payload = (REDFISH_PAYLOAD) postPayload (
> +  RedResponse->Payload = (REDFISH_PAYLOAD) postPayloadEx (
>   Target,
>   Payload,
> + >Headers,
> + >HeaderCount,
>   &(RedResponse->StatusCode)
>   );
> 
> diff --git
> a/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfish
> Payload.h
> b/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfish
> Payload.h
> index 43149f3c89..be74c64297 100644
> ---
> a/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfish
> Payload.h
> +++ b/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/
> +++ redfishPayload.h
> @@ -9,7 +9,7 @@
>  
> //
> 
>Copyright (c) 2019, Intel Corporation. All rights reserved.
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -29,8 +29,11 @@ redfishPayload* getPayloadByIndex(redfishPayload*
> payload, size_t index, EFI_HTT
>  redfishPayload* getPayloadForPath(redfishPayload* payload,
> redPathNode* redpath, EFI_HTTP_STATUS_CODE** StatusCode);
>  redfishPayload* getPayloadForPathString(redfishPayload* payload, const
> char* string, EFI_HTTP_STATUS_CODE** StatusCode);
>  redfishPayload* patchPayload(redfishPayload* target, redfishPayload*
> payload, EFI_HTTP_STATUS_CODE** StatusCode);
> +redfishPayload* patchPayloadEx(redfishPayload* target, redfishPayload*
> +payload, EFI_HTTP_HEADER **Headers, UINTN *HeaderCount,
> +EFI_HTTP_STATUS_CODE** StatusCode);
>  redfishPayload* postContentToPayload(redfishPayload* target, const char*
> data, size_t dataSize, const char* contentType, EFI_HTTP_STATUS_CODE**
> StatusCode);
> +redfishPayload* postContentToPayloadEx(redfishPayload* target, const
> +char* data, size_t dataSize, const char* contentType, 

Re: [edk2-devel] [edk2-staging][PATCH v3 08/15] edk2-staging/RedfishClientPkg: Update Redfish feature core driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 08/15] edk2-staging/RedfishClientPkg:
> Update Redfish feature core driver
> 
> [CAUTION: External Email]
> 
> Update Redfish feature core driver to support Redfish resource with multiple
> parents. A resource may be presented in different resource and the link in
> different resource point to the same location. Also add interchange data
> interface in feature core driver so feature core driver can talk to feature
> drivers directly.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../Include/Protocol/EdkIIRedfishFeature.h|  20 +-
>  .../RedfishFeatureCoreDxe.c   | 290 --
>  .../RedfishFeatureCoreDxe.h   |  20 +-
>  .../RedfishFeatureCoreDxe.inf |   5 +-
>  4 files changed, 278 insertions(+), 57 deletions(-)
> 
> diff --git a/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h
> b/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h
> index 036622128d..26814c8786 100644
> --- a/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h
> +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h
> @@ -1,7 +1,7 @@
>  /** @file
>This file defines the EDKII_REDFISH_FEATURE_PROTOCOL interface.
> 
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -10,6 +10,8 @@
>  #ifndef EDKII_REDFISH_FEATURE_H_
>  #define EDKII_REDFISH_FEATURE_H_
> 
> +#include 
> +
>  typedef struct _EDKII_REDFISH_FEATURE_PROTOCOL
> EDKII_REDFISH_FEATURE_PROTOCOL;
> 
>  #define EDKII_REDFISH_FEATURE_PROTOCOL_GUID \ @@ -23,25 +25,13
> @@ typedef enum {
>CallbackActionMax
>  } FEATURE_CALLBACK_ACTION;
> 
> -typedef enum {
> -  InformationTypeNone = 0,///< Invalid information.
> -  InformationTypeCollectionMemberUri, ///< URI to the new created
> collection member.
> -  InformationTypeMax
> -} FEATURE_RETURNED_INFORMATION_TYPE;
> -
> -typedef struct {
> -  FEATURE_RETURNED_INFORMATION_TYPE Type; -}
> FEATURE_RETURNED_INFORMATION;
> -
>  /**
>The callback function provided by Redfish Feature driver.
> 
>@param[in] ThisPointer to 
> EDKII_REDFISH_FEATURE_PROTOCOL
> instance.
>@param[in] FeatureAction   The action Redfish feature driver should
> take.
>@param[in] Context The context of Redfish feature driver.
> -  @param[in,out] InformationReturned The pointer to retrive the pointer to
> - FEATURE_RETURNED_INFOMATION. The memory 
> block
> of this
> - information should be freed by caller.
> +  @param[in,out] ExchangeInformation The pointer to
> RESOURCE_INFORMATION_EXCHANGE.
> 
>@retval EFI_SUCCESS  Redfish feature driver callback is 
> executed
> successfully.
>@retval Others   Some errors happened.
> @@ -53,7 +43,7 @@ EFI_STATUS
>IN EDKII_REDFISH_FEATURE_PROTOCOL *This,
>IN FEATURE_CALLBACK_ACTIONFeatureAction,
>IN VOID   *Context,
> -  IN OUT FEATURE_RETURNED_INFORMATION   **InformationReturned
> +  IN OUT RESOURCE_INFORMATION_EXCHANGE  *ExchangeInformation
>  );
>  /**
>The registration function for the Redfish Feature driver.
> diff --git
> a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> index 49e1cd6b60..3414f0c942 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> @@ -2,7 +2,7 @@
>RedfishFeatureCoreDxe produces EdkIIRedfishFeatureCoreProtocol
>for EDK2 Redfish Feature driver registration.
> 
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -13,38 +13,188 @@
>  EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent;
>  REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext;
> REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList;
> +RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
> +
> +/**
> +  Setup the information to deliver to child feature/collection driver.
> +
> +  @param[in]  ThisList REDFISH_FEATURE_INTERNAL_DATA 
> instance.
> +  @param[in]  ParentConfgLanguageUri   Parent configure language URI.
> +
> +**/
> +EFI_STATUS
> +SetupExchangeInformationInfo (
> +  IN REDFISH_FEATURE_INTERNAL_DATA *ThisList,
> +  IN EFI_STRINGParentConfgLanguageUri
> +  )
> +{
> +  

Re: [edk2-devel] [edk2-staging][PATCH v3 07/15] edk2-staging/RedfishClientPkg: Update ETag driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 07/15] edk2-staging/RedfishClientPkg:
> Update ETag driver
> 
> [CAUTION: External Email]
> 
> Update ETag driver and use specific variable GUID. Also fix the typo in
> comment.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  RedfishClientPkg/RedfishClientPkg.dec|  2 +-
>  RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c | 10 +-
> RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h |  4 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index 7bdab5be0c..67929341df 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -36,7 +36,7 @@
>gEdkIIRedfishFeatureProtocolGuid= { 0x785CC694, 0x4930, 0xEFBF,
> { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
>## Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
>gEdkIIRedfishResourceConfigProtocolGuid = { 0x6f164c68, 0xfb09, 0x4646,
> { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } }
> -  ## Include/Protocol/EdkiiRedfishETagProtocol.h
> +  ## Include/Protocol/EdkIIRedfishETagProtocol.h
>gEdkIIRedfishETagProtocolGuid   = { 0x5706d368, 0xaf66, 0x48f5, { 
> 0x89,
> 0xfc, 0xa6, 0x61, 0xce, 0xb5, 0xa6, 0xa9 } }
>## Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h
>gEdkIIRedfishConfigLangMapProtocolGuid= { 0x1d9ba9fe, 0x5d5a, 0x4b66,
> {0x83, 0x5b, 0xe2, 0x5d, 0x13, 0x93, 0x4a, 0x9c } }
> diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> index 73d3a8c39a..52015672f9 100644
> --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -398,17 +398,17 @@ SaveETagList (
>//
>Status = GetVariable2 (
>   VariableName,
> - ,
> + ,
>   (VOID *),
>   NULL
>   );
>if (!EFI_ERROR (Status)) {
>  FreePool (Data);
> -gRT->SetVariable (VariableName, ,
> VARIABLE_ATTRIBUTE_NV_BS, 0, NULL);
> +gRT->SetVariable (VariableName, ,
> + VARIABLE_ATTRIBUTE_NV_BS, 0, NULL);
>}
> 
> 
> -  return gRT->SetVariable (VariableName, ,
> VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
> +  return gRT->SetVariable (VariableName, ,
> + VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
>  }
> 
>  /**
> @@ -444,7 +444,7 @@ InitialETagList (
>//
>Status = GetVariable2 (
>   VariableName,
> - ,
> + ,
>   (VOID *),
>   
>   );
> diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> index 58925b4a51..3deab377dc 100644
> --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> @@ -1,7 +1,7 @@
>  /** @file
>Common header file for RedfishETagDxe driver.
> 
> -  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -11,6 +11,7 @@
>  #define REDFISH_ETAG_DXE_H_
> 
>  #include 
> +#include 
> 
>  //
>  // Libraries
> @@ -30,7 +31,6 @@
>  #include 
> 
>  #define ETAG_VARIABLE_NAMEL"RedfishETag"
> -#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
>  #define ETAG_DEBUG_ENABLED0x00
> 
>  //
> --
> 2.32.0.windows.2


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




Re: [edk2-devel] [edk2-staging][PATCH v3 06/15] edk2-staging/RedfishClientPkg: Introduce RedfishConfigLangMap driver

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 06/15] edk2-staging/RedfishClientPkg:
> Introduce RedfishConfigLangMap driver
> 
> [CAUTION: External Email]
> 
> Introduce Redfish configure language map driver. This driver keeps the
> mapping between configure language and Redfish URI for internal use.
> This saves the communication time between feature drivers and Redfish
> service. It also provides the history records so that feature drivers can do
> provisioning, consuming and updating efficiently.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../EdkIIRedfishConfigLangMapProtocol.h   |  88 ++
>  RedfishClientPkg/RedfishClient.fdf.inc|   3 +-
>  .../RedfishClientComponents.dsc.inc   |   1 +
>  RedfishClientPkg/RedfishClientPkg.dec |   2 +
>  .../RedfishConfigLangMapDxe.c | 810 ++
>  .../RedfishConfigLangMapDxe.h |  71 ++
>  .../RedfishConfigLangMapDxe.inf   |  46 +
>  7 files changed, 1020 insertions(+), 1 deletion(-)  create mode 100644
> RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h
>  create mode 100644
> RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
>  create mode 100644
> RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
>  create mode 100644
> RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
> 
> diff --git
> a/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h
> b/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtocol.h
> new file mode 100644
> index 00..03d18aa297
> --- /dev/null
> +++
> b/RedfishClientPkg/Include/Protocol/EdkIIRedfishConfigLangMapProtoco
> +++ l.h
> @@ -0,0 +1,88 @@
> +/** @file
> +  This file defines the EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL
> interface.
> +
> +  (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_H_
> +#define EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_H_
> +
> +typedef struct _EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL
> +EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL;
> +
> +/**
> + Definition of REDFISH_CONFIG_LANG_MAP_GET_TYPE  **/ typedef enum
> {
> +  RedfishGetTypeUri = 0,
> +  RedfishGetTypeConfigLang,
> +  RedfishGetTypeMax
> +} REDFISH_CONFIG_LANG_MAP_GET_TYPE;
> +
> +/**
> +  Get string in database by given query string.
> +
> +  @param[in]   ThisPointer to
> EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL instance.
> +  @param[in]   QueryStringType The type of given QueryString.
> +  @param[in]   QueryString Query string.
> +  @param[out]  ResultStringReturned string mapping to give query
> string.
> +
> +  @retval EFI_SUCCESS  The result is found successfully.
> +  @retval EFI_INVALID_PARAMETERInvalid parameter is given.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_GET) (
> +  IN  EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL  *This,
> +  IN  REDFISH_CONFIG_LANG_MAP_GET_TYPEQueryStringType,
> +  IN  EFI_STRING  QueryString,
> +  OUT EFI_STRING  *ResultString
> +  );
> +
> +/**
> +  Save URI string which maps to given ConfigLang.
> +
> +  @param[in]   ThisPointer to
> EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL instance.
> +  @param[in]   ConfigLang  Config language to set
> +  @param[in]   Uri Uri which is mapping to give ConfigLang. 
> If Uri is
> NULL,
> +   the record will be removed.
> +
> +  @retval EFI_SUCCESS  Uri is saved successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_SET) (
> +  IN  EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL  *This,
> +  IN  EFI_STRING  ConfigLang,
> +  IN  EFI_STRING  UriOPTIONAL
> +  );
> +
> +/**
> +  Refresh the resource map database and save database to variable.
> +
> +  @param[in]   ThisPointer to
> EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL instance.
> +
> +  @retval EFI_SUCCESS  database is saved successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_FLUSH) (
> +  IN  EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL*This
> +  );
> +
> +struct _EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL {
> +  EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_GET   Get;
> +  EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL_SET   Set;
> +  

Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Michael D Kinney
The commit message and comments for the #defines
for the retry count and timeouts should state that
the values are required by spec and name the spec.

Thanks,

Mike

> -Original Message-
> From: Zhang, Qi1 
> Sent: Wednesday, July 27, 2022 5:41 PM
> To: Kinney, Michael D ; devel@edk2.groups.io; 
> Yao, Jiewen 
> Cc: Wang, Jian J 
> Subject: RE: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm 
> command
> 
> Retry count is suggested in the spec.
> 
> PtpCrbWaitRegisterBits() already has delay.
> 
> Thanks!
> Qi Zhang
> 
> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, July 28, 2022 12:38 AM
> To: devel@edk2.groups.io; Yao, Jiewen ; Zhang, Qi1 
> ; Kinney, Michael D
> 
> Cc: Wang, Jian J 
> Subject: RE: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm 
> command
> 
> Why is 3 the correct retry count?
> 
> Do we need this to be configurable?
> 
> Is a delay required between retries?
> 
> What specific state is a DTPM getting into that requires this retry 
> mechanism?  Can that state be detected?
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Yao,
> > Jiewen
> > Sent: Wednesday, July 27, 2022 5:07 AM
> > To: Zhang, Qi1 ; devel@edk2.groups.io
> > Cc: Wang, Jian J 
> > Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for
> > tpm command
> >
> > Thanks. Please add Bugzilla ID and add tested-by tag by the people who 
> > performed the test.
> >
> > For the code, reviewed-by: Jiewen Yao 
> >
> > > -Original Message-
> > > From: Zhang, Qi1 
> > > Sent: Wednesday, July 27, 2022 7:36 PM
> > > To: devel@edk2.groups.io
> > > Cc: Zhang, Qi1 ; Yao, Jiewen
> > > ; Wang, Jian J 
> > > Subject: [PATCH] SecurityPkg: Add retry mechanism for tpm command
> > >
> > > Signed-off-by: Qi Zhang 
> > > Cc: Jiewen Yao 
> > > Cc: Jian J Wang 
> > > ---
> > >  .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
> > >  1 file changed, 68 insertions(+), 39 deletions(-)
> > >
> > > diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > > b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > > index 1d99beaa10..6b5994fde2 100644
> > > --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > > +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > > @@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  //
> > >
> > >  #define TPMCMDBUFLENGTH  0x500
> > >
> > >
> > >
> > > +//
> > >
> > > +// Max retry count
> > >
> > > +//
> > >
> > > +#define RETRY_CNT_MAX  3
> > >
> > > +
> > >
> > >  /**
> > >
> > >Check whether TPM PTP register exist.
> > >
> > >
> > >
> > > @@ -153,6 +158,7 @@ PtpCrbTpmCommand (
> > >UINT32  TpmOutSize;
> > >
> > >UINT16  Data16;
> > >
> > >UINT32  Data32;
> > >
> > > +  UINT8   RetryCnt;
> > >
> > >
> > >
> > >DEBUG_CODE_BEGIN ();
> > >
> > >UINTN  DebugSize;
> > >
> > > @@ -179,53 +185,76 @@ PtpCrbTpmCommand (
> > >DEBUG_CODE_END ();
> > >
> > >TpmOutSize = 0;
> > >
> > >
> > >
> > > -  //
> > >
> > > -  // STEP 0:
> > >
> > > -  // if CapCRbIdelByPass == 0, enforce Idle state before sending
> > > command
> > >
> > > -  //
> > >
> > > -  if ((GetCachedIdleByPass () == 0) && ((MmioRead32
> > > ((UINTN)
> > > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> > >
> > > +  RetryCnt = 0;
> > >
> > > +  while (TRUE) {
> > >
> > > +//
> > >
> > > +// STEP 0:
> > >
> > > +// if CapCRbIdelByPass == 0, enforce Idle state before sending
> > > + command
> > >
> > > +//
> > >
> > > +if ((GetCachedIdleByPass () == 0) && ((MmioRead32
> > > + ((UINTN)
> > > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> > >
> > > +  Status = PtpCrbWaitRegisterBits (
> > >
> > > + >CrbControlStatus,
> > >
> > > + PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> > >
> > > + 0,
> > >
> > > + PTP_TIMEOUT_C
> > >
> > > + );
> > >
> > > +  if (EFI_ERROR (Status)) {
> > >
> > > +RetryCnt++;
> > >
> > > +if (RetryCnt < RETRY_CNT_MAX) {
> > >
> > > +  MmioWrite32 ((UINTN)>CrbControlRequest,
> > > PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> > >
> > > +  continue;
> > >
> > > +} else {
> > >
> > > +  //
> > >
> > > +  // Try to goIdle to recover TPM
> > >
> > > +  //
> > >
> > > +  Status = EFI_DEVICE_ERROR;
> > >
> > > +  goto GoIdle_Exit;
> > >
> > > +}
> > >
> > > +  }
> > >
> > > +}
> > >
> > > +
> > >
> > > +//
> > >
> > > +// STEP 1:
> > >
> > > +// Ready is any time the TPM is ready to receive a command,
> > > + following a
> > > write
> > >
> > > +// of 1 by software to Request.cmdReady, as indicated by the
> > > + Status field
> > >
> > > +// being cleared to 0.
> > >
> > > +//
> > >
> > > +MmioWrite32 ((UINTN)>CrbControlRequest,
> > > 

[edk2-devel] [Patch 1/1] Maintainers.txt: Add missing Github IDs for OvmfPkg TPM/TGC modules

2022-07-27 Thread Michael D Kinney
Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Cc: Marc-André Lureau 
Cc: Stefan Berger 
Signed-off-by: Michael D Kinney 
---
 Maintainers.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index 071644c35612..a0d8b6968505 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -495,8 +495,8 @@ F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 F: OvmfPkg/Library/Tcg2PhysicalPresenceLib*/
 F: OvmfPkg/PlatformPei/ClearCache.c
 F: OvmfPkg/Tcg/
-R: Marc-André Lureau 
-R: Stefan Berger 
+R: Marc-André Lureau  [elmarco]
+R: Stefan Berger  [stefanberger]
 
 OvmfPkg: Xen-related modules
 F: OvmfPkg/Include/Guid/XenBusRootDevice.h
-- 
2.32.0.windows.1



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




[edk2-devel] [PATCH v2] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Qi Zhang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3980

Signed-off-by: Qi Zhang 
Cc: Jiewen Yao 
Cc: Jian J Wang 
Reviewed-by: Jiewen Yao 
Tested-by: Swapnil Patil 
---
 .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
 1 file changed, 68 insertions(+), 39 deletions(-)

diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c 
b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
index 1d99beaa10..6b5994fde2 100644
--- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
+++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
@@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 #define TPMCMDBUFLENGTH  0x500
 
+//
+// Max retry count
+//
+#define RETRY_CNT_MAX  3
+
 /**
   Check whether TPM PTP register exist.
 
@@ -153,6 +158,7 @@ PtpCrbTpmCommand (
   UINT32  TpmOutSize;
   UINT16  Data16;
   UINT32  Data32;
+  UINT8   RetryCnt;
 
   DEBUG_CODE_BEGIN ();
   UINTN  DebugSize;
@@ -179,53 +185,76 @@ PtpCrbTpmCommand (
   DEBUG_CODE_END ();
   TpmOutSize = 0;
 
-  //
-  // STEP 0:
-  // if CapCRbIdelByPass == 0, enforce Idle state before sending command
-  //
-  if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
((UINTN)>CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 
0)) {
+  RetryCnt = 0;
+  while (TRUE) {
+//
+// STEP 0:
+// if CapCRbIdelByPass == 0, enforce Idle state before sending command
+//
+if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
((UINTN)>CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 
0)) {
+  Status = PtpCrbWaitRegisterBits (
+ >CrbControlStatus,
+ PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+ 0,
+ PTP_TIMEOUT_C
+ );
+  if (EFI_ERROR (Status)) {
+RetryCnt++;
+if (RetryCnt < RETRY_CNT_MAX) {
+  MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+  continue;
+} else {
+  //
+  // Try to goIdle to recover TPM
+  //
+  Status = EFI_DEVICE_ERROR;
+  goto GoIdle_Exit;
+}
+  }
+}
+
+//
+// STEP 1:
+// Ready is any time the TPM is ready to receive a command, following a 
write
+// of 1 by software to Request.cmdReady, as indicated by the Status field
+// being cleared to 0.
+//
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
 Status = PtpCrbWaitRegisterBits (
-   >CrbControlStatus,
-   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+   >CrbControlRequest,
0,
+   PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
PTP_TIMEOUT_C
);
 if (EFI_ERROR (Status)) {
-  //
-  // Try to goIdle to recover TPM
-  //
-  Status = EFI_DEVICE_ERROR;
-  goto GoIdle_Exit;
+  RetryCnt++;
+  if (RetryCnt < RETRY_CNT_MAX) {
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+continue;
+  } else {
+Status = EFI_DEVICE_ERROR;
+goto GoIdle_Exit;
+  }
 }
-  }
 
-  //
-  // STEP 1:
-  // Ready is any time the TPM is ready to receive a command, following a write
-  // of 1 by software to Request.cmdReady, as indicated by the Status field
-  // being cleared to 0.
-  //
-  MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
-  Status = PtpCrbWaitRegisterBits (
- >CrbControlRequest,
- 0,
- PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
- PTP_TIMEOUT_C
- );
-  if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
-goto GoIdle_Exit;
-  }
+Status = PtpCrbWaitRegisterBits (
+   >CrbControlStatus,
+   0,
+   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+   PTP_TIMEOUT_C
+   );
+if (EFI_ERROR (Status)) {
+  RetryCnt++;
+  if (RetryCnt < RETRY_CNT_MAX) {
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+continue;
+  } else {
+Status = EFI_DEVICE_ERROR;
+goto GoIdle_Exit;
+  }
+}
 
-  Status = PtpCrbWaitRegisterBits (
- >CrbControlStatus,
- 0,
- PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
- PTP_TIMEOUT_C
- );
-  if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
-goto GoIdle_Exit;
+break;
   }
 
   //
-- 
2.26.2.windows.1



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




Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Qi Zhang
Retry count is suggested in the spec.

PtpCrbWaitRegisterBits() already has delay.

Thanks!
Qi Zhang

-Original Message-
From: Kinney, Michael D  
Sent: Thursday, July 28, 2022 12:38 AM
To: devel@edk2.groups.io; Yao, Jiewen ; Zhang, Qi1 
; Kinney, Michael D 
Cc: Wang, Jian J 
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm 
command

Why is 3 the correct retry count?

Do we need this to be configurable?

Is a delay required between retries?

What specific state is a DTPM getting into that requires this retry mechanism?  
Can that state be detected?

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yao, 
> Jiewen
> Sent: Wednesday, July 27, 2022 5:07 AM
> To: Zhang, Qi1 ; devel@edk2.groups.io
> Cc: Wang, Jian J 
> Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for 
> tpm command
> 
> Thanks. Please add Bugzilla ID and add tested-by tag by the people who 
> performed the test.
> 
> For the code, reviewed-by: Jiewen Yao 
> 
> > -Original Message-
> > From: Zhang, Qi1 
> > Sent: Wednesday, July 27, 2022 7:36 PM
> > To: devel@edk2.groups.io
> > Cc: Zhang, Qi1 ; Yao, Jiewen 
> > ; Wang, Jian J 
> > Subject: [PATCH] SecurityPkg: Add retry mechanism for tpm command
> >
> > Signed-off-by: Qi Zhang 
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > ---
> >  .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
> >  1 file changed, 68 insertions(+), 39 deletions(-)
> >
> > diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > index 1d99beaa10..6b5994fde2 100644
> > --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > @@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  //
> >
> >  #define TPMCMDBUFLENGTH  0x500
> >
> >
> >
> > +//
> >
> > +// Max retry count
> >
> > +//
> >
> > +#define RETRY_CNT_MAX  3
> >
> > +
> >
> >  /**
> >
> >Check whether TPM PTP register exist.
> >
> >
> >
> > @@ -153,6 +158,7 @@ PtpCrbTpmCommand (
> >UINT32  TpmOutSize;
> >
> >UINT16  Data16;
> >
> >UINT32  Data32;
> >
> > +  UINT8   RetryCnt;
> >
> >
> >
> >DEBUG_CODE_BEGIN ();
> >
> >UINTN  DebugSize;
> >
> > @@ -179,53 +185,76 @@ PtpCrbTpmCommand (
> >DEBUG_CODE_END ();
> >
> >TpmOutSize = 0;
> >
> >
> >
> > -  //
> >
> > -  // STEP 0:
> >
> > -  // if CapCRbIdelByPass == 0, enforce Idle state before sending 
> > command
> >
> > -  //
> >
> > -  if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
> > ((UINTN)
> > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> >
> > +  RetryCnt = 0;
> >
> > +  while (TRUE) {
> >
> > +//
> >
> > +// STEP 0:
> >
> > +// if CapCRbIdelByPass == 0, enforce Idle state before sending 
> > + command
> >
> > +//
> >
> > +if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
> > + ((UINTN)
> > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> >
> > +  Status = PtpCrbWaitRegisterBits (
> >
> > + >CrbControlStatus,
> >
> > + PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> >
> > + 0,
> >
> > + PTP_TIMEOUT_C
> >
> > + );
> >
> > +  if (EFI_ERROR (Status)) {
> >
> > +RetryCnt++;
> >
> > +if (RetryCnt < RETRY_CNT_MAX) {
> >
> > +  MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> >
> > +  continue;
> >
> > +} else {
> >
> > +  //
> >
> > +  // Try to goIdle to recover TPM
> >
> > +  //
> >
> > +  Status = EFI_DEVICE_ERROR;
> >
> > +  goto GoIdle_Exit;
> >
> > +}
> >
> > +  }
> >
> > +}
> >
> > +
> >
> > +//
> >
> > +// STEP 1:
> >
> > +// Ready is any time the TPM is ready to receive a command, 
> > + following a
> > write
> >
> > +// of 1 by software to Request.cmdReady, as indicated by the 
> > + Status field
> >
> > +// being cleared to 0.
> >
> > +//
> >
> > +MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
> >
> >  Status = PtpCrbWaitRegisterBits (
> >
> > -   >CrbControlStatus,
> >
> > -   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> >
> > +   >CrbControlRequest,
> >
> > 0,
> >
> > +   PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
> >
> > PTP_TIMEOUT_C
> >
> > );
> >
> >  if (EFI_ERROR (Status)) {
> >
> > -  //
> >
> > -  // Try to goIdle to recover TPM
> >
> > -  //
> >
> > -  Status = EFI_DEVICE_ERROR;
> >
> > -  goto GoIdle_Exit;
> >
> > +  RetryCnt++;
> >
> > +  if (RetryCnt < RETRY_CNT_MAX) {
> >
> > +MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> >
> > +continue;
> >
> > +  } else {
> >
> > +

Re: [edk2-devel] [edk2-staging][PATCH v3 04/15] edk2-staging/RedfishClientPkg: Introduce Redfish resource config library

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

There is another SCHEMA_NAME_PREFIX_OFFSET in EdkIIRedfishResourceConfig.c.
Please also address that when you push the code, no need V4 for this.
Thanks

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 04/15] edk2-staging/RedfishClientPkg:
> Introduce Redfish resource config library
> 
> [CAUTION: External Email]
> 
> Add EdkIIRedfishResourceConfigLib in order to work with Redfish Config
> Protocol and do the communication between each feature drivers. Also
> introduce Redfish interchange data protocol to exchange data efficiently.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../Library/EdkIIRedfishResourceConfigLib.h   | 163 +
>  .../Protocol/EdkIIRedfishInterchangeData.h|  52 ++
>  .../EdkIIRedfishResourceConfigLib.c   | 593 ++
>  .../EdkIIRedfishResourceConfigLib.inf |  49 ++
>  .../RedfishFeatureUtilityInternal.h   |   3 +-
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|   1 +
>  RedfishClientPkg/RedfishClientPkg.dec |   5 +-
>  7 files changed, 864 insertions(+), 2 deletions(-)  create mode 100644
> RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
>  create mode 100644
> RedfishClientPkg/Include/Protocol/EdkIIRedfishInterchangeData.h
>  create mode 100644
> RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResour
> ceConfigLib.c
>  create mode 100644
> RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResour
> ceConfigLib.inf
> 
> diff --git
> a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> new file mode 100644
> index 00..1e843ec551
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> @@ -0,0 +1,163 @@
> +/** @file
> +  This file defines the EDKII resource config Library interface.
> +
> +  (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EDKII_REDFISH_RESOURCE_CONFIG_LIB_H_
> +#define EDKII_REDFISH_RESOURCE_CONFIG_LIB_H_
> +
> +#include 
> +#include 
> +#include 
> +#include  #include
> +
> +#include 
> +/**
> +  Provising redfish resource by given URI.
> +
> +  @param[in]   Schema  Redfish schema information.
> +  @param[in]   Uri Target URI to create resource.
> +  @param[in]   InformationExchange Pointer to
> RESOURCE_INFORMATION_EXCHANGE.
> +  @param[in]   HttpPostModeTRUE if resource does not exist, HTTP
> POST method is used.
> +   FALSE if the resource exist but some of 
> properties are
> missing,
> +   HTTP PUT method is used.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EdkIIRedfishResourceConfigProvisionging (
> +  IN REDFISH_SCHEMA_INFO *Schema,
> +  IN EFI_STRING  Uri,
> +  IN RESOURCE_INFORMATION_EXCHANGE   *InformationExchange,
> +  IN BOOLEAN HttpPostMode
> +  );
> +
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   Schema  Redfish schema information.
> +  @param[in]   Uri The target URI to consume.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EdkIIRedfishResourceConfigConsume (
> +  IN REDFISH_SCHEMA_INFO  *Schema,
> +  IN EFI_STRING   Uri
> +  );
> +
> +
> +/**
> +  Update resource to given URI.
> +
> +  @param[in]   Schema  Redfish schema information.
> +  @param[in]   Uri The target URI to consume.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EdkIIRedfishResourceConfigUpdate (
> +  IN REDFISH_SCHEMA_INFO  *Schema,
> +  IN EFI_STRING   Uri
> +  );
> +
> +
> +/**
> +  Check resource on given URI.
> +
> +  @param[in]   Uri The target URI to consume.
> +
> +  @retval EFI_SUCCESS  Value is returned successfully.
> +  @retval Others   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EdkIIRedfishResourceConfigCheck (
> +  IN REDFISH_SCHEMA_INFO  *Schema,
> +  IN EFI_STRING   Uri
> +  );
> +
> +/**
> +  Identify resource on given URI.
> +
> +  @param[in]   Schema  Redfish schema information.
> +  @param[in]   Uri The target URI to consume.
> +  @param[in]   InformationExchange Pointer to
> 

[edk2-devel] [PATCH] IntelFsp2Pkg: FSPI_UPD is not mandatory.

2022-07-27 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/Include/FspGlobalData.h |  5 +++--
 IntelFsp2Pkg/Tools/GenCfgOpt.py  | 14 ++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h 
b/IntelFsp2Pkg/Include/FspGlobalData.h
index cf94f7b6a5..d1b3dfbfc4 100644
--- a/IntelFsp2Pkg/Include/FspGlobalData.h
+++ b/IntelFsp2Pkg/Include/FspGlobalData.h
@@ -76,15 +76,15 @@ typedef struct  {
   VOID   *TempRamInitUpdPtr;
   VOID   *MemoryInitUpdPtr;
   VOID   *SiliconInitUpdPtr;
-  VOID   *SmmInitUpdPtr;
   ///
-  /// IA32: Offset 0x68; X64: Offset 0x98
+  /// IA32: Offset 0x64; X64: Offset 0x90
   /// To store function parameters pointer
   /// so it can be retrieved after stack switched.
   ///
   VOID   *FunctionParameterPtr;
   FSP_INFO_HEADER*FspInfoHeader;
   VOID   *UpdDataPtr;
+  VOID   *SmmInitUpdPtr;
   UINTN  Reserved5;
   ///
   /// End of UINTN and pointer section
@@ -94,6 +94,7 @@ typedef struct  {
   UINT16 PerfLen;
   UINT16 Reserved7;
   UINT32 PerfIdx;
+  UINT32 Reserved8;
   UINT64 PerfData[32];
 } FSP_GLOBAL_DATA;
 
diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 128b896592..71c48f10e0 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -959,8 +959,13 @@ EndList
 UpdTxtFile = ''
 FvDir = self._FvDir
 if GuidList[Index] not in self._MacroDict:
-self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])
-return 1
+NoFSPI = False
+if GuidList[Index] == 'FSP_I_UPD_TOOL_GUID':
+NoFSPI = True
+continue
+else:
+self.Error = "%s definition is missing in DSC file" % 
(GuidList[Index])
+return 1
 
 if UpdTxtFile == '':
 UpdTxtFile = os.path.join(FvDir, 
self._MacroDict[GuidList[Index]] + '.txt')
@@ -1296,7 +1301,8 @@ EndList
elif '_S' in SignatureStr[6:6+2]:
TxtBody.append("#define FSPS_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))
elif '_I' in SignatureStr[6:6+2]:
-   TxtBody.append("#define FSPI_UPD_SIGNATURE   %s 
   /* '%s' */\n\n" % (Item['value'], SignatureStr))
+   if NoFSPI == True:
+   TxtBody.append("#define FSPI_UPD_SIGNATURE  
 %s/* '%s' */\n\n" % (Item['value'], SignatureStr))
 TxtBody.append("\n")
 
 for Region in ['UPD']:
@@ -1702,7 +1708,7 @@ EndList
 
 
 def Usage():
-print ("GenCfgOpt Version 0.58")
+print ("GenCfgOpt Version 0.59")
 print ("Usage:")
 print ("GenCfgOpt  UPDTXT  PlatformDscFile BuildFvDir 
[-D Macros]")
 print ("GenCfgOpt  HEADER  PlatformDscFile BuildFvDir  InputHFile 
[-D Macros]")
-- 
2.35.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91907): https://edk2.groups.io/g/devel/message/91907
Mute This Topic: https://groups.io/mt/92660833/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/QemuVideoDxe: Zero out PixelInformation in QueryMode

2022-07-27 Thread Pedro Falcato
Hi,

I also cannot see the patch properly. "=" disappearing magically sounds
like a quoted-printable email with a non-quoted-printable content.
Groups.io does not properly parse quoted-printable emails, so it's leaving
the "=" as is.

Thanks,
Pedro

On Wed, Jul 27, 2022 at 8:34 PM Dimitrije Pavlov 
wrote:

> Looks like the patch is corrupted for you for some reason. Up the email
> chain it shows fine. You can see the patch here:
> https://edk2.groups.io/g/devel/message/90822
> 
>
>

-- 
Pedro Falcato


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91906): https://edk2.groups.io/g/devel/message/91906
Mute This Topic: https://groups.io/mt/92050521/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/QemuVideoDxe: Zero out PixelInformation in QueryMode

2022-07-27 Thread Dimitrije Pavlov
Looks like the patch is corrupted for you for some reason. Up the email chain 
it shows fine. You can see the patch here: 
https://edk2.groups.io/g/devel/message/90822


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91905): https://edk2.groups.io/g/devel/message/91905
Mute This Topic: https://groups.io/mt/92050521/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 1/1] MinPlatformPkg: AcpiTables: Add additional thread mapping in MADT

2022-07-27 Thread Sinha, Ankit
Adding second, third and fourth thread mapping to MADT

Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 16 
+++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index c7e87cbd7d9d..524f9914b0b1 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -261,7 +261,7 @@ SortCpuLocalApicInTable (
   }
 
   //
-  // 3. Sort and map the second threads to the middle of the 
CpuApicIdOrderTable
+  // 3. Sort and map the second, third and fourth threads to the middle of the 
CpuApicIdOrderTable
   //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
 if ((TempCpuApicIdOrderTable[Index].Thread) == 1) { //second thread
@@ -270,6 +270,20 @@ SortCpuLocalApicInTable (
 }
   }
 
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 2) { // third thread
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 3) { // fourth thread
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
   //
   // 4. Sort and map the not enabled threads to the bottom of the 
CpuApicIdOrderTable
   //
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91904): https://edk2.groups.io/g/devel/message/91904
Mute This Topic: https://groups.io/mt/92656419/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 1/1] MinPlatformPkg: Add and re-arrange PCDs to configure FADT and FACS

2022-07-27 Thread Sinha, Ankit
1. Add the PCD for GPE 1 block register width control in FADT
2. Re-arrange PCD category for some PCDs

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 1 +
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 +
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   | 9 ++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index c7e87cbd7d9d..e68b6070607f 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -1227,6 +1227,7 @@ PlatformUpdateTables (
 FadtHeader->XPmTmrBlk.AccessSize  = PcdGet8 
(PcdAcpiXPmTmrBlkAccessSize);
 FadtHeader->XGpe0Blk.AccessSize   = PcdGet8 
(PcdAcpiXGpe0BlkAccessSize);
 FadtHeader->XGpe1Blk.AccessSize   = PcdGet8 
(PcdAcpiXGpe1BlkAccessSize);
+FadtHeader->XGpe1Blk.RegisterBitWidth = PcdGet8 
(PcdAcpiXGpe1BlkRegisterBitWidth);
 
 FadtHeader->SleepControlReg.AddressSpaceId= PcdGet8 
(PcdAcpiSleepControlRegisterAddressSpaceId);
 FadtHeader->SleepControlReg.RegisterBitWidth  = PcdGet8 
(PcdAcpiSleepControlRegisterBitWidth);
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
index 31b6c3be3cc1..1dc0683da650 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
@@ -93,6 +93,7 @@
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize
+  gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth  
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 098bb50075d1..3a735b0e1917 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -134,6 +134,7 @@
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize|0x00|UINT8|0x00010048
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize|0x00|UINT8|0x00010049
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize|0x00|UINT8|0x0001004A
+  
gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth|0x00|UINT8|0x00010056
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiS4BiosReq|0x|UINT8|0x00010055
 
   #
@@ -266,9 +267,6 @@
 
 [PcdsDynamic, PcdsDynamicEx]
   gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x9019
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x9025
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x9026
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x86A5|UINT32|0x9027
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|0x00|UINT8|0x0001004B
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth|0x00|UINT8|0x0001004C
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset|0x00|UINT8|0x0001004D
@@ -337,6 +335,11 @@
   #   //Header
   #  0x7F, 0xFF, 0x04, 0x00}
   gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath|{0x02, 0x01, 0x0C, 
0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 
0x00, 0x17, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x310
+  
+  ## ACPI
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x9025
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x9026
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x86A5|UINT32|0x9027
 
 [PcdsFixedAtBuild]
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91903): https://edk2.groups.io/g/devel/message/91903
Mute This Topic: https://groups.io/mt/92656407/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 V1 1/1] Add second, third and fourth thread mapping in MADT

2022-07-27 Thread Sinha, Ankit
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 16 
+++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index c7e87cbd7d9d..524f9914b0b1 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -261,7 +261,7 @@ SortCpuLocalApicInTable (
   }
 
   //
-  // 3. Sort and map the second threads to the middle of the 
CpuApicIdOrderTable
+  // 3. Sort and map the second, third and fourth threads to the middle of the 
CpuApicIdOrderTable
   //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
 if ((TempCpuApicIdOrderTable[Index].Thread) == 1) { //second thread
@@ -270,6 +270,20 @@ SortCpuLocalApicInTable (
 }
   }
 
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 2) { // third thread
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 3) { // fourth thread
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
   //
   // 4. Sort and map the not enabled threads to the bottom of the 
CpuApicIdOrderTable
   //
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91902): https://edk2.groups.io/g/devel/message/91902
Mute This Topic: https://groups.io/mt/92656120/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 V1 1/1] 1. Add the PCD for GPE 1 block register width control in FADT 2. Re-arrange PCD category for some PCDs

2022-07-27 Thread Sinha, Ankit
Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 1 +
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 +
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   | 9 ++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index c7e87cbd7d9d..e68b6070607f 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -1227,6 +1227,7 @@ PlatformUpdateTables (
 FadtHeader->XPmTmrBlk.AccessSize  = PcdGet8 
(PcdAcpiXPmTmrBlkAccessSize);
 FadtHeader->XGpe0Blk.AccessSize   = PcdGet8 
(PcdAcpiXGpe0BlkAccessSize);
 FadtHeader->XGpe1Blk.AccessSize   = PcdGet8 
(PcdAcpiXGpe1BlkAccessSize);
+FadtHeader->XGpe1Blk.RegisterBitWidth = PcdGet8 
(PcdAcpiXGpe1BlkRegisterBitWidth);
 
 FadtHeader->SleepControlReg.AddressSpaceId= PcdGet8 
(PcdAcpiSleepControlRegisterAddressSpaceId);
 FadtHeader->SleepControlReg.RegisterBitWidth  = PcdGet8 
(PcdAcpiSleepControlRegisterBitWidth);
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
index 31b6c3be3cc1..1dc0683da650 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
@@ -93,6 +93,7 @@
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize
+  gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth  
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 098bb50075d1..3a735b0e1917 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -134,6 +134,7 @@
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize|0x00|UINT8|0x00010048
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize|0x00|UINT8|0x00010049
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize|0x00|UINT8|0x0001004A
+  
gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth|0x00|UINT8|0x00010056
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiS4BiosReq|0x|UINT8|0x00010055
 
   #
@@ -266,9 +267,6 @@
 
 [PcdsDynamic, PcdsDynamicEx]
   gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x9019
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x9025
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x9026
-  gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x86A5|UINT32|0x9027
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|0x00|UINT8|0x0001004B
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth|0x00|UINT8|0x0001004C
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset|0x00|UINT8|0x0001004D
@@ -337,6 +335,11 @@
   #   //Header
   #  0x7F, 0xFF, 0x04, 0x00}
   gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath|{0x02, 0x01, 0x0C, 
0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 
0x00, 0x17, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x310
+  
+  ## ACPI
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x9025
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x9026
+  gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x86A5|UINT32|0x9027
 
 [PcdsFixedAtBuild]
 
-- 
2.27.0.windows.1



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




Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Michael D Kinney
Why is 3 the correct retry count?

Do we need this to be configurable?

Is a delay required between retries?

What specific state is a DTPM getting into that
requires this retry mechanism?  Can that state be
detected?

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yao, Jiewen
> Sent: Wednesday, July 27, 2022 5:07 AM
> To: Zhang, Qi1 ; devel@edk2.groups.io
> Cc: Wang, Jian J 
> Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm 
> command
> 
> Thanks. Please add Bugzilla ID and add tested-by tag by the people who 
> performed the test.
> 
> For the code, reviewed-by: Jiewen Yao 
> 
> > -Original Message-
> > From: Zhang, Qi1 
> > Sent: Wednesday, July 27, 2022 7:36 PM
> > To: devel@edk2.groups.io
> > Cc: Zhang, Qi1 ; Yao, Jiewen ;
> > Wang, Jian J 
> > Subject: [PATCH] SecurityPkg: Add retry mechanism for tpm command
> >
> > Signed-off-by: Qi Zhang 
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > ---
> >  .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
> >  1 file changed, 68 insertions(+), 39 deletions(-)
> >
> > diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > index 1d99beaa10..6b5994fde2 100644
> > --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> > @@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  //
> >
> >  #define TPMCMDBUFLENGTH  0x500
> >
> >
> >
> > +//
> >
> > +// Max retry count
> >
> > +//
> >
> > +#define RETRY_CNT_MAX  3
> >
> > +
> >
> >  /**
> >
> >Check whether TPM PTP register exist.
> >
> >
> >
> > @@ -153,6 +158,7 @@ PtpCrbTpmCommand (
> >UINT32  TpmOutSize;
> >
> >UINT16  Data16;
> >
> >UINT32  Data32;
> >
> > +  UINT8   RetryCnt;
> >
> >
> >
> >DEBUG_CODE_BEGIN ();
> >
> >UINTN  DebugSize;
> >
> > @@ -179,53 +185,76 @@ PtpCrbTpmCommand (
> >DEBUG_CODE_END ();
> >
> >TpmOutSize = 0;
> >
> >
> >
> > -  //
> >
> > -  // STEP 0:
> >
> > -  // if CapCRbIdelByPass == 0, enforce Idle state before sending command
> >
> > -  //
> >
> > -  if ((GetCachedIdleByPass () == 0) && ((MmioRead32 ((UINTN)
> > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> >
> > +  RetryCnt = 0;
> >
> > +  while (TRUE) {
> >
> > +//
> >
> > +// STEP 0:
> >
> > +// if CapCRbIdelByPass == 0, enforce Idle state before sending command
> >
> > +//
> >
> > +if ((GetCachedIdleByPass () == 0) && ((MmioRead32 ((UINTN)
> > >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> >
> > +  Status = PtpCrbWaitRegisterBits (
> >
> > + >CrbControlStatus,
> >
> > + PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> >
> > + 0,
> >
> > + PTP_TIMEOUT_C
> >
> > + );
> >
> > +  if (EFI_ERROR (Status)) {
> >
> > +RetryCnt++;
> >
> > +if (RetryCnt < RETRY_CNT_MAX) {
> >
> > +  MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> >
> > +  continue;
> >
> > +} else {
> >
> > +  //
> >
> > +  // Try to goIdle to recover TPM
> >
> > +  //
> >
> > +  Status = EFI_DEVICE_ERROR;
> >
> > +  goto GoIdle_Exit;
> >
> > +}
> >
> > +  }
> >
> > +}
> >
> > +
> >
> > +//
> >
> > +// STEP 1:
> >
> > +// Ready is any time the TPM is ready to receive a command, following a
> > write
> >
> > +// of 1 by software to Request.cmdReady, as indicated by the Status 
> > field
> >
> > +// being cleared to 0.
> >
> > +//
> >
> > +MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
> >
> >  Status = PtpCrbWaitRegisterBits (
> >
> > -   >CrbControlStatus,
> >
> > -   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> >
> > +   >CrbControlRequest,
> >
> > 0,
> >
> > +   PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
> >
> > PTP_TIMEOUT_C
> >
> > );
> >
> >  if (EFI_ERROR (Status)) {
> >
> > -  //
> >
> > -  // Try to goIdle to recover TPM
> >
> > -  //
> >
> > -  Status = EFI_DEVICE_ERROR;
> >
> > -  goto GoIdle_Exit;
> >
> > +  RetryCnt++;
> >
> > +  if (RetryCnt < RETRY_CNT_MAX) {
> >
> > +MmioWrite32 ((UINTN)>CrbControlRequest,
> > PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> >
> > +continue;
> >
> > +  } else {
> >
> > +Status = EFI_DEVICE_ERROR;
> >
> > +goto GoIdle_Exit;
> >
> > +  }
> >
> >  }
> >
> > -  }
> >
> >
> >
> > -  //
> >
> > -  // STEP 1:
> >
> > -  // Ready is any time the TPM is ready to receive a command, following a 
> > write
> >
> > -  // of 1 by software to Request.cmdReady, as indicated by the Status field
> >
> > -  // being cleared to 0.
> >
> > -  //
> >
> > -  MmioWrite32 

Re: [edk2-devel] [edk2-staging][PATCH v3 05/15] edk2-staging/RedfishClientPkg: Introduce resource identify library

2022-07-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Yang, Atom
> ; Nick Ramirez 
> Subject: [edk2-staging][PATCH v3 05/15] edk2-staging/RedfishClientPkg:
> Introduce resource identify library
> 
> [CAUTION: External Email]
> 
> Introduce resource identify library which works with resource config protocol 
> to
> identify Redfish resource. This library provides the flexibility for platform 
> to
> implement its own policy and identify resource. Two library implementation are
> provided as demonstration code. NULL version of library accepts all Redfish
> resource and another implementation to computer system resource uses UUID
> to identify Redfish resource.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Yang Atom 
> Cc: Nick Ramirez 
> ---
>  .../Library/RedfishResourceIdentifyLib.h  |  29 
>  .../RedfishResourceIdentifyLibComuterSystem.c | 164
> ++  ...edfishResourceIdentifyLibComuterSystem.inf |  39
> +
>  .../RedfishResourceIdentifyLibNull.c  |  37 
>  .../RedfishResourceIdentifyLibNull.inf|  32 
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|   2 +-
>  RedfishClientPkg/RedfishClientPkg.dec |   1 +
>  7 files changed, 303 insertions(+), 1 deletion(-)  create mode 100644
> RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h
>  create mode 100644
> RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_0/Re
> dfishResourceIdentifyLibComuterSystem.c
>  create mode 100644
> RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_0/Re
> dfishResourceIdentifyLibComuterSystem.inf
>  create mode 100644
> RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourceIdenti
> fyLibNull.c
>  create mode 100644
> RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourceIdenti
> fyLibNull.inf
> 
> diff --git a/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h
> b/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h
> new file mode 100644
> index 00..91d01b7d68
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h
> @@ -0,0 +1,29 @@
> +/** @file
> +  This file defines the Redfish resource identify Library interface.
> +
> +  (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_RESOURCE_IDENTIFY_LIB_H_ #define
> +REDFISH_RESOURCE_IDENTIFY_LIB_H_
> +
> +/**
> +  Identify resource from given URI and context in JSON format
> +
> +  @param[in]   UriURI of given Redfish resource
> +  @param[in]   Json   Context in JSON format of give Redfish resource
> +
> +  @retval TRUEThis is the Redfish resource that we have to handle.
> +  @retval FALSE   We don't handle this Redfish resource.
> +
> +**/
> +BOOLEAN
> +RedfishIdentifyResource (
> +  IN EFI_STRING Uri,
> +  IN CHAR8  *Json
> +  );
> +
> +#endif
> diff --git
> a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_0/
> RedfishResourceIdentifyLibComuterSystem.c
> b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_0/
> RedfishResourceIdentifyLibComuterSystem.c
> new file mode 100644
> index 00..e5699f194c
> --- /dev/null
> +++ b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v
> +++ 1_5_0/RedfishResourceIdentifyLibComuterSystem.c
> @@ -0,0 +1,164 @@
> +/** @file
> +  Redfish resource identify library implementation for computer system
> +version 1.5.0
> +
> +  (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include
> + >
> +
> +EFI_REST_JSON_STRUCTURE_PROTOCOL  *mJsonStructProtocol = NULL;
> +
> +/**
> +  Identify resource from given URI and context in JSON format
> +
> +  @param[in]   UriURI of given Redfish resource
> +  @param[in]   Json   Context in JSON format of give Redfish resource
> +
> +  @retval TRUEThis is the Redfish resource that we have to handle.
> +  @retval FALSE   We don't handle this Redfish resource.
> +
> +**/
> +BOOLEAN
> +RedfishIdentifyResource (
> +  IN EFI_STRING Uri,
> +  IN CHAR8  *Json
> +  )
> +{
> +  EFI_STATUSStatus;
> +  EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem;
> +  EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS  *ComputerSystemCs;
> +  EFI_GUID  SystemUuid;
> +  EFI_GUID  ResourceUuid;
> +
> +  if (IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (Json)) {
> +return FALSE;
> +  }
> +
> +  if (mJsonStructProtocol == NULL) {
> +return FALSE;
> +  }
> +
> +  ComputerSystem = NULL;
> +  

Re: [edk2-devel] [PATCH edk2-platforms v4 00/17] Fix build breaks and update IORT revision macro

2022-07-27 Thread Ard Biesheuvel
On Wed, 27 Jul 2022 at 02:21, Sami Mujawar  wrote:
>
> Hi All,
>
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3458
>
> The edk2 patch series for IORT Rev E.d updates has been submitted to the 
> mailing list and has been reviewed at
> https://edk2.groups.io/g/devel/message/91361
>
> The corresponding edk2-platforms series is posted on the mailing list at 
> https://edk2.groups.io/g/devel/message/91543
>
> The edk2-platforms series fixes a number of build breaks as well as makes the 
> necessary updates to reflect the changes due to IORT Rev E.d updates.
>
> I would prefer this patch series to be merged in the edk2-stable202208 tag. 
> Therefore, requesting review for the edk2-platform patches from the 
> respective maintainers for the following modules:
> - Silicon/AMD/Styx
> - Silicon/Socionext/SynQuacer
> - Platform/LeMaker
> - Platform/Socionext
> - Silicon/NXP & Platform/NXP/*
>

For the associated fixes for all the above:

Reviewed-by: Ard Biesheuvel 

Feel free to push all of these changes when you feel it is appropriate.


> On 19/07/2022, 17:24, "devel@edk2.groups.io on behalf of Sami Mujawar via 
> groups.io"  
> wrote:
>
> Hi All,
>
> The IORT Rev E.d seriesfor edk2 has received the r-b from the respective
> maintainers.
>
> Can the following package maintainers review this series and provide
> feedback, please?
>
> - Silicon/AMD/Styx
>
> - Silicon/Socionext/SynQuacer
>
> - Platform/LeMaker
>
> - Platform/Socionext
>
> - Silicon/NXP & Platform/NXP/*
>
> Regards,
>
> Sami Mujawar
>
> On 14/07/2022 05:55 pm, Sami Mujawar wrote:
> > This v4 series includes 5 additional patches (13-17) that
> > fix various build breaks caused by changes in edk2 repo.
> > The patches 1-12 have not changed between v3 series, except
> > updates to the r-b received.
> >
> > The v3 patch series renames the EFI_ACPI_IO_REMAPPING_TABLE_REV0
> > macro to EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00 based on the
> > feedback received. It also includes an additional patch that fixes
> > the build break in CelloBoard due to missing VariablePolicyHelperLib
> > dependency.
> >
> > The v2 patch series fixes the build break in Ampere/Jade and
> > Pythium/FT2000-4 due to missing VariableFlashInfoLib dependency
> > and also updates the IORT revision macro.
> >
> > The IORT Rev E.d specification updates the IORT table revision
> > to 5. Following this the IORT table revision macro
> > EFI_ACPI_IO_REMAPPING_TABLE_REVISION which was at Rev 0 has
> > been renamed to EFI_ACPI_IO_REMAPPING_TABLE_REV0. Therefore,
> > this series updates the following platforms to reflect this
> > renaming:
> >   - FVP
> >   - Morello FVP
> >   - SGI
> >   - AMD/Styx
> >   - Socionext/SynQuacer
> >   - RaspberryPi
> >   - N1SDP
> >   - Ampere/Jade
> >   - Pythium/FT2000-4
> >
> > Note: This patch series is dependent on the edk2 patch series:
> >"[PATCH v6 0/8] IORT Rev E.d specification updates"
> >(https://edk2.groups.io/g/devel/message/91361), which must
> >be merged in edk2 before this patch series can be integrated.
> >
> > The changes can be seen at:
> > 
> https://github.com/samimujawar/edk2-platforms/tree/1527_iort_rev_ed_platforms_v4
> >
> > Sami Mujawar (17):
> >Platform/ARM: FVP: Update for IORT revision macro renaming
> >Platform/ARM: Morello: Update for IORT revision macro renaming
> >Platform/ARM: SGI: Update for IORT revision macro renaming
> >Silicon/AMD/Styx: Update for IORT revision macro renaming
> >Silicon/Socionext/SynQuacer: Update for IORT revision macro renaming
> >Platform/RaspberryPi: Update for IORT revision macro renaming
> >Platform/ARM: N1SDP: Update for IORT revision macro renaming
> >Silicon/Ampere: Add VariableFlashInfoLib
> >Platform/Ampere: JadePkg: Update for IORT revision macro renaming
> >Silicon/Phytium: Add VariableFlashInfoLib
> >Silicon/Phytium: FT2000-4Pkg: Update for IORT revision macro renaming
> >Platform/LeMaker: Fix missing dependency on VariablePolicyHelperLib
> >Platform/Socionext: Fix missing dependency on VariableFlashInfoLib
> >Silicon/NXP: Fix missing dependency on VariableFlashInfoLib
> >Platform/NXP/LS1043aRdbPk: Fix build break due to change in
> >  ARM_CORE_INFO
> >Platform/NXP/LS1046aFrwyPkg: Fix build break due to change in
> >  ARM_CORE_INFO
> >Platform/NXP/LX2160aRdbPkg: Fix build break due to change in
> >  ARM_CORE_INFO
> >
> >   
> Platform/ARM/Morello/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerFvp.c
>   | 2 +-
> >   
> Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
>| 2 +-
> >   Platform/ARM/SgiPkg/AcpiTables/Iort.aslc 

Re: [edk2-devel] [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode

2022-07-27 Thread Ard Biesheuvel
On Tue, 28 Jun 2022 at 11:48, Dimitrije Pavlov  wrote:
>
> Ensure that the PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
> EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
> PixelBlueGreenRedReserved8BitPerColor.
>
> According to UEFI 2.9 Section 12.9, PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
> PixelFormat is PixelBitMask. This means that firmware is not required
> to fill out the PixelInformation field for other PixelFormat types,
> which implies that the QemuVideoDxe implementation is technically
> correct.
>
> However, not zeroing out those fields will leak the contents of the
> memory returned by the memory allocator, so it is better to explicitly
> set them to zero.
>
> In addition, the SCT test suite relies on PixelInformation always
> having a consistent value, which causes failures.
>
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Gerd Hoffmann 
> Cc: Jeff Booher-Kaeding 
> Cc: Samer El-Haj-Mahmoud 
> Cc: Sunny Wang 
> Cc: Jeremy Linton 
>
> Signed-off-by: Dimitrije Pavlov 
> ---
>  OvmfPkg/QemuVideoDxe/Gop.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
> index 0c4dea7fb6f2..7a9fe208c99c 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo (
>  Info->PixelInformation.ReservedMask  0;
>} else if (ModeData->ColorDepth  32) {
>  DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
> -Info->PixelFormat  PixelBlueGreenRedReserved8BitPerColor;
> +Info->PixelFormat
> PixelBlueGreenRedReserved8BitPerColor;
> +Info->PixelInformation.RedMask   0;
> +Info->PixelInformation.GreenMask 0;
> +Info->PixelInformation.BlueMask  0;
> +Info->PixelInformation.ReservedMask  0;

Is this valid C? Or is the patch corrupted by email?


> +  } else {
> +DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, 
> ModeData->ColorDepth));
> +ASSERT (FALSE);
>}
>
>Info->PixelsPerScanLine  Info->HorizontalResolution;
> --
> 2.34.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#90822): https://edk2.groups.io/g/devel/message/90822
> Mute This Topic: https://groups.io/mt/92050521/1131722
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [a...@kernel.org]
> 
>
>


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




[edk2-devel] [PATCH] VirtualKeyboardFeaturePkg: Pre OS virtual keyboard touch response are very slow with I2C touch panel

2022-07-27 Thread KalaiyarasanX Thangaraj
On one Touch, multiple Reads happend and  this reads varying based on Key Press 
time.
Resulting in Multiple key press update on screen. This condition avoids 
KeyPressed skips
resulting due to faster key press and update only on valid key press.


Cc: Dandan Bi 
Cc: Liming Gao 
Cc: Madhan Pethaiyan 
Cc: Kathappan Esakkithevar 
Cc: Madhusudhan Balaji 
Signed-off-by: KalaiyarasanX Thangaraj 
---
 
Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/Keyboard.c
| 12 
 
Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/VirtualKeyboard.h
 |  3 +++
 2 files changed, 15 insertions(+)

diff --git 
a/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/Keyboard.c
 
b/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/Keyboard.c
index 2b1216746b..aa4bfe3baa 100644
--- 
a/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/Keyboard.c
+++ 
b/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/Keyboard.c
@@ -512,6 +512,18 @@ VkTimer (
   if (!VkContext->TouchActive) {
 VkContext->KeyPressed = FALSE;
   }
+
+  //
+  // On one Touch, multiple Reads happend and  this reads varying based on Key 
Press time.
+  // Resulting in Multiple key press update on screen. This condition avoids 
Key Press skips
+  // resulting due to faster key press and update only on valid key press.
+  //
+  if ((Point.CurrentX != PreviousX) || (Point.CurrentY != PreviousY)) {
+ VkContext->KeyPressed = FALSE;
+  }
+  PreviousX = Point.CurrentX;
+  PreviousY = Point.CurrentY;
+
   ConvertCoordinate (VkContext, Point, , );
 
   if (!VkContext->KeyPressed &&
diff --git 
a/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/VirtualKeyboard.h
 
b/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/VirtualKeyboard.h
index 14a50fa5af..11e045f894 100644
--- 
a/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/VirtualKeyboard.h
+++ 
b/Features/Intel/UserInterface/VirtualKeyboardFeaturePkg/VirtualKeyboardDxe/VirtualKeyboard.h
@@ -37,6 +37,9 @@ extern EFI_DRIVER_BINDING_PROTOCOL   
gVirtualKeyboardDriverBinding;
 extern EFI_COMPONENT_NAME_PROTOCOL   gVirtualKeyboardComponentName;
 extern EFI_COMPONENT_NAME2_PROTOCOL  gVirtualKeyboardComponentName2;
 
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN PreviousX;
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN PreviousY;
+
 ///
 /// Debug raw data points
 ///
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91896): https://edk2.groups.io/g/devel/message/91896
Mute This Topic: https://groups.io/mt/92651285/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 1/1] Silicon/Qemu: Add SMBIOS tables of types 16, 17, and 19

2022-07-27 Thread Samer El-Haj-Mahmoud
Thanks Dimitrije for the patch!

Reviewed-By: Samer El-Haj-Mahmoud 


> -Original Message-
> From: Dimitrije Pavlov 
> Sent: Wednesday, July 20, 2022 6:05 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel ; Leif Lindholm
> ; Graeme Gregory ;
> Radoslaw Biernacki ; Jeff Booher-Kaeding  kaed...@arm.com>; Samer El-Haj-Mahmoud  mahm...@arm.com>; Sunny Wang ; Jeremy Linton
> 
> Subject: [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of
> types 16, 17, and 19
> 
> Arm SBBR specification includes the list of required and recommended
> SMBIOS tables. Tables of types 16 (Physical Memory Array),
> 17 (Memory Device), and 19 (Memory Array Mapped Address) are required,
> but are not included in the current SbsaQemu SMBIOS driver. The current
> SMBIOS driver provides a limited number of tables using ArmPkg.
> 
> This patch adds SbsaQemu-specific tables of types 16, 17, and 19.
> 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Graeme Gregory 
> Cc: Radoslaw Biernacki 
> Cc: Jeff Booher-Kaeding 
> Cc: Samer El-Haj-Mahmoud 
> Cc: Sunny Wang 
> Cc: Jeremy Linton 
> 
> Signed-off-by: Dimitrije Pavlov 
> ---
>  Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |   1 +
>  Platform/Qemu/SbsaQemu/SbsaQemu.fdf   |   1 +
> 
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf |  48 +++
> 
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
> | 405 
>  4 files changed, 455 insertions(+)
> 
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index 97014e2fb630..b7050d911708 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -721,6 +721,7 @@ [Components.common]
>ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
>EmbeddedPkg/Library/FdtLib/FdtLib.inf
>MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> +
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf
> 
>#
># PCI support
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> index c35e3ed44054..9f031c3e6649 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> @@ -242,6 +242,7 @@ [FV.FvMain]
>INF
> ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
>INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
>INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> +  INF
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf
> 
>#
># PCI support
> diff --git
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> new file mode 100644
> index ..b5d156f6654e
> --- /dev/null
> +++
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> @@ -0,0 +1,48 @@
> +#/** @file
> +#
> +#  Static SMBIOS tables for the SbsaQemu platform.
> +#
> +#  Copyright (c) 2022, ARM Limited. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#**/
> +
> +[Defines]
> +  INF_VERSION= 0x0001001A
> +  BASE_NAME  = SbsaQemuSmbiosDxe
> +  FILE_GUID  = DDE1ACCB-0555-4CAA-85E7-3CBC8962026E
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= SbsaQemuSmbiosDriverEntryPoint
> +
> +[Sources]
> +  SbsaQemuSmbiosDxe.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ArmPlatformPkg/ArmPlatformPkg.dec
> +  ArmPkg/ArmPkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  ArmPlatformLib
> +  UefiBootServicesTableLib
> +  MemoryAllocationLib
> +  BaseMemoryLib
> +  BaseLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +  DebugLib
> +  PrintLib
> +
> +[Protocols]
> +  gEfiSmbiosProtocolGuid
> +
> +[Depex]
> +  gEfiSmbiosProtocolGuid
> +
> +[Pcd]
> +  gArmTokenSpaceGuid.PcdSystemMemorySize
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> diff --git
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> new file mode 100644
> index ..9ef5168b79f6
> --- /dev/null
> +++
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> @@ -0,0 +1,405 @@
> +/** @file
> + *
> + *  Static SMBIOS tables for the SbsaQemu platform.
> + *
> + *  Note: Some tables are provided by ArmPkg. The tables that are not 
> provided
> by
> + *  ArmPkg, but are required by SBBR, are as follows:
> + *Physical Memory Array (Type 16)
> + *Memory Device (Type 17) - For each socketed system-memory Device
> + *Memory Array Mapped Address (Type 19) - One per contiguous block per
> Physical Memory Array
> + *
> + *  Copyright (c) 2022, ARM Limited. All rights reserved.
> + *
> + *  SPDX-License-Identifier: 

Re: [edk2-devel] [edk2-platforms] [PATCH 1/1] Platform/Sgi: Add support to disable isolated cpus

2022-07-27 Thread Nishant Sharma
Hi Sami,
Please find my reply inline

On Thu, Jul 21, 2022 at 12:47 PM, Sami Mujawar wrote:

> 
> 
> 
> Hi Nishant,
> 
> 
> 
> Please find my response inline marked [SAMI].
> 
> 
> 
> Regards,
> 
> 
> 
> Sami Mujawar
> 
> On 17/06/2022 07:07 am, Nishant Sharma wrote:
> 
>> Isolated CPUs are those that are not to be used on the platform for
>> various reasons. The isolated CPU list is an array of MPID values of
> 
> [SAMI] Can you explain the use-case/reason, please?

[Nishant]: I will update in the next patchset.

> 
> 
>> the CPUs that have to be isolated. This list is supplied via the
>> NT_FW_CONFIG dtb.
>> 
>> Add support to search for isolated CPUs MPID list and,
>> if present,
>> update the MADT table to disable the corresponding CPUs.
>> 
>> Signed-off-by: Nishant Sharma  (
>> nishant.sha...@arm.com )
>> ---
>> 
>> Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf |   1 -
>> 
>> Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |   8 +-
>> 
>> Platform/ARM/SgiPkg/Include/SgiPlatform.h |   7 ++
>> 
>> Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 131
>> +++-
>> 
>> Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  |  45
>> ++-
>>  5 files changed, 186 insertions(+), 6 deletions(-)
>> 
>> diff --git
>> a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
>> b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
>> index
>> 4b36c3e5ceb2..e13c2f08ce6e 100644
>> ---
>> a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
>> +++
>> b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
>> @@ -18,7 +18,6 @@
>> 
>> Dbg2.aslc
>> 
>>Fadt.aslc
>> 
>>Gtdt.aslc
>> 
>> -  Iort.aslc
> 
> [SAMI] Why is IORT table being removed here?

[Nishant]: I think some issue with patch generation. I will remove this change 
in the next patch. Thanks for pointing it out.

> 
> 
>>Mcfg.aslc
>> 
>>RdN2Cfg1/Dsdt.asl
>> 
>>RdN2Cfg1/Madt.aslc
>> 
>> diff --git
>> a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>> b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>> index
>> 407160c07563..fbf061ad3bdb 100644
>> ---
>> a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>> +++
>> b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>> @@ -1,5
>> +1,5 @@
>>  #
>> 
>> -#  Copyright (c) 2018, ARM Limited. All rights reserved.
>> 
>> +# 
>> Copyright (c) 2018-2022, ARM Limited. All rights reserved.
>> 
>>  #
>> 
>>  # 
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> 
>>  #
>> 
>> @@ -13,6 +13,7 @@
>>   
>> ENTRY_POINT= SgiPlatformPeim
>> 
>>  
>> 
>>  [Packages]
>> 
>> + 
>> ArmPlatformPkg/ArmPlatformPkg.dec
>> 
>>EmbeddedPkg/EmbeddedPkg.dec
>> 
>>   
>> MdePkg/MdePkg.dec
>> 
>>Platform/ARM/SgiPkg/SgiPlatform.dec
>> 
>> @@ -21,6 +22,11
>> @@
>>FdtLib
>> 
>>PeimEntryPoint
>> 
>>  
>> 
>> +[FixedPcd]
>> 
>> + 
>> gArmSgiTokenSpaceGuid.PcdChipCount
>> 
>> + 
>> gArmPlatformTokenSpaceGuid.PcdCoreCount
>> 
>> + 
>> gArmPlatformTokenSpaceGuid.PcdClusterCount
>> 
>> +
>> 
>>  [Sources]
>> 
>>   
>> SgiPlatformPeim.c
>> 
>>  
>> 
>> diff --git
>> a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> index
>> dddb58832d73..311286ce5337 100644
>> ---
>> a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> +++
>> b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> @@ -65,11 +65,18 @@
>>  #define
>> DRAM_BLOCK2_BASE_REMOTE(ChipId) \
>> 
>>(SGI_REMOTE_CHIP_MEM_OFFSET
>> (ChipId) + FixedPcdGet64 (PcdDramBlock2Base))
>> 
>>  
>> 
>> +// List of isolated
>> CPUs MPID
>> 
>> +typedef struct {
>> 
>> +  UINT64  Count;// Number
>> of elements present in the list
>> 
>> +  UINT64  Mpid[];   // List
>> containing isolated CPU MPIDs
>> 
>> +} SGI_ISOLATED_CPU_LIST;
>> 
>> +
>> 
>>  // ARM
>> platform description data.
>> 
>>  typedef struct {
>> 
>>UINTN  PlatformId;
>> 
>>   
>> UINTN  ConfigId;
>> 
>>UINTN  MultiChipMode;
>> 
>> +  SGI_ISOLATED_CPU_LIST 
>> IsolatedCpuList;
>> 
>>  } SGI_PLATFORM_DESCRIPTOR;
>> 
>>  
>> 
>>  // Arm SGI/RD Product
>> IDs
>> 
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> index
>> 2f72e7152ff3..80190120ff32 100644
>> ---
>> a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> +++
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> @@ -1,14 +1,17 @@
>> 
>> /** @file
>> 
>>  *
>> 
>> -*  Copyright (c) 2018, ARM Limited. All rights reserved.
>> 
>> +*  Copyright (c) 2018 - 2022, ARM Limited. All rights reserved.
>> 
>>  *
>> 
>>  * 
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> 
>>  *
>> 
>>  **/
>> 
>>  
>> 
>> +#include
>> 
>> 
>> +
>> 
>>  #include 
>> 
>>  #include
>> 
>> 
>>  #include 
>> 
>> +#include
>> 
>> 
>>  #include 
>> 
>>  
>> 
>>  VOID
>> 
>> @@ -16,6 +19,127 @@ InitVirtioDevices (
>>VOID
>> 
>>);
>> 
>>  
>> 
>> 

[edk2-devel] [PATCH v2 0/2] Add EDKII_PCI_DEVICE_PPI support to EDK2

2022-07-27 Thread Maciej Czajkowski
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907

The purpose of those changes is to introduce the way to enumerate and assign 
resources in PEI for the systems with more than one PCI root. 
Here is a need to have an interface that will support such a mechanizm.
For now, the part that performs the enumeration will be implemented in the 
silicon code.
Sample code can be seen here: 
https://github.com/mczaj/edk2-platforms/commit/d443062e58f9fba228869b54f2546d9735b3b506

v1: https://edk2.groups.io/g/devel/topic/91575907

v2 changes:
- collected Acked-by tag for no.1 commit
- followed-up with change suggestions in no.2 commit

Maciej Czajkowski (2):
  MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition
  MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device

 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c| 585 ++--
 MdeModulePkg/Bus/Ata/AhciPei/DevicePath.c |  44 --
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  17 +-
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.inf  |   5 +-
 MdeModulePkg/Include/Ppi/PciDevice.h  |  32 ++
 MdeModulePkg/MdeModulePkg.dec |   3 +
 MdeModulePkg/MdeModulePkg.dsc |   1 +
 7 files changed, 465 insertions(+), 222 deletions(-)
 create mode 100644 MdeModulePkg/Include/Ppi/PciDevice.h

-- 
2.27.0.windows.1

-
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.



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




[edk2-devel] [PATCH v2 2/2] MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device

2022-07-27 Thread Maciej Czajkowski
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907

This change modifies AhciPei library to allow usage both EDKII_PCI_DEVICE_PPI
and EDKII_PEI_ATA_AHCI_HOST_CONTROLLER_PPI to manage ATA HDD working under
AHCI mode.

Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Maciej Czajkowski 
---

Notes:
v2 changes:
- added missing function descriptions
- moved controller initialization from PCI_DEVICE_PPI to seperate funciton
in order to reduce code duplication
- added DevicePathLib BASE instance to the MdeModulePkg.dec to allow PEIMs 
to consume it

 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c| 585 ++--
 MdeModulePkg/Bus/Ata/AhciPei/DevicePath.c |  44 --
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  17 +-
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.inf  |   5 +-
 MdeModulePkg/MdeModulePkg.dsc |   1 +
 5 files changed, 430 insertions(+), 222 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c 
b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
index 208b7e9a3606..8ad98dc76bc1 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
@@ -9,6 +9,47 @@
 **/
 
 #include "AhciPei.h"
+#include 
+#include 
+#include 
+
+/**
+  Callback for EDKII_ATA_AHCI_HOST_CONTROLLER_PPI installation.
+
+  @param[in] PeiServices Pointer to PEI Services Table.
+  @param[in] NotifyDescriptorPointer to the descriptor for the Notification
+ event that caused this function to execute.
+  @param[in] Ppi Pointer to the PPI data associated with this 
function.
+
+  @retval EFI_SUCCESSThe function completes successfully
+
+**/
+EFI_STATUS
+EFIAPI
+AtaAhciHostControllerPpiInstallationCallback (
+  IN EFI_PEI_SERVICES   **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID   *Ppi
+  );
+
+/**
+  Callback for EDKII_PCI_DEVICE_PPI installation.
+
+  @param[in] PeiServices Pointer to PEI Services Table.
+  @param[in] NotifyDescriptorPointer to the descriptor for the Notification
+ event that caused this function to execute.
+  @param[in] Ppi Pointer to the PPI data associated with this 
function.
+
+  @retval EFI_SUCCESSThe function completes successfully
+
+**/
+EFI_STATUS
+EFIAPI
+AtaAhciPciDevicePpiInstallationCallback (
+  IN EFI_PEI_SERVICES   **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID   *Ppi
+  );
 
 EFI_PEI_PPI_DESCRIPTOR  mAhciAtaPassThruPpiListTemplate = {
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
@@ -40,6 +81,18 @@ EFI_PEI_NOTIFY_DESCRIPTOR  mAhciEndOfPeiNotifyListTemplate = 
{
   AhciPeimEndOfPei
 };
 
+EFI_PEI_NOTIFY_DESCRIPTOR  mAtaAhciHostControllerNotify = {
+  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  ,
+  AtaAhciHostControllerPpiInstallationCallback
+};
+
+EFI_PEI_NOTIFY_DESCRIPTOR  mPciDevicePpiNotify = {
+  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  ,
+  AtaAhciPciDevicePpiInstallationCallback
+};
+
 /**
   Free the DMA resources allocated by an ATA AHCI controller.
 
@@ -111,33 +164,30 @@ AhciPeimEndOfPei (
 }
 
 /**
-  Entry point of the PEIM.
+  Initialize and install PrivateData PPIs.
 
-  @param[in] FileHandle Handle of the file being invoked.
-  @param[in] PeiServicesDescribes the list of possible PEI Services.
-
-  @retval EFI_SUCCESSPPI successfully installed.
+  @param[in] MmioBaseMMIO base address of specific AHCI controller
+  @param[in] DevicePath  A pointer to the EFI_DEVICE_PATH_PROTOCOL
+ structure.
+  @param[in] DevicePathLengthLength of the device path.
 
+  @retval EFI_SUCCESS  AHCI controller initialized and PPIs installed
+  @retval others   Failed to initialize AHCI controller
 **/
 EFI_STATUS
-EFIAPI
-AtaAhciPeimEntry (
-  IN EFI_PEI_FILE_HANDLE FileHandle,
-  IN CONST EFI_PEI_SERVICES  **PeiServices
+AtaAhciInitPrivateData (
+  IN UINTN MmioBase,
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN UINTN DevicePathLength
   )
 {
-  EFI_STATUS  Status;
-  EFI_BOOT_MODE   BootMode;
-  EDKII_ATA_AHCI_HOST_CONTROLLER_PPI  *AhciHcPpi;
-  UINT8   Controller;
-  UINTN   MmioBase;
-  UINTN   DevicePathLength;
-  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
-  UINT32  PortBitMap;
-  PEI_AHCI_CONTROLLER_PRIVATE_DATA*Private;
-  UINT8   NumberOfPorts;
+  EFI_STATUSStatus;
+  UINT32PortBitMap;
+  UINT8 NumberOfPorts;
+  PEI_AHCI_CONTROLLER_PRIVATE_DATA  *Private;
+  EFI_BOOT_MODE   

[edk2-devel] [PATCH v2 1/2] MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition

2022-07-27 Thread Maciej Czajkowski
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907

This commit introduces EDKII_PCI_DEVICE_PPI. The purpose of this PPI is
to provide a way of accessing PCI devices to drvice drivers such as
NvmExpressPei or AhciPei.

Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Maciej Czajkowski 
Acked-by: Hao A Wu 
---

Notes:
v2 changes:
- added acked-by tag
- minor change - modified header guard to follow coding style

 MdeModulePkg/Include/Ppi/PciDevice.h | 32 
 MdeModulePkg/MdeModulePkg.dec|  3 ++
 2 files changed, 35 insertions(+)

diff --git a/MdeModulePkg/Include/Ppi/PciDevice.h 
b/MdeModulePkg/Include/Ppi/PciDevice.h
new file mode 100644
index ..6750ae6ce394
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/PciDevice.h
@@ -0,0 +1,32 @@
+/** @file
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_PCI_DEVICE_PPI_H_
+#define EDKII_PCI_DEVICE_PPI_H_
+
+#include 
+#include 
+
+///
+/// Global ID for the EDKII_PCI_DEVICE_PPI_GUID.
+///
+#define EDKII_PCI_DEVICE_PPI_GUID \
+  { \
+0x1597ab4f, 0xd542, 0x4efe, { 0x9a, 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 
0x0b } \
+  }
+
+///
+/// PCI Device PPI structure.
+///
+typedef struct {
+  EFI_PCI_IO_PROTOCOL PciIo;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+} EDKII_PCI_DEVICE_PPI;
+
+extern EFI_GUID  gEdkiiPeiPciDevicePpiGuid;
+
+#endif // EDKII_PCI_DEVICE_PPI_H_
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 2bcb9f9453af..7d989108324a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -509,6 +509,9 @@ [Ppis]
   ## Include/Ppi/NvmExpressPassThru.h
   gEdkiiPeiNvmExpressPassThruPpiGuid= { 0x6af31b2c, 0x3be, 0x46c1, { 0xb1, 
0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } }
 
+  ## Include/Ppi/PciDevice.h
+  gEdkiiPeiPciDevicePpiGuid = { 0x1597ab4f, 0xd542, 0x4efe, { 
0x9a, 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 0x0b } }
+
   ## Include/Ppi/CapsuleOnDisk.h
   gEdkiiPeiCapsuleOnDiskPpiGuid = { 0x71a9ea61, 0x5a35, 0x4a5d, { 
0xac, 0xef, 0x9c, 0xf8, 0x6d, 0x6d, 0x67, 0xe0 } }
   gEdkiiPeiBootInCapsuleOnDiskModePpiGuid   = { 0xb08a11e4, 0xe2b7, 0x4b75, { 
0xb5, 0x15, 0xaf, 0x61, 0x6, 0x68, 0xbf, 0xd1  } }
-- 
2.27.0.windows.1

-
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.



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




Re: [edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Yao, Jiewen
Thanks. Please add Bugzilla ID and add tested-by tag by the people who 
performed the test.

For the code, reviewed-by: Jiewen Yao 

> -Original Message-
> From: Zhang, Qi1 
> Sent: Wednesday, July 27, 2022 7:36 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Qi1 ; Yao, Jiewen ;
> Wang, Jian J 
> Subject: [PATCH] SecurityPkg: Add retry mechanism for tpm command
> 
> Signed-off-by: Qi Zhang 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> ---
>  .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
>  1 file changed, 68 insertions(+), 39 deletions(-)
> 
> diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> index 1d99beaa10..6b5994fde2 100644
> --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> @@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  //
> 
>  #define TPMCMDBUFLENGTH  0x500
> 
> 
> 
> +//
> 
> +// Max retry count
> 
> +//
> 
> +#define RETRY_CNT_MAX  3
> 
> +
> 
>  /**
> 
>Check whether TPM PTP register exist.
> 
> 
> 
> @@ -153,6 +158,7 @@ PtpCrbTpmCommand (
>UINT32  TpmOutSize;
> 
>UINT16  Data16;
> 
>UINT32  Data32;
> 
> +  UINT8   RetryCnt;
> 
> 
> 
>DEBUG_CODE_BEGIN ();
> 
>UINTN  DebugSize;
> 
> @@ -179,53 +185,76 @@ PtpCrbTpmCommand (
>DEBUG_CODE_END ();
> 
>TpmOutSize = 0;
> 
> 
> 
> -  //
> 
> -  // STEP 0:
> 
> -  // if CapCRbIdelByPass == 0, enforce Idle state before sending command
> 
> -  //
> 
> -  if ((GetCachedIdleByPass () == 0) && ((MmioRead32 ((UINTN)
> >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> 
> +  RetryCnt = 0;
> 
> +  while (TRUE) {
> 
> +//
> 
> +// STEP 0:
> 
> +// if CapCRbIdelByPass == 0, enforce Idle state before sending command
> 
> +//
> 
> +if ((GetCachedIdleByPass () == 0) && ((MmioRead32 ((UINTN)
> >CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 0)) {
> 
> +  Status = PtpCrbWaitRegisterBits (
> 
> + >CrbControlStatus,
> 
> + PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> 
> + 0,
> 
> + PTP_TIMEOUT_C
> 
> + );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +RetryCnt++;
> 
> +if (RetryCnt < RETRY_CNT_MAX) {
> 
> +  MmioWrite32 ((UINTN)>CrbControlRequest,
> PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> 
> +  continue;
> 
> +} else {
> 
> +  //
> 
> +  // Try to goIdle to recover TPM
> 
> +  //
> 
> +  Status = EFI_DEVICE_ERROR;
> 
> +  goto GoIdle_Exit;
> 
> +}
> 
> +  }
> 
> +}
> 
> +
> 
> +//
> 
> +// STEP 1:
> 
> +// Ready is any time the TPM is ready to receive a command, following a
> write
> 
> +// of 1 by software to Request.cmdReady, as indicated by the Status field
> 
> +// being cleared to 0.
> 
> +//
> 
> +MmioWrite32 ((UINTN)>CrbControlRequest,
> PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
> 
>  Status = PtpCrbWaitRegisterBits (
> 
> -   >CrbControlStatus,
> 
> -   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> 
> +   >CrbControlRequest,
> 
> 0,
> 
> +   PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
> 
> PTP_TIMEOUT_C
> 
> );
> 
>  if (EFI_ERROR (Status)) {
> 
> -  //
> 
> -  // Try to goIdle to recover TPM
> 
> -  //
> 
> -  Status = EFI_DEVICE_ERROR;
> 
> -  goto GoIdle_Exit;
> 
> +  RetryCnt++;
> 
> +  if (RetryCnt < RETRY_CNT_MAX) {
> 
> +MmioWrite32 ((UINTN)>CrbControlRequest,
> PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> 
> +continue;
> 
> +  } else {
> 
> +Status = EFI_DEVICE_ERROR;
> 
> +goto GoIdle_Exit;
> 
> +  }
> 
>  }
> 
> -  }
> 
> 
> 
> -  //
> 
> -  // STEP 1:
> 
> -  // Ready is any time the TPM is ready to receive a command, following a 
> write
> 
> -  // of 1 by software to Request.cmdReady, as indicated by the Status field
> 
> -  // being cleared to 0.
> 
> -  //
> 
> -  MmioWrite32 ((UINTN)>CrbControlRequest,
> PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
> 
> -  Status = PtpCrbWaitRegisterBits (
> 
> - >CrbControlRequest,
> 
> - 0,
> 
> - PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
> 
> - PTP_TIMEOUT_C
> 
> - );
> 
> -  if (EFI_ERROR (Status)) {
> 
> -Status = EFI_DEVICE_ERROR;
> 
> -goto GoIdle_Exit;
> 
> -  }
> 
> +Status = PtpCrbWaitRegisterBits (
> 
> +   >CrbControlStatus,
> 
> +   0,
> 
> +   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
> 
> +   PTP_TIMEOUT_C
> 
> +   );
> 
> +if (EFI_ERROR (Status)) {
> 
> +  RetryCnt++;
> 
> +  if (RetryCnt < RETRY_CNT_MAX) {
> 
> +MmioWrite32 ((UINTN)>CrbControlRequest,
> PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
> 
> +continue;
> 
> +   

[edk2-devel] [PATCH] SecurityPkg: Add retry mechanism for tpm command

2022-07-27 Thread Qi Zhang
Signed-off-by: Qi Zhang 
Cc: Jiewen Yao 
Cc: Jian J Wang 
---
 .../Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 107 +++---
 1 file changed, 68 insertions(+), 39 deletions(-)

diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c 
b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
index 1d99beaa10..6b5994fde2 100644
--- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
+++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
@@ -33,6 +33,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 #define TPMCMDBUFLENGTH  0x500
 
+//
+// Max retry count
+//
+#define RETRY_CNT_MAX  3
+
 /**
   Check whether TPM PTP register exist.
 
@@ -153,6 +158,7 @@ PtpCrbTpmCommand (
   UINT32  TpmOutSize;
   UINT16  Data16;
   UINT32  Data32;
+  UINT8   RetryCnt;
 
   DEBUG_CODE_BEGIN ();
   UINTN  DebugSize;
@@ -179,53 +185,76 @@ PtpCrbTpmCommand (
   DEBUG_CODE_END ();
   TpmOutSize = 0;
 
-  //
-  // STEP 0:
-  // if CapCRbIdelByPass == 0, enforce Idle state before sending command
-  //
-  if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
((UINTN)>CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 
0)) {
+  RetryCnt = 0;
+  while (TRUE) {
+//
+// STEP 0:
+// if CapCRbIdelByPass == 0, enforce Idle state before sending command
+//
+if ((GetCachedIdleByPass () == 0) && ((MmioRead32 
((UINTN)>CrbControlStatus) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) == 
0)) {
+  Status = PtpCrbWaitRegisterBits (
+ >CrbControlStatus,
+ PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+ 0,
+ PTP_TIMEOUT_C
+ );
+  if (EFI_ERROR (Status)) {
+RetryCnt++;
+if (RetryCnt < RETRY_CNT_MAX) {
+  MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+  continue;
+} else {
+  //
+  // Try to goIdle to recover TPM
+  //
+  Status = EFI_DEVICE_ERROR;
+  goto GoIdle_Exit;
+}
+  }
+}
+
+//
+// STEP 1:
+// Ready is any time the TPM is ready to receive a command, following a 
write
+// of 1 by software to Request.cmdReady, as indicated by the Status field
+// being cleared to 0.
+//
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
 Status = PtpCrbWaitRegisterBits (
-   >CrbControlStatus,
-   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+   >CrbControlRequest,
0,
+   PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
PTP_TIMEOUT_C
);
 if (EFI_ERROR (Status)) {
-  //
-  // Try to goIdle to recover TPM
-  //
-  Status = EFI_DEVICE_ERROR;
-  goto GoIdle_Exit;
+  RetryCnt++;
+  if (RetryCnt < RETRY_CNT_MAX) {
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+continue;
+  } else {
+Status = EFI_DEVICE_ERROR;
+goto GoIdle_Exit;
+  }
 }
-  }
 
-  //
-  // STEP 1:
-  // Ready is any time the TPM is ready to receive a command, following a write
-  // of 1 by software to Request.cmdReady, as indicated by the Status field
-  // being cleared to 0.
-  //
-  MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);
-  Status = PtpCrbWaitRegisterBits (
- >CrbControlRequest,
- 0,
- PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY,
- PTP_TIMEOUT_C
- );
-  if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
-goto GoIdle_Exit;
-  }
+Status = PtpCrbWaitRegisterBits (
+   >CrbControlStatus,
+   0,
+   PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
+   PTP_TIMEOUT_C
+   );
+if (EFI_ERROR (Status)) {
+  RetryCnt++;
+  if (RetryCnt < RETRY_CNT_MAX) {
+MmioWrite32 ((UINTN)>CrbControlRequest, 
PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE);
+continue;
+  } else {
+Status = EFI_DEVICE_ERROR;
+goto GoIdle_Exit;
+  }
+}
 
-  Status = PtpCrbWaitRegisterBits (
- >CrbControlStatus,
- 0,
- PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE,
- PTP_TIMEOUT_C
- );
-  if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
-goto GoIdle_Exit;
+break;
   }
 
   //
-- 
2.26.2.windows.1



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




Re: [edk2-devel] [PATCH edk2-platforms v4 00/17] Fix build breaks and update IORT revision macro

2022-07-27 Thread Sami Mujawar
Hi All,

Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3458

The edk2 patch series for IORT Rev E.d updates has been submitted to the 
mailing list and has been reviewed at 
https://edk2.groups.io/g/devel/message/91361

The corresponding edk2-platforms series is posted on the mailing list at 
https://edk2.groups.io/g/devel/message/91543

The edk2-platforms series fixes a number of build breaks as well as makes the 
necessary updates to reflect the changes due to IORT Rev E.d updates.

I would prefer this patch series to be merged in the edk2-stable202208 tag. 
Therefore, requesting review for the edk2-platform patches from the respective 
maintainers for the following modules:
- Silicon/AMD/Styx
- Silicon/Socionext/SynQuacer
- Platform/LeMaker
- Platform/Socionext
- Silicon/NXP & Platform/NXP/*

Regards,

Sami Mujawar


On 19/07/2022, 17:24, "devel@edk2.groups.io on behalf of Sami Mujawar via 
groups.io"  
wrote:

Hi All,

The IORT Rev E.d seriesfor edk2 has received the r-b from the respective 
maintainers.

Can the following package maintainers review this series and provide 
feedback, please?

- Silicon/AMD/Styx

- Silicon/Socionext/SynQuacer

- Platform/LeMaker

- Platform/Socionext

- Silicon/NXP & Platform/NXP/*

Regards,

Sami Mujawar

On 14/07/2022 05:55 pm, Sami Mujawar wrote:
> This v4 series includes 5 additional patches (13-17) that
> fix various build breaks caused by changes in edk2 repo.
> The patches 1-12 have not changed between v3 series, except
> updates to the r-b received.
>
> The v3 patch series renames the EFI_ACPI_IO_REMAPPING_TABLE_REV0
> macro to EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00 based on the
> feedback received. It also includes an additional patch that fixes
> the build break in CelloBoard due to missing VariablePolicyHelperLib
> dependency.
>
> The v2 patch series fixes the build break in Ampere/Jade and
> Pythium/FT2000-4 due to missing VariableFlashInfoLib dependency
> and also updates the IORT revision macro.
>
> The IORT Rev E.d specification updates the IORT table revision
> to 5. Following this the IORT table revision macro
> EFI_ACPI_IO_REMAPPING_TABLE_REVISION which was at Rev 0 has
> been renamed to EFI_ACPI_IO_REMAPPING_TABLE_REV0. Therefore,
> this series updates the following platforms to reflect this
> renaming:
>   - FVP
>   - Morello FVP
>   - SGI
>   - AMD/Styx
>   - Socionext/SynQuacer
>   - RaspberryPi
>   - N1SDP
>   - Ampere/Jade
>   - Pythium/FT2000-4
>
> Note: This patch series is dependent on the edk2 patch series:
>"[PATCH v6 0/8] IORT Rev E.d specification updates"
>(https://edk2.groups.io/g/devel/message/91361), which must
>be merged in edk2 before this patch series can be integrated.
>
> The changes can be seen at:
> 
https://github.com/samimujawar/edk2-platforms/tree/1527_iort_rev_ed_platforms_v4
>
> Sami Mujawar (17):
>Platform/ARM: FVP: Update for IORT revision macro renaming
>Platform/ARM: Morello: Update for IORT revision macro renaming
>Platform/ARM: SGI: Update for IORT revision macro renaming
>Silicon/AMD/Styx: Update for IORT revision macro renaming
>Silicon/Socionext/SynQuacer: Update for IORT revision macro renaming
>Platform/RaspberryPi: Update for IORT revision macro renaming
>Platform/ARM: N1SDP: Update for IORT revision macro renaming
>Silicon/Ampere: Add VariableFlashInfoLib
>Platform/Ampere: JadePkg: Update for IORT revision macro renaming
>Silicon/Phytium: Add VariableFlashInfoLib
>Silicon/Phytium: FT2000-4Pkg: Update for IORT revision macro renaming
>Platform/LeMaker: Fix missing dependency on VariablePolicyHelperLib
>Platform/Socionext: Fix missing dependency on VariableFlashInfoLib
>Silicon/NXP: Fix missing dependency on VariableFlashInfoLib
>Platform/NXP/LS1043aRdbPk: Fix build break due to change in
>  ARM_CORE_INFO
>Platform/NXP/LS1046aFrwyPkg: Fix build break due to change in
>  ARM_CORE_INFO
>Platform/NXP/LX2160aRdbPkg: Fix build break due to change in
>  ARM_CORE_INFO
>
>   
Platform/ARM/Morello/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerFvp.c
  | 2 +-
>   
Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
   | 2 +-
>   Platform/ARM/SgiPkg/AcpiTables/Iort.aslc
 | 2 +-
>   
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 | 2 +-
>   Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c  
 | 2 +-
>   Platform/LeMaker/CelloBoard/CelloBoard.dsc  
 | 1 +
>   

[edk2-devel] [PATCH] MdeModulePkg/DumpDynPcd: Remove unsupported format specifiers

2022-07-27 Thread Konstantin Aladyshev
Some print statements use format specifiers like %N/%H/%E/%B that are
only supported in the shell print functions. In the ordinary 'Print'
function they are just displayed as letters N/H/E/B.
Remove these unsupported format specifiers from the 'Print' statements
to fix the issue.

Signed-off-by: Konstantin Aladyshev 
---
 .../Application/DumpDynPcd/DumpDynPcd.c   | 28 +--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.c 
b/MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.c
index b8571c4556..013198963e 100644
--- a/MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.c
+++ b/MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.c
@@ -361,7 +361,7 @@ DumpPcdInfo (
 Uint8 = mPiPcd->Get8 (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint8);
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint8);
   break;
 case EFI_PCD_TYPE_16:
   if (TokenSpace == NULL) {
@@ -370,7 +370,7 @@ DumpPcdInfo (
 Uint16 = mPiPcd->Get16 (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint16);
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint16);
   break;
 case EFI_PCD_TYPE_32:
   if (TokenSpace == NULL) {
@@ -379,7 +379,7 @@ DumpPcdInfo (
 Uint32 = mPiPcd->Get32 (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint32);
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x - Value = 
0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint32);
   break;
 case EFI_PCD_TYPE_64:
   if (TokenSpace == NULL) {
@@ -388,7 +388,7 @@ DumpPcdInfo (
 Uint64 = mPiPcd->Get64 (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 
0x%lx\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint64);
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x - Value = 
0x%lx\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint64);
   break;
 case EFI_PCD_TYPE_BOOL:
   if (TokenSpace == NULL) {
@@ -397,7 +397,7 @@ DumpPcdInfo (
 Boolean = mPiPcd->GetBool (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 
%a\n", TokenNumber, RetString, PcdInfo->PcdSize, Boolean ? "TRUE" : "FALSE");
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x - Value = %a\n", 
TokenNumber, RetString, PcdInfo->PcdSize, Boolean ? "TRUE" : "FALSE");
   break;
 case EFI_PCD_TYPE_PTR:
   if (TokenSpace == NULL) {
@@ -406,7 +406,7 @@ DumpPcdInfo (
 PcdData = mPiPcd->GetPtr (TokenSpace, TokenNumber);
   }
 
-  Print (L"  Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x\n", 
TokenNumber, RetString, PcdInfo->PcdSize);
+  Print (L"  Token = 0x%08x - Type = %-17s - Size = 0x%x\n", TokenNumber, 
RetString, PcdInfo->PcdSize);
   DumpHex (2, 0, PcdInfo->PcdSize, PcdData);
   break;
 default:
@@ -509,7 +509,7 @@ ProcessPcd (
 //
 // The specified PCD is not found, print error.
 //
-Print (L"%EError. %NNo matching PCD found: %s.\n", InputPcdName);
+Print (L"Error. No matching PCD found: %s.\n", InputPcdName);
 return EFI_NOT_FOUND;
   }
 
@@ -548,25 +548,25 @@ DumpDynPcdMain (
 
   Status = gBS->LocateProtocol (, NULL, (VOID **));
   if (EFI_ERROR (Status)) {
-Print (L"DumpDynPcd: %EError. %NPI PCD protocol is not present.\n");
+Print (L"DumpDynPcd: Error. PI PCD protocol is not present.\n");
 return Status;
   }
 
   Status = gBS->LocateProtocol (, NULL, (VOID 
**));
   if (EFI_ERROR (Status)) {
-Print (L"DumpDynPcd: %EError. %NPI PCD info protocol is not present.\n");
+Print (L"DumpDynPcd: Error. PI PCD info protocol is not present.\n");
 return Status;
   }
 
   Status = gBS->LocateProtocol (, NULL, (VOID **));
   if (EFI_ERROR (Status)) {
-Print (L"DumpDynPcd: %EError. %NPCD protocol is not present.\n");
+Print (L"DumpDynPcd: Error. PCD protocol is not present.\n");
 return Status;
   }
 
   Status = gBS->LocateProtocol (, NULL, (VOID 
**));
   if (EFI_ERROR (Status)) {
-Print (L"DumpDynPcd: %EError. %NPCD info protocol is not present.\n");
+Print (L"DumpDynPcd: Error. PCD info protocol is not present.\n");
 return Status;
   }
 
@@ -575,13 +575,13 @@ DumpDynPcdMain (
   //
   Status = GetArg ();
   if (EFI_ERROR (Status)) {
-Print (L"DumpDynPcd: %EError. %NThe input parameters are not 
recognized.\n");
+Print (L"DumpDynPcd: Error. The input parameters are not recognized.\n");
 

[edk2-devel] [edk2-platforms: PATCH] Modify processor _UID ordering by CPU default fused in MADT

2022-07-27 Thread JackX Lin
BIOS should not reordering cpu processor_uid

Signed-off-by: JackX Lin 
Cc: Chasel Chiu 
Cc: Dong Eric 
Cc: Jiewen Yao 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Cc: Donald Kuo 
Cc: Chandana C Kumar 
Cc: JackX Lin 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 14 
+-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index c7e87cbd7d..f4c45336c5 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -173,7 +173,6 @@ SortCpuLocalApicInTable (
   EFI_CPU_ID_ORDER_MAP  *CpuIdMapPtr;
   UINT32CoreThreadMask;
   EFI_CPU_ID_ORDER_MAP  *TempCpuApicIdOrderTable;
-  UINT32Socket;
 
   Index  = 0;
   Status = EFI_SUCCESS;
@@ -198,6 +197,7 @@ SortCpuLocalApicInTable (
   CpuIdMapPtr->Thread  = ProcessorInfoBuffer.Location.Thread;
   CpuIdMapPtr->Flags   = ((ProcessorInfoBuffer.StatusFlag & 
PROCESSOR_ENABLED_BIT) != 0);
   CpuIdMapPtr->SocketNum = ProcessorInfoBuffer.Location.Package;
+  CpuIdMapPtr->AcpiProcessorUid = (ProcessorInfoBuffer.Location.Package << 
mNumOfBitShift) + CurrProcessor;
 
   //update processorbitMask
   if (CpuIdMapPtr->Flags == 1) {
@@ -280,18 +280,6 @@ SortCpuLocalApicInTable (
 }
   }
 
-  //
-  // 5. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
-  //
-  for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
-for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
-  if (mCpuApicIdOrderTable[CurrProcessor].Flags && 
(mCpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) {
-mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid = 
(mCpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) + Index;
-Index++;
-  }
-}
-  }
-
   //keep for debug purpose
   DEBUG ((DEBUG_INFO, "APIC ID Order Table ReOrdered\n"));
   DebugDisplayReOrderTable (mCpuApicIdOrderTable);
-- 
2.32.0.windows.2



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