Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61891
b: refs/heads/master
c: 2229833
h: refs/heads/master
i:
  61889: 7f55963
  61887: cd02899
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 19, 2007
1 parent ccbc3ab commit f87be77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 342cdb6d4739cee430efc3eafcacd1605db66036
refs/heads/master: 2229833c1365346b64357a9263fa724f74f5e376
7 changes: 1 addition & 6 deletions trunk/drivers/ide/ide-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,27 +267,23 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
{
int pio_mode;
int cycle_time = 0;
int use_iordy = 0;
struct hd_driveid* id = drive->id;
int overridden = 0;

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) {
printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
use_iordy = (pio_mode > 2);
} else {
pio_mode = id->tPIO;
if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */
pio_mode = 2;
overridden = 1;
}
if (id->field_valid & 2) { /* drive implements ATA2? */
if (id->capability & 8) { /* drive supports use_iordy? */
use_iordy = 1;
if (id->capability & 8) { /* IORDY supported? */
cycle_time = id->eide_pio_iordy;
if (id->eide_pio_modes & 7) {
overridden = 0;
Expand Down Expand Up @@ -325,7 +321,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
if (d) {
d->pio_mode = pio_mode;
d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time;
d->use_iordy = use_iordy;
}
return pio_mode;
}
Expand Down
10 changes: 7 additions & 3 deletions trunk/drivers/ide/pci/sl82c105.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
* Convert a PIO mode and cycle time to the required on/off times
* for the interface. This has protection against runaway timings.
*/
static unsigned int get_pio_timings(ide_pio_data_t *p)
static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p)
{
unsigned int cmd_on, cmd_off;
u8 iordy = 0;

cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30;
cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30;
Expand All @@ -65,7 +66,10 @@ static unsigned int get_pio_timings(ide_pio_data_t *p)
if (cmd_off == 0)
cmd_off = 1;

return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00);
if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id))
iordy = 0x40;

return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy;
}

/*
Expand All @@ -82,7 +86,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)

pio = ide_get_best_pio_mode(drive, pio, 5, &p);

drv_ctrl = get_pio_timings(&p);
drv_ctrl = get_pio_timings(drive, &p);

/*
* Store the PIO timings so that we can restore them
Expand Down
6 changes: 5 additions & 1 deletion trunk/include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,11 @@ extern void ide_toggle_bounce(ide_drive_t *drive, int on);
extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
int ide_use_fast_pio(ide_drive_t *);

static inline int ide_dev_has_iordy(struct hd_driveid *id)
{
return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
}

u8 ide_dump_status(ide_drive_t *, const char *, u8);

typedef struct ide_pio_timings_s {
Expand All @@ -1374,7 +1379,6 @@ typedef struct ide_pio_timings_s {

typedef struct ide_pio_data_s {
u8 pio_mode;
u8 use_iordy;
unsigned int cycle_time;
} ide_pio_data_t;

Expand Down

0 comments on commit f87be77

Please sign in to comment.