diff options
author | jhb <jhb@FreeBSD.org> | 2004-05-11 20:23:24 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2004-05-11 20:23:24 +0000 |
commit | 052c3f46af8417c8d636dc411d8c3b623150e3e3 (patch) | |
tree | ce3dbe1911eeb423f600ca03d164c09ab40ec809 /sys/i386/isa | |
parent | d3dd9c61568d91f6f4aea05a8e113a69ddf9a705 (diff) | |
download | FreeBSD-src-052c3f46af8417c8d636dc411d8c3b623150e3e3.zip FreeBSD-src-052c3f46af8417c8d636dc411d8c3b623150e3e3.tar.gz |
- Move some macros from icu.h into atpic.c as that is the only place they
are used.
- Reduce duplication of a couple of macros removing the duplicates from
ich.h.
- Remove unused macros from icu.h as well as locore protection as this
header is no longer included in assembly sources.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/atpic.c | 27 | ||||
-rw-r--r-- | sys/i386/isa/icu.h | 53 |
2 files changed, 19 insertions, 61 deletions
diff --git a/sys/i386/isa/atpic.c b/sys/i386/isa/atpic.c index 9667c04..a3f834f 100644 --- a/sys/i386/isa/atpic.c +++ b/sys/i386/isa/atpic.c @@ -65,6 +65,16 @@ __FBSDID("$FreeBSD$"); #define SLAVE 1 /* + * PC-98 machines wire the slave 8259A to pin 7 on the master PIC, and + * PC-AT machines wire the slave PIC to pin 2 on the master PIC. + */ +#ifdef PC98 +#define ICU_SLAVEID 7 +#else +#define ICU_SLAVEID 2 +#endif + +/* * Determine the base master and slave modes not including auto EOI support. * All machines that FreeBSD supports use 8086 mode. */ @@ -93,7 +103,8 @@ __FBSDID("$FreeBSD$"); #define SLAVE_MODE BASE_SLAVE_MODE #endif -#define IMEN_MASK(ai) (1 << (ai)->at_irq) +#define IRQ_MASK(irq) (1 << (irq)) +#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) #define NUM_ISA_IRQS 16 @@ -215,7 +226,7 @@ atpic_eoi_master(struct intsrc *isrc) ("%s: mismatched pic", __func__)); #ifndef AUTO_EOI_1 mtx_lock_spin(&icu_lock); - outb(atpics[MASTER].at_ioaddr, ICU_EOI); + outb(atpics[MASTER].at_ioaddr, OCW2_EOI); mtx_unlock_spin(&icu_lock); #endif } @@ -232,9 +243,9 @@ atpic_eoi_slave(struct intsrc *isrc) ("%s: mismatched pic", __func__)); #ifndef AUTO_EOI_2 mtx_lock_spin(&icu_lock); - outb(atpics[SLAVE].at_ioaddr, ICU_EOI); + outb(atpics[SLAVE].at_ioaddr, OCW2_EOI); #ifndef AUTO_EOI_1 - outb(atpics[MASTER].at_ioaddr, ICU_EOI); + outb(atpics[MASTER].at_ioaddr, OCW2_EOI); #endif mtx_unlock_spin(&icu_lock); #endif @@ -371,9 +382,9 @@ i8259_init(struct atpic *pic, int slave) * which line on the master we are connected to. */ if (slave) - outb(imr_addr, ICU_SLAVEID); /* my slave id is 7 */ + outb(imr_addr, ICU_SLAVEID); else - outb(imr_addr, IRQ_SLAVE); /* slave on line 7 */ + outb(imr_addr, IRQ_MASK(ICU_SLAVEID)); /* Set mode. */ if (slave) @@ -493,7 +504,7 @@ atpic_handle_intr(struct intrframe iframe) { struct intsrc *isrc; - KASSERT((u_int)iframe.if_vec < ICU_LEN, + KASSERT((u_int)iframe.if_vec < NUM_ISA_IRQS, ("unknown int %d\n", iframe.if_vec)); isrc = &atintrs[iframe.if_vec].at_intsrc; @@ -515,7 +526,7 @@ atpic_handle_intr(struct intrframe iframe) isr = inb(port); outb(port, OCW3_SEL | OCW3_RR); mtx_unlock_spin(&icu_lock); - if ((isr & IRQ7) == 0) + if ((isr & IRQ_MASK(7)) == 0) return; } intr_execute_handlers(isrc, &iframe); diff --git a/sys/i386/isa/icu.h b/sys/i386/isa/icu.h index 60368ec..b882022 100644 --- a/sys/i386/isa/icu.h +++ b/sys/i386/isa/icu.h @@ -41,66 +41,13 @@ #ifndef _I386_ISA_ICU_H_ #define _I386_ISA_ICU_H_ -/* - * Interrupt enable bits - in normal order of priority (which we change) - */ -#ifdef PC98 -#define IRQ0 0x0001 -#define IRQ1 0x0002 -#define IRQ2 0x0004 -#define IRQ3 0x0008 -#define IRQ4 0x0010 -#define IRQ5 0x0020 -#define IRQ6 0x0040 -#define IRQ7 0x0080 -#define IRQ_SLAVE 0x0080 -#define IRQ8 0x0100 -#define IRQ9 0x0200 -#define IRQ10 0x0400 -#define IRQ11 0x0800 -#define IRQ12 0x1000 -#define IRQ13 0x2000 -#define IRQ14 0x4000 -#define IRQ15 0x8000 -#else -#define IRQ0 0x0001 /* highest priority - timer */ -#define IRQ1 0x0002 -#define IRQ_SLAVE 0x0004 -#define IRQ8 0x0100 -#define IRQ9 0x0200 -#define IRQ2 IRQ9 -#define IRQ10 0x0400 -#define IRQ11 0x0800 -#define IRQ12 0x1000 -#define IRQ13 0x2000 -#define IRQ14 0x4000 -#define IRQ15 0x8000 -#define IRQ3 0x0008 /* this is highest after rotation */ -#define IRQ4 0x0010 -#define IRQ5 0x0020 -#define IRQ6 0x0040 -#define IRQ7 0x0080 /* lowest - parallel printer */ -#endif - -/* - * Interrupt Control offset into Interrupt descriptor table (IDT) - */ -#define ICU_OFFSET 32 /* 0-31 are processor exceptions */ -#define ICU_LEN 16 /* 32-47 are ISA interrupts */ - #ifdef PC98 #define ICU_IMR_OFFSET 2 -#define ICU_SLAVEID 7 #else #define ICU_IMR_OFFSET 1 -#define ICU_SLAVEID 2 #endif -#define ICU_EOI (OCW2_EOI) /* non-specific EOI */ - -#ifndef LOCORE void atpic_handle_intr(struct intrframe iframe); void atpic_startup(void); -#endif #endif /* !_I386_ISA_ICU_H_ */ |