intrdefs.h revision 1.1
11.1Sfvdl/*	$NetBSD: intrdefs.h,v 1.1 2002/11/22 15:07:38 fvdl Exp $	*/
21.1Sfvdl
31.1Sfvdl#ifndef _i386_INTRDEFS_H
41.1Sfvdl#define _i386_INTRDEFS_H
51.1Sfvdl
61.1Sfvdl/*
71.1Sfvdl * Interrupt priority levels.
81.1Sfvdl *
91.1Sfvdl * There are tty, network and disk drivers that use free() at interrupt
101.1Sfvdl * time, so imp > (tty | net | bio).
111.1Sfvdl *
121.1Sfvdl * Since run queues may be manipulated by both the statclock and tty,
131.1Sfvdl * network, and disk drivers, clock > imp.
141.1Sfvdl *
151.1Sfvdl * IPL_HIGH must block everything that can manipulate a run queue.
161.1Sfvdl *
171.1Sfvdl * We need serial drivers to run at the absolute highest priority to
181.1Sfvdl * avoid overruns, so serial > high.
191.1Sfvdl *
201.1Sfvdl * The level numbers are picked to fit into APIC vector priorities.
211.1Sfvdl *
221.1Sfvdl */
231.1Sfvdl#define	IPL_NONE	0x0	/* nothing */
241.1Sfvdl#define	IPL_SOFTCLOCK	0x4	/* timeouts */
251.1Sfvdl#define	IPL_SOFTNET	0x5	/* protocol stacks */
261.1Sfvdl#define	IPL_BIO		0x6	/* block I/O */
271.1Sfvdl#define	IPL_NET		0x7	/* network */
281.1Sfvdl#define	IPL_SOFTSERIAL	0x8	/* serial */
291.1Sfvdl#define	IPL_TTY		0x9	/* terminal */
301.1Sfvdl#define	IPL_VM		0xa	/* memory allocation */
311.1Sfvdl#define IPL_IMP		IPL_VM
321.1Sfvdl#define	IPL_AUDIO	0xb	/* audio */
331.1Sfvdl#define	IPL_CLOCK	0xc	/* clock */
341.1Sfvdl#define IPL_SCHED	IPL_CLOCK
351.1Sfvdl#define	IPL_HIGH	0xd	/* everything */
361.1Sfvdl#define	IPL_SERIAL	0xd	/* serial */
371.1Sfvdl#define IPL_IPI		0xe	/* inter-processor interrupts */
381.1Sfvdl#define	NIPL		16
391.1Sfvdl
401.1Sfvdl/* Interrupt sharing types. */
411.1Sfvdl#define	IST_NONE	0	/* none */
421.1Sfvdl#define	IST_PULSE	1	/* pulsed */
431.1Sfvdl#define	IST_EDGE	2	/* edge-triggered */
441.1Sfvdl#define	IST_LEVEL	3	/* level-triggered */
451.1Sfvdl
461.1Sfvdl/* Soft interrupt masks. */
471.1Sfvdl#define	SIR_CLOCK	31
481.1Sfvdl#define	SIR_NET	30
491.1Sfvdl#define	SIR_SERIAL	29
501.1Sfvdl
511.1Sfvdl/*
521.1Sfvdl * Local APIC masks. Must not conflict with SIR_* above, and must
531.1Sfvdl * be >= NUM_LEGACY_IRQs.
541.1Sfvdl */
551.1Sfvdl#define LIR_TIMER	28
561.1Sfvdl#define LIR_IPI		27
571.1Sfvdl
581.1Sfvdl/*
591.1Sfvdl * Maximum # of interrupt sources per CPU. 32 to fit in one word.
601.1Sfvdl * ioapics can theoretically produce more, but it's not likely to
611.1Sfvdl * happen. For multiple ioapics, things can be routed to different
621.1Sfvdl * CPUs.
631.1Sfvdl */
641.1Sfvdl#define MAX_INTR_SOURCES	32
651.1Sfvdl#define NUM_LEGACY_IRQS		16
661.1Sfvdl
671.1Sfvdl/*
681.1Sfvdl * Low and high boundaries between which interrupt gates will
691.1Sfvdl * be allocated in the IDT.
701.1Sfvdl */
711.1Sfvdl#define IDT_INTR_LOW	(0x20 + NUM_LEGACY_IRQS)
721.1Sfvdl#define IDT_INTR_HIGH	0xef
731.1Sfvdl
741.1Sfvdl#define I386_IPI_HALT			0x00000001
751.1Sfvdl#define I386_IPI_MICROSET		0x00000002
761.1Sfvdl#define I386_IPI_FLUSH_FPU		0x00000004
771.1Sfvdl#define I386_IPI_SYNCH_FPU		0x00000008
781.1Sfvdl#define I386_IPI_TLB			0x00000010
791.1Sfvdl#define I386_IPI_MTRR			0x00000020
801.1Sfvdl#define I386_IPI_GDT			0x00000040
811.1Sfvdl
821.1Sfvdl#define I386_NIPI		7
831.1Sfvdl
841.1Sfvdl#define I386_IPI_NAMES { "halt IPI", "timeset IPI", "FPU flush IPI", \
851.1Sfvdl			 "FPU synch IPI", "TLB shootdown IPI", \
861.1Sfvdl			 "MTRR update IPI", "GDT update IPI" }
871.1Sfvdl
881.1Sfvdl#endif /* _I386_INTRDEFS_H */
89