When I start a hard disk read ,e.g ide_read(0, buf, 1);
I indeed can receive a IDE IRQ, But if I read hard disk again in interrupt handler, I can't receive a IDE IRQ anymore.
Code: Select all
int
ide_read(uint32_t secno, void *dst, size_t nsecs)
{
int r;
assert(nsecs <= 256);
ide_wait_ready(0);
outb(0x1F2, nsecs);
outb(0x1F3, secno & 0xFF);
outb(0x1F4, (secno >> 8) & 0xFF);
outb(0x1F5, (secno >> 16) & 0xFF);
outb(0x1F6, 0xE0 | ((diskno&1)<<4) | ((secno>>24)&0x0F));
outb(0x1F7, 0x20); // CMD 0x20 means read sector
return 0;
}
static void
do_hd_interrupt(struct frame *tf)
{
printk("CPU:%d IRQ_IDE \n",get_cpuid());
insl(0x1F0, buf, 512/4);
get_stat();
ide_read(200, buf, 1);
get_stat();
printk("%x\n",inb(0x3F6));
}