-/**
- * drive_cmd_intr - drive command completion interrupt
- * @drive: drive the completion interrupt occurred on
- *
- * drive_cmd_intr() is invoked on completion of a special DRIVE_CMD.
- * We do any necessary data reading and then wait for the drive to
- * go non busy. At that point we may read the error data and complete
- * the request
- */
-
-static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
-{
- struct request *rq = HWGROUP(drive)->rq;
- ide_hwif_t *hwif = HWIF(drive);
- u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
-
- if (pio_in) {
- u8 io_32bit = drive->io_32bit;
- stat = hwif->INB(IDE_STATUS_REG);
- if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
- if (stat & (ERR_STAT | DRQ_STAT))
- return ide_error(drive, __FUNCTION__, stat);
- ide_set_handler(drive, &drive_cmd_intr, WAIT_WORSTCASE,
- NULL);
- return ide_started;
- }
- drive->io_32bit = 0;
- hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
- drive->io_32bit = io_32bit;
- stat = wait_drive_not_busy(drive);
- } else {
- local_irq_enable_in_hardirq();
- stat = hwif->INB(IDE_STATUS_REG);
- }
-
- if (!OK_STAT(stat, (pio_in ? 0 : READY_STAT), BAD_STAT))
- return ide_error(drive, __FUNCTION__, stat);
- /* calls ide_end_drive_cmd */
- ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG));
- return ide_stopped;
-}
-