xref: /titanic_44/usr/src/uts/intel/sys/pmem.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*ae115bc7Smrj 
32*ae115bc7Smrj #ifdef	__cplusplus
33*ae115bc7Smrj extern "C" {
34*ae115bc7Smrj #endif
35*ae115bc7Smrj 
36*ae115bc7Smrj /*
37*ae115bc7Smrj  * PMEM - Direct mapping physical memory pages to userland process
38*ae115bc7Smrj  *
39*ae115bc7Smrj  * Provide consolidation private functions used for directly (w/o occupying
40*ae115bc7Smrj  * kernel virtual address space) allocating and exporting physical memory pages
41*ae115bc7Smrj  * to userland.
42*ae115bc7Smrj  */
43*ae115bc7Smrj 
44*ae115bc7Smrj /*
45*ae115bc7Smrj  * Flags to pass to pmem_alloc
46*ae115bc7Smrj  */
47*ae115bc7Smrj #define	PMEM_SLEEP	0x1
48*ae115bc7Smrj #define	PMEM_NOSLEEP	0x2
49*ae115bc7Smrj 
50*ae115bc7Smrj /*
51*ae115bc7Smrj  * Called by driver devmap routine to pass physical memory mapping info to
52*ae115bc7Smrj  * seg_dev framework, used only for physical memory allocated from
53*ae115bc7Smrj  * devmap_pmem_alloc().
54*ae115bc7Smrj  */
55*ae115bc7Smrj int	devmap_pmem_setup(devmap_cookie_t, dev_info_t *dip,
56*ae115bc7Smrj     struct devmap_callback_ctl *, devmap_pmem_cookie_t, offset_t,
57*ae115bc7Smrj     size_t, uint_t, uint_t, ddi_device_acc_attr_t *);
58*ae115bc7Smrj 
59*ae115bc7Smrj /*
60*ae115bc7Smrj  * Replace existing mapping using a new cookie, mainly gets called when doing
61*ae115bc7Smrj  * fork(). Should be called in pertinent devmap_dup(9E).
62*ae115bc7Smrj  */
63*ae115bc7Smrj int	devmap_pmem_remap(devmap_cookie_t, dev_info_t *dip,
64*ae115bc7Smrj     devmap_pmem_cookie_t, offset_t, size_t, uint_t, uint_t,
65*ae115bc7Smrj     ddi_device_acc_attr_t *);
66*ae115bc7Smrj 
67*ae115bc7Smrj /*
68*ae115bc7Smrj  * Directly (i.e., without occupying kernel virtual address space) allocate
69*ae115bc7Smrj  * 'npages' physical memory pages for exporting to user land. The allocated
70*ae115bc7Smrj  * page_t pointer will be recorded in cookie.
71*ae115bc7Smrj  */
72*ae115bc7Smrj int	devmap_pmem_alloc(size_t, uint_t, devmap_pmem_cookie_t *);
73*ae115bc7Smrj 
74*ae115bc7Smrj void	devmap_pmem_free(devmap_pmem_cookie_t);
75*ae115bc7Smrj 
76*ae115bc7Smrj int	devmap_pmem_getpfns(devmap_pmem_cookie_t, uint_t, pgcnt_t, pfn_t *);
77*ae115bc7Smrj 
78*ae115bc7Smrj void    pmem_init();
79*ae115bc7Smrj 
80*ae115bc7Smrj #ifdef	__cplusplus
81*ae115bc7Smrj }
82*ae115bc7Smrj #endif
83*ae115bc7Smrj 
84*ae115bc7Smrj #endif	/* _SYS_PMEM_H */
85