Skip to contentSkip to conversation

libata resume improvements

PATCH In review Jeff Garzik 2 participants 4 messages May 27, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata resume improvements

This is an example of how one might make sure the ATA bus reaches bus-idle, before attempting to talk to it.

It compiles, but is completely untested...

Other resume improvements should work at the pci_driver::resume level as this does, _not_ the SCSI->ATA->resume device level.

drivers/scsi/ata_piix.c +1 -1
index 6dc8814..949d496 100644
@@ -201,7 +201,7 @@ static struct pci_driver piix_pci_driver
 	.probe			= piix_init_one,
 	.remove			= ata_pci_remove_one,
 	.suspend		= ata_pci_device_suspend,
-	.resume			= ata_pci_device_resume,
+	.resume			= pata_pci_device_resume,
 };
 
 static struct scsi_host_template piix_sht = {
drivers/scsi/libata-core.c +23 -0
index fa476e7..fe42a75 100644
@@ -4852,6 +4852,28 @@ int ata_pci_device_resume(struct pci_dev
 	pci_set_master(pdev);
 	return 0;
 }
+
+int pata_pci_device_resume(struct pci_dev *pdev)
+{
+	struct device *dev = pci_dev_to_dev(pdev);
+	struct ata_host_set *host_set = dev_get_drvdata(dev);
+	struct ata_port *ap;
+	int i;
+
+	ata_pci_device_resume(pdev);
+
+	msleep(400);
+
+	for (i = 0; i < host_set->n_ports; i++) {
+		ap = host_set->ports[i];
+
+		if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT))
+			printk(KERN_ERR "ata%u: failed to resume\n", ap->id);
+	}
+
+	return 0;
+}
+
 #endif /* CONFIG_PCI */
 
 
@@ -4970,6 +4992,7 @@ EXPORT_SYMBOL_GPL(ata_pci_init_one);
 EXPORT_SYMBOL_GPL(ata_pci_remove_one);
 EXPORT_SYMBOL_GPL(ata_pci_device_suspend);
 EXPORT_SYMBOL_GPL(ata_pci_device_resume);
+EXPORT_SYMBOL_GPL(pata_pci_device_resume);
 EXPORT_SYMBOL_GPL(ata_pci_default_filter);
 EXPORT_SYMBOL_GPL(ata_pci_clear_simplex);
 #endif /* CONFIG_PCI */
include/linux/libata.h +1 -0
index b80d2e7..cad531a 100644
@@ -516,6 +516,7 @@ extern int ata_pci_init_one (struct pci_
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
 extern int ata_pci_device_resume(struct pci_dev *pdev);
+extern int pata_pci_device_resume(struct pci_dev *pdev);
 extern int ata_pci_clear_simplex(struct pci_dev *pdev);
 #endif /* CONFIG_PCI */
 extern int ata_device_add(const struct ata_probe_ent *ent);
#1 lore raw

drivers/scsi/ata_piix.c

Quoted 10 lines · Jeff Garzik

This is an example of how one might make sure the ATA bus reaches bus-idle, before attempting to talk to it.

It compiles, but is completely untested...

Other resume improvements should work at the pci_driver::resume level as this does, _not_ the SCSI->ATA->resume device level.

drivers/scsi/ata_piix.c +0 -0

...

Sorry to say, but no user-visible difference from previous attempts. Still fails the same way, after a 30-ish second timeout on resume.

Cheers

#2 lore raw

Oops.. replied to the wrong thread, but reply is still valid :)

#3 lore raw
In reply to Mark Lord
Quoted 10 lines · Mark Lord
Quoted 9 lines · Jeff Garzik

This is an example of how one might make sure the ATA bus reaches bus-idle, before attempting to talk to it.

It compiles, but is completely untested...

Other resume improvements should work at the pci_driver::resume level as this does, _not_ the SCSI->ATA->resume device level.

Quoted 5 lines

drivers/scsi/ata_piix.c

Quoted 1 line
drivers/scsi/ata_piix.c +0 -0

...

Sorry to say, but no user-visible difference from previous attempts. Still fails the same way, after a 30-ish second timeout on resume.

Thanks again for testing, though I think more recent of the flurry of patches invalidated this patch :/ Nonetheless, its useful as a data point.

Jeff