aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:54 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:54 -0400
commit1823649b5abb77ffe638178bc5253249d3ecd17d (patch)
tree154d876b89cf010568d18105913c7fbca8d7cba9 /drivers
parent88a72109b2256bf2974f324a8f890b4a06faf7e9 (diff)
ide: add ide_read_bcount_and_ireason() helper
Add ide_read_bcount_and_ireason() helper and use it instead of ->INB in {cdrom_newpc,ide_pc}_intr(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-atapi.c6
-rw-r--r--drivers/ide/ide-cd.c12
-rw-r--r--drivers/ide/ide-iops.c15
3 files changed, 21 insertions, 12 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index bfab5c4afc6a..f17a00ccbe96 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -107,11 +107,9 @@ cmd_finished:
107 ide_dma_off(drive); 107 ide_dma_off(drive);
108 return ide_do_reset(drive); 108 return ide_do_reset(drive);
109 } 109 }
110 /* Get the number of bytes to transfer on this interrupt. */
111 bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
112 hwif->INB(hwif->io_ports.lbam_addr);
113 110
114 ireason = hwif->INB(hwif->io_ports.nsect_addr); 111 /* Get the number of bytes to transfer on this interrupt. */
112 ide_read_bcount_and_ireason(drive, &bcount, &ireason);
115 113
116 if (ireason & CD) { 114 if (ireason & CD) {
117 printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__); 115 printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 82879a1a89e5..563a380d0e7a 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -895,10 +895,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
895 struct request *rq = HWGROUP(drive)->rq; 895 struct request *rq = HWGROUP(drive)->rq;
896 xfer_func_t *xferfunc; 896 xfer_func_t *xferfunc;
897 ide_expiry_t *expiry = NULL; 897 ide_expiry_t *expiry = NULL;
898 int dma_error = 0, dma, stat, ireason, len, thislen, uptodate = 0; 898 int dma_error = 0, dma, stat, thislen, uptodate = 0;
899 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0; 899 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
900 unsigned int timeout; 900 unsigned int timeout;
901 u8 lowcyl, highcyl; 901 u16 len;
902 u8 ireason;
902 903
903 /* check for errors */ 904 /* check for errors */
904 dma = info->dma; 905 dma = info->dma;
@@ -926,12 +927,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
926 goto end_request; 927 goto end_request;
927 } 928 }
928 929
929 /* ok we fall to pio :/ */ 930 ide_read_bcount_and_ireason(drive, &len, &ireason);
930 ireason = hwif->INB(hwif->io_ports.nsect_addr) & 0x3;
931 lowcyl = hwif->INB(hwif->io_ports.lbam_addr);
932 highcyl = hwif->INB(hwif->io_ports.lbah_addr);
933
934 len = lowcyl + (256 * highcyl);
935 931
936 thislen = blk_fs_request(rq) ? len : rq->data_len; 932 thislen = blk_fs_request(rq) ? len : rq->data_len;
937 if (thislen > len) 933 if (thislen > len)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 113db8744736..cb11c7861a50 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -405,6 +405,21 @@ u8 ide_read_error(ide_drive_t *drive)
405} 405}
406EXPORT_SYMBOL_GPL(ide_read_error); 406EXPORT_SYMBOL_GPL(ide_read_error);
407 407
408void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason)
409{
410 ide_task_t task;
411
412 memset(&task, 0, sizeof(task));
413 task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM |
414 IDE_TFLAG_IN_NSECT;
415
416 drive->hwif->tf_read(drive, &task);
417
418 *bcount = (task.tf.lbah << 8) | task.tf.lbam;
419 *ireason = task.tf.nsect & 3;
420}
421EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason);
422
408void ide_fix_driveid (struct hd_driveid *id) 423void ide_fix_driveid (struct hd_driveid *id)
409{ 424{
410#ifndef __LITTLE_ENDIAN 425#ifndef __LITTLE_ENDIAN