Page 1 of 1

ATA Driver Problems

Posted: Fri Jul 13, 2007 11:34 pm
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

Posted: Sat Jul 14, 2007 7:43 am
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.

Posted: Sat Jul 14, 2007 4:39 pm
by pcmattman
Edit: <snip>

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