intrdefs.h revision 1.4 1 1.4 yamt /* $NetBSD: intrdefs.h,v 1.4 2005/04/16 07:45:59 yamt 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.1 fvdl #define IPL_SOFTCLOCK 0x4 /* timeouts */
25 1.1 fvdl #define IPL_SOFTNET 0x5 /* protocol stacks */
26 1.1 fvdl #define IPL_BIO 0x6 /* block I/O */
27 1.1 fvdl #define IPL_NET 0x7 /* network */
28 1.1 fvdl #define IPL_SOFTSERIAL 0x8 /* serial */
29 1.1 fvdl #define IPL_TTY 0x9 /* terminal */
30 1.1 fvdl #define IPL_VM 0xa /* memory allocation */
31 1.1 fvdl #define IPL_AUDIO 0xb /* audio */
32 1.1 fvdl #define IPL_CLOCK 0xc /* clock */
33 1.1 fvdl #define IPL_SCHED IPL_CLOCK
34 1.1 fvdl #define IPL_HIGH 0xd /* everything */
35 1.1 fvdl #define IPL_SERIAL 0xd /* serial */
36 1.1 fvdl #define IPL_IPI 0xe /* inter-processor interrupts */
37 1.1 fvdl #define NIPL 16
38 1.1 fvdl
39 1.1 fvdl /* Interrupt sharing types. */
40 1.1 fvdl #define IST_NONE 0 /* none */
41 1.1 fvdl #define IST_PULSE 1 /* pulsed */
42 1.1 fvdl #define IST_EDGE 2 /* edge-triggered */
43 1.1 fvdl #define IST_LEVEL 3 /* level-triggered */
44 1.1 fvdl
45 1.1 fvdl /*
46 1.1 fvdl * Local APIC masks. Must not conflict with SIR_* above, and must
47 1.1 fvdl * be >= NUM_LEGACY_IRQs. Note that LIR_IPI must be first.
48 1.1 fvdl */
49 1.1 fvdl #define LIR_IPI 31
50 1.1 fvdl #define LIR_TIMER 30
51 1.1 fvdl
52 1.1 fvdl /* Soft interrupt masks. */
53 1.1 fvdl #define SIR_CLOCK 29
54 1.1 fvdl #define SIR_NET 28
55 1.1 fvdl #define SIR_SERIAL 27
56 1.1 fvdl
57 1.1 fvdl
58 1.1 fvdl /*
59 1.1 fvdl * Maximum # of interrupt sources per CPU. 32 to fit in one word.
60 1.1 fvdl * ioapics can theoretically produce more, but it's not likely to
61 1.1 fvdl * happen. For multiple ioapics, things can be routed to different
62 1.1 fvdl * CPUs.
63 1.1 fvdl */
64 1.1 fvdl #define MAX_INTR_SOURCES 32
65 1.1 fvdl #define NUM_LEGACY_IRQS 16
66 1.1 fvdl
67 1.1 fvdl /*
68 1.1 fvdl * Low and high boundaries between which interrupt gates will
69 1.1 fvdl * be allocated in the IDT.
70 1.1 fvdl */
71 1.1 fvdl #define IDT_INTR_LOW (0x20 + NUM_LEGACY_IRQS)
72 1.1 fvdl #define IDT_INTR_HIGH 0xef
73 1.1 fvdl
74 1.1 fvdl #define X86_IPI_HALT 0x00000001
75 1.1 fvdl #define X86_IPI_MICROSET 0x00000002
76 1.1 fvdl #define X86_IPI_FLUSH_FPU 0x00000004
77 1.1 fvdl #define X86_IPI_SYNCH_FPU 0x00000008
78 1.1 fvdl #define X86_IPI_TLB 0x00000010
79 1.1 fvdl #define X86_IPI_MTRR 0x00000020
80 1.1 fvdl #define X86_IPI_GDT 0x00000040
81 1.1 fvdl
82 1.1 fvdl #define X86_NIPI 7
83 1.1 fvdl
84 1.1 fvdl #define X86_IPI_NAMES { "halt IPI", "timeset IPI", "FPU flush IPI", \
85 1.1 fvdl "FPU synch IPI", "TLB shootdown IPI", \
86 1.1 fvdl "MTRR update IPI", "GDT update IPI" }
87 1.2 fvdl
88 1.2 fvdl #define IREENT_MAGIC 0x18041969
89 1.1 fvdl
90 1.4 yamt #endif /* _X86_INTRDEFS_H_ */
91