Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / ddi_map_regs.9f
blob8e3867a82881a3fbefcef94fe34430e960bb60a6
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc.
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 DDI_MAP_REGS 9F "Jan 16, 2006"
7 .SH NAME
8 ddi_map_regs, ddi_unmap_regs \- map or unmap registers
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/conf.h>
13 #include <sys/ddi.h>
14 #include <sys/sunddi.h>
18 \fBint\fR \fBddi_map_regs\fR(\fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t *\fR\fIkaddrp\fR,
19      \fBoff_t\fR \fIoffset\fR, \fBoff_t\fR \fIlen\fR);
20 .fi
22 .LP
23 .nf
24 \fBvoid\fR \fBddi_unmap_regs\fR(\fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t *\fR\fIkaddrp\fR,
25      \fBoff_t\fR \fIoffset\fR, \fBoff_t\fR \fIlen\fR);
26 .fi
28 .SH INTERFACE LEVEL
29 .sp
30 .LP
31 These interfaces are obsolete. Use \fBddi_regs_map_setup\fR(9F) instead of
32 \fBddi_map_regs()\fR. Use \fBddi_regs_map_free\fR(9F) instead of
33 \fBddi_unmap_regs()\fR.
34 .SH PARAMETERS
35 .SS "\fBddi_map_regs()\fR"
36 .sp
37 .ne 2
38 .na
39 \fB\fIdip\fR\fR
40 .ad
41 .RS 11n
42 Pointer to the device's dev_info structure.
43 .RE
45 .sp
46 .ne 2
47 .na
48 \fB\fIrnumber\fR\fR
49 .ad
50 .RS 11n
51 Register set number.
52 .RE
54 .sp
55 .ne 2
56 .na
57 \fB\fIkaddrp\fR\fR
58 .ad
59 .RS 11n
60 Pointer to the base kernel address of the mapped region (set on return).
61 .RE
63 .sp
64 .ne 2
65 .na
66 \fB\fIoffset\fR\fR
67 .ad
68 .RS 11n
69 Offset into register space.
70 .RE
72 .sp
73 .ne 2
74 .na
75 \fB\fIlen\fR\fR
76 .ad
77 .RS 11n
78 Length to be mapped.
79 .RE
81 .SS "\fBddi_unmap_regs()\fR"
82 .sp
83 .ne 2
84 .na
85 \fB\fIdip\fR\fR
86 .ad
87 .RS 11n
88 Pointer to the device's dev_info structure.
89 .RE
91 .sp
92 .ne 2
93 .na
94 \fB\fIrnumber\fR\fR
95 .ad
96 .RS 11n
97 Register set number.
98 .RE
101 .ne 2
103 \fB\fIkaddrp\fR\fR
105 .RS 11n
106 Pointer to the base kernel address of the region to be unmapped.
110 .ne 2
112 \fB\fIoffset\fR\fR
114 .RS 11n
115 Offset into register space.
119 .ne 2
121 \fB\fIlen\fR\fR
123 .RS 11n
124 Length to be unmapped.
127 .SH DESCRIPTION
130 The \fBddi_map_regs()\fR function maps in the register set given by
131 \fIrnumber\fR. The register number determines which register set will be mapped
132 if more than one exists. The base kernel virtual address of the mapped register
133 set is returned in \fIkaddrp\fR. \fIoffset\fR specifies an offset into the
134 register space to start from and \fIlen\fR indicates the size of the area to be
135 mapped. If \fIlen\fR is non-zero, it overrides the length given in the register
136 set description. See the discussion of the \fBreg\fR property in \fBsbus\fR(4)
137 and for more information on register set descriptions. If \fIlen\fR and
138 \fIoffset\fR are 0, the entire space is mapped.
141 The \fBddi_unmap_regs()\fR function undoes mappings set up by
142 \fBddi_map_regs()\fR. This is provided for drivers preparing to detach
143 themselves from the system, allowing them to release allocated mappings.
144 Mappings must be released in the same way they were mapped (a call to
145 \fBddi_unmap_regs()\fR must correspond to a previous call to
146 \fBddi_map_regs()\fR). Releasing portions of previous mappings is not allowed.
147 \fIrnumber\fR determines which register set will be unmapped if more than one
148 exists. The \fIkaddrp\fR, \fIoffset\fR and \fIlen\fR specify the area to be
149 unmapped. \fIkaddrp\fR is a pointer to the address returned from
150 \fBddi_map_regs()\fR; \fIoffset\fR and \fIlen\fR should match what
151 \fBddi_map_regs()\fR was called with.
152 .SH RETURN VALUES
155 The \fBddi_map_regs()\fR function returns:
157 .ne 2
159 \fB\fBDDI_SUCCESS\fR\fR
161 .RS 15n
162 on success.
165 .SH CONTEXT
168 These functions can be called from user, interrupt, or kernel context.
169 .SH ATTRIBUTES
172 See \fBattributes\fR(5) for a description of the following attributes:
177 box;
178 c | c
179 l | l .
180 ATTRIBUTE TYPE  ATTRIBUTE VALUE
182 Interface Stability     Obsolete
185 .SH SEE ALSO
188 \fBattributes\fR(5), \fBsbus\fR(4), \fBddi_regs_map_free\fR(9F),
189 \fBddi_regs_map_setup\fR(9F)
192 \fIWriting Device Drivers\fR