Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017
 
 

ddi_cb_get_flags (9F)

Name

ddi_cb_get_flags, ddi_cb_add_flags, ddi_cb_remove_flags - edit flags of a registered device driver callback handler

Synopsis

#include <sys/sunddi.h>
int ddi_cb_get_flags(ddi_cb_handle_t hdl, ddi_cb_flags_t *flagsp);
int ddi_cb_add_flags(ddi_cb_handle_t hdl, ddi_cb_flags_t flags);
int ddi_cb_remove_flags(ddi_cb_handle_t hdl, ddi_cb_flags_t flags);

Parameters

ddi_cb_get_flags()

hdl

Handle to the registered callback handler.

flagsp

Pointer to return the current flags settings.

ddi_cb_add_flags()

hdl

Handle to the registered callback handler.

flags

Flags to determine the callback events to add.

ddi_cb_remove_flags()

hdl

Handle to the registered callback handler.

flags

Flags to determine the callback events to remove.

Interface Level

Solaris DDI specific (Solaris DDI).

Description

The functions ddi_cb_get_flags(), ddi_cb_add_flags(), and ddi_cb_remove_flags() provide a driver with the option to selectively enable or disable support for specific types of callback actions for a registered callback handler.

The functions ddi_cb_register() and ddi_cb_unregister() can be used by a device driver to register and unregister a callback handler. During registration, a device driver specifies a set of flags indicating what callback actions it can process. After registration, the device driver may then receive any actions related to the specified flags.

If a device driver expects to process multiple types of callback actions, it might be difficult during attach(9E) to enable support for all callback actions simultaneously using the function ddi_cb_register(). In such cases, the device driver may register a callback handler with fewer flags specified (possibly even no flags), and then use the function ddi_cb_add_flags() to incrementally enable support for callback actions with more granularity during attach(9E). Likewise, the function ddi_cb_remove_flags() allows a device driver to incrementally teardown callback support during detach(9E).

The function ddi_cb_unregister() will unregister a device driver callback handler and disable all callback actions. There is no need to first remove flags using the function ddi_cb_remove_flags() before unregistering.

The flags parameter consists of the following:

DDI_CB_FLAG_INTR

The device driver participates in interrupt resource management. When this flag is set, the device driver may receive callback actions related to changes in interrupt availability.

DDI_CB_FLAG_SRIOV

Indicates to the DDI framework that the device driver is IOV capable. When this flag is set, the device driver may receive callback actions related to configuring or unconfiguring IOV virtual functions.

DDI_CB_FLAG_COMM

The device driver uses the pciv_send(9F) interfaces for inter- domain and intra-domain communication. When this flag is set, device drivers may receive callback actions notifying them about incoming data.

DDI_CB_FLAG_LSR

The device driver supports Live Suspend and Resume (LSR) operations. When this flag is set, a device driver may receive callback actions that describe the circumstances of I/O suspend and resume operations.

Return Values

The functions ddi_cb_get_flags(), ddi_cb_add_flags(), and ddi_cb_remove_flags() return:

DDI_SUCCESS

On success.

DDI_EINVAL

An invalid parameter was given. The callback handle was invalid or unregistered, the flagsp parameter for ddi_cb_get_flags() is invalid, or an invalid flags parameter was specified.

Context

These functions can be called from kernel, non-interrupt context.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Uncommitted
MT-Level
Unsafe

See Also

attributes(5), ddi_cb_register(9F)