xref: /freebsd/sys/kern/pic_if.m (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1#-
2# Copyright (c) 2015-2016 Svatopluk Kraus
3# Copyright (c) 2015-2016 Michal Meloun
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27#
28
29#include <sys/bus.h>
30#include <sys/cpuset.h>
31#include <sys/resource.h>
32#include <sys/intr.h>
33
34INTERFACE pic;
35
36CODE {
37	static int
38	dflt_pic_bind_intr(device_t dev, struct intr_irqsrc *isrc)
39	{
40
41		return (EOPNOTSUPP);
42	}
43
44	static int
45	null_pic_activate_intr(device_t dev, struct intr_irqsrc *isrc,
46	    struct resource *res, struct intr_map_data *data)
47	{
48
49		return (0);
50	}
51
52	static int
53	null_pic_deactivate_intr(device_t dev, struct intr_irqsrc *isrc,
54	    struct resource *res, struct intr_map_data *data)
55	{
56
57		return (0);
58	}
59
60	static int
61	null_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
62	    struct resource *res, struct intr_map_data *data)
63	{
64
65		return (0);
66	}
67
68	static int
69	null_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
70	    struct resource *res, struct intr_map_data *data)
71	{
72
73		return (0);
74	}
75
76	static void
77	null_pic_init_secondary(device_t dev)
78	{
79	}
80
81	static void
82	null_pic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi)
83	{
84	}
85
86	static int
87	dflt_pic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc *isrc)
88	{
89
90		return (EOPNOTSUPP);
91	}
92};
93
94METHOD int activate_intr {
95	device_t		dev;
96	struct intr_irqsrc	*isrc;
97	struct resource		*res;
98	struct intr_map_data	*data;
99} DEFAULT null_pic_activate_intr;
100
101METHOD int bind_intr {
102	device_t		dev;
103	struct intr_irqsrc	*isrc;
104} DEFAULT dflt_pic_bind_intr;
105
106METHOD void disable_intr {
107	device_t		dev;
108	struct intr_irqsrc	*isrc;
109};
110
111METHOD void enable_intr {
112	device_t		dev;
113	struct intr_irqsrc	*isrc;
114};
115
116METHOD int map_intr {
117	device_t		dev;
118	struct intr_map_data	*data;
119	struct intr_irqsrc	**isrcp;
120};
121
122METHOD int deactivate_intr {
123	device_t		dev;
124	struct intr_irqsrc	*isrc;
125	struct resource		*res;
126	struct intr_map_data	*data;
127} DEFAULT null_pic_deactivate_intr;
128
129METHOD int setup_intr {
130	device_t		dev;
131	struct intr_irqsrc	*isrc;
132	struct resource		*res;
133	struct intr_map_data	*data;
134} DEFAULT null_pic_setup_intr;
135
136METHOD int teardown_intr {
137	device_t		dev;
138	struct intr_irqsrc	*isrc;
139	struct resource		*res;
140	struct intr_map_data	*data;
141} DEFAULT null_pic_teardown_intr;
142
143METHOD void post_filter {
144	device_t		dev;
145	struct intr_irqsrc	*isrc;
146};
147
148METHOD void post_ithread {
149	device_t		dev;
150	struct intr_irqsrc	*isrc;
151};
152
153METHOD void pre_ithread {
154	device_t		dev;
155	struct intr_irqsrc	*isrc;
156};
157
158METHOD void init_secondary {
159	device_t	dev;
160} DEFAULT null_pic_init_secondary;
161
162METHOD void ipi_send {
163	device_t		dev;
164	struct intr_irqsrc	*isrc;
165	cpuset_t		cpus;
166	u_int			ipi;
167} DEFAULT null_pic_ipi_send;
168
169METHOD int ipi_setup {
170	device_t		dev;
171	u_int			ipi;
172	struct intr_irqsrc	**isrcp;
173} DEFAULT dflt_pic_ipi_setup;
174