intrdefs.h revision 1.9 1 1.9 ad /* $NetBSD: intrdefs.h,v 1.9 2007/08/29 23:38:05 ad Exp $ */
2 1.1 fvdl
3 1.4 yamt #ifndef _X86_INTRDEFS_H_
4 1.4 yamt #define _X86_INTRDEFS_H_
5 1.1 fvdl
6 1.1 fvdl /*
7 1.1 fvdl * Interrupt priority levels.
8 1.1 fvdl *
9 1.1 fvdl * There are tty, network and disk drivers that use free() at interrupt
10 1.1 fvdl * time, so imp > (tty | net | bio).
11 1.1 fvdl *
12 1.1 fvdl * Since run queues may be manipulated by both the statclock and tty,
13 1.1 fvdl * network, and disk drivers, clock > imp.
14 1.1 fvdl *
15 1.1 fvdl * IPL_HIGH must block everything that can manipulate a run queue.
16 1.1 fvdl *
17 1.1 fvdl * We need serial drivers to run at the absolute highest priority to
18 1.1 fvdl * avoid overruns, so serial > high.
19 1.1 fvdl *
20 1.1 fvdl * The level numbers are picked to fit into APIC vector priorities.
21 1.1 fvdl *
22 1.1 fvdl */
23 1.1 fvdl #define IPL_NONE 0x0 /* nothing */
24 1.9 ad #define IPL_SOFTCLOCK 0x1 /* timeouts */
25 1.9 ad #define IPL_SOFTBIO 0x2 /* block I/O */
26 1.9 ad #define IPL_SOFTNET 0x3 /* protocol stacks */
27 1.9 ad #define IPL_SOFTSERIAL 0x4 /* serial */
28 1.9 ad #define IPL_BIO 0x5 /* block I/O */
29 1.9 ad #define IPL_NET 0x5 /* network */
30 1.9 ad #define IPL_TTY 0x5 /* terminal */
31 1.9 ad #define IPL_LPT 0x5
32 1.9 ad #define IPL_VM 0x5 /* memory allocation */
33 1.9 ad #define IPL_AUDIO 0x5 /* audio */
34 1.9 ad #define IPL_CLOCK 0x6 /* clock */
35 1.9 ad #define IPL_STATCLOCK 0x6
36 1.9 ad #define IPL_SCHED 0x6
37 1.9 ad #define IPL_HIGH 0x7 /* everything */
38 1.9 ad #define IPL_SERIAL 0x7 /* serial */
39 1.9 ad #define IPL_IPI 0x7 /* inter-processor interrupts */
40 1.9 ad #define NIPL 8
41 1.1 fvdl
42 1.1 fvdl /* Interrupt sharing types. */
43 1.1 fvdl #define IST_NONE 0 /* none */
44 1.1 fvdl #define IST_PULSE 1 /* pulsed */
45 1.1 fvdl #define IST_EDGE 2 /* edge-triggered */
46 1.1 fvdl #define IST_LEVEL 3 /* level-triggered */
47 1.1 fvdl
48 1.1 fvdl /*
49 1.9 ad * Local APIC masks and software interrupt masks, in order
50 1.9 ad * of priority. Must not conflict with SIR_* below.
51 1.1 fvdl */
52 1.1 fvdl #define LIR_IPI 31
53 1.1 fvdl #define LIR_TIMER 30
54 1.1 fvdl
55 1.9 ad /*
56 1.9 ad * XXX These should be lowest numbered, but right now would
57 1.9 ad * conflict with the legacy IRQs. Their current position
58 1.9 ad * means that soft interrupt take priority over hardware
59 1.9 ad * interrupts when lowering the priority level!
60 1.9 ad */
61 1.9 ad #define SIR_SERIAL 29
62 1.1 fvdl #define SIR_NET 28
63 1.9 ad #define SIR_BIO 27
64 1.9 ad #define SIR_CLOCK 26
65 1.1 fvdl
66 1.1 fvdl /*
67 1.1 fvdl * Maximum # of interrupt sources per CPU. 32 to fit in one word.
68 1.1 fvdl * ioapics can theoretically produce more, but it's not likely to
69 1.1 fvdl * happen. For multiple ioapics, things can be routed to different
70 1.1 fvdl * CPUs.
71 1.1 fvdl */
72 1.1 fvdl #define MAX_INTR_SOURCES 32
73 1.1 fvdl #define NUM_LEGACY_IRQS 16
74 1.1 fvdl
75 1.1 fvdl /*
76 1.1 fvdl * Low and high boundaries between which interrupt gates will
77 1.1 fvdl * be allocated in the IDT.
78 1.1 fvdl */
79 1.1 fvdl #define IDT_INTR_LOW (0x20 + NUM_LEGACY_IRQS)
80 1.1 fvdl #define IDT_INTR_HIGH 0xef
81 1.1 fvdl
82 1.1 fvdl #define X86_IPI_HALT 0x00000001
83 1.1 fvdl #define X86_IPI_MICROSET 0x00000002
84 1.1 fvdl #define X86_IPI_FLUSH_FPU 0x00000004
85 1.1 fvdl #define X86_IPI_SYNCH_FPU 0x00000008
86 1.9 ad #define X86_IPI_MTRR 0x00000010
87 1.9 ad #define X86_IPI_GDT 0x00000020
88 1.9 ad #define X86_IPI_WRITE_MSR 0x00000040
89 1.1 fvdl
90 1.9 ad #define X86_NIPI 7
91 1.1 fvdl
92 1.1 fvdl #define X86_IPI_NAMES { "halt IPI", "timeset IPI", "FPU flush IPI", \
93 1.9 ad "FPU synch IPI", "MTRR update IPI", \
94 1.9 ad "GDT update IPI", "MSR write IPI" }
95 1.2 fvdl
96 1.2 fvdl #define IREENT_MAGIC 0x18041969
97 1.1 fvdl
98 1.4 yamt #endif /* _X86_INTRDEFS_H_ */
99