Writing Device Drivers

Entry Points

Associated with each device driver is a dev_ops(9S) structure, which in turn refers to a cb_ops(9S) structure. These structures contain pointers to the driver entry points. Table 9-1 lists the character device driver autoconfiguration routines and entry points. Note that some of these entry points may be replaced with nodev(9F) or nulldev(9F) as appropriate.

Table 9-1 Character Driver Autoconfiguration Routines and Entry Points

Entry Point 

Description 

_init(9E) 

Initializes the loadable-driver module. 

_info(9E) 

Returns the loadable-driver module information. 

_fini(9E) 

Prepares a loadable-driver module for unloading. 

identify(9E) 

Obsolete and no longer required. Set to nulldev(9F)

probe(9E)  

Determines if a device is present. 

attach(9E) 

Performs device-specific initialization and/or power management resume functionality. 

detach(9E) 

Removes device-specific state and/or power management suspend functionality. 

getinfo(9E) 

Gets device driver information. 

power(9E) 

Sets the power level of a device component. 

open(9E) 

Gains access to a device. 

close(9E) 

Relinquishes access to a device. 

read(9E) 

Reads data from device. 

aread(9E) 

Reads data asynchronously from device.  

write(9E) 

Writes data to device. 

awrite(9E) 

Writes data asynchronously to device. 

ioctl(9E) 

Performs arbitrary operations. 

prop_op(9E) 

Manages arbitrary driver properties. 

devmap(9E) 

Validate and translate virtual mapping for a memory mapped device. 

mmap(9E)

Checks virtual mapping for a memory-mapped device. For new drivers, use the devmap(9E) entry point.

segmap(9E) 

Maps device memory into user space. 

chpoll(9E) 

Polls device for events.