// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2016 Linaro Ltd; <[email protected]> */ #include <linux/efi.h> #include <linux/log2.h> #include <asm/efi.h> #include "efistub.h" /* * Return the number of slots covered by this entry, i.e., the number of * addresses it covers that are suitably aligned and supply enough room * for the allocation. */ static unsigned long get_entry_num_slots(efi_memory_desc_t *md, unsigned long size, unsigned long align_shift, u64 alloc_min, u64 alloc_max) { … } /* * The UEFI memory descriptors have a virtual address field that is only used * when installing the virtual mapping using SetVirtualAddressMap(). Since it * is unused here, we can reuse it to keep track of each descriptor's slot * count. */ #define MD_NUM_SLOTS(md) … efi_status_t efi_random_alloc(unsigned long size, unsigned long align, unsigned long *addr, unsigned long random_seed, int memory_type, unsigned long alloc_min, unsigned long alloc_max) { … }