[PATCH] libata: modify ata_dev_try_classify
Make ata_dev_try_classify take @r_err to store tf error register value on completion and return device class instead of directly manipulating dev->class. This is preparation for new reset mechanism. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
parent
6f8b995895
commit
b4dc7623c1
1 changed files with 16 additions and 14 deletions
|
@ -830,6 +830,7 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
|
||||||
* ata_dev_try_classify - Parse returned ATA device signature
|
* ata_dev_try_classify - Parse returned ATA device signature
|
||||||
* @ap: ATA channel to examine
|
* @ap: ATA channel to examine
|
||||||
* @device: Device to examine (starting at zero)
|
* @device: Device to examine (starting at zero)
|
||||||
|
* @r_err: Value of error register on completion
|
||||||
*
|
*
|
||||||
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
|
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
|
||||||
* an ATA/ATAPI-defined set of values is placed in the ATA
|
* an ATA/ATAPI-defined set of values is placed in the ATA
|
||||||
|
@ -842,11 +843,14 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
|
||||||
*
|
*
|
||||||
* LOCKING:
|
* LOCKING:
|
||||||
* caller.
|
* caller.
|
||||||
|
*
|
||||||
|
* RETURNS:
|
||||||
|
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
|
static unsigned int
|
||||||
|
ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
|
||||||
{
|
{
|
||||||
struct ata_device *dev = &ap->device[device];
|
|
||||||
struct ata_taskfile tf;
|
struct ata_taskfile tf;
|
||||||
unsigned int class;
|
unsigned int class;
|
||||||
u8 err;
|
u8 err;
|
||||||
|
@ -857,8 +861,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
|
||||||
|
|
||||||
ap->ops->tf_read(ap, &tf);
|
ap->ops->tf_read(ap, &tf);
|
||||||
err = tf.feature;
|
err = tf.feature;
|
||||||
|
if (r_err)
|
||||||
dev->class = ATA_DEV_NONE;
|
*r_err = err;
|
||||||
|
|
||||||
/* see if device passed diags */
|
/* see if device passed diags */
|
||||||
if (err == 1)
|
if (err == 1)
|
||||||
|
@ -866,18 +870,16 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
|
||||||
else if ((device == 0) && (err == 0x81))
|
else if ((device == 0) && (err == 0x81))
|
||||||
/* do nothing */ ;
|
/* do nothing */ ;
|
||||||
else
|
else
|
||||||
return err;
|
return ATA_DEV_NONE;
|
||||||
|
|
||||||
/* determine if device if ATA or ATAPI */
|
/* determine if device is ATA or ATAPI */
|
||||||
class = ata_dev_classify(&tf);
|
class = ata_dev_classify(&tf);
|
||||||
|
|
||||||
if (class == ATA_DEV_UNKNOWN)
|
if (class == ATA_DEV_UNKNOWN)
|
||||||
return err;
|
return ATA_DEV_NONE;
|
||||||
if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
|
if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
|
||||||
return err;
|
return ATA_DEV_NONE;
|
||||||
|
return class;
|
||||||
dev->class = class;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2177,9 +2179,9 @@ void ata_bus_reset(struct ata_port *ap)
|
||||||
/*
|
/*
|
||||||
* determine by signature whether we have ATA or ATAPI devices
|
* determine by signature whether we have ATA or ATAPI devices
|
||||||
*/
|
*/
|
||||||
err = ata_dev_try_classify(ap, 0);
|
ap->device[0].class = ata_dev_try_classify(ap, 0, &err);
|
||||||
if ((slave_possible) && (err != 0x81))
|
if ((slave_possible) && (err != 0x81))
|
||||||
ata_dev_try_classify(ap, 1);
|
ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
|
||||||
|
|
||||||
/* re-enable interrupts */
|
/* re-enable interrupts */
|
||||||
if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */
|
if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */
|
||||||
|
|
Loading…
Reference in a new issue