2 .\" Copyright (c) 2005, 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_INTR_ENABLE 9F "Apr 22, 2005"
8 ddi_intr_enable, ddi_intr_block_enable, ddi_intr_disable,
9 ddi_intr_block_disable \- enable or disable a given interrupt or range of
14 #include <sys/types.h>
17 #include <sys/sunddi.h>
21 \fBint\fR \fBddi_intr_enable\fR(\fBddi_intr_handle_t\fR \fIh\fR);
26 \fBint\fR \fBddi_intr_block_enable\fR(\fBddi_intr_handle_t *\fR\fIh_array\fR, \fBint\fR \fIcount\fR);
31 \fBint\fR \fBddi_intr_disable\fR(\fBddi_intr_handle_t\fR \fIh\fR);
36 \fBint\fR \fBddi_intr_block_disable\fR(\fBddi_intr_handle_t *\fR\fIh_array\fR, \fBint\fR \fIcount\fR);
42 Solaris DDI specific (Solaris DDI).
46 \fBddi_intr_enable()\fR
58 \fBddi_intr_block_enable()\fR
65 Pointer to an array of DDI interrupt handles
79 \fBddi_intr_disable()\fR
91 \fBddi_intr_block_disable()\fR
98 Pointer to an array of DDI interrupt handles
113 The \fBddi_intr_enable()\fR function enables the interrupt given by the
114 interrupt handle \fIh\fR.
117 The \fBddi_intr_block_enable()\fR function enables a range of interrupts given
118 by the \fIcount\fR and \fIh_array\fR arguments, where \fIcount\fR must be at
119 least \fB1\fR and \fIh_array\fR is pointer to a count-sized array of interrupt
123 The \fBddi_intr_block_enable()\fR function can be used only if the device or
124 host bridge supports the block enable/disable feature. The
125 \fBddi_intr_get_cap()\fR function returns the \fBRO\fR flag
126 \fBDDI_INTR_FLAG_BLOCK\fR if the device or host bridge supports the interrupt
127 block enable/disable feature for the given interrupt type. The
128 \fBddi_intr_block_enable()\fR function is useful for enabling MSI interrupts
129 when the optional per-vector masking capability is not supported.
132 The \fBddi_intr_enable()\fR or \fBddi_intr_block_enable()\fR functions must be
133 called after the required interrupt resources are allocated with
134 \fBddi_intr_alloc()\fR, the interrupt handlers are added through
135 \fBddi_intr_add_handler()\fR, and the required locks are initialized by
136 \fBmutex\fR(9F) or \fBrwlock\fR(9F).
139 Once enabled by either of the enable calls, the interrupt can be taken and
140 passed to the driver's interrupt service routine. Enabling an interrupt implies
141 clearing any system or device mask bits associated with the interrupt.
144 The \fBddi_intr_disable()\fR function disables the interrupt given by the
145 interrupt handle \fIh\fR.
148 The \fBddi_intr_block_disable()\fR function disables a range of interrupts
149 given by the \fIcount\fR and \fIh_array\fR arguments, where \fIcount\fR must be
150 at least \fB1\fR and \fIh_array\fR is pointer to a count-sized array of
154 The \fBddi_intr_block_disable()\fR function can be used only if the device or
155 host bridge supports the block enable/disable feature. The
156 \fBddi_intr_get_cap()\fR function returns the \fBRO\fR flag
157 \fBDDI_INTR_FLAG_BLOCK\fR if the device or host bridge supports the interrupt
158 block enable/disable feature for the given interrupt type. The
159 \fBddi_intr_block_disable()\fR function is useful for disabling MSI interrupts
160 when the optional per-vector masking capability is not supported.
163 The \fBddi_intr_disable()\fR or \fBddi_intr_block_disable()\fR functions must
164 be called before removing the interrupt handler and freeing the corresponding
165 interrupt with \fBddi_intr_remove_handler()\fR and \fBddi_intr_free()\fR,
166 respectively. The \fBddi_intr_block_disable()\fR function should be called if
167 the \fBddi_intr_block_enable()\fR function was used to enable the interrupts.
171 The \fBddi_intr_enable()\fR, \fBddi_intr_block_enable()\fR,
172 \fBddi_intr_disable()\fR, and \fBddi_intr_block_disable()\fR functions return:
176 \fB\fBDDI_SUCCESS\fR\fR
185 \fB\fBDDI_EINVAL\fR\fR
188 On encountering invalid input parameters.
194 \fB\fBDDI_FAILURE\fR\fR
197 On any implementation specific failure.
203 The \fBddi_intr_enable()\fR, \fBddi_intr_block_enable()\fR,
204 \fBddi_intr_disable()\fR, and \fBddi_intr_block_disable()\fR functions can be
205 called from kernel non-interrupt context.
209 See \fBattributes\fR(5) for descriptions of the following attributes:
217 ATTRIBUTE TYPE ATTRIBUTE VALUE
219 Interface Stability Committed
225 \fBattributes\fR(5), \fBddi_intr_add_handler\fR(9F), \fBddi_intr_alloc\fR(9F),
226 \fBddi_intr_dup_handler\fR(9F), \fBddi_intr_free\fR(9F),
227 \fBddi_intr_get_cap\fR(9F), \fBddi_intr_remove_handler\fR(9F), \fBmutex\fR(9F),
231 \fIWriting Device Drivers\fR
235 Consumers of these interfaces should verify that the return value is not equal
236 to \fBDDI_SUCCESS\fR. Incomplete checking for failure codes could result in
237 inconsistent behavior among platforms.
240 If a device driver that uses \fBMSI\fR and \fBMSI-X\fR interrupts resets the
241 device, the device might reset its configuration space modifications. Such a
242 reset could cause a device driver to lose any \fBMSI\fR and \fBMSI-X\fR
243 interrupt usage settings that have been applied.