Comment 27 for bug 1783906

MichaƂ Wadowski (wadosm) wrote :

I can split my issue into two cases:

1. My HDD inside DVD enclosure is not discovered. Then I have to reset stata device 3 or 4 times by "echo "- - -" > /sys/class/scsi_host/host1/scan" command

2. After stata resets, function sata_down_spd_limit() is called.

 * In Linux 4.14 this function set up link->sata_spd_limit from value 4294967295 to value 1. After this set up, HDD is discovered and works fine.
 * Since patch 4.15.0-rc4 value of link->sata_spd_limit is not changed, so HDD is not working at all.

Some debug information:
Inside function sata_down_spd_limit() is called ata_sstatus_online() and it returns 0 that means link is offline.
Value of "link->sata_spd" and "spd" is 0, value of "link->sata_spd_limit" is 4294967295 and value of "bit" is 31. After statement "mask &= ~(1 << bit);" mask is set to 2147483647

Because "spd" is 0, then statement "if (spd > 1)" is not pass and "else return -EINVAL;" is called.

Patch "else link->sata_spd_limit = mask;" doesn't work, because mask is 2147483647 and it seems to not be valid value (I think it should be 1, 2, or 4).