aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index c11601617134..9234bc047956 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -47,6 +47,7 @@ const struct ata_port_operations ata_sff_port_ops = {
47 47
48 .freeze = ata_sff_freeze, 48 .freeze = ata_sff_freeze,
49 .thaw = ata_sff_thaw, 49 .thaw = ata_sff_thaw,
50 .prereset = ata_sff_prereset,
50 .softreset = ata_sff_softreset, 51 .softreset = ata_sff_softreset,
51 .error_handler = ata_sff_error_handler, 52 .error_handler = ata_sff_error_handler,
52 .post_internal_cmd = ata_sff_post_internal_cmd, 53 .post_internal_cmd = ata_sff_post_internal_cmd,
@@ -1607,6 +1608,48 @@ void ata_sff_thaw(struct ata_port *ap)
1607} 1608}
1608 1609
1609/** 1610/**
1611 * ata_sff_prereset - prepare SFF link for reset
1612 * @link: SFF link to be reset
1613 * @deadline: deadline jiffies for the operation
1614 *
1615 * SFF link @link is about to be reset. Initialize it. It first
1616 * calls ata_std_prereset() and wait for !BSY if the port is
1617 * being softreset.
1618 *
1619 * LOCKING:
1620 * Kernel thread context (may sleep)
1621 *
1622 * RETURNS:
1623 * 0 on success, -errno otherwise.
1624 */
1625int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
1626{
1627 struct ata_port *ap = link->ap;
1628 struct ata_eh_context *ehc = &link->eh_context;
1629 int rc;
1630
1631 rc = ata_std_prereset(link, deadline);
1632 if (rc)
1633 return rc;
1634
1635 /* if we're about to do hardreset, nothing more to do */
1636 if (ehc->i.action & ATA_EH_HARDRESET)
1637 return 0;
1638
1639 /* wait for !BSY if we don't know that no device is attached */
1640 if (!ata_link_offline(link)) {
1641 rc = ata_sff_wait_ready(ap, deadline);
1642 if (rc && rc != -ENODEV) {
1643 ata_link_printk(link, KERN_WARNING, "device not ready "
1644 "(errno=%d), forcing hardreset\n", rc);
1645 ehc->i.action |= ATA_EH_HARDRESET;
1646 }
1647 }
1648
1649 return 0;
1650}
1651
1652/**
1610 * ata_devchk - PATA device presence detection 1653 * ata_devchk - PATA device presence detection
1611 * @ap: ATA channel to examine 1654 * @ap: ATA channel to examine
1612 * @device: Device to examine (starting at zero) 1655 * @device: Device to examine (starting at zero)