[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>
This commit is contained in:
Tejun Heo 2005-12-19 22:35:02 +09:00 committed by Jeff Garzik
parent 35cfc45c58
commit 3be680b732

View File

@ -1525,6 +1525,41 @@ void ata_port_probe(struct ata_port *ap)
ap->flags &= ~ATA_FLAG_PORT_DISABLED;
}
/**
* sata_print_link_status - Print SATA link status
* @ap: SATA port to printk link status about
*
* This function prints link speed and status of a SATA link.
*
* LOCKING:
* None.
*/
static void sata_print_link_status(struct ata_port *ap)
{
u32 sstatus, tmp;
const char *speed;
if (!ap->ops->scr_read)
return;
sstatus = scr_read(ap, SCR_STATUS);
if (sata_dev_present(ap)) {
tmp = (sstatus >> 4) & 0xf;
if (tmp & (1 << 0))
speed = "1.5";
else if (tmp & (1 << 1))
speed = "3.0";
else
speed = "<unknown>";
printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n",
ap->id, speed, sstatus);
} else {
printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n",
ap->id, sstatus);
}
}
/**
* __sata_phy_reset - Wake/reset a low-level SATA PHY
* @ap: SATA port associated with target SATA PHY.
@ -1559,27 +1594,14 @@ void __sata_phy_reset(struct ata_port *ap)
break;
} while (time_before(jiffies, timeout));
/* TODO: phy layer with polling, timeouts, etc. */
sstatus = scr_read(ap, SCR_STATUS);
if (sata_dev_present(ap)) {
const char *speed;
u32 tmp;
/* print link status */
sata_print_link_status(ap);
tmp = (sstatus >> 4) & 0xf;
if (tmp & (1 << 0))
speed = "1.5";
else if (tmp & (1 << 1))
speed = "3.0";
else
speed = "<unknown>";
printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n",
ap->id, speed, sstatus);
/* TODO: phy layer with polling, timeouts, etc. */
if (sata_dev_present(ap))
ata_port_probe(ap);
} else {
printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n",
ap->id, sstatus);
else
ata_port_disable(ap);
}
if (ap->flags & ATA_FLAG_PORT_DISABLED)
return;