blob: 8b158f591d75a17c44fbf8c3dc95e4a937342577 [file] [log] [blame]
Paolo Bonziniefd8e5a2017-10-22 15:19:32 +02001#ifndef VMALLOC_H
2#define VMALLOC_H 1
3
Paolo Bonzinidcda2152017-10-23 15:00:53 +02004#include <asm/page.h>
5
Claudio Imbrendadee42232020-06-22 18:21:38 +02006/* Allocate consecutive virtual pages (without backing) */
Paolo Bonziniefd8e5a2017-10-22 15:19:32 +02007extern void *alloc_vpages(ulong nr);
Claudio Imbrenda0d622fc2020-07-06 18:43:24 +02008/* Allocate consecutive and aligned virtual pages (without backing) */
9extern void *alloc_vpages_aligned(ulong nr, unsigned int alignment_order);
10
Claudio Imbrendadee42232020-06-22 18:21:38 +020011/* Allocate one virtual page (without backing) */
Paolo Bonziniefd8e5a2017-10-22 15:19:32 +020012extern void *alloc_vpage(void);
Claudio Imbrendadee42232020-06-22 18:21:38 +020013/* Set the top of the virtual address space */
Paolo Bonziniefd8e5a2017-10-22 15:19:32 +020014extern void init_alloc_vpage(void *top);
Claudio Imbrendadee42232020-06-22 18:21:38 +020015/* Set up the virtual allocator; also sets up the page allocator if needed */
Thomas Huthda7eceb2018-04-03 10:10:52 +020016extern void setup_vm(void);
Paolo Bonzini937e2392017-10-23 04:13:30 +020017
Claudio Imbrendadee42232020-06-22 18:21:38 +020018/* Set up paging */
Paolo Bonzini937e2392017-10-23 04:13:30 +020019extern void *setup_mmu(phys_addr_t top);
Claudio Imbrendadee42232020-06-22 18:21:38 +020020/* Walk the page table and resolve the virtual address to a physical address */
Paolo Bonzinic41e0322017-10-23 13:03:16 +020021extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt);
Claudio Imbrendadee42232020-06-22 18:21:38 +020022/* Map the virtual address to the physical address for the given page tables */
Paolo Bonzinidcda2152017-10-23 15:00:53 +020023extern pteval_t *install_page(pgd_t *pgtable, phys_addr_t phys, void *virt);
24
Claudio Imbrendadee42232020-06-22 18:21:38 +020025/* Map consecutive physical pages */
Paolo Bonzinidcda2152017-10-23 15:00:53 +020026void *vmap(phys_addr_t phys, size_t size);
Paolo Bonziniefd8e5a2017-10-22 15:19:32 +020027
28#endif