Trouble detecting drive for ATA_PIO.
Trouble detecting drive for ATA_PIO.
Hi, I am having trouble detecting the hard disk for my ATA_PIO driver. After sending the interrupt command, the status port comes back as 0? Does this mean I should write a PIC driver to find out where the ATA_PIO ports are? Or is their another soulution?
Re: Trouble detecting drive for ATA_PIO.
What do you mean by “sending the interrupt command”? Do you have an online repository of your code?
Re: Trouble detecting drive for ATA_PIO.
That was i typo, my bad. I meant the IDENTIFY command.iansjack wrote:What do you mean by “sending the interrupt command”? Do you have an online repository of your code?
Re: Trouble detecting drive for ATA_PIO.
Without code, it is almost impossible to guess where problem is.
I assume you mean PCI. If you want serious driver, answer is yes. Hard disk is not everywhere connected to same ports.Caffeine wrote:Does this mean I should write a PIC driver to find out where the ATA_PIO ports are?
Re: Trouble detecting drive for ATA_PIO.
I did mean PCI, again, sorry for the typos. Thanks for the help! I'll make a PCI driver.Klakap wrote:Without code, it is almost impossible to guess where problem is.I assume you mean PCI. If you want serious driver, answer is yes. Hard disk is not everywhere connected to same ports.Caffeine wrote:Does this mean I should write a PIC driver to find out where the ATA_PIO ports are?
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Trouble detecting drive for ATA_PIO.
It sounds an awful lot like you do have an IDE controller at the legacy I/O addresses, but there's no hard drive attached.
Are you testing this in a virtual machine? If so, how did you configure said virtual machine?
Are you testing this in a virtual machine? If so, how did you configure said virtual machine?
Re: Trouble detecting drive for ATA_PIO.
You must know whether there is an IDE drive in your computer (real or virtual). So, is there? If so then there is something wrong in your code (which we can’t see, so can’t guess at your error).
Forget PCI; if you have an IDE drive it will show up at the standard ports.
Forget PCI; if you have an IDE drive it will show up at the standard ports.
Re: Trouble detecting drive for ATA_PIO.
Yeah, I'm using qemu. Here is the command I am using:Octocontrabass wrote:It sounds an awful lot like you do have an IDE controller at the legacy I/O addresses, but there's no hard drive attached.
Are you testing this in a virtual machine? If so, how did you configure said virtual machine?
Code: Select all
qemu-system-i386 -cdrom Binaries/OS.iso -s
But other than that I am using the default settings.
EDIT:
I just replaced the line with:
Code: Select all
qemu-system-i386 -drive file=Binaries/caffieneOS.iso,media=cdrom
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Trouble detecting drive for ATA_PIO.
This attaches a CD drive to the secondary IDE channel. You're probably looking at the primary IDE channel, but this command doesn't attach anything to the primary IDE channel.Caffeine wrote:Code: Select all
qemu-system-i386 -cdrom Binaries/OS.iso -s
This attaches a CD drive to the primary IDE channel.Caffeine wrote:I just replaced the line with:, and now it is detecting something!Code: Select all
qemu-system-i386 -drive file=Binaries/caffieneOS.iso,media=cdrom
Re: Trouble detecting drive for ATA_PIO.
So now the drive does not seem to be ATA. My code to check if it is ATA is:
And i've defined ATA_PRIMARY_LBA_MID as 0x1F4 and ATA_PRIMARY_LBA_HI 0x1F5. I'm pretty sure this is right but if not please let me know. And if I did do it correctly, how do I make the drive ATA. Also, STAT_BSY is defined as (1 << 7).
Code: Select all
while (status & STAT_BSY) { status = inportb(ATA_PRIMARY_COMM_REGSTAT); } // Wait for status bit to clear
unsigned char mid = inportb(ATA_PRIMARY_LBA_MID);
unsigned char hi = inportb(ATA_PRIMARY_LBA_HI);
if (mid != 0 || hi != 0) { print("The drive is not ATA."); return 0; }
Last edited by Caffeine on Tue Apr 05, 2022 2:46 pm, edited 1 time in total.
Re: Trouble detecting drive for ATA_PIO.
That’s correct. A CD drive is not ATA. Try attaching a hard disk.
Re: Trouble detecting drive for ATA_PIO.
I got it working by running the VM with this command:iansjack wrote:That’s correct. A CD drive is not ATA. Try attaching a hard disk.
Code: Select all
qemu-system-i386 -drive file=Binaries/caffieneOS.iso,media=disk,format=raw