ATA Driver Problems

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Freenode IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

ATA Driver Problems

Post by pcmattman »

OK, I have some sudden problems in my ATA driver that are really frustrating me. It worked 2 days ago, and then I made some changes to my driver management code and suddenly nothing is working anymore.

The current problem is that I can't read data off the drive - I just get a full sector of NULLs (see the pic below). I have no idea why it doesn't work and I've tried everything. Still, I cannot read in the sector. I'll restart my PC and load up Bochs and see if I can get a bit more information, but if anyone can give any hints that'd be great.

Image
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

I would be able to help if I could look at the source code of your procedure/function but the problem that I used to have was that I was not setting the "L" bit (that is the 6th bit) of the Device/Head register in order to enable LBA addressing. When you are reading in LBA more, the value 0x00000040 (L BIT) must be mixed with Device/Head Register's default value (compliant with ATA-1 but not of any use with ATA-4 and forth) 0x000000A0.

There are also a lot of other things that you have to consider before attempting to read from the Data Register of either the primary or the secondary IDE controller like checking the BSY/DRQ bits of the Status Register. Also make sure that the DRV bit in the Device/Head register is set to 0 for Drive0 and set to 1 for Drive1 of that IDE Controller you are working with.

Again, I could help more if I had the source code to your procedure/function that doesn't work.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Freenode IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Edit: <snip>

My mistake, I just realized I was mixing a descriptor with a device ID :D. Problem solved.
Post Reply