aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-15 04:24:09 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-20 05:07:52 -0500
commit6aff8f1f07a7fff48121d1ad4a550f3af24ccc81 (patch)
tree3b02003f45b43c81b395c4a07e8c708599304bdd /drivers
parent6a62a04d4705df4f9f9bee39e889b9e920eeca47 (diff)
[PATCH] libata: update ata_dev_init_params()
Update ata_dev_init_params() such that it doesn't disable port directly but return with appropriate error mask on failure. This is preparation for splitting ata_dev_identify(). Note that this patch changes behavior of dev_init_params failure such that only failing devices are taken offline not the whole port. This change is intended. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libata-core.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d694b20e81b..76621463b49 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -62,7 +62,8 @@
62#include "libata.h" 62#include "libata.h"
63 63
64static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); 64static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
65static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); 65static unsigned int ata_dev_init_params(struct ata_port *ap,
66 struct ata_device *dev);
66static void ata_set_mode(struct ata_port *ap); 67static void ata_set_mode(struct ata_port *ap);
67static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); 68static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
68static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift); 69static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
@@ -1041,7 +1042,12 @@ retry:
1041 * Some drives were very specific about that exact sequence. 1042 * Some drives were very specific about that exact sequence.
1042 */ 1043 */
1043 if (major_version < 4 || (!ata_id_has_lba(dev->id))) { 1044 if (major_version < 4 || (!ata_id_has_lba(dev->id))) {
1044 ata_dev_init_params(ap, dev); 1045 err_mask = ata_dev_init_params(ap, dev);
1046 if (err_mask) {
1047 printk(KERN_ERR "ata%u: failed to init "
1048 "parameters, disabled\n", ap->id);
1049 goto err_out;
1050 }
1045 1051
1046 /* current CHS translation info (id[53-58]) might be 1052 /* current CHS translation info (id[53-58]) might be
1047 * changed. reread the identify device info. 1053 * changed. reread the identify device info.
@@ -2530,17 +2536,23 @@ err_out:
2530 * @dev: Device to which command will be sent 2536 * @dev: Device to which command will be sent
2531 * 2537 *
2532 * LOCKING: 2538 * LOCKING:
2539 * Kernel thread context (may sleep)
2540 *
2541 * RETURNS:
2542 * 0 on success, AC_ERR_* mask otherwise.
2533 */ 2543 */
2534 2544
2535static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev) 2545static unsigned int ata_dev_init_params(struct ata_port *ap,
2546 struct ata_device *dev)
2536{ 2547{
2537 struct ata_taskfile tf; 2548 struct ata_taskfile tf;
2549 unsigned int err_mask;
2538 u16 sectors = dev->id[6]; 2550 u16 sectors = dev->id[6];
2539 u16 heads = dev->id[3]; 2551 u16 heads = dev->id[3];
2540 2552
2541 /* Number of sectors per track 1-255. Number of heads 1-16 */ 2553 /* Number of sectors per track 1-255. Number of heads 1-16 */
2542 if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16) 2554 if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16)
2543 return; 2555 return 0;
2544 2556
2545 /* set up init dev params taskfile */ 2557 /* set up init dev params taskfile */
2546 DPRINTK("init dev params \n"); 2558 DPRINTK("init dev params \n");
@@ -2552,13 +2564,10 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev)
2552 tf.nsect = sectors; 2564 tf.nsect = sectors;
2553 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */ 2565 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */
2554 2566
2555 if (ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0)) { 2567 err_mask = ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0);
2556 printk(KERN_ERR "ata%u: failed to init parameters, disabled\n",
2557 ap->id);
2558 ata_port_disable(ap);
2559 }
2560 2568
2561 DPRINTK("EXIT\n"); 2569 DPRINTK("EXIT, err_mask=%x\n", err_mask);
2570 return err_mask;
2562} 2571}
2563 2572
2564/** 2573/**