aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-12-19 08:35:02 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 19:49:10 -0500
commit3be680b7329e65b9165d6d8dc81baa1e9e89dfc7 (patch)
tree75e7392670acb6bc8edfa58dbbbf5e1bbc541abe /drivers/scsi/libata-core.c
parent35cfc45c582c0df666a817bc5e6cbe7aef5693a0 (diff)
[PATCH] libata: separate out ata_sata_print_link_status
Separate out sata_print_link_status() from __sata_phy_reset(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c58
1 files changed, 40 insertions, 18 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 46c4cdbaee8..a07bd35da91 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1526,6 +1526,41 @@ void ata_port_probe(struct ata_port *ap)
1526} 1526}
1527 1527
1528/** 1528/**
1529 * sata_print_link_status - Print SATA link status
1530 * @ap: SATA port to printk link status about
1531 *
1532 * This function prints link speed and status of a SATA link.
1533 *
1534 * LOCKING:
1535 * None.
1536 */
1537static void sata_print_link_status(struct ata_port *ap)
1538{
1539 u32 sstatus, tmp;
1540 const char *speed;
1541
1542 if (!ap->ops->scr_read)
1543 return;
1544
1545 sstatus = scr_read(ap, SCR_STATUS);
1546
1547 if (sata_dev_present(ap)) {
1548 tmp = (sstatus >> 4) & 0xf;
1549 if (tmp & (1 << 0))
1550 speed = "1.5";
1551 else if (tmp & (1 << 1))
1552 speed = "3.0";
1553 else
1554 speed = "<unknown>";
1555 printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n",
1556 ap->id, speed, sstatus);
1557 } else {
1558 printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n",
1559 ap->id, sstatus);
1560 }
1561}
1562
1563/**
1529 * __sata_phy_reset - Wake/reset a low-level SATA PHY 1564 * __sata_phy_reset - Wake/reset a low-level SATA PHY
1530 * @ap: SATA port associated with target SATA PHY. 1565 * @ap: SATA port associated with target SATA PHY.
1531 * 1566 *
@@ -1559,27 +1594,14 @@ void __sata_phy_reset(struct ata_port *ap)
1559 break; 1594 break;
1560 } while (time_before(jiffies, timeout)); 1595 } while (time_before(jiffies, timeout));
1561 1596
1562 /* TODO: phy layer with polling, timeouts, etc. */ 1597 /* print link status */
1563 sstatus = scr_read(ap, SCR_STATUS); 1598 sata_print_link_status(ap);
1564 if (sata_dev_present(ap)) {
1565 const char *speed;
1566 u32 tmp;
1567 1599
1568 tmp = (sstatus >> 4) & 0xf; 1600 /* TODO: phy layer with polling, timeouts, etc. */
1569 if (tmp & (1 << 0)) 1601 if (sata_dev_present(ap))
1570 speed = "1.5";
1571 else if (tmp & (1 << 1))
1572 speed = "3.0";
1573 else
1574 speed = "<unknown>";
1575 printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n",
1576 ap->id, speed, sstatus);
1577 ata_port_probe(ap); 1602 ata_port_probe(ap);
1578 } else { 1603 else
1579 printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n",
1580 ap->id, sstatus);
1581 ata_port_disable(ap); 1604 ata_port_disable(ap);
1582 }
1583 1605
1584 if (ap->flags & ATA_FLAG_PORT_DISABLED) 1606 if (ap->flags & ATA_FLAG_PORT_DISABLED)
1585 return; 1607 return;