intr_machdep.h revision 166901
181390Sjake/*-
281390Sjake * Copyright (c) 2001 Jake Burkholder.
381390Sjake * All rights reserved.
481390Sjake *
581390Sjake * Redistribution and use in source and binary forms, with or without
681390Sjake * modification, are permitted provided that the following conditions
781390Sjake * are met:
881390Sjake * 1. Redistributions of source code must retain the above copyright
981390Sjake *    notice, this list of conditions and the following disclaimer.
1081390Sjake * 2. Redistributions in binary form must reproduce the above copyright
1181390Sjake *    notice, this list of conditions and the following disclaimer in the
1281390Sjake *    documentation and/or other materials provided with the distribution.
1381390Sjake *
1481390Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1581390Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1681390Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1781390Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1881390Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1981390Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2081390Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2181390Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2281390Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2381390Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2481390Sjake * SUCH DAMAGE.
2581390Sjake *
2681390Sjake * $FreeBSD: head/sys/sparc64/include/intr_machdep.h 166901 2007-02-23 12:19:07Z piso $
2781390Sjake */
2881390Sjake
2981390Sjake#ifndef	_MACHINE_INTR_MACHDEP_H_
3081390Sjake#define	_MACHINE_INTR_MACHDEP_H_
3181390Sjake
3297265Sjake#define	IRSR_BUSY	(1 << 5)
3381390Sjake
3497265Sjake#define	PIL_MAX		(1 << 4)
3597265Sjake#define	IV_MAX		(1 << 11)
36117658Sjmg#define IV_NAMLEN	1024
3781390Sjake
3897265Sjake#define	IR_FREE		(PIL_MAX * 2)
3997265Sjake
4088623Sjake#define	IH_SHIFT	PTR_SHIFT
4181390Sjake#define	IQE_SHIFT	5
4281390Sjake#define	IV_SHIFT	5
4381390Sjake
4484849Stmm#define	PIL_LOW		1	/* stray interrupts */
4584849Stmm#define	PIL_ITHREAD	2	/* interrupts that use ithreads */
4689051Sjake#define	PIL_RENDEZVOUS	3	/* smp rendezvous ipi */
4789051Sjake#define	PIL_AST		4	/* ast ipi */
4889051Sjake#define	PIL_STOP	5	/* stop cpu ipi */
4984849Stmm#define	PIL_FAST	13	/* fast interrupts */
5081390Sjake#define	PIL_TICK	14
5181390Sjake
52166105Smarius#ifndef LOCORE
53166105Smarius
5497508Sjakestruct trapframe;
5597508Sjake
5681390Sjaketypedef	void ih_func_t(struct trapframe *);
5781390Sjaketypedef	void iv_func_t(void *);
5881390Sjake
5997265Sjakestruct ithd;
6081390Sjake
6197265Sjakestruct intr_request {
6297265Sjake	struct	intr_request *ir_next;
6397265Sjake	iv_func_t *ir_func;
6497265Sjake	void	*ir_arg;
6597265Sjake	u_int	ir_vec;
6697265Sjake	u_int	ir_pri;
6781390Sjake};
6881390Sjake
6983053Sobrienstruct intr_vector {
7085235Sjake	iv_func_t *iv_func;
7181390Sjake	void	*iv_arg;
72151658Sjhb	struct	intr_event *iv_event;
7381390Sjake	u_int	iv_pri;
7485235Sjake	u_int	iv_vec;
7581390Sjake};
7681390Sjake
7788623Sjakeextern ih_func_t *intr_handlers[];
7881390Sjakeextern struct intr_vector intr_vectors[];
7981390Sjake
8081390Sjakevoid	intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
81166105Smarius	    void *iva);
8290624Stmmvoid	intr_init1(void);
8390624Stmmvoid	intr_init2(void);
84166901Spisoint	inthand_add(const char *name, int vec, int (*filt)(void *),
85166901Spiso	     void (*handler)(void *), void *arg, int flags, void **cookiep);
8684849Stmmint	inthand_remove(int vec, void *cookie);
8781390Sjake
88104075Sjakeih_func_t intr_fast;
8981390Sjake
90166105Smarius#endif /* !LOCORE */
91166105Smarius
92166105Smarius#endif /* !_MACHINE_INTR_MACHDEP_H_ */
93