OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 11:09 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: ATA not detecting!
PostPosted: Sun May 13, 2018 11:54 am 
Offline
Member
Member

Joined: Sat Sep 24, 2016 12:06 am
Posts: 90
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:
Code:
//Выбераем диск
    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++;

Cheers,
Aleksandr


Top
 Profile  
 
 Post subject: Re: ATA not detecting!
PostPosted: Tue May 15, 2018 9:36 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
MrLolthe1st wrote:
on notebook function 'detect' returns 0xFF and 0xFFFF 256 times info.

Does your notebook have an IDE-compatible HBA? Most SATA HBAs can be configured for IDE compatibility in the BIOS setup.

Are you accessing the HBA on the correct ports? Modern HBAs don't always use port 0x1F0-0x1F7.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group