#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> int prefixattach(dev_info_t *dip, ddi_attach_cmd_t cmd);
attach() is the device-specific initialization entry point. 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.
attach() will be called once for each instance of the device on the system. Until attach() succeeds, the only driver entry points which may be called are open(9E) and getinfo(9E) . See the "Autoconfiguration" chapter in The instance number may be obtained using ddi_get_instance(9F) .
A successful return from probe(9E) is required before a call to the driver’s attach() entry point will be made.