1 '\" te 2 .\" Copyright (c) 2006, 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_GET_NINTRS 9F "Nov 13, 2006" 7 .SH NAME 8 ddi_intr_get_nintrs, ddi_intr_get_navail \- return number of interrupts 9 supported or available for a given interrupt type 10 .SH SYNOPSIS 11 .LP 12 .nf 13 #include <sys/types.h> 14 #include <sys/conf.h> 15 #include <sys/ddi.h> 16 #include <sys/sunddi.h> 17 18 \fBint\fR \fBddi_intr_get_nintrs\fR(\fBdev_info_t *\fR\fIdip\fR, \fBint\fR \fItype\fR, \fBint *\fR\fInintrsp\fR); 19 .fi 20 21 .LP 22 .nf 23 \fBint\fR \fBddi_intr_get_navail\fR(\fBdev_info_t *\fR\fIdip\fR, \fBint\fR \fItype\fR, \fBint *\fR\fInavailp\fR); 24 .fi 25 26 .SH INTERFACE LEVEL 27 .sp 28 .LP 29 Solaris DDI specific (Solaris DDI). 30 .SH PARAMETERS 31 .sp 32 .LP 33 \fBddi_intr_get_nintrs()\fR 34 .sp 35 .ne 2 36 .na 37 \fB\fIdip\fR\fR 38 .ad 39 .RS 11n 40 Pointer to \fBdev_info\fR structure 41 .RE 42 43 .sp 44 .ne 2 45 .na 46 \fB\fItype\fR\fR 47 .ad 48 .RS 11n 49 Interrupt type 50 .RE 51 52 .sp 53 .ne 2 54 .na 55 \fB\fInintrsp\fR\fR 56 .ad 57 .RS 11n 58 Pointer to number of interrupts of the given type that are supported by the 59 system 60 .RE 61 62 .sp 63 .LP 64 \fBddi_intr_get_navail()\fR 65 .sp 66 .ne 2 67 .na 68 \fB\fIdip\fR\fR 69 .ad 70 .RS 11n 71 Pointer to \fBdev_info\fR structure 72 .RE 73 74 .sp 75 .ne 2 76 .na 77 \fB\fItype\fR\fR 78 .ad 79 .RS 11n 80 Interrupt type 81 .RE 82 83 .sp 84 .ne 2 85 .na 86 \fB\fInavailp\fR\fR 87 .ad 88 .RS 11n 89 Pointer to number of interrupts of the given type that are currently available 90 from the system 91 .RE 92 93 .SH DESCRIPTION 94 .sp 95 .LP 96 The \fBddi_intr_get_nintrs()\fR function returns the number of interrupts of 97 the given \fItype\fR supported by a particular hardware device. On a successful 98 return, the number of supported interrupts is returned as an integer pointed to 99 by the \fInintrsp\fR argument. 100 .sp 101 .LP 102 If the hardware device is not found to support any interrupts of the given 103 \fItype\fR, the \fBDDI_INTR_NOTFOUND\fR failure is returned rather than a zero 104 in \fInintrsp\fR. 105 .sp 106 .LP 107 The \fBddi_intr_get_navail()\fR function returns the number of interrupts of a 108 given \fItype\fR that is available to a particular hardware device. On a 109 successful return, the number of available interrupts is returned as an integer 110 pointed to by \fInavailp\fR. 111 .sp 112 .LP 113 The hardware device may support more than one interrupt and can request that 114 all interrupts be allocated. The host software can then use policy-based 115 decisions to determine how many interrupts are made available to the device. 116 Based on the determination, a value is returned that should be used to allocate 117 interrupts with the \fBddi_int_alloc()\fR function. 118 .sp 119 .LP 120 The \fBddi_intr_get_supported_types\fR(9F) function returns a list of valid 121 supported types for the given hardware device. It must be called prior to 122 calling either the \fBddi_intr_get_nintrs()\fR or \fBddi_intr_get_navail()\fR. 123 .SH RETURN VALUES 124 .sp 125 .LP 126 The \fBddi_intr_get_nintrs()\fR and \fBddi_intr_get_navail()\fR functions 127 return: 128 .sp 129 .ne 2 130 .na 131 \fB\fBDDI_SUCCESS\fR\fR 132 .ad 133 .RS 21n 134 On success. 135 .RE 136 137 .sp 138 .ne 2 139 .na 140 \fB\fBDDI_EINVAL\fR\fR 141 .ad 142 .RS 21n 143 On encountering invalid input parameters. 144 .RE 145 146 .sp 147 .ne 2 148 .na 149 \fB\fBDDI_INTR_NOTFOUND\fR\fR 150 .ad 151 .RS 21n 152 On not finding any interrupts for the given interrupt type. 153 .RE 154 155 .sp 156 .ne 2 157 .na 158 \fB\fBDDI_FAILURE\fR\fR 159 .ad 160 .RS 21n 161 On any implementation specific failure. 162 .RE 163 164 .SH CONTEXT 165 .sp 166 .LP 167 The \fBddi_intr_get_nintrs()\fR and \fBddi_intr_get_navail()\fR functions can 168 be called from either user or kernel non-interrupt context. 169 .SH ATTRIBUTES 170 .sp 171 .LP 172 See \fBattributes\fR(5) for descriptions of the following attributes: 173 .sp 174 175 .sp 176 .TS 177 box; 178 c | c 179 l | l . 180 ATTRIBUTE TYPE ATTRIBUTE VALUE 181 _ 182 Interface Stability Committed 183 .TE 184 185 .SH SEE ALSO 186 .sp 187 .LP 188 \fBattributes\fR(5), \fBddi_intr_alloc\fR(9F), \fBddi_intr_enable\fR(9F), 189 \fBddi_intr_get_supported_types\fR(9F) 190 .sp 191 .LP 192 \fIWriting Device Drivers\fR 193 .SH NOTES 194 .sp 195 .LP 196 The \fBddi_intr_get_nintrs()\fR and \fBddi_intr_get_navail()\fR functions can 197 be called at any time, even if the driver has added an interrupt handler for a 198 given interrupt specification. 199 .sp 200 .LP 201 On x86 platforms, the number of interrupts returned by the 202 \fBddi_intr_get_navail()\fR function might need to be further reduced by the 203 number of interrupts available for each interrupt priority on the system. In 204 that case, drivers should use different priorities for some of the interrupts. 205 .sp 206 .LP 207 Consumers of these interfaces should verify that the return value is not equal 208 to \fBDDI_SUCCESS\fR. Incomplete checking for failure codes could result in 209 inconsistent behavior among platforms.