aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 99a881558e8d..93e7b99d7819 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3425,19 +3425,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
3425 xfer_mask = ata_pack_xfermask(ap->pio_mask, 3425 xfer_mask = ata_pack_xfermask(ap->pio_mask,
3426 ap->mwdma_mask, ap->udma_mask); 3426 ap->mwdma_mask, ap->udma_mask);
3427 3427
3428 /* Apply cable rule here. Don't apply it early because when 3428 /* drive modes available */
3429 * we handle hot plug the cable type can itself change.
3430 */
3431 if (ap->cbl == ATA_CBL_PATA40)
3432 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
3433 /* Apply drive side cable rule. Unknown or 80 pin cables reported
3434 * host side are checked drive side as well. Cases where we know a
3435 * 40wire cable is used safely for 80 are not checked here.
3436 */
3437 if (ata_drive_40wire(dev->id) && (ap->cbl == ATA_CBL_PATA_UNK || ap->cbl == ATA_CBL_PATA80))
3438 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
3439
3440
3441 xfer_mask &= ata_pack_xfermask(dev->pio_mask, 3429 xfer_mask &= ata_pack_xfermask(dev->pio_mask,
3442 dev->mwdma_mask, dev->udma_mask); 3430 dev->mwdma_mask, dev->udma_mask);
3443 xfer_mask &= ata_id_xfermask(dev->id); 3431 xfer_mask &= ata_id_xfermask(dev->id);
@@ -3469,6 +3457,25 @@ static void ata_dev_xfermask(struct ata_device *dev)
3469 if (ap->ops->mode_filter) 3457 if (ap->ops->mode_filter)
3470 xfer_mask = ap->ops->mode_filter(ap, dev, xfer_mask); 3458 xfer_mask = ap->ops->mode_filter(ap, dev, xfer_mask);
3471 3459
3460 /* Apply cable rule here. Don't apply it early because when
3461 * we handle hot plug the cable type can itself change.
3462 * Check this last so that we know if the transfer rate was
3463 * solely limited by the cable.
3464 * Unknown or 80 wire cables reported host side are checked
3465 * drive side as well. Cases where we know a 40wire cable
3466 * is used safely for 80 are not checked here.
3467 */
3468 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
3469 /* UDMA/44 or higher would be available */
3470 if((ap->cbl == ATA_CBL_PATA40) ||
3471 (ata_drive_40wire(dev->id) &&
3472 (ap->cbl == ATA_CBL_PATA_UNK ||
3473 ap->cbl == ATA_CBL_PATA80))) {
3474 ata_dev_printk(dev, KERN_WARNING,
3475 "limited to UDMA/33 due to 40-wire cable\n");
3476 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
3477 }
3478
3472 ata_unpack_xfermask(xfer_mask, &dev->pio_mask, 3479 ata_unpack_xfermask(xfer_mask, &dev->pio_mask,
3473 &dev->mwdma_mask, &dev->udma_mask); 3480 &dev->mwdma_mask, &dev->udma_mask);
3474} 3481}