diff options
author | Tejun Heo <htejun@gmail.com> | 2006-11-10 04:08:10 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-01 22:45:55 -0500 |
commit | bff0464769f2a1bd348265de704471747378e247 (patch) | |
tree | 50b04bf291837cb99ca67ac557d577aaf84a75f8 /drivers/ata | |
parent | b3362f88a8f938fb700fdedf074ec222cba7cf83 (diff) |
[PATCH] libata: convert @post_reset to @flags in ata_dev_read_id()
Make ata_dev_read_id() take @flags instead of @post_reset. Currently
there is only one flag defined - ATA_READID_POSTRESET, which is
equivalent to @post_reset. This is preparation for polling presence
detection.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 17 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 11 | ||||
-rw-r--r-- | drivers/ata/libata.h | 9 |
3 files changed, 23 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d94b8a02c340..090abe443820 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1224,7 +1224,7 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1224 | * ata_dev_read_id - Read ID data from the specified device | 1224 | * ata_dev_read_id - Read ID data from the specified device |
1225 | * @dev: target device | 1225 | * @dev: target device |
1226 | * @p_class: pointer to class of the target device (may be changed) | 1226 | * @p_class: pointer to class of the target device (may be changed) |
1227 | * @post_reset: is this read ID post-reset? | 1227 | * @flags: ATA_READID_* flags |
1228 | * @id: buffer to read IDENTIFY data into | 1228 | * @id: buffer to read IDENTIFY data into |
1229 | * | 1229 | * |
1230 | * Read ID data from the specified device. ATA_CMD_ID_ATA is | 1230 | * Read ID data from the specified device. ATA_CMD_ID_ATA is |
@@ -1239,7 +1239,7 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1239 | * 0 on success, -errno otherwise. | 1239 | * 0 on success, -errno otherwise. |
1240 | */ | 1240 | */ |
1241 | int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | 1241 | int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, |
1242 | int post_reset, u16 *id) | 1242 | unsigned int flags, u16 *id) |
1243 | { | 1243 | { |
1244 | struct ata_port *ap = dev->ap; | 1244 | struct ata_port *ap = dev->ap; |
1245 | unsigned int class = *p_class; | 1245 | unsigned int class = *p_class; |
@@ -1294,7 +1294,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1294 | goto err_out; | 1294 | goto err_out; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | if (post_reset && class == ATA_DEV_ATA) { | 1297 | if ((flags & ATA_READID_POSTRESET) && class == ATA_DEV_ATA) { |
1298 | /* | 1298 | /* |
1299 | * The exact sequence expected by certain pre-ATA4 drives is: | 1299 | * The exact sequence expected by certain pre-ATA4 drives is: |
1300 | * SRST RESET | 1300 | * SRST RESET |
@@ -1314,7 +1314,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1314 | /* current CHS translation info (id[53-58]) might be | 1314 | /* current CHS translation info (id[53-58]) might be |
1315 | * changed. reread the identify device info. | 1315 | * changed. reread the identify device info. |
1316 | */ | 1316 | */ |
1317 | post_reset = 0; | 1317 | flags &= ~ATA_READID_POSTRESET; |
1318 | goto retry; | 1318 | goto retry; |
1319 | } | 1319 | } |
1320 | } | 1320 | } |
@@ -1643,7 +1643,8 @@ int ata_bus_probe(struct ata_port *ap) | |||
1643 | if (!ata_dev_enabled(dev)) | 1643 | if (!ata_dev_enabled(dev)) |
1644 | continue; | 1644 | continue; |
1645 | 1645 | ||
1646 | rc = ata_dev_read_id(dev, &dev->class, 1, dev->id); | 1646 | rc = ata_dev_read_id(dev, &dev->class, ATA_READID_POSTRESET, |
1647 | dev->id); | ||
1647 | if (rc) | 1648 | if (rc) |
1648 | goto fail; | 1649 | goto fail; |
1649 | 1650 | ||
@@ -3023,7 +3024,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3023 | /** | 3024 | /** |
3024 | * ata_dev_revalidate - Revalidate ATA device | 3025 | * ata_dev_revalidate - Revalidate ATA device |
3025 | * @dev: device to revalidate | 3026 | * @dev: device to revalidate |
3026 | * @post_reset: is this revalidation after reset? | 3027 | * @readid_flags: read ID flags |
3027 | * | 3028 | * |
3028 | * Re-read IDENTIFY page and make sure @dev is still attached to | 3029 | * Re-read IDENTIFY page and make sure @dev is still attached to |
3029 | * the port. | 3030 | * the port. |
@@ -3034,7 +3035,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3034 | * RETURNS: | 3035 | * RETURNS: |
3035 | * 0 on success, negative errno otherwise | 3036 | * 0 on success, negative errno otherwise |
3036 | */ | 3037 | */ |
3037 | int ata_dev_revalidate(struct ata_device *dev, int post_reset) | 3038 | int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags) |
3038 | { | 3039 | { |
3039 | unsigned int class = dev->class; | 3040 | unsigned int class = dev->class; |
3040 | u16 *id = (void *)dev->ap->sector_buf; | 3041 | u16 *id = (void *)dev->ap->sector_buf; |
@@ -3046,7 +3047,7 @@ int ata_dev_revalidate(struct ata_device *dev, int post_reset) | |||
3046 | } | 3047 | } |
3047 | 3048 | ||
3048 | /* read ID data */ | 3049 | /* read ID data */ |
3049 | rc = ata_dev_read_id(dev, &class, post_reset, id); | 3050 | rc = ata_dev_read_id(dev, &class, readid_flags, id); |
3050 | if (rc) | 3051 | if (rc) |
3051 | goto fail; | 3052 | goto fail; |
3052 | 3053 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 477648801a65..755fc68b5374 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1634,11 +1634,14 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1634 | DPRINTK("ENTER\n"); | 1634 | DPRINTK("ENTER\n"); |
1635 | 1635 | ||
1636 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1636 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
1637 | unsigned int action; | 1637 | unsigned int action, readid_flags = 0; |
1638 | 1638 | ||
1639 | dev = &ap->device[i]; | 1639 | dev = &ap->device[i]; |
1640 | action = ata_eh_dev_action(dev); | 1640 | action = ata_eh_dev_action(dev); |
1641 | 1641 | ||
1642 | if (ehc->i.flags & ATA_EHI_DID_RESET) | ||
1643 | readid_flags |= ATA_READID_POSTRESET; | ||
1644 | |||
1642 | if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { | 1645 | if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { |
1643 | if (ata_port_offline(ap)) { | 1646 | if (ata_port_offline(ap)) { |
1644 | rc = -EIO; | 1647 | rc = -EIO; |
@@ -1646,8 +1649,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1646 | } | 1649 | } |
1647 | 1650 | ||
1648 | ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); | 1651 | ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); |
1649 | rc = ata_dev_revalidate(dev, | 1652 | rc = ata_dev_revalidate(dev, readid_flags); |
1650 | ehc->i.flags & ATA_EHI_DID_RESET); | ||
1651 | if (rc) | 1653 | if (rc) |
1652 | break; | 1654 | break; |
1653 | 1655 | ||
@@ -1665,7 +1667,8 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1665 | ata_class_enabled(ehc->classes[dev->devno])) { | 1667 | ata_class_enabled(ehc->classes[dev->devno])) { |
1666 | dev->class = ehc->classes[dev->devno]; | 1668 | dev->class = ehc->classes[dev->devno]; |
1667 | 1669 | ||
1668 | rc = ata_dev_read_id(dev, &dev->class, 1, dev->id); | 1670 | rc = ata_dev_read_id(dev, &dev->class, readid_flags, |
1671 | dev->id); | ||
1669 | if (rc == 0) { | 1672 | if (rc == 0) { |
1670 | ehc->i.flags |= ATA_EHI_PRINTINFO; | 1673 | ehc->i.flags |= ATA_EHI_PRINTINFO; |
1671 | rc = ata_dev_configure(dev); | 1674 | rc = ata_dev_configure(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index e4ffb2e38992..bb98390aa01a 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -39,6 +39,11 @@ struct ata_scsi_args { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* libata-core.c */ | 41 | /* libata-core.c */ |
42 | enum { | ||
43 | /* flags for ata_dev_read_id() */ | ||
44 | ATA_READID_POSTRESET = (1 << 0), /* reading ID after reset */ | ||
45 | }; | ||
46 | |||
42 | extern struct workqueue_struct *ata_aux_wq; | 47 | extern struct workqueue_struct *ata_aux_wq; |
43 | extern int atapi_enabled; | 48 | extern int atapi_enabled; |
44 | extern int atapi_dmadir; | 49 | extern int atapi_dmadir; |
@@ -52,8 +57,8 @@ extern unsigned ata_exec_internal(struct ata_device *dev, | |||
52 | int dma_dir, void *buf, unsigned int buflen); | 57 | int dma_dir, void *buf, unsigned int buflen); |
53 | extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd); | 58 | extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd); |
54 | extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | 59 | extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, |
55 | int post_reset, u16 *id); | 60 | unsigned int flags, u16 *id); |
56 | extern int ata_dev_revalidate(struct ata_device *dev, int post_reset); | 61 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int flags); |
57 | extern int ata_dev_configure(struct ata_device *dev); | 62 | extern int ata_dev_configure(struct ata_device *dev); |
58 | extern int sata_down_spd_limit(struct ata_port *ap); | 63 | extern int sata_down_spd_limit(struct ata_port *ap); |
59 | extern int sata_set_spd_needed(struct ata_port *ap); | 64 | extern int sata_set_spd_needed(struct ata_port *ap); |