* [PATCH 6/15] ide: ide_find_best_pio_mode() fixes
@ 2007-06-30 19:04 Bartlomiej Zolnierkiewicz
2007-07-02 15:20 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-06-30 19:04 UTC (permalink / raw)
To: linux-ide
* Check IORDY bit for PIO modes > 2.
* Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-timing.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-timing.h
===================================================================
--- a/drivers/ide/ide-timing.h
+++ b/drivers/ide/ide-timing.h
@@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_
struct hd_driveid *id = drive->id;
short best = 0;
- if (id->field_valid & 2) { /* EIDE PIO modes */
-
+ /* EIDE PIO modes */
+ if ((id->field_valid & 2) && (id->capability & 8)) {
if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
(drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
(drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
}
-
- return (drive->id->tPIO == 2) ? XFER_PIO_2 :
- (drive->id->tPIO == 1) ? XFER_PIO_1 :
- (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
+
+ return min_t(u8, id->tPIO, 2);
}
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/15] ide: ide_find_best_pio_mode() fixes
2007-06-30 19:04 [PATCH 6/15] ide: ide_find_best_pio_mode() fixes Bartlomiej Zolnierkiewicz
@ 2007-07-02 15:20 ` Sergei Shtylyov
2007-07-02 18:05 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2007-07-02 15:20 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Hello.
Bartlomiej Zolnierkiewicz wrote:
> * Check IORDY bit for PIO modes > 2.
> * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
> severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
NAK. :-)
> Index: b/drivers/ide/ide-timing.h
> ===================================================================
> --- a/drivers/ide/ide-timing.h
> +++ b/drivers/ide/ide-timing.h
> @@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_
> struct hd_driveid *id = drive->id;
> short best = 0;
>
> - if (id->field_valid & 2) { /* EIDE PIO modes */
> -
> + /* EIDE PIO modes */
> + if ((id->field_valid & 2) && (id->capability & 8)) {
> if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
> (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
> (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
> }
> -
> - return (drive->id->tPIO == 2) ? XFER_PIO_2 :
> - (drive->id->tPIO == 1) ? XFER_PIO_1 :
> - (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
> +
> + return min_t(u8, id->tPIO, 2);
XFER_PIO_[012] != [012], and otherwise you're returning XFER_PIO_* constants.
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/15] ide: ide_find_best_pio_mode() fixes
2007-07-02 15:20 ` Sergei Shtylyov
@ 2007-07-02 18:05 ` Bartlomiej Zolnierkiewicz
2007-07-04 16:19 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-07-02 18:05 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide
On Monday 02 July 2007, Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
> > * Check IORDY bit for PIO modes > 2.
>
> > * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
> > severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> NAK. :-)
>
> > Index: b/drivers/ide/ide-timing.h
> > ===================================================================
> > --- a/drivers/ide/ide-timing.h
> > +++ b/drivers/ide/ide-timing.h
> > @@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_
> > struct hd_driveid *id = drive->id;
> > short best = 0;
> >
> > - if (id->field_valid & 2) { /* EIDE PIO modes */
> > -
> > + /* EIDE PIO modes */
> > + if ((id->field_valid & 2) && (id->capability & 8)) {
> > if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
> > (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
> > (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
> > }
> > -
> > - return (drive->id->tPIO == 2) ? XFER_PIO_2 :
> > - (drive->id->tPIO == 1) ? XFER_PIO_1 :
> > - (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
> > +
> > + return min_t(u8, id->tPIO, 2);
>
> XFER_PIO_[012] != [012], and otherwise you're returning XFER_PIO_* constants.
Oh, crap, there should be "+ XFER_PIO_0" in the return line - fixed.
Thanks for spotting this bug, revised patch included.
[PATCH] ide: ide_find_best_pio_mode() fixes (take 2)
* Check IORDY bit for PIO modes > 2.
* Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
v2:
* Fix PIO number being returned incorrectly instead of PIO mode
(Noticed by Sergei).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
drivers/ide/ide-timing.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-timing.h
===================================================================
--- a/drivers/ide/ide-timing.h
+++ b/drivers/ide/ide-timing.h
@@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_
struct hd_driveid *id = drive->id;
short best = 0;
- if (id->field_valid & 2) { /* EIDE PIO modes */
-
+ /* EIDE PIO modes */
+ if ((id->field_valid & 2) && (id->capability & 8)) {
if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
(drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
(drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
}
-
- return (drive->id->tPIO == 2) ? XFER_PIO_2 :
- (drive->id->tPIO == 1) ? XFER_PIO_1 :
- (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
+
+ return XFER_PIO_0 + min_t(u8, id->tPIO, 2);
}
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/15] ide: ide_find_best_pio_mode() fixes
2007-07-02 18:05 ` Bartlomiej Zolnierkiewicz
@ 2007-07-04 16:19 ` Sergei Shtylyov
2007-07-04 19:00 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2007-07-04 16:19 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Hello.
Bartlomiej Zolnierkiewicz wrote:
> [PATCH] ide: ide_find_best_pio_mode() fixes (take 2)
> * Check IORDY bit for PIO modes > 2.
> * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
> severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
> v2:
> * Fix PIO number being returned incorrectly instead of PIO mode
> (Noticed by Sergei).
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/15] ide: ide_find_best_pio_mode() fixes
2007-07-04 16:19 ` Sergei Shtylyov
@ 2007-07-04 19:00 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-07-04 19:00 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide
On Wednesday 04 July 2007, Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
>
> > [PATCH] ide: ide_find_best_pio_mode() fixes (take 2)
>
> > * Check IORDY bit for PIO modes > 2.
>
> > * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too
> > severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead.
>
> > v2:
> > * Fix PIO number being returned incorrectly instead of PIO mode
> > (Noticed by Sergei).
>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
added
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-04 18:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-30 19:04 [PATCH 6/15] ide: ide_find_best_pio_mode() fixes Bartlomiej Zolnierkiewicz
2007-07-02 15:20 ` Sergei Shtylyov
2007-07-02 18:05 ` Bartlomiej Zolnierkiewicz
2007-07-04 16:19 ` Sergei Shtylyov
2007-07-04 19:00 ` Bartlomiej Zolnierkiewicz
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).