xref: /freebsd/sys/kern/pic_if.m (revision 732a02b4e77866604a120a275c082bb6221bd2ff)
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# $FreeBSD$
28#
29
30#include <sys/bus.h>
31#include <sys/cpuset.h>
32#include <sys/resource.h>
33#include <sys/intr.h>
34
35INTERFACE pic;
36
37CODE {
38	static int
39	dflt_pic_bind_intr(device_t dev, struct intr_irqsrc *isrc)
40	{
41
42		return (EOPNOTSUPP);
43	}
44
45	static int
46	null_pic_activate_intr(device_t dev, struct intr_irqsrc *isrc,
47	    struct resource *res, struct intr_map_data *data)
48	{
49
50		return (0);
51	}
52
53	static int
54	null_pic_deactivate_intr(device_t dev, struct intr_irqsrc *isrc,
55	    struct resource *res, struct intr_map_data *data)
56	{
57
58		return (0);
59	}
60
61	static int
62	null_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
63	    struct resource *res, struct intr_map_data *data)
64	{
65
66		return (0);
67	}
68
69	static int
70	null_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
71	    struct resource *res, struct intr_map_data *data)
72	{
73
74		return (0);
75	}
76
77	static void
78	null_pic_init_secondary(device_t dev)
79	{
80	}
81
82	static void
83	null_pic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi)
84	{
85	}
86
87	static int
88	dflt_pic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc *isrc)
89	{
90
91		return (EOPNOTSUPP);
92	}
93};
94
95METHOD int activate_intr {
96	device_t		dev;
97	struct intr_irqsrc	*isrc;
98	struct resource		*res;
99	struct intr_map_data	*data;
100} DEFAULT null_pic_activate_intr;
101
102METHOD int bind_intr {
103	device_t		dev;
104	struct intr_irqsrc	*isrc;
105} DEFAULT dflt_pic_bind_intr;
106
107METHOD void disable_intr {
108	device_t		dev;
109	struct intr_irqsrc	*isrc;
110};
111
112METHOD void enable_intr {
113	device_t		dev;
114	struct intr_irqsrc	*isrc;
115};
116
117METHOD int map_intr {
118	device_t		dev;
119	struct intr_map_data	*data;
120	struct intr_irqsrc	**isrcp;
121};
122
123METHOD int deactivate_intr {
124	device_t		dev;
125	struct intr_irqsrc	*isrc;
126	struct resource		*res;
127	struct intr_map_data	*data;
128} DEFAULT null_pic_deactivate_intr;
129
130METHOD int setup_intr {
131	device_t		dev;
132	struct intr_irqsrc	*isrc;
133	struct resource		*res;
134	struct intr_map_data	*data;
135} DEFAULT null_pic_setup_intr;
136
137METHOD int teardown_intr {
138	device_t		dev;
139	struct intr_irqsrc	*isrc;
140	struct resource		*res;
141	struct intr_map_data	*data;
142} DEFAULT null_pic_teardown_intr;
143
144METHOD void post_filter {
145	device_t		dev;
146	struct intr_irqsrc	*isrc;
147};
148
149METHOD void post_ithread {
150	device_t		dev;
151	struct intr_irqsrc	*isrc;
152};
153
154METHOD void pre_ithread {
155	device_t		dev;
156	struct intr_irqsrc	*isrc;
157};
158
159METHOD void init_secondary {
160	device_t	dev;
161} DEFAULT null_pic_init_secondary;
162
163METHOD void ipi_send {
164	device_t		dev;
165	struct intr_irqsrc	*isrc;
166	cpuset_t		cpus;
167	u_int			ipi;
168} DEFAULT null_pic_ipi_send;
169
170METHOD int ipi_setup {
171	device_t		dev;
172	u_int			ipi;
173	struct intr_irqsrc	**isrcp;
174} DEFAULT dflt_pic_ipi_setup;
175