2 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DEVMAP_DEFAULT_ACCESS 9F "Jan 14, 1997"
8 devmap_default_access \- default driver memory access function
13 #include <sys/sunddi.h>
16 \fBint\fR \fBdevmap_default_access\fR(\fBdevmap_cookie_t\fR \fIdhp\fR, \fBvoid *\fR\fIpvtp\fR,
17 \fBoffset_t\fR \fIoff\fR, \fBsize_t\fR \fIlen\fR, \fBuint_t\fR \fItype\fR, \fBuint_t\fR \fIrw\fR);
23 Solaris DDI specific (Solaris DDI).
31 An opaque mapping handle that the system uses to describe the mapping.
40 Driver private mapping data.
49 User offset within the logical device memory at which the access begins.
58 Length (in bytes) of the memory being accessed.
67 Type of access operation.
82 \fBdevmap_default_access()\fR is a function providing the semantics of
83 \fBdevmap_access\fR(9E). The drivers call \fBdevmap_default_access()\fR to
84 handle the mappings that do not support context switching. The drivers should
85 call \fBdevmap_do_ctxmgt\fR(9F) for the mappings that support context
89 \fBdevmap_default_access()\fR can either be called from \fBdevmap_access\fR(9E)
90 or be used as the \fBdevmap_access\fR(9E) entry point. The arguments \fIdhp\fR,
91 \fIpvtp\fR, \fIoff\fR, \fIlen\fR, \fItype\fR, and \fIrw\fR are provided by
92 the \fBdevmap_access\fR(9E) entry point and must not be modified.
100 Successful completion.
115 \fBdevmap_default_access()\fR must be called from the driver's
116 \fBdevmap_access\fR(9E) entry point.
119 \fBExample 1 \fRUsing devmap_default_access in devmap_access.
122 The following shows an example of using \fBdevmap_default_access()\fR in the
123 \fBdevmap_access\fR(9E) entry point.
129 #define OFF_DO_CTXMGT 0x40000000
130 #define OFF_NORMAL 0x40100000
131 #define CTXMGT_SIZE 0x100000
132 #define NORMAL_SIZE 0x100000
135 * Driver devmap_contextmgt(9E) callback function.
138 xx_context_mgt(devmap_cookie_t dhp, void *pvtp, offset_t offset,
139 size_t length, uint_t type, uint_t rw)
143 * see devmap_contextmgt(9E) for an example
148 * Driver devmap_access(9E) entry point
151 xxdevmap_access(devmap_cookie_t dhp, void *pvtp, offset_t off,
152 size_t len, uint_t type, uint_t rw)
158 * check if off is within the range that supports
159 * context management.
161 if ((diff = off - OFF_DO_CTXMG) >= 0 && diff < CTXMGT_SIZE) {
163 * calculates the length for context switching
165 if ((len + off) > (OFF_DO_CTXMGT + CTXMGT_SIZE))
168 * perform context switching
170 err = devmap_do_ctxmgt(dhp, pvtp, off, len, type,
173 * check if off is within the range that does normal
176 } else if ((diff = off - OFF_NORMAL) >= 0 && diff < NORMAL_SIZE) {
177 if ((len + off) > (OFF_NORMAL + NORMAL_SIZE))
179 err = devmap_default_access(dhp, pvtp, off, len, type, rw);
191 \fBdevmap_access\fR(9E), \fBdevmap_do_ctxmgt\fR(9F),
192 \fBdevmap_callback_ctl\fR(9S)
195 \fIWriting Device Drivers\fR