TianoCore EDK2 master
Loading...
Searching...
No Matches
Imem.h File Reference

Go to the source code of this file.

Data Structures

struct  MEMORY_MAP
 

Macros

#define MEMORY_MAP_SIGNATURE   SIGNATURE_32('m','m','a','p')
 

Functions

VOID * CoreAllocatePoolPages (IN EFI_MEMORY_TYPE PoolType, IN UINTN NumberOfPages, IN UINTN Alignment, IN BOOLEAN NeedGuard)
 
VOID CoreFreePoolPages (IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
 
VOID * CoreAllocatePoolI (IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, IN BOOLEAN NeedGuard)
 
EFI_STATUS CoreFreePoolI (IN VOID *Buffer, OUT EFI_MEMORY_TYPE *PoolType OPTIONAL)
 
VOID CoreAcquireMemoryLock (VOID)
 
VOID CoreReleaseMemoryLock (VOID)
 
EFI_STATUS EFIAPI CoreInternalAllocatePages (IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, IN OUT EFI_PHYSICAL_ADDRESS *Memory, IN BOOLEAN NeedGuard)
 

Variables

EFI_LOCK gMemoryLock
 
LIST_ENTRY gMemoryMap
 
LIST_ENTRY mGcdMemorySpaceMap
 

Detailed Description

Data structure and functions to allocate and free memory space.

Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Imem.h.

Macro Definition Documentation

◆ MEMORY_MAP_SIGNATURE

#define MEMORY_MAP_SIGNATURE   SIGNATURE_32('m','m','a','p')

Definition at line 16 of file Imem.h.

Function Documentation

◆ CoreAcquireMemoryLock()

VOID CoreAcquireMemoryLock ( VOID  )

Enter critical section by gaining lock on gMemoryLock.

Definition at line 103 of file Page.c.

◆ CoreAllocatePoolI()

VOID * CoreAllocatePoolI ( IN EFI_MEMORY_TYPE  PoolType,
IN UINTN  Size,
IN BOOLEAN  NeedGuard 
)

Internal function to allocate pool of a particular type. Caller must have the memory lock held

Parameters
PoolTypeType of pool to allocate
SizeThe amount of pool to allocate
NeedGuardFlag to indicate Guard page is needed or not
Returns
The allocate pool, or NULL

Definition at line 351 of file Pool.c.

◆ CoreAllocatePoolPages()

VOID * CoreAllocatePoolPages ( IN EFI_MEMORY_TYPE  PoolType,
IN UINTN  NumberOfPages,
IN UINTN  Alignment,
IN BOOLEAN  NeedGuard 
)

Internal function. Used by the pool functions to allocate pages to back pool allocation requests.

Parameters
PoolTypeThe type of memory for the new pool pages
NumberOfPagesNo of pages to allocate
AlignmentBits to align.
NeedGuardFlag to indicate Guard page is needed or not
Returns
The allocated memory, or NULL

Definition at line 2196 of file Page.c.

◆ CoreFreePoolI()

EFI_STATUS CoreFreePoolI ( IN VOID *  Buffer,
OUT EFI_MEMORY_TYPE *PoolType  OPTIONAL 
)

Internal function to free a pool entry. Caller must have the memory lock held

Parameters
BufferThe allocated pool entry to free
PoolTypePointer to pool type
Return values
EFI_INVALID_PARAMETERBuffer not valid
EFI_SUCCESSBuffer successfully freed.

Definition at line 691 of file Pool.c.

◆ CoreFreePoolPages()

VOID CoreFreePoolPages ( IN EFI_PHYSICAL_ADDRESS  Memory,
IN UINTN  NumberOfPages 
)

Internal function. Frees pool pages allocated via AllocatePoolPages ()

Parameters
MemoryThe base address to free
NumberOfPagesThe number of pages to free

Definition at line 2240 of file Page.c.

◆ CoreInternalAllocatePages()

EFI_STATUS EFIAPI CoreInternalAllocatePages ( IN EFI_ALLOCATE_TYPE  Type,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  NumberOfPages,
IN OUT EFI_PHYSICAL_ADDRESS Memory,
IN BOOLEAN  NeedGuard 
)

Allocates pages from the memory map.

Parameters
TypeThe type of allocation to perform
MemoryTypeThe type of memory to turn the allocated pages into
NumberOfPagesThe number of pages to allocate
MemoryA pointer to receive the base allocated memory address
NeedGuardFlag to indicate Guard page is needed or not
Returns
Status. On success, Memory is filled in with the base address allocated
Return values
EFI_INVALID_PARAMETERParameters violate checking rules defined in spec.
EFI_NOT_FOUNDCould not allocate pages match the requirement.
EFI_OUT_OF_RESOURCESNo enough pages to allocate.
EFI_SUCCESSPages successfully allocated.

Definition at line 1381 of file Page.c.

◆ CoreReleaseMemoryLock()

VOID CoreReleaseMemoryLock ( VOID  )

Exit critical section by releasing lock on gMemoryLock.

Definition at line 115 of file Page.c.

Variable Documentation

◆ gMemoryLock

EFI_LOCK gMemoryLock
extern

Definition at line 14 of file MemData.c.

◆ gMemoryMap

LIST_ENTRY gMemoryMap
extern

Definition at line 19 of file MemData.c.

◆ mGcdMemorySpaceMap

LIST_ENTRY mGcdMemorySpaceMap
extern

Definition at line 45 of file Gcd.c.