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"
8 ddi_map_regs, ddi_unmap_regs \- map or unmap registers
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);
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);
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.
35 .SS "\fBddi_map_regs()\fR"
42 Pointer to the device's dev_info structure.
60 Pointer to the base kernel address of the mapped region (set on return).
69 Offset into register space.
81 .SS "\fBddi_unmap_regs()\fR"
88 Pointer to the device's dev_info structure.
106 Pointer to the base kernel address of the region to be unmapped.
115 Offset into register space.
124 Length to be unmapped.
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.
155 The \fBddi_map_regs()\fR function returns:
159 \fB\fBDDI_SUCCESS\fR\fR
168 These functions can be called from user, interrupt, or kernel context.
172 See \fBattributes\fR(5) for a description of the following attributes:
180 ATTRIBUTE TYPE ATTRIBUTE VALUE
182 Interface Stability Obsolete
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