* Move forcing device to PIO0 on device disable into
ata_dev_disable(). This makes both old and new EHs act the same
way.
* Speed down only PIO mode on probe failure. All commands used during
probing are PIO commands. There's no point in speeding down DMA.
* Retry at least once after -ENODEV. Some devices report garbled
IDENTIFY data after certain events. This shouldn't cause device
detach and re-attach.
* Rearrange EH failure path for simplicity.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
{
if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) {
ata_dev_printk(dev, KERN_WARNING, "disabled\n");
{
if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) {
ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+ ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
+ ATA_DNXFER_QUIET);
{
unsigned int classes[ATA_MAX_DEVICES];
int tries[ATA_MAX_DEVICES];
{
unsigned int classes[ATA_MAX_DEVICES];
int tries[ATA_MAX_DEVICES];
- int i, rc, down_xfermask;
tries[i] = ATA_PROBE_MAX_TRIES;
retry:
tries[i] = ATA_PROBE_MAX_TRIES;
retry:
/* reset and determine device classes */
ap->ops->phy_reset(ap);
/* reset and determine device classes */
ap->ops->phy_reset(ap);
/* configure transfer mode */
rc = ata_set_mode(ap, &dev);
/* configure transfer mode */
rc = ata_set_mode(ap, &dev);
- if (rc) {
- down_xfermask = 1;
for (i = 0; i < ATA_MAX_DEVICES; i++)
if (ata_dev_enabled(&ap->device[i]))
for (i = 0; i < ATA_MAX_DEVICES; i++)
if (ata_dev_enabled(&ap->device[i]))
switch (rc) {
case -EINVAL:
switch (rc) {
case -EINVAL:
+ /* eeek, something went very wrong, give up */
tries[dev->devno] = 0;
break;
tries[dev->devno] = 0;
break;
+
+ case -ENODEV:
+ /* give it just one more chance */
+ tries[dev->devno] = min(tries[dev->devno], 1);
- sata_down_spd_limit(ap);
- /* fall through */
- default:
- tries[dev->devno]--;
- dnxfer_sel = ATA_DNXFER_ANY;
- if (tries[dev->devno] == 1)
- dnxfer_sel = ATA_DNXFER_FORCE_PIO0;
- if (down_xfermask && ata_down_xfermask_limit(dev, dnxfer_sel))
- tries[dev->devno] = 0;
+ if (tries[dev->devno] == 1) {
+ /* This is the last chance, better to slow
+ * down than lose it.
+ */
+ sata_down_spd_limit(ap);
+ ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+ }
- if (!tries[dev->devno]) {
- ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0);
+ if (!tries[dev->devno])
{
struct ata_eh_context *ehc = &ap->eh_context;
struct ata_device *dev;
{
struct ata_eh_context *ehc = &ap->eh_context;
struct ata_device *dev;
- int down_xfermask, i, rc;
- int dnxfer_sel;
rc = 0;
/* if UNLOADING, finish immediately */
rc = 0;
/* if UNLOADING, finish immediately */
/* configure transfer mode if necessary */
if (ehc->i.flags & ATA_EHI_SETMODE) {
rc = ata_set_mode(ap, &dev);
/* configure transfer mode if necessary */
if (ehc->i.flags & ATA_EHI_SETMODE) {
rc = ata_set_mode(ap, &dev);
- if (rc) {
- down_xfermask = 1;
ehc->i.flags &= ~ATA_EHI_SETMODE;
}
ehc->i.flags &= ~ATA_EHI_SETMODE;
}
+ ehc->tries[dev->devno]--;
+
- case -ENODEV:
- /* device missing, schedule probing */
- ehc->i.probe_mask |= (1 << dev->devno);
+ /* eeek, something went very wrong, give up */
ehc->tries[dev->devno] = 0;
break;
ehc->tries[dev->devno] = 0;
break;
+
+ case -ENODEV:
+ /* device missing or wrong IDENTIFY data, schedule probing */
+ ehc->i.probe_mask |= (1 << dev->devno);
+ /* give it just one more chance */
+ ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
- sata_down_spd_limit(ap);
- default:
- ehc->tries[dev->devno]--;
- 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;
+ if (ehc->tries[dev->devno] == 1) {
+ /* This is the last chance, better to slow
+ * down than lose it.
+ */
+ sata_down_spd_limit(ap);
+ ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+ }
}
if (ata_dev_enabled(dev) && !ehc->tries[dev->devno]) {
}
if (ata_dev_enabled(dev) && !ehc->tries[dev->devno]) {