1 /*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.386.c% 9 * 10 * @(#)icu.h 5.7 (Berkeley) 11/16/91 11 */ 12 13 /* 14 * AT/386 Interrupt Control constants 15 * W. Jolitz 8/89 16 */ 17 18 #ifndef __ICU__ 19 #define __ICU__ 20 21 #ifndef LOCORE 22 23 /* 24 * Interrupt "level" mechanism variables, masks, and macros 25 */ 26 extern unsigned short imen; /* interrupt mask enable */ 27 extern unsigned short cpl; /* current priority level mask */ 28 29 extern unsigned short highmask; /* group of interrupts masked with splhigh() */ 30 extern unsigned short ttymask; /* group of interrupts masked with spltty() */ 31 extern unsigned short biomask; /* group of interrupts masked with splbio() */ 32 extern unsigned short netmask; /* group of interrupts masked with splimp() */ 33 34 #define INTREN(s) imen &= ~(s) 35 #define INTRDIS(s) imen |= (s) 36 #define INTRMASK(msk,s) msk |= (s) 37 38 #else 39 40 /* 41 * Macro's for interrupt level priority masks (used in interrupt vector entry) 42 */ 43 44 /* Mask a group of interrupts atomically */ 45 #define INTR(unit,mask,offst) \ 46 cli ; \ 47 pushl $0 ; \ 48 nop ; \ 49 pushl $ T_ASTFLT ; \ 50 nop ; \ 51 pushal ; \ 52 nop ; \ 53 movb $0x20,%al ; \ 54 outb %al,$ IO_ICU1 ; \ 55 outb %al,$ IO_ICU2 ; \ 56 pushl %ds ; \ 57 pushl %es ; \ 58 movw $0x10, %ax ; \ 59 movw %ax, %ds ; \ 60 movw %ax,%es ; \ 61 incl _cnt+V_INTR ; \ 62 incl _isa_intr + offst * 4 ; \ 63 movzwl _cpl,%eax ; \ 64 pushl %eax ; \ 65 pushl $ unit ; \ 66 orw mask ,%ax ; \ 67 movw %ax,_cpl ; \ 68 orw _imen,%ax ; \ 69 outb %al,$ IO_ICU1+1 ; \ 70 movb %ah,%al ; \ 71 outb %al,$ IO_ICU2+1 ; \ 72 sti ; 73 74 /* Interrupt vector exit macros */ 75 76 /* First eight interrupts (ICU1) */ 77 #define INTREXIT1 \ 78 jmp doreti 79 80 /* Second eight interrupts (ICU2) */ 81 #define INTREXIT2 \ 82 jmp doreti 83 84 #endif 85 86 /* 87 * Interrupt enable bits -- in order of priority 88 */ 89 #define IRQ0 0x0001 /* highest priority - timer */ 90 #define IRQ1 0x0002 91 #define IRQ_SLAVE 0x0004 92 #define IRQ8 0x0100 93 #define IRQ9 0x0200 94 #define IRQ2 IRQ9 95 #define IRQ10 0x0400 96 #define IRQ11 0x0800 97 #define IRQ12 0x1000 98 #define IRQ13 0x2000 99 #define IRQ14 0x4000 100 #define IRQ15 0x8000 101 #define IRQ3 0x0008 102 #define IRQ4 0x0010 103 #define IRQ5 0x0020 104 #define IRQ6 0x0040 105 #define IRQ7 0x0080 /* lowest - parallel printer */ 106 107 /* 108 * Interrupt Control offset into Interrupt descriptor table (IDT) 109 */ 110 #define ICU_OFFSET 32 /* 0-31 are processor exceptions */ 111 #define ICU_LEN 16 /* 32-47 are ISA interrupts */ 112 113 #endif __ICU__ 114