man Pages(9E): DDI and DKI Driver Entry Points
검색에만이 책은
PDF로 이 문서 다운로드

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)

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.

INTERFACE LEVEL

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

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. See BUGS section below.
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), timeout(9F)
Writing Device Drivers

BUGS

Drivers which are initialized at boot time (i.e., drivers that are attached before the root filesystem is mounted) must complete initialization without assuming that device interrupts can occur. This includes the system clock; therefore, system timer services as described in timeout(9F) cannot be assumed to be functioning correctly when this entry point is called.