Page 1 of 1

ATA driver

Posted: Mon Nov 05, 2018 11:48 am
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.

Re: ATA driver

Posted: Mon Nov 05, 2018 12:17 pm
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.

Re: ATA driver

Posted: Mon Nov 05, 2018 12:27 pm
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.

Re: ATA driver

Posted: Mon Nov 05, 2018 12:30 pm
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.

Re: ATA driver

Posted: Mon Nov 05, 2018 12:31 pm
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. :(

Re: ATA driver

Posted: Mon Nov 05, 2018 4:18 pm
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.