Lines Matching +full:time +full:- +full:slots
1 // SPDX-License-Identifier: GPL-2.0
13 * Return the number of slots covered by this entry, i.e., the number of
25 if (md->type != EFI_CONVENTIONAL_MEMORY) in get_entry_num_slots()
29 (md->attribute & EFI_MEMORY_SP)) in get_entry_num_slots()
32 region_end = min(md->phys_addr + md->num_pages * EFI_PAGE_SIZE - 1, in get_entry_num_slots()
37 first_slot = round_up(max(md->phys_addr, alloc_min), align); in get_entry_num_slots()
38 last_slot = round_down(region_end - size + 1, align); in get_entry_num_slots()
43 return ((unsigned long)(last_slot - first_slot) >> align_shift) + 1; in get_entry_num_slots()
52 #define MD_NUM_SLOTS(md) ((md)->virt_addr)
77 /* count the suitable slots in each memory map entry */ in efi_random_alloc()
78 for (map_offset = 0; map_offset < map->map_size; map_offset += map->desc_size) { in efi_random_alloc()
79 efi_memory_desc_t *md = (void *)map->map + map_offset; in efi_random_alloc()
80 unsigned long slots; in efi_random_alloc() local
82 slots = get_entry_num_slots(md, size, ilog2(align), alloc_min, in efi_random_alloc()
84 MD_NUM_SLOTS(md) = slots; in efi_random_alloc()
85 total_slots += slots; in efi_random_alloc()
86 if (md->attribute & EFI_MEMORY_MORE_RELIABLE) in efi_random_alloc()
87 total_mirrored_slots += slots; in efi_random_alloc()
90 /* consider only mirrored slots for randomization if any exist */ in efi_random_alloc()
99 * it corresponds with exactly one of the suitable slots we recorded in efi_random_alloc()
100 * when iterating over the memory map the first time around. in efi_random_alloc()
103 * slots of each entry at each iteration, until we have found the entry in efi_random_alloc()
109 for (map_offset = 0; map_offset < map->map_size; map_offset += map->desc_size) { in efi_random_alloc()
110 efi_memory_desc_t *md = (void *)map->map + map_offset; in efi_random_alloc()
115 !(md->attribute & EFI_MEMORY_MORE_RELIABLE)) in efi_random_alloc()
119 target_slot -= MD_NUM_SLOTS(md); in efi_random_alloc()
123 target = round_up(max_t(u64, md->phys_addr, alloc_min), align) + target_slot * align; in efi_random_alloc()