Re: [edk2-devel] [PATCH v1] DynamicTablesPkg: Fix using RmrNodeCount unitlitialised

2022-08-05 Thread Sami Mujawar

Hi Edward,

Thank you for this patch.

This fix looks good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 04/08/2022 10:20 am, Edward Pickup wrote:

Fix using RmrNodeCount uninitliased by initliasing it to zero. Also, add
an additional check for ACPI version. This fixes a crash running on
kvmtool.

Signed-off-by: Edward Pickup 
---

Change can be seen at 
https://github.com/edpickup/edk2/tree/2322_rmrnodecount_uninitialised_v1

  DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 
40d99162cc610de2d0c2f0a5fff6e457c08d07fb..f28973c1a8620aa5b756e85af1b46ebfaf018839
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -2107,6 +2107,8 @@ BuildIortTable (
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);

ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);

  


+  RmrNodeCount = 0;

+

if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||

(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))

{

@@ -2714,7 +2716,10 @@ BuildIortTable (
  }

}

  


-  if (RmrNodeCount > 0) {

+  if ((AcpiTableInfo->AcpiTableRevision >=

+   EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05) &&

+  (RmrNodeCount > 0))

+  {

  Status = AddRmrNodes (

 This,

 CfgMgrProtocol,




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92177): https://edk2.groups.io/g/devel/message/92177
Mute This Topic: https://groups.io/mt/92809989/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] MinPlatformPkg/TestPointCheckLib: Remove unnecessary GetVariable2() call

2022-08-05 Thread Oram, Isaac W
Reviewed-by: Isaac Oram 

-Original Message-
From: mikub...@linux.microsoft.com  
Sent: Friday, August 5, 2022 11:02 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Oram, Isaac W ; Gao, 
Liming ; Dong, Eric 
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: 
Remove unnecessary GetVariable2() call

From: Michael Kubacki 

The data buffer returned from the GetVariable2() call in
TestPointCheckMemoryTypeInformation() is not actually used or freed.

This change removes the unnecessary function call.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 | 8 
 1 file changed, 8 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..0ff6789ac621 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
@@ -109,7 +109,6 @@ TestPointCheckMemoryTypeInformation (
   EFI_HOB_GUID_TYPE   *GuidHob;
   VOID*CurrentMemoryTypeInformation;
   VOID*PreviousMemoryTypeInformation;
-  VOID*VariableMemoryTypeInformation;
   
   DEBUG ((DEBUG_INFO, " TestPointCheckMemoryTypeInformation - Enter\n"));
   CurrentMemoryTypeInformation = NULL;
@@ -128,13 +127,6 @@ TestPointCheckMemoryTypeInformation (
 goto Done;
   }
 
-  GetVariable2 (
- EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
- &gEfiMemoryTypeInformationGuid,
- &VariableMemoryTypeInformation,
- NULL
- );
-
   if ((CurrentMemoryTypeInformation != NULL) && (PreviousMemoryTypeInformation 
!= NULL)) {
 DumpMemoryTypeInfoSummary(CurrentMemoryTypeInformation, 
PreviousMemoryTypeInformation);
   }
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92176): https://edk2.groups.io/g/devel/message/92176
Mute This Topic: https://groups.io/mt/92840556/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] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

2022-08-05 Thread Oram, Isaac W
Reviewed-by: Isaac Oram 

-Original Message-
From: mikub...@linux.microsoft.com  
Sent: Friday, August 5, 2022 10:16 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Oram, Isaac W ; Gao, 
Liming ; Dong, Eric 
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: 
Prevent modification of HOB data

From: Michael Kubacki 

DumpMemoryTypeInfoSummary() is used to dump information about the 
MemoryTypeInformation HOB. The dump function currently modifies the data which 
can corrupt the data for later HOB consumers in the DXE phase.

This change makes DumpMemoryTypeInfoSummary() treat the data as read-only.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(
 
 VOID
 DumpMemoryTypeInfoSummary (
-  IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
-  IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
+  IN CONST  EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,  
+ IN CONST  EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
   )
 {
   UINTNIndex;
@@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary (
 }
 
 if (Next != Previous) {
-  PreviousMemoryTypeInformation[Index].NumberOfPages = Next;
   MemoryTypeInformationModified = TRUE;
 }
 
@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
   VOID*CurrentMemoryTypeInformation;
   VOID*PreviousMemoryTypeInformation;
   VOID*VariableMemoryTypeInformation;
-  
+
   DEBUG ((DEBUG_INFO, " TestPointCheckMemoryTypeInformation - Enter\n"));
   CurrentMemoryTypeInformation = NULL;
   PreviousMemoryTypeInformation = NULL;
--
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92175): https://edk2.groups.io/g/devel/message/92175
Mute This Topic: https://groups.io/mt/92839532/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] MinPlatformPkg: Add FspNvsBuffer compression option

2022-08-05 Thread Michael Kubacki
From: Michael Kubacki 

Adds a PCD called "PcdEnableCompressedFspNvsBuffer" that allows the
"FspNvsBuffer" UEFI variable data to be saved as compressed data.

Especially due to the nature of the data saved in this variable, it
compresses well. For example, it has been found to reduce ~63KB
of data to ~13KB. Boot time impact has been found to be negligible.

The default value is FALSE to keep default behavior consistent.

Decompression can be performed on the variable data using the
standard UefiDecompressLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c   
| 62 
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf 
|  4 ++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
|  6 ++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   
|  1 +
 4 files changed, 60 insertions(+), 13 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
index 0215e8eeddfb..95b8cef8b32b 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
@@ -3,6 +3,7 @@
   exists, and saves the data to nvRAM.
 
 Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -38,20 +41,26 @@ SaveMemoryConfigEntryPoint (
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUSStatus;
-  EFI_HOB_GUID_TYPE *GuidHob;
-  VOID  *HobData;
-  VOID  *VariableData;
-  UINTN DataSize;
-  UINTN BufferSize;
-  BOOLEAN   DataIsIdentical;
+  EFI_STATUS Status;
+  EFI_HOB_GUID_TYPE  *GuidHob;
+  VOID   *HobData;
+  VOID   *VariableData;
+  UINTN  DataSize;
+  UINTN  BufferSize;
+  BOOLEANDataIsIdentical;
+  VOID   *CompressedData;
+  UINT64 CompressedSize;
+  UINTN  CompressedAllocationPages;
 
-  DataSize= 0;
-  BufferSize  = 0;
-  VariableData= NULL;
-  GuidHob = NULL;
-  HobData = NULL;
-  DataIsIdentical = FALSE;
+  DataSize  = 0;
+  BufferSize= 0;
+  VariableData  = NULL;
+  GuidHob   = NULL;
+  HobData   = NULL;
+  DataIsIdentical   = FALSE;
+  CompressedData= NULL;
+  CompressedSize= 0;
+  CompressedAllocationPages = 0;
 
   //
   // Search for the Memory Configuration GUID HOB.  If it is not present, then
@@ -73,6 +82,29 @@ SaveMemoryConfigEntryPoint (
 }
   }
 
+  if (PcdGetBool (PcdEnableCompressedFspNvsBuffer)) {
+if (DataSize > 0) {
+  CompressedAllocationPages = EFI_SIZE_TO_PAGES (DataSize);
+  CompressedData= AllocatePages (CompressedAllocationPages);
+  if (CompressedData == NULL) {
+DEBUG ((DEBUG_ERROR, "[%a] - Failed to allocate compressed data 
buffer.\n", __FUNCTION__));
+ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+return EFI_OUT_OF_RESOURCES;
+  }
+
+  CompressedSize = EFI_PAGES_TO_SIZE (CompressedAllocationPages);
+  Status = Compress (HobData, DataSize, CompressedData, 
&CompressedSize);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "[%a] - failed to compress data. Status = %r\n", 
__FUNCTION__, Status));
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+}
+
+HobData  = CompressedData;
+DataSize = (UINTN)CompressedSize;
+  }
+
   if (HobData != NULL) {
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize));
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr   : 0x%x\n", HobData));
@@ -136,6 +168,10 @@ SaveMemoryConfigEntryPoint (
 DEBUG((DEBUG_ERROR, "Memory S3 Data HOB was not found\n"));
   }
 
+  if (CompressedData != NULL) {
+FreePages (CompressedData, CompressedAllocationPages);
+  }
+
   //
   // This driver does not produce any protocol services, so always unload it.
   //
diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
index 61e85a658693..0f12deb131ca 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryCo

[edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Remove unnecessary GetVariable2() call

2022-08-05 Thread Michael Kubacki
From: Michael Kubacki 

The data buffer returned from the GetVariable2() call in
TestPointCheckMemoryTypeInformation() is not actually used or freed.

This change removes the unnecessary function call.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 | 8 
 1 file changed, 8 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..0ff6789ac621 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
@@ -109,7 +109,6 @@ TestPointCheckMemoryTypeInformation (
   EFI_HOB_GUID_TYPE   *GuidHob;
   VOID*CurrentMemoryTypeInformation;
   VOID*PreviousMemoryTypeInformation;
-  VOID*VariableMemoryTypeInformation;
   
   DEBUG ((DEBUG_INFO, " TestPointCheckMemoryTypeInformation - Enter\n"));
   CurrentMemoryTypeInformation = NULL;
@@ -128,13 +127,6 @@ TestPointCheckMemoryTypeInformation (
 goto Done;
   }
 
-  GetVariable2 (
- EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
- &gEfiMemoryTypeInformationGuid,
- &VariableMemoryTypeInformation,
- NULL
- );
-
   if ((CurrentMemoryTypeInformation != NULL) && (PreviousMemoryTypeInformation 
!= NULL)) {
 DumpMemoryTypeInfoSummary(CurrentMemoryTypeInformation, 
PreviousMemoryTypeInformation);
   }
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92173): https://edk2.groups.io/g/devel/message/92173
Mute This Topic: https://groups.io/mt/92840556/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] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

2022-08-05 Thread Michael Kubacki
From: Michael Kubacki 

DumpMemoryTypeInfoSummary() is used to dump information about the
MemoryTypeInformation HOB. The dump function currently modifies the
data which can corrupt the data for later HOB consumers in the DXE
phase.

This change makes DumpMemoryTypeInfoSummary() treat the data as
read-only.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(
 
 VOID
 DumpMemoryTypeInfoSummary (
-  IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
-  IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
+  IN CONST  EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
+  IN CONST  EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
   )
 {
   UINTNIndex;
@@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary (
 }
 
 if (Next != Previous) {
-  PreviousMemoryTypeInformation[Index].NumberOfPages = Next;
   MemoryTypeInformationModified = TRUE;
 }
 
@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
   VOID*CurrentMemoryTypeInformation;
   VOID*PreviousMemoryTypeInformation;
   VOID*VariableMemoryTypeInformation;
-  
+
   DEBUG ((DEBUG_INFO, " TestPointCheckMemoryTypeInformation - Enter\n"));
   CurrentMemoryTypeInformation = NULL;
   PreviousMemoryTypeInformation = NULL;
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92172): https://edk2.groups.io/g/devel/message/92172
Mute This Topic: https://groups.io/mt/92839532/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] MdeModulePkg/NonDiscoverablePciDeviceDxe: Allow partial FreeBuffer

2022-08-05 Thread Jeff Brasen via groups.io


> -Original Message-
> From: Ard Biesheuvel 
> Sent: Tuesday, August 2, 2022 10:51 AM
> To: Jeff Brasen 
> Cc: devel@edk2.groups.io; hao.a...@intel.com; ray...@intel.com;
> quic_llind...@quicinc.com; ardb+tianoc...@kernel.org
> Subject: Re: [PATCH v2] MdeModulePkg/NonDiscoverablePciDeviceDxe:
> Allow partial FreeBuffer
> 
> External email: Use caution opening links or attachments
> 
> 
> On Tue, 2 Aug 2022 at 17:32, Jeff Brasen  wrote:
> >
> >
> >
> > > -Original Message-
> > > From: Ard Biesheuvel 
> > > Sent: Friday, July 29, 2022 9:48 AM
> > > To: Jeff Brasen 
> > > Cc: devel@edk2.groups.io; hao.a...@intel.com; ray...@intel.com;
> > > quic_llind...@quicinc.com; ardb+tianoc...@kernel.org
> > > Subject: Re: [PATCH v2] MdeModulePkg/NonDiscoverablePciDeviceDxe:
> > > Allow partial FreeBuffer
> > >
> > > External email: Use caution opening links or attachments
> > >
> > >
> > > On Thu, 28 Jul 2022 at 13:25, Jeff Brasen  wrote:
> > > >
> > > >
> > > > Adding Leif/Ard to CC incase they have any comments on this patch.
> > > >
> > >
> > > This generally looks ok to me. I just wonder if it wouldn't be
> > > simpler to reuse the existing allocation descriptor if it is not
> > > being freed entirely. Given the [presumably] the most common case is
> > > to allocate and then free some pages at the end, lowering the page
> > > count on the existing descriptor would cover most cases, and we'd
> > > only need to allocate new ones if pages are being freed at the start or in
> the middle.
> >
> > There is often freeing at the beginning as well as this is being used to 
> > create
> a 64K aligned section of memory in the case. So it over allocates and the
> free's some at the beginning and the end. I could probably make it detect
> and use that but figured this code would support all cases and required less
> case specific detection.
> >
> 
> Ah interesting. Would it help if the allocate routine aligned allocations to 
> their
> size?

The PciIo->AllocateBuffer function doesn't support passing the request in so we 
would need to know that info beforehand. The current calling in the XHCI driver 
does a free at the beginning and then the end of the buffer so we could the 
existing allocation tracker but figured it would be better to correct the 
function just in case someone called it to free in the middle.


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




Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: USB Redfish host interface is not supported

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

Hi Igor,
Just found that you don't have the CC for maintainers and your Signed-off-by 
tag in the commit message.
You can refer to below link for the correct commit message format for the patch.
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers

Thanks
Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Thursday, August 4, 2022 11:25 PM
> To: Chang, Abner 
> Cc: nickle.w...@hpe.com; Igor Kulchytskyy ;
> devel@edk2.groups.io
> Subject: [PATCH] RedfishPkg: RedfishDiscoverDxe: USB Redfish host
> interface is not supported
> 
> [CAUTION: External Email]
> 
> Host Interface details are discribed by the SMBIOS Type 42 table.
> The table is published by the RedfishHostInterfaceDxe driver.
> That driver supports PCI-E and USB host interface types.
> The table is consumed by the RedfishGetHostInterfaceProtocolData function
> in the RedfishDiscoverDxe driver.
> That function only supports PCI-E interface.
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c | 11
> ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
> index d79750b..a3b977f 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
> @@ -65,10 +65,15 @@ RedfishGetHostInterfaceProtocolData (
>  RecordTmp   = (UINT8 *)Record + Offset;
> 
>  //
> -// Check Device Type, only PCI/PCIe Network Interface v2 is supported
> now.
> +// Check Device Type, PCI/PCIe and USB Network Interface v2 is
> supported.
>  //
> -if (*RecordTmp ==
> REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) {
> -  ASSERT (SpecificDataLen == sizeof
> (PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1);
> +if ((*RecordTmp ==
> REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) || (*RecordTmp ==
> REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2)) {
> +  if (*RecordTmp ==
> REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2){
> +  ASSERT (SpecificDataLen == sizeof
> (PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1);
> +  }
> +  if (*RecordTmp ==
> REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2){
> +  ASSERT (SpecificDataLen > sizeof
> (REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2) + 1);
> +  }
>*DeviceDescriptor = (REDFISH_INTERFACE_DATA *)RecordTmp;
>Offset= Offset + SpecificDataLen;
>RecordTmp = (UINT8 *)Record + Offset;
> --
> 2.6.1.windows.1
> -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intended
> to be read only by the individual or entity to whom it is addressed or by 
> their
> designee. If the reader of this message is not the intended recipient, you are
> on notice that any distribution of this message, in any form, is strictly
> prohibited. Please promptly notify the sender by reply e-mail or by
> telephone at 770-246-8600, and then delete or destroy all copies of the
> transmission.


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




Re: [edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the DevicePathUtilitiesStandaloneMm

2022-08-05 Thread Michael D Kinney
Liming,

Adding a new INF that is type BASE was my original suggestion.  Not the name 
change.

In that thread, I suggested we get input from MM owners before changing the 
name.

If there are many downstream platforms that are breaking from the name change, 
then we should add the old INF back to provide time for all platform to update 
to
use the new INF name.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of gaoliming via 
> groups.io
> Sent: Thursday, August 4, 2022 11:11 PM
> To: Huang, Yanbo ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Liu, Zhiguang 
> ; Bi, Dandan 
> Subject: 回复: [edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the 
> DevicePathUtilitiesStandaloneMm
> 
> Yanbo:
>   If this patch is temporarily added, you can handle it in your downstream 
> code base.
> 
>   If you request to add DevicePathUtilitiesStandaloneMm for long term 
> compatibility, this topic has been discussed in
> https://edk2.groups.io/g/devel/message/91799.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: Huang, Yanbo 
> > 发送时间: 2022年8月5日 13:34
> > 收件人: Gao, Liming ; devel@edk2.groups.io
> > 抄送: Kinney, Michael D ; Liu, Zhiguang
> > ; Bi, Dandan 
> > 主题: RE: [edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the
> > DevicePathUtilitiesStandaloneMm
> >
> > Hi Liming,
> >
> > You mentioned patch rename the DevicePathUtilitiesStandaloneMm to
> > UefiDevicePathLibBase, but there are some consumer in intel platform still
> > use the DevicePathUtilitiesStandaloneMm, so downstream will failed in CI
> > because it cannot find DevicePathUtilitiesStandaloneMm. So the
> > DevicePathUtilitiesStandaloneMm and UefiDevicePathLibBase must exist at
> > the same time for a period of time. After downstream finished and platform
> > change to use UefiDevicePathLibBase, then
> > DevicePathUtilitiesStandaloneMm can be deleted.
> >
> > Best Regards,
> > Yanbo Huang
> >
> > -Original Message-
> > From: gaoliming 
> > Sent: Friday, August 5, 2022 11:16 AM
> > To: devel@edk2.groups.io; Huang, Yanbo 
> > Cc: Kinney, Michael D ; Liu, Zhiguang
> > 
> > Subject: 回复: [edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the
> > DevicePathUtilitiesStandaloneMm
> >
> > Yanbo:
> >   Previous change has been reviewed and merged. Please see the detail
> > https://edk2.groups.io/g/devel/message/91799
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Huang,
> > Yanbo
> > > 发送时间: 2022年8月5日 10:42
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Yanbo Huang ; Michael D Kinney
> > > ; Liming Gao ;
> > > Zhiguang Liu 
> > > 主题: [edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the
> > > DevicePathUtilitiesStandaloneMm
> > >
> > > From: Yanbo Huang 
> > >
> > > reback the DevicePathUtilitiesStandaloneMm to unblock the downstream
> > > sync
> > >
> > > Signed-off-by: Yanbo Huang 
> > > CC: Michael D Kinney 
> > > CC: Liming Gao 
> > > CC: Zhiguang Liu 
> > >
> > > ---
> > >  .../DevicePathUtilitiesStandaloneMm.c | 39 ++
> > >  .../UefiDevicePathLibStandaloneMm.inf | 75
> > > +++
> > >  2 files changed, 114 insertions(+)
> > >  create mode 100644
> > > MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
> > >  create mode 100644
> > > MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
> > >
> > > diff --git
> > > a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
> > > b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
> > > new file mode 100644
> > > index 00..096f835b90
> > > --- /dev/null
> > > +++
> > > b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
> > > @@ -0,0 +1,39 @@
> > > +/** @file
> > > +  Device Path services. The thing to remember is device paths are
> > > +built
> > out
> > > of
> > > +  nodes. The device path is terminated by an end node that is length
> > > + sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is
> > > sizeof(EFI_DEVICE_PATH_PROTOCOL)
> > > +  all over this file.
> > > +
> > > +  The only place where multi-instance device paths are supported is
> > > + in  environment varibles. Multi-instance device paths should never
> > > + be
> > placed
> > > +  on a Handle.
> > > +
> > > +  Copyright (c) 2006 - 2018, Intel Corporation. All rights
> > > + reserved.  Copyright (c) Microsoft Corporation.
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +**/
> > > +
> > > +#include "UefiDevicePathLib.h"
> > > +
> > > +/**
> > > +  Retrieves the device path protocol from a handle.
> > > +
> > > +  This function returns the device path protocol from the handle
> > specified by
> > > Handle.
> > > +  If Handle is NULL or Handle does not contain a device path
> > > + protocol,
> > then
> > > NULL
> > > +  is returned.
> > > +
> > > +  @param  Handle The handle from which to
> > > retrieve the device
> > > + path protocol.
> > > +
> > > +  @return The device pa

Re: [edk2-devel] [PATCH v7 0/4] Improved support for FT2004/4 chip.

2022-08-05 Thread shuyiqi
Reviewed-by: Yiqi Shu 


> -原始邮件-发件人:"贾玲" 发送时间:2022-08-05 15:37:30 
> (星期五)收件人:"Yiqi Shu" , "Peng Xie" 
> 抄送:主题:[PATCH v7 0/4] Improved support for FT2004/4 
> chip.
> 
> Completed the flash driver and fvb driver.
> Solved the problems in boot process.
> Added virtual address conversion.
> 
> The public git repository is :
> https://github.com/jialing2020/edk2-platforms/tree/Phytium_Opensource_For_FT2000-4_v7
> 
> Ling Jia (4):
>   Platform/Phytium: Solved problems during boot.
>   Silicon/Phytium: Added flash driver support to Phytium Silicon.
>   Silicon/Phytium: Added fvb driver for flash
>   Silicon/Phytium: Added runtime support to spi master.
> 
>  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
> |1 +
>  Platform/Phytium/DurianPkg/DurianPkg.dsc 
> |   14 +
>  Platform/Phytium/DurianPkg/DurianPkg.fdf 
> |   32 +-
>  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
> |5 +
>  Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => 
> SpiNorFlashDxe/SpiNorFlashDxe.inf} |   25 +-
>  Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf 
> |   63 +
>  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h  
> |2 +
>  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h  
> |   95 ++
>  Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h   
> |  105 ++
>  Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h  
> |   74 ++
>  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c  
> |   84 +-
>  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c  
> |  412 ++
>  Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c   
> | 1329 
>  13 files changed, 2210 insertions(+), 31 deletions(-)
>  copy Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => 
> SpiNorFlashDxe/SpiNorFlashDxe.inf} (55%)
>  mode change 100644 => 100755
>  create mode 100755 
> Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>  create mode 100755 
> Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h
>  create mode 100755 
> Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h
>  create mode 100755 
> Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h
>  create mode 100755 
> Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c
>  create mode 100755 
> Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> 
> -- 
> 2.25.1
> 
> 
> 信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
> Information Security Notice: The information contained in this mail is solely 
> property of the sender's organization.This mail communication is 
> confidential.Recipients named above are obligated to maintain secrecy and are 
> not permitted to disclose the contents of this communication to others.


--
​
舒奕棋 YiQi Shu | 软件技术方案部 经理
 022-59080100-2201  183-9087-7610  022-58955668  www.phytium.com.cn  
长沙市开福区芙蓉中路一段富兴时代T2栋16-18楼

信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
Information Security Notice: The information contained in this mail is solely 
property of the sender's organization.This mail communication is 
confidential.Recipients named above are obligated to maintain secrecy and are 
not permitted to disclose the contents of this communication to others.


信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
Information Security Notice: The information contained in this mail is solely 
property of the sender's organization.This mail communication is 
confidential.Recipients named above are obligated to maintain secrecy and are 
not permitted to disclose the contents of this communication to others.

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




[edk2-devel] [PATCH] DynamicTablesPkg: Add support to build _DSD

2022-08-05 Thread Jeff Brasen via groups.io
Add APIs needed to build _DSD with different UUIDs.

This is per ACPI specification 6.4 s6.2.5.



Adds support for building data packages with format

Package {"Name", Integer}



Signed-off-by: Jeff Brasen 

---

 .../Include/Library/AmlLib/AmlLib.h   |  50 

 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 236 ++

 2 files changed, 286 insertions(+)



diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

index 6f214c0dfa..30cab3f6bb 100644

--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

@@ -1280,6 +1280,56 @@ AmlAddLpiState (

   IN  AML_OBJECT_NODE_HANDLE  LpiNode

   );

 

+/** AML code generation for a _DSD device data object.

+

+  AmlAddDeviceDataDescriptorPackage (Uuid, ParentNode, NewObjectNode) is

+  equivalent of the following ASL code:

+ToUUID(Uuid),

+Package () {}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Uuid   The Uuid of the descriptor to be created

+  @param [in]  DsdNodeNode of the DSD Package.

+  @param [out] PackageNodeIf success, contains the created package node.

+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddDeviceDataDescriptorPackage (

+  IN  CONST EFI_GUID*Uuid,

+  INAML_OBJECT_NODE_HANDLE  DsdNode,

+  OUT   AML_OBJECT_NODE_HANDLE  *PackageNode

+  );

+

+/** AML code generation to add a package with a name and value,

+ *  to a parent package

+

+  AmlAddNameValuePackage ("Name", Value, ParentNode) is

+  equivalent of the following ASL code:

+Package (2) {"Name", Value}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Name   String to place in first entry of package

+  @param [in]  Value  Integer to place in second entry of package

+  @param [in]  PackageNodePackage to add new sub package to.

+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddNameIntegerPackage (

+  IN CHAR8   *Name,

+  IN UINT64  Value,

+  IN AML_OBJECT_NODE_HANDLE  PackageNode

+  );

+

 // DEPRECATED APIS

 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES

 

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

index e51d2dd7f0..80e43d0e62 100644

--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

@@ -2600,3 +2600,239 @@ error_handler:

 

   return Status;

 }

+

+/** AML code generation for a _DSD device data object.

+

+  AmlAddDeviceDataDescriptorPackage (Uuid, ParentNode, NewObjectNode) is

+  equivalent of the following ASL code:

+ToUUID(Uuid),

+Package () {}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Uuid   The Uuid of the descriptor to be created

+  @param [in]  DsdNodeNode of the DSD Package.

+  @param [out] PackageNodeIf success, contains the created package node.

+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddDeviceDataDescriptorPackage (

+  IN  CONST EFI_GUID*Uuid,

+  INAML_OBJECT_NODE_HANDLE  DsdNode,

+  OUT   AML_OBJECT_NODE_HANDLE  *PackageNode

+  )

+{

+  EFI_STATUS  Status;

+  AML_OBJECT_NODE *UuidNode;

+  AML_DATA_NODE   *UuidDataNode;

+  AML_OBJECT_NODE_HANDLE  DsdEntryList;

+

+  if ((Uuid == NULL) ||

+  (PackageNode == NULL) ||

+  (AmlGetNodeType ((AML_NODE_HANDLE)DsdNode) != EAmlNodeObject) ||

+  (!AmlNodeHasOpCode (DsdNode, AML_NAME_OP, 0)) ||

+  !AmlNameOpCompareName (DsdNode, "_DSD"))

+  {

+ASSERT (0);

+return EFI_INVALID_PARAMETER;

+  }

+

+  // Get the Package object node of the _DSD node,

+  // which is the 2nd fixed argument (i.e. index 1).

+  DsdEntryList = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (

+   DsdNode,

+   EAmlParseIndexTerm1

+   );

+  if ((DsdEntryList == NULL)  ||

+  (AmlGetNodeType ((AML_NODE_HANDLE)DsdEntryList) != EAmlNodeObject)  ||

+  (!AmlNodeHasOpCode (DsdEntryList, AML_PACKAGE_OP, 0)))

+  {

+ASSERT (0);

+return EFI_INVALID_PARAMETER;

+  }

+

+  *PackageNode = NULL;

+  UuidNode = NULL;

+

+  Status = AmlCodeGenBuffer (NULL, 0, &UuidNode);

+  if (EFI_ERROR (Status)) {

+ASSERT (0);

+goto e

Re: [edk2-devel] [PATCH v1 0/5] Add support to build PRM for AARCH64 using GCC

2022-08-05 Thread Michael Kubacki

Hi Sami,

I see you created a PR that is marked as draft with these changes:
https://github.com/tianocore/edk2/pull/3167

When you're ready for them to be submitted, if you could please create a 
non-draft PR with the review tags added, I'd be happy to push it.


Thanks,
Michael

On 8/3/2022 10:35 AM, Sami Mujawar wrote:

This patch series adds support to build PRM for AARCH64 using GCC.

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/2238_aarch64_prm_support_v1

Jose Marinho (5):
   Basetools/GenFw: Allow AARCH64 builds to use the --prm flag
   PrmPkg: Enable external visibility on PRM symbols
   PrmPkg: Build Prm Samples with GCC for AARCH64
   PrmPkg: Support AArch64 builds using GCC
   PrmPkg: Add details on AArch64 build to the Readme.

  BaseTools/Source/C/GenFw/Elf64Convert.c   
   |  6 ++---
  PrmPkg/Include/Prm.h  
   |  3 +++
  PrmPkg/PrmPkg.ci.yaml 
   |  1 +
  PrmPkg/PrmPkg.dsc 
   | 24 +---
  PrmPkg/Readme.md  
   | 11 +
  
PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.inf
 |  4 
  PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.inf  
   |  4 
  7 files changed, 47 insertions(+), 6 deletions(-)




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




[edk2-devel] [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in UsbHcFreeMemPool()

2022-08-05 Thread Zeng, Star
Use Block->Next instead of Pool->Head->Next, otherwise the for loop
will be not able to come out.
It will also match with the UsbHcFreeMemPool() in EhciPei.

Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Zhikai Sun 
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c 
b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
index c64b38fcfc89..148425ae844e 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
@@ -385,7 +385,7 @@ UsbHcFreeMemPool (
   // UsbHcUnlinkMemBlock can't be used to unlink and free the
   // first block.
   //
-  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
+  for (Block = Pool->Head->Next; Block != NULL; Block = Block->Next) {
 // UsbHcUnlinkMemBlock (Pool->Head, Block);
 UsbHcFreeMemBlock (Pool, Block);
   }
-- 
2.33.1.windows.1



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




[edk2-devel] [PATCH] MdeModulePkg: Update the SMBIOS version by UPL

2022-08-05 Thread kasimx . liu
From: KasimX Liu 

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

For the SMBIOS version can be update by UPL,we create
the gUniversalPayloadSmbios3TableGuid HOB to store
the value then updated version.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: KasimX Liu 
---
 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c 
b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 81df59cd0f..5ee76c7129 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1746,14 +1746,30 @@ SmbiosDriverEntryPoint (
   )
 {
   EFI_STATUS  Status;
+  EFI_HOB_GUID_TYPE   *GuidHob;
+  UNIVERSAL_PAYLOAD_SMBIOS_TABLE  *Smbiostable;
+  SMBIOS_TABLE_3_0_ENTRY_POINT*Smbios30EntryPoint;
+
+  GuidHob = NULL;
+  Smbiostable = NULL;
+  Smbios30EntryPoint = NULL;
 
   mPrivateData.Signature   = SMBIOS_INSTANCE_SIGNATURE;
   mPrivateData.Smbios.Add  = SmbiosAdd;
   mPrivateData.Smbios.UpdateString = SmbiosUpdateString;
   mPrivateData.Smbios.Remove   = SmbiosRemove;
   mPrivateData.Smbios.GetNext  = SmbiosGetNext;
-  mPrivateData.Smbios.MajorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) >> 8);
-  mPrivateData.Smbios.MinorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) & 
0x00ff);
+
+  GuidHob = GetFirstGuidHob (&gUniversalPayloadSmbios3TableGuid);
+  if (GuidHob != NULL){
+Smbiostable = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *) (UINTN 
*)(GET_GUID_HOB_DATA (GuidHob));
+Smbios30EntryPoint = (SMBIOS_TABLE_3_0_ENTRY_POINT 
*)Smbiostable->SmBiosEntryPoint;
+mPrivateData.Smbios.MajorVersion = Smbios30EntryPoint->MajorVersion;
+mPrivateData.Smbios.MinorVersion = Smbios30EntryPoint->MinorVersion;
+  } else {
+mPrivateData.Smbios.MajorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) >> 
8);
+mPrivateData.Smbios.MinorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) & 
0x00ff);
+  }
 
   InitializeListHead (&mPrivateData.DataListHead);
   InitializeListHead (&mPrivateData.AllocatedHandleListHead);
-- 
2.32.0.windows.2



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




[edk2-devel] The secureboot framework does not support RSA-PSS.

2022-08-05 Thread 任云青
I would like to create anissue in bugzilla.

The detail is:

The secureboot framework finally invokes PKCS7_verifyof openssl. It has been 
verified that PKCS7_verify does not support verifying the contents with a 
RSA-PSS signature. The CMS_verify interface supports RSA-PSS. I would like to 
ask if the edk2 secureboot framework has any plans to support RSA-PSS?

For this issue, I do not have a patch to fix it...

Thank you.




| |
renyunqing1...@163.com
|
|
邮箱:renyunqing1...@163.com
|

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




[edk2-devel] [PATCH] MdePkg/UefiDevicePathLib: reback the DevicePathUtilitiesStandaloneMm

2022-08-05 Thread First Last
From: Yanbo Huang 

reback the DevicePathUtilitiesStandaloneMm to unblock the downstream sync

Signed-off-by: Yanbo Huang 
CC: Michael D Kinney 
CC: Liming Gao 
CC: Zhiguang Liu 

---
 .../DevicePathUtilitiesStandaloneMm.c | 39 ++
 .../UefiDevicePathLibStandaloneMm.inf | 75 +++
 2 files changed, 114 insertions(+)
 create mode 100644 
MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
 create mode 100644 
MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
new file mode 100644
index 00..096f835b90
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
@@ -0,0 +1,39 @@
+/** @file
+  Device Path services. The thing to remember is device paths are built out of
+  nodes. The device path is terminated by an end node that is length
+  sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is 
sizeof(EFI_DEVICE_PATH_PROTOCOL)
+  all over this file.
+
+  The only place where multi-instance device paths are supported is in
+  environment varibles. Multi-instance device paths should never be placed
+  on a Handle.
+
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+/**
+  Retrieves the device path protocol from a handle.
+
+  This function returns the device path protocol from the handle specified by 
Handle.
+  If Handle is NULL or Handle does not contain a device path protocol, then 
NULL
+  is returned.
+
+  @param  Handle The handle from which to retrieve the 
device
+ path protocol.
+
+  @return The device path protocol from the handle specified by Handle.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+DevicePathFromHandle (
+  IN EFI_HANDLE  Handle
+  )
+{
+  return NULL;
+}
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf 
b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
new file mode 100644
index 00..23fedf38b7
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
@@ -0,0 +1,75 @@
+## @file
+# Instance of Device Path Library based on Memory Allocation Library.
+#
+# Device Path Library that layers on top of the Memory Allocation Library.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = UefiDevicePathLib
+  MODULE_UNI_FILE= UefiDevicePathLib.uni
+  FILE_GUID  = D8E58437-44D3-4154-B7A7-EB794923EF12
+  MODULE_TYPE= MM_STANDALONE
+  PI_SPECIFICATION_VERSION   = 0x00010032
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = DevicePathLib | MM_STANDALONE 
MM_CORE_STANDALONE
+
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+
+[Sources]
+  DevicePathUtilities.c
+  DevicePathUtilitiesStandaloneMm.c
+  DevicePathToText.c
+  DevicePathFromText.c
+  UefiDevicePathLib.c
+  UefiDevicePathLib.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  MemoryAllocationLib
+  DebugLib
+  BaseMemoryLib
+  PcdLib
+  PrintLib
+
+[Guids]
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVTUTF8Guid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVT100Guid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVT100PlusGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiPcAnsiGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiUartDevicePathGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiSasDevicePathGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVirtualDiskGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVirtualCdGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiPersistentVirtualDiskGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiPersistentVirtualCdGuid
+
+[Protocols]
+  gEfiDevicePathProtocolGuid## SOMETIMES_CONSUMES
+  gEfiDebugPortProtocolGuid ## UNDEFINED
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount## 
SOMETIMES_CONSUMES
-- 
2.31.1.windows.1



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




[edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-08-05 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Logo/Logo.c  | 5 +
 MdeModulePkg/Logo/LogoDxe.inf | 4 
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 6 ++
 4 files changed, 21 insertions(+)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..1638d0f984 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -69,6 +70,10 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
+mLogos[Current].Attribute = 
EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 7d98910832..a503aaf58d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2098,6 +2098,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index b070f15ff2..e7050df7b7 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1334,3 +1334,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the position of the Logo. When set to true, the Logo is 
positioned following the recommendations"
+   
  " from Microsoft, 38.2% from the top of the screen."
+
-- 
2.34.1



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




[edk2-devel] [PATCH 3/3] UefiPayloadPkg: Hook up MICROSOFT_RECOMMENDED macro

2022-08-05 Thread Sean Rhodes
Hook up MICROSOFT_RECOMMENDED macro to PcdFollowMicrosoftRecommended.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 91cd78dbf1..b3ed0f6a2e 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -43,6 +43,7 @@
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
   DEFINE BOOTSPLASH_IMAGE = FALSE
+  DEFINE MICROSOFT_RECOMMENDED= FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -440,6 +441,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|$(MICROSOFT_RECOMMENDED)
 
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
-- 
2.34.1



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




[edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow Microsoft Recommendations

2022-08-05 Thread Sean Rhodes
Add an option to position the logo 38.2% from the top of the screen,
which follows the recommendations from Microsoft. These can be found
here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h 
b/MdeModulePkg/Include/Protocol/PlatformLogo.h
index 08e1dc35a4..b24d7d5b79 100644
--- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
+++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
@@ -29,7 +29,8 @@ typedef enum {
   EdkiiPlatformLogoDisplayAttributeCenterBottom,
   EdkiiPlatformLogoDisplayAttributeLeftBottom,
   EdkiiPlatformLogoDisplayAttributeCenterLeft,
-  EdkiiPlatformLogoDisplayAttributeCenter
+  EdkiiPlatformLogoDisplayAttributeCenter,
+  EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended
 } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
 
 /**
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..9065e5281b 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -169,7 +169,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = 0;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeCenterLeft:
 DestX = 0;
 DestY = (SizeOfY - Image.Height) / 2;
@@ -182,7 +181,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = (SizeOfY - Image.Height) / 2;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeLeftBottom:
 DestX = 0;
 DestY = SizeOfY - Image.Height;
@@ -195,7 +193,10 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = SizeOfY - Image.Height;
 break;
-
+  case EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended:
+DestX = (SizeOfX - Image.Width) / 2;
+DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
+break;
   default:
 ASSERT (FALSE);
 continue;
-- 
2.34.1



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




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-05 Thread wenyi,xie via groups.io
As the CommunicationBuffer plus BufferSize may overflow, check the
value first before using.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 +---
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  5 +
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 9e5c6cbe33dd..fcf8c61d7f1b 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -613,23 +613,28 @@ SmmEndOfS3ResumeHandler (
   @retval FALSE Buffer doesn't overlap.
 
 **/
-BOOLEAN
+EFI_STATUS
 InternalIsBufferOverlapped (
   IN UINT8  *Buff1,
   IN UINTN  Size1,
   IN UINT8  *Buff2,
-  IN UINTN  Size2
+  IN UINTN  Size2,
+  IN BOOLEAN *IsOverlapped
   )
 {
+  *IsOverlapped = TRUE;
+  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN - 
Size2)) {
+return EFI_INVALID_PARAMETER;
+  }
   //
   // If buff1's end is less than the start of buff2, then it's ok.
   // Also, if buff1's start is beyond buff2's end, then it's ok.
   //
   if (((Buff1 + Size1) <= Buff2) || (Buff1 >= (Buff2 + Size2))) {
-return FALSE;
+*IsOverlapped = FALSE;
   }
 
-  return TRUE;
+  return EFI_SUCCESS;
 }
 
 /**
@@ -693,17 +698,18 @@ SmmEntryPoint (
   //
   // Synchronous SMI for SMM Core or request from Communicate protocol
   //
-  IsOverlapped = InternalIsBufferOverlapped (
+  Status = InternalIsBufferOverlapped (
(UINT8 *)CommunicationBuffer,
BufferSize,
(UINT8 *)gSmmCorePrivate,
-   sizeof (*gSmmCorePrivate)
+   sizeof (*gSmmCorePrivate),
+   &IsOverlapped
);
-  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer, BufferSize) 
|| IsOverlapped) {
+  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer, BufferSize) 
|| EFI_ERROR(Status) || IsOverlapped) {
 //
 // If CommunicationBuffer is not in valid address scope,
 // or there is overlap between gSmmCorePrivate and CommunicationBuffer,
-// return EFI_INVALID_PARAMETER
+// return EFI_ACCESS_DENIED
 //
 gSmmCorePrivate->CommunicationBuffer = NULL;
 gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4f00cebaf5ed..bd13cf97ec93 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -525,6 +525,11 @@ SmmCommunicationCommunicate (
 
   CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommBuffer;
 
+  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)) {
+DEBUG ((DEBUG_ERROR, "MessageLength is invalid!\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
   if (CommSize == NULL) {
 TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength;
   } else {
-- 
2.20.1.windows.1



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




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-05 Thread wenyi,xie via groups.io
Main Changes :
1.Add check to avoid overflow.

Wenyi Xie (1):
  MdeModulePkg/PiSmmCore:Avoid overflow risk

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 +---
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  5 +
 2 files changed, 19 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1



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




Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow BGRT specification

2022-08-05 Thread Pedro Falcato
Hi Sean,

I think it's clear from the wording that the 38.2% thing is a
recommendation and not mandatory. I was curious and checked out the ACPI
spec and they appear to not mention that at all. Maybe reword things to
"Microsoft recommendation"?

Thanks,
Pedro

On Fri, 5 Aug 2022, 07:55 Sean Rhodes,  wrote:

> Hi Liming
>
> Microsoft details about positioning can be found here:
> https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components
>
> Thanks
>
> Sean
>
> On Fri, 5 Aug 2022 at 07:00, gaoliming via groups.io  byosoft.com...@groups.io> wrote:
>
>> Sean:
>>   Can you give BGRT spec link? I want to check the spec description.
>>
>> Thanks
>> Liming
>> > -邮件原件-
>> > 发件人: devel@edk2.groups.io  代表 Sean Rhodes
>> > 发送时间: 2022年7月26日 16:15
>> > 收件人: devel@edk2.groups.io
>> > 抄送: Sean Rhodes ; Zhichao Gao
>> > ; Ray Ni ; Jian J Wang
>> > ; Liming Gao 
>> > 主题: [edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to
>> > follow BGRT specification
>> >
>> > Add an option to position the logo 38.2% from the top of the screen,
>> > which follows the BGRT specification.
>> >
>> > Cc: Zhichao Gao 
>> > Cc: Ray Ni 
>> > Cc: Jian J Wang 
>> > Cc: Liming Gao 
>> > Signed-off-by: Sean Rhodes 
>> > ---
>> >  MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
>> >  MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
>> >  2 files changed, 6 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h
>> > b/MdeModulePkg/Include/Protocol/PlatformLogo.h
>> > index 08e1dc35a4..7c9ef63c66 100644
>> > --- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
>> > +++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
>> > @@ -29,7 +29,8 @@ typedef enum {
>> >EdkiiPlatformLogoDisplayAttributeCenterBottom,
>> >
>> >EdkiiPlatformLogoDisplayAttributeLeftBottom,
>> >
>> >EdkiiPlatformLogoDisplayAttributeCenterLeft,
>> >
>> > -  EdkiiPlatformLogoDisplayAttributeCenter
>> >
>> > +  EdkiiPlatformLogoDisplayAttributeCenter,
>> >
>> > +  EdkiiPlatformLogoDisplayAttributeBGRTSpecification
>> >
>> >  } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
>> >
>> >
>> >
>> >  /**
>> >
>> > diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
>> > b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
>> > index 478ec2d40e..ac086f9c79 100644
>> > --- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
>> > +++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
>> > @@ -169,7 +169,6 @@ BootLogoEnableLogo (
>> >  DestX = SizeOfX - Image.Width;
>> >
>> >  DestY = 0;
>> >
>> >  break;
>> >
>> > -
>> >
>> >case EdkiiPlatformLogoDisplayAttributeCenterLeft:
>> >
>> >  DestX = 0;
>> >
>> >  DestY = (SizeOfY - Image.Height) / 2;
>> >
>> > @@ -182,7 +181,6 @@ BootLogoEnableLogo (
>> >  DestX = SizeOfX - Image.Width;
>> >
>> >  DestY = (SizeOfY - Image.Height) / 2;
>> >
>> >  break;
>> >
>> > -
>> >
>> >case EdkiiPlatformLogoDisplayAttributeLeftBottom:
>> >
>> >  DestX = 0;
>> >
>> >  DestY = SizeOfY - Image.Height;
>> >
>> > @@ -195,7 +193,10 @@ BootLogoEnableLogo (
>> >  DestX = SizeOfX - Image.Width;
>> >
>> >  DestY = SizeOfY - Image.Height;
>> >
>> >  break;
>> >
>> > -
>> >
>> > +  case EdkiiPlatformLogoDisplayAttributeBGRTSpecification:
>> >
>> > +DestX = (SizeOfX - Image.Width) / 2;
>> >
>> > +DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
>> >
>> > +break;
>> >
>> >default:
>> >
>> >  ASSERT (FALSE);
>> >
>> >  continue;
>> >
>> > --
>> > 2.34.1
>> >
>> >
>> >
>> > -=-=-=-=-=-=
>> > Groups.io Links: You receive all messages sent to this group.
>> > View/Reply Online (#91842):
>> https://edk2.groups.io/g/devel/message/91842
>> > Mute This Topic: https://groups.io/mt/92623125/4905953
>> > Group Owner: devel+ow...@edk2.groups.io
>> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
>> > [gaolim...@byosoft.com.cn]
>> > -=-=-=-=-=-=
>> >
>>
>>
>>
>>
>>
>>
>>
>>
>> 
>


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