Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / ddi_prop_get_int.9f
blobb5fcaf613f1f0355feaa55d090e4e0095827c7f9
1 '\" te
2 .\" Copyright (c) 2001, 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_PROP_GET_INT 9F "Aug 25, 2001"
7 .SH NAME
8 ddi_prop_get_int, ddi_prop_get_int64 \- lookup integer property
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/ddi.h>
13 #include <sys/sunddi.h>
17 \fBint\fR \fBddi_prop_get_int\fR(\fBdev_t\fR \fImatch_dev\fR, \fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIflags\fR,
18      \fBchar *\fR\fIname\fR, \fBint\fR \fIdefvalue\fR);
19 .fi
21 .LP
22 .nf
23 \fBint64_t\fR \fBddi_prop_get_int64\fR(\fBdev_t\fR \fImatch_dev\fR, \fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIflags\fR,
24      \fBchar *\fR\fIname\fR, \fBint64_t\fR \fIdefvalue\fR);
25 .fi
27 .SH PARAMETERS
28 .sp
29 .ne 2
30 .na
31 \fB\fImatch_dev\fR\fR
32 .ad
33 .RS 13n
34 Device number associated with property or \fBDDI_DEV_T_ANY.\fR
35 .RE
37 .sp
38 .ne 2
39 .na
40 \fB\fIdip\fR\fR
41 .ad
42 .RS 13n
43 Pointer to the device info node of device whose property list should be
44 searched.
45 .RE
47 .sp
48 .ne 2
49 .na
50 \fB\fIflags\fR\fR
51 .ad
52 .RS 13n
53 Possible flag values are some combination of:
54 .sp
55 .ne 2
56 .na
57 \fB\fBDDI_PROP_DONTPASS\fR\fR
58 .ad
59 .RS 21n
60 Do not pass request to parent device information node if property not found.
61 .RE
63 .sp
64 .ne 2
65 .na
66 \fB\fBDDI_PROP_NOTPROM\fR\fR
67 .ad
68 .RS 21n
69 Do not look at \fBPROM \fRproperties (ignored on platforms that do not support
70 \fBPROM \fRproperties).
71 .RE
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fIname\fR\fR
79 .ad
80 .RS 13n
81 String containing the name of the property.
82 .RE
84 .sp
85 .ne 2
86 .na
87 \fB\fIdefvalue\fR\fR
88 .ad
89 .RS 13n
90 An integer value that is returned if the property cannot be found.
91 .RE
93 .SH INTERFACE LEVEL
94 .sp
95 .LP
96 Solaris DDI specific (Solaris DDI).
97 .SH DESCRIPTION
98 .sp
99 .LP
100 The \fBddi_prop_get_int()\fR and \fBddi_prop_get_int64()\fR functions search
101 for an integer property and, if found, returns the value of the property.
104 Properties are searched for based on the \fIdip\fR, \fIname\fR,
105 \fImatch_dev\fR, and the type of the data (integer). The property search order
106 is as follows:
107 .RS +4
110 Search software properties created by the driver.
112 .RS +4
115 Search the software properties created by the system (or nexus nodes in the
116 device info tree).
118 .RS +4
121 Search the driver global properties list.
123 .RS +4
126 If \fBDDI_PROP_NOTPROM\fR is not set, search the \fBPROM \fRproperties (if
127 they exist).
129 .RS +4
132 If \fBDDI_PROP_DONTPASS\fR is not set, pass this request to the parent
133 device information node.
135 .RS +4
138 Return \fIdefvalue\fR.
142 Usually, the \fImatch_dev\fR argument should be set to the actual device number
143 that this property is associated with. However, if the \fImatch_dev\fR argument
144 is \fBDDI_DEV_T_ANY,\fR then \fBddi_prop_get_int()\fR and
145 \fBddi_prop_get_int()\fR will match the request regardless of the
146 \fImatch_dev\fR the property was created with. If a property was created with
147 \fImatch_dev\fR set to \fBDDI_DEV_T_NONE,\fR then the only way to look up this
148 property is with a \fImatch_dev\fR set to \fBDDI_DEV_T_ANY.\fR \fBPROM
149 \fRproperties are always created with \fImatch_dev\fR set to
150 \fBDDI_DEV_T_NONE.\fR
153 \fIname\fR must always be set to the name of the property being looked up.
156 The return value of the routine is the value of the property. If the property
157 is not found, the argument \fIdefvalue\fR is returned as the value of the
158 property.
161 \fBddi_prop_get_int64()\fR will not search the PROM for 64-bit property values.
162 .SH RETURN VALUES
165 \fBddi_prop_get_int()\fR and \fBddi_prop_get_int64()\fR return the value of the
166 property. If the property is not found, the argument \fBdefvalue\fR is
167 returned. If the property is found, but cannot be decoded into an \fBint\fR or
168 an \fBint64\fR, then \fBDDI_PROP_NOT_FOUND\fR is returned.
169 .SH CONTEXT
172 \fBddi_prop_get_int()\fR and \fBddi_prop_get_int64()\fR can be called from user
173 or kernel context.
174 .SH EXAMPLES
176 \fBExample 1 \fRUsing \fBddi_prop_get_int()\fR
179 The following example demonstrates the use of \fBddi_prop_get_int()\fR.
182 .in +2
184 \fB     
186         * Get the value of the integer "width" property, using
187         * our own default if no such property exists
188         */
189         width = ddi_prop_get_int(xx_dev, xx_dip, 0, "width",
190                    XX_DEFAULT_WIDTH);\fR
192 .in -2
194 .SH SEE ALSO
197 \fBddi_prop_exists\fR(9F), \fBddi_prop_lookup\fR(9F),
198 \fBddi_prop_remove\fR(9F), \fBddi_prop_update\fR(9F)
201 \fIWriting Device Drivers\fR