diff options
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r-- | drivers/ide/ide-atapi.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 25939bc60402..932a83abaf06 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -68,3 +68,52 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
68 | return ide_started; | 68 | return ide_started; |
69 | } | 69 | } |
70 | EXPORT_SYMBOL_GPL(ide_transfer_pc); | 70 | EXPORT_SYMBOL_GPL(ide_transfer_pc); |
71 | |||
72 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | ||
73 | ide_handler_t *handler, unsigned int timeout, | ||
74 | ide_expiry_t *expiry) | ||
75 | { | ||
76 | ide_hwif_t *hwif = drive->hwif; | ||
77 | u16 bcount; | ||
78 | u8 dma = 0; | ||
79 | |||
80 | /* We haven't transferred any data yet */ | ||
81 | pc->xferred = 0; | ||
82 | pc->cur_pos = pc->buf; | ||
83 | |||
84 | /* Request to transfer the entire buffer at once */ | ||
85 | if (drive->media == ide_tape && !drive->scsi) | ||
86 | bcount = pc->req_xfer; | ||
87 | else | ||
88 | bcount = min(pc->req_xfer, 63 * 1024); | ||
89 | |||
90 | if (pc->flags & PC_FLAG_DMA_ERROR) { | ||
91 | pc->flags &= ~PC_FLAG_DMA_ERROR; | ||
92 | ide_dma_off(drive); | ||
93 | } | ||
94 | |||
95 | if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) { | ||
96 | if (drive->scsi) | ||
97 | hwif->sg_mapped = 1; | ||
98 | dma = !hwif->dma_ops->dma_setup(drive); | ||
99 | if (drive->scsi) | ||
100 | hwif->sg_mapped = 0; | ||
101 | } | ||
102 | |||
103 | if (!dma) | ||
104 | pc->flags &= ~PC_FLAG_DMA_OK; | ||
105 | |||
106 | ide_pktcmd_tf_load(drive, drive->scsi ? 0 : IDE_TFLAG_OUT_DEVICE, | ||
107 | bcount, dma); | ||
108 | |||
109 | /* Issue the packet command */ | ||
110 | if (pc->flags & PC_FLAG_DRQ_INTERRUPT) { | ||
111 | ide_execute_command(drive, WIN_PACKETCMD, handler, | ||
112 | timeout, NULL); | ||
113 | return ide_started; | ||
114 | } else { | ||
115 | ide_execute_pkt_cmd(drive); | ||
116 | return (*handler)(drive); | ||
117 | } | ||
118 | } | ||
119 | EXPORT_SYMBOL_GPL(ide_issue_pc); | ||