CloudHv/arm: add PeiMemInfoLib

Memory layout in CLoud Hypervisor for arm is changed and is different
with Qemu, thus we should build its own PeiMemInfoLib.
The main change in the memory layout is that normal ram may not contiguous
under 4G. The top 64M under 4G is reserved for 32bit device.

What this patch does:
1. get all of the memory node from DT;
2. Init page table for each memory node;
3. Add all of the memory nodes to Hob;

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
Jianyong Wu
2022-09-06 15:39:20 +08:00
committed by mergify[bot]
parent 520ba8e306
commit dba79765c4
3 changed files with 332 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
## @file
# Cloud Hypervisor virtual memory map library.
#
# Copyright (c) 2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = CloudHvVirtMemInfoPeiLib
FILE_GUID = c7ada233-d35b-49c3-aa51-e2b5cd80c910
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = ArmVirtMemInfoLib|PEIM
CONSTRUCTOR = CloudHvVirtMemInfoPeiLibConstructor
[Sources]
CloudHvVirtMemInfoLib.c
CloudHvVirtMemInfoLib.h
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
[LibraryClasses]
ArmLib
BaseMemoryLib
DebugLib
FdtLib
MemoryAllocationLib
PcdLib
[Pcd]
gArmTokenSpaceGuid.PcdFdBaseAddress
gArmTokenSpaceGuid.PcdFvBaseAddress
gArmTokenSpaceGuid.PcdSystemMemoryBase
gArmTokenSpaceGuid.PcdSystemMemorySize
[FixedPcd]
gArmTokenSpaceGuid.PcdFdSize
gArmTokenSpaceGuid.PcdFvSize
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress