<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/ata.h, branch v3.2.83</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.83</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.83'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2016-04-01T00:54:32Z</updated>
<entry>
<title>libata: fix HDIO_GET_32BIT ioctl</title>
<updated>2016-04-01T00:54:32Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2016-02-11T13:16:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=846b4032720fd8815984aaafc6cbb46f86063306'/>
<id>urn:sha1:846b4032720fd8815984aaafc6cbb46f86063306</id>
<content type='text'>
commit 287e6611ab1eac76c2c5ebf6e345e04c80ca9c61 upstream.

As reported by Soohoon Lee, the HDIO_GET_32BIT ioctl does not
work correctly in compat mode with libata.

I have investigated the issue further and found multiple problems
that all appeared with the same commit that originally introduced
HDIO_GET_32BIT handling in libata back in linux-2.6.8 and presumably
also linux-2.4, as the code uses "copy_to_user(arg, &amp;val, 1)" to copy
a 'long' variable containing either 0 or 1 to user space.

The problems with this are:

* On big-endian machines, this will always write a zero because it
  stores the wrong byte into user space.

* In compat mode, the upper three bytes of the variable are updated
  by the compat_hdio_ioctl() function, but they now contain
  uninitialized stack data.

* The hdparm tool calling this ioctl uses a 'static long' variable
  to store the result. This means at least the upper bytes are
  initialized to zero, but calling another ioctl like HDIO_GET_MULTCOUNT
  would fill them with data that remains stale when the low byte
  is overwritten. Fortunately libata doesn't implement any of the
  affected ioctl commands, so this would only happen when we query
  both an IDE and an ATA device in the same command such as
  "hdparm -N -c /dev/hda /dev/sda"

* The libata code for unknown reasons started using ATA_IOC_GET_IO32
  and ATA_IOC_SET_IO32 as aliases for HDIO_GET_32BIT and HDIO_SET_32BIT,
  while the ioctl commands that were added later use the normal
  HDIO_* names. This is harmless but rather confusing.

This addresses all four issues by changing the code to use put_user()
on an 'unsigned long' variable in HDIO_GET_32BIT, like the IDE subsystem
does, and by clarifying the names of the ioctl commands.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reported-by: Soohoon Lee &lt;Soohoon.Lee@f5.com&gt;
Tested-by: Soohoon Lee &lt;Soohoon.Lee@f5.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>libata: Use integer return value for atapi_command_packet_set</title>
<updated>2013-04-25T19:25:31Z</updated>
<author>
<name>Shan Hai</name>
<email>shan.hai@windriver.com</email>
</author>
<published>2013-03-18T02:30:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=274c4edc025428ca6a856c201f331abde3794192'/>
<id>urn:sha1:274c4edc025428ca6a856c201f331abde3794192</id>
<content type='text'>
commit d8668fcb0b257d9fdcfbe5c172a99b8d85e1cd82 upstream.

The function returns type of ATAPI drives so it should return integer value.
The commit 4dce8ba94c7 (libata: Use 'bool' return value for ata_id_XXX) since
v2.6.39 changed the type of return value from int to bool, the change would
cause all of the ATAPI class drives to be treated as TYPE_TAPE and the
max_sectors of the drives to be set to 65535 because of the commit
f8d8e5799b7(libata: increase 128 KB / cmd limit for ATAPI tape drives), for the
function would return true for all ATAPI class drives and the TYPE_TAPE is
defined as 0x01.

Signed-off-by: Shan Hai &lt;shan.hai@windriver.com&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>libata: Use 'bool' return value for ata_id_XXX</title>
<updated>2011-03-15T06:42:32Z</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2011-03-14T07:54:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4dce8ba94c751dd25f1d9b2d35c04312b046e5d6'/>
<id>urn:sha1:4dce8ba94c751dd25f1d9b2d35c04312b046e5d6</id>
<content type='text'>
Most ata_id_XXX inlines are simple tests, so we should set
the return value to 'bool' here.

Signed-off-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@pobox.com&gt;
</content>
</entry>
<entry>
<title>libata: Include WWN ID in inquiry VPD emulation</title>
<updated>2011-03-14T06:59:37Z</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2011-03-07T07:56:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6b3b9d73e08d8939aaf54f85bb47495171f49e20'/>
<id>urn:sha1:6b3b9d73e08d8939aaf54f85bb47495171f49e20</id>
<content type='text'>
As per SAT-3 the WWN ID should be included in the VPD page 0x83
(device identification) emulation.

Signed-off-by: Hannes Reinecke &lt;hare@suse.de&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@pobox.com&gt;
</content>
</entry>
<entry>
<title>[libata] support for &gt; 512 byte sectors (e.g. 4K Native)</title>
<updated>2010-10-22T00:21:03Z</updated>
<author>
<name>Grant Grundler</name>
<email>grundler@google.com</email>
</author>
<published>2010-08-17T17:56:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=295124dce4ddfd40b1f12d3ffd2779673e87c701'/>
<id>urn:sha1:295124dce4ddfd40b1f12d3ffd2779673e87c701</id>
<content type='text'>
This change enables my x86 machine to recognize and talk to a
"Native 4K" SATA device.

