xref: /titanic_50/usr/src/uts/common/sys/ddidevmap.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_DDIDEVMAP_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_DDIDEVMAP_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #include <sys/mman.h>
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate struct devmap_info {
41*7c478bd9Sstevel@tonic-gate 	size_t	length;		/* and this length */
42*7c478bd9Sstevel@tonic-gate 	size_t	page_size;	/* pte page size selected by framework */
43*7c478bd9Sstevel@tonic-gate 	size_t	offset;		/* optimal page size based on this offset */
44*7c478bd9Sstevel@tonic-gate 	ushort_t valid_flag;	/* flag to indicate the validity of data */
45*7c478bd9Sstevel@tonic-gate 	uchar_t	byte_order;	/* the  endian characteristics of the mapping */
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate 	/*
48*7c478bd9Sstevel@tonic-gate 	 * describes  order in which the CPU will reference data.
49*7c478bd9Sstevel@tonic-gate 	 */
50*7c478bd9Sstevel@tonic-gate 	uchar_t	data_order;
51*7c478bd9Sstevel@tonic-gate };
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate typedef void * ddi_umem_cookie_t;
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * umem callback function vector for drivers
57*7c478bd9Sstevel@tonic-gate  *
58*7c478bd9Sstevel@tonic-gate  * NOTE: IMPORTANT!  When umem_lockmemory is called with a valid
59*7c478bd9Sstevel@tonic-gate  * umem_callback_ops and DDI_UMEMLOCK_LONGTERM set, the 'cleanup'
60*7c478bd9Sstevel@tonic-gate  * callback function may be called AFTER a call to ddi_umem_lock.
61*7c478bd9Sstevel@tonic-gate  * It is the users responsibility to make sure that ddi_umem_lock is
62*7c478bd9Sstevel@tonic-gate  * called ONLY once for each ddi_umem_lock/umem_lockmemory cookie.
63*7c478bd9Sstevel@tonic-gate  */
64*7c478bd9Sstevel@tonic-gate #define	UMEM_CALLBACK_VERSION 1
65*7c478bd9Sstevel@tonic-gate struct umem_callback_ops {
66*7c478bd9Sstevel@tonic-gate 	int	cbo_umem_callback_version;	/* version number */
67*7c478bd9Sstevel@tonic-gate 	void (*cbo_umem_lock_cleanup)(ddi_umem_cookie_t *);
68*7c478bd9Sstevel@tonic-gate };
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate struct ddi_umem_cookie {
71*7c478bd9Sstevel@tonic-gate 	size_t	size;	/* size of allocation */
72*7c478bd9Sstevel@tonic-gate 	caddr_t	cvaddr;	/* cookie virtual address. */
73*7c478bd9Sstevel@tonic-gate 			/* KMEM - kvaddr returned from ddi_umem_alloc() */
74*7c478bd9Sstevel@tonic-gate 			/* For LOCKEDUMEM - user address of backing store */
75*7c478bd9Sstevel@tonic-gate 			/* For TRASH_UMEM - unused */
76*7c478bd9Sstevel@tonic-gate 	kmutex_t	lock;
77*7c478bd9Sstevel@tonic-gate 	uint_t		type;	/* see below for umem_cookie types */
78*7c478bd9Sstevel@tonic-gate 	/*
79*7c478bd9Sstevel@tonic-gate 	 * Following 4 members are used for UMEM_LOCKED cookie type
80*7c478bd9Sstevel@tonic-gate 	 */
81*7c478bd9Sstevel@tonic-gate 	page_t		**pparray;	/* shadow list from as_pagelock */
82*7c478bd9Sstevel@tonic-gate 	void		*procp;		/* user process owning backing store */
83*7c478bd9Sstevel@tonic-gate 	struct as	*asp;		/* as ptr for use by ddi_umem_unlock */
84*7c478bd9Sstevel@tonic-gate 	enum seg_rw	s_flags;	/* flags used during pagelock/fault */
85*7c478bd9Sstevel@tonic-gate 	/*
86*7c478bd9Sstevel@tonic-gate 	 * locked indicates underlying memory locked for KMEM_PAGEABLE
87*7c478bd9Sstevel@tonic-gate 	 * locked is a count of for how many pages this has been locked
88*7c478bd9Sstevel@tonic-gate 	 */
89*7c478bd9Sstevel@tonic-gate 	uint_t		locked;
90*7c478bd9Sstevel@tonic-gate 	struct umem_callback_ops callbacks;
91*7c478bd9Sstevel@tonic-gate 	/*
92*7c478bd9Sstevel@tonic-gate 	 * cook_refcnt used in UMEM_LOCKED type
93*7c478bd9Sstevel@tonic-gate 	 */
94*7c478bd9Sstevel@tonic-gate 	ulong_t		cook_refcnt;	/* cookie reference count */
95*7c478bd9Sstevel@tonic-gate 	struct ddi_umem_cookie *unl_forw;   /* list ptr for unlock cookies */
96*7c478bd9Sstevel@tonic-gate 	void		*lockmem_proj;	/* project ptr for resource mgmt */
97*7c478bd9Sstevel@tonic-gate };
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate typedef struct as *ddi_as_handle_t;
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate /*
103*7c478bd9Sstevel@tonic-gate  * type of umem_cookie:
104*7c478bd9Sstevel@tonic-gate  *    pageable memory allocated from segkp segment driver
105*7c478bd9Sstevel@tonic-gate  *    non-pageable memory allocated from kmem_getpages()
106*7c478bd9Sstevel@tonic-gate  *    locked umem allocated from ddi_umem_lock
107*7c478bd9Sstevel@tonic-gate  *    trash umem maps all user virtual addresses to a common trash page
108*7c478bd9Sstevel@tonic-gate  */
109*7c478bd9Sstevel@tonic-gate #define	KMEM_PAGEABLE		0x100	/* un-locked kernel memory */
110*7c478bd9Sstevel@tonic-gate #define	KMEM_NON_PAGEABLE	0x200	/* locked kernel memeory */
111*7c478bd9Sstevel@tonic-gate #define	UMEM_LOCKED		0x400	/* locked user process memeory */
112*7c478bd9Sstevel@tonic-gate #define	UMEM_TRASH		0x800	/* trash page mapping */
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate typedef struct __devmap_pmem_cookie *devmap_pmem_cookie_t;
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate typedef void *devmap_cookie_t;
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate struct devmap_callback_ctl {
119*7c478bd9Sstevel@tonic-gate 	int	devmap_rev;		/* devmap_callback_ctl version number */
120*7c478bd9Sstevel@tonic-gate 	int	(*devmap_map)(devmap_cookie_t dhp, dev_t dev, uint_t flags,
121*7c478bd9Sstevel@tonic-gate 				offset_t off, size_t len, void **pvtp);
122*7c478bd9Sstevel@tonic-gate 	int	(*devmap_access)(devmap_cookie_t dhp, void *pvtp, offset_t off,
123*7c478bd9Sstevel@tonic-gate 				size_t len, uint_t type, uint_t rw);
124*7c478bd9Sstevel@tonic-gate 	int	(*devmap_dup)(devmap_cookie_t dhp, void *pvtp,
125*7c478bd9Sstevel@tonic-gate 				devmap_cookie_t new_dhp, void **new_pvtp);
126*7c478bd9Sstevel@tonic-gate 	void	(*devmap_unmap)(devmap_cookie_t dhp, void *pvtp, offset_t off,
127*7c478bd9Sstevel@tonic-gate 				size_t len, devmap_cookie_t new_dhp1,
128*7c478bd9Sstevel@tonic-gate 				void **new_pvtp1, devmap_cookie_t new_dhp2,
129*7c478bd9Sstevel@tonic-gate 				void **new_pvtp2);
130*7c478bd9Sstevel@tonic-gate };
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate struct devmap_softlock {
133*7c478bd9Sstevel@tonic-gate 	ulong_t		id;	/* handle grouping id */
134*7c478bd9Sstevel@tonic-gate 	dev_t		dev; /* Device to which we are mapping */
135*7c478bd9Sstevel@tonic-gate 	struct		devmap_softlock	*next;
136*7c478bd9Sstevel@tonic-gate 	kmutex_t	lock;
137*7c478bd9Sstevel@tonic-gate 	kcondvar_t	cv;
138*7c478bd9Sstevel@tonic-gate 	int		refcnt;	/* Number of threads with mappings */
139*7c478bd9Sstevel@tonic-gate 	ssize_t		softlocked;
140*7c478bd9Sstevel@tonic-gate };
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate struct devmap_ctx {
143*7c478bd9Sstevel@tonic-gate 	ulong_t		id; /* handle grouping id */
144*7c478bd9Sstevel@tonic-gate 	dev_info_t	*dip; /* Device info struct for tracing context */
145*7c478bd9Sstevel@tonic-gate 	struct devmap_ctx *next;
146*7c478bd9Sstevel@tonic-gate 	kmutex_t	lock;
147*7c478bd9Sstevel@tonic-gate 	kcondvar_t	cv;
148*7c478bd9Sstevel@tonic-gate 	int		refcnt; /* Number of threads with mappings */
149*7c478bd9Sstevel@tonic-gate 	uint_t		oncpu; /* this context is running on a cpu */
150*7c478bd9Sstevel@tonic-gate 	timeout_id_t	timeout; /* Timeout ID */
151*7c478bd9Sstevel@tonic-gate };
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate /*
154*7c478bd9Sstevel@tonic-gate  * Fault information passed to the driver fault handling routine.
155*7c478bd9Sstevel@tonic-gate  * The DEVMAP_LOCK and DEVMAP_UNLOCK are used by software
156*7c478bd9Sstevel@tonic-gate  * to lock and unlock pages for physical I/O.
157*7c478bd9Sstevel@tonic-gate  */
158*7c478bd9Sstevel@tonic-gate enum devmap_fault_type {
159*7c478bd9Sstevel@tonic-gate 	DEVMAP_ACCESS,		/* invalid page */
160*7c478bd9Sstevel@tonic-gate 	DEVMAP_PROT,		/* protection fault */
161*7c478bd9Sstevel@tonic-gate 	DEVMAP_LOCK,		/* software requested locking */
162*7c478bd9Sstevel@tonic-gate 	DEVMAP_UNLOCK		/* software requested unlocking */
163*7c478bd9Sstevel@tonic-gate };
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*
166*7c478bd9Sstevel@tonic-gate  * seg_rw gives the access type for a fault operation
167*7c478bd9Sstevel@tonic-gate  */
168*7c478bd9Sstevel@tonic-gate enum devmap_rw {
169*7c478bd9Sstevel@tonic-gate 	DEVMAP_OTHER,		/* unknown or not touched */
170*7c478bd9Sstevel@tonic-gate 	DEVMAP_READ,		/* read access attempted */
171*7c478bd9Sstevel@tonic-gate 	DEVMAP_WRITE,		/* write access attempted */
172*7c478bd9Sstevel@tonic-gate 	DEVMAP_EXEC,		/* execution access attempted */
173*7c478bd9Sstevel@tonic-gate 	DEVMAP_CREATE		/* create if page doesn't exist */
174*7c478bd9Sstevel@tonic-gate };
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate typedef struct devmap_handle {
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate 	/*
179*7c478bd9Sstevel@tonic-gate 	 * physical offset at the beginning of mapping.
180*7c478bd9Sstevel@tonic-gate 	 */
181*7c478bd9Sstevel@tonic-gate 	offset_t	dh_roff;
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate 	/*
184*7c478bd9Sstevel@tonic-gate 	 * user offset at the beginning of mapping.
185*7c478bd9Sstevel@tonic-gate 	 */
186*7c478bd9Sstevel@tonic-gate 	offset_t	dh_uoff;
187*7c478bd9Sstevel@tonic-gate 	size_t		dh_len;		/* length of mapping */
188*7c478bd9Sstevel@tonic-gate 	dev_t		dh_dev;		/* dev_t for this mapping */
189*7c478bd9Sstevel@tonic-gate 	caddr_t		dh_cvaddr;  /* cookie virtual address */
190*7c478bd9Sstevel@tonic-gate 	caddr_t		dh_uvaddr;  /* user address within dh_seg */
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate 	/*
193*7c478bd9Sstevel@tonic-gate 	 * Lock protects fields that can change during remap
194*7c478bd9Sstevel@tonic-gate 	 * dh_roff, dh_cookie, dh_flags, dh_mmulevel, dh_maxprot,
195*7c478bd9Sstevel@tonic-gate 	 * dh_pfn, dh_hat_attr
196*7c478bd9Sstevel@tonic-gate 	 */
197*7c478bd9Sstevel@tonic-gate 	kmutex_t	dh_lock;
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate 	/*
200*7c478bd9Sstevel@tonic-gate 	 * to sync. faults for remap and unlocked kvaddr.
201*7c478bd9Sstevel@tonic-gate 	 */
202*7c478bd9Sstevel@tonic-gate 	struct seg		*dh_seg; /* segment created for this mapping */
203*7c478bd9Sstevel@tonic-gate 	void			*dh_pvtp; /* device mapping private data */
204*7c478bd9Sstevel@tonic-gate 	struct devmap_handle	*dh_next;
205*7c478bd9Sstevel@tonic-gate 	struct devmap_softlock	*dh_softlock;
206*7c478bd9Sstevel@tonic-gate 	struct devmap_ctx	*dh_ctx;
207*7c478bd9Sstevel@tonic-gate 	ddi_umem_cookie_t	dh_cookie;	/* kmem cookie */
208*7c478bd9Sstevel@tonic-gate 	devmap_pmem_cookie_t	dh_pcookie;	/* pmem cookie */
209*7c478bd9Sstevel@tonic-gate 
210*7c478bd9Sstevel@tonic-gate 	/*
211*7c478bd9Sstevel@tonic-gate 	 * protection flag possible for attempted mapping.
212*7c478bd9Sstevel@tonic-gate 	 */
213*7c478bd9Sstevel@tonic-gate 	uint_t		dh_prot;
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate 	/*
216*7c478bd9Sstevel@tonic-gate 	 * Current maximum protection flag for attempted mapping.
217*7c478bd9Sstevel@tonic-gate 	 * This controls how dh_prot can be changed in segdev_setprot
218*7c478bd9Sstevel@tonic-gate 	 * See dh_orig_maxprot below also
219*7c478bd9Sstevel@tonic-gate 	 */
220*7c478bd9Sstevel@tonic-gate 	uint_t		dh_maxprot;
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate 	/*
223*7c478bd9Sstevel@tonic-gate 	 * mmu level corresponds to the Max page size can be use for
224*7c478bd9Sstevel@tonic-gate 	 * the mapping.
225*7c478bd9Sstevel@tonic-gate 	 */
226*7c478bd9Sstevel@tonic-gate 	uint_t		dh_mmulevel;
227*7c478bd9Sstevel@tonic-gate 	uint_t		dh_flags;   /* see defines below */
228*7c478bd9Sstevel@tonic-gate 	pfn_t		dh_pfn;		/* pfn corresponds to dh_reg_off */
229*7c478bd9Sstevel@tonic-gate 	uint_t		dh_hat_attr;
230*7c478bd9Sstevel@tonic-gate 	clock_t		dh_timeout_length;
231*7c478bd9Sstevel@tonic-gate 	struct devmap_callback_ctl dh_callbackops;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate 	/*
234*7c478bd9Sstevel@tonic-gate 	 * orig_maxprot is what the original mmap set maxprot to.
235*7c478bd9Sstevel@tonic-gate 	 * This is never modified once it is setup during mmap(2)
236*7c478bd9Sstevel@tonic-gate 	 * This is different from the current dh_maxprot which can
237*7c478bd9Sstevel@tonic-gate 	 * be changed in devmap_*_setup/remap
238*7c478bd9Sstevel@tonic-gate 	 */
239*7c478bd9Sstevel@tonic-gate 	uint_t		dh_orig_maxprot;
240*7c478bd9Sstevel@tonic-gate } devmap_handle_t;
241*7c478bd9Sstevel@tonic-gate 
242*7c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate /*
245*7c478bd9Sstevel@tonic-gate  * define for devmap_rev
246*7c478bd9Sstevel@tonic-gate  */
247*7c478bd9Sstevel@tonic-gate #define	DEVMAP_OPS_REV 1
248*7c478bd9Sstevel@tonic-gate 
249*7c478bd9Sstevel@tonic-gate /*
250*7c478bd9Sstevel@tonic-gate  * defines for devmap_*_setup flag, called by drivers
251*7c478bd9Sstevel@tonic-gate  */
252*7c478bd9Sstevel@tonic-gate #define	DEVMAP_DEFAULTS			0x00
253*7c478bd9Sstevel@tonic-gate #define	DEVMAP_MAPPING_INVALID		0x01 	/* mapping is invalid */
254*7c478bd9Sstevel@tonic-gate #define	DEVMAP_ALLOW_REMAP		0x02	/* allow remap */
255*7c478bd9Sstevel@tonic-gate #define	DEVMAP_USE_PAGESIZE		0x04	/* use pagesize for mmu load */
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate /* flags used by drivers */
258*7c478bd9Sstevel@tonic-gate #define	DEVMAP_SETUP_FLAGS	\
259*7c478bd9Sstevel@tonic-gate 	(DEVMAP_MAPPING_INVALID | DEVMAP_ALLOW_REMAP | DEVMAP_USE_PAGESIZE)
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate /*
262*7c478bd9Sstevel@tonic-gate  * defines for dh_flags, these are used internally in devmap
263*7c478bd9Sstevel@tonic-gate  */
264*7c478bd9Sstevel@tonic-gate #define	DEVMAP_SETUP_DONE		0x100	/* mapping setup is done */
265*7c478bd9Sstevel@tonic-gate #define	DEVMAP_LOCK_INITED		0x200	/* locks are initailized */
266*7c478bd9Sstevel@tonic-gate #define	DEVMAP_LOCKED			0x800	/* dhp is locked. */
267*7c478bd9Sstevel@tonic-gate #define	DEVMAP_FLAG_LARGE		0x1000  /* cal. optimal pgsize */
268*7c478bd9Sstevel@tonic-gate 
269*7c478bd9Sstevel@tonic-gate /*
270*7c478bd9Sstevel@tonic-gate  * Flags to pass to ddi_umem_alloc and ddi_umem_iosetup
271*7c478bd9Sstevel@tonic-gate  */
272*7c478bd9Sstevel@tonic-gate #define	DDI_UMEM_SLEEP		0x0
273*7c478bd9Sstevel@tonic-gate #define	DDI_UMEM_NOSLEEP	0x01
274*7c478bd9Sstevel@tonic-gate #define	DDI_UMEM_PAGEABLE	0x02
275*7c478bd9Sstevel@tonic-gate #define	DDI_UMEM_TRASH		0x04
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate /*
278*7c478bd9Sstevel@tonic-gate  * Flags to pass to ddi_umem_lock to indicate expected access pattern
279*7c478bd9Sstevel@tonic-gate  * DDI_UMEMLOCK_READ implies the memory being locked will be read
280*7c478bd9Sstevel@tonic-gate  * (e.g., data read from memory is written out to the disk or network)
281*7c478bd9Sstevel@tonic-gate  * DDI_UMEMLOCK_WRITE implies the memory being locked will be written
282*7c478bd9Sstevel@tonic-gate  * (e.g., data from the disk or network is written to memory)
283*7c478bd9Sstevel@tonic-gate  * Both flags may be set in the call to ddi_umem_lock,
284*7c478bd9Sstevel@tonic-gate  * Note that this corresponds to the VM subsystem definition of read/write
285*7c478bd9Sstevel@tonic-gate  * and also correspond to the prots set in devmap
286*7c478bd9Sstevel@tonic-gate  * When doing I/O, B_READ/B_WRITE are used which have exactly the opposite
287*7c478bd9Sstevel@tonic-gate  * meaning. Be careful when using it both for I/O and devmap
288*7c478bd9Sstevel@tonic-gate  *
289*7c478bd9Sstevel@tonic-gate  *
290*7c478bd9Sstevel@tonic-gate  */
291*7c478bd9Sstevel@tonic-gate #define	DDI_UMEMLOCK_READ	0x01
292*7c478bd9Sstevel@tonic-gate #define	DDI_UMEMLOCK_WRITE	0x02
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
295*7c478bd9Sstevel@tonic-gate }
296*7c478bd9Sstevel@tonic-gate #endif
297*7c478bd9Sstevel@tonic-gate 
298*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_DDIDEVMAP_H */
299