Description, Status codes returned – Intel Extensible Firmware Interface User Manual
Page 121

Services — Boot Services
Version 1.10
12/01/02
5-23
Description
The
AllocatePages()
function allocates the requested number of pages and returns a pointer
to the base address of the page range in the location referenced by
Memory
. The function scans the
memory map to locate free pages. When it finds a physically contiguous block of pages that is
large enough and also satisfies the value of
Type
, it changes the memory map to indicate that the
pages are now of type
MemoryType
.
In general, EFI OS loaders and EFI applications should allocate memory (and pool) of type
EfiLoaderData
. Boot service drivers must allocate memory (and pool) of type
EfiBootServicesData
. Runtime drivers should allocate memory (and pool) of type
EfiRuntimeServicesData
(although such allocation can only be made during boot services
time).
Allocation requests of
Type AllocateAnyPages
allocate any available range of pages that
satisfies the request. On input, the address pointed to by
Memory
is ignored.
Allocation requests of
Type AllocateMaxAddress
allocate any available range of pages
whose uppermost address is less than or equal to the address pointed to by
Memory
on input.
Allocation requests of
Type AllocateAddress
allocate pages at the address pointed to by
Memory
on input.
Status Codes Returned
EFI_SUCCESS
The requested pages were allocated.
EFI_OUT_OF_RESOURCES
The pages could not be allocated.
EFI_INVALID_PARAMETER
Type
is not
AllocateAnyPages
or
AllocateMaxAddress
or
AllocateAddress
.
EFI_INVALID_PARAMETER
MemoryType
is in the range
EfiMaxMemoryType
..0x7FFFFFFF.
EFI_NOT_FOUND
The requested pages could not be found.