mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
efi: Add tracking for dynamically allocated memmaps
In preparation for fixing efi_memmap_alloc() leaks, add support for recording whether the memmap was dynamically allocated from slab, memblock, or is the original physical memmap provided by the platform. Given this tracking is established in efi_memmap_alloc() and needs to be carried to efi_memmap_install(), use 'struct efi_memory_map_data' to convey the flags. Some small cleanups result from this reorganization, specifically the removal of local variables for 'phys' and 'size' that are already tracked in @data. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20200113172245.27925-12-ardb@kernel.org
This commit is contained in:
parent
26c0e44a21
commit
1db91035d0
5 changed files with 55 additions and 48 deletions
|
@ -759,8 +759,8 @@ typedef union {
|
|||
|
||||
/*
|
||||
* Architecture independent structure for describing a memory map for the
|
||||
* benefit of efi_memmap_init_early(), saving us the need to pass four
|
||||
* parameters.
|
||||
* benefit of efi_memmap_init_early(), and for passing context between
|
||||
* efi_memmap_alloc() and efi_memmap_install().
|
||||
*/
|
||||
struct efi_memory_map_data {
|
||||
phys_addr_t phys_map;
|
||||
|
@ -778,6 +778,8 @@ struct efi_memory_map {
|
|||
unsigned long desc_version;
|
||||
unsigned long desc_size;
|
||||
#define EFI_MEMMAP_LATE (1UL << 0)
|
||||
#define EFI_MEMMAP_MEMBLOCK (1UL << 1)
|
||||
#define EFI_MEMMAP_SLAB (1UL << 2)
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
|
@ -972,11 +974,12 @@ static inline efi_status_t efi_query_variable_store(u32 attributes,
|
|||
#endif
|
||||
extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
|
||||
|
||||
extern phys_addr_t __init efi_memmap_alloc(unsigned int num_entries);
|
||||
extern int __init efi_memmap_alloc(unsigned int num_entries,
|
||||
struct efi_memory_map_data *data);
|
||||
extern int __init efi_memmap_init_early(struct efi_memory_map_data *data);
|
||||
extern int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size);
|
||||
extern void __init efi_memmap_unmap(void);
|
||||
extern int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map);
|
||||
extern int __init efi_memmap_install(struct efi_memory_map_data *data);
|
||||
extern int __init efi_memmap_split_count(efi_memory_desc_t *md,
|
||||
struct range *range);
|
||||
extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue