* [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting
@ 2007-02-08 13:32 Sergei Shtylyov
2007-02-08 13:57 ` [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting (take 2) Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2007-02-08 13:32 UTC (permalink / raw)
To: bzolnier; +Cc: linux-ide
The function ide_get_best_pio_mode() fails to return the correct IORDY setting
for the explicitly specified modes -- fix this along with the heading comment,
and also remove the long commented out code.
Also, while at it, correct the misliading comment about the PIO cycle time in
<linux/ide.h> -- it actually consists of only the active and recovery periods,
with only some chips also including the address setup time into equation...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
drivers/ide/ide-lib.c | 14 ++++----------
include/linux/ide.h | 3 ++-
2 files changed, 6 insertions(+), 11 deletions(-)
Index: linux-2.6/drivers/ide/ide-lib.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-lib.c
+++ linux-2.6/drivers/ide/ide-lib.c
@@ -333,13 +333,13 @@ static int ide_scan_pio_blacklist (char
* @driver: drive to consider
* @mode_wanted: preferred mode
* @max_mode: highest allowed
- * @d: pio data
+ * @d: PIO data
*
* This routine returns the recommended PIO settings for a given drive,
* based on the drive->id information and the ide_pio_blacklist[].
- * This is used by most chipset support modules when "auto-tuning".
*
- * Drive PIO mode auto selection
+ * Drive PIO mode is auto-selected if 255 is passed as mode_wanted.
+ * This is used by most chipset support modules when "auto-tuning".
*/
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
@@ -353,6 +353,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *d
if (mode_wanted != 255) {
pio_mode = mode_wanted;
+ use_iordy = (pio_mode > 2);
} else if (!drive->id) {
pio_mode = 0;
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
@@ -383,19 +384,12 @@ u8 ide_get_best_pio_mode (ide_drive_t *d
}
}
-#if 0
- if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
-#endif
-
/*
* Conservative "downgrade" for all pre-ATA2 drives
*/
if (pio_mode && pio_mode < 4) {
pio_mode--;
overridden = 1;
-#if 0
- use_iordy = (pio_mode > 2);
-#endif
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
cycle_time = 0; /* use standard timing */
}
Index: linux-2.6/include/linux/ide.h
===================================================================
--- linux-2.6.orig/include/linux/ide.h
+++ linux-2.6/include/linux/ide.h
@@ -1333,7 +1333,8 @@ u8 ide_dump_status(ide_drive_t *, const
typedef struct ide_pio_timings_s {
int setup_time; /* Address setup (ns) minimum */
int active_time; /* Active pulse (ns) minimum */
- int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
+ int cycle_time; /* Cycle time (ns) minimum = */
+ /* active + recovery (+ setup for some chips) */
} ide_pio_timings_t;
typedef struct ide_pio_data_s {
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting (take 2)
2007-02-08 13:32 [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting Sergei Shtylyov
@ 2007-02-08 13:57 ` Sergei Shtylyov
2007-02-10 0:12 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2007-02-08 13:57 UTC (permalink / raw)
To: bzolnier; +Cc: linux-ide
The function ide_get_best_pio_mode() fails to return the correct IORDY setting
for the explicitly specified modes -- fix this along with the heading comment,
and also remove the long commented out code.
Also, while at it, correct the misliading comment about the PIO cycle time in
<linux/ide.h> -- it actually consists of only the active and recovery periods,
with only some chips also including the address setup time into equation...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
drivers/ide/ide-lib.c | 18 ++++++------------
include/linux/ide.h | 3 ++-
2 files changed, 8 insertions(+), 13 deletions(-)
Index: linux-2.6/drivers/ide/ide-lib.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-lib.c
+++ linux-2.6/drivers/ide/ide-lib.c
@@ -330,16 +330,16 @@ static int ide_scan_pio_blacklist (char
/**
* ide_get_best_pio_mode - get PIO mode from drive
- * @driver: drive to consider
+ * @drive: drive to consider
* @mode_wanted: preferred mode
- * @max_mode: highest allowed
- * @d: pio data
+ * @max_mode: highest allowed mode
+ * @d: PIO data
*
* This routine returns the recommended PIO settings for a given drive,
* based on the drive->id information and the ide_pio_blacklist[].
- * This is used by most chipset support modules when "auto-tuning".
*
- * Drive PIO mode auto selection
+ * Drive PIO mode is auto-selected if 255 is passed as mode_wanted.
+ * This is used by most chipset support modules when "auto-tuning".
*/
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
@@ -353,6 +353,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *d
if (mode_wanted != 255) {
pio_mode = mode_wanted;
+ use_iordy = (pio_mode > 2);
} else if (!drive->id) {
pio_mode = 0;
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
@@ -383,19 +384,12 @@ u8 ide_get_best_pio_mode (ide_drive_t *d
}
}
-#if 0
- if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
-#endif
-
/*
* Conservative "downgrade" for all pre-ATA2 drives
*/
if (pio_mode && pio_mode < 4) {
pio_mode--;
overridden = 1;
-#if 0
- use_iordy = (pio_mode > 2);
-#endif
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
cycle_time = 0; /* use standard timing */
}
Index: linux-2.6/include/linux/ide.h
===================================================================
--- linux-2.6.orig/include/linux/ide.h
+++ linux-2.6/include/linux/ide.h
@@ -1333,7 +1333,8 @@ u8 ide_dump_status(ide_drive_t *, const
typedef struct ide_pio_timings_s {
int setup_time; /* Address setup (ns) minimum */
int active_time; /* Active pulse (ns) minimum */
- int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
+ int cycle_time; /* Cycle time (ns) minimum = */
+ /* active + recovery (+ setup for some chips) */
} ide_pio_timings_t;
typedef struct ide_pio_data_s {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting (take 2)
2007-02-08 13:57 ` [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting (take 2) Sergei Shtylyov
@ 2007-02-10 0:12 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-02-10 0:12 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide
On Thursday 08 February 2007 14:57, Sergei Shtylyov wrote:
> The function ide_get_best_pio_mode() fails to return the correct IORDY setting
> for the explicitly specified modes -- fix this along with the heading comment,
> and also remove the long commented out code.
>
> Also, while at it, correct the misliading comment about the PIO cycle time in
> <linux/ide.h> -- it actually consists of only the active and recovery periods,
> with only some chips also including the address setup time into equation...
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-10 0:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-08 13:32 [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting Sergei Shtylyov
2007-02-08 13:57 ` [PATCH] (pata-2.6 fix queue) ide_get_best_pio_mode() returns incorrect IORDY setting (take 2) Sergei Shtylyov
2007-02-10 0:12 ` 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).