What is the point of read/write buffer in ATA?

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
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

What is the point of read/write buffer in ATA?

Post by Ethin »

So, this is kinda confusing and seems pointless to me. As ya'll know, ACS-4 defines "read buffer" and "write buffer" commands. The descriptions, for each, are:
The READ BUFFER command enables the host to read a 512-byte block of data. The command prior to a READ BUFFER command should be a WRITE BUFFER command. If the READ BUFFER command is not preceded by a WRITE BUFFER command, the data returned by READ BUFFER command may be indeterminate.
And:
The WRITE BUFFER command writes the contents of one 512-byte block of data to the device’s buffer. The READ BUFFER command and WRITE BUFFER command shall be synchronized within the device such that sequential WRITE BUFFER command and READ BUFFER command access the same bytes within the buffer.
[/quote]
And I'm just wondering, what is the point of these? What could they be used for in a practical setting? And do these descriptions mean that if I write data into the buffer -- whatever that is -- I have to then immediately read it back out?
Octocontrabass
Member
Member
Posts: 5574
Joined: Mon Mar 25, 2013 7:01 pm

Re: What is the point of read/write buffer in ATA?

Post by Octocontrabass »

Ethin wrote:And I'm just wondering, what is the point of these? What could they be used for in a practical setting?
They're diagnostic commands. They can be used to detect communication errors. They could also be used to detect problems with the drive's buffer, but I think you'd need vendor-specific commands in order to choose which part of the buffer you're accessing.
Ethin wrote:And do these descriptions mean that if I write data into the buffer -- whatever that is -- I have to then immediately read it back out?
It means that if you do WRITE BUFFER followed by READ BUFFER with no commands in between, you're guaranteed to read the data you wrote. You don't have to read it, but I can't imagine why you would write the buffer if you're not going to read it.
Post Reply