'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH DDI_INTR_GET_CAP 9F "Apr 20, 2005"
.SH NAME
ddi_intr_get_cap, ddi_intr_set_cap \- get or set interrupt capabilities for a
given interrupt type
.SH SYNOPSIS
.LP
.nf
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>

\fBint\fR \fBddi_intr_get_cap\fR(\fBddi_intr_handle_t\fR \fIh\fR, \fBint *\fR\fIflagsp\fR);
.fi

.LP
.nf
\fBint\fR \fBddi_intr_set_cap\fR(\fBddi_intr_handle_t\fR \fIh\fR, \fBint\fR \fIflags\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.sp
.LP
\fBddi_intr_get_cap()\fR
.sp
.ne 2
.na
\fB\fIh\fR\fR
.ad
.RS 10n
DDI interrupt handle
.RE

.sp
.ne 2
.na
\fB\fIflagsp\fR\fR
.ad
.RS 10n
Pointer to the capability flags returned for this handle
.RE

.sp
.LP
\fBddi_intr_set_cap()\fR
.sp
.ne 2
.na
\fB\fIh\fR\fR
.ad
.RS 9n
DDI interrupt handle
.RE

.sp
.ne 2
.na
\fB\fIflags\fR\fR
.ad
.RS 9n
Contains the capability flag to be set
.RE

.SH DESCRIPTION
.sp
.LP
The \fBddi_intr_get_cap()\fR function returns the interrupt capability flags
for the interrupt handle \fIh\fR. Upon a successful return, the flags are
returned in the integer pointed to by the \fIflagsp\fR argument.
.sp
.LP
These flags are typically combinations of the following:
.sp
.ne 2
.na
\fB\fBDDI_INTR_FLAG_EDGE\fR\fR
.ad
.RS 26n
For discrete interrupts, the host supports \fBedge\fR type of trigger. This
flag is not returned for \fBDDI_INTR_TYPE_MSI\fR or \fBDDI_INTR_TYPE_MSIX\fR
interrupt types. This is a read-write (RW) flag.
.RE

.sp
.ne 2
.na
\fB\fBDDI_INTR_FLAG_LEVEL\fR\fR
.ad
.RS 26n
For discrete interrupts the host supports \fBlevel\fR, \fBedge\fR, or both
types of triggers. This flag is not returned for \fBDDI_INTR_TYPE_MSI\fR or
\fBDDI_INTR_TYPE_MSIX\fR interrupt types.
.RE

.sp
.ne 2
.na
\fB\fBDDI_INTR_FLAG_MASKABLE\fR\fR
.ad
.RS 26n
The interrupt can be masked either by the device or by the host bridge, or
optionally by the host. This is a read-only (\fBRO\fR) flag.
.RE

.sp
.ne 2
.na
\fB\fBDDI_INTR_FLAG_PENDING\fR\fR
.ad
.RS 26n
The interrupt supports an interrupt pending bit. This is a read-only (\fBRO\fR)
flag.
.RE

.sp
.ne 2
.na
\fB\fBDDI_INTR_FLAG_BLOCK\fR\fR
.ad
.RS 26n
All interrupts of the given type must be block-enabled and are not individually
maskable. This is a read-only (\fBRO\fR) flag.
.RE

.sp
.LP
The \fBddi_intr_set_cap()\fR function allows a driver to specify the capability
flags for the interrupt handle \fIh\fR. Only \fBDDI_INTR_FLAG_LEVEL\fR and
\fBDDI_INTR_FLAG_EDGE\fR flags can be set. Some devices can support both level
and edge capability and either can be set by using the \fBddi_intr_set_cap()\fR
function. Setting the capability flags is device and platform dependent.
.sp
.LP
The \fBddi_intr_set_cap()\fR function can be called after interrupts are
allocated and prior to adding the interrupt handler. For all other times it
returns failure.
.SH RETURN VALUES
.sp
.LP
The \fBddi_intr_get_cap()\fR and \fBddi_intr_set_cap()\fR functions return:
.sp
.ne 2
.na
\fB\fBDDI_SUCCESS\fR\fR
.ad
.RS 15n
On success.
.RE

.sp
.ne 2
.na
\fB\fBDDI_EINVAL\fR\fR
.ad
.RS 15n
On encountering invalid input parameters.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FAILURE\fR\fR
.ad
.RS 15n
On any implementation specific failure.
.RE

.sp
.ne 2
.na
\fB\fBDDI_ENOTSUP\fR\fR
.ad
.RS 15n
On device not supporting operation.
.RE

.SH CONTEXT
.sp
.LP
The \fBddi_intr_get_cap()\fR and \fBddi_intr_set_cap()\fR functions can be
called from either user or kernel non-interrupt context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
.TE

.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5), \fBddi_intr_alloc\fR(9F), \fBddi_intr_block_enable\fR(9F),
\fBddi_intr_get_nintrs\fR(9F), \fBddi_intr_get_pending\fR(9F),
\fBddi_intr_get_supported_types\fR(9F), \fBddi_intr_set_mask\fR(9F)
.sp
.LP
\fIWriting Device Drivers\fR
.SH NOTES
.sp
.LP
Consumers of these interfaces should verify that the return value is not equal
to \fBDDI_SUCCESS\fR. Incomplete checking for failure codes could result in
inconsistent behavior among platforms.