提交 1a43a88b 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Automatic EOI doesn't work on tom. Add piceoi.

上级 789a5877
......@@ -100,7 +100,7 @@ fs.img: mkfs README $(UPROGS)
clean:
rm -f *.o *.d *.asm *.sym initcode kernel bootother mkfs fs.img
QEMUOPTS = -smp $(CPUS) -m 512 -nographic
QEMUOPTS = -smp $(CPUS) -m 512
qemu: kernel
$(QEMU) $(QEMUOPTS) -kernel kernel
gdb: kernel
......
......@@ -155,6 +155,7 @@ void* ns_enumerate_key(struct ns *ns, struct nskey key, void *(*f)(voi
// picirq.c
void picenable(int);
void piceoi(void);
// pipe.c
int pipealloc(struct file**, struct file**);
......
......@@ -28,6 +28,18 @@ picenable(int irq)
picsetmask(irqmask & ~(1<<irq));
}
void
piceoi(void)
{
// OCW2: rse00xxx
// r: rotate
// s: specific
// e: end-of-interrupt
// xxx: specific interrupt line
outb(IO_PIC1, 0x20);
outb(IO_PIC2, 0x20);
}
// Initialize the 8259A interrupt controllers.
void
initpic(void)
......@@ -59,15 +71,15 @@ initpic(void)
// can be hardwired).
// a: 1 = Automatic EOI mode
// p: 0 = MCS-80/85 mode, 1 = intel x86 mode
outb(IO_PIC1+1, 0x3);
outb(IO_PIC1+1, 0x1);
// Set up slave (8259A-2)
outb(IO_PIC2, 0x11); // ICW1
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
outb(IO_PIC2+1, IRQ_SLAVE); // ICW3
// NB Automatic EOI mode doesn't tend to work on the slave.
// Linux source code says it's "to be investigated".
outb(IO_PIC2+1, 0x3); // ICW4
outb(IO_PIC2+1, 0x1); // ICW4
// OCW3: 0ef01prs
// ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask
......
......@@ -82,6 +82,7 @@ trap(struct trapframe *tf)
case T_IRQ0 + IRQ_IDE:
ideintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
......@@ -89,14 +90,16 @@ trap(struct trapframe *tf)
case T_IRQ0 + IRQ_KBD:
kbdintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + IRQ_COM1:
uartintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
cprintf("cpu%d: spurious interrupt at %x:%lx\n",
mycpu()->id, tf->cs, tf->rip);
lapiceoi();
case T_TLBFLUSH:
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论