diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:32 -0400 |
commit | 4c3032d8a4d6c97bd6e02bcab524ef2428d89561 (patch) | |
tree | 4528851a9b04282f602cebb6b2ab4bc677b63259 /drivers/ide/ide-io.c | |
parent | 387750c3bf49c22f6189436032145e2131985076 (diff) |
ide: add struct ide_io_ports (take 3)
* Add struct ide_io_ports and use it instead of `unsigned long io_ports[]`
in ide_hwif_t.
* Rename io_ports[] in hw_regs_t to io_ports_array[].
* Use un-named union for 'unsigned long io_ports_array[]' and 'struct
ide_io_ports io_ports' in hw_regs_t.
* Remove IDE_*_OFFSET defines.
v2:
* scc_pata.c build fix from Stephen Rothwell.
v3:
* Fix ctl_adrr typo in Sparc-specific part of ns87415.c.
(Noticed by Andrew Morton)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 0fe89a599275..3a2d8930d17f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -298,48 +298,43 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq) | |||
298 | void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 298 | void ide_tf_read(ide_drive_t *drive, ide_task_t *task) |
299 | { | 299 | { |
300 | ide_hwif_t *hwif = drive->hwif; | 300 | ide_hwif_t *hwif = drive->hwif; |
301 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
301 | struct ide_taskfile *tf = &task->tf; | 302 | struct ide_taskfile *tf = &task->tf; |
302 | 303 | ||
303 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 304 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { |
304 | u16 data = hwif->INW(hwif->io_ports[IDE_DATA_OFFSET]); | 305 | u16 data = hwif->INW(io_ports->data_addr); |
305 | 306 | ||
306 | tf->data = data & 0xff; | 307 | tf->data = data & 0xff; |
307 | tf->hob_data = (data >> 8) & 0xff; | 308 | tf->hob_data = (data >> 8) & 0xff; |
308 | } | 309 | } |
309 | 310 | ||
310 | /* be sure we're looking at the low order bits */ | 311 | /* be sure we're looking at the low order bits */ |
311 | hwif->OUTB(drive->ctl & ~0x80, hwif->io_ports[IDE_CONTROL_OFFSET]); | 312 | hwif->OUTB(drive->ctl & ~0x80, io_ports->ctl_addr); |
312 | 313 | ||
313 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 314 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
314 | tf->nsect = hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]); | 315 | tf->nsect = hwif->INB(io_ports->nsect_addr); |
315 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 316 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
316 | tf->lbal = hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]); | 317 | tf->lbal = hwif->INB(io_ports->lbal_addr); |
317 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 318 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) |
318 | tf->lbam = hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]); | 319 | tf->lbam = hwif->INB(io_ports->lbam_addr); |
319 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 320 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) |
320 | tf->lbah = hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]); | 321 | tf->lbah = hwif->INB(io_ports->lbah_addr); |
321 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 322 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) |
322 | tf->device = hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]); | 323 | tf->device = hwif->INB(io_ports->device_addr); |
323 | 324 | ||
324 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 325 | if (task->tf_flags & IDE_TFLAG_LBA48) { |
325 | hwif->OUTB(drive->ctl | 0x80, | 326 | hwif->OUTB(drive->ctl | 0x80, io_ports->ctl_addr); |
326 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
327 | 327 | ||
328 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 328 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
329 | tf->hob_feature = | 329 | tf->hob_feature = hwif->INB(io_ports->feature_addr); |
330 | hwif->INB(hwif->io_ports[IDE_FEATURE_OFFSET]); | ||
331 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 330 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
332 | tf->hob_nsect = | 331 | tf->hob_nsect = hwif->INB(io_ports->nsect_addr); |
333 | hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]); | ||
334 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 332 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
335 | tf->hob_lbal = | 333 | tf->hob_lbal = hwif->INB(io_ports->lbal_addr); |
336 | hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]); | ||
337 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 334 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
338 | tf->hob_lbam = | 335 | tf->hob_lbam = hwif->INB(io_ports->lbam_addr); |
339 | hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]); | ||
340 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 336 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
341 | tf->hob_lbah = | 337 | tf->hob_lbah = hwif->INB(io_ports->lbah_addr); |
342 | hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]); | ||
343 | } | 338 | } |
344 | } | 339 | } |
345 | 340 | ||
@@ -454,7 +449,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
454 | if (err == ABRT_ERR) { | 449 | if (err == ABRT_ERR) { |
455 | if (drive->select.b.lba && | 450 | if (drive->select.b.lba && |
456 | /* some newer drives don't support WIN_SPECIFY */ | 451 | /* some newer drives don't support WIN_SPECIFY */ |
457 | hwif->INB(hwif->io_ports[IDE_COMMAND_OFFSET]) == | 452 | hwif->INB(hwif->io_ports.command_addr) == |
458 | WIN_SPECIFY) | 453 | WIN_SPECIFY) |
459 | return ide_stopped; | 454 | return ide_stopped; |
460 | } else if ((err & BAD_CRC) == BAD_CRC) { | 455 | } else if ((err & BAD_CRC) == BAD_CRC) { |
@@ -507,8 +502,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
507 | 502 | ||
508 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 503 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) |
509 | /* force an abort */ | 504 | /* force an abort */ |
510 | hwif->OUTB(WIN_IDLEIMMEDIATE, | 505 | hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr); |
511 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
512 | 506 | ||
513 | if (rq->errors >= ERROR_MAX) { | 507 | if (rq->errors >= ERROR_MAX) { |
514 | ide_kill_rq(drive, rq); | 508 | ide_kill_rq(drive, rq); |
@@ -1421,7 +1415,7 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup) | |||
1421 | */ | 1415 | */ |
1422 | do { | 1416 | do { |
1423 | if (hwif->irq == irq) { | 1417 | if (hwif->irq == irq) { |
1424 | stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | 1418 | stat = hwif->INB(hwif->io_ports.status_addr); |
1425 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { | 1419 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { |
1426 | /* Try to not flood the console with msgs */ | 1420 | /* Try to not flood the console with msgs */ |
1427 | static unsigned long last_msgtime, count; | 1421 | static unsigned long last_msgtime, count; |
@@ -1511,7 +1505,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
1511 | * Whack the status register, just in case | 1505 | * Whack the status register, just in case |
1512 | * we have a leftover pending IRQ. | 1506 | * we have a leftover pending IRQ. |
1513 | */ | 1507 | */ |
1514 | (void) hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | 1508 | (void) hwif->INB(hwif->io_ports.status_addr); |
1515 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | 1509 | #endif /* CONFIG_BLK_DEV_IDEPCI */ |
1516 | } | 1510 | } |
1517 | spin_unlock_irqrestore(&ide_lock, flags); | 1511 | spin_unlock_irqrestore(&ide_lock, flags); |