aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 05:36:23 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:31 -0400
commitcc0680a580b5be81a1ca321b58f8e9b80b5c1052 (patch)
tree57454cdfdc9890f4e8d9f532e9cd240c7361951f /drivers/ata/libata-core.c
parent955e57dfde4ff75e4d7329ac7a3d645b16015309 (diff)
libata-link: linkify reset
Make reset methods and related functions deal with ata_link instead of ata_port. * ata_do_reset() * ata_eh_reset() * all prereset/reset/postreset methods and related functions This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 6f99dee6b6d..73f66f4e1ee 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3306,10 +3306,10 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
3306 3306
3307/** 3307/**
3308 * ata_std_prereset - prepare for reset 3308 * ata_std_prereset - prepare for reset
3309 * @ap: ATA port to be reset 3309 * @link: ATA link to be reset
3310 * @deadline: deadline jiffies for the operation 3310 * @deadline: deadline jiffies for the operation
3311 * 3311 *
3312 * @ap is about to be reset. Initialize it. Failure from 3312 * @link is about to be reset. Initialize it. Failure from
3313 * prereset makes libata abort whole reset sequence and give up 3313 * prereset makes libata abort whole reset sequence and give up
3314 * that port, so prereset should be best-effort. It does its 3314 * that port, so prereset should be best-effort. It does its
3315 * best to prepare for reset sequence but if things go wrong, it 3315 * best to prepare for reset sequence but if things go wrong, it
@@ -3321,9 +3321,9 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
3321 * RETURNS: 3321 * RETURNS:
3322 * 0 on success, -errno otherwise. 3322 * 0 on success, -errno otherwise.
3323 */ 3323 */
3324int ata_std_prereset(struct ata_port *ap, unsigned long deadline) 3324int ata_std_prereset(struct ata_link *link, unsigned long deadline)
3325{ 3325{
3326 struct ata_link *link = &ap->link; 3326 struct ata_port *ap = link->ap;
3327 struct ata_eh_context *ehc = &link->eh_context; 3327 struct ata_eh_context *ehc = &link->eh_context;
3328 const unsigned long *timing = sata_ehc_deb_timing(ehc); 3328 const unsigned long *timing = sata_ehc_deb_timing(ehc);
3329 int rc; 3329 int rc;
@@ -3342,7 +3342,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3342 rc = sata_link_resume(link, timing, deadline); 3342 rc = sata_link_resume(link, timing, deadline);
3343 /* whine about phy resume failure but proceed */ 3343 /* whine about phy resume failure but proceed */
3344 if (rc && rc != -EOPNOTSUPP) 3344 if (rc && rc != -EOPNOTSUPP)
3345 ata_port_printk(ap, KERN_WARNING, "failed to resume " 3345 ata_link_printk(link, KERN_WARNING, "failed to resume "
3346 "link for reset (errno=%d)\n", rc); 3346 "link for reset (errno=%d)\n", rc);
3347 } 3347 }
3348 3348
@@ -3352,7 +3352,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3352 if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_link_offline(link)) { 3352 if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_link_offline(link)) {
3353 rc = ata_wait_ready(ap, deadline); 3353 rc = ata_wait_ready(ap, deadline);
3354 if (rc && rc != -ENODEV) { 3354 if (rc && rc != -ENODEV) {
3355 ata_port_printk(ap, KERN_WARNING, "device not ready " 3355 ata_link_printk(link, KERN_WARNING, "device not ready "
3356 "(errno=%d), forcing hardreset\n", rc); 3356 "(errno=%d), forcing hardreset\n", rc);
3357 ehc->i.action |= ATA_EH_HARDRESET; 3357 ehc->i.action |= ATA_EH_HARDRESET;
3358 } 3358 }
@@ -3363,7 +3363,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3363 3363
3364/** 3364/**
3365 * ata_std_softreset - reset host port via ATA SRST 3365 * ata_std_softreset - reset host port via ATA SRST
3366 * @ap: port to reset 3366 * @link: ATA link to reset
3367 * @classes: resulting classes of attached devices 3367 * @classes: resulting classes of attached devices
3368 * @deadline: deadline jiffies for the operation 3368 * @deadline: deadline jiffies for the operation
3369 * 3369 *
@@ -3375,10 +3375,10 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3375 * RETURNS: 3375 * RETURNS:
3376 * 0 on success, -errno otherwise. 3376 * 0 on success, -errno otherwise.
3377 */ 3377 */
3378int ata_std_softreset(struct ata_port *ap, unsigned int *classes, 3378int ata_std_softreset(struct ata_link *link, unsigned int *classes,
3379 unsigned long deadline) 3379 unsigned long deadline)
3380{ 3380{
3381 struct ata_link *link = &ap->link; 3381 struct ata_port *ap = link->ap;
3382 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 3382 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
3383 unsigned int devmask = 0; 3383 unsigned int devmask = 0;
3384 int rc; 3384 int rc;
@@ -3405,7 +3405,7 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes,
3405 rc = ata_bus_softreset(ap, devmask, deadline); 3405 rc = ata_bus_softreset(ap, devmask, deadline);
3406 /* if link is occupied, -ENODEV too is an error */ 3406 /* if link is occupied, -ENODEV too is an error */
3407 if (rc && (rc != -ENODEV || sata_scr_valid(link))) { 3407 if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
3408 ata_port_printk(ap, KERN_ERR, "SRST failed (errno=%d)\n", rc); 3408 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
3409 return rc; 3409 return rc;
3410 } 3410 }
3411 3411
@@ -3420,12 +3420,12 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes,
3420} 3420}
3421 3421
3422/** 3422/**
3423 * sata_port_hardreset - reset port via SATA phy reset 3423 * sata_link_hardreset - reset link via SATA phy reset
3424 * @ap: port to reset 3424 * @link: link to reset
3425 * @timing: timing parameters { interval, duratinon, timeout } in msec 3425 * @timing: timing parameters { interval, duratinon, timeout } in msec
3426 * @deadline: deadline jiffies for the operation 3426 * @deadline: deadline jiffies for the operation
3427 * 3427 *
3428 * SATA phy-reset host port using DET bits of SControl register. 3428 * SATA phy-reset @link using DET bits of SControl register.
3429 * 3429 *
3430 * LOCKING: 3430 * LOCKING:
3431 * Kernel thread context (may sleep) 3431 * Kernel thread context (may sleep)
@@ -3433,10 +3433,9 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes,
3433 * RETURNS: 3433 * RETURNS:
3434 * 0 on success, -errno otherwise. 3434 * 0 on success, -errno otherwise.
3435 */ 3435 */
3436int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing, 3436int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
3437 unsigned long deadline) 3437 unsigned long deadline)
3438{ 3438{
3439 struct ata_link *link = &ap->link;
3440 u32 scontrol; 3439 u32 scontrol;
3441 int rc; 3440 int rc;
3442 3441
@@ -3482,7 +3481,7 @@ int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing,
3482 3481
3483/** 3482/**
3484 * sata_std_hardreset - reset host port via SATA phy reset 3483 * sata_std_hardreset - reset host port via SATA phy reset
3485 * @ap: port to reset 3484 * @link: link to reset
3486 * @class: resulting class of attached device 3485 * @class: resulting class of attached device
3487 * @deadline: deadline jiffies for the operation 3486 * @deadline: deadline jiffies for the operation
3488 * 3487 *
@@ -3495,19 +3494,19 @@ int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing,
3495 * RETURNS: 3494 * RETURNS:
3496 * 0 on success, -errno otherwise. 3495 * 0 on success, -errno otherwise.
3497 */ 3496 */
3498int sata_std_hardreset(struct ata_port *ap, unsigned int *class, 3497int sata_std_hardreset(struct ata_link *link, unsigned int *class,
3499 unsigned long deadline) 3498 unsigned long deadline)
3500{ 3499{
3501 struct ata_link *link = &ap->link; 3500 struct ata_port *ap = link->ap;
3502 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 3501 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
3503 int rc; 3502 int rc;
3504 3503
3505 DPRINTK("ENTER\n"); 3504 DPRINTK("ENTER\n");
3506 3505
3507 /* do hardreset */ 3506 /* do hardreset */
3508 rc = sata_port_hardreset(ap, timing, deadline); 3507 rc = sata_link_hardreset(link, timing, deadline);
3509 if (rc) { 3508 if (rc) {
3510 ata_port_printk(ap, KERN_ERR, 3509 ata_link_printk(link, KERN_ERR,
3511 "COMRESET failed (errno=%d)\n", rc); 3510 "COMRESET failed (errno=%d)\n", rc);
3512 return rc; 3511 return rc;
3513 } 3512 }
@@ -3525,7 +3524,7 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class,
3525 rc = ata_wait_ready(ap, deadline); 3524 rc = ata_wait_ready(ap, deadline);
3526 /* link occupied, -ENODEV too is an error */ 3525 /* link occupied, -ENODEV too is an error */
3527 if (rc) { 3526 if (rc) {
3528 ata_port_printk(ap, KERN_ERR, 3527 ata_link_printk(link, KERN_ERR,
3529 "COMRESET failed (errno=%d)\n", rc); 3528 "COMRESET failed (errno=%d)\n", rc);
3530 return rc; 3529 return rc;
3531 } 3530 }
@@ -3540,7 +3539,7 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class,
3540 3539
3541/** 3540/**
3542 * ata_std_postreset - standard postreset callback 3541 * ata_std_postreset - standard postreset callback
3543 * @ap: the target ata_port 3542 * @link: the target ata_link
3544 * @classes: classes of attached devices 3543 * @classes: classes of attached devices
3545 * 3544 *
3546 * This function is invoked after a successful reset. Note that 3545 * This function is invoked after a successful reset. Note that
@@ -3550,9 +3549,9 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class,
3550 * LOCKING: 3549 * LOCKING:
3551 * Kernel thread context (may sleep) 3550 * Kernel thread context (may sleep)
3552 */ 3551 */
3553void ata_std_postreset(struct ata_port *ap, unsigned int *classes) 3552void ata_std_postreset(struct ata_link *link, unsigned int *classes)
3554{ 3553{
3555 struct ata_link *link = &ap->link; 3554 struct ata_port *ap = link->ap;
3556 u32 serror; 3555 u32 serror;
3557 3556
3558 DPRINTK("ENTER\n"); 3557 DPRINTK("ENTER\n");
@@ -6946,7 +6945,7 @@ EXPORT_SYMBOL_GPL(__sata_phy_reset);
6946EXPORT_SYMBOL_GPL(ata_bus_reset); 6945EXPORT_SYMBOL_GPL(ata_bus_reset);
6947EXPORT_SYMBOL_GPL(ata_std_prereset); 6946EXPORT_SYMBOL_GPL(ata_std_prereset);
6948EXPORT_SYMBOL_GPL(ata_std_softreset); 6947EXPORT_SYMBOL_GPL(ata_std_softreset);
6949EXPORT_SYMBOL_GPL(sata_port_hardreset); 6948EXPORT_SYMBOL_GPL(sata_link_hardreset);
6950EXPORT_SYMBOL_GPL(sata_std_hardreset); 6949EXPORT_SYMBOL_GPL(sata_std_hardreset);
6951EXPORT_SYMBOL_GPL(ata_std_postreset); 6950EXPORT_SYMBOL_GPL(ata_std_postreset);
6952EXPORT_SYMBOL_GPL(ata_dev_classify); 6951EXPORT_SYMBOL_GPL(ata_dev_classify);