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

NAME


ddi_fm_init, ddi_fm_fini, ddi_fm_capable - initialize and get the FM
capabilities for a device instance capabilities for a device instance

SYNOPSIS


#include <sys/ddifm.h>

void
ddi_fm_init(dev_info_t *dip, int *fm_capability,
ddi_iblock_cookie_t *ibcp);

void
ddi_fm_fini(dev_info_t *dip);

int
ddi_fm_capable(dev_info_t *dip);

INTERFACE LEVEL


Committed - illumos DDI specific

Parameters
dip Pointer to the driver's dev_info structure.

fm_capability
Fault Management capability bit mask

ibcp Pointer to where the interrupt block cookie should be
returned.

DESCRIPTION


A device driver can declare its fault management capabilities to the I/O
Fault Management framework by calling the ddi_fm_init() function. The
ddi_fm_init() function allocates and initializes resources according to the
bitwise-inclusive-OR of the fault management capabilities, described in the
following and supported by the driver's immediate nexus parent.

DDI_FM_NOT_CAPABLE
The driver does not support any FMA features. This is the
default value assigned to device drivers.

If the value of the capability bits is equal to
DDI_FM_NOT_CAPABLE, then no capability bits will be set.
Conversely, if a capability bit is set, then the capability
value will not be equal to DDI_FM_NOT_CAPABLE.

DDI_FM_EREPORT_CAPABLE
The driver generates FMA protocol error events (ereports)
upon the detection of an error condition.

DDI_FM_ACCCHK_CAPABLE
The driver checks for errors upon the completion of one or
more access I/O transactions.

DDI_FM_DMACHK_CAPABLE
The driver checks for errors upon the completion of one or
more DMA I/O transactions.

DDI_FM_ERRCB_CAPABLE
The driver is capable of error handler callback registration.

If the parent nexus is not capable of supporting any one of the requested
capabilities, the associated bit will not be set and returned as such to
the driver. Before returning from ddi_fm_init(), the I/O Fault Management
framework creates a set of fault management capability properties:
fm-ereport-capable, fm-errcb-capable, fm-accchk-capable, and
fm-dmachk-capable. The current supported fault management capability
levels are observable via prtconf(8).

A driver can support the administrative selection of fault management
capabilities by exporting and setting a fault management capability level
property in its driver.conf(5) file to the values described above. The
fm_capable properties must be set and read prior to calling ddi_fm_init()
with the desired capability list.

The ddi_fm_fini() function cleans up the kernel infrastructure set up
during a call to the ddi_fm_init() function. If the driver did not call
ddi_fm_init() or the capability returned in fm_capability was
DDI_FM_NOT_CAPABLE then the driver must not call ddi_fm_fini().

The ddi_fm_capable() function returns the capability bit mask currently set
for the device instance identified by dip.

CONTEXT


The ddi_fm_init() and ddi_fm_fini() functions may only be called from
kernel context during a driver's attach(9E) and detach(9E) entry points.

RETURN VALUES


Upon successful completion, the ddi_fm_capable() function returns the FM
capability bit mask currently in use. If no capabilities are in use then
DDI_FM_NOT_CAPABLE is returned.

SEE ALSO


driver.conf(5), prtconf(8), attach(9E), detach(9E)


Writing Device Drivers.

illumos September 13, 2018 illumos