Writing Device Drivers

Looking up Properties

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

For example, the "esp" driver maintains an integer property for each target called targetx-sync-speed, where "x" is the target number. The prtconf(1M) command in its verbose mode displays driver properties. 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>.
...

Table 4-1 provides information on the property interfaces.

Table 4-1 Property Interface Uses

Family 

Property Interfaces 

Description 

ddi_prop_lookup 

ddi_prop_exists (9F) 

Looks up property and returns success if one exists. Returns failure if one does not exist.  

 

dd_prop_get_int(9F) 

Looks up and returns an integer property. 

 

ddi_prop_lookup_int_array(9F) 

Looks up and returns an integer array property. 

 

ddi_prop_lookup_string(9F) 

Looks up and returns a string property. 

 

ddi_prop_lookup_string_array(9F) 

Looks up and returns a string array property. 

 

ddi_prop_lookup_byte_array(9F) 

Looks up and returns a byte array property. 

ddi_prop_update 

ddi_prop_update_in(9F) 

Updates an integer property. 

 

ddi_prop_update_int_array(9F) 

Updates an integer array property. 

 

ddi_prop_update_string(9F) 

Updates a string property. 

 

ddi_prop_update_string_array(9F) 

Updates an string array property. 

 

ddi_prop_update_byte_array(9F) 

Updates a byte array property. 

ddi_prop_remove 

ddi_prop_remove(9F) 

Removes a property. 

 

ddi_prop_remove_all(9F) 

Removes all properties associated with a device.