Skip Navigation Links | |
Exit Print View | |
![]() |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 10 1/13 Information Library |
csx_AccessConfigurationRegister(9F)
csx_Parse_CISTPL_BYTEORDER(9F)
csx_Parse_CISTPL_CFTABLE_ENTRY(9F)
csx_Parse_CISTPL_DEVICEGEO(9F)
csx_Parse_CISTPL_DEVICEGEO_A(9F)
csx_Parse_CISTPL_DEVICE_OA(9F)
csx_Parse_CISTPL_DEVICE_OC(9F)
csx_Parse_CISTPL_LINKTARGET(9F)
csx_Parse_CISTPL_LONGLINK_A(9F)
csx_Parse_CISTPL_LONGLINK_C(9F)
csx_Parse_CISTPL_LONGLINK_MFC(9F)
ddi_get_soft_iblock_cookie(9F)
ddi_intr_get_supported_types(9F)
ddi_prop_lookup_byte_array(9F)
ddi_prop_lookup_int64_array(9F)
ddi_prop_lookup_string_array(9F)
ddi_prop_update_byte_array(9F)
ddi_prop_update_int64_array(9F)
ddi_prop_update_string_array(9F)
ldi_prop_lookup_byte_array(9F)
ldi_prop_lookup_int64_array(9F)
ldi_prop_lookup_string_array(9F)
mac_prop_info_set_default_link_flowctrl(9F)
mac_prop_info_set_default_str(9F)
mac_prop_info_set_default_uint8(9F)
mac_prop_info_set_range_uint32(9F)
net_event_notify_unregister(9F)
net_instance_notify_register(9F)
net_instance_notify_unregister(9F)
net_instance_protocol_unregister(9F)
net_protocol_notify_register(9F)
nvlist_lookup_boolean_array(9F)
nvlist_lookup_boolean_value(9F)
nvlist_lookup_nvlist_array(9F)
nvlist_lookup_string_array(9F)
nvlist_lookup_uint16_array(9F)
nvlist_lookup_uint32_array(9F)
nvlist_lookup_uint64_array(9F)
nvpair_value_boolean_array(9F)
pci_plist_lookup_int16_array(9F)
pci_plist_lookup_int32_array(9F)
pci_plist_lookup_int64_array(9F)
pci_plist_lookup_int8_array(9F)
pci_plist_lookup_string_array(9F)
pci_plist_lookup_uint16_array(9F)
pci_plist_lookup_uint32_array(9F)
pci_plist_lookup_uint64_array(9F)
pci_plist_lookup_uint8_array(9F)
scsi_get_device_type_scsi_options(9F)
scsi_sense_cmdspecific_uint64(9F)
usb_get_current_frame_number(9F)
usb_get_max_pkts_per_isoc_request(9F)
usb_pipe_get_max_bulk_transfer_size(9F)
usb_pipe_stop_intr_polling(9F)
usb_pipe_stop_isoc_polling(9F)
- create, remove, or modify properties for leaf device drivers
#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> int ddi_prop_create(dev_t dev, dev_info_t *dip, int flags, char *name, caddr_t valuep, int length);
int ddi_prop_undefine(dev_t dev, dev_info_t *dip, int flags, char *name);
int ddi_prop_modify(dev_t dev, dev_info_t *dip, int flags, char *name, caddr_t valuep, int length);
int ddi_prop_remove(dev_t dev, dev_info_t *dip, char *name);
void ddi_prop_remove_all(dev_info_t *dip);
Solaris DDI specific (Solaris DDI). The ddi_prop_create() and ddi_prop_modify() functions are obsolete. Use ddi_prop_update(9F) instead of these functions.
ddi_prop_create()
dev_t of the device.
dev_info_t pointer of the device.
flag modifiers. The only possible flag value is DDI_PROP_CANSLEEP: Memory allocation may sleep.
name of property.
pointer to property value.
property length.
ddi_prop_undefine()
dev_t of the device.
dev_info_t pointer of the device.
flag modifiers. The only possible flag value is DDI_PROP_CANSLEEP: Memory allocation may sleep.
name of property.
ddi_prop_modify()
dev_t of the device.
dev_info_t pointer of the device.
flag modifiers. The only possible flag value is DDI_PROP_CANSLEEP: Memory allocation may sleep.
name of property.
pointer to property value.
property length.
ddi_prop_remove()
dev_t of the device.
dev_info_t pointer of the device.
name of property.
ddi_prop_remove_all()
dev_info_t pointer of the device.
Device drivers have the ability to create and manage their own properties as well as gain access to properties that the system creates on behalf of the driver. A driver uses ddi_getproplen(9F) to query whether or not a specific property exists.
Property creation is done by creating a new property definition in the driver's property list associated with dip.
Property definitions are stacked; they are added to the beginning of the driver's property list when created. Thus, when searched for, the most recent matching property definition will be found and its value will be return to the caller.
The individual functions are described as follows:
ddi_prop_create() adds a property to the device's property list. If the property is not associated with any particular dev but is associated with the physical device itself, then the argument dev should be the special device DDI_DEV_T_NONE. If you do not have a dev for your device (for example during attach(9E) time), you can create one using makedevice(9F) with a major number of DDI_MAJOR_T_UNKNOWN. ddi_prop_create() will then make the correct dev for your device.
For boolean properties, you must set length to 0. For all other properties, the length argument must be set to the number of bytes used by the data structure representing the property being created.
Note that creating a property involves allocating memory for the property list, the property name and the property value. If flags does not contain DDI_PROP_CANSLEEP, ddi_prop_create() returns DDI_PROP_NO_MEMORY on memory allocation failure or DDI_PROP_SUCCESS if the allocation succeeded. If DDI_PROP_CANSLEEP was set, the caller may sleep until memory becomes available.
ddi_prop_undefine() is a special case of property creation where the value of the property is set to undefined. This property has the effect of terminating a property search at the current devinfo node, rather than allowing the search to proceed up to ancestor devinfo nodes. However, ddi_prop_undefine() will not terminate a search when the ddi_prop_get_int(9F) or ddi_prop_lookup(9F) routines are used for lookup of 64-bit property value. See ddi_prop_op(9F).
Note that undefining properties does involve memory allocation, and therefore, is subject to the same memory allocation constraints as ddi_prop_create().
ddi_prop_modify() modifies the length and the value of a property. If ddi_prop_modify() finds the property in the driver's property list, allocates memory for the property value and returns DDI_PROP_SUCCESS. If the property was not found, the function returns DDI_PROP_NOT_FOUND.
Note that modifying properties does involve memory allocation, and therefore, is subject to the same memory allocation constraints as ddi_prop_create().
ddi_prop_remove() unlinks a property from the device's property list. If ddi_prop_remove() finds the property (an exact match of both nameand dev), it unlinks the property, frees its memory, and returns DDI_PROP_SUCCESS, otherwise, it returns DDI_PROP_NOT_FOUND.
ddi_prop_remove_all() removes the properties of all the dev_t's associated with the dip. It is called before unloading a driver.
The ddi_prop_create() function returns the following values:
On success.
On memory allocation failure.
If an attempt is made to create a property with dev equal to DDI_DEV_T_ANY or if name is NULL or name is the NULL string.
The ddi_prop_ undefine() function returns the following values:
On success.
On memory allocation failure.
If an attempt is made to create a property with dev DDI_DEV_T_ANY or if name is NULL or name is the NULL string.
The ddi_prop_modify() function returns the following values:
On success.
On memory allocation failure.
If an attempt is made to create a property with dev equal to DDI_DEV_T_ANY or if name is NULL or name is the NULL string.
On property search failure.
The ddi_prop_remove() function returns the following values:
On success.
If an attempt is made to create a property with dev equal to DDI_DEV_T_ANY or if name is NULL or name is the NULL string.
On property search failure.
If DDI_PROP_CANSLEEP is set, these functions can cannot be called from interrupt context. Otherwise, they can be called from user, interrupt, or kernel context.
Example 1 Creating a Property
The following example creates a property called nblocks for each partition on a disk.
int propval = 8192; for (minor = 0; minor < 8; minor ++) { (void) ddi_prop_create(makedevice(DDI_MAJOR_T_UNKNOWN, minor), dev, DDI_PROP_CANSLEEP, "nblocks", (caddr_t) &propval, sizeof (int)); … }
See attributes(5) for a description of the following attributes:
|
driver.conf(4), attributes(5), attach(9E), ddi_getproplen(9F), ddi_prop_op(9F), ddi_prop_update(9F), makedevice(9F)