detecting ata version

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
RaffoPazzo
Posts: 23
Joined: Tue Apr 05, 2011 11:34 am

detecting ata version

Post by RaffoPazzo »

Since 1994 up till todays 8 standards of the ATA interface (eventually with the Packet Interface since version 4) have been released.

Quick search did not end up showing how detect which version the controller is compliant to. Is there a way to achieve such a detection? Do you use different drivers for different ATA versions or just a big and (very) smart driver able to handle every controller?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: detecting ata version

Post by Brynet-Inc »

They're all revisions of the same specification, introducing only new features.. possibly depreciating others, no radical redesigns.

For the most part the t10/t13 specifications define only the electrical conventions used by ATA and not how a controller should be exposed to programmers.

The "PCI IDE Controller Specification" and "Programming Interface for Bus Master IDE Controller" guides are useful for writing generic drivers, as well as datasheets from particular vendors.

You can find them on Google in your preferred format.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
RaffoPazzo
Posts: 23
Joined: Tue Apr 05, 2011 11:34 am

Re: detecting ata version [ solved ]

Post by RaffoPazzo »

Brynet-Inc wrote:They're all revisions of the same specification, introducing only new features.. possibly depreciating others, no radical redesigns.
"Introducing new features and depreciating other" is the issue. An ATA-6 driver expecting some features to be implemented (or not) wouldn't optimize performances on a ATA-1 device or even not be able to get the device working, just because the feature is not implemented. What I mean is: ATA version does really matter, it's not just a cosmetic revision of a couple of bits.

I guess to have found how detect wich ATA version the device is compliant to. For each version the Identify Command result has to be parsed.

ATA-1: Bit 1 of word 53 have to be 0, because reserved.
ATA-2: Bit 1 of word 53 have to be 1, meaning that words 64-70 are valid (previously reserved in ATA-1)
ATA-3 through (future) ATA/ATAPI-14 have dedicated bits in word 80. If bit 3 is set, ATA-3 is supported. If bit 4 is set ATA/ATAPI-4 is supported and so on till bit 14 for (future) ATA/ATAPI-14. Be careful on this anyway, because strange things happen in the specification. Infact, word 80 in ATA-3 and ATA/ATAPI-4 define bit 1 and 2 to be set if the device supports, respectively, ATA-1 and ATA-2 but, later on, bit 1, 2 and 3, became progressively obsolete, respectively, in ATA/ATAPI-5, ATA/ATAPI-6 and ATA/ATAPI-7.
RaffoPazzo
Posts: 23
Joined: Tue Apr 05, 2011 11:34 am

Re: detecting ata version

Post by RaffoPazzo »

berkus wrote:You can put this into Deprecated article on OSdev Wiki.
Ok, i know i'm going to be pointed as an idiot but i can't find the Deprecated articles section :D
The only thing related to "Deprecated" that i can find is http://wiki.osdev.org/Deprecated, do you mean that?
Post Reply