public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions
@ 2021-01-29  1:59 Park, Aiden
  2021-01-29  3:45 ` [edk2-devel] " Ni, Ray
  0 siblings, 1 reply; 4+ messages in thread
From: Park, Aiden @ 2021-01-29  1:59 UTC (permalink / raw)
  To: guo.dong, maurice.ma, devel; +Cc: aiden.park

From: Aiden Park <aiden.park@intel.com>

The CoreInitializeMemoryServices() looks for a suitable memory region
for EFI Memory Service from the ResourceDescriptor Hob.
This patch does not allow legacy memory region for the Memory Service
and provides default memory type information to calculate minimal
required memory size properly for the Memory Service.

Signed-off-by: Aiden Park <aiden.park@intel.com>
---
 .../UefiPayloadEntry/UefiPayloadEntry.c       | 20 +++++++++++++++++++
 .../UefiPayloadEntry/UefiPayloadEntry.inf     |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 805f5448d9..d2e6f962cd 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -6,6 +6,16 @@
 **/
 
 #include "UefiPayloadEntry.h"
+#include <Guid/MemoryTypeInformation.h>
+
+EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
+  { EfiACPIReclaimMemory,   FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory) },
+  { EfiACPIMemoryNVS,       FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) },
+  { EfiReservedMemoryType,  FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryType) },
+  { EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesData) },
+  { EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode) },
+  { EfiMaxMemoryType,       0     }
+};
 
 /**
    Callback function to build resource descriptor HOB
@@ -44,6 +54,9 @@ MemInfoCallback (
     // Remove tested attribute to avoid DXE core to dispatch driver to memory above 4GB
     Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
   }
+  if (Base == 0x00) {
+    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
+  }
 
   BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, Size);
   DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type));
@@ -315,6 +328,13 @@ BuildGenericHob (
   UINT8                            PhysicalAddressBits;
   EFI_RESOURCE_ATTRIBUTE_TYPE      ResourceAttribute;
 
+  //
+  // Create Memory Type Information HOB
+  //
+  BuildGuidDataHob (&gEfiMemoryTypeInformationGuid,
+                    mDefaultMemoryTypeInformation,
+                    sizeof (mDefaultMemoryTypeInformation));
+
   // The UEFI payload FV
   BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (PcdPayloadFdMemSize), EfiBootServicesData);
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index cc59f1903b..5cb084ca51 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -86,6 +86,11 @@
   gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
   gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
   gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack               ## SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIMES_CONSUMES
-- 
2.20.1


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

* Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions
  2021-01-29  1:59 [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions Park, Aiden
@ 2021-01-29  3:45 ` Ni, Ray
  2021-01-29 21:08   ` Park, Aiden
  0 siblings, 1 reply; 4+ messages in thread
From: Ni, Ray @ 2021-01-29  3:45 UTC (permalink / raw)
  To: devel@edk2.groups.io, Park, Aiden, Dong, Guo, Ma, Maurice

The EDKII UEFI bios flow is:
1. platform PEI creates a default memory type information HOB
2. DXE CORE reserves the memory according to the HOB for allocation
3. BDS checks whether the pre-reserved memory meets the needs and saves the real needs to a NV variable if the pre-reserved is not enough
4. Next time boot, platform PEI loads the NV variable to create the memory type information HOB

But this patch only creates a default HOB and don't provides a mechanism to consume the NV and create the HOB.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Park, Aiden
> Sent: Friday, January 29, 2021 10:00 AM
> To: Dong, Guo <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>; devel@edk2.groups.io
> Cc: Park, Aiden <aiden.park@intel.com>
> Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions
> 
> From: Aiden Park <aiden.park@intel.com>
> 
> The CoreInitializeMemoryServices() looks for a suitable memory region
> for EFI Memory Service from the ResourceDescriptor Hob.
> This patch does not allow legacy memory region for the Memory Service
> and provides default memory type information to calculate minimal
> required memory size properly for the Memory Service.
> 
> Signed-off-by: Aiden Park <aiden.park@intel.com>
> ---
>  .../UefiPayloadEntry/UefiPayloadEntry.c       | 20 +++++++++++++++++++
>  .../UefiPayloadEntry/UefiPayloadEntry.inf     |  5 +++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> index 805f5448d9..d2e6f962cd 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> @@ -6,6 +6,16 @@
>  **/
> 
>  #include "UefiPayloadEntry.h"
> +#include <Guid/MemoryTypeInformation.h>
> +
> +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
> +  { EfiACPIReclaimMemory,   FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory) },
> +  { EfiACPIMemoryNVS,       FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) },
> +  { EfiReservedMemoryType,  FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryType) },
> +  { EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesData) },
> +  { EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode) },
> +  { EfiMaxMemoryType,       0     }
> +};
> 
>  /**
>     Callback function to build resource descriptor HOB
> @@ -44,6 +54,9 @@ MemInfoCallback (
>      // Remove tested attribute to avoid DXE core to dispatch driver to memory above 4GB
>      Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
>    }
> +  if (Base == 0x00) {
> +    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
> +  }
> 
>    BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, Size);
>    DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type));
> @@ -315,6 +328,13 @@ BuildGenericHob (
>    UINT8                            PhysicalAddressBits;
>    EFI_RESOURCE_ATTRIBUTE_TYPE      ResourceAttribute;
> 
> +  //
> +  // Create Memory Type Information HOB
> +  //
> +  BuildGuidDataHob (&gEfiMemoryTypeInformationGuid,
> +                    mDefaultMemoryTypeInformation,
> +                    sizeof (mDefaultMemoryTypeInformation));
> +
>    // The UEFI payload FV
>    BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (PcdPayloadFdMemSize), EfiBootServicesData);
> 
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> index cc59f1903b..5cb084ca51 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> @@ -86,6 +86,11 @@
>    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
>    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
>    gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
> 
>    gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack               ## SOMETIMES_CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIMES_CONSUMES
> --
> 2.20.1
> 
> 
> 
> 
> 


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

* Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions
  2021-01-29  3:45 ` [edk2-devel] " Ni, Ray
