UEFI Support¶
UEFI stub library functions¶
-
efi_status_t
efi_get_memory_map
(struct efi_boot_memmap * map)¶ get memory map
Parameters
struct efi_boot_memmap * map
- on return pointer to memory map
Description
Retrieve the UEFI memory map. The allocated memory leaves room for up to EFI_MMAP_NR_SLACK_SLOTS additional memory map entries.
Return
status code
-
efi_status_t
efi_allocate_pages
(unsigned long size, unsigned long * addr, unsigned long max)¶ Allocate memory pages
Parameters
unsigned long size
- minimum number of bytes to allocate
unsigned long * addr
- On return the address of the first allocated page. The first allocated page has alignment EFI_ALLOC_ALIGN which is an architecture dependent multiple of the page size.
unsigned long max
- the address that the last allocated memory page shall not exceed
Description
Allocate pages as EFI_LOADER_DATA. The allocated pages are aligned according to EFI_ALLOC_ALIGN. The last allocated page will not exceed the address given by max.
Return
status code
-
efi_status_t
efi_low_alloc_above
(unsigned long size, unsigned long align, unsigned long * addr, unsigned long min)¶ allocate pages at or above given address
Parameters
unsigned long size
- size of the memory area to allocate
unsigned long align
- minimum alignment of the allocated memory area. It should a power of two.
unsigned long * addr
- on exit the address of the allocated memory
unsigned long min
- minimum address to used for the memory allocation
Description
Allocate at the lowest possible address that is not below min as EFI_LOADER_DATA. The allocated pages are aligned according to align but at least EFI_ALLOC_ALIGN. The first allocated page will not below the address given by min.
Return
status code
-
void
efi_free
(unsigned long size, unsigned long addr)¶ free memory pages
Parameters
unsigned long size
- size of the memory area to free in bytes
unsigned long addr
- start of the memory area to free (must be EFI_PAGE_SIZE aligned)
Description
size is rounded up to a multiple of EFI_ALLOC_ALIGN which is an
architecture specific multiple of EFI_PAGE_SIZE. So this function should
only be used to return pages allocated with efi_allocate_pages()
or
efi_low_alloc_above()
.
-
efi_status_t
efi_relocate_kernel
(unsigned long * image_addr, unsigned long image_size, unsigned long alloc_size, unsigned long preferred_addr, unsigned long alignment, unsigned long min_addr)¶ copy memory area
Parameters
unsigned long * image_addr
- pointer to address of memory area to copy
unsigned long image_size
- size of memory area to copy
unsigned long alloc_size
- minimum size of memory to allocate, must be greater or equal to image_size
unsigned long preferred_addr
- preferred target address
unsigned long alignment
- minimum alignment of the allocated memory area. It should be a power of two.
unsigned long min_addr
- minimum target address
Description
Copy a memory area to a newly allocated memory area aligned according to alignment but at least EFI_ALLOC_ALIGN. If the preferred address is not available, the allocated address will not be below min_addr. On exit, image_addr is updated to the target copy address that was used.
This function is used to copy the Linux kernel verbatim. It does not apply any relocation changes.
Return
status code