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 43a3870a18SJohn Baldwin /* Domains must be dense (non-sparse) and zero-based. */ 44a3870a18SJohn Baldwin struct mem_affinity { 45a3870a18SJohn Baldwin vm_paddr_t start; 46a3870a18SJohn Baldwin vm_paddr_t end; 47a3870a18SJohn Baldwin int domain; 48a3870a18SJohn Baldwin }; 49a3870a18SJohn Baldwin 50a3870a18SJohn Baldwin extern struct mem_affinity *mem_affinity; 51a3870a18SJohn Baldwin 52fbd80bd0SAlan Cox /* 53fbd80bd0SAlan Cox * The following functions are only to be used by the virtual memory system. 54fbd80bd0SAlan Cox */ 5511752d88SAlan Cox void vm_phys_add_page(vm_paddr_t pa); 565c1f2cc4SAlan Cox vm_page_t vm_phys_alloc_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, 575c1f2cc4SAlan Cox u_long alignment, vm_paddr_t boundary); 5849ca10d4SJayachandran C. vm_page_t vm_phys_alloc_freelist_pages(int flind, int pool, int order); 5911752d88SAlan Cox vm_page_t vm_phys_alloc_pages(int pool, int order); 60b6de32bdSKonstantin Belousov int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, 61b6de32bdSKonstantin Belousov vm_memattr_t memattr); 62b6de32bdSKonstantin Belousov void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); 63b6de32bdSKonstantin Belousov vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa); 645c1f2cc4SAlan Cox void vm_phys_free_contig(vm_page_t m, u_long npages); 6511752d88SAlan Cox void vm_phys_free_pages(vm_page_t m, int order); 6611752d88SAlan Cox void vm_phys_init(void); 67*43f48b65SKonstantin Belousov vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); 687bfda801SAlan Cox void vm_phys_set_pool(int pool, vm_page_t m, int order); 69e35395ceSAlan Cox boolean_t vm_phys_unfree_page(vm_page_t m); 7011752d88SAlan Cox boolean_t vm_phys_zero_pages_idle(void); 7111752d88SAlan Cox 72e35395ceSAlan Cox #endif /* _KERNEL */ 7311752d88SAlan Cox #endif /* !_VM_PHYS_H_ */ 74