This patch prevents the error handler from changing link->sata_spd unless the link is online. (debug output) [ 79.658098] ATA_EH_RESET: sstatus 0x0 link->sata_spd 0x0 [ 79.658104] SATA_PRINT_LINK_STATUS: sstatus 0x0 scontrol 0x300 [ 79.658109] ata4: SATA link down (SStatus 0 SControl 300) [ 79.658113] ATA_PHYS_LINK_OFFLINE: sata_scr_read sstatus 0x0 [ 79.658117] ATA_PHYS_LINK_OFFLINE: sata_scr_read sstatus 0x0 [ 79.658128] SATA_DOWN_SPD_LIMIT: sstatus 0x0 [ 79.658130] SATA_DOWN_SPD_LIMIT: spd 0x0 mask 0xffffffff [ 79.658132] SATA_DOWN_SPD_LIMIT: bit 31 mask 0x7fffffff [ 79.658134] SATA_DOWN_SPD_LIMIT: spd 0x0 mask 0x1 [ 79.658137] ata4: limiting SATA link speed to 1.5 Gbps Signed-off-by: David Milburn <dmilburn@xxxxxxxxxx> --- drivers/ata/libata-core.c | 2 +- drivers/ata/libata-eh.c | 6 ++++-- drivers/ata/libata.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 38c40cf..57c7e56 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -177,7 +177,7 @@ struct ata_force_ent { MODULE_VERSION(DRV_VERSION); -static bool ata_sstatus_online(u32 sstatus) +bool ata_sstatus_online(u32 sstatus) { return (sstatus & 0xf) == 0x3; } diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index e4effef..d469951 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2911,9 +2911,11 @@ int ata_eh_reset(struct ata_link *link, int classify, } /* record current link speed */ - if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) + if (!sata_scr_read(link, SCR_STATUS, &sstatus) && + ata_sstatus_online(sstatus)) link->sata_spd = (sstatus >> 4) & 0xf; - if (slave && sata_scr_read(slave, SCR_STATUS, &sstatus) == 0) + if (slave && !sata_scr_read(slave, SCR_STATUS, &sstatus) && + ata_sstatus_online(sstatus)) slave->sata_spd = (sstatus >> 4) & 0xf; /* thaw the port */ diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 839d487..7787fcc 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -52,6 +52,7 @@ enum { extern int libata_noacpi; extern int libata_allow_tpm; extern struct device_type ata_port_type; +extern bool ata_sstatus_online(u32 sstatus); extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); extern void ata_force_cbl(struct ata_port *ap); extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html