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

NAME

6       ldi_prop_get_int, ldi_prop_get_int64 - Lookup integer property
7

SYNOPSIS

9       #include <sys/sunldi.h>
10
11       int ldi_prop_get_int(ldi_handle_t lh, uint_t flags, char *name,
12            int defvalue);
13
14
15       int64_t ldi_prop_get_int64(ldi_handle_t lh, uint_t flags, char *name,
16            int64_t defvalue);
17
18

PARAMETERS

20       lh        Layered handle.
21
22
23       flags     Possible flag values are some combination of:
24
25                 LDI_DEV_T_ANY        Match  the lookup request independent of
26                                      the actual dev_t  value  that  was  used
27                                      when the property was created. Indicates
28                                      any     dev_t      value      (including
29                                      DDI_DEV_T_NONE) associated with a possi‐
30                                      ble property match satisfies the  match‐
31                                      ing criteria.
32
33
34                 DDI_PROP_DONTPASS    Do  not  pass  request  to parent device
35                                      information node if property not found.
36
37
38                 DDI_PROP_NOTPROM     Do not look at PROM properties  (ignored
39                                      on  platforms  that  do not support PROM
40                                      properties).
41
42
43
44       name        String containing the property name.
45
46
47       defvalue    Integer value that is  returned  if  the  property  is  not
48                   found.
49
50

INTERFACE LEVEL

52       Solaris DDI specific (Solaris DDI)
53

DESCRIPTION

55       The ldi_prop_get_int() and ldi_prop_get_int64() functions search for an
56       integer property associated with a device represented  by  the  layered
57       driver  handle.  If the integer property is found, the functions return
58       the property value.
59
60
61       Properties are searched for based on the dip and dev_t  values  associ‐
62       ated  with  the layered handle, the property name, and type of the data
63       (integer).
64
65
66       The property search order is as follows:
67
68           1.     Search software properties created by the driver.
69
70           2.     Search the software properties created  by  the  system  (or
71                  nexus nodes in the device info tree).
72
73           3.     Search the driver global properties list.
74
75           4.     If  DDI_PROP_NOTPROM  is not set, search the PROM properties
76                  (if they exist).
77
78           5.     If DDI_PROP_DONTPASS is not set, pass this  request  to  the
79                  parent device information node of the device  represented by
80                  the layered handle.
81
82           6.     Return defvalue.
83
84
85       Typically, the specific dev_t value associated with the  device  repre‐
86       sented  by  the  layered handle (ldi_handle_t) is used as a part of the
87       property match criteria. This association is  handled  by  the  layered
88       driver  infrastructure  on  behalf of the consumers of the ldi property
89       look up functions.
90
91
92       However, if the LDI_DEV_T_ANY flag is used,  the  ldi  property  lookup
93       functions  match  the  request regardless of the dev_t value associated
94       with the property at the time of its creation. If a property  was  cre‐
95       ated  with  a dev_t set to DDI_DEV_T_NONE, the only way to look up this
96       property is with the LDI_DEV_T_ANY flag.  PROM  properties  are  always
97       created with a dev_t set to DDI_DEV_T_NONE.
98
99
100       name must always be set to the name of the property being looked up.
101
102
103       The  return value of the routine is the value of property. If the prop‐
104       erty is not found, the argument defvalue is returned  as  the  property
105       value.
106
107
108       ldi_prop_get_int64()  does not search the PROM for 64-bit property val‐
109       ues.
110

RETURN VALUES

112       ldi_prop_get_int() and ldi_prop_get_int64() return the property  value.
113       If the property is not found, the argument defvalue is returned. If the
114       property is found, but cannot be decoded into an  int  or  an  int64_t,
115       DDI_PROP_NOT_FOUND is returned.
116

CONTEXT

118       ldi_prop_get_int()  and ldi_prop_get_int64() can be called from user or
119       kernel context.
120

EXAMPLES

122       Using ldi_prop_get_int64().
123
124         The following example demonstrates the use of ldi_prop_get_int64().
125
126                /*
127                 * Get the value of the integer "timeout" property, using
128                 * our own default if no such property exists
129                 */
130
131                int64_t timeout, defval;
132
133                timeout = ldi_prop_get_int64(lh, LDI_DEV_T_ANY|DDI_PROP_DONTPASS,
134                    propname, defval);
135
136

SEE ALSO

138       ddi_prop_get_int(9F), ddi_prop_get_int64(9F), ldi_prop_exists(9F).
139
140
141       Writing Device Drivers
142
143
144
145SunOS 5.11                        3 June 2003             ldi_prop_get_int(9F)
Impressum