@ 2021-01-29 21:08   ` Park, Aiden
  2021-01-31  4:19     ` Benjamin You
  0 siblings, 1 reply; 4+ messages in thread
From: Park, Aiden @ 2021-01-29 21:08 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io, Dong, Guo, Ma, Maurice

Hi Ray,

You are absolutely right. This patch does not have the adjust/recovery path.
The reasons we have the initial values here are
1. Without default memory type, the EFI memory service look for an usable conventional memory region calculated with the minimal memory size 64KB. This patch will increase the minimal memory size condition to 1.3MB.
2. The default memory type PCD values are enough for UefiPayload memory service since most of necessary memory are already covered in pre-stage boot firmware.
3. The default memory type PCDs can be updated or overridden by a platform DSC if necessary
4. UefiPayload is using EmuVariableNvMode by default

The main goal of this patch is
-  To avoid legacy memory region to be selected for EFI memory service
-  To select Fair enough conventional memory region by increasing the minimal memory size

> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Thursday, January 28, 2021 7:45 PM
> To: devel@edk2.groups.io; Park, Aiden <aiden.park@intel.com>; Dong, Guo
> <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>
> Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service
> conditions
> 
> The EDKII UEFI bios flow is:
> 1. platform PEI creates a default memory type information HOB 2. DXE CORE
> reserves the memory according to the HOB for allocation 3. BDS checks whether
> the pre-reserved memory meets the needs and saves the real needs to a NV
> variable if the pre-reserved is not enough 4. Next time boot, platform PEI loads
> the NV variable to create the memory type information HOB
> 
> But this patch only creates a default HOB and don't provides a mechanism to
> consume the NV and create the HOB.
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Park,
> > Aiden
> > Sent: Friday, January 29, 2021 10:00 AM
> > To: Dong, Guo <guo.dong@intel.com>; Ma, Maurice
> > <maurice.ma@intel.com>; devel@edk2.groups.io
> > Cc: Park, Aiden <aiden.park@intel.com>
> > Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory
> > Service conditions
> >
> > From: Aiden Park <aiden.park@intel.com>
> >
> > The CoreInitializeMemoryServices() looks for a suitable memory region
> > for EFI Memory Service from the ResourceDescriptor Hob.
> > This patch does not allow legacy memory region for the Memory Service
> > and provides default memory type information to calculate minimal
> > required memory size properly for the Memory Service.
> >
> > Signed-off-by: Aiden Park <aiden.park@intel.com>
> > ---
> >  .../UefiPayloadEntry/UefiPayloadEntry.c       | 20 +++++++++++++++++++
> >  .../UefiPayloadEntry/UefiPayloadEntry.inf     |  5 +++++
> >  2 files changed, 25 insertions(+)
> >
> > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > index 805f5448d9..d2e6f962cd 100644
> > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > @@ -6,6 +6,16 @@
> >  **/
> >
> >  #include "UefiPayloadEntry.h"
> > +#include <Guid/MemoryTypeInformation.h>
> > +
> > +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
> > +  { EfiACPIReclaimMemory,   FixedPcdGet32
> (PcdMemoryTypeEfiACPIReclaimMemory) },
> > +  { EfiACPIMemoryNVS,       FixedPcdGet32
> (PcdMemoryTypeEfiACPIMemoryNVS) },
> > +  { EfiReservedMemoryType,  FixedPcdGet32
> > +(PcdMemoryTypeEfiReservedMemoryType) },
> > +  { EfiRuntimeServicesData, FixedPcdGet32
> > +(PcdMemoryTypeEfiRuntimeServicesData) },
> > +  { EfiRuntimeServicesCode, FixedPcdGet32
> (PcdMemoryTypeEfiRuntimeServicesCode) },
> > +  { EfiMaxMemoryType,       0     }
> > +};
> >
> >  /**
> >     Callback function to build resource descriptor HOB @@ -44,6 +54,9
> > @@ MemInfoCallback (
> >      // Remove tested attribute to avoid DXE core to dispatch driver to memory
> above 4GB
> >      Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
> >    }
> > +  if (Base == 0x00) {
> > +    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;  }
> >
> >    BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base,
> Size);
> >    DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type =
> > 0x%x\n", Base, Size, Type)); @@ -315,6 +328,13 @@ BuildGenericHob (
> >    UINT8                            PhysicalAddressBits;
> >    EFI_RESOURCE_ATTRIBUTE_TYPE      ResourceAttribute;
> >
> > +  //
> > +  // Create Memory Type Information HOB  //  BuildGuidDataHob
> > + (&gEfiMemoryTypeInformationGuid,
> > +                    mDefaultMemoryTypeInformation,
> > +                    sizeof (mDefaultMemoryTypeInformation));
> > +
> >    // The UEFI payload FV
> >    BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32
> > (PcdPayloadFdMemSize), EfiBootServicesData);
> >
> > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > index cc59f1903b..5cb084ca51 100644
> > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > @@ -86,6 +86,11 @@
> >    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
> >    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
> >    gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
> > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
> > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
> > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
> > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
> > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
> >
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack               ##
> SOMETIMES_CONSUMES
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ##
> > SOMETIMES_CONSUMES
> > --
> > 2.20.1
> >
> >
> >
> > 
> >

Best Regards,
Aiden

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

* Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions
  2021-01-29 21:08   ` Park, Aiden
@ 2021-01-31  4:19     ` Benjamin You
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin You @ 2021-01-31  4:19 UTC (permalink / raw)
  To: devel@edk2.groups.io, Park, Aiden, Ni, Ray, Dong, Guo,
	Ma, Maurice

Hi Aiden,

Could you please insert some comments for below codes?

+  if (Base == 0x00) {
+    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;  }

Also, is this removal of legacy region to protect coreboot data structures in
the region?

Thanks,

- ben

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Park, Aiden
> Sent: Saturday, January 30, 2021 5:08 AM
> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Dong, Guo
> <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>
> Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service
> conditions
> 
> Hi Ray,
> 
> You are absolutely right. This patch does not have the adjust/recovery path.
> The reasons we have the initial values here are
> 1. Without default memory type, the EFI memory service look for an usable
> conventional memory region calculated with the minimal memory size 64KB.
> This patch will increase the minimal memory size condition to 1.3MB.
> 2. The default memory type PCD values are enough for UefiPayload memory
> service since most of necessary memory are already covered in pre-stage boot
> firmware.
> 3. The default memory type PCDs can be updated or overridden by a platform
> DSC if necessary
> 4. UefiPayload is using EmuVariableNvMode by default
> 
> The main goal of this patch is
> -  To avoid legacy memory region to be selected for EFI memory service
> -  To select Fair enough conventional memory region by increasing the minimal
> memory size
> 
> > -----Original Message-----
> > From: Ni, Ray <ray.ni@intel.com>
> > Sent: Thursday, January 28, 2021 7:45 PM
> > To: devel@edk2.groups.io; Park, Aiden <aiden.park@intel.com>; Dong, Guo
> > <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>
> > Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory
> Service
> > conditions
> >
> > The EDKII UEFI bios flow is:
> > 1. platform PEI creates a default memory type information HOB 2. DXE CORE
> > reserves the memory according to the HOB for allocation 3. BDS checks
> whether
> > the pre-reserved memory meets the needs and saves the real needs to a NV
> > variable if the pre-reserved is not enough 4. Next time boot, platform PEI
> loads
> > the NV variable to create the memory type information HOB
> >
> > But this patch only creates a default HOB and don't provides a mechanism to
> > consume the NV and create the HOB.
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Park,
> > > Aiden
> > > Sent: Friday, January 29, 2021 10:00 AM
> > > To: Dong, Guo <guo.dong@intel.com>; Ma, Maurice
> > > <maurice.ma@intel.com>; devel@edk2.groups.io
> > > Cc: Park, Aiden <aiden.park@intel.com>
> > > Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory
> > > Service conditions
> > >
> > > From: Aiden Park <aiden.park@intel.com>
> > >
> > > The CoreInitializeMemoryServices() looks for a suitable memory region
> > > for EFI Memory Service from the ResourceDescriptor Hob.
> > > This patch does not allow legacy memory region for the Memory Service
> > > and provides default memory type information to calculate minimal
> > > required memory size properly for the Memory Service.
> > >
> > > Signed-off-by: Aiden Park <aiden.park@intel.com>
> > > ---
> > >  .../UefiPayloadEntry/UefiPayloadEntry.c       | 20 +++++++++++++++++++
> > >  .../UefiPayloadEntry/UefiPayloadEntry.inf     |  5 +++++
> > >  2 files changed, 25 insertions(+)
> > >
> > > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > > index 805f5448d9..d2e6f962cd 100644
> > > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> > > @@ -6,6 +6,16 @@
> > >  **/
> > >
> > >  #include "UefiPayloadEntry.h"
> > > +#include <Guid/MemoryTypeInformation.h>
> > > +
> > > +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =
> {
> > > +  { EfiACPIReclaimMemory,   FixedPcdGet32
> > (PcdMemoryTypeEfiACPIReclaimMemory) },
> > > +  { EfiACPIMemoryNVS,       FixedPcdGet32
> > (PcdMemoryTypeEfiACPIMemoryNVS) },
> > > +  { EfiReservedMemoryType,  FixedPcdGet32
> > > +(PcdMemoryTypeEfiReservedMemoryType) },
> > > +  { EfiRuntimeServicesData, FixedPcdGet32
> > > +(PcdMemoryTypeEfiRuntimeServicesData) },
> > > +  { EfiRuntimeServicesCode, FixedPcdGet32
> > (PcdMemoryTypeEfiRuntimeServicesCode) },
> > > +  { EfiMaxMemoryType,       0     }
> > > +};
> > >
> > >  /**
> > >     Callback function to build resource descriptor HOB @@ -44,6 +54,9
> > > @@ MemInfoCallback (
> > >      // Remove tested attribute to avoid DXE core to dispatch driver to
> memory
> > above 4GB
> > >      Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
> > >    }
> > > +  if (Base == 0x00) {
> > > +    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;  }
> > >
> > >    BuildResourceDescriptorHob (Type, Attribue,
> (EFI_PHYSICAL_ADDRESS)Base,
> > Size);
> > >    DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type =
> > > 0x%x\n", Base, Size, Type)); @@ -315,6 +328,13 @@ BuildGenericHob (
> > >    UINT8                            PhysicalAddressBits;
> > >    EFI_RESOURCE_ATTRIBUTE_TYPE      ResourceAttribute;
> > >
> > > +  //
> > > +  // Create Memory Type Information HOB  //  BuildGuidDataHob
> > > + (&gEfiMemoryTypeInformationGuid,
> > > +                    mDefaultMemoryTypeInformation,
> > > +                    sizeof (mDefaultMemoryTypeInformation));
> > > +
> > >    // The UEFI payload FV
> > >    BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32
> > > (PcdPayloadFdMemSize), EfiBootServicesData);
> > >
> > > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > > index cc59f1903b..5cb084ca51 100644
> > > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> > > @@ -86,6 +86,11 @@
> > >    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
> > >    gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
> > >    gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
> > > +
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
> > > +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
> > > +
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
> > > +
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
> > > +
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
> > >
> > >    gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack               ##
> > SOMETIMES_CONSUMES
> > >    gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ##
> > > SOMETIMES_CONSUMES
> > > --
> > > 2.20.1
> > >
> > >
> > >
> > >
> > >
> 
> Best Regards,
> Aiden
> 
> 
> 
> 


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

end of thread, other threads:[~2021-01-31  4:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-29  1:59 [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions Park, Aiden
2021-01-29  3:45 ` [edk2-devel] " Ni, Ray
2021-01-29 21:08   ` Park, Aiden
2021-01-31  4:19     ` Benjamin You

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