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