* [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments
@ 2007-08-08 5:37 Tejun Heo
2007-08-08 5:40 ` [PATCH 2/2 #upstream] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
2007-08-31 9:18 ` [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Tejun Heo @ 2007-08-08 5:37 UTC (permalink / raw)
To: Jeff Garzik, linux-ide, Alan Cox, amsden_linux
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>
---
drivers/ata/libata-core.c | 31 +++++++++++++++++--------------
drivers/ata/pata_scc.c | 6 ++++--
drivers/ata/sata_mv.c | 2 +-
include/linux/libata.h | 3 ++-
4 files changed, 24 insertions(+), 18 deletions(-)
Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -696,8 +696,8 @@ unsigned int ata_dev_classify(const stru
/**
* ata_dev_try_classify - Parse returned ATA device signature
- * @ap: ATA channel to examine
- * @device: Device to examine (starting at zero)
+ * @dev: ATA device to classify (starting at zero)
+ * @present: device seems present
* @r_err: Value of error register on completion
*
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
@@ -715,15 +715,15 @@ unsigned int ata_dev_classify(const stru
* RETURNS:
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
*/
-
-unsigned int
-ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
+unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
+ u8 *r_err)
{
+ struct ata_port *ap = dev->ap;
struct ata_taskfile tf;
unsigned int class;
u8 err;
- ap->ops->dev_select(ap, device);
+ ap->ops->dev_select(ap, dev->devno);
memset(&tf, 0, sizeof(tf));
@@ -733,12 +733,12 @@ ata_dev_try_classify(struct ata_port *ap
*r_err = err;
/* 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_ */
- ap->device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC;
+ dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
else if (err == 1)
/* do nothing */ ;
- else if ((device == 0) && (err == 0x81))
+ else if ((dev->devno == 0) && (err == 0x81))
/* do nothing */ ;
else
return ATA_DEV_NONE;
@@ -3176,9 +3176,10 @@ void ata_bus_reset(struct ata_port *ap)
/*
* determine by signature whether we have ATA or ATAPI devices
*/
- ap->device[0].class = ata_dev_try_classify(ap, 0, &err);
+ ap->device[0].class = ata_dev_try_classify(&ap->device[0], dev0, &err);
if ((slave_possible) && (err != 0x81))
- ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
+ ap->device[1].class = ata_dev_try_classify(&ap->device[1],
+ dev1, &err);
/* is double-select really necessary? */
if (ap->device[1].class != ATA_DEV_NONE)
@@ -3415,9 +3416,11 @@ int ata_std_softreset(struct ata_port *a
}
/* 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->device[0],
+ devmask & (1 << 0), &err);
if (slave_possible && err != 0x81)
- classes[1] = ata_dev_try_classify(ap, 1, &err);
+ classes[1] = ata_dev_try_classify(&ap->device[1],
+ devmask & (1 << 1), &err);
out:
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
@@ -3535,7 +3538,7 @@ int sata_std_hardreset(struct ata_port *
ap->ops->dev_select(ap, 0); /* probably unnecessary */
- *class = ata_dev_try_classify(ap, 0, NULL);
+ *class = ata_dev_try_classify(ap->device, 1, NULL);
DPRINTK("EXIT, class=%u\n", *class);
return 0;
Index: work/drivers/ata/pata_scc.c
===================================================================
--- work.orig/drivers/ata/pata_scc.c
+++ work/drivers/ata/pata_scc.c
@@ -636,9 +636,11 @@ static int scc_std_softreset (struct ata
}
/* 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->device[0],
+ devmask & (1 << 0), &err);
if (slave_possible && err != 0x81)
- classes[1] = ata_dev_try_classify(ap, 1, &err);
+ classes[1] = ata_dev_try_classify(&ap->device[1],
+ devmask & (1 << 1), &err);
out:
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
Index: work/drivers/ata/sata_mv.c
===================================================================
--- work.orig/drivers/ata/sata_mv.c
+++ work/drivers/ata/sata_mv.c
@@ -2233,7 +2233,7 @@ comreset_retry:
*/
/* finally, read device signature from TF registers */
- *class = ata_dev_try_classify(ap, 0, NULL);
+ *class = ata_dev_try_classify(ap->device, 1, NULL);
writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
Index: work/include/linux/libata.h
===================================================================
--- work.orig/include/linux/libata.h
+++ work/include/linux/libata.h
@@ -764,7 +764,8 @@ extern void ata_port_queue_task(struct a
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
unsigned long interval_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
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/2 #upstream] libata: assume ATA_DEV_ATA on diagnostic failure
2007-08-08 5:37 [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Tejun Heo
@ 2007-08-08 5:40 ` Tejun Heo
2007-08-08 8:33 ` Alan Cox
2007-08-31 9:18 ` [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
1 sibling, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2007-08-08 5:40 UTC (permalink / raw)
To: Jeff Garzik, linux-ide, Alan Cox, amsden_linux
Certain device which reports diagnostic failure also reports invalid
device signature. Assume ATA_DEV_ATA on diagnostic failure if reset
indicates device presence.
This is fix for bugzilla bug 8784.
http://bugzilla.kernel.org/show_bug.cgi?id=8784
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Edward Amsden <amsden_linux@earthlink.net>
---
drivers/ata/libata-core.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -746,10 +746,20 @@ unsigned int ata_dev_try_classify(struct
/* determine if device is ATA or ATAPI */
class = ata_dev_classify(&tf);
- if (class == ATA_DEV_UNKNOWN)
- return ATA_DEV_NONE;
- if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
- return ATA_DEV_NONE;
+ if (class == ATA_DEV_UNKNOWN) {
+ /* If the device failed diagnostic, it's likely to
+ * have reported incorrect device signature too.
+ * Assume ATA device if the device seems present but
+ * device signature is invalid with diagnostic
+ * failure.
+ */
+ if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
+ class = ATA_DEV_ATA;
+ else
+ class = ATA_DEV_NONE;
+ } else if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
+ class = ATA_DEV_NONE;
+
return class;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments
2007-08-08 5:37 [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Tejun Heo
2007-08-08 5:40 ` [PATCH 2/2 #upstream] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
@ 2007-08-31 9:18 ` Jeff Garzik
2007-09-02 14:23 ` [PATCH 1/2 #upstream,REGENERATED] " Tejun Heo
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-08-31 9:18 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Alan Cox, amsden_linux
Tejun Heo wrote:
> 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>
> ---
> drivers/ata/libata-core.c | 31 +++++++++++++++++--------------
> drivers/ata/pata_scc.c | 6 ++++--
> drivers/ata/sata_mv.c | 2 +-
> include/linux/libata.h | 3 ++-
> 4 files changed, 24 insertions(+), 18 deletions(-)
ACK patches 1-2
request rediff+resend
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2 #upstream,REGENERATED] libata: udpate ata_dev_try_classify() arguments
2007-08-31 9:18 ` [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
@ 2007-09-02 14:23 ` Tejun Heo
2007-09-02 14:24 ` [PATCH 2/2 #upstream,REGENERATED] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
2007-09-20 21:32 ` [PATCH 1/2 #upstream,REGENERATED] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Tejun Heo @ 2007-09-02 14:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Alan Cox, amsden_linux
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>
---
drivers/ata/libata-core.c | 30 ++++++++++++++++--------------
drivers/ata/pata_scc.c | 6 ++++--
drivers/ata/sata_mv.c | 2 +-
include/linux/libata.h | 3 ++-
4 files changed, 23 insertions(+), 18 deletions(-)
Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -701,8 +701,8 @@ unsigned int ata_dev_classify(const stru
/**
* ata_dev_try_classify - Parse returned ATA device signature
- * @ap: ATA channel to examine
- * @device: Device to examine (starting at zero)
+ * @dev: ATA device to classify (starting at zero)
+ * @present: device seems present
* @r_err: Value of error register on completion
*
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
@@ -720,15 +720,15 @@ unsigned int ata_dev_classify(const stru
* RETURNS:
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
*/
-
-unsigned int
-ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
+unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
+ u8 *r_err)
{
+ struct ata_port *ap = dev->link->ap;
struct ata_taskfile tf;
unsigned int class;
u8 err;
- ap->ops->dev_select(ap, device);
+ ap->ops->dev_select(ap, dev->devno);
memset(&tf, 0, sizeof(tf));
@@ -738,12 +738,12 @@ ata_dev_try_classify(struct ata_port *ap
*r_err = err;
/* 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_ */
- ap->link.device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC;
+ dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
else if (err == 1)
/* do nothing */ ;
- else if ((device == 0) && (err == 0x81))
+ else if ((dev->devno == 0) && (err == 0x81))
/* do nothing */ ;
else
return ATA_DEV_NONE;
@@ -3212,9 +3212,9 @@ void ata_bus_reset(struct ata_port *ap)
/*
* 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))
- 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? */
if (device[1].class != ATA_DEV_NONE)
@@ -3453,9 +3453,11 @@ int ata_std_softreset(struct ata_link *l
}
/* 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)
- classes[1] = ata_dev_try_classify(ap, 1, &err);
+ classes[1] = ata_dev_try_classify(&link->device[1],
+ devmask & (1 << 1), &err);
out:
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
@@ -3574,7 +3576,7 @@ int sata_std_hardreset(struct ata_link *
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);
return 0;
Index: work/drivers/ata/pata_scc.c
===================================================================
--- work.orig/drivers/ata/pata_scc.c
+++ work/drivers/ata/pata_scc.c
@@ -636,9 +636,11 @@ static int scc_std_softreset (struct ata
}
/* 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)
- classes[1] = ata_dev_try_classify(ap, 1, &err);
+ classes[1] = ata_dev_try_classify(&ap->link.device[1],
+ devmask & (1 << 1), &err);
out:
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
Index: work/drivers/ata/sata_mv.c
===================================================================
--- work.orig/drivers/ata/sata_mv.c
+++ work/drivers/ata/sata_mv.c
@@ -2224,7 +2224,7 @@ comreset_retry:
*/
/* 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);
Index: work/include/linux/libata.h
===================================================================
--- work.orig/include/linux/libata.h
+++ work/include/linux/libata.h
@@ -781,7 +781,8 @@ extern void ata_port_queue_task(struct a
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
unsigned long interval_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
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/2 #upstream,REGENERATED] libata: assume ATA_DEV_ATA on diagnostic failure
2007-09-02 14:23 ` [PATCH 1/2 #upstream,REGENERATED] " Tejun Heo
@ 2007-09-02 14:24 ` Tejun Heo
2007-09-20 21:32 ` [PATCH 1/2 #upstream,REGENERATED] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
1 sibling, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2007-09-02 14:24 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Alan Cox, amsden_linux
Certain device which reports diagnostic failure also reports invalid
device signature. Assume ATA_DEV_ATA on diagnostic failure if reset
indicates device presence.
This is fix for bugzilla bug 8784.
http://bugzilla.kernel.org/show_bug.cgi?id=8784
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Edward Amsden <amsden_linux@earthlink.net>
---
drivers/ata/libata-core.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -751,10 +751,20 @@ unsigned int ata_dev_try_classify(struct
/* determine if device is ATA or ATAPI */
class = ata_dev_classify(&tf);
- if (class == ATA_DEV_UNKNOWN)
- return ATA_DEV_NONE;
- if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
- return ATA_DEV_NONE;
+ if (class == ATA_DEV_UNKNOWN) {
+ /* If the device failed diagnostic, it's likely to
+ * have reported incorrect device signature too.
+ * Assume ATA device if the device seems present but
+ * device signature is invalid with diagnostic
+ * failure.
+ */
+ if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
+ class = ATA_DEV_ATA;
+ else
+ class = ATA_DEV_NONE;
+ } else if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
+ class = ATA_DEV_NONE;
+
return class;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2 #upstream,REGENERATED] libata: udpate ata_dev_try_classify() arguments
2007-09-02 14:23 ` [PATCH 1/2 #upstream,REGENERATED] " Tejun Heo
2007-09-02 14:24 ` [PATCH 2/2 #upstream,REGENERATED] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
@ 2007-09-20 21:32 ` Jeff Garzik
1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-09-20 21:32 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Alan Cox, amsden_linux
Tejun Heo wrote:
> 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>
> ---
> drivers/ata/libata-core.c | 30 ++++++++++++++++--------------
> drivers/ata/pata_scc.c | 6 ++++--
> drivers/ata/sata_mv.c | 2 +-
> include/linux/libata.h | 3 ++-
> 4 files changed, 23 insertions(+), 18 deletions(-)
applied 1-2
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-09-20 21:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 5:37 [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Tejun Heo
2007-08-08 5:40 ` [PATCH 2/2 #upstream] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
2007-08-08 8:33 ` Alan Cox
2007-08-31 9:18 ` [PATCH 1/2 #upstream] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
2007-09-02 14:23 ` [PATCH 1/2 #upstream,REGENERATED] " Tejun Heo
2007-09-02 14:24 ` [PATCH 2/2 #upstream,REGENERATED] libata: assume ATA_DEV_ATA on diagnostic failure Tejun Heo
2007-09-20 21:32 ` [PATCH 1/2 #upstream,REGENERATED] libata: udpate ata_dev_try_classify() arguments Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).