Writing Device Drivers for Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

Looking Up Properties

A driver can request a property from its parent, which in turn can ask its parent. The driver can control whether the request can go higher than its parent.

For example, the esp driver in the following example maintains an integer property called targetx-sync-speed for each target. The x in targetx-sync-speed represents the target number. The prtconf(1M) command displays driver properties in verbose mode. The following example shows a partial listing for the esp driver.

% prtconf -v
...
       esp, instance #0
            Driver software properties:
                name <target2-sync-speed> length <4>
                    value <0x00000fa0>.
...

The following table provides a summary of the property interfaces.

Table 4-1  Property Interface Uses
Family
Property Interfaces
Description
ddi_prop_lookup
Looks up a property and returns successfully if the property exists. Fails if the property does not exist
Looks up and returns an integer property
Looks up and returns a 64-bit integer property
Looks up and returns an integer array property
Looks up and returns a 64-bit integer array property
Looks up and returns a string property
Looks up and returns a string array property
Looks up and returns a byte array property
ddi_prop_update
Updates or creates an integer property
Updates or creates a single 64-bit integer property
Updates or creates an integer array property
Updates or creates a string property
Updates or creates a string array property
Updates or creates a 64-bit integer array property
Updates or creates a byte array property
ddi_prop_remove
Removes a property
Removes all properties that are associated with a device

Whenever possible, use 64-bit versions of int property interfaces such as ddi_prop_update_int64(9F) instead of 32-bit versions such as ddi_prop_update_int(9F)).