diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:54 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:54 -0400 |
commit | 88a72109b2256bf2974f324a8f890b4a06faf7e9 (patch) | |
tree | 97637da113fe72a95f275c31226742e4b1a548fb /drivers/ide/ide-atapi.c | |
parent | 1f2efb82af3cfbac995f590a8f8d3beb6fa5678b (diff) |
ide: add ide_read_ireason() helper
Add ide_read_ireason() helper and use instead of ->INB for reading
ATAPI Interrupt Reason register.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r-- | drivers/ide/ide-atapi.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 6554c4225a05..bfab5c4afc6a 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -183,16 +183,27 @@ cmd_finished: | |||
183 | } | 183 | } |
184 | EXPORT_SYMBOL_GPL(ide_pc_intr); | 184 | EXPORT_SYMBOL_GPL(ide_pc_intr); |
185 | 185 | ||
186 | static u8 ide_read_ireason(ide_drive_t *drive) | ||
187 | { | ||
188 | ide_task_t task; | ||
189 | |||
190 | memset(&task, 0, sizeof(task)); | ||
191 | task.tf_flags = IDE_TFLAG_IN_NSECT; | ||
192 | |||
193 | drive->hwif->tf_read(drive, &task); | ||
194 | |||
195 | return task.tf.nsect & 3; | ||
196 | } | ||
197 | |||
186 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) | 198 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) |
187 | { | 199 | { |
188 | ide_hwif_t *hwif = drive->hwif; | ||
189 | int retries = 100; | 200 | int retries = 100; |
190 | 201 | ||
191 | while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { | 202 | while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { |
192 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " | 203 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " |
193 | "a packet command, retrying\n", drive->name); | 204 | "a packet command, retrying\n", drive->name); |
194 | udelay(100); | 205 | udelay(100); |
195 | ireason = hwif->INB(hwif->io_ports.nsect_addr); | 206 | ireason = ide_read_ireason(drive); |
196 | if (retries == 0) { | 207 | if (retries == 0) { |
197 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " | 208 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " |
198 | "a packet command, ignoring\n", | 209 | "a packet command, ignoring\n", |
@@ -219,7 +230,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
219 | return startstop; | 230 | return startstop; |
220 | } | 231 | } |
221 | 232 | ||
222 | ireason = hwif->INB(hwif->io_ports.nsect_addr); | 233 | ireason = ide_read_ireason(drive); |
223 | if (drive->media == ide_tape && !drive->scsi) | 234 | if (drive->media == ide_tape && !drive->scsi) |
224 | ireason = ide_wait_ireason(drive, ireason); | 235 | ireason = ide_wait_ireason(drive, ireason); |
225 | 236 | ||