rmixl_intr.h revision 1.1.2.11 1 1.1.2.11 matt /* $NetBSD: rmixl_intr.h,v 1.1.2.11 2011/12/31 08:20:43 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 /*
55 1.1.2.1 cliff * iv_list and ref count manage sharing of each vector
56 1.1.2.1 cliff */
57 1.1.2.1 cliff typedef struct rmixl_intrhand {
58 1.1.2.9 matt LIST_ENTRY(rmixl_intrhand) ih_link;
59 1.1.2.1 cliff int (*ih_func)(void *);
60 1.1.2.1 cliff void *ih_arg;
61 1.1.2.9 matt bool ih_mpsafe; /* true if does not need kernel lock */
62 1.1.2.9 matt uint8_t ih_vec; /* vector is bit number in EIRR/EIMR */
63 1.1.2.1 cliff } rmixl_intrhand_t;
64 1.1.2.1 cliff
65 1.1.2.9 matt typedef struct rmixl_intrvec {
66 1.1.2.9 matt LIST_HEAD(, rmixl_intrhand) iv_hands;
67 1.1.2.9 matt TAILQ_ENTRY(rmixl_intrvec) iv_lruq_link;
68 1.1.2.9 matt rmixl_intrhand_t iv_intrhand;
69 1.1.2.9 matt uint8_t iv_ipl; /* interrupt priority */
70 1.1.2.9 matt } rmixl_intrvec_t;
71 1.1.2.9 matt
72 1.1.2.9 matt typedef TAILQ_HEAD(rmixl_intrvecq, rmixl_intrvec) rmixl_intrvecq_t;
73 1.1.2.9 matt
74 1.1.2.1 cliff /*
75 1.1.2.1 cliff * stuff exported from rmixl_spl.S
76 1.1.2.1 cliff */
77 1.1.2.1 cliff extern const struct splsw rmixl_splsw;
78 1.1.2.1 cliff extern uint64_t ipl_eimr_map[];
79 1.1.2.1 cliff
80 1.1.2.11 matt void * rmixl_intr_establish(size_t /* irt */, int /* ipl */, int /* ist */,
81 1.1.2.9 matt int (*)(void *), void *, bool);
82 1.1.2.9 matt void rmixl_intr_disestablish(void *);
83 1.1.2.9 matt void * rmixl_vec_establish(size_t /* vec */, rmixl_intrhand_t *, int /* ipl */,
84 1.1.2.9 matt int (*)(void *), void *, bool);
85 1.1.2.9 matt void rmixl_vec_disestablish(void *);
86 1.1.2.9 matt const char *
87 1.1.2.9 matt rmixl_intr_string(size_t);
88 1.1.2.9 matt const char *
89 1.1.2.9 matt rmixl_irt_string(size_t);
90 1.1.2.9 matt void rmixl_intr_init_cpu(struct cpu_info *);
91 1.1.2.9 matt void rmixl_intr_init_clk(void);
92 1.1.2.1 cliff #ifdef MULTIPROCESSOR
93 1.1.2.9 matt void rmixl_intr_init_ipi(void);
94 1.1.2.1 cliff #endif
95 1.1.2.1 cliff
96 1.1.2.10 matt void * gpio_intr_establish(size_t /* pin */, int /* ipl */, int /* ist */,
97 1.1.2.10 matt int (*)(void *), void *, bool);
98 1.1.2.10 matt
99 1.1.2.10 matt void gpio_intr_disestablish(void *);
100 1.1.2.1 cliff #endif /* _MIPS_RMI_RMIXL_INTR_H_ */
101