Skip Navigation Links | |
Exit Print View | |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 11.1 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_get_device_type_string(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)
- reset a USB device according to the reset_level.
#include <sys/usb/usba.h int usb_reset_device (dev_info_t *dip, usb_dev_reset_lvl_t reset_level);
Solaris DDI specific (Solaris DDI)
Pointer to the devices's dev_info structure.
The level to which the device is reset. See below for a list of valid usb_dev_reset_lvl_t values and explanations.
The usb_reset_device() function provides a client driver to request a hardware reset for a USB device, which may be required in some situations such as:
Resetting the hardware may help drivers to recover devices from an error state caused by physical or firmware defects.
Some USB devices need the driver to upload firmware into the device's RAM and initiate a hardware reset in order to activate the new firmware.
The valid values for the reset_level are:
The default reset level. The device is reset and any error status is cleared. The device state machines and registers are also cleared and need to be reinitialized in the driver. The current driver remains attached. This reset level applies to hardware error recovery, or firmware download without changing the descriptors.
The device is reset. The original driver is detached and a new driver attaching process is started according to the updated compatible name. This reset level applies to the firmware download with the descriptors changing, or other situations in which the device needs to be reattached.
The usb_reset_device() function creates a new helper thread for reattachment. When called from attach(9E), the new thread sets a timer (1 second), and waits until the driver's attach(9E) completes, after which the thread attempts to reattach the driver. When not called from attach(9E), the new thread attempts to reattach the driver immediately.
If the thread fails to reattach to the driver, an error message is printed in system log with the detailed reason. The driver returns to a stable state, depending on where the failure occurred.
The return values for the usb_reset_device() function are:
If USB_RESET_LVL_DEFAULT is specified, the device was reset successfully. If USB_RESET_LVL_REATTACH is specified, reattaching was started successfully or a previous reset is still in progress.
The state of the device's parent hub is invalid (disconnected or suspended). This is called when the driver being detached. If USB_RESET_LVL_DEFAULT is specified, the device failed to be reset. If USB_RESET_LVL_REATTACH is specified, reattaching failed to start.
Invalid arguments.
The driver of the dip does not own the entire device.
If USB_RESET_LVL_DEFAULT is specified, one or more pipes other than the default control pipe are open on the device.
If USB_RESET_LVL_DEFAULT is specified, called from interrupt context
Example 1 Resetting a Device
The following example shows how a device is reset to recover it from an error state:
xxx_configure() { xxx_set_parameter1(); if (xxx_set_parameter2() == USB_FAILURE) { /* Close all the opened pipes except the default pipe */ xxx_close_all_opened_pipes(); /* Reset the device */ rval = usb_reset_device(dip, USB_RESET_LVL_DEFAULT); if (rval == USB_SUCCESS) { /* Re-configure the device */ xxx_set_parameter1(); xxx_set_parameter2(); /* Open the closed pipes if needed */ ... } else { /* Failed to reset the device, check the return value for further process */ ... } } }
Example 2 Resetting a Device After Downloading Firmware
The following example shows how a device is reset after downloading firmware. the device's descriptors change after the reset:
static int xxx_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { ... /* Download the firmware to the RAM of the device */ if (firmware_download() == USB_SUCCESS) { /* Reset the device and re-enumerate it */ rval = usb_reset_device(dip, USB_RESET_LVL_REATTACH); if (rval == USB_SUCCESS) { /* The re-enumeration has been started up, just return */ return (DDI_SUCCESS); } else { /* Failed to start the re-enumeration, check the return value for further process*/ ... return (DDI_FAILURE); } }
The usb_reset_device() function may be called from user or kernel context.
See attributes(5) for descriptions of the following attributes:
|
attributes(5), usb_clr_feature(9F), usb_get_cfg(9F), usb_pipe_close(9F), usb_pipe_open(9F), usb_pipe_reset(9F),
The messages described below may appear on the system console as well as being logged. All messages are formatted in the following manner:
WARNING: dev_path hubdinstance_num driver_name Error message ...
Bus power management is in process when calling the reset function, the device failed to be reset and stayed in the former state. Please disconnect and reconnect it to system.
The parent hub/root hub of this device is busy now. The device failed to be reset and stayed in the former state. Please disconnect the device, wait for a while and reconnect it to system.
The device is using by other applications, the related driver failed to be detached. Please make sure to close these applications before calling the reset function.
Always close all applications before resetting a device.