intr_machdep.h revision 172066
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 172066 2007-09-06 19:16:30Z marius $
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
42172066Smarius#define	IV_SHIFT	6
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 intr_request {
6097265Sjake	struct	intr_request *ir_next;
6197265Sjake	iv_func_t *ir_func;
6297265Sjake	void	*ir_arg;
6397265Sjake	u_int	ir_vec;
6497265Sjake	u_int	ir_pri;
6581390Sjake};
6681390Sjake
67172066Smariusstruct intr_controller {
68172066Smarius	void	(*ic_enable)(void *);
69172066Smarius	void	(*ic_disable)(void *);
70172066Smarius	void	(*ic_eoi)(void *);
71172066Smarius};
72172066Smarius
7383053Sobrienstruct intr_vector {
7485235Sjake	iv_func_t *iv_func;
7581390Sjake	void	*iv_arg;
76172066Smarius	const struct	intr_controller *iv_ic;
77172066Smarius	void	*iv_icarg;
78151658Sjhb	struct	intr_event *iv_event;
7981390Sjake	u_int	iv_pri;
8085235Sjake	u_int	iv_vec;
81172066Smarius	u_int	iv_mid;
82172066Smarius	u_int	iv_refcnt;
83172066Smarius	u_int	iv_pad[2];
8481390Sjake};
8581390Sjake
8688623Sjakeextern ih_func_t *intr_handlers[];
8781390Sjakeextern struct intr_vector intr_vectors[];
8881390Sjake
8981390Sjakevoid	intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
90166105Smarius	    void *iva);
9190624Stmmvoid	intr_init1(void);
9290624Stmmvoid	intr_init2(void);
93172066Smariusint	intr_controller_register(int vec, const struct intr_controller *ic,
94172066Smarius	    void *icarg);
95166901Spisoint	inthand_add(const char *name, int vec, int (*filt)(void *),
96172066Smarius	    void (*handler)(void *), void *arg, int flags, void **cookiep);
9784849Stmmint	inthand_remove(int vec, void *cookie);
9881390Sjake
99104075Sjakeih_func_t intr_fast;
10081390Sjake
101166105Smarius#endif /* !LOCORE */
102166105Smarius
103166105Smarius#endif /* !_MACHINE_INTR_MACHDEP_H_ */
104