Skip to contentSkip to conversation

libata: mask off DET when restoring SControl for detach

PATCH Applied Tejun Heo 2 participants 2 messages Nov 3, 2008 – Nov 4, 2008 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 libata: mask off DET when restoring SControl for detach

libata restores SControl on detach; however, trying to restore non-zero DET can cause undeterministic behavior including PMP device going offline till power cycling. Mask off DET when restoring SControl.

---
 drivers/ata/libata-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
Index: work/drivers/ata/libata-core.c
===================================================================
@@ -5936,7 +5936,7 @@ static void ata_port_detach(struct ata_p
 	 * to us.  Restore SControl and disable all existing devices.
 	 */
 	__ata_port_for_each_link(link, ap) {
-		sata_scr_write(link, SCR_CONTROL, link->saved_scontrol);
+		sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0);
 		ata_link_for_each_dev(dev, link)
 			ata_dev_disable(dev);
 	}
Applied
#1 lore raw
Quoted 15 lines · Tejun Heo

libata restores SControl on detach; however, trying to restore non-zero DET can cause undeterministic behavior including PMP device going offline till power cycling. Mask off DET when restoring SControl.

---
 drivers/ata/libata-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: work/drivers/ata/libata-core.c
===================================================================

drivers/ata/libata-core.c static void ata_port_detach(struct ata_p · line 5941

Quoted 7 lines
drivers/ata/libata-core.c +1 -1
@@ -5936,7 +5936,7 @@ static void ata_port_detach(struct ata_p
 	 * to us.  Restore SControl and disable all existing devices.
 	 */
 	__ata_port_for_each_link(link, ap) {
-		sata_scr_write(link, SCR_CONTROL, link->saved_scontrol);
+		sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0);
 		ata_link_for_each_dev(dev, link)
 			ata_dev_disable(dev);

applied