summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/ldi_prop_get_int.9f
blob: 70a611eabedfaf89f6eed4ccb49c746eac683de1 (plain)
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) 2003, Sun Microsystems, Inc.,  All Rights Reserved
.\" 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 LDI_PROP_GET_INT 9F "Jun 3, 2003"
.SH NAME
ldi_prop_get_int, ldi_prop_get_int64 \- Lookup integer property
.SH SYNOPSIS
.nf
#include <sys/sunldi.h>

\fBint\fR \fBldi_prop_get_int\fR(\fBldi_handle_t\fR \fIlh\fR, \fBuint_t\fR \fIflags\fR, \fBchar *\fR\fIname\fR,
     \fBint\fR \fIdefvalue\fR);
.fi

.LP
.nf
\fBint\fR\fB64_t ldi_prop_get_int64\fR(\fBldi_handle_t\fR \fIlh\fR, \fBuint_t\fR \fIflags\fR, \fBchar *\fR\fIname\fR,
     \fBint64_t \fR\fIdefvalue\fR);
.fi

.SH PARAMETERS
.ne 2
.na
\fB\fIlh\fR \fR
.ad
.RS 10n
Layered handle.
.RE

.sp
.ne 2
.na
\fB\fIflags\fR \fR
.ad
.RS 10n
Possible flag values are some combination of:
.sp
.ne 2
.na
\fBLDI_DEV_T_ANY\fR
.ad
.RS 21n
Match the lookup request independent of the actual dev_t value that was used
when the property was created. Indicates any dev_t value (including
DDI_DEV_T_NONE) associated with a possible property match satisfies the
matching criteria.
.RE

.sp
.ne 2
.na
\fBDDI_PROP_DONTPASS\fR
.ad
.RS 21n
Do not pass request to parent device information node if property not found.
.RE

.sp
.ne 2
.na
\fBDDI_PROP_NOTPROM\fR
.ad
.RS 21n
Do not look at PROM properties (ignored on platforms that do not support PROM
properties).
.RE

.RE

.sp
.ne 2
.na
\fBname\fR
.ad
.RS 12n
String containing the property name.
.RE

.sp
.ne 2
.na
\fBdefvalue\fR
.ad
.RS 12n
Integer value that is returned if the property is not found.
.RE

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI)
.SH DESCRIPTION
The \fBldi_prop_get_int()\fR and \fBldi_prop_get_int64()\fR functions search
for an integer property associated with a device represented by the layered
driver handle. If the integer property is found, the functions return the
property value.
.sp
.LP
Properties are searched for based on the dip and dev_t values associated with
the layered handle, the property name, and type of the data (integer).
.sp
.LP
The property search order is as follows:
.RS +4
.TP
1.
Search software properties created by the driver.
.RE
.RS +4
.TP
2.
Search the software properties created by the system (or nexus nodes in the
device info tree).
.RE
.RS +4
.TP
3.
Search the driver global properties list.
.RE
.RS +4
.TP
4.
If DDI_PROP_NOTPROM is not set, search the PROM properties (if they exist).
.RE
.RS +4
.TP
5.
If DDI_PROP_DONTPASS is not set, pass this request to the parent device
information node of the device  represented by the layered handle.
.RE
.RS +4
.TP
6.
Return defvalue.
.RE
.sp
.LP
Typically, the specific dev_t value associated with the device represented by
the layered handle (ldi_handle_t) is used as a part of the property match
criteria. This association is handled by the layered driver infrastructure on
behalf of the consumers of the ldi property look up functions.
.sp
.LP
However, if the LDI_DEV_T_ANY flag is used, the ldi property lookup functions
match the request regardless of the dev_t value associated with the property at
the time of its creation. If a property was created with a dev_t set to
DDI_DEV_T_NONE, the only way to look up this property is with the LDI_DEV_T_ANY
flag.  PROM properties are always created with a dev_t set to DDI_DEV_T_NONE.
.sp
.LP
name must always be set to the name of the property being looked up.
.sp
.LP
The return value of the routine is the value of property. If the property is
not found, the argument defvalue is returned as the property value.
.sp
.LP
\fBldi_prop_get_int64()\fR does not search the PROM for 64-bit property values.
.SH RETURN VALUES
\fBldi_prop_get_int()\fR and \fBldi_prop_get_int64()\fR return the property
value. If the property is not found, the argument \fBdefvalue\fR is returned.
If the property is found, but cannot be decoded into an int or an int64_t,
DDI_PROP_NOT_FOUND is returned.
.SH CONTEXT
\fBldi_prop_get_int()\fR and \fBldi_prop_get_int64()\fR can be called from user
or kernel context.
.SH EXAMPLES
Using\fB ldi_prop_get_int64()\fR.
.sp
.in +2
.nf
The following example demonstrates the use of ldi_prop_get_int64().

       /*
        * Get the value of the integer "timeout" property, using
        * our own default if no such property exists
        */

       int64_t timeout, defval;

       timeout = ldi_prop_get_int64(lh, LDI_DEV_T_ANY|DDI_PROP_DONTPASS,
           propname, defval);
.fi
.in -2

.SH SEE ALSO
\fBddi_prop_get_int\fR(9F), \fBddi_prop_get_int64\fR(9F),
\fBldi_prop_exists\fR(9F)
.sp
.LP
\fIWriting Device Drivers\fR