1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc.
.\" 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.
.\" 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.
.\" 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]
.TH DDI_REGS_MAP_SETUP 9F "Nov 18, 2004"
.SH NAME
ddi_regs_map_setup \- set up a mapping for a register address space
.SH SYNOPSIS
.LP
.nf
#include <sys/ddi.h>
#include <sys/sunddi.h>
\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,
\fBoffset_t\fR \fIoffset\fR, \fBoffset_t\fR \fIlen\fR, \fBddi_device_acc_attr_t\fR \fI*accattrp\fR,
\fBddi_acc_handle_t\fR \fI*handlep\fR);
.fi
.SH INTERFACE LEVEL
.sp
.LP
Solaris \fBDDI\fR specific (Solaris \fBDDI\fR).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIdip\fR\fR
.ad
.RS 12n
Pointer to the device's \fBdev_info\fR structure.
.RE
.sp
.ne 2
.na
\fB\fIrnumber\fR\fR
.ad
.RS 12n
Index number to the register address space set.
.RE
.sp
.ne 2
.na
\fB\fIaddrp\fR\fR
.ad
.RS 12n
A platform-dependent value that, when added to an offset that is less than or
equal to the \fIlen\fR parameter (see below), is used for the \fBdev_addr\fR
argument to the \fBddi_get\fR, \fBddi_mem_get\fR, and
\fBddi_io_get\fR/\fBput\fR routines.
.RE
.sp
.ne 2
.na
\fB\fIoffset\fR\fR
.ad
.RS 12n
Offset into the register address space.
.RE
.sp
.ne 2
.na
\fB\fIlen\fR\fR
.ad
.RS 12n
Length to be mapped.
.RE
.sp
.ne 2
.na
\fB\fIaccattrp\fR\fR
.ad
.RS 12n
Pointer to a device access attribute structure of this mapping (see
\fBddi_device_acc_attr\fR(9S)).
.RE
.sp
.ne 2
.na
\fB\fIhandlep\fR\fR
.ad
.RS 12n
Pointer to a data access handle.
.RE
.SH DESCRIPTION
.sp
.LP
\fBddi_regs_map_setup()\fR maps in the register set given by \fIrnumber\fR. The
register number determines which register set is mapped if more than one
exists.
.sp
.LP
\fIoffset\fR specifies the starting location within the register space and
\fIlen\fR indicates the size of the area to be mapped. If \fIlen\fR is
non-zero, it overrides the length given in the register set description. If
both \fIlen\fR and \fIoffset\fR are \fB0\fR, the entire space is mapped. The
base of the mapped register space is returned in \fIaddrp\fR.
.sp
.LP
The device access attributes are specified in the location pointed by the
\fIaccattrp\fR argument (see \fBddi_device_acc_attr\fR(9S) for details).
.sp
.LP
The data access handle is returned in \fIhandlep\fR. \fIhandlep\fR is opaque;
drivers should not attempt to interpret its value. The handle is used by the
system to encode information for subsequent data access function calls to
maintain a consistent view between the host and the device.
.SH RETURN VALUES
.sp
.LP
\fBddi_regs_map_setup()\fR returns:
.sp
.ne 2
.na
\fB\fBDDI_SUCCESS\fR\fR
.ad
.RS 25n
Successfully set up the mapping for data access.
.RE
.sp
.ne 2
.na
\fB\fBDDI_FAILURE\fR\fR
.ad
.RS 25n
Invalid register number \fIrnumber\fR, offset \fIoffset\fR, or length
\fIlen\fR.
.RE
.sp
.ne 2
.na
\fB\fBDDI_ME_RNUMBER_RANGE\fR\fR
.ad
.RS 25n
Invalid register number \fIrnumber\fR or unable to find \fIreg\fR property.
.RE
.sp
.ne 2
.na
\fB\fBDDI_REGS_ACC_CONFLICT\fR\fR
.ad
.RS 25n
Cannot enable the register mapping due to access conflicts with other enabled
mappings.
.RE
.sp
.LP
Note that the return value \fBDDI_ME_RNUMBER_RANGE\fR is not supported on all
platforms. Also, there is potential overlap between \fBDDI_ME_RNUMBER_RANGE\fR
and \fBDDI_FAILURE\fR. Drivers should check for \fB!=DDI_SUCCESS\fR rather than
checking for a specific failure value.
.SH CONTEXT
.sp
.LP
\fBddi_regs_map_setup()\fR must be called from user or kernel context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Architecture PCI Local Bus, SBus, ISA
.TE
.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5), \fBddi_regs_map_free\fR(9F), \fBddi_device_acc_attr\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR
|