intr_machdep.h revision 104075
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 104075 2002-09-28 03:06:35Z jake $
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)
3681390Sjake
3797265Sjake#define	IR_FREE		(PIL_MAX * 2)
3897265Sjake
3988623Sjake#define	IH_SHIFT	PTR_SHIFT
4081390Sjake#define	IQE_SHIFT	5
4181390Sjake#define	IV_SHIFT	5
4281390Sjake
4384849Stmm#define	PIL_LOW		1	/* stray interrupts */
4484849Stmm#define	PIL_ITHREAD	2	/* interrupts that use ithreads */
4589051Sjake#define	PIL_RENDEZVOUS	3	/* smp rendezvous ipi */
4689051Sjake#define	PIL_AST		4	/* ast ipi */
4789051Sjake#define	PIL_STOP	5	/* stop cpu ipi */
4884849Stmm#define	PIL_FAST	13	/* fast interrupts */
4981390Sjake#define	PIL_TICK	14
5081390Sjake
5197508Sjakestruct trapframe;
5297508Sjake
5381390Sjaketypedef	void ih_func_t(struct trapframe *);
5481390Sjaketypedef	void iv_func_t(void *);
5581390Sjake
5697265Sjakestruct ithd;
5781390Sjake
5897265Sjakestruct intr_request {
5997265Sjake	struct	intr_request *ir_next;
6097265Sjake	iv_func_t *ir_func;
6197265Sjake	void	*ir_arg;
6297265Sjake	u_int	ir_vec;
6397265Sjake	u_int	ir_pri;
6481390Sjake};
6581390Sjake
6683053Sobrienstruct intr_vector {
6785235Sjake	iv_func_t *iv_func;
6881390Sjake	void	*iv_arg;
6984849Stmm	struct	ithd *iv_ithd;
7081390Sjake	u_int	iv_pri;
7185235Sjake	u_int	iv_vec;
7281390Sjake};
7381390Sjake
7488623Sjakeextern ih_func_t *intr_handlers[];
7581390Sjakeextern struct intr_vector intr_vectors[];
7681390Sjake
7781390Sjakevoid	intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
7881390Sjake		   void *iva);
7990624Stmmvoid	intr_init1(void);
8090624Stmmvoid	intr_init2(void);
8184849Stmmint	inthand_add(const char *name, int vec, void (*handler)(void *),
8284849Stmm    void *arg, int flags, void **cookiep);
8384849Stmmint	inthand_remove(int vec, void *cookie);
8481390Sjake
85104075Sjakeih_func_t intr_fast;
8681390Sjake
8781390Sjake#endif
88