Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / sys / intr.h @ 13

History | View | Annotate | Download (3.07 KB)

1 13 up20180614
/*        $NetBSD: intr.h,v 1.19 2015/08/17 06:16:03 knakahara Exp $        */
2
3
/*-
4
 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5
 * All rights reserved.
6
 *
7
 * This code is derived from software contributed to The NetBSD Foundation
8
 * by Andrew Doran.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
 * POSSIBILITY OF SUCH DAMAGE.
30
 */
31
32
#ifndef _SYS_INTR_H_
33
#define        _SYS_INTR_H_
34
35
#define INTRIDBUF 64
36
#define INTRDEVNAMEBUF 256
37
38
#ifdef _KERNEL
39
40
#include <sys/types.h>
41
42
struct cpu_info;
43
44
/* Public interface. */
45
void        *softint_establish(u_int, void (*)(void *), void *);
46
void        softint_disestablish(void *);
47
void        softint_schedule(void *);
48
void        softint_schedule_cpu(void *, struct cpu_info *);
49
50
/* MI hooks. */
51
void        softint_init(struct cpu_info *);
52
lwp_t        *softint_picklwp(void);
53
void        softint_overlay(void);
54
void        softint_block(lwp_t *);
55
56
/* MD-MI interface. */
57
void        softint_init_md(lwp_t *, u_int, uintptr_t *);
58
#ifndef __HAVE_MD_SOFTINT_TRIGGER
59
void        softint_trigger(uintptr_t);
60
#endif
61
void        softint_dispatch(lwp_t *, int);
62
63
/* Flags for softint_establish(). */
64
#define        SOFTINT_BIO        0x0000
65
#define        SOFTINT_CLOCK        0x0001
66
#define        SOFTINT_SERIAL        0x0002
67
#define        SOFTINT_NET        0x0003
68
#define        SOFTINT_MPSAFE        0x0100
69
#define        SOFTINT_RCPU        0x0200
70
71
/* Implementation private flags. */
72
#define        SOFTINT_PENDING        0x1000
73
#define        SOFTINT_ACTIVE        0x2000
74
75
#define        SOFTINT_COUNT        0x0004
76
#define        SOFTINT_LVLMASK        0x00ff
77
#define        SOFTINT_IMPMASK        0xf000
78
79
extern u_int        softint_timing;
80
81
/*
82
 * Historical aliases.
83
 */
84
#define        IPL_BIO                IPL_VM
85
#define        IPL_NET                IPL_VM
86
#define        IPL_TTY                IPL_VM
87
#define        IPL_AUDIO        IPL_SCHED
88
#define        IPL_CLOCK        IPL_SCHED
89
#define        IPL_SERIAL        IPL_HIGH
90
91
#define        splbio()        splvm()
92
#define        splnet()        splvm()
93
#define        spltty()        splvm()
94
#define        splaudio()        splsched()
95
#define        splclock()        splsched()
96
#define        splserial()        splhigh()
97
98
#include <machine/intr.h>
99
100
#elif defined(_KMEMUSER)
101
#define        SOFTINT_COUNT        0x0004
102
#endif        /* _KERNEL */
103
104
#endif        /* _SYS_INTR_H_ */