aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-01-24 03:05:22 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-26 23:20:14 -0500
commitb4dc7623c1bb258b66418261dab40f0e4cfc6d42 (patch)
treeab6d2d5ce603fdc936d47788d80011abb11d6b57
parent6f8b99589524f3e759e44721376abcdf88ed8915 (diff)
[PATCH] libata: modify ata_dev_try_classify
Make ata_dev_try_classify take @r_err to store tf error register value on completion and return device class instead of directly manipulating dev->class. This is preparation for new reset mechanism. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/scsi/libata-core.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 4336fc889acd..1f78e246f5e0 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -830,6 +830,7 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
830 * ata_dev_try_classify - Parse returned ATA device signature 830 * ata_dev_try_classify - Parse returned ATA device signature
831 * @ap: ATA channel to examine 831 * @ap: ATA channel to examine
832 * @device: Device to examine (starting at zero) 832 * @device: Device to examine (starting at zero)
833 * @r_err: Value of error register on completion
833 * 834 *
834 * After an event -- SRST, E.D.D., or SATA COMRESET -- occurs, 835 * After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
835 * an ATA/ATAPI-defined set of values is placed in the ATA 836 * an ATA/ATAPI-defined set of values is placed in the ATA
@@ -842,11 +843,14 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
842 * 843 *
843 * LOCKING: 844 * LOCKING:
844 * caller. 845 * caller.
846 *
847 * RETURNS:
848 * Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
845 */ 849 */
846 850
847static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) 851static unsigned int
852ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
848{ 853{
849 struct ata_device *dev = &ap->device[device];
850 struct ata_taskfile tf; 854 struct ata_taskfile tf;
851 unsigned int class; 855 unsigned int class;
852 u8 err; 856 u8 err;
@@ -857,8 +861,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
857 861
858 ap->ops->tf_read(ap, &tf); 862 ap->ops->tf_read(ap, &tf);
859 err = tf.feature; 863 err = tf.feature;
860 864 if (r_err)
861 dev->class = ATA_DEV_NONE; 865 *r_err = err;
862 866
863 /* see if device passed diags */ 867 /* see if device passed diags */
864 if (err == 1) 868 if (err == 1)
@@ -866,18 +870,16 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
866 else if ((device == 0) && (err == 0x81)) 870 else if ((device == 0) && (err == 0x81))
867 /* do nothing */ ; 871 /* do nothing */ ;
868 else 872 else
869 return err; 873 return ATA_DEV_NONE;
870 874
871 /* determine if device if ATA or ATAPI */ 875 /* determine if device is ATA or ATAPI */
872 class = ata_dev_classify(&tf); 876 class = ata_dev_classify(&tf);
877
873 if (class == ATA_DEV_UNKNOWN) 878 if (class == ATA_DEV_UNKNOWN)
874 return err; 879 return ATA_DEV_NONE;
875 if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0)) 880 if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
876 return err; 881 return ATA_DEV_NONE;
877 882 return class;
878 dev->class = class;
879
880 return err;
881} 883}
882 884
883/** 885/**
@@ -2177,9 +2179,9 @@ void ata_bus_reset(struct ata_port *ap)
2177 /* 2179 /*
2178 * determine by signature whether we have ATA or ATAPI devices 2180 * determine by signature whether we have ATA or ATAPI devices
2179 */ 2181 */
2180 err = ata_dev_try_classify(ap, 0); 2182 ap->device[0].class = ata_dev_try_classify(ap, 0, &err);
2181 if ((slave_possible) && (err != 0x81)) 2183 if ((slave_possible) && (err != 0x81))
2182 ata_dev_try_classify(ap, 1); 2184 ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
2183 2185
2184 /* re-enable interrupts */ 2186 /* re-enable interrupts */
2185 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */ 2187 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */