HDD GURU FORUMS
http://forum.hddguru.com/

how to detect the presence of ata-device(HDD)
http://forum.hddguru.com/viewtopic.php?f=7&t=22857
Page 1 of 1

Author:  corner [ May 6th, 2012, 6:32 ]
Post subject:  how to detect the presence of ata-device(HDD)

Why doesn't ATA-spec(ATA/ATAPI-6) provide the standard about how to detect the presence of ATA-DEVICE(HDD or CD)?
Recently, I look for the stuff about detect ATA-DEVICE in ATA/ATAPI-6 SPEC.
But, what I got is implicit description.

Summary:
ATA/ATAPI-6 wrote:
Chapter 13: Application Layer
Section 13.1: Parallel ATA Emulation
BIOS and system software writers should be aware of the 10 ms latency the interface may incur
in determining device presence, and either ensure the Shadow Status register is read no sooner
than 10 ms after initialization or ensure the Shadow Status register is re-read 10 ms after having
read a value of 7Fh in order to positively determine presence of a device.


Any info should be appreciated

Author:  corner [ May 6th, 2012, 7:02 ]
Post subject:  Re: how to detect the presence of ata-device(HDD)

Sorry, the summary come from SATA3.0-SPEC

Author:  Vulcan [ May 7th, 2012, 17:30 ]
Post subject:  Re: how to detect the presence of ata-device(HDD)

corner wrote:
Why doesn't ATA-spec(ATA/ATAPI-6) provide the standard about how to detect the presence of ATA-DEVICE(HDD or CD)?

I last worked in this area many years ago, but try reading section 9.1 of ATA-4. That section describes & explains the concept of the "drive signature" quite well. Then in ATA-6 you will see an expanded list of signature values, including SATA devices (which are not included in the ATA-4 document).

You haven't explained what type of software / firmware you are writing, and there can be other issues you will need to consider in your code, but hopefully the information above will be helpful to you. :)

Author:  corner [ May 11th, 2012, 22:18 ]
Post subject:  Re: how to detect the presence of ata-device(HDD)

Thank you, I've read section 9.11(Signature and persistence) in ATA-6, not including SATA devices Signature, may included in ATA-7(the Gen1 ATA-spec that support SATA).
After read the section(9.11), I also don't know how to detect the presence of ATA-DEVICE clearly, just via check the master/slave Register-Block ?

Author:  Vulcan [ May 11th, 2012, 22:54 ]
Post subject:  Re: how to detect the presence of ata-device(HDD)

Sorry, I meant to say that the SATA signatures are in ATA-8 (I rarely read ATA-7, so I didn't spend time checking that one), but the discussion about Signatures in that version of the spec is not so good IMHO - which is why I recommended reading ATA-4.

To answer your question, yes, the basic process I used (long ago) was to check the registers which contain the signature - but as I said before, there is more to consider (e.g. think about when the drive signature is put into the registers!), and I have not seen enough details about exactly what you are doing and what results you have got so far, for me to offer further comments at the moment.

Author:  corner [ May 14th, 2012, 7:39 ]
Post subject:  Re: how to detect the presence of ata-device(HDD)

Thank you very much, Vulcan!
Consider there are two ATA-DEVICE(e.g HDD\CDROM) attached to one port of SATA-Controller. They are Primary-DEV0(master) \ Primary-DEV1(slave).
Now, I try to deliver a SOFTWARE-RESET(or other similar command could got the "Signatures"), then I read the appropriate register to get "Signatures". How could I know the "Signatures" is for which Device (for DEV0 or for DEV1)?
ATA-6 wrote:
A device not implementing the PACKET command feature set shall place the signature in the Command
Block registers listed below for power-on reset, hardware reset, software reset, and the EXECUTE DEVICE
DIAGNOSTIC command.
If the device does not implement the PACKET command feature set, the signature shall be:
Sector Count 01h
Sector Number 01h
Cylinder Low 00h
Cylinder High 00h
A device implementing the PACKET command feature set shall place the signature in the Command Block
registers listed below for power-on reset, hardware reset, software reset, the EXECUTE DEVICE
DIAGNOSTIC command, and the DEVICE RESET command. The DEVICE RESET command shall not
change the value of the DEV bit when writing the signature into the Device/Head register for a device
implementing the PACKET command feature set. If the device implements the PACKET command feature
set, the signature is also written in the registers for the IDENTIFY DEVICE and READ SECTOR(S)
commands.
If the device implements the PACKET command feature set, the signature shall be:
Sector Count 01h
Sector Number 01h
Cylinder Low 14h
Cylinder High EBh
Device/Head 000x0000b where x equals 0
except when responding to a
DEVICE RESET command. For
the DEVICE RESET command
the value of x is not changed from
that existing when the command
is written to the Command
register.
Device/Head 00h

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/