When I started working on this, I didn't know Matthew Wilcox had
posted a similar patch 2 years ago:
  http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors

Gwendal Grignou pointed me at the the above code and small portions of
this patch include Matthew's work. That's why Mathew is first on the
"Signed-off-by:". I've NOT included his use of a bitmap to determine
512 vs Native for ATA command block size - just used a simple table.
And bugs are almost certainly mine.

Lastly, the patch has been tested with a native 4K 'Engineering
Sample' drive provided by Hitachi GST.

Signed-off-by: Matthew Wilcox &lt;matthew.r.wilcox@intel.com&gt;
Signed-off-by: Grant Grundler &lt;grundler@google.com&gt;
Reviewed-by: Gwendal Grignou &lt;gwendal@google.com&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
<entry>
<title>libata-sff: prd is BMDMA specific</title>
<updated>2010-05-19T17:38:54Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-05-10T19:41:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f60d70113fa04e32aee2dedbf304a48469c9c45c'/>
<id>urn:sha1:f60d70113fa04e32aee2dedbf304a48469c9c45c</id>
<content type='text'>
struct ata_prd and ap-&gt;prd are BMDMA specific.  Add bmdma_ prefix to
them and move them inside CONFIG_ATA_SFF.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
<entry>
<title>libata: Fix accesses at LBA28 boundary (old bug, but nasty) (v2)</title>
<updated>2010-04-08T16:53:57Z</updated>
<author>
<name>Mark Lord</name>
<email>kernel@teksavvy.com</email>
</author>
<published>2010-04-07T17:52:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=45c4d015a92f72ec47acd0c7557abdc0c8a6499d'/>
<id>urn:sha1:45c4d015a92f72ec47acd0c7557abdc0c8a6499d</id>
<content type='text'>
Most drives from Seagate, Hitachi, and possibly other brands,
do not allow LBA28 access to sector number 0x0fffffff (2^28 - 1).
So instead use LBA48 for such accesses.

This bug could bite a lot of systems, especially when the user has
taken care to align partitions to 4KB boundaries. On misaligned systems,
it is less likely to be encountered, since a 4KB read would end at
0x10000000 rather than at 0x0fffffff.

Signed-off-by: Mark Lord &lt;mlord@pobox.com&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
<entry>
<title>ata: Detect Delkin Devices compact flash</title>
<updated>2010-03-01T20:11:32Z</updated>
<author>
<name>Ben Gardner</name>
<email>gardner.ben@gmail.com</email>
</author>
<published>2010-02-23T18:41:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4b7d1c0509d0d07edc731f990791dc5518e51617'/>
<id>urn:sha1:4b7d1c0509d0d07edc731f990791dc5518e51617</id>
<content type='text'>
I have a Delkin Devices compact flash card that isn't being recognized using the
SATA/PATA drivers.
The card is recognized and works with the deprecated ATA drivers.

The error I am seeing is:
ata1.00: failed to IDENTIFY (device reports invalid type, err_mask=0x0)

I tracked it down to ata_id_is_cfa() in include/linux/ata.h.
The Delkin card has id[0] set to 0x844a and id[83] set to 0.
This isn't what the kernel expects and is probably incorrect.

The simplest work-around is to add a check for 0x844a to ata_id_is_cfa().

Signed-off-by: Ben Gardner &lt;gardner.ben@gmail.com&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
<entry>
<title>libata: fix ata_id_logical_per_physical_sectors</title>
<updated>2010-02-04T06:01:32Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2010-01-28T12:30:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f7acede65d6b65919aee5b6a360a17cedb11f2f7'/>
<id>urn:sha1:f7acede65d6b65919aee5b6a360a17cedb11f2f7</id>
<content type='text'>
The value we get from the low byte of the ATA_ID_SECTOR_SIZE word is not not
a plain multiple, but the log of it, so fix the helper to give the correct
answer.  Without this we'll get an incorrect minimal I/O size in the block
limits VPD page for 4k sector drives.

Also change the return value of ata_id_logical_per_physical_sectors to u16
for the unlikely case of very large logical sectors.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
<entry>
<title>libata: Clarify ata_set_lba_range_entries function</title>
<updated>2009-12-03T23:01:23Z</updated>
<author>
<name>Martin K. Petersen</name>
<email>martin.petersen@oracle.com</email>
</author>
<published>2009-11-26T17:00:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d0634c4aea0b80447cbdc4c0db285004b860c455'/>
<id>urn:sha1:d0634c4aea0b80447cbdc4c0db285004b860c455</id>
<content type='text'>
ata_set_lba_range_entries used the variable max for two different things
which was confusing.  Make the function take a buffer size in bytes as
argument and return the used buffer size upon completion.

Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
</content>
</entry>
</feed>
