diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:21:58 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:21:58 -0400 |
commit | 594c16d8dd54cd7b1c5ef1ec3ac0f6bf34301dad (patch) | |
tree | 4891a8ab4e998ba00db51e4672da64fd83663002 /drivers/ide/ide-tape.c | |
parent | f83cbc77b0d5521b4f0f591ede4870316944481a (diff) |
ide: add ide_transfer_pc() helper
* Add ide-atapi.c file for generic ATAPI support together with
CONFIG_IDE_ATAPI config option.
* Add generic ide_transfer_pc() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2a362138f973..5adc2c9ae418 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -947,64 +947,12 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
947 | * again, the callback function will be called and then we will handle the next | 947 | * again, the callback function will be called and then we will handle the next |
948 | * request. | 948 | * request. |
949 | */ | 949 | */ |
950 | |||
951 | static u8 ide_tape_wait_ireason(ide_drive_t *drive, u8 ireason) | ||
952 | { | ||
953 | ide_hwif_t *hwif = drive->hwif; | ||
954 | int retries = 100; | ||
955 | |||
956 | while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { | ||
957 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " | ||
958 | "a packet command, retrying\n", drive->name); | ||
959 | udelay(100); | ||
960 | ireason = hwif->INB(hwif->io_ports.nsect_addr); | ||
961 | if (retries == 0) { | ||
962 | printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " | ||
963 | "a packet command, ignoring\n", | ||
964 | drive->name); | ||
965 | ireason |= CD; | ||
966 | ireason &= ~IO; | ||
967 | } | ||
968 | } | ||
969 | |||
970 | return ireason; | ||
971 | } | ||
972 | |||
973 | static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | 950 | static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) |
974 | { | 951 | { |
975 | ide_hwif_t *hwif = drive->hwif; | ||
976 | idetape_tape_t *tape = drive->driver_data; | 952 | idetape_tape_t *tape = drive->driver_data; |
977 | struct ide_atapi_pc *pc = tape->pc; | ||
978 | ide_startstop_t startstop; | ||
979 | u8 ireason; | ||
980 | |||
981 | if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) { | ||
982 | printk(KERN_ERR "%s: Strange, packet command initiated yet " | ||
983 | "DRQ isn't asserted\n", drive->name); | ||
984 | return startstop; | ||
985 | } | ||
986 | |||
987 | ireason = hwif->INB(hwif->io_ports.nsect_addr); | ||
988 | ireason = ide_tape_wait_ireason(drive, ireason); | ||
989 | 953 | ||
990 | if ((ireason & CD) == 0 || (ireason & IO)) { | 954 | return ide_transfer_pc(drive, tape->pc, idetape_pc_intr, |
991 | printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing " | 955 | IDETAPE_WAIT_CMD, NULL); |
992 | "a packet command\n", drive->name); | ||
993 | return ide_do_reset(drive); | ||
994 | } | ||
995 | /* Set the interrupt routine */ | ||
996 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); | ||
997 | |||
998 | /* Begin DMA, if necessary */ | ||
999 | if (pc->flags & PC_FLAG_DMA_OK) { | ||
1000 | pc->flags |= PC_FLAG_DMA_IN_PROGRESS; | ||
1001 | hwif->dma_ops->dma_start(drive); | ||
1002 | } | ||
1003 | |||
1004 | /* Send the actual packet */ | ||
1005 | hwif->output_data(drive, NULL, pc->c, 12); | ||
1006 | |||
1007 | return ide_started; | ||
1008 | } | 956 | } |
1009 | 957 | ||
1010 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | 958 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, |