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"
8 ddi_prop_get_int, ddi_prop_get_int64 \- lookup integer property
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);
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);
34 Device number associated with property or \fBDDI_DEV_T_ANY.\fR
43 Pointer to the device info node of device whose property list should be
53 Possible flag values are some combination of:
57 \fB\fBDDI_PROP_DONTPASS\fR\fR
60 Do not pass request to parent device information node if property not found.
66 \fB\fBDDI_PROP_NOTPROM\fR\fR
69 Do not look at \fBPROM \fRproperties (ignored on platforms that do not support
70 \fBPROM \fRproperties).
81 String containing the name of the property.
90 An integer value that is returned if the property cannot be found.
96 Solaris DDI specific (Solaris DDI).
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
110 Search software properties created by the driver.
115 Search the software properties created by the system (or nexus nodes in the
121 Search the driver global properties list.
126 If \fBDDI_PROP_NOTPROM\fR is not set, search the \fBPROM \fRproperties (if
132 If \fBDDI_PROP_DONTPASS\fR is not set, pass this request to the parent
133 device information node.
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
161 \fBddi_prop_get_int64()\fR will not search the PROM for 64-bit property 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.
172 \fBddi_prop_get_int()\fR and \fBddi_prop_get_int64()\fR can be called from user
176 \fBExample 1 \fRUsing \fBddi_prop_get_int()\fR
179 The following example demonstrates the use of \fBddi_prop_get_int()\fR.
186 * Get the value of the integer "width" property, using
187 * our own default if no such property exists
189 width = ddi_prop_get_int(xx_dev, xx_dip, 0, "width",
190 XX_DEFAULT_WIDTH);\fR
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