[edk2-devel] [PATCH] UefiPayloadPkg: Add memory type information HOB
Ma, Maurice
maurice.ma at intel.com
Tue Jan 5 19:51:52 UTC 2021
Reviewed-by: Maurice Ma <maurice.ma at intel.com>
Regards
Maurice
> -----Original Message-----
> From: Guo Dong <guo.dong at intel.com>
> Sent: Thursday, December 24, 2020 12:56
> To: devel at edk2.groups.io
> Cc: Dong, Eric <eric.dong at intel.com>; Ma, Maurice <maurice.ma at intel.com>;
> You, Benjamin <benjamin.you at intel.com>;
> philipp.deppenwiese at 9elements.com
> Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Add memory type information
> HOB
>
> To avoid DXE drivers to be dispatched to memory above 4GB, this patch build
> memory type information HOB in payload entry module.
>
> Signed-off-by: Guo Dong <guo.dong at intel.com>
> ---
> UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 23
> ++++++++++++++++++-----
> UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 1 +
> UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 5 +++++
> 3 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> index 805f5448d9..5d8b9d1464 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> @@ -7,6 +7,16 @@
>
> #include "UefiPayloadEntry.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
>
> @@ -40,11 +50,6 @@ MemInfoCallback (
> EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
> EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
>
> - if (Base >= BASE_4GB ) {
> - // Remove tested attribute to avoid DXE core to dispatch driver to memory
> above 4GB
> - 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));
>
> @@ -343,6 +348,14 @@ BuildGenericHob (
> BuildResourceDescriptorHob (EFI_RESOURCE_MEMORY_MAPPED_IO,
> ResourceAttribute, 0xFEC80000, SIZE_512KB);
> BuildMemoryAllocationHob ( 0xFEC80000, SIZE_512KB,
> EfiMemoryMappedIO);
>
> + //
> + // Create Memory Type Information HOB // BuildGuidDataHob (
> + &gEfiMemoryTypeInformationGuid,
> + mDefaultMemoryTypeInformation,
> + sizeof(mDefaultMemoryTypeInformation)
> + );
> }
>
>
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
> index 2c84d6ed53..57b03dffe9 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
> @@ -31,6 +31,7 @@
> #include <Guid/MemoryMapInfoGuid.h>
> #include <Guid/AcpiBoardInfoGuid.h>
> #include <Guid/GraphicsInfoHob.h>
> +#include <Guid/MemoryTypeInformation.h>
>
>
> #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 diff --git
> a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> index cc59f1903b..444d03b6d4 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> @@ -84,6 +84,11 @@
>
> gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
> gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
> + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
> + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
> + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
> + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
> + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
> gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
> gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
>
> --
> 2.16.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69746): https://edk2.groups.io/g/devel/message/69746
Mute This Topic: https://groups.io/mt/79209988/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list