2 .\" Copyright (c) 1995, 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_EXISTS 9F "May 22, 1995"
8 ddi_prop_exists \- check for the existence of a property
13 #include <sys/sunddi.h>
17 \fBint\fR \fBddi_prop_exists\fR(\fBdev_t\fR \fImatch_dev\fR, \fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIflags\fR,
18 \fBchar *\fR\fIname\fR);
24 Solaris DDI specific (Solaris DDI).
29 \fB\fImatch_dev\fR \fR
32 Device number associated with property or \fBDDI_DEV_T_ANY.\fR
41 Pointer to the device info node of device whose property list should be
51 Possible flag values are some combination of:
55 \fB\fBDDI_PROP_DONTPASS\fR \fR
58 Do not pass request to parent device information node if the property is not
65 \fB\fBDDI_PROP_NOTPROM\fR \fR
68 Do not look at \fBPROM \fRproperties (ignored on platforms that do not support
69 \fBPROM \fRproperties).
80 String containing the name of the property.
86 \fBddi_prop_exists()\fR checks for the existence of a property regardless of
87 the property value data type.
90 Properties are searched for based on the \fIdip\fR, \fIname\fR, and
91 \fImatch_dev\fR. The property search order is as follows:
95 Search software properties created by the driver.
100 Search the software properties created by the system (or nexus nodes in the
106 Search the driver global properties list.
111 If \fBDDI_PROP_NOTPROM\fR is not set, search the \fBPROM \fRproperties (if
117 If \fBDDI_PROP_DONTPASS\fR is not set, pass this request to the parent
118 device information node.
123 Return \fB0\fR if not found and \fB1\fR if found.
127 Usually, the \fImatch_dev\fR argument should be set to the actual device number
128 that this property is associated with. However, if the \fImatch_dev\fR
129 argument is \fBDDI_DEV_T_ANY,\fR then \fBddi_prop_exists()\fR will match the
130 request regardless of the \fImatch_dev\fR the property was created with.
131 That is the first property whose name matches \fIname\fR will be returned. If
132 a property was created with \fImatch_dev\fR set to \fBDDI_DEV_T_NONE\fR then
133 the only way to look up this property is with a \fImatch_dev\fR set to
134 \fBDDI_DEV_T_ANY.\fR \fBPROM \fRproperties are always created with
135 \fImatch_dev\fR set to \fBDDI_DEV_T_NONE.\fR
138 \fIname\fR must always be set to the name of the property being looked up.
142 \fBddi_prop_exists()\fR returns \fB1\fR if the property exists and \fB0\fR
147 These functions can be called from user or kernel context.
150 \fBExample 1 \fR: Using \fBddi_prop_exists()\fR
153 The following example demonstrates the use of \fBddi_prop_exists()\fR.
159 * Enable "whizzy" mode if the "whizzy-mode" property exists
161 if (ddi_prop_exists(xx_dev, xx_dip, DDI_PROP_NOTPROM,
162 "whizzy-mode") == 1) {
163 xx_enable_whizzy_mode(xx_dip);
165 xx_disable_whizzy_mode(xx_dip);
173 \fBddi_prop_get_int\fR(9F), \fBddi_prop_lookup\fR(9F),
174 \fBddi_prop_remove\fR(9F), \fBddi_prop_update\fR(9F)
177 \fIWriting Device Drivers\fR