aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 715379605a7b..31e5afadb7e9 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -301,39 +301,45 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task)
301 struct ide_taskfile *tf = &task->tf; 301 struct ide_taskfile *tf = &task->tf;
302 302
303 if (task->tf_flags & IDE_TFLAG_IN_DATA) { 303 if (task->tf_flags & IDE_TFLAG_IN_DATA) {
304 u16 data = hwif->INW(IDE_DATA_REG); 304 u16 data = hwif->INW(hwif->io_ports[IDE_DATA_OFFSET]);
305 305
306 tf->data = data & 0xff; 306 tf->data = data & 0xff;
307 tf->hob_data = (data >> 8) & 0xff; 307 tf->hob_data = (data >> 8) & 0xff;
308 } 308 }
309 309
310 /* be sure we're looking at the low order bits */ 310 /* be sure we're looking at the low order bits */
311 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); 311 hwif->OUTB(drive->ctl & ~0x80, hwif->io_ports[IDE_CONTROL_OFFSET]);
312 312
313 if (task->tf_flags & IDE_TFLAG_IN_NSECT) 313 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
314 tf->nsect = hwif->INB(IDE_NSECTOR_REG); 314 tf->nsect = hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]);
315 if (task->tf_flags & IDE_TFLAG_IN_LBAL) 315 if (task->tf_flags & IDE_TFLAG_IN_LBAL)
316 tf->lbal = hwif->INB(IDE_SECTOR_REG); 316 tf->lbal = hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]);
317 if (task->tf_flags & IDE_TFLAG_IN_LBAM) 317 if (task->tf_flags & IDE_TFLAG_IN_LBAM)
318 tf->lbam = hwif->INB(IDE_LCYL_REG); 318 tf->lbam = hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]);
319 if (task->tf_flags & IDE_TFLAG_IN_LBAH) 319 if (task->tf_flags & IDE_TFLAG_IN_LBAH)
320 tf->lbah = hwif->INB(IDE_HCYL_REG); 320 tf->lbah = hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]);
321 if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 321 if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
322 tf->device = hwif->INB(IDE_SELECT_REG); 322 tf->device = hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]);
323 323
324 if (task->tf_flags & IDE_TFLAG_LBA48) { 324 if (task->tf_flags & IDE_TFLAG_LBA48) {
325 hwif->OUTB(drive->ctl | 0x80, IDE_CONTROL_REG); 325 hwif->OUTB(drive->ctl | 0x80,
326 hwif->io_ports[IDE_CONTROL_OFFSET]);
326 327
327 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 328 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
328 tf->hob_feature = hwif->INB(IDE_FEATURE_REG); 329 tf->hob_feature =
330 hwif->INB(hwif->io_ports[IDE_FEATURE_OFFSET]);
329 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 331 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
330 tf->hob_nsect = hwif->INB(IDE_NSECTOR_REG); 332 tf->hob_nsect =
333 hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]);
331 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 334 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
332 tf->hob_lbal = hwif->INB(IDE_SECTOR_REG); 335 tf->hob_lbal =
336 hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]);
333 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 337 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
334 tf->hob_lbam = hwif->INB(IDE_LCYL_REG); 338 tf->hob_lbam =
339 hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]);
335 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 340 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
336 tf->hob_lbah = hwif->INB(IDE_HCYL_REG); 341 tf->hob_lbah =
342 hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]);
337 } 343 }
338} 344}
339 345
@@ -448,7 +454,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
448 if (err == ABRT_ERR) { 454 if (err == ABRT_ERR) {
449 if (drive->select.b.lba && 455 if (drive->select.b.lba &&
450 /* some newer drives don't support WIN_SPECIFY */ 456 /* some newer drives don't support WIN_SPECIFY */
451 hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY) 457 hwif->INB(hwif->io_ports[IDE_COMMAND_OFFSET]) ==
458 WIN_SPECIFY)
452 return ide_stopped; 459 return ide_stopped;
453 } else if ((err & BAD_CRC) == BAD_CRC) { 460 } else if ((err & BAD_CRC) == BAD_CRC) {
454 /* UDMA crc error, just retry the operation */ 461 /* UDMA crc error, just retry the operation */
@@ -500,7 +507,8 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
500 507
501 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) 508 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
502 /* force an abort */ 509 /* force an abort */
503 hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); 510 hwif->OUTB(WIN_IDLEIMMEDIATE,
511 hwif->io_ports[IDE_COMMAND_OFFSET]);
504 512
505 if (rq->errors >= ERROR_MAX) { 513 if (rq->errors >= ERROR_MAX) {
506 ide_kill_rq(drive, rq); 514 ide_kill_rq(drive, rq);