ATA driver

Programming, for all ages and all languages.
Post Reply
grenders22
Posts: 16
Joined: Thu Mar 01, 2018 10:09 am

ATA driver

Post by grenders22 »

Good day! The ATA driver successfully works in the QEMU, but does not work on the real machine. Status is always 0xff. What could be the problem?

PS I understand that the qemu and the real machine are different, but what exactly the difference I do not understand.
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: ATA driver

Post by Octocontrabass »

It's not sensible for the status register to have the value 0xFF. You're probably reading at the wrong address.

Did you search the PCI bus for the PCI IDE controller and read its BARs to determine the addresses to use? Newer hardware is less likely to bother with ensuring IDE controllers are using legacy AT-compatible addresses, and SATA controllers are often not configured to emulate IDE at all.
grenders22
Posts: 16
Joined: Thu Mar 01, 2018 10:09 am

Re: ATA driver

Post by grenders22 »

Octocontrabass wrote:It's not sensible for the status register to have the value 0xFF. You're probably reading at the wrong address.

Did you search the PCI bus for the PCI IDE controller and read its BARs to determine the addresses to use? Newer hardware is less likely to bother with ensuring IDE controllers are using legacy AT-compatible addresses, and SATA controllers are often not configured to emulate IDE at all.
Thanks for the answer. Literally 5 minutes ago, I realized that the pc just does not support ide. After reading in the wiki, I realized that they are different.(ide and ahci) I understood correctly?

PS I have difficulty translating English texts.
Last edited by grenders22 on Mon Nov 05, 2018 12:30 pm, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: ATA driver

Post by Octocontrabass »

grenders22 wrote:Literally 5 minutes ago, I realized that the pc just does not support ide.
Check the BIOS. Sometimes you can change it to use IDE emulation for SATA.
grenders22
Posts: 16
Joined: Thu Mar 01, 2018 10:09 am

Re: ATA driver

Post by grenders22 »

Octocontrabass wrote:
grenders22 wrote:Literally 5 minutes ago, I realized that the pc just does not support ide.
Check the BIOS. Sometimes you can change it to use IDE emulation for SATA.
Checked, only AHCI. :(
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: ATA driver

Post by BrightLight »

grenders22 wrote:Checked, only AHCI. :(
Then you answered yourself: you need to write an AHCI driver.

Just as a side note, like Octocontrabass said, newer hardware with IDE controllers or SATA controller in IDE emulation mode won't place their I/O registers at ports 0x1F0-0x170; instead you'll need to scan the PCI bus for an IDE controller and read the BARs, which contains the base I/O ports for two ATA channels.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Post Reply