2 .\" Copyright (c) 2004, 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_REGS_MAP_SETUP 9F "Nov 18, 2004"
8 ddi_regs_map_setup \- set up a mapping for a register address space
13 #include <sys/sunddi.h>
17 \fBint\fR \fBddi_regs_map_setup\fR(\fBdev_info_t\fR \fI*dip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t\fR \fI*addrp\fR,
18 \fBoffset_t\fR \fIoffset\fR, \fBoffset_t\fR \fIlen\fR, \fBddi_device_acc_attr_t\fR \fI*accattrp\fR,
19 \fBddi_acc_handle_t\fR \fI*handlep\fR);
25 Solaris \fBDDI\fR specific (Solaris \fBDDI\fR).
33 Pointer to the device's \fBdev_info\fR structure.
42 Index number to the register address space set.
51 A platform-dependent value that, when added to an offset that is less than or
52 equal to the \fIlen\fR parameter (see below), is used for the \fBdev_addr\fR
53 argument to the \fBddi_get\fR, \fBddi_mem_get\fR, and
54 \fBddi_io_get\fR/\fBput\fR routines.
63 Offset into the register address space.
81 Pointer to a device access attribute structure of this mapping (see
82 \fBddi_device_acc_attr\fR(9S)).
91 Pointer to a data access handle.
97 \fBddi_regs_map_setup()\fR maps in the register set given by \fIrnumber\fR. The
98 register number determines which register set is mapped if more than one
102 \fIoffset\fR specifies the starting location within the register space and
103 \fIlen\fR indicates the size of the area to be mapped. If \fIlen\fR is
104 non-zero, it overrides the length given in the register set description. If
105 both \fIlen\fR and \fIoffset\fR are \fB0\fR, the entire space is mapped. The
106 base of the mapped register space is returned in \fIaddrp\fR.
109 The device access attributes are specified in the location pointed by the
110 \fIaccattrp\fR argument (see \fBddi_device_acc_attr\fR(9S) for details).
113 The data access handle is returned in \fIhandlep\fR. \fIhandlep\fR is opaque;
114 drivers should not attempt to interpret its value. The handle is used by the
115 system to encode information for subsequent data access function calls to
116 maintain a consistent view between the host and the device.
120 \fBddi_regs_map_setup()\fR returns:
124 \fB\fBDDI_SUCCESS\fR\fR
127 Successfully set up the mapping for data access.
133 \fB\fBDDI_FAILURE\fR\fR
136 Invalid register number \fIrnumber\fR, offset \fIoffset\fR, or length
143 \fB\fBDDI_ME_RNUMBER_RANGE\fR\fR
146 Invalid register number \fIrnumber\fR or unable to find \fIreg\fR property.
152 \fB\fBDDI_REGS_ACC_CONFLICT\fR\fR
155 Cannot enable the register mapping due to access conflicts with other enabled
161 Note that the return value \fBDDI_ME_RNUMBER_RANGE\fR is not supported on all
162 platforms. Also, there is potential overlap between \fBDDI_ME_RNUMBER_RANGE\fR
163 and \fBDDI_FAILURE\fR. Drivers should check for \fB!=DDI_SUCCESS\fR rather than
164 checking for a specific failure value.
168 \fBddi_regs_map_setup()\fR must be called from user or kernel context.
172 See \fBattributes\fR(5) for descriptions of the following attributes:
180 ATTRIBUTE TYPE ATTRIBUTE VALUE
182 Architecture PCI Local Bus, SBus, ISA
188 \fBattributes\fR(5), \fBddi_regs_map_free\fR(9F), \fBddi_device_acc_attr\fR(9S)
191 \fIWriting Device Drivers\fR