diff options
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r-- | drivers/ide/ide-lib.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 97fefabea8b8..3066d7e75c73 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -90,29 +90,31 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed) | |||
90 | 90 | ||
91 | u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) | 91 | u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) |
92 | { | 92 | { |
93 | int pio_mode; | 93 | u16 *id = drive->id; |
94 | struct hd_driveid* id = drive->id; | 94 | int pio_mode = -1, overridden = 0; |
95 | int overridden = 0; | ||
96 | 95 | ||
97 | if (mode_wanted != 255) | 96 | if (mode_wanted != 255) |
98 | return min_t(u8, mode_wanted, max_mode); | 97 | return min_t(u8, mode_wanted, max_mode); |
99 | 98 | ||
100 | if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && | 99 | if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0) |
101 | (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { | 100 | pio_mode = ide_scan_pio_blacklist((char *)&id[ATA_ID_PROD]); |
101 | |||
102 | if (pio_mode != -1) { | ||
102 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); | 103 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); |
103 | } else { | 104 | } else { |
104 | pio_mode = id->tPIO; | 105 | pio_mode = drive->driveid->tPIO; |
105 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ | 106 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ |
106 | pio_mode = 2; | 107 | pio_mode = 2; |
107 | overridden = 1; | 108 | overridden = 1; |
108 | } | 109 | } |
109 | if (id->field_valid & 2) { /* drive implements ATA2? */ | 110 | |
110 | if (id->capability & 8) { /* IORDY supported? */ | 111 | if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ |
111 | if (id->eide_pio_modes & 7) { | 112 | if (drive->driveid->capability & 8) { /* IORDY sup? */ |
113 | if (id[ATA_ID_PIO_MODES] & 7) { | ||
112 | overridden = 0; | 114 | overridden = 0; |
113 | if (id->eide_pio_modes & 4) | 115 | if (id[ATA_ID_PIO_MODES] & 4) |
114 | pio_mode = 5; | 116 | pio_mode = 5; |
115 | else if (id->eide_pio_modes & 2) | 117 | else if (id[ATA_ID_PIO_MODES] & 2) |
116 | pio_mode = 4; | 118 | pio_mode = 4; |
117 | else | 119 | else |
118 | pio_mode = 3; | 120 | pio_mode = 3; |