aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-05-14 14:28:16 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-09 12:17:31 -0400
commit6746544c3b143ca7071d144f1882ccbe1f47b08d (patch)
tree49106311ab2a748feda2fa91f977f700938d3d5c /drivers/ata/libata-core.c
parent69b16a5f4c4f1dab70d4d555c487c318c6878b3e (diff)
libata: reimplement ACPI invocation
This patch reimplements ACPI invocation such that, instead of exporting ACPI details to the rest of libata, ACPI event handlers - ata_acpi_on_resume() and ata_acpi_on_devcfg() - are used. These two functions are responsible for determining whether specific ACPI method is used and when. On resume, _GTF is scheduled by setting ATA_DFLAG_ACPI_PENDING device flag. This is done this way to avoid performing the action on wrong device device (device swapping while suspended). On every ata_dev_configure(), ata_acpi_on_devcfg() is called, which performs _SDD and _GTF. _GTF is performed only after resuming and, if SATA, hardreset as the ACPI spec specifies. As _GTF may contain arbitrary commands, IDENTIFY page is re-read after _GTF taskfiles are executed. If one of ACPI methods fails, ata_acpi_on_devcfg() retries on the first failure. If it fails again on the second try, ACPI is disabled on the device. Note that successful configuration clears ACPI failed status. With all feature checks moved to the above two functions, do_drive_set_taskfiles() is trivial and thus collapsed into ata_acpi_exec_tfs(), which is now static and converted to return the number of executed taskfiles to be used by ata_acpi_on_resume(). As failures are handled properly, ata_acpi_push_id() now returns -errno on errors instead of unconditional zero. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5a46cdebc588..90ed2b9a34de 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1845,7 +1845,8 @@ static void ata_dev_config_ncq(struct ata_device *dev,
1845int ata_dev_configure(struct ata_device *dev) 1845int ata_dev_configure(struct ata_device *dev)
1846{ 1846{
1847 struct ata_port *ap = dev->ap; 1847 struct ata_port *ap = dev->ap;
1848 int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO; 1848 struct ata_eh_context *ehc = &ap->eh_context;
1849 int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
1849 const u16 *id = dev->id; 1850 const u16 *id = dev->id;
1850 unsigned int xfer_mask; 1851 unsigned int xfer_mask;
1851 char revbuf[7]; /* XYZ-99\0 */ 1852 char revbuf[7]; /* XYZ-99\0 */
@@ -1862,15 +1863,10 @@ int ata_dev_configure(struct ata_device *dev)
1862 if (ata_msg_probe(ap)) 1863 if (ata_msg_probe(ap))
1863 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); 1864 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
1864 1865
1865 /* set _SDD */ 1866 /* let ACPI work its magic */
1866 rc = ata_acpi_push_id(dev); 1867 rc = ata_acpi_on_devcfg(dev);
1867 if (rc) { 1868 if (rc)
1868 ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n", 1869 return rc;
1869 rc);
1870 }
1871
1872 /* retrieve and execute the ATA task file of _GTF */
1873 ata_acpi_exec_tfs(ap);
1874 1870
1875 /* print device capabilities */ 1871 /* print device capabilities */
1876 if (ata_msg_probe(ap)) 1872 if (ata_msg_probe(ap))