MemoryType information assists GCD with defragmenting the memory map.
When the DXE core starts, GCD adds memory descriptors for the resource
descriptors HOBs. This allocates heap space which can be reused later
as the bins by memory type. It seems memory allocation prefers low
ranges.
It seems "below 4G" is an artifact of this heap reuse. However, the
memory type information determines the DXE core's
`MinimalMemorySizeNeeded`, determining which system memory descriptor
HOB may be used by DXE. Furthermore, it's important that the memory
type information be correct, for an S4 memory map.
Therefore, follow other bootloaders, such as [MinPlatform][1], and do
this unconditionally. As of [edk2-stable202011][2], it was.
[1]: b6f9674389/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c (L164-L201)
[2]: https://github.com/tianocore/edk2/blob/edk2-stable202011/UefiPayloadPkg/BlSupportPei/BlSupportPei.c#L462-L466
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
99 lines
3.1 KiB
INI
99 lines
3.1 KiB
INI
## @file
|
|
# This is the first module for UEFI payload.
|
|
#
|
|
# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
|
|
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = PayloadEntry
|
|
FILE_GUID = 2119BBD7-9432-4f47-B5E2-5C4EA31B6BDC
|
|
MODULE_TYPE = SEC
|
|
VERSION_STRING = 1.0
|
|
|
|
#
|
|
# The following information is for reference only and not required by the build tools.
|
|
#
|
|
# VALID_ARCHITECTURES = IA32 X64
|
|
#
|
|
|
|
[Sources]
|
|
UefiPayloadEntry.c
|
|
LoadDxeCore.c
|
|
MemoryAllocation.c
|
|
AcpiTable.c
|
|
|
|
[Sources.Ia32]
|
|
X64/VirtualMemory.h
|
|
X64/VirtualMemory.c
|
|
Ia32/DxeLoadFunc.c
|
|
Ia32/IdtVectorAsm.nasm
|
|
|
|
[Sources.X64]
|
|
X64/VirtualMemory.h
|
|
X64/VirtualMemory.c
|
|
X64/DxeLoadFunc.c
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
UefiCpuPkg/UefiCpuPkg.dec
|
|
UefiPayloadPkg/UefiPayloadPkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseMemoryLib
|
|
DebugLib
|
|
BaseLib
|
|
SerialPortLib
|
|
IoLib
|
|
BlParseLib
|
|
HobLib
|
|
PeCoffLib
|
|
PlatformSupportLib
|
|
CpuLib
|
|
|
|
[Guids]
|
|
gEfiMemoryTypeInformationGuid
|
|
gEfiFirmwareFileSystem2Guid
|
|
gEfiGraphicsInfoHobGuid
|
|
gEfiGraphicsDeviceInfoHobGuid
|
|
gUefiAcpiBoardInfoGuid
|
|
gUniversalPayloadSmbiosTableGuid
|
|
gUniversalPayloadAcpiTableGuid
|
|
gUniversalPayloadSerialPortInfoGuid
|
|
|
|
[FeaturePcd.IA32]
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
|
|
|
|
[FeaturePcd.X64]
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables ## CONSUMES
|
|
|
|
|
|
[Pcd.IA32,Pcd.X64]
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize ## CONSUMES
|
|
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
|
|
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIMES_CONSUMES
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy ## SOMETIMES_CONSUMES
|
|
|