aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-09-23 00:14:12 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:40 -0400
commit422c9daa8b5bea09f3393b11a106afd68850b39b (patch)
tree76a4d15d77a26c049ca80ae850473b83df47d332 /drivers
parente0a7175263db4a226558883a51a88a5d2bc5d9fe (diff)
libata-pmp-prep: add @new_class to ata_dev_revalidate()
Consider newly found class code while revalidating. PMP resetting always results in valid class code and issuing PMP commands to ATA/ATAPI device isn't very attractive. Add @new_class to ata_dev_revalidate() and check class code for revalidation. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c15
-rw-r--r--drivers/ata/libata-eh.c3
-rw-r--r--drivers/ata/libata.h3
3 files changed, 17 insertions, 4 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 1daea1caf3e5..c046c5e1e5db 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2846,7 +2846,7 @@ static int ata_dev_set_mode(struct ata_device *dev)
2846 } 2846 }
2847 2847
2848 ehc->i.flags |= ATA_EHI_POST_SETMODE; 2848 ehc->i.flags |= ATA_EHI_POST_SETMODE;
2849 rc = ata_dev_revalidate(dev, 0); 2849 rc = ata_dev_revalidate(dev, ATA_DEV_UNKNOWN, 0);
2850 ehc->i.flags &= ~ATA_EHI_POST_SETMODE; 2850 ehc->i.flags &= ~ATA_EHI_POST_SETMODE;
2851 if (rc) 2851 if (rc)
2852 return rc; 2852 return rc;
@@ -3750,6 +3750,7 @@ int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags)
3750/** 3750/**
3751 * ata_dev_revalidate - Revalidate ATA device 3751 * ata_dev_revalidate - Revalidate ATA device
3752 * @dev: device to revalidate 3752 * @dev: device to revalidate
3753 * @new_class: new class code
3753 * @readid_flags: read ID flags 3754 * @readid_flags: read ID flags
3754 * 3755 *
3755 * Re-read IDENTIFY page, make sure @dev is still attached to the 3756 * Re-read IDENTIFY page, make sure @dev is still attached to the
@@ -3761,7 +3762,8 @@ int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags)
3761 * RETURNS: 3762 * RETURNS:
3762 * 0 on success, negative errno otherwise 3763 * 0 on success, negative errno otherwise
3763 */ 3764 */
3764int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags) 3765int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
3766 unsigned int readid_flags)
3765{ 3767{
3766 u64 n_sectors = dev->n_sectors; 3768 u64 n_sectors = dev->n_sectors;
3767 int rc; 3769 int rc;
@@ -3769,6 +3771,15 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
3769 if (!ata_dev_enabled(dev)) 3771 if (!ata_dev_enabled(dev))
3770 return -ENODEV; 3772 return -ENODEV;
3771 3773
3774 /* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */
3775 if (ata_class_enabled(new_class) &&
3776 new_class != ATA_DEV_ATA && new_class != ATA_DEV_ATAPI) {
3777 ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n",
3778 dev->class, new_class);
3779 rc = -ENODEV;
3780 goto fail;
3781 }
3782
3772 /* re-read ID */ 3783 /* re-read ID */
3773 rc = ata_dev_reread_id(dev, readid_flags); 3784 rc = ata_dev_reread_id(dev, readid_flags);
3774 if (rc) 3785 if (rc)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index daa2f74f73c8..eb087bbc4771 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2104,7 +2104,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2104 } 2104 }
2105 2105
2106 ata_eh_about_to_do(link, dev, ATA_EH_REVALIDATE); 2106 ata_eh_about_to_do(link, dev, ATA_EH_REVALIDATE);
2107 rc = ata_dev_revalidate(dev, readid_flags); 2107 rc = ata_dev_revalidate(dev, ehc->classes[dev->devno],
2108 readid_flags);
2108 if (rc) 2109 if (rc)
2109 goto err; 2110 goto err;
2110 2111
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index e45f6d5542d5..d4d369908c0f 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -78,7 +78,8 @@ extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd);
78extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, 78extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
79 unsigned int flags, u16 *id); 79 unsigned int flags, u16 *id);
80extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); 80extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags);
81extern int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags); 81extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
82 unsigned int readid_flags);
82extern int ata_dev_configure(struct ata_device *dev); 83extern int ata_dev_configure(struct ata_device *dev);
83extern int sata_down_spd_limit(struct ata_link *link); 84extern int sata_down_spd_limit(struct ata_link *link);
84extern int sata_set_spd_needed(struct ata_link *link); 85extern int sata_set_spd_needed(struct ata_link *link);