TianoCore EDK2 master
Loading...
Searching...
No Matches
Memory.c File Reference
#include <PiPei.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/ResourcePublicationLib.h>
#include <Library/BaseRiscVSbiLib.h>
#include <Register/RiscV64/RiscVEncoding.h>
#include <Library/PrePiLib.h>
#include <libfdt.h>
#include <Guid/FdtHob.h>

Go to the source code of this file.

Functions

VOID BuildMemoryTypeInformationHob (VOID)
 
STATIC VOID AddMemoryBaseSizeHob (IN EFI_PHYSICAL_ADDRESS MemoryBase, IN UINT64 MemorySize)
 
STATIC VOID AddMemoryRangeHob (IN EFI_PHYSICAL_ADDRESS MemoryBase, IN EFI_PHYSICAL_ADDRESS MemoryLimit)
 
STATIC VOID InitializeRamRegions (IN EFI_PHYSICAL_ADDRESS SystemMemoryBase, IN UINT64 SystemMemorySize)
 
STATIC INT32 GetNumCells (IN VOID *Fdt, IN INT32 Node, IN CONST CHAR8 *Name)
 
STATIC VOID AddReservedMemoryMap (IN VOID *FdtPointer)
 
EFI_STATUS MemoryPeimInitialization (VOID)
 

Detailed Description

Memory Detection for Virtual Machines.

Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Module Name:

MemDetect.c

Definition in file Memory.c.

Function Documentation

◆ AddMemoryBaseSizeHob()

STATIC VOID AddMemoryBaseSizeHob ( IN EFI_PHYSICAL_ADDRESS  MemoryBase,
IN UINT64  MemorySize 
)

Create memory range resource HOB using the memory base address and size.

Parameters
MemoryBaseMemory range base address.
MemorySizeMemory range size.

Definition at line 50 of file Memory.c.

◆ AddMemoryRangeHob()

STATIC VOID AddMemoryRangeHob ( IN EFI_PHYSICAL_ADDRESS  MemoryBase,
IN EFI_PHYSICAL_ADDRESS  MemoryLimit 
)

Create memory range resource HOB using memory base address and top address of the memory range.

Parameters
MemoryBaseMemory range base address.
MemoryLimitMemory range size.

Definition at line 79 of file Memory.c.

◆ AddReservedMemoryMap()

STATIC VOID AddReservedMemoryMap ( IN VOID *  FdtPointer)

Mark reserved memory ranges in the EFI memory map

As per DT spec v0.4 Section 3.5.4, "Reserved regions with the no-map property must be listed in the memory map with type EfiReservedMemoryType. All other reserved regions must be listed with type EfiBootServicesData."

Parameters
FdtPointerPointer to FDT

Definition at line 153 of file Memory.c.

◆ BuildMemoryTypeInformationHob()

VOID BuildMemoryTypeInformationHob ( VOID  )

Populate and install the memory type information HOB.

Build the memory type information HOB that describes how many pages of each type to preallocate when initializing the GCD memory map.

Definition at line 36 of file MemoryInitPeim.c.

◆ GetNumCells()

STATIC INT32 GetNumCells ( IN VOID *  Fdt,
IN INT32  Node,
IN CONST CHAR8 *  Name 
)

Get the number of cells for a given property

Parameters
[in]FdtPointer to Device Tree (DTB)
[in]NodeNode
[in]NameName of the property
Returns
Number of cells.

Definition at line 114 of file Memory.c.

◆ InitializeRamRegions()

STATIC VOID InitializeRamRegions ( IN EFI_PHYSICAL_ADDRESS  SystemMemoryBase,
IN UINT64  SystemMemorySize 
)

Publish system RAM and reserve memory regions.

Definition at line 93 of file Memory.c.

◆ MemoryPeimInitialization()

EFI_STATUS MemoryPeimInitialization ( VOID  )

Initialize memory hob based on the DTB information.

Returns
EFI_SUCCESS The memory hob added successfully.

Definition at line 244 of file Memory.c.