Writing Device Drivers

Device Macros

This section describes the kadb(1M) macros that can be used to retrieve information from the kernel about a device during a debugging session.

devinfo_brief

Prints a brief summary of a dev_info_t structure; the name and addr fields are shown in string form and are used in the /devices path to the node

devinfo

Prints devinfo_brief information for a dev_info_t structure followed by an in-order dump of all fields

devinfo.parent

Prints devinfo_brief information for the specified node and its parents all the way back to the root of the devinfo tree

devinfo.sibling

Prints devinfo_brief information for all siblings of the specified node; you see all sibling nodes if you start at the parent's child

devinfo.minor

Prints the ddi_minor_data structure for all minor name nodes associated with the specified device node

devinfo.prop

Prints all the property lists associated with the specified device node 

devinfo_major

Prints devinfo_brief information for all device nodes associated with the specified driver major number

devt

Breaks a dev_t into its major and minor parts and prints the values in hexadecimal and decimal

devnames

Prints the contents of the specified devnames structure

devnames_major

Prints the contents of the devnames structure for the specified major number

bus_op

Prints the contents of a bus_ops structure

The devinfo commands, such as devinfo and devinfo_brief, return a node_state value, which may be one of the following:

DS_LINKED

This device node has been linked into the kernel's device tree, but the system has not yet found a driver for it.

DS_BOUND

The node is bound to a driver, but the driver's probe(9E) routine has not yet been called.

DS_INITIALIZED

The parent nexus has assigned a bus address for the driver and completed implementation-specific initializations, but the driver's probe(9E) routine has not yet been called.

DS_PROBED

The driver's probe(9E) routine returned successfully.

DS_ATTACHED

The driver's attach(9E) routine returned successfully.

DS_READY

The device is fully configured.