View Single Post
Old 05 June 2011, 14:56  
Toni Wilen
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,947
I may have (finally) found the problem..

When AOS IDE driver gets transfer that is longer than 256 bytes, it splits it in two or more pieces (because max ATA transfer is 256 blocks). After first piece has finished, it reads IDE CHS/LBA registers, adds one to address and then writes it back as start address of second piece. (ATA spec says they contain last read/written address) So far so good but:

ATA-1 spec says:

At command completion, the Command Block Registers contain the cylinder, head, and sector number of the last sector read.

ATA-2 spec says:

This register shall be updated to reflect the media address of the error when a media access command is unsuccessfully completed.

NOTE 9 - Prior to the development of this standard, this register was updated at the end of every media access command to reflect the current media address

In other words ATA-2 or newer device does not need to update CHS/LBA address after command finishes normally, only in error situations. This will break AOS ATA driver logic, start address of second piece becomes invalid (I assume drive keeps old values unmodified, second piece of data overwrites beginning of first piece which also explains why filesystem structure corruption has never been reported, only data corruption)

NOTE: This theory is not tested! (EDIT: it is now)

Last edited by Toni Wilen; 14 August 2011 at 11:15.
Toni Wilen is offline  
Page generated in 0.07427 seconds with 10 queries