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 5*5107Seota * Common Development and Distribution License (the "License"). 6*5107Seota * 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*5107Seota * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_AVINTR_H 270Sstevel@tonic-gate #define _SYS_AVINTR_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <sys/mutex.h> 320Sstevel@tonic-gate #include <sys/dditypes.h> 330Sstevel@tonic-gate #include <sys/ddi_intr.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * Period of autovector structures (add this in to get the next level). 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate #define MAXIPL 16 430Sstevel@tonic-gate #define INT_IPL(x) (x) 440Sstevel@tonic-gate #define AV_INT_SPURIOUS -1 450Sstevel@tonic-gate 460Sstevel@tonic-gate #ifdef __STDC__ 470Sstevel@tonic-gate typedef uint_t (*avfunc)(caddr_t, caddr_t); 480Sstevel@tonic-gate #else 490Sstevel@tonic-gate typedef uint_t (*avfunc)(); 500Sstevel@tonic-gate #endif /* __STDC__ */ 510Sstevel@tonic-gate 520Sstevel@tonic-gate struct autovec { 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * Interrupt handler and argument to pass to it. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate 580Sstevel@tonic-gate struct autovec *av_link; /* pointer to next on in chain */ 590Sstevel@tonic-gate uint_t (*av_vector)(); 600Sstevel@tonic-gate caddr_t av_intarg1; 610Sstevel@tonic-gate caddr_t av_intarg2; 62916Sschwartz uint64_t *av_ticksp; 630Sstevel@tonic-gate uint_t av_prilevel; /* priority level */ 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Interrupt handle/id (like intrspec structure pointer) used to 670Sstevel@tonic-gate * identify a specific instance of interrupt handler in case we 680Sstevel@tonic-gate * have to remove the interrupt handler later. 690Sstevel@tonic-gate * 700Sstevel@tonic-gate */ 710Sstevel@tonic-gate void *av_intr_id; 720Sstevel@tonic-gate dev_info_t *av_dip; 730Sstevel@tonic-gate }; 740Sstevel@tonic-gate 750Sstevel@tonic-gate struct av_head { 760Sstevel@tonic-gate struct autovec *avh_link; 770Sstevel@tonic-gate ushort_t avh_hi_pri; 780Sstevel@tonic-gate ushort_t avh_lo_pri; 790Sstevel@tonic-gate }; 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* softing contains a bit field of software interrupts which are pending */ 820Sstevel@tonic-gate struct softint { 830Sstevel@tonic-gate int st_pending; 840Sstevel@tonic-gate }; 850Sstevel@tonic-gate 860Sstevel@tonic-gate #ifdef _KERNEL 870Sstevel@tonic-gate 880Sstevel@tonic-gate extern kmutex_t av_lock; 89*5107Seota extern ddi_softint_hdl_impl_t softlevel_hdl[]; 900Sstevel@tonic-gate extern ddi_softint_hdl_impl_t softlevel1_hdl; 910Sstevel@tonic-gate extern int add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name, 92916Sschwartz int vect, caddr_t arg1, caddr_t arg2, uint64_t *, dev_info_t *); 930Sstevel@tonic-gate extern int add_nmintr(int lvl, avfunc nmintr, char *name, caddr_t arg); 940Sstevel@tonic-gate extern int add_avsoftintr(void *intr_id, int lvl, avfunc xxintr, 950Sstevel@tonic-gate char *name, caddr_t arg1, caddr_t arg2); 960Sstevel@tonic-gate extern int rem_avsoftintr(void *intr_id, int lvl, avfunc xxintr); 97999Slq150181 extern int av_softint_movepri(void *intr_id, int old_lvl); 980Sstevel@tonic-gate extern void update_avsoftintr_args(void *intr_id, int lvl, caddr_t arg2); 990Sstevel@tonic-gate extern void rem_avintr(void *intr_id, int lvl, avfunc xxintr, int vect); 1000Sstevel@tonic-gate extern void wait_till_seen(int ipl); 1010Sstevel@tonic-gate extern uint_t softlevel1(caddr_t, caddr_t); 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate #endif /* _KERNEL */ 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #ifdef __cplusplus 1060Sstevel@tonic-gate } 1070Sstevel@tonic-gate #endif 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #endif /* _SYS_AVINTR_H */ 110