When I try to wait for the first disk in the secondary IDE controller to be free in QEMU, inb(0x177) always returns 0)
Steps followed:
I tried adding a 3rd disk to QEMU by doing the following:
1) Create a new blank disk image 2) Adding the image as hdc in QEMU options 3) Creating a new file called ide.c to handle the secondary channel. (Using ports 0x17* instead of 0x1F* as specified in the h/w manual)
In ide.c, I have the following to check if the secondary controller exists:
outb(0x173, 0x88);
int r = inb(0x173);
printf("SECONDARY DISK CONTROLLER%s\n", r==0x88?" present":"not present")
& it shows that it does.
But the check device not busy does not work. Does anybody know why that is?
static int
ide_wait_ready(bool check_error)
{
int r;
//WAIT FOR !BUSY
while (((r = inb(0x177)) > 0)
;
}