Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21781
b: refs/heads/master
c: 3be680b
h: refs/heads/master
i:
  21779: 473f5e2
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Jan 18, 2006
1 parent 7101ade commit f07109c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35cfc45c582c0df666a817bc5e6cbe7aef5693a0
refs/heads/master: 3be680b7329e65b9165d6d8dc81baa1e9e89dfc7
58 changes: 40 additions & 18 deletions trunk/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 f07109c

Please sign in to comment.