1*ae115bc7Smrj /* 2*ae115bc7Smrj * CDDL HEADER START 3*ae115bc7Smrj * 4*ae115bc7Smrj * The contents of this file are subject to the terms of the 5*ae115bc7Smrj * Common Development and Distribution License, Version 1.0 only 6*ae115bc7Smrj * (the "License"). You may not use this file except in compliance 7*ae115bc7Smrj * with the License. 8*ae115bc7Smrj * 9*ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*ae115bc7Smrj * or http://www.opensolaris.org/os/licensing. 11*ae115bc7Smrj * See the License for the specific language governing permissions 12*ae115bc7Smrj * and limitations under the License. 13*ae115bc7Smrj * 14*ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each 15*ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the 17*ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying 18*ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner] 19*ae115bc7Smrj * 20*ae115bc7Smrj * CDDL HEADER END 21*ae115bc7Smrj */ 22*ae115bc7Smrj /* 23*ae115bc7Smrj * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*ae115bc7Smrj * Use is subject to license terms. 25*ae115bc7Smrj */ 26*ae115bc7Smrj 27*ae115bc7Smrj #ifndef _SYS_PMEM_H 28*ae115bc7Smrj #define _SYS_PMEM_H 29*ae115bc7Smrj 30*ae115bc7Smrj #ifdef __cplusplus 31*ae115bc7Smrj extern "C" { 32*ae115bc7Smrj #endif 33*ae115bc7Smrj 34*ae115bc7Smrj /* 35*ae115bc7Smrj * PMEM - Direct mapping physical memory pages to userland process 36*ae115bc7Smrj * 37*ae115bc7Smrj * Provide consolidation private functions used for directly (w/o occupying 38*ae115bc7Smrj * kernel virtual address space) allocating and exporting physical memory pages 39*ae115bc7Smrj * to userland. 40*ae115bc7Smrj */ 41*ae115bc7Smrj 42*ae115bc7Smrj /* 43*ae115bc7Smrj * Flags to pass to pmem_alloc 44*ae115bc7Smrj */ 45*ae115bc7Smrj #define PMEM_SLEEP 0x1 46*ae115bc7Smrj #define PMEM_NOSLEEP 0x2 47*ae115bc7Smrj 48*ae115bc7Smrj /* 49*ae115bc7Smrj * Called by driver devmap routine to pass physical memory mapping info to 50*ae115bc7Smrj * seg_dev framework, used only for physical memory allocated from 51*ae115bc7Smrj * devmap_pmem_alloc(). 52*ae115bc7Smrj */ 53*ae115bc7Smrj int devmap_pmem_setup(devmap_cookie_t, dev_info_t *dip, 54*ae115bc7Smrj struct devmap_callback_ctl *, devmap_pmem_cookie_t, offset_t, 55*ae115bc7Smrj size_t, uint_t, uint_t, ddi_device_acc_attr_t *); 56*ae115bc7Smrj 57*ae115bc7Smrj /* 58*ae115bc7Smrj * Replace existing mapping using a new cookie, mainly gets called when doing 59*ae115bc7Smrj * fork(). Should be called in pertinent devmap_dup(9E). 60*ae115bc7Smrj */ 61*ae115bc7Smrj int devmap_pmem_remap(devmap_cookie_t, dev_info_t *dip, 62*ae115bc7Smrj devmap_pmem_cookie_t, offset_t, size_t, uint_t, uint_t, 63*ae115bc7Smrj ddi_device_acc_attr_t *); 64*ae115bc7Smrj 65*ae115bc7Smrj /* 66*ae115bc7Smrj * Directly (i.e., without occupying kernel virtual address space) allocate 67*ae115bc7Smrj * 'npages' physical memory pages for exporting to user land. The allocated 68*ae115bc7Smrj * page_t pointer will be recorded in cookie. 69*ae115bc7Smrj */ 70*ae115bc7Smrj int devmap_pmem_alloc(size_t, uint_t, devmap_pmem_cookie_t *); 71*ae115bc7Smrj 72*ae115bc7Smrj void devmap_pmem_free(devmap_pmem_cookie_t); 73*ae115bc7Smrj 74*ae115bc7Smrj int devmap_pmem_getpfns(devmap_pmem_cookie_t, uint_t, pgcnt_t, pfn_t *); 75*ae115bc7Smrj 76*ae115bc7Smrj void pmem_init(); 77*ae115bc7Smrj 78*ae115bc7Smrj #ifdef __cplusplus 79*ae115bc7Smrj } 80*ae115bc7Smrj #endif 81*ae115bc7Smrj 82*ae115bc7Smrj #endif /* _SYS_PMEM_H */ 83