1ddi_prop_get_int(9F)     Kernel Functions for Drivers     ddi_prop_get_int(9F)
2
3
4

NAME

6       ddi_prop_get_int, ddi_prop_get_int64 - lookup integer property
7

SYNOPSIS

9       #include <sys/ddi.h>
10       #include <sys/sunddi.h>
11
12
13
14       int ddi_prop_get_int(dev_t match_dev, dev_info_t *dip, uint_t flags,
15            char *name, int defvalue);
16
17
18       int64_t ddi_prop_get_int64(dev_t match_dev, dev_info_t *dip, uint_t flags,
19            char *name, int64_t defvalue);
20
21

PARAMETERS

23       match_dev    Device number associated with property or DDI_DEV_T_ANY.
24
25
26       dip          Pointer  to  the device info node of device whose property
27                    list should be searched.
28
29
30       flags        Possible flag values are some combination of:
31
32                    DDI_PROP_DONTPASS    Do not pass request to parent  device
33                                         information   node  if  property  not
34                                         found.
35
36
37                    DDI_PROP_NOTPROM     Do  not  look  at   PROM   properties
38                                         (ignored  on  platforms  that  do not
39                                         support PROM properties).
40
41
42
43       name         String containing the name of the property.
44
45
46       defvalue     An integer value that is returned if the  property  cannot
47                    be found.
48
49

INTERFACE LEVEL

51       Solaris DDI specific (Solaris DDI).
52

DESCRIPTION

54       The ddi_prop_get_int() and ddi_prop_get_int64() functions search for an
55       integer property and, if found, returns the value of the property.
56
57
58       Properties are searched for based on the dip, name, match_dev, and  the
59       type of the data (integer). The property search order is as follows:
60
61           1.     Search software properties created by the driver.
62
63           2.     Search  the  software  properties  created by the system (or
64                  nexus nodes in the device info tree).
65
66           3.     Search the driver global properties list.
67
68           4.     If DDI_PROP_NOTPROM is not set, search the  PROM  properties
69                  (if they exist).
70
71           5.     If  DDI_PROP_DONTPASS  is  not set, pass this request to the
72                  parent device information node.
73
74           6.     Return defvalue.
75
76
77       Usually, the match_dev argument should be set to the actual device num‐
78       ber  that  this  property is associated with. However, if the match_dev
79       argument    is    DDI_DEV_T_ANY,    then     ddi_prop_get_int()     and
80       ddi_prop_get_int()  will  match the request regardless of the match_dev
81       the property was created with. If a property was created with match_dev
82       set  to  DDI_DEV_T_NONE,  then the only way to look up this property is
83       with a match_dev set to DDI_DEV_T_ANY. PROM properties are always  cre‐
84       ated with match_dev set to DDI_DEV_T_NONE.
85
86
87       name must always be set to the name of the property being looked up.
88
89
90       The  return  value  of the routine is the value of the property. If the
91       property is not found, the argument defvalue is returned as  the  value
92       of the property.
93
94
95       ddi_prop_get_int64()  will not search the PROM for 64-bit property val‐
96       ues.
97

RETURN VALUES

99       ddi_prop_get_int() and ddi_prop_get_int64() return  the  value  of  the
100       property.  If  the  property  is  not  found,  the argument defvalue is
101       returned. If the property is found, but cannot be decoded into  an  int
102       or an int64, then DDI_PROP_NOT_FOUND is returned.
103

CONTEXT

105       ddi_prop_get_int()  and ddi_prop_get_int64() can be called from user or
106       kernel context.
107

EXAMPLES

109       Example 1 Using ddi_prop_get_int()
110
111
112       The following example demonstrates the use of ddi_prop_get_int().
113
114
115
116         /*
117              * Get the value of the integer "width" property, using
118              * our own default if no such property exists
119              */
120              width = ddi_prop_get_int(xx_dev, xx_dip, 0, "width",
121                         XX_DEFAULT_WIDTH);
122
123

SEE ALSO

125       ddi_prop_exists(9F),     ddi_prop_lookup(9F),      ddi_prop_remove(9F),
126       ddi_prop_update(9F)
127
128
129       Writing Device Drivers
130
131
132
133SunOS 5.11                        25 Aug 2001             ddi_prop_get_int(9F)
Impressum