NAME | SYNOPSIS | INTERFACE LEVEL | PARAMETERS | DESCRIPTION | RETURN VALUES | SEE ALSO
#include <sys/ddi.h> #include <sys/sunddi.h>int prefixattach(dev_info_t *dip, ddi_attach_cmd_t cmd);
Solaris DDI specific (Solaris DDI).
A pointer to the device's dev_info structure.
Attach type. Possible values are DDI_ATTACH, DDI_PM_RESUME, and DDI_RESUME. Other values are reserved. The driver must return DDI_FAILURE if reserved values are passed to it.
The attach() function is the device-specific initialization entry point. This entry point is required and must be written. The DDI_ATTACH command must be provided in the attach entry point. The DDI_PM_RESUME command is optional, but must be supported if the driver will support power management. See pm(7D). The DDI_RESUME command is optional, but must be supported if the driver will support the processes of suspend and resume. See cpr(7). When attach() is called with cmd set to DDI_ATTACH, all normal kernel services (such as kmem_alloc(9F)) are available for use by the driver. Device interrupts are not blocked when attaching a device to the system.
The attach() function will be called once for each instance of the device on the system with cmd set to DDI_ATTACH. Until attach() succeeds, the only driver entry points which may be called are open(9E) and getinfo(9E). See the "Autoconfiguration" chapter in Writing Device Drivers. The instance number may be obtained using ddi_get_instance(9F).
The attach() function may be called with cmd set to DDI_PM_RESUME after detach(9E) has been successfully called with cmd set to DDI_PM_SUSPEND. When called with cmd set to DDI_PM_RESUME, attach()must restore the hardware state of a device (power may have been removed from the device), allow pending requests to continue, and service new requests.
The driver must not make any assumptions about the state of the hardware, but must restore it to the state it had when the detach(9E) entry point was called with DDI_PM_SUSPEND.
The attach() function may be called with cmd set to DDI_RESUME after detach(9E) has been successfully called with cmd set to DDI_SUSPEND.
If the device is still suspended by DDI_PM_SUSPEND, the only effect of DDI_RESUME is to allow the driver to call ddi_dev_is_needed(9F) for any new or pending requests, as a subsequent call to attach() will be made with cmd set to DDI_PM_RESUME to restore the hardware state.
When called with cmd set to DDI_RESUME, attach() must restore the hardware state of a device (power may have been removed from the device) ,allow pending requests to continue, and service new requests. In this case, the driver must not make any assumptions about the state of the hardware, but must restore it to the state it had when the detach(9E) entry point was called with DDI_SUSPEND.
cpr(7), pm(7D), detach(9E), getinfo(9E), identify(9E), open(9E), pm(9E), probe(9E), ddi_add_intr(9F), ddi_create_minor_node(9F), ddi_get_instance(9F), ddi_map_regs(9F), kmem_alloc(9F)
NAME | SYNOPSIS | INTERFACE LEVEL | PARAMETERS | DESCRIPTION | RETURN VALUES | SEE ALSO