Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

identify(9E)

probe(9E)

ddi_add_intr(9F)

ddi_create_minor_node(9F)

ddi_get_instance(9F)

ddi_map_regs(9F)

kmem_alloc(9F)

attach(9E)

NAME

attach − attach a device to the system

SYNOPSIS

#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>

int prefixattach(dev_info_t ∗dip,
ddi_attach_cmd_t cmd);

INTERFACE LEVEL

Solaris DDI specific (Solaris DDI).  This entry point is required and must be written. 

ARGUMENTS

dip A pointer to the device’s dev_info structure. 

cmd Attach type. Should be set to DDI_ATTACH. Other values are reserved.  The driver should return DDI_FAILURE if reserved values are passed to it. 

DESCRIPTION

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 Writing Device Drivers.  The instance number may be obtained using ddi_get_instance(9F). 

Successful returns from identify(9E) and probe(9E) are required before a call to the driver’s attach() entry point will be made. 

RETURN VALUES

attach() should return:

DDI_SUCCESS on success. 

DDI_FAILURE on failure. 

SEE ALSO

identify(9E), probe(9E), ddi_add_intr(9F), ddi_create_minor_node(9F), ddi_get_instance(9F), ddi_map_regs(9F), kmem_alloc(9F),

Writing Device Drivers

SunOS 5.5/SPARC  —  Last change: 3 Dec 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026