libata: improve ata_down_xfermask_limit()
Make ata_down_xfermask_limit() accept @sel instead of @force_pio0.
@sel selects how the xfermask limit will be adjusted. The following
selectors are defined.
* ATA_DNXFER_PIO : only speed down PIO
* ATA_DNXFER_DMA : only speed down DMA, don't cause transfer mode change
* ATA_DNXFER_40C : apply 40c cable limit
* ATA_DNXFER_FORCE_PIO : force PIO
* ATA_DNXFER_FORCE_PIO0 : force PIO0 (same as original with @force_pio0 == 1)
* ATA_DNXFER_ANY : same as original with @force_pio0 == 0
Currently, only ANY and FORCE_PIO0 are used to maintain the original
behavior. Other selectors will be used later to improve EH speed down
sequence.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 52c85af..7b61562 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1276,7 +1276,7 @@
return ATA_EH_HARDRESET;
/* lower transfer mode */
- if (ata_down_xfermask_limit(dev, 0) == 0)
+ if (ata_down_xfermask_limit(dev, ATA_DNXFER_ANY) == 0)
return ATA_EH_SOFTRESET;
ata_dev_printk(dev, KERN_ERR,
@@ -1965,6 +1965,7 @@
struct ata_eh_context *ehc = &ap->eh_context;
struct ata_device *dev;
int down_xfermask, i, rc;
+ int dnxfer_sel;
DPRINTK("ENTER\n");
@@ -2064,8 +2065,10 @@
sata_down_spd_limit(ap);
default:
ehc->tries[dev->devno]--;
- if (down_xfermask &&
- ata_down_xfermask_limit(dev, ehc->tries[dev->devno] == 1))
+ dnxfer_sel = ATA_DNXFER_ANY;
+ if (ehc->tries[dev->devno] == 1)
+ dnxfer_sel = ATA_DNXFER_FORCE_PIO0;
+ if (down_xfermask && ata_down_xfermask_limit(dev, dnxfer_sel))
ehc->tries[dev->devno] = 0;
}