]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
libata: check SATA_SETTINGS log with HW Feature Ctrl
authorShane Huang <shane.huang@amd.com>
Sat, 17 Nov 2012 20:44:41 +0000 (04:44 +0800)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 3 Dec 2012 09:57:37 +0000 (04:57 -0500)
NCQ capability was used to check availability of SATA Settings page
from Identify Device Data Log, which contains DevSlp timing variables.
It does not work on some HDDs and leads to error messages.
IDENTIFY word 78 bit 5(Hardware Feature Control) should be used.

Quoting SATA spec 3.1:
If Hardware Feature Control is supported, then:
a) IDENTIFY DEVICE data word 78 bit 5 (see 13.2.1.18) shall be
set to one;
b) the SET FEATURES Select Hardware Feature Control subcommand
shall be supported (see 13.3.8);
c) page 08h of the Identify Device Data log (see 13.7.7) shall
be supported;

This patch is not tested on SATA HDD with DevSlp supported.

Reported-by: Borislav Petkov <bp@amd64.org>
Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-core.c
include/linux/ata.h

index f46fbd3bd3fb6b4456032a0255bad894e8fc9cdb..caffe73c1e4a1bfb559f0ef3d2f56e69f1b6d7dc 100644 (file)
@@ -2330,9 +2330,8 @@ int ata_dev_configure(struct ata_device *dev)
 
                /* Obtain SATA Settings page from Identify Device Data Log,
                 * which contains DevSlp timing variables etc.
-                * Exclude old devices with ata_id_has_ncq()
                 */
-               if (ata_id_has_ncq(dev->id)) {
+               if (ata_id_has_hw_feature_ctrl(dev->id)) {
                        err_mask = ata_read_log_page(dev,
                                                     ATA_LOG_SATA_ID_DEV_DATA,
                                                     ATA_LOG_SATA_SETTINGS,
index 408da9502177bd18a3ba88e2831701e916e800aa..18cbb93fdbcaff0e33c88595c5ab68a834c72649 100644 (file)
@@ -593,6 +593,7 @@ static inline int ata_is_data(u8 prot)
 #define ata_id_cdb_intr(id)    (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
 #define ata_id_has_da(id)      ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
 #define ata_id_has_devslp(id)  ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
+#define ata_id_has_hw_feature_ctrl(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 5))
 
 static inline bool ata_id_has_hipm(const u16 *id)
 {