First of all, the drive's first 16bits returned are all 1s which seems to conflict. Second the serial is reported as:
XXXXXXXZXXXXXXXXXZXX
I'm not sure if Bochs is just weird when it comes to giving virtual drives serials, or what. Here's the read code:
Code: Select all
void idedriveinfo(ushort device)
{
inportb(device + IDEERROR); //0x1F1
idedrivewait(device, IDESTATUSREADY + IDESTATUSSEEKCOMPLETE); //0x1F0, 01010000b
outportb(device + IDEDRIVEHEAD, IDEDRIVEHEADRESERVED + IDEDRIVEHEADPRIMARY); //0x1F6, 0xA0
outportb(device + IDECOMMAND, IDECOMMANDIDENT); //0x1F7, 0xEC
idedrivewait(device, IDESTATUSREADY + IDESTATUSSEEKCOMPLETE + IDESTATUSDRQ); //0x1F0, 01011000b
kprintf("IDE Probe of Device at: 0x%h\n", device);
kprintf("Flags: %b%b \n", inportb(device), inportb(device));
uint i = 0;
for(i = 10; i>0;i--)
{
inportb(device);
inportb(device);
}
char serial[21];
serial[20] = 0;
for(i=20;i>0;i--)
serial[i-1] = inportb(device);
kprintf(serial);
}
So does anyone see a problem with this code, or is Bochs just unreliable/strange in it's reporting of serials?
I'm getting all of my information from http://www.nondot.org/sabre/os/files/Disk/IDE-tech.html and http://www.nondot.org/sabre/os/files/Di ... rogate.zip