rmixl_intr.h revision 1.1.2.3 1 1.1.2.3 cliff /* $NetBSD: rmixl_intr.h,v 1.1.2.3 2010/04/13 18:15:16 cliff Exp $ */
2 1.1.2.3 cliff /*-
3 1.1.2.3 cliff * Copyright (c) 2010 The NetBSD Foundation, Inc.
4 1.1.2.3 cliff * All rights reserved.
5 1.1.2.3 cliff *
6 1.1.2.3 cliff * This code is derived from software contributed to The NetBSD Foundation
7 1.1.2.3 cliff * by Cliff Neighbors.
8 1.1.2.3 cliff *
9 1.1.2.3 cliff * Redistribution and use in source and binary forms, with or without
10 1.1.2.3 cliff * modification, are permitted provided that the following conditions
11 1.1.2.3 cliff * are met:
12 1.1.2.3 cliff * 1. Redistributions of source code must retain the above copyright
13 1.1.2.3 cliff * notice, this list of conditions and the following disclaimer.
14 1.1.2.3 cliff * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.2.3 cliff * notice, this list of conditions and the following disclaimer in the
16 1.1.2.3 cliff * documentation and/or other materials provided with the distribution.
17 1.1.2.3 cliff *
18 1.1.2.3 cliff * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1.2.3 cliff * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1.2.3 cliff * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1.2.3 cliff * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1.2.3 cliff * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1.2.3 cliff * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1.2.3 cliff * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1.2.3 cliff * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1.2.3 cliff * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1.2.3 cliff * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1.2.3 cliff * POSSIBILITY OF SUCH DAMAGE.
29 1.1.2.3 cliff */
30 1.1.2.1 cliff
31 1.1.2.1 cliff #ifndef _MIPS_RMI_RMIXL_INTR_H_
32 1.1.2.1 cliff #define _MIPS_RMI_RMIXL_INTR_H_
33 1.1.2.1 cliff
34 1.1.2.1 cliff /*
35 1.1.2.1 cliff * An 'irq' is an EIRR bit numbers or 'vector' as used in the PRM
36 1.1.2.1 cliff * - PIC-based irqs are in the range 0..31 and index into the IRT
37 1.1.2.1 cliff * - IRT entry <n> always routes to vector <n>
38 1.1.2.1 cliff * - non-PIC-based irqs are in the range 32..63
39 1.1.2.1 cliff * - only 1 intrhand_t per irq/vector
40 1.1.2.1 cliff */
41 1.1.2.1 cliff #define NINTRVECS 64 /* bit width of the EIRR */
42 1.1.2.1 cliff #define NIRTS 32 /* #entries in the Interrupt Redirection Table */
43 1.1.2.1 cliff
44 1.1.2.1 cliff /*
45 1.1.2.1 cliff * reserved vectors >=32
46 1.1.2.1 cliff */
47 1.1.2.1 cliff #define RMIXL_INTRVEC_IPI 32
48 1.1.2.1 cliff #define RMIXL_INTRVEC_FMN 33
49 1.1.2.1 cliff
50 1.1.2.1 cliff typedef enum {
51 1.1.2.1 cliff RMIXL_TRIG_NONE=0,
52 1.1.2.1 cliff RMIXL_TRIG_EDGE,
53 1.1.2.1 cliff RMIXL_TRIG_LEVEL,
54 1.1.2.1 cliff } rmixl_intr_trigger_t;
55 1.1.2.1 cliff
56 1.1.2.1 cliff typedef enum {
57 1.1.2.1 cliff RMIXL_POLR_NONE=0,
58 1.1.2.1 cliff RMIXL_POLR_RISING,
59 1.1.2.1 cliff RMIXL_POLR_HIGH,
60 1.1.2.1 cliff RMIXL_POLR_FALLING,
61 1.1.2.1 cliff RMIXL_POLR_LOW,
62 1.1.2.1 cliff } rmixl_intr_polarity_t;
63 1.1.2.1 cliff
64 1.1.2.1 cliff
65 1.1.2.1 cliff /*
66 1.1.2.1 cliff * iv_list and ref count manage sharing of each vector
67 1.1.2.1 cliff */
68 1.1.2.1 cliff typedef struct rmixl_intrhand {
69 1.1.2.1 cliff int (*ih_func)(void *);
70 1.1.2.1 cliff void *ih_arg;
71 1.1.2.2 cliff int ih_mpsafe; /* true if does not need kernel lock */
72 1.1.2.1 cliff int ih_irq; /* >=32 if not-PIC-based */
73 1.1.2.1 cliff int ih_ipl; /* interrupt priority */
74 1.1.2.1 cliff int ih_cpumask; /* CPUs which may handle this irpt */
75 1.1.2.1 cliff } rmixl_intrhand_t;
76 1.1.2.1 cliff
77 1.1.2.1 cliff /*
78 1.1.2.1 cliff * stuff exported from rmixl_spl.S
79 1.1.2.1 cliff */
80 1.1.2.1 cliff extern const struct splsw rmixl_splsw;
81 1.1.2.1 cliff extern uint64_t ipl_eimr_map[];
82 1.1.2.1 cliff
83 1.1.2.1 cliff extern void *rmixl_intr_establish(int, int, int,
84 1.1.2.1 cliff rmixl_intr_trigger_t, rmixl_intr_polarity_t,
85 1.1.2.2 cliff int (*)(void *), void *, bool);
86 1.1.2.1 cliff extern void rmixl_intr_disestablish(void *);
87 1.1.2.1 cliff extern void *rmixl_vec_establish(int, int, int,
88 1.1.2.2 cliff int (*)(void *), void *, bool);
89 1.1.2.1 cliff extern void rmixl_vec_disestablish(void *);
90 1.1.2.1 cliff extern const char *rmixl_intr_string(int);
91 1.1.2.1 cliff extern void rmixl_intr_init_cpu(struct cpu_info *);
92 1.1.2.1 cliff extern void *rmixl_intr_init_clk(void);
93 1.1.2.1 cliff #ifdef MULTIPROCESSOR
94 1.1.2.1 cliff extern void *rmixl_intr_init_ipi(void);
95 1.1.2.1 cliff #endif
96 1.1.2.1 cliff
97 1.1.2.1 cliff #endif /* _MIPS_RMI_RMIXL_INTR_H_ */
98