• Home
  • Raw
  • Download

Lines Matching +full:existing +full:- +full:parts

1 // SPDX-License-Identifier: GPL-2.0
55 * efi_memmap_alloc - Allocate memory for the EFI memory map
69 WARN_ON(data->phys_map || data->size); in efi_memmap_alloc()
71 data->size = num_entries * efi.memmap.desc_size; in efi_memmap_alloc()
72 data->desc_version = efi.memmap.desc_version; in efi_memmap_alloc()
73 data->desc_size = efi.memmap.desc_size; in efi_memmap_alloc()
74 data->flags &= ~(EFI_MEMMAP_SLAB | EFI_MEMMAP_MEMBLOCK); in efi_memmap_alloc()
75 data->flags |= efi.memmap.flags & EFI_MEMMAP_LATE; in efi_memmap_alloc()
78 data->flags |= EFI_MEMMAP_SLAB; in efi_memmap_alloc()
79 data->phys_map = __efi_memmap_alloc_late(data->size); in efi_memmap_alloc()
81 data->flags |= EFI_MEMMAP_MEMBLOCK; in efi_memmap_alloc()
82 data->phys_map = __efi_memmap_alloc_early(data->size); in efi_memmap_alloc()
85 if (!data->phys_map) in efi_memmap_alloc()
86 return -ENOMEM; in efi_memmap_alloc()
91 * __efi_memmap_init - Common code for mapping the EFI memory map
98 * During bootup EFI_MEMMAP_LATE in data->flags should be clear since we
113 phys_map = data->phys_map; in __efi_memmap_init()
115 if (data->flags & EFI_MEMMAP_LATE) in __efi_memmap_init()
116 map.map = memremap(phys_map, data->size, MEMREMAP_WB); in __efi_memmap_init()
118 map.map = early_memremap(phys_map, data->size); in __efi_memmap_init()
122 return -ENOMEM; in __efi_memmap_init()
125 /* NOP if data->flags & (EFI_MEMMAP_MEMBLOCK | EFI_MEMMAP_SLAB) == 0 */ in __efi_memmap_init()
128 map.phys_map = data->phys_map; in __efi_memmap_init()
129 map.nr_map = data->size / data->desc_size; in __efi_memmap_init()
130 map.map_end = map.map + data->size; in __efi_memmap_init()
132 map.desc_version = data->desc_version; in __efi_memmap_init()
133 map.desc_size = data->desc_size; in __efi_memmap_init()
134 map.flags = data->flags; in __efi_memmap_init()
144 * efi_memmap_init_early - Map the EFI memory map data structure
155 data->flags = 0; in efi_memmap_init_early()
178 * efi_memmap_init_late - Map efi.memmap with memremap()
217 * existing early EFI memmap. in efi_memmap_init_late()
226 * efi_memmap_install - Install a new EFI memory map in efi.memmap
230 * to switch from early to late mappings. It simply uses the existing
243 * efi_memmap_split_count - Count number of additional EFI memmap entries
256 start = md->phys_addr; in efi_memmap_split_count()
257 end = start + (md->num_pages << EFI_PAGE_SHIFT) - 1; in efi_memmap_split_count()
260 m_start = range->start; in efi_memmap_split_count()
261 m_end = range->end; in efi_memmap_split_count()
264 /* split into 2 parts */ in efi_memmap_split_count()
270 /* split into 3 parts */ in efi_memmap_split_count()
273 /* split into 2 parts */ in efi_memmap_split_count()
282 * efi_memmap_insert - Insert a memory region in an EFI memmap
283 * @old_memmap: The existing EFI memory map structure
299 m_start = mem->range.start; in efi_memmap_insert()
300 m_end = mem->range.end; in efi_memmap_insert()
301 m_attr = mem->attribute; in efi_memmap_insert()
314 for (old = old_memmap->map, new = buf; in efi_memmap_insert()
315 old < old_memmap->map_end; in efi_memmap_insert()
316 old += old_memmap->desc_size, new += old_memmap->desc_size) { in efi_memmap_insert()
319 memcpy(new, old, old_memmap->desc_size); in efi_memmap_insert()
321 start = md->phys_addr; in efi_memmap_insert()
322 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1; in efi_memmap_insert()
325 md->attribute |= m_attr; in efi_memmap_insert()
330 md->attribute |= m_attr; in efi_memmap_insert()
331 md->num_pages = (m_end - md->phys_addr + 1) >> in efi_memmap_insert()
334 new += old_memmap->desc_size; in efi_memmap_insert()
335 memcpy(new, old, old_memmap->desc_size); in efi_memmap_insert()
337 md->phys_addr = m_end + 1; in efi_memmap_insert()
338 md->num_pages = (end - md->phys_addr + 1) >> in efi_memmap_insert()
344 md->num_pages = (m_start - md->phys_addr) >> in efi_memmap_insert()
347 new += old_memmap->desc_size; in efi_memmap_insert()
348 memcpy(new, old, old_memmap->desc_size); in efi_memmap_insert()
350 md->attribute |= m_attr; in efi_memmap_insert()
351 md->phys_addr = m_start; in efi_memmap_insert()
352 md->num_pages = (m_end - m_start + 1) >> in efi_memmap_insert()
355 new += old_memmap->desc_size; in efi_memmap_insert()
356 memcpy(new, old, old_memmap->desc_size); in efi_memmap_insert()
358 md->phys_addr = m_end + 1; in efi_memmap_insert()
359 md->num_pages = (end - m_end) >> in efi_memmap_insert()
366 md->num_pages = (m_start - md->phys_addr) >> in efi_memmap_insert()
369 new += old_memmap->desc_size; in efi_memmap_insert()
370 memcpy(new, old, old_memmap->desc_size); in efi_memmap_insert()
372 md->phys_addr = m_start; in efi_memmap_insert()
373 md->num_pages = (end - md->phys_addr + 1) >> in efi_memmap_insert()
375 md->attribute |= m_attr; in efi_memmap_insert()