diff options
author | Tejun Heo <htejun@gmail.com> | 2006-03-31 11:38:17 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-04-01 12:33:45 -0500 |
commit | 4c360c81a6f8d4253f7fc2e69852305676fdfa72 (patch) | |
tree | ac36bd47924d0b591d966c4976335c6e6409b99c /drivers/scsi/libata-core.c | |
parent | 96072e699be08af8e7c33c56759582ea89088a02 (diff) |
[PATCH] libata: separate out ata_spd_string()
Separate out ata_spd_string() from sata_print_link_status(). This
will be used by SATA spd configuration routines.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index c7ba523fb1eb..6a336babf88b 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -397,6 +397,18 @@ static const char *ata_mode_string(unsigned int xfer_mask) | |||
397 | return "<n/a>"; | 397 | return "<n/a>"; |
398 | } | 398 | } |
399 | 399 | ||
400 | static const char *sata_spd_string(unsigned int spd) | ||
401 | { | ||
402 | static const char * const spd_str[] = { | ||
403 | "1.5 Gbps", | ||
404 | "3.0 Gbps", | ||
405 | }; | ||
406 | |||
407 | if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str)) | ||
408 | return "<unknown>"; | ||
409 | return spd_str[spd - 1]; | ||
410 | } | ||
411 | |||
400 | static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev) | 412 | static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev) |
401 | { | 413 | { |
402 | if (ata_dev_present(dev)) { | 414 | if (ata_dev_present(dev)) { |
@@ -1452,7 +1464,6 @@ void ata_port_probe(struct ata_port *ap) | |||
1452 | static void sata_print_link_status(struct ata_port *ap) | 1464 | static void sata_print_link_status(struct ata_port *ap) |
1453 | { | 1465 | { |
1454 | u32 sstatus, tmp; | 1466 | u32 sstatus, tmp; |
1455 | const char *speed; | ||
1456 | 1467 | ||
1457 | if (!ap->ops->scr_read) | 1468 | if (!ap->ops->scr_read) |
1458 | return; | 1469 | return; |
@@ -1461,14 +1472,8 @@ static void sata_print_link_status(struct ata_port *ap) | |||
1461 | 1472 | ||
1462 | if (sata_dev_present(ap)) { | 1473 | if (sata_dev_present(ap)) { |
1463 | tmp = (sstatus >> 4) & 0xf; | 1474 | tmp = (sstatus >> 4) & 0xf; |
1464 | if (tmp & (1 << 0)) | 1475 | printk(KERN_INFO "ata%u: SATA link up %s (SStatus %X)\n", |
1465 | speed = "1.5"; | 1476 | ap->id, sata_spd_string(tmp), sstatus); |
1466 | else if (tmp & (1 << 1)) | ||
1467 | speed = "3.0"; | ||
1468 | else | ||
1469 | speed = "<unknown>"; | ||
1470 | printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n", | ||
1471 | ap->id, speed, sstatus); | ||
1472 | } else { | 1477 | } else { |
1473 | printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n", | 1478 | printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n", |
1474 | ap->id, sstatus); | 1479 | ap->id, sstatus); |