Skip to content

Commit

Permalink
[PATCH] libata: separate out ata_sata_print_link_status
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Jan 18, 2006
1 parent 35cfc45 commit 3be680b
Showing 1 changed file with 40 additions and 18 deletions.
58 changes: 40 additions & 18 deletions drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3be680b

Please sign in to comment.