OvmfPkg/PlatformInitLib: Add hob functions
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3863 In this patch of PlatformInitLib, below hob functions are introduced: - PlatformAddIoMemoryBaseSizeHob - PlatformAddIoMemoryRangeHob - PlatformAddMemoryBaseSizeHob - PlatformAddMemoryRangeHob - PlatformAddReservedMemoryBaseSizeHob They correspond the below functions in OvmfPkg/PlatformPei: - AddIoMemoryBaseSizeHob - AddIoMemoryRangeHob - AddMemoryBaseSizeHob - AddMemoryRangeHob - AddReservedMemoryBaseSizeHob After above hob functions are introduced in PlatformInitLib, OvmfPkg/PlatformPei is refactored with this library. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
@@ -275,10 +275,10 @@ ScanOrAdd64BitE820Ram (
|
||||
End = (E820Entry.BaseAddr + E820Entry.Length) &
|
||||
~(UINT64)EFI_PAGE_MASK;
|
||||
if (Base < End) {
|
||||
AddMemoryRangeHob (Base, End);
|
||||
PlatformAddMemoryRangeHob (Base, End);
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: AddMemoryRangeHob [0x%Lx, 0x%Lx)\n",
|
||||
"%a: PlatformAddMemoryRangeHob [0x%Lx, 0x%Lx)\n",
|
||||
__FUNCTION__,
|
||||
Base,
|
||||
End
|
||||
@@ -816,8 +816,8 @@ QemuInitializeRamBelow1gb (
|
||||
)
|
||||
{
|
||||
if (FeaturePcdGet (PcdSmmSmramRequire) && mQ35SmramAtDefaultSmbase) {
|
||||
AddMemoryRangeHob (0, SMM_DEFAULT_SMBASE);
|
||||
AddReservedMemoryBaseSizeHob (
|
||||
PlatformAddMemoryRangeHob (0, SMM_DEFAULT_SMBASE);
|
||||
PlatformAddReservedMemoryBaseSizeHob (
|
||||
SMM_DEFAULT_SMBASE,
|
||||
MCH_DEFAULT_SMBASE_SIZE,
|
||||
TRUE /* Cacheable */
|
||||
@@ -826,12 +826,12 @@ QemuInitializeRamBelow1gb (
|
||||
SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE < BASE_512KB + BASE_128KB,
|
||||
"end of SMRAM at default SMBASE ends at, or exceeds, 640KB"
|
||||
);
|
||||
AddMemoryRangeHob (
|
||||
PlatformAddMemoryRangeHob (
|
||||
SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE,
|
||||
BASE_512KB + BASE_128KB
|
||||
);
|
||||
} else {
|
||||
AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
|
||||
PlatformAddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -889,14 +889,14 @@ QemuInitializeRam (
|
||||
UINT32 TsegSize;
|
||||
|
||||
TsegSize = mQ35TsegMbytes * SIZE_1MB;
|
||||
AddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
|
||||
AddReservedMemoryBaseSizeHob (
|
||||
PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
|
||||
PlatformAddReservedMemoryBaseSizeHob (
|
||||
LowerMemorySize - TsegSize,
|
||||
TsegSize,
|
||||
TRUE
|
||||
);
|
||||
} else {
|
||||
AddMemoryRangeHob (BASE_1MB, LowerMemorySize);
|
||||
PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -908,7 +908,7 @@ QemuInitializeRam (
|
||||
if (EFI_ERROR (Status)) {
|
||||
UpperMemorySize = GetSystemMemorySizeAbove4gb ();
|
||||
if (UpperMemorySize != 0) {
|
||||
AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
|
||||
PlatformAddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user