libata: update ata_dev_try_classify() arguments
Make ata_dev_try_classify() take a pointer to ata_device instead of ata_port/port_number combination for consistency and add @present argument. @present indicates whether the device seems present during reset. It's the result of TF access during softreset and link onlineness during hardreset. @present will be used to improve diagnostic failure handling. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
@@ -701,8 +701,8 @@ 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
|
* @dev: ATA device to classify (starting at zero)
|
||||||
* @device: Device to examine (starting at zero)
|
* @present: device seems present
|
||||||
* @r_err: Value of error register on completion
|
* @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,
|
||||||
@@ -720,15 +720,15 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
|
|||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
|
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
|
||||||
*/
|
*/
|
||||||
|
unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
|
||||||
unsigned int
|
u8 *r_err)
|
||||||
ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
|
|
||||||
{
|
{
|
||||||
|
struct ata_port *ap = dev->link->ap;
|
||||||
struct ata_taskfile tf;
|
struct ata_taskfile tf;
|
||||||
unsigned int class;
|
unsigned int class;
|
||||||
u8 err;
|
u8 err;
|
||||||
|
|
||||||
ap->ops->dev_select(ap, device);
|
ap->ops->dev_select(ap, dev->devno);
|
||||||
|
|
||||||
memset(&tf, 0, sizeof(tf));
|
memset(&tf, 0, sizeof(tf));
|
||||||
|
|
||||||
@@ -738,12 +738,12 @@ ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
|
|||||||
*r_err = err;
|
*r_err = err;
|
||||||
|
|
||||||
/* see if device passed diags: if master then continue and warn later */
|
/* see if device passed diags: if master then continue and warn later */
|
||||||
if (err == 0 && device == 0)
|
if (err == 0 && dev->devno == 0)
|
||||||
/* diagnostic fail : do nothing _YET_ */
|
/* diagnostic fail : do nothing _YET_ */
|
||||||
ap->link.device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC;
|
dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
|
||||||
else if (err == 1)
|
else if (err == 1)
|
||||||
/* do nothing */ ;
|
/* do nothing */ ;
|
||||||
else if ((device == 0) && (err == 0x81))
|
else if ((dev->devno == 0) && (err == 0x81))
|
||||||
/* do nothing */ ;
|
/* do nothing */ ;
|
||||||
else
|
else
|
||||||
return ATA_DEV_NONE;
|
return ATA_DEV_NONE;
|
||||||
@@ -3238,9 +3238,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
|
||||||
*/
|
*/
|
||||||
device[0].class = ata_dev_try_classify(ap, 0, &err);
|
device[0].class = ata_dev_try_classify(&device[0], dev0, &err);
|
||||||
if ((slave_possible) && (err != 0x81))
|
if ((slave_possible) && (err != 0x81))
|
||||||
device[1].class = ata_dev_try_classify(ap, 1, &err);
|
device[1].class = ata_dev_try_classify(&device[1], dev1, &err);
|
||||||
|
|
||||||
/* is double-select really necessary? */
|
/* is double-select really necessary? */
|
||||||
if (device[1].class != ATA_DEV_NONE)
|
if (device[1].class != ATA_DEV_NONE)
|
||||||
@@ -3479,9 +3479,11 @@ int ata_std_softreset(struct ata_link *link, unsigned int *classes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* determine by signature whether we have ATA or ATAPI devices */
|
/* determine by signature whether we have ATA or ATAPI devices */
|
||||||
classes[0] = ata_dev_try_classify(ap, 0, &err);
|
classes[0] = ata_dev_try_classify(&link->device[0],
|
||||||
|
devmask & (1 << 0), &err);
|
||||||
if (slave_possible && err != 0x81)
|
if (slave_possible && err != 0x81)
|
||||||
classes[1] = ata_dev_try_classify(ap, 1, &err);
|
classes[1] = ata_dev_try_classify(&link->device[1],
|
||||||
|
devmask & (1 << 1), &err);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
|
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
|
||||||
@@ -3600,7 +3602,7 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
|
|||||||
|
|
||||||
ap->ops->dev_select(ap, 0); /* probably unnecessary */
|
ap->ops->dev_select(ap, 0); /* probably unnecessary */
|
||||||
|
|
||||||
*class = ata_dev_try_classify(ap, 0, NULL);
|
*class = ata_dev_try_classify(link->device, 1, NULL);
|
||||||
|
|
||||||
DPRINTK("EXIT, class=%u\n", *class);
|
DPRINTK("EXIT, class=%u\n", *class);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -636,9 +636,11 @@ static int scc_std_softreset (struct ata_port *ap, unsigned int *classes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* determine by signature whether we have ATA or ATAPI devices */
|
/* determine by signature whether we have ATA or ATAPI devices */
|
||||||
classes[0] = ata_dev_try_classify(ap, 0, &err);
|
classes[0] = ata_dev_try_classify(&ap->link.device[0],
|
||||||
|
devmask & (1 << 0), &err);
|
||||||
if (slave_possible && err != 0x81)
|
if (slave_possible && err != 0x81)
|
||||||
classes[1] = ata_dev_try_classify(ap, 1, &err);
|
classes[1] = ata_dev_try_classify(&ap->link.device[1],
|
||||||
|
devmask & (1 << 1), &err);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
|
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
|
||||||
|
@@ -2248,7 +2248,7 @@ comreset_retry:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* finally, read device signature from TF registers */
|
/* finally, read device signature from TF registers */
|
||||||
*class = ata_dev_try_classify(ap, 0, NULL);
|
*class = ata_dev_try_classify(ap->link.device, 1, NULL);
|
||||||
|
|
||||||
writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
|
writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
|
||||||
|
|
||||||
|
@@ -781,7 +781,8 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
|
|||||||
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
|
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
|
||||||
unsigned long interval_msec,
|
unsigned long interval_msec,
|
||||||
unsigned long timeout_msec);
|
unsigned long timeout_msec);
|
||||||
extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);
|
extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
|
||||||
|
u8 *r_err);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default driver ops implementations
|
* Default driver ops implementations
|
||||||
|
Reference in New Issue
Block a user