Hey guys, I am playing with the
xv6 kernel and want to improve its IDE disk driver. The xv6 doc said ''
Modern disk controllers typically accept a batch of disk requests at a time", and that is my goal. But as far as I know, IDE driver uses in/out instructions to communicate with disk, as the following code shows:
Code:
idewait(0);// wait for IDE disk to become ready.
outb(0x3f6, 0); // generate interrupt
outb(0x1f2, sector_per_block); // number of sectors
outb(0x1f3, sector & 0xff);
outb(0x1f4, (sector >> 8) & 0xff);
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
outb(0x1f7, IDE_CMD_WRITE);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, IDE_CMD_READ);
}
Based on above knowledge, I don't know how to implement an IDE driver that can issue a batch of requests(e.g., read block 3, read block 5) to disk all at once. Maybe I can use a loop to wrap all
outbs in above code? I want someone to point me to the right direction, thanks.