xref: /titanic_51/usr/src/uts/common/sys/ddi_intr.h (revision 657f87de670449e1422db4f51fb2880a7cb69d5a)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55febcb4aSScott Carter, SD IOSW  * Common Development and Distribution License (the "License").
65febcb4aSScott Carter, SD IOSW  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*657f87deSgongtian zhao - Sun Microsystems - Beijing China  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_SYS_DDI_INTR_H
267c478bd9Sstevel@tonic-gate #define	_SYS_DDI_INTR_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * Sun DDI interrupt support definitions
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/ddipropdefs.h>
337c478bd9Sstevel@tonic-gate #include <sys/rwlock.h>
3409b1eac2SEvan Yan #include <sys/processor.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef _KERNEL
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Interrupt related definitions.
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Returned by ddi_add_intr or ddi_add_fastintr in order to signal
487c478bd9Sstevel@tonic-gate  * the the caller requested interrupt number to be added does not
497c478bd9Sstevel@tonic-gate  * exist.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	DDI_INTR_NOTFOUND	1	/* interrupt not found error */
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * For use by driver interrupt service routines to return to the
557c478bd9Sstevel@tonic-gate  * system whether an interrupt was for the driver or not.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	DDI_INTR_CLAIMED	1	/* returned when driver claims intr */
587c478bd9Sstevel@tonic-gate #define	DDI_INTR_UNCLAIMED	0	/* returned when driver does not */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /* Hardware interrupt types */
617c478bd9Sstevel@tonic-gate #define	DDI_INTR_TYPE_FIXED	0x1
627c478bd9Sstevel@tonic-gate #define	DDI_INTR_TYPE_MSI	0x2
637c478bd9Sstevel@tonic-gate #define	DDI_INTR_TYPE_MSIX	0x4
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /* Hardware interrupt priority must be a number within these min/max values */
667c478bd9Sstevel@tonic-gate #define	DDI_INTR_PRI_MIN	1
677c478bd9Sstevel@tonic-gate #define	DDI_INTR_PRI_MAX	12
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* Soft priority must be a number within these min/max values */
707c478bd9Sstevel@tonic-gate #define	DDI_INTR_SOFTPRI_MIN	1
717c478bd9Sstevel@tonic-gate #define	DDI_INTR_SOFTPRI_MAX	9
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /* Used in calls to allocate soft interrupt priority. */
747c478bd9Sstevel@tonic-gate #define	DDI_INTR_SOFTPRI_DEFAULT	DDI_INTR_SOFTPRI_MIN
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * Interrupt flags specify certain capabilities for a given
787c478bd9Sstevel@tonic-gate  * interrupt (by type and inum).
797c478bd9Sstevel@tonic-gate  * RO/RW refer to use by ddi_intr_set_cap(9f)
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  * DDI_INTR_FLAG_MSI64 is an internal flag not exposed to leaf drivers.
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate #define	DDI_INTR_FLAG_LEVEL	0x0001	/* (RW) level trigger */
847c478bd9Sstevel@tonic-gate #define	DDI_INTR_FLAG_EDGE	0x0002	/* (RW) edge triggered */
857c478bd9Sstevel@tonic-gate #define	DDI_INTR_FLAG_MASKABLE	0x0010	/* (RO) maskable */
867c478bd9Sstevel@tonic-gate #define	DDI_INTR_FLAG_PENDING	0x0020	/* (RO) int pending supported */
877c478bd9Sstevel@tonic-gate #define	DDI_INTR_FLAG_BLOCK	0x0100	/* (RO) requires block enable */
8809b1eac2SEvan Yan #define	DDI_INTR_FLAG_MSI64	0x0200	/* (RO) MSI/X supports 64 bit addr */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
91a195726fSgovinda  * Macro to be used while passing interrupt priority
92a195726fSgovinda  * for lock initialization.
93a195726fSgovinda  */
94a195726fSgovinda #define	DDI_INTR_PRI(pri)	(void *)((uintptr_t)(pri))
95a195726fSgovinda 
96a195726fSgovinda /*
977c478bd9Sstevel@tonic-gate  * Typedef for interrupt handles
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate typedef struct __ddi_intr_handle *ddi_intr_handle_t;
1007c478bd9Sstevel@tonic-gate typedef struct __ddi_softint_handle *ddi_softint_handle_t;
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * Definition for behavior flag which is used with ddi_intr_alloc(9f).
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate #define	DDI_INTR_ALLOC_NORMAL	0	/* Non-strict alloc */
1067c478bd9Sstevel@tonic-gate #define	DDI_INTR_ALLOC_STRICT	1	/* Strict allocation */
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * Typedef for driver's interrupt handler
1107c478bd9Sstevel@tonic-gate  */
1117c478bd9Sstevel@tonic-gate typedef uint_t (ddi_intr_handler_t)(caddr_t arg1, caddr_t arg2);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1147c478bd9Sstevel@tonic-gate #include <sys/ddi_intr_impl.h>
1157c478bd9Sstevel@tonic-gate #ifdef _KERNEL
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /*
1187c478bd9Sstevel@tonic-gate  * DDI interrupt function prototypes.
1197c478bd9Sstevel@tonic-gate  *
1207c478bd9Sstevel@tonic-gate  * New DDI interrupt interfaces.
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * ddi_intr_get_supported_types:
1257c478bd9Sstevel@tonic-gate  *
1267c478bd9Sstevel@tonic-gate  *	Return, as a bit mask, the hardware interrupt types supported by
1277c478bd9Sstevel@tonic-gate  *	both the device and by the host in the integer pointed
1287c478bd9Sstevel@tonic-gate  *	to be the 'typesp' argument.
1297c478bd9Sstevel@tonic-gate  */
1307c478bd9Sstevel@tonic-gate int	ddi_intr_get_supported_types(dev_info_t *dip, int *typesp);
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * ddi_intr_get_nintrs:
1347c478bd9Sstevel@tonic-gate  *
1357c478bd9Sstevel@tonic-gate  * 	Return as an integer in the integer pointed to by the argument
1367c478bd9Sstevel@tonic-gate  * 	*nintrsp*, the number of interrupts the device supports for the
1377c478bd9Sstevel@tonic-gate  *	given interrupt type.
1387c478bd9Sstevel@tonic-gate  */
1397c478bd9Sstevel@tonic-gate int	ddi_intr_get_nintrs(dev_info_t *dip, int type, int *nintrsp);
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * ddi_intr_get_navail:
1437c478bd9Sstevel@tonic-gate  *
1447c478bd9Sstevel@tonic-gate  * 	Return as an integer in the integer pointed to by the argument
1457c478bd9Sstevel@tonic-gate  * 	*navailp*, the number of interrupts currently available for the
1467c478bd9Sstevel@tonic-gate  *	given interrupt type.
1477c478bd9Sstevel@tonic-gate  */
1487c478bd9Sstevel@tonic-gate int	ddi_intr_get_navail(dev_info_t *dip, int type, int *navailp);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Interrupt resource allocate/free functions
1527c478bd9Sstevel@tonic-gate  */
1537c478bd9Sstevel@tonic-gate int	ddi_intr_alloc(dev_info_t *dip, ddi_intr_handle_t *h_array,
1547c478bd9Sstevel@tonic-gate 	    int type, int inum, int count, int *actualp, int behavior);
1557c478bd9Sstevel@tonic-gate int	ddi_intr_free(ddi_intr_handle_t h);
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /*
1587c478bd9Sstevel@tonic-gate  * Interrupt get/set capacity functions
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate int	ddi_intr_get_cap(ddi_intr_handle_t h, int *flagsp);
1617c478bd9Sstevel@tonic-gate int	ddi_intr_set_cap(ddi_intr_handle_t h, int flags);
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * Interrupt priority management functions
1657c478bd9Sstevel@tonic-gate  */
1667c478bd9Sstevel@tonic-gate uint_t	ddi_intr_get_hilevel_pri(void);
1677c478bd9Sstevel@tonic-gate int	ddi_intr_get_pri(ddi_intr_handle_t h, uint_t *prip);
1687c478bd9Sstevel@tonic-gate int	ddi_intr_set_pri(ddi_intr_handle_t h, uint_t pri);
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate /*
1717c478bd9Sstevel@tonic-gate  * Interrupt add/duplicate/remove functions
1727c478bd9Sstevel@tonic-gate  */
1737c478bd9Sstevel@tonic-gate int	ddi_intr_add_handler(ddi_intr_handle_t h,
1747c478bd9Sstevel@tonic-gate 	    ddi_intr_handler_t inthandler, void *arg1, void *arg2);
1757c478bd9Sstevel@tonic-gate int	ddi_intr_dup_handler(ddi_intr_handle_t org, int vector,
1767c478bd9Sstevel@tonic-gate 	    ddi_intr_handle_t *dup);
1777c478bd9Sstevel@tonic-gate int	ddi_intr_remove_handler(ddi_intr_handle_t h);
1787c478bd9Sstevel@tonic-gate 
17909b1eac2SEvan Yan 
18009b1eac2SEvan Yan /*
1817c478bd9Sstevel@tonic-gate  * Interrupt enable/disable/block_enable/block_disable functions
1827c478bd9Sstevel@tonic-gate  */
1837c478bd9Sstevel@tonic-gate int	ddi_intr_enable(ddi_intr_handle_t h);
1847c478bd9Sstevel@tonic-gate int	ddi_intr_disable(ddi_intr_handle_t h);
1857c478bd9Sstevel@tonic-gate int	ddi_intr_block_enable(ddi_intr_handle_t *h_array, int count);
1867c478bd9Sstevel@tonic-gate int	ddi_intr_block_disable(ddi_intr_handle_t *h_array, int count);
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate /*
1897c478bd9Sstevel@tonic-gate  * Interrupt set/clr mask functions
1907c478bd9Sstevel@tonic-gate  */
1917c478bd9Sstevel@tonic-gate int	ddi_intr_set_mask(ddi_intr_handle_t h);
1927c478bd9Sstevel@tonic-gate int	ddi_intr_clr_mask(ddi_intr_handle_t h);
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /*
1957c478bd9Sstevel@tonic-gate  * Interrupt get pending function
1967c478bd9Sstevel@tonic-gate  */
1977c478bd9Sstevel@tonic-gate int	ddi_intr_get_pending(ddi_intr_handle_t h, int *pendingp);
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate /*
20009b1eac2SEvan Yan  * Interrupt resource management function
20109b1eac2SEvan Yan  */
20209b1eac2SEvan Yan int	ddi_intr_set_nreq(dev_info_t *dip, int nreq);
20309b1eac2SEvan Yan 
20409b1eac2SEvan Yan /*
2057c478bd9Sstevel@tonic-gate  * Soft interrupt functions
2067c478bd9Sstevel@tonic-gate  */
2077c478bd9Sstevel@tonic-gate int	ddi_intr_add_softint(dev_info_t *dip, ddi_softint_handle_t *h,
2087c478bd9Sstevel@tonic-gate 	    int soft_pri, ddi_intr_handler_t handler, void *arg1);
2097c478bd9Sstevel@tonic-gate int	ddi_intr_remove_softint(ddi_softint_handle_t h);
2107c478bd9Sstevel@tonic-gate int	ddi_intr_trigger_softint(ddi_softint_handle_t h, void *arg2);
2117c478bd9Sstevel@tonic-gate int	ddi_intr_get_softint_pri(ddi_softint_handle_t h, uint_t *soft_prip);
2127c478bd9Sstevel@tonic-gate int	ddi_intr_set_softint_pri(ddi_softint_handle_t h, uint_t soft_pri);
2137c478bd9Sstevel@tonic-gate 
2145febcb4aSScott Carter, SD IOSW /*
2157c478bd9Sstevel@tonic-gate  * Old DDI interrupt interfaces.
216a195726fSgovinda  *
217a195726fSgovinda  * The following DDI interrupt interfaces are obsolete.
218a195726fSgovinda  * Use the above new DDI interrupt interfaces instead.
2197c478bd9Sstevel@tonic-gate  */
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * Return non-zero if the specified interrupt exists and the handler
2237c478bd9Sstevel@tonic-gate  * will be restricted to using only certain functions because the
2247c478bd9Sstevel@tonic-gate  * interrupt level is not blocked by the scheduler.  I.e., it cannot
2257c478bd9Sstevel@tonic-gate  * signal other threads.
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate int	ddi_intr_hilevel(dev_info_t *dip, uint_t inumber);
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate int	ddi_get_iblock_cookie(dev_info_t *dip, uint_t inumber,
2307c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t *iblock_cookiep);
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate /*
2337c478bd9Sstevel@tonic-gate  * ddi_dev_nintrs
2347c478bd9Sstevel@tonic-gate  *
2357c478bd9Sstevel@tonic-gate  *	If the device has h/w interrupt(s), report
2367c478bd9Sstevel@tonic-gate  *	how many of them that there are into resultp.
2377c478bd9Sstevel@tonic-gate  *	Return DDI_FAILURE if the device has no interrupts.
2387c478bd9Sstevel@tonic-gate  */
2397c478bd9Sstevel@tonic-gate int	ddi_dev_nintrs(dev_info_t *dev, int *resultp);
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate /*
2427c478bd9Sstevel@tonic-gate  * ddi_add_intr: Add an interrupt to the system.
2437c478bd9Sstevel@tonic-gate  *
2447c478bd9Sstevel@tonic-gate  *	The interrupt number "inumber" determines which interrupt will
2457c478bd9Sstevel@tonic-gate  *	be added. The interrupt number is associated with interrupt
2467c478bd9Sstevel@tonic-gate  *	information provided from self identifying devices or configuration
2477c478bd9Sstevel@tonic-gate  *	information for non-self identifying devices. If only one interrupt
2487c478bd9Sstevel@tonic-gate  *	is associated with the device then the interrupt number should be 0.
2497c478bd9Sstevel@tonic-gate  *
2507c478bd9Sstevel@tonic-gate  *	If successful, "*iblock_cookiep" will contain information necessary
2517c478bd9Sstevel@tonic-gate  *	for initializing locks (mutex_init, cv_init, etc.) as well as for
2527c478bd9Sstevel@tonic-gate  *	possible later removal of the interrupt from the system.
2537c478bd9Sstevel@tonic-gate  *
2547c478bd9Sstevel@tonic-gate  *	If successful, "*idevice_cookiep" will contain the correct programmable
2557c478bd9Sstevel@tonic-gate  *	device interrupt value (see <sys/dditypes.h> in the form of the
2567c478bd9Sstevel@tonic-gate  *	type ddi_idevice_cookie_t).
2577c478bd9Sstevel@tonic-gate  *
2587c478bd9Sstevel@tonic-gate  *	Either cookie pointer may be specified as a NULL pointer
2597c478bd9Sstevel@tonic-gate  *	in which case no value will be returned.
2607c478bd9Sstevel@tonic-gate  *
2617c478bd9Sstevel@tonic-gate  *	The interrupt handler "int_handler" is the address of the routine
2627c478bd9Sstevel@tonic-gate  *	to be called upon receipt of an appropriate interrupt. The
2637c478bd9Sstevel@tonic-gate  *	interrupt handler should return DDI_INTR_CLAIMED if the
2647c478bd9Sstevel@tonic-gate  *	interrupt was claimed, else DDI_INTR_UNCLAIMED. The argument
2657c478bd9Sstevel@tonic-gate  *	"int_handler_arg" will be passed to the "int_handler"
2667c478bd9Sstevel@tonic-gate  *	upon receipt of an appropriate interrupt.
2677c478bd9Sstevel@tonic-gate  *
2687c478bd9Sstevel@tonic-gate  *	If successful ddi_add_intr will return DDI_SUCCESS.
2697c478bd9Sstevel@tonic-gate  *	If the interrupt information cannot be found it will
2707c478bd9Sstevel@tonic-gate  *	return DDI_INTR_NOTFOUND.
2717c478bd9Sstevel@tonic-gate  *
2727c478bd9Sstevel@tonic-gate  */
2737c478bd9Sstevel@tonic-gate int	ddi_add_intr(dev_info_t *dip, uint_t inumber,
2747c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t *iblock_cookiep,
2757c478bd9Sstevel@tonic-gate 	    ddi_idevice_cookie_t *idevice_cookiep,
2767c478bd9Sstevel@tonic-gate 	    uint_t (*int_handler)(caddr_t int_handler_arg),
2777c478bd9Sstevel@tonic-gate 	    caddr_t int_handler_arg);
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate /*
2807c478bd9Sstevel@tonic-gate  * The following function is for Sun's internal use only at present
2817c478bd9Sstevel@tonic-gate  */
2827c478bd9Sstevel@tonic-gate int	ddi_add_fastintr(dev_info_t *dip, uint_t inumber,
2837c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t *iblock_cookiep,
2847c478bd9Sstevel@tonic-gate 	    ddi_idevice_cookie_t *idevice_cookiep,
2857c478bd9Sstevel@tonic-gate 	    uint_t (*hi_int_handler)(void));
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate /*
2887c478bd9Sstevel@tonic-gate  * ddi_remove_intr:	Remove interrupt set up by ddi_add_intr.
2897c478bd9Sstevel@tonic-gate  *
2907c478bd9Sstevel@tonic-gate  *	This routine is intended to be used by drivers that are
2917c478bd9Sstevel@tonic-gate  *	preparing to unload themselves "detach" from the system.
2927c478bd9Sstevel@tonic-gate  */
2937c478bd9Sstevel@tonic-gate void	ddi_remove_intr(dev_info_t *dip, uint_t inum,
2947c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t iblock_cookie);
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate /*
2977c478bd9Sstevel@tonic-gate  * For use by ddi_add_softintr in order to specify a priority preference.
2987c478bd9Sstevel@tonic-gate  */
2997c478bd9Sstevel@tonic-gate #define	DDI_SOFTINT_FIXED	0	/* Fixed priority soft interrupt */
3007c478bd9Sstevel@tonic-gate #define	DDI_SOFTINT_LOW		8	/* Low priority soft interrupt */
3017c478bd9Sstevel@tonic-gate #define	DDI_SOFTINT_MED		128	/* Medium priority soft interrupt */
3027c478bd9Sstevel@tonic-gate #define	DDI_SOFTINT_HIGH	256	/* High priority soft interrupt */
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate int	ddi_get_soft_iblock_cookie(dev_info_t *dip, int preference,
3067c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t *iblock_cookiep);
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate /*
3097c478bd9Sstevel@tonic-gate  * ddi_add_softintr:	Add a "soft" interrupt to the system.
3107c478bd9Sstevel@tonic-gate  *
3117c478bd9Sstevel@tonic-gate  *	Like ddi_add_intr, only for system interrupts that you can trigger
3127c478bd9Sstevel@tonic-gate  *	yourself. You specify a preference (see above) for the level you
3137c478bd9Sstevel@tonic-gate  *	want. You get an identifier back which you can use to either trigger
3147c478bd9Sstevel@tonic-gate  *	a soft interrupt or, later, remove it.
3157c478bd9Sstevel@tonic-gate  */
3167c478bd9Sstevel@tonic-gate int	ddi_add_softintr(dev_info_t *dip, int preference, ddi_softintr_t *idp,
3177c478bd9Sstevel@tonic-gate 	    ddi_iblock_cookie_t *iblock_cookiep,
3187c478bd9Sstevel@tonic-gate 	    ddi_idevice_cookie_t *idevice_cookiep,
3197c478bd9Sstevel@tonic-gate 	    uint_t (*int_handler)(caddr_t int_handler_arg),
3207c478bd9Sstevel@tonic-gate 	    caddr_t int_handler_arg);
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate void	ddi_remove_softintr(ddi_softintr_t id);
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate void	ddi_trigger_softintr(ddi_softintr_t id);
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3297c478bd9Sstevel@tonic-gate }
3307c478bd9Sstevel@tonic-gate #endif
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate #endif	/* _SYS_DDI_INTR_H */
333