Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ddi_get_devstate(9f) [sunos man page]

ddi_get_devstate(9F)					   Kernel Functions for Drivers 				      ddi_get_devstate(9F)

NAME
ddi_get_devstate - Check device state SYNOPSIS
#include <sys/ddi.h> #include <sys/sunddi.h> ddi_devstate_t ddi_get_devstate(dev_info_t *dip); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
dip Pointer to the device's dev_info structure DESCRIPTION
The ddi_get_devstate() function returns a value indicating the state of the device specified by dip, as derived from the configuration operations that have been performed on it (or on the bus on which it resides) and any fault reports relating to it. RETURN VALUES
DDI_DEVSTATE_OFFLINE The device is offline. In this state, the device driver is not attached, nor will it be attached automatically. The device cannot be used until it is brought online. DDI_DEVSTATE_DOWN The device is online but unusable due to a fault. DDI_DEVSTATE_QUIESCED The bus on which the device resides has been quiesced. This is not a fault, but no operations on the device should be performed while the bus remains quiesced. DDI_DEVSTATE_DEGRADED The device is online but only able to provide a partial or degraded service, due to a fault. DDI_DEVSTATE_UP The device is online and fully operational. CONTEXT
The ddi_get_devstate() function may be called from user, kernel, or interrupt context. NOTES
A device driver should call this function to check its own state at each major entry point, and before committing resources to a requested operation. If a driver discovers that its device is already down, it should perform required cleanup actions and return as soon as possi- ble. If appropriate, it should return an error to its caller, indicating that the device has failed (for example, a driver's read(9E) rou- tine would return EIO). Depending on the driver, some non-I/O operations (for example, calls to the driver's ioctl(9E) routine) may still succeed; only functions which would require fully accessible and operational hardware will necessarily fail. If the bus on which the device resides is quiesced, the driver may return a value indicating the operation should be retried later (for example, EAGAIN). Alternatively, for some classes of device, it may be appropriate for the driver to enqueue the operation and service it once the bus has been unquiesced. Note that not all busses support the quiesce/unquiesce operations, so this value may never be seen by some drivers. SEE ALSO
attach(9E), ioctl(9E), open(9E), read(9E), strategy(9E), write(9E), ddi_dev_report_fault(9F) SunOS 5.10 13 August 1999 ddi_get_devstate(9F)

Check Out this Related Man Page

DEVCTL(8)						    BSD System Manager's Manual 						 DEVCTL(8)

NAME
devctl -- device control utility SYNOPSIS
devctl attach device devctl detach [-f] device devctl disable [-f] device devctl enable device devctl suspend device devctl resume device devctl set driver [-f] device driver DESCRIPTION
The devctl utility adjusts the state of individual devices in the kernel's internal device hierarchy. Each invocation of devctl consists of a single command followed by command-specific arguments. Each command operates on a single device specified via the device argument. The device may be specified either as the name of an existing device or as a bus-specific address. More details on supported address formats can be found in devctl(3). The following commands are supported: attach device Force the kernel to re-probe the device. If a suitable driver is found, it is attached to the device. detach [-f] device Detach the device from its current device driver. If the -f flag is specified, the device driver will be detached even if the device is busy. disable [-f] device Disable a device. If the device is currently attached to a device driver, the device driver will be detached from the device, but the device will retain its current name. If the -f flag is specified, the device driver will be detached even if the device is busy. enable device Enable a device. The device will probe and attach if a suitable device driver is found. Note that this can re-enable a device dis- abled at boot time via a loader tunable. suspend device Suspend a device. This may include placing the device in a reduced power state. resume device Resume a suspended device to a fully working state. set driver [-f] device driver Force the device to use a device driver named driver. If the device is already attached to a device driver and the -f flag is speci- fied, the device will be detached from its current device driver before it is attached to the new device driver. If the device is already attached to a device driver and the -f flag is not specified, the device will not be changed. SEE ALSO
devctl(3), devinfo(8) HISTORY
The devctl utility first appeared in FreeBSD 11.0. BSD
February 5, 2015 BSD
Man Page