// SPDX-License-Identifier: GPL-2.0 #include <linux/efi.h> #include <asm/efi.h> #include "efistub.h" /** * efi_low_alloc_above() - allocate pages at or above given address * @size: size of the memory area to allocate * @align: minimum alignment of the allocated memory area. It should * a power of two. * @addr: on exit the address of the allocated memory * @min: minimum address to used for the memory allocation * * 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 */ efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align, unsigned long *addr, unsigned long min) { … } /** * efi_relocate_kernel() - copy memory area * @image_addr: pointer to address of memory area to copy * @image_size: size of memory area to copy * @alloc_size: minimum size of memory to allocate, must be greater or * equal to image_size * @preferred_addr: preferred target address * @alignment: minimum alignment of the allocated memory area. It * should be a power of two. * @min_addr: minimum target address * * 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 */ 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) { … }