rmixl_intr.h revision 1.1.2.9 1 1.1.2.9 matt /* $NetBSD: rmixl_intr.h,v 1.1.2.9 2011/12/24 01:57:54 matt 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.6 cliff #ifdef _KERNEL_OPT
35 1.1.2.5 cliff #include "opt_multiprocessor.h"
36 1.1.2.6 cliff #endif
37 1.1.2.5 cliff
38 1.1.2.1 cliff /*
39 1.1.2.4 cliff * A 'vector' is bit number in EIRR/EIMR
40 1.1.2.9 matt * - IRT or non-IRT interrupts use vectors 8..63
41 1.1.2.9 matt * - vector or dynamically assigned (except for IPI and FMN)
42 1.1.2.1 cliff */
43 1.1.2.1 cliff #define NINTRVECS 64 /* bit width of the EIRR */
44 1.1.2.9 matt #define RMIXLP_NIRTS 160 /* #entries in Interrupt Redirection Table */
45 1.1.2.9 matt #define RMIXLR_NIRTS 32 /* #entries in Interrupt Redirection Table */
46 1.1.2.9 matt #define RMIXLS_NIRTS 32 /* #entries in Interrupt Redirection Table */
47 1.1.2.4 cliff
48 1.1.2.4 cliff /*
49 1.1.2.4 cliff * vectors (0 <= vec < 8) are CAUSE[8..15] (including softintrs and count/compare)
50 1.1.2.4 cliff */
51 1.1.2.4 cliff #define RMIXL_INTRVEC_IPI 8
52 1.1.2.5 cliff #define RMIXL_INTRVEC_FMN (RMIXL_INTRVEC_IPI + NIPIS)
53 1.1.2.1 cliff
54 1.1.2.1 cliff typedef enum {
55 1.1.2.9 matt RMIXL_TRIG_LEVEL=0,
56 1.1.2.1 cliff RMIXL_TRIG_EDGE,
57 1.1.2.1 cliff } rmixl_intr_trigger_t;
58 1.1.2.1 cliff
59 1.1.2.1 cliff typedef enum {
60 1.1.2.9 matt RMIXL_POLR_HIGH=0,
61 1.1.2.9 matt RMIXL_POLR_LOW,
62 1.1.2.1 cliff RMIXL_POLR_RISING,
63 1.1.2.1 cliff RMIXL_POLR_FALLING,
64 1.1.2.1 cliff } rmixl_intr_polarity_t;
65 1.1.2.1 cliff
66 1.1.2.1 cliff
67 1.1.2.1 cliff /*
68 1.1.2.1 cliff * iv_list and ref count manage sharing of each vector
69 1.1.2.1 cliff */
70 1.1.2.1 cliff typedef struct rmixl_intrhand {
71 1.1.2.9 matt LIST_ENTRY(rmixl_intrhand) ih_link;
72 1.1.2.1 cliff int (*ih_func)(void *);
73 1.1.2.1 cliff void *ih_arg;
74 1.1.2.9 matt bool ih_mpsafe; /* true if does not need kernel lock */
75 1.1.2.9 matt uint8_t ih_vec; /* vector is bit number in EIRR/EIMR */
76 1.1.2.1 cliff } rmixl_intrhand_t;
77 1.1.2.1 cliff
78 1.1.2.9 matt typedef struct rmixl_intrvec {
79 1.1.2.9 matt LIST_HEAD(, rmixl_intrhand) iv_hands;
80 1.1.2.9 matt TAILQ_ENTRY(rmixl_intrvec) iv_lruq_link;
81 1.1.2.9 matt rmixl_intrhand_t iv_intrhand;
82 1.1.2.9 matt uint8_t iv_ipl; /* interrupt priority */
83 1.1.2.9 matt } rmixl_intrvec_t;
84 1.1.2.9 matt
85 1.1.2.9 matt typedef TAILQ_HEAD(rmixl_intrvecq, rmixl_intrvec) rmixl_intrvecq_t;
86 1.1.2.9 matt
87 1.1.2.1 cliff /*
88 1.1.2.1 cliff * stuff exported from rmixl_spl.S
89 1.1.2.1 cliff */
90 1.1.2.1 cliff extern const struct splsw rmixl_splsw;
91 1.1.2.1 cliff extern uint64_t ipl_eimr_map[];
92 1.1.2.1 cliff
93 1.1.2.9 matt void * rmixl_intr_establish(size_t /* irt */, int /* ipl */,
94 1.1.2.9 matt rmixl_intr_trigger_t, rmixl_intr_polarity_t,
95 1.1.2.9 matt int (*)(void *), void *, bool);
96 1.1.2.9 matt void rmixl_intr_disestablish(void *);
97 1.1.2.9 matt void * rmixl_vec_establish(size_t /* vec */, rmixl_intrhand_t *, int /* ipl */,
98 1.1.2.9 matt int (*)(void *), void *, bool);
99 1.1.2.9 matt void rmixl_vec_disestablish(void *);
100 1.1.2.9 matt const char *
101 1.1.2.9 matt rmixl_intr_string(size_t);
102 1.1.2.9 matt const char *
103 1.1.2.9 matt rmixl_irt_string(size_t);
104 1.1.2.9 matt void rmixl_intr_init_cpu(struct cpu_info *);
105 1.1.2.9 matt void rmixl_intr_init_clk(void);
106 1.1.2.1 cliff #ifdef MULTIPROCESSOR
107 1.1.2.9 matt void rmixl_intr_init_ipi(void);
108 1.1.2.1 cliff #endif
109 1.1.2.1 cliff
110 1.1.2.1 cliff #endif /* _MIPS_RMI_RMIXL_INTR_H_ */
111