Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21854
b: refs/heads/master
c: 6aff8f1
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Feb 20, 2006
1 parent 9cd4743 commit a4c233e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 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: 6a62a04d4705df4f9f9bee39e889b9e920eeca47
refs/heads/master: 6aff8f1f07a7fff48121d1ad4a550f3af24ccc81
29 changes: 19 additions & 10 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
#include "libata.h"

static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
static unsigned int ata_dev_init_params(struct ata_port *ap,
struct ata_device *dev);
static void ata_set_mode(struct ata_port *ap);
static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
Expand Down Expand Up @@ -1041,7 +1042,12 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
* Some drives were very specific about that exact sequence.
*/
if (major_version < 4 || (!ata_id_has_lba(dev->id))) {
ata_dev_init_params(ap, dev);
err_mask = ata_dev_init_params(ap, dev);
if (err_mask) {
printk(KERN_ERR "ata%u: failed to init "
"parameters, disabled\n", ap->id);
goto err_out;
}

/* current CHS translation info (id[53-58]) might be
* changed. reread the identify device info.
Expand Down Expand Up @@ -2530,17 +2536,23 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev)
* @dev: Device to which command will be sent
*
* LOCKING:
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, AC_ERR_* mask otherwise.
*/

static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev)
static unsigned int ata_dev_init_params(struct ata_port *ap,
struct ata_device *dev)
{
struct ata_taskfile tf;
unsigned int err_mask;
u16 sectors = dev->id[6];
u16 heads = dev->id[3];

/* Number of sectors per track 1-255. Number of heads 1-16 */
if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16)
return;
return 0;

/* set up init dev params taskfile */
DPRINTK("init dev params \n");
Expand All @@ -2552,13 +2564,10 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev)
tf.nsect = sectors;
tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */

if (ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0)) {
printk(KERN_ERR "ata%u: failed to init parameters, disabled\n",
ap->id);
ata_port_disable(ap);
}
err_mask = ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0);

DPRINTK("EXIT\n");
DPRINTK("EXIT, err_mask=%x\n", err_mask);
return err_mask;
}

/**
Expand Down

0 comments on commit a4c233e

Please sign in to comment.