Commit 800b3996 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

[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: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 3ac551a6
...@@ -105,9 +105,8 @@ enum { ...@@ -105,9 +105,8 @@ enum {
PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */ PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */
PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */
PIIX_PATA_FLAGS = ATA_FLAG_SLAVE_POSS | ATA_FLAG_DETECT_POLLING, PIIX_PATA_FLAGS = ATA_FLAG_SLAVE_POSS,
PIIX_SATA_FLAGS = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR | PIIX_SATA_FLAGS = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR,
ATA_FLAG_DETECT_POLLING,
/* combined mode. if set, PATA is channel 0. /* combined mode. if set, PATA is channel 0.
* if clear, PATA is channel 1. * if clear, PATA is channel 1.
......
...@@ -1473,16 +1473,12 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, ...@@ -1473,16 +1473,12 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
} }
tf.protocol = ATA_PROT_PIO; tf.protocol = ATA_PROT_PIO;
tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
/* presence detection using polling IDENTIFY? */
if (flags & ATA_READID_DETECT)
tf.flags |= ATA_TFLAG_POLLING;
err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
id, sizeof(id[0]) * ATA_ID_WORDS); id, sizeof(id[0]) * ATA_ID_WORDS);
if (err_mask) { if (err_mask) {
if ((flags & ATA_READID_DETECT) && if (err_mask & AC_ERR_NODEV_HINT) {
(err_mask & AC_ERR_NODEV_HINT)) {
DPRINTK("ata%u.%d: NODEV after polling detection\n", DPRINTK("ata%u.%d: NODEV after polling detection\n",
ap->id, dev->devno); ap->id, dev->devno);
return -ENOENT; return -ENOENT;
......
...@@ -1692,9 +1692,6 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, ...@@ -1692,9 +1692,6 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
ata_class_enabled(ehc->classes[dev->devno])) { ata_class_enabled(ehc->classes[dev->devno])) {
dev->class = ehc->classes[dev->devno]; dev->class = ehc->classes[dev->devno];
if (ap->flags & ATA_FLAG_DETECT_POLLING)
readid_flags |= ATA_READID_DETECT;
rc = ata_dev_read_id(dev, &dev->class, readid_flags, rc = ata_dev_read_id(dev, &dev->class, readid_flags,
dev->id); dev->id);
if (rc == 0) { if (rc == 0) {
......
...@@ -42,8 +42,6 @@ struct ata_scsi_args { ...@@ -42,8 +42,6 @@ struct ata_scsi_args {
enum { enum {
/* flags for ata_dev_read_id() */ /* flags for ata_dev_read_id() */
ATA_READID_POSTRESET = (1 << 0), /* reading ID after reset */ ATA_READID_POSTRESET = (1 << 0), /* reading ID after reset */
ATA_READID_DETECT = (1 << 1), /* perform presence detection
* using polling IDENTIFY */
}; };
extern struct workqueue_struct *ata_aux_wq; extern struct workqueue_struct *ata_aux_wq;
......
...@@ -176,9 +176,7 @@ enum { ...@@ -176,9 +176,7 @@ enum {
ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
* Register FIS clearing BSY */ * Register FIS clearing BSY */
ATA_FLAG_DEBUGMSG = (1 << 13), ATA_FLAG_DEBUGMSG = (1 << 13),
ATA_FLAG_DETECT_POLLING = (1 << 14), /* detect device presence by ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
* polling IDENTIFY */
ATA_FLAG_SETXFER_POLLING= (1 << 15), /* use polling for SETXFER */
/* The following flag belongs to ap->pflags but is kept in /* The following flag belongs to ap->pflags but is kept in
* ap->flags because it's referenced in many LLDs and will be * ap->flags because it's referenced in many LLDs and will be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment