diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-25 00:33:27 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-25 00:33:27 -0400 |
commit | 218f3d30e60f32394738372c594d063f8e43ee6d (patch) | |
tree | e3a545c5c458c959d8cfa21040fafcf0dd03383c /drivers/ata | |
parent | c9927c2bf4f45bb85e8b502ab3fb79ad6483c244 (diff) |
[libata] Create internal helper ata_dev_set_feature()
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 2d147b51c978..294eee3d86fb 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -68,7 +68,8 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; | |||
68 | static unsigned int ata_dev_init_params(struct ata_device *dev, | 68 | static unsigned int ata_dev_init_params(struct ata_device *dev, |
69 | u16 heads, u16 sectors); | 69 | u16 heads, u16 sectors); |
70 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | 70 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev); |
71 | static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable); | 71 | static unsigned int ata_dev_set_feature(struct ata_device *dev, |
72 | u8 enable, u8 feature); | ||
72 | static void ata_dev_xfermask(struct ata_device *dev); | 73 | static void ata_dev_xfermask(struct ata_device *dev); |
73 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 74 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
74 | 75 | ||
@@ -1799,13 +1800,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1799 | * SET_FEATURES spin-up subcommand before it will accept | 1800 | * SET_FEATURES spin-up subcommand before it will accept |
1800 | * anything other than the original IDENTIFY command. | 1801 | * anything other than the original IDENTIFY command. |
1801 | */ | 1802 | */ |
1802 | ata_tf_init(dev, &tf); | 1803 | err_mask = ata_dev_set_feature(dev, SETFEATURES_SPINUP, 0); |
1803 | tf.command = ATA_CMD_SET_FEATURES; | ||
1804 | tf.feature = SETFEATURES_SPINUP; | ||
1805 | tf.protocol = ATA_PROT_NODATA; | ||
1806 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | ||
1807 | err_mask = ata_exec_internal(dev, &tf, NULL, | ||
1808 | DMA_NONE, NULL, 0, 0); | ||
1809 | if (err_mask && id[2] != 0x738c) { | 1804 | if (err_mask && id[2] != 0x738c) { |
1810 | rc = -EIO; | 1805 | rc = -EIO; |
1811 | reason = "SPINUP failed"; | 1806 | reason = "SPINUP failed"; |
@@ -2075,7 +2070,8 @@ int ata_dev_configure(struct ata_device *dev) | |||
2075 | unsigned int err_mask; | 2070 | unsigned int err_mask; |
2076 | 2071 | ||
2077 | /* issue SET feature command to turn this on */ | 2072 | /* issue SET feature command to turn this on */ |
2078 | err_mask = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE); | 2073 | err_mask = ata_dev_set_feature(dev, |
2074 | SETFEATURES_SATA_ENABLE, SATA_AN); | ||
2079 | if (err_mask) | 2075 | if (err_mask) |
2080 | ata_dev_printk(dev, KERN_ERR, | 2076 | ata_dev_printk(dev, KERN_ERR, |
2081 | "failed to enable ATAPI AN " | 2077 | "failed to enable ATAPI AN " |
@@ -4181,15 +4177,14 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) | |||
4181 | DPRINTK("EXIT, err_mask=%x\n", err_mask); | 4177 | DPRINTK("EXIT, err_mask=%x\n", err_mask); |
4182 | return err_mask; | 4178 | return err_mask; |
4183 | } | 4179 | } |
4184 | |||
4185 | /** | 4180 | /** |
4186 | * ata_dev_set_AN - Issue SET FEATURES - SATA FEATURES | 4181 | * ata_dev_set_feature - Issue SET FEATURES - SATA FEATURES |
4187 | * @dev: Device to which command will be sent | 4182 | * @dev: Device to which command will be sent |
4188 | * @enable: Whether to enable or disable the feature | 4183 | * @enable: Whether to enable or disable the feature |
4184 | * @feature: The sector count represents the feature to set | ||
4189 | * | 4185 | * |
4190 | * Issue SET FEATURES - SATA FEATURES command to device @dev | 4186 | * Issue SET FEATURES - SATA FEATURES command to device @dev |
4191 | * on port @ap with sector count set to indicate Asynchronous | 4187 | * on port @ap with sector count |
4192 | * Notification feature | ||
4193 | * | 4188 | * |
4194 | * LOCKING: | 4189 | * LOCKING: |
4195 | * PCI/etc. bus probe sem. | 4190 | * PCI/etc. bus probe sem. |
@@ -4197,7 +4192,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) | |||
4197 | * RETURNS: | 4192 | * RETURNS: |
4198 | * 0 on success, AC_ERR_* mask otherwise. | 4193 | * 0 on success, AC_ERR_* mask otherwise. |
4199 | */ | 4194 | */ |
4200 | static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable) | 4195 | static unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, |
4196 | u8 feature) | ||
4201 | { | 4197 | { |
4202 | struct ata_taskfile tf; | 4198 | struct ata_taskfile tf; |
4203 | unsigned int err_mask; | 4199 | unsigned int err_mask; |
@@ -4210,7 +4206,7 @@ static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable) | |||
4210 | tf.feature = enable; | 4206 | tf.feature = enable; |
4211 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 4207 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
4212 | tf.protocol = ATA_PROT_NODATA; | 4208 | tf.protocol = ATA_PROT_NODATA; |
4213 | tf.nsect = SATA_AN; | 4209 | tf.nsect = feature; |
4214 | 4210 | ||
4215 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); | 4211 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); |
4216 | 4212 | ||