avintr.h revision 5cd376e8b7030707d78315f63adb4bb2b4d9963e
2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SYS_AVINTR_H
2N/A#define _SYS_AVINTR_H
2N/A
2N/A
2N/A#include <sys/mutex.h>
2N/A#include <sys/dditypes.h>
2N/A#include <sys/ddi_intr.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Period of autovector structures (add this in to get the next level).
2N/A */
2N/A#define MAXIPL 16
2N/A#define INT_IPL(x) (x)
2N/A#define AV_INT_SPURIOUS -1
2N/A
2N/A#ifdef __STDC__
2N/Atypedef uint_t (*avfunc)(caddr_t, caddr_t);
2N/A#else
2N/Atypedef uint_t (*avfunc)();
2N/A#endif /* __STDC__ */
2N/A
2N/Astruct autovec {
2N/A
2N/A /*
2N/A * Interrupt handler and argument to pass to it.
2N/A */
2N/A
2N/A struct autovec *av_link; /* pointer to next on in chain */
2N/A uint_t (*av_vector)();
2N/A caddr_t av_intarg1;
2N/A caddr_t av_intarg2;
2N/A uint64_t *av_ticksp;
2N/A uint_t av_prilevel; /* priority level */
2N/A
2N/A /*
2N/A * Interrupt handle/id (like intrspec structure pointer) used to
2N/A * identify a specific instance of interrupt handler in case we
2N/A * have to remove the interrupt handler later.
2N/A *
2N/A */
2N/A void *av_intr_id;
2N/A dev_info_t *av_dip;
2N/A ushort_t av_flags; /* pending flags */
2N/A struct autovec *av_ipl_link; /* pointer to next on ipl chain */
2N/A};
2N/A
2N/A#define AV_PENTRY_VECTMASK 0xff /* low 8 bit used for irqno */
2N/A#define AV_PENTRY_PEND 0x100 /* pending hardware interrupt */
2N/A#define AV_PENTRY_ONPROC 0x200 /* being serviced by CPU */
2N/A#define AV_PENTRY_LEVEL 0x8000 /* level-triggered interrupt */
2N/A
2N/Astruct av_head {
2N/A struct autovec *avh_link;
2N/A ushort_t avh_hi_pri;
2N/A ushort_t avh_lo_pri;
2N/A};
2N/A
2N/A/* softing contains a bit field of software interrupts which are pending */
2N/Astruct softint {
2N/A int st_pending;
2N/A};
2N/A
2N/A#ifdef _KERNEL
2N/A
2N/Aextern kmutex_t av_lock;
2N/Aextern ddi_softint_hdl_impl_t softlevel_hdl[];
2N/Aextern ddi_softint_hdl_impl_t softlevel1_hdl;
2N/Aextern int add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name,
2N/A int vect, caddr_t arg1, caddr_t arg2, uint64_t *, dev_info_t *);
2N/Aextern int add_nmintr(int lvl, avfunc nmintr, char *name, caddr_t arg);
2N/Aextern int add_avsoftintr(void *intr_id, int lvl, avfunc xxintr,
2N/A char *name, caddr_t arg1, caddr_t arg2);
2N/Aextern int rem_avsoftintr(void *intr_id, int lvl, avfunc xxintr);
2N/Aextern int av_softint_movepri(void *intr_id, int old_lvl);
2N/Aextern void update_avsoftintr_args(void *intr_id, int lvl, caddr_t arg2);
2N/Aextern void rem_avintr(void *intr_id, int lvl, avfunc xxintr, int vect);
2N/Aextern void wait_till_seen(int ipl);
2N/Aextern uint_t softlevel1(caddr_t, caddr_t);
2N/A
2N/A#endif /* _KERNEL */
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SYS_AVINTR_H */
2N/A