xref: /onnv-gate/usr/src/uts/common/sys/avintr.h (revision 12825:e35468461453)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55107Seota  * Common Development and Distribution License (the "License").
65107Seota  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12825SJimmy.Vetayases@oracle.com  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef _SYS_AVINTR_H
260Sstevel@tonic-gate #define	_SYS_AVINTR_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/mutex.h>
300Sstevel@tonic-gate #include <sys/dditypes.h>
310Sstevel@tonic-gate #include <sys/ddi_intr.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * Period of autovector structures (add this in to get the next level).
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate #define	MAXIPL	16
410Sstevel@tonic-gate #define	INT_IPL(x) (x)
420Sstevel@tonic-gate #define	AV_INT_SPURIOUS	-1
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #ifdef	__STDC__
450Sstevel@tonic-gate typedef uint_t (*avfunc)(caddr_t, caddr_t);
460Sstevel@tonic-gate #else
470Sstevel@tonic-gate typedef uint_t (*avfunc)();
480Sstevel@tonic-gate #endif	/* __STDC__ */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate struct autovec {
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 	/*
530Sstevel@tonic-gate 	 * Interrupt handler and argument to pass to it.
540Sstevel@tonic-gate 	 */
550Sstevel@tonic-gate 
560Sstevel@tonic-gate 	struct autovec *av_link;	/* pointer to next on in chain */
570Sstevel@tonic-gate 	uint_t	(*av_vector)();
580Sstevel@tonic-gate 	caddr_t	av_intarg1;
590Sstevel@tonic-gate 	caddr_t	av_intarg2;
60916Sschwartz 	uint64_t *av_ticksp;
610Sstevel@tonic-gate 	uint_t	av_prilevel;		/* priority level */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 	/*
640Sstevel@tonic-gate 	 * Interrupt handle/id (like intrspec structure pointer) used to
650Sstevel@tonic-gate 	 * identify a specific instance of interrupt handler in case we
660Sstevel@tonic-gate 	 * have to remove the interrupt handler later.
670Sstevel@tonic-gate 	 *
680Sstevel@tonic-gate 	 */
690Sstevel@tonic-gate 	void	*av_intr_id;
700Sstevel@tonic-gate 	dev_info_t *av_dip;
7112683SJimmy.Vetayases@oracle.com 	ushort_t	av_flags;	/* pending flags */
7212683SJimmy.Vetayases@oracle.com 	struct autovec *av_ipl_link;	/* pointer to next on ipl chain */
730Sstevel@tonic-gate };
740Sstevel@tonic-gate 
7512683SJimmy.Vetayases@oracle.com #define	AV_PENTRY_VECTMASK	0xff	/* low 8 bit used for irqno */
7612683SJimmy.Vetayases@oracle.com #define	AV_PENTRY_PEND	0x100	/* pending hardware interrupt */
7712683SJimmy.Vetayases@oracle.com #define	AV_PENTRY_ONPROC	0x200	/* being serviced by CPU */
7812683SJimmy.Vetayases@oracle.com #define	AV_PENTRY_LEVEL	0x8000	/* level-triggered interrupt */
7912683SJimmy.Vetayases@oracle.com 
800Sstevel@tonic-gate struct av_head {
810Sstevel@tonic-gate 	struct 	autovec	*avh_link;
820Sstevel@tonic-gate 	ushort_t	avh_hi_pri;
830Sstevel@tonic-gate 	ushort_t	avh_lo_pri;
840Sstevel@tonic-gate };
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /* softing contains a bit field of software interrupts which are pending */
870Sstevel@tonic-gate struct softint {
880Sstevel@tonic-gate 	int st_pending;
890Sstevel@tonic-gate };
900Sstevel@tonic-gate 
910Sstevel@tonic-gate #ifdef _KERNEL
920Sstevel@tonic-gate 
930Sstevel@tonic-gate extern kmutex_t av_lock;
945107Seota extern ddi_softint_hdl_impl_t softlevel_hdl[];
950Sstevel@tonic-gate extern ddi_softint_hdl_impl_t softlevel1_hdl;
960Sstevel@tonic-gate extern int add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name,
97916Sschwartz 	int vect, caddr_t arg1, caddr_t arg2, uint64_t *, dev_info_t *);
980Sstevel@tonic-gate extern int add_nmintr(int lvl, avfunc nmintr, char *name, caddr_t arg);
990Sstevel@tonic-gate extern int add_avsoftintr(void *intr_id, int lvl, avfunc xxintr,
1000Sstevel@tonic-gate 	char *name, caddr_t arg1, caddr_t arg2);
1010Sstevel@tonic-gate extern int rem_avsoftintr(void *intr_id, int lvl, avfunc xxintr);
102999Slq150181 extern int av_softint_movepri(void *intr_id, int old_lvl);
1030Sstevel@tonic-gate extern void update_avsoftintr_args(void *intr_id, int lvl, caddr_t arg2);
1040Sstevel@tonic-gate extern void rem_avintr(void *intr_id, int lvl, avfunc xxintr, int vect);
10512683SJimmy.Vetayases@oracle.com extern void wait_till_seen(int ipl);
1060Sstevel@tonic-gate extern uint_t softlevel1(caddr_t, caddr_t);
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate #endif	/* _KERNEL */
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #ifdef	__cplusplus
1110Sstevel@tonic-gate }
1120Sstevel@tonic-gate #endif
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate #endif /* _SYS_AVINTR_H */
115