diff options
author | Tejun Heo <htejun@gmail.com> | 2006-12-03 07:34:13 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-03 07:58:10 -0500 |
commit | 800b399669ad495ad4361d134df87401ae36f44f (patch) | |
tree | 19e29f655836cd4808c668d736a83df552b7d8dd | |
parent | 3ac551a6a63dcbc707348772a27bd7090b081524 (diff) |
[PATCH] libata: always use polling IDENTIFY
libata switched to IRQ-driven IDENTIFY when IRQ-driven PIO was
introduced. This has caused a lot of problems including device
misdetection and phantom device.
ATA_FLAG_DETECT_POLLING was added recently to selectively use polling
IDENTIFY on problemetic drivers but many controllers and devices are
affected by this problem and trying to adding ATA_FLAG_DETECT_POLLING
for each such case is diffcult and not very rewarding.
This patch makes libata always use polling IDENTIFY. This is
consistent with libata's original behavior and drivers/ide's behavior.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/ata_piix.c | 5 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 8 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 3 | ||||
-rw-r--r-- | drivers/ata/libata.h | 2 | ||||
-rw-r--r-- | include/linux/libata.h | 4 |
5 files changed, 5 insertions, 17 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 788a269206e6..a2d84f7cf2bc 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -105,9 +105,8 @@ enum { | |||
105 | PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */ | 105 | PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */ |
106 | PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ | 106 | PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ |
107 | 107 | ||
108 | PIIX_PATA_FLAGS = ATA_FLAG_SLAVE_POSS | ATA_FLAG_DETECT_POLLING, | 108 | PIIX_PATA_FLAGS = ATA_FLAG_SLAVE_POSS, |
109 | PIIX_SATA_FLAGS = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR | | 109 | PIIX_SATA_FLAGS = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR, |
110 | ATA_FLAG_DETECT_POLLING, | ||
111 | 110 | ||
112 | /* combined mode. if set, PATA is channel 0. | 111 | /* combined mode. if set, PATA is channel 0. |
113 | * if clear, PATA is channel 1. | 112 | * if clear, PATA is channel 1. |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 883276388207..f8ec3896b793 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1473,16 +1473,12 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | tf.protocol = ATA_PROT_PIO; | 1475 | tf.protocol = ATA_PROT_PIO; |
1476 | 1476 | tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */ | |
1477 | /* presence detection using polling IDENTIFY? */ | ||
1478 | if (flags & ATA_READID_DETECT) | ||
1479 | tf.flags |= ATA_TFLAG_POLLING; | ||
1480 | 1477 | ||
1481 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, | 1478 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, |
1482 | id, sizeof(id[0]) * ATA_ID_WORDS); | 1479 | id, sizeof(id[0]) * ATA_ID_WORDS); |
1483 | if (err_mask) { | 1480 | if (err_mask) { |
1484 | if ((flags & ATA_READID_DETECT) && | 1481 | if (err_mask & AC_ERR_NODEV_HINT) { |
1485 | (err_mask & AC_ERR_NODEV_HINT)) { | ||
1486 | DPRINTK("ata%u.%d: NODEV after polling detection\n", | 1482 | DPRINTK("ata%u.%d: NODEV after polling detection\n", |
1487 | ap->id, dev->devno); | 1483 | ap->id, dev->devno); |
1488 | return -ENOENT; | 1484 | return -ENOENT; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 2aad7b79d6dd..76a85dfb7307 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1692,9 +1692,6 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1692 | ata_class_enabled(ehc->classes[dev->devno])) { | 1692 | ata_class_enabled(ehc->classes[dev->devno])) { |
1693 | dev->class = ehc->classes[dev->devno]; | 1693 | dev->class = ehc->classes[dev->devno]; |
1694 | 1694 | ||
1695 | if (ap->flags & ATA_FLAG_DETECT_POLLING) | ||
1696 | readid_flags |= ATA_READID_DETECT; | ||
1697 | |||
1698 | rc = ata_dev_read_id(dev, &dev->class, readid_flags, | 1695 | rc = ata_dev_read_id(dev, &dev->class, readid_flags, |
1699 | dev->id); | 1696 | dev->id); |
1700 | if (rc == 0) { | 1697 | if (rc == 0) { |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 1ff3f59504c9..107b2b565229 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -42,8 +42,6 @@ struct ata_scsi_args { | |||
42 | enum { | 42 | enum { |
43 | /* flags for ata_dev_read_id() */ | 43 | /* flags for ata_dev_read_id() */ |
44 | ATA_READID_POSTRESET = (1 << 0), /* reading ID after reset */ | 44 | ATA_READID_POSTRESET = (1 << 0), /* reading ID after reset */ |
45 | ATA_READID_DETECT = (1 << 1), /* perform presence detection | ||
46 | * using polling IDENTIFY */ | ||
47 | }; | 45 | }; |
48 | 46 | ||
49 | extern struct workqueue_struct *ata_aux_wq; | 47 | extern struct workqueue_struct *ata_aux_wq; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 8b57b6a806cc..202283b5df96 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -176,9 +176,7 @@ enum { | |||
176 | ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H | 176 | ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H |
177 | * Register FIS clearing BSY */ | 177 | * Register FIS clearing BSY */ |
178 | ATA_FLAG_DEBUGMSG = (1 << 13), | 178 | ATA_FLAG_DEBUGMSG = (1 << 13), |
179 | ATA_FLAG_DETECT_POLLING = (1 << 14), /* detect device presence by | 179 | ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */ |
180 | * polling IDENTIFY */ | ||
181 | ATA_FLAG_SETXFER_POLLING= (1 << 15), /* use polling for SETXFER */ | ||
182 | 180 | ||
183 | /* The following flag belongs to ap->pflags but is kept in | 181 | /* The following flag belongs to ap->pflags but is kept in |
184 | * ap->flags because it's referenced in many LLDs and will be | 182 | * ap->flags because it's referenced in many LLDs and will be |