xref: /freebsd/sys/vm/vm_phys.h (revision a3870a1826f50ac9d8076f7f21738aa608a916fa)
111752d88SAlan Cox /*-
211752d88SAlan Cox  * Copyright (c) 2002-2006 Rice University
37bfda801SAlan Cox  * Copyright (c) 2007 Alan L. Cox <alc@cs.rice.edu>
411752d88SAlan Cox  * All rights reserved.
511752d88SAlan Cox  *
611752d88SAlan Cox  * This software was developed for the FreeBSD Project by Alan L. Cox,
711752d88SAlan Cox  * Olivier Crameri, Peter Druschel, Sitaram Iyer, and Juan Navarro.
811752d88SAlan Cox  *
911752d88SAlan Cox  * Redistribution and use in source and binary forms, with or without
1011752d88SAlan Cox  * modification, are permitted provided that the following conditions
1111752d88SAlan Cox  * are met:
1211752d88SAlan Cox  * 1. Redistributions of source code must retain the above copyright
1311752d88SAlan Cox  *    notice, this list of conditions and the following disclaimer.
1411752d88SAlan Cox  * 2. Redistributions in binary form must reproduce the above copyright
1511752d88SAlan Cox  *    notice, this list of conditions and the following disclaimer in the
1611752d88SAlan Cox  *    documentation and/or other materials provided with the distribution.
1711752d88SAlan Cox  *
1811752d88SAlan Cox  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1911752d88SAlan Cox  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2011752d88SAlan Cox  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2111752d88SAlan Cox  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
2211752d88SAlan Cox  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2311752d88SAlan Cox  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2411752d88SAlan Cox  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2511752d88SAlan Cox  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2611752d88SAlan Cox  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2711752d88SAlan Cox  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
2811752d88SAlan Cox  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2911752d88SAlan Cox  * POSSIBILITY OF SUCH DAMAGE.
3011752d88SAlan Cox  *
3111752d88SAlan Cox  * $FreeBSD$
3211752d88SAlan Cox  */
3311752d88SAlan Cox 
3411752d88SAlan Cox /*
3511752d88SAlan Cox  *	Physical memory system definitions
3611752d88SAlan Cox  */
3711752d88SAlan Cox 
3811752d88SAlan Cox #ifndef	_VM_PHYS_H_
3911752d88SAlan Cox #define	_VM_PHYS_H_
4011752d88SAlan Cox 
41e35395ceSAlan Cox #ifdef _KERNEL
42e35395ceSAlan Cox 
43*a3870a18SJohn Baldwin /* Domains must be dense (non-sparse) and zero-based. */
44*a3870a18SJohn Baldwin struct mem_affinity {
45*a3870a18SJohn Baldwin 	vm_paddr_t start;
46*a3870a18SJohn Baldwin 	vm_paddr_t end;
47*a3870a18SJohn Baldwin 	int domain;
48*a3870a18SJohn Baldwin };
49*a3870a18SJohn Baldwin 
50*a3870a18SJohn Baldwin extern struct mem_affinity *mem_affinity;
51*a3870a18SJohn Baldwin 
5211752d88SAlan Cox void vm_phys_add_page(vm_paddr_t pa);
5311752d88SAlan Cox vm_page_t vm_phys_alloc_contig(unsigned long npages,
5411752d88SAlan Cox     vm_paddr_t low, vm_paddr_t high,
553153e878SAlan Cox     unsigned long alignment, unsigned long boundary);
5649ca10d4SJayachandran C. vm_page_t vm_phys_alloc_freelist_pages(int flind, int pool, int order);
5711752d88SAlan Cox vm_page_t vm_phys_alloc_pages(int pool, int order);
5811752d88SAlan Cox vm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment);
5911752d88SAlan Cox void vm_phys_free_pages(vm_page_t m, int order);
6011752d88SAlan Cox void vm_phys_init(void);
617bfda801SAlan Cox void vm_phys_set_pool(int pool, vm_page_t m, int order);
62e35395ceSAlan Cox boolean_t vm_phys_unfree_page(vm_page_t m);
6311752d88SAlan Cox boolean_t vm_phys_zero_pages_idle(void);
6411752d88SAlan Cox 
65e35395ceSAlan Cox #endif	/* _KERNEL */
6611752d88SAlan Cox #endif	/* !_VM_PHYS_H_ */
67