9022 loader.efi: module placement must check memory map
[unleashed.git] / share / man / man9f / ddi_add_event_handler.9f
blob4941b8af3f8be80e0358275c427cdc33a928cb61
1 '\" te
2 .\"  Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DDI_ADD_EVENT_HANDLER 9F "Nov 2, 2003"
7 .SH NAME
8 ddi_add_event_handler \- add an NDI event service callback handler
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/dditypes.h>
13 #include <sys/sunddi.h>
15 \fBint\fR \fBddi_add_event_handler\fR(\fBdev_info_t *\fR\fIdip\fR, \fBddi_eventcookie_t\fR \fIcookie\fR,
16      \fBvoid (*\fR\fIhandler\fR)(dev_info_t *, ddi_eventcookie_t, void *, void *),
17      \fBvoid *\fR\fIarg\fR, \fBddi_registration_id_t *\fR\fIid\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Solaris DDI specific (Solaris DDI).
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fBdev_info_t *\fR\fIdip\fR\fR
29 .ad
30 .sp .6
31 .RS 4n
32 Device node registering the callback.
33 .RE
35 .sp
36 .ne 2
37 .na
38 \fB\fBddi_eventcookie_t\fR \fIcookie\fR\fR
39 .ad
40 .sp .6
41 .RS 4n
42 Cookie returned from call to \fBddi_get_eventcookie\fR(9F).
43 .RE
45 .sp
46 .ne 2
47 .na
48 \fB\fBvoid (*\fR\fIhandler\fR\fB)(dev_info_t *, ddi_eventcookie_t, void *, void
49 *)\fR\fR
50 .ad
51 .sp .6
52 .RS 4n
53 Callback handler responsible for handling an NDI event service notification.
54 .RE
56 .sp
57 .ne 2
58 .na
59 \fB\fBvoid *\fR\fIarg\fR\fR
60 .ad
61 .sp .6
62 .RS 4n
63 Pointer to opaque data supplied by the caller. Typically, this would be a
64 pointer to the driver's \fBsoftstate\fR structure.
65 .RE
67 .sp
68 .ne 2
69 .na
70 \fB\fBddi_registration_id_t *\fR\fIid\fR\fR
71 .ad
72 .sp .6
73 .RS 4n
74 Pointer to registration ID where a unique registration id will be returned.
75 Registration ID must be saved and used when calling
76 \fBddi_remove_event_handler\fR(9F) to unregister a callback.
77 .RE
79 .SH DESCRIPTION
80 .sp
81 .LP
82 The \fBddi_add_event_handler()\fR function adds a callback handler to be
83 invoked in the face of the event specifed by \fIcookie\fR. The process of
84 adding a callback handler is also known as subscribing to an event. Upon
85 successful subscription, the handler will be invoked by the system when the
86 event occurs. The handler can be unregistered by using
87 \fBddi_remove_event_handler\fR(9F).
88 .sp
89 .LP
90 An instance of a driver can register multiple handlers for an event or a single
91 handler for multiple events. Callback order is not defined and should assumed
92 to be random.
93 .sp
94 .LP
95 The routine handler will be invoked with the following arguments:
96 .sp
97 .ne 2
98 .na
99 \fB\fBdev_info_t *\fR\fIdip\fR\fR
101 .RS 28n
102 Device node requesting the notification.
106 .ne 2
108 \fB\fBddi_eventcookie_t\fR \fIcookie\fR\fR
110 .RS 28n
111 Structure describing event that occurred.
115 .ne 2
117 \fB\fBvoid *\fR\fIarg\fR\fR
119 .RS 28n
120 Opaque data pointer provided, by the driver, during callback registration.
124 .ne 2
126 \fB\fBvoid *\fR\fIimpl_data\fR\fR
128 .RS 28n
129 Pointer to event specific data defined by the framework which invokes the
130 callback function.
133 .SH RETURN VALUES
135 .ne 2
137 \fB\fBDDI_SUCCESS\fR\fR
139 .RS 15n
140 Callback handler registered successfully.
144 .ne 2
146 \fB\fBDDI_FAILURE\fR\fR
148 .RS 15n
149 Failed to register callback handler. Possible reasons include lack of resources
150 or a bad cookie.
153 .SH CONTEXT
156 The \fBddi_add_event_handler()\fR and \fBhandler()\fR function can be called
157 from user and kernel contexts only.
158 .SH ATTRIBUTES
161 See \fBattributes\fR(5) for a description of the following attributes:
166 box;
167 c | c
168 l | l .
169 ATTRIBUTE TYPE  ATTRIBUTE VALUE
171 Stability Level Committed
174 .SH SEE ALSO
177 \fBattributes\fR(5), \fBddi_get_eventcookie\fR(9F),
178 \fBddi_remove_event_handler\fR(9F)
181 \fIWriting Device Drivers\fR
182 .SH NOTES
185 Drivers must remove all registered callback handlers for a device instance by
186 calling \fBddi_remove_event_handler\fR(9F) before detach completes.