ATA not detecting!
Posted: Sun May 13, 2018 11:54 am
Hi all, have a good day. Im tested my os in qemu, virtualbox, bochs, but on real hardware my detecting procedure says, that i haven't any ATA devices. On PC all, may be ok, not tested for read/write, but on notebook function 'detect' returns 0xFF and 0xFFFF 256 times info. Any ideas?
that my code:
Cheers,
Aleksandr
that my code:
Code: Select all
//Выбераем диск
outportb(port + 6, 0xA0 | slavebit);
//Кол-во секторов 0
outportb(port + 2, 0);
//LBA 0
outportb(port + 3, 0);
outportb(port + 4, 0);
outportb(port + 5, 0);
//IDENTIFY command
outportb(port + 7, 0xEC);
char x = inportb(port + 7);
while (x & 0x80) {
x = inportb(port + 7);
if (x & 1) break;
}
if (x == 0 || x & 1) {
//Диска нету/ошибка
return;
}
unsigned short u = inportw(port);
kprintf("\n");
returned[0] = u;
kprintf("%x ",returned[0]);
for (int i = 1; i < 256; i++)
{
returned[i] = inportw(port);
kprintf("%x ",returned[i]);
}
while(getKey()==0);
ATADevices[deviceCount].port = port;
ATADevices[deviceCount].slavebit = slavebit;
if (returned[83] & 1 << 10 != 0) {
ATADevices[deviceCount].isLBA48Supported = 1;
ATADevices[deviceCount].LBA48 = (returned[103] << 48) + (returned[102] << 32) + (returned[101] << 16) + returned[100];
diskDevices[dcount].sectorsCount = ATADevices[deviceCount].LBA48;
diskDevices[dcount].readSectors = & ReadController;
diskDevices[dcount].writeSectors = & WriteController;
diskDevices[dcount].ataNo = deviceCount;
diskDevices[dcount].type = DISK_TYPE_ATA;
if (ATADevices[deviceCount].LBA48 == 0)
return;
} else {
ATADevices[deviceCount].isLBA48Supported = 0;
ATADevices[deviceCount].LBA28 = returned[61] << 16 + returned[60];
diskDevices[dcount].sectorsCount = ATADevices[deviceCount].LBA28;
diskDevices[dcount].readSectors = & ReadController;
diskDevices[dcount].writeSectors = & WriteController;
diskDevices[dcount].ataNo = deviceCount;
diskDevices[dcount].type = DISK_TYPE_ATA;
if (ATADevices[deviceCount].LBA28 == 0)
return;
}
dcount++;
deviceCount++;
Aleksandr