Writing Device Drivers

Summary of Common Entry Points

The following table lists entry points that can be used by all types of drivers.

Table 1–1 Entry Points for All Driver Types

Category / Entry Point 

Usage 

Description 

cb_ops Entry Points

   

open(9E)

Required 

Gets access to a device. Additional information: 

close(9E)

Required 

Gives up access to a device. The version of close() for STREAMS drivers has a different signature than character and block drivers. Additional information:

Loadable Module Entry Points

   

_init(9E)

Required 

Initializes a loadable module. Additional information: Loadable Driver Interfaces

_fini(9E)

Required 

Prepares a loadable module for unloading. Required for all driver types. Additional information: Loadable Driver Interfaces

_info(9E)

Required 

Returns information about a loadable module. Additional information: Loadable Driver Interfaces

Autoconfiguration Entry Points

   

attach(9E)

Required 

Adds a device to the system as part of initialization. Also used to resume a system that has been suspended. Additional information: attach() Entry Point

detach(9E)

Required 

Detaches a device from the system. Also, used to suspend a device temporarily. Additional information: detach() Entry Point

getinfo(9E)

Required 

Gets device information that is specific to the driver, such as the mapping between a device number and the corresponding instance. Additional information: 

probe(9E)

See Description 

Determines if a non-self-identifying device is present. Required for a device that cannot identify itself. Additional information: 

Kernel Statistics Entry Points

   

ks_snapshot(9E)

Optional 

Takes a snapshot of kstat(9S) data. Additional information: Kernel Statistics

ks_update(9E)

Optional 

Updates kstat(9S) data dynamically. Additional information: Kernel Statistics

Power Management Entry Point

   

power(9E)

Required 

Sets the power level of a device. If not used, set to NULL. Additional information: power() Entry Point

System Quiesce Entry Point

   

quiesce(9E)

See Description 

Quiesces a device so that the device no longer generates interrupts or modifies or accesses memory. 

Miscellaneous Entry Points

   

prop_op(9E)

See Description 

Reports driver property information. Required unless ddi_prop_op(9F) is substituted. Additional information:

dump(9E)

See Description 

Dumps memory to a device during system failure. Required for any device that is to be used as the dump device during a panic. Additional information: 

identify(9E)

Obsolete 

Do not use this entry point. Assign nulldev(9F) to this entry point in the dev_ops structure.