Lines Matching +full:no +full:- +full:pc +full:- +full:write

4  * Copyright (C) 1995-1999  Gadi Oxman <gadio@netvision.net.il>
5 * Copyright (C) 2003-2005 Bartlomiej Zolnierkiewicz
8 * of the faculty of electrical engineering in the Technion - Israel's
15 * Documentation/ide/ChangeLog.ide-tape.1995-2002
18 #define DRV_NAME "ide-tape"
79 * function in ide-tape. There are two cases in which we poll for DSC:
81 * 1. Before a read/write packet command, to ensure that we can transfer data
91 * here should be lower than the read/write frequency since those media access
92 * commands are slow. We start from a "fast" frequency - IDETAPE_DSC_MA_FAST
94 * (5 min), we switch it to a lower frequency - IDETAPE_DSC_MA_SLOW (1 min).
146 /* used by REQ_IDETAPE_{READ,WRITE} requests */
163 /* Read/Write dsc polling frequency */
193 * At most, there is only one ide-tape originated data transfer request
202 /* The read/write cursor */
214 /* the tape hardware is write protected */
216 /* the tape is write protected (hardware or opened as read-only) */
244 if (ide_device_get(tape->drive)) in ide_tape_get()
247 get_device(&tape->dev); in ide_tape_get()
256 ide_drive_t *drive = tape->drive; in ide_tape_put()
259 put_device(&tape->dev); in ide_tape_put()
270 idetape_tape_t *tape = drive->driver_data; in idetape_analyze_error()
271 struct ide_atapi_pc *pc = drive->failed_pc; in idetape_analyze_error() local
272 struct request *rq = drive->hwif->rq; in idetape_analyze_error()
273 u8 *sense = bio_data(rq->bio); in idetape_analyze_error()
275 tape->sense_key = sense[2] & 0xF; in idetape_analyze_error()
276 tape->asc = sense[12]; in idetape_analyze_error()
277 tape->ascq = sense[13]; in idetape_analyze_error()
281 rq->cmd[0], tape->sense_key, tape->asc, tape->ascq); in idetape_analyze_error()
284 if (pc->flags & PC_FLAG_DMA_ERROR) in idetape_analyze_error()
285 scsi_req(rq)->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); in idetape_analyze_error()
288 * If error was the result of a zero-length read or write command, in idetape_analyze_error()
290 * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. in idetape_analyze_error()
292 if ((pc->c[0] == READ_6 || pc->c[0] == WRITE_6) in idetape_analyze_error()
294 && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { in idetape_analyze_error()
295 if (tape->sense_key == 5) { in idetape_analyze_error()
297 pc->error = 0; in idetape_analyze_error()
298 /* don't retry read/write */ in idetape_analyze_error()
299 pc->flags |= PC_FLAG_ABORT; in idetape_analyze_error()
302 if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { in idetape_analyze_error()
303 pc->error = IDE_DRV_ERROR_FILEMARK; in idetape_analyze_error()
304 pc->flags |= PC_FLAG_ABORT; in idetape_analyze_error()
306 if (pc->c[0] == WRITE_6) { in idetape_analyze_error()
307 if ((sense[2] & 0x40) || (tape->sense_key == 0xd in idetape_analyze_error()
308 && tape->asc == 0x0 && tape->ascq == 0x2)) { in idetape_analyze_error()
309 pc->error = IDE_DRV_ERROR_EOD; in idetape_analyze_error()
310 pc->flags |= PC_FLAG_ABORT; in idetape_analyze_error()
313 if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { in idetape_analyze_error()
314 if (tape->sense_key == 8) { in idetape_analyze_error()
315 pc->error = IDE_DRV_ERROR_EOD; in idetape_analyze_error()
316 pc->flags |= PC_FLAG_ABORT; in idetape_analyze_error()
318 if (!(pc->flags & PC_FLAG_ABORT) && in idetape_analyze_error()
319 (blk_rq_bytes(rq) - scsi_req(rq)->resid_len)) in idetape_analyze_error()
320 pc->retries = IDETAPE_MAX_PC_RETRIES + 1; in idetape_analyze_error()
328 idetape_tape_t *tape = drive->driver_data; in ide_tape_callback()
329 struct ide_atapi_pc *pc = drive->pc; in ide_tape_callback() local
330 struct request *rq = drive->hwif->rq; in ide_tape_callback()
331 int uptodate = pc->error ? 0 : 1; in ide_tape_callback()
334 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc: %d, err: %d", rq->cmd[0], in ide_tape_callback()
340 if (drive->failed_pc == pc) in ide_tape_callback()
341 drive->failed_pc = NULL; in ide_tape_callback()
343 if (pc->c[0] == REQUEST_SENSE) { in ide_tape_callback()
347 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " in ide_tape_callback()
348 "itself - Aborting request!\n"); in ide_tape_callback()
349 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { in ide_tape_callback()
351 (blk_rq_bytes(rq) - scsi_req(rq)->resid_len) / tape->blk_size; in ide_tape_callback()
353 tape->avg_size += blocks * tape->blk_size; in ide_tape_callback()
355 if (time_after_eq(jiffies, tape->avg_time + HZ)) { in ide_tape_callback()
356 tape->avg_speed = tape->avg_size * HZ / in ide_tape_callback()
357 (jiffies - tape->avg_time) / 1024; in ide_tape_callback()
358 tape->avg_size = 0; in ide_tape_callback()
359 tape->avg_time = jiffies; in ide_tape_callback()
362 tape->first_frame += blocks; in ide_tape_callback()
364 if (pc->error) { in ide_tape_callback()
366 err = pc->error; in ide_tape_callback()
369 scsi_req(rq)->result = err; in ide_tape_callback()
380 idetape_tape_t *tape = drive->driver_data; in ide_tape_stall_queue()
383 drive->hwif->rq->cmd[0], tape->dsc_poll_freq); in ide_tape_stall_queue()
385 tape->postponed_rq = true; in ide_tape_stall_queue()
387 ide_stall_queue(drive, tape->dsc_poll_freq); in ide_tape_stall_queue()
392 idetape_tape_t *tape = drive->driver_data; in ide_tape_handle_dsc()
395 tape->dsc_polling_start = jiffies; in ide_tape_handle_dsc()
396 tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST; in ide_tape_handle_dsc()
397 tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT; in ide_tape_handle_dsc()
405 * The current Packet Command is available in drive->pc, and will not change
415 * repeated until the device signals us that no more interrupts will be issued.
434 * 6. In case no error was found, or we decided to give up and not to retry
441 struct ide_atapi_pc *pc) in ide_tape_issue_pc() argument
443 idetape_tape_t *tape = drive->driver_data; in ide_tape_issue_pc()
444 struct request *rq = drive->hwif->rq; in ide_tape_issue_pc()
446 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) in ide_tape_issue_pc()
447 drive->failed_pc = pc; in ide_tape_issue_pc()
450 drive->pc = pc; in ide_tape_issue_pc()
452 if (pc->retries > IDETAPE_MAX_PC_RETRIES || in ide_tape_issue_pc()
453 (pc->flags & PC_FLAG_ABORT)) { in ide_tape_issue_pc()
460 if (!(pc->flags & PC_FLAG_ABORT)) { in ide_tape_issue_pc()
461 if (!(pc->c[0] == TEST_UNIT_READY && in ide_tape_issue_pc()
462 tape->sense_key == 2 && tape->asc == 4 && in ide_tape_issue_pc()
463 (tape->ascq == 1 || tape->ascq == 8))) { in ide_tape_issue_pc()
464 printk(KERN_ERR "ide-tape: %s: I/O error, " in ide_tape_issue_pc()
465 "pc = %2x, key = %2x, " in ide_tape_issue_pc()
467 tape->name, pc->c[0], in ide_tape_issue_pc()
468 tape->sense_key, tape->asc, in ide_tape_issue_pc()
469 tape->ascq); in ide_tape_issue_pc()
472 pc->error = IDE_DRV_ERROR_GENERAL; in ide_tape_issue_pc()
475 drive->failed_pc = NULL; in ide_tape_issue_pc()
476 drive->pc_callback(drive, 0); in ide_tape_issue_pc()
480 ide_debug_log(IDE_DBG_SENSE, "retry #%d, cmd: 0x%02x", pc->retries, in ide_tape_issue_pc()
481 pc->c[0]); in ide_tape_issue_pc()
483 pc->retries++; in ide_tape_issue_pc()
489 static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code) in idetape_create_mode_sense_cmd() argument
491 ide_init_pc(pc); in idetape_create_mode_sense_cmd()
492 pc->c[0] = MODE_SENSE; in idetape_create_mode_sense_cmd()
494 /* DBD = 1 - Don't return block descriptors */ in idetape_create_mode_sense_cmd()
495 pc->c[1] = 8; in idetape_create_mode_sense_cmd()
496 pc->c[2] = page_code; in idetape_create_mode_sense_cmd()
498 * Changed pc->c[3] to 0 (255 will at best return unused info). in idetape_create_mode_sense_cmd()
504 pc->c[3] = 0; in idetape_create_mode_sense_cmd()
506 pc->c[4] = 255; in idetape_create_mode_sense_cmd()
508 pc->req_xfer = 12; in idetape_create_mode_sense_cmd()
510 pc->req_xfer = 24; in idetape_create_mode_sense_cmd()
512 pc->req_xfer = 50; in idetape_create_mode_sense_cmd()
517 ide_hwif_t *hwif = drive->hwif; in idetape_media_access_finished()
518 idetape_tape_t *tape = drive->driver_data; in idetape_media_access_finished()
519 struct ide_atapi_pc *pc = drive->pc; in idetape_media_access_finished() local
522 stat = hwif->tp_ops->read_status(hwif); in idetape_media_access_finished()
527 if (pc->c[0] != TEST_UNIT_READY) in idetape_media_access_finished()
528 printk(KERN_ERR "ide-tape: %s: I/O error, ", in idetape_media_access_finished()
529 tape->name); in idetape_media_access_finished()
534 pc->error = 0; in idetape_media_access_finished()
536 pc->error = IDE_DRV_ERROR_GENERAL; in idetape_media_access_finished()
537 drive->failed_pc = NULL; in idetape_media_access_finished()
539 drive->pc_callback(drive, 0); in idetape_media_access_finished()
544 struct ide_atapi_pc *pc, struct request *rq, in ide_tape_create_rw_cmd() argument
547 unsigned int length = blk_rq_sectors(rq) / (tape->blk_size >> 9); in ide_tape_create_rw_cmd()
549 ide_init_pc(pc); in ide_tape_create_rw_cmd()
550 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); in ide_tape_create_rw_cmd()
551 pc->c[1] = 1; in ide_tape_create_rw_cmd()
553 if (blk_rq_bytes(rq) == tape->buffer_size) in ide_tape_create_rw_cmd()
554 pc->flags |= PC_FLAG_DMA_OK; in ide_tape_create_rw_cmd()
557 pc->c[0] = READ_6; in ide_tape_create_rw_cmd()
559 pc->c[0] = WRITE_6; in ide_tape_create_rw_cmd()
560 pc->flags |= PC_FLAG_WRITING; in ide_tape_create_rw_cmd()
563 memcpy(scsi_req(rq)->cmd, pc->c, 12); in ide_tape_create_rw_cmd()
569 ide_hwif_t *hwif = drive->hwif; in idetape_do_request()
570 idetape_tape_t *tape = drive->driver_data; in idetape_do_request()
571 struct ide_atapi_pc *pc = NULL; in idetape_do_request() local
577 req->cmd[0], (unsigned long long)blk_rq_pos(rq), in idetape_do_request()
581 BUG_ON(ide_req(rq)->type != ATA_PRIV_MISC && in idetape_do_request()
582 ide_req(rq)->type != ATA_PRIV_SENSE); in idetape_do_request()
585 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { in idetape_do_request()
586 pc = drive->failed_pc; in idetape_do_request()
594 stat = hwif->tp_ops->read_status(hwif); in idetape_do_request()
596 if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && in idetape_do_request()
597 (req->cmd[13] & REQ_IDETAPE_PC2) == 0) in idetape_do_request()
598 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; in idetape_do_request()
600 if (drive->dev_flags & IDE_DFLAG_POST_RESET) { in idetape_do_request()
601 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; in idetape_do_request()
602 drive->dev_flags &= ~IDE_DFLAG_POST_RESET; in idetape_do_request()
605 if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) && in idetape_do_request()
607 if (!tape->postponed_rq) { in idetape_do_request()
608 tape->dsc_polling_start = jiffies; in idetape_do_request()
609 tape->dsc_poll_freq = tape->best_dsc_rw_freq; in idetape_do_request()
610 tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT; in idetape_do_request()
611 } else if (time_after(jiffies, tape->dsc_timeout)) { in idetape_do_request()
612 printk(KERN_ERR "ide-tape: %s: DSC timeout\n", in idetape_do_request()
613 tape->name); in idetape_do_request()
614 if (req->cmd[13] & REQ_IDETAPE_PC2) { in idetape_do_request()
621 tape->dsc_polling_start + in idetape_do_request()
623 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW; in idetape_do_request()
627 drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC; in idetape_do_request()
628 tape->postponed_rq = false; in idetape_do_request()
631 if (req->cmd[13] & REQ_IDETAPE_READ) { in idetape_do_request()
632 pc = &tape->queued_pc; in idetape_do_request()
633 ide_tape_create_rw_cmd(tape, pc, rq, READ_6); in idetape_do_request()
636 if (req->cmd[13] & REQ_IDETAPE_WRITE) { in idetape_do_request()
637 pc = &tape->queued_pc; in idetape_do_request()
638 ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); in idetape_do_request()
641 if (req->cmd[13] & REQ_IDETAPE_PC1) { in idetape_do_request()
642 pc = (struct ide_atapi_pc *)ide_req(rq)->special; in idetape_do_request()
643 req->cmd[13] &= ~(REQ_IDETAPE_PC1); in idetape_do_request()
644 req->cmd[13] |= REQ_IDETAPE_PC2; in idetape_do_request()
647 if (req->cmd[13] & REQ_IDETAPE_PC2) { in idetape_do_request()
667 return ide_tape_issue_pc(drive, &cmd, pc); in idetape_do_request()
671 * Write a filemark if write_filemark=1. Flush the device buffers without
675 struct ide_atapi_pc *pc, int write_filemark) in idetape_create_write_filemark_cmd() argument
677 ide_init_pc(pc); in idetape_create_write_filemark_cmd()
678 pc->c[0] = WRITE_FILEMARKS; in idetape_create_write_filemark_cmd()
679 pc->c[4] = write_filemark; in idetape_create_write_filemark_cmd()
680 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_write_filemark_cmd()
685 idetape_tape_t *tape = drive->driver_data; in idetape_wait_ready()
686 struct gendisk *disk = tape->disk; in idetape_wait_ready()
690 set_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), &drive->atapi_flags); in idetape_wait_ready()
695 if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) in idetape_wait_ready()
696 || (tape->asc == 0x3A)) { in idetape_wait_ready()
697 /* no media */ in idetape_wait_ready()
699 return -ENOMEDIUM; in idetape_wait_ready()
703 } else if (!(tape->sense_key == 2 && tape->asc == 4 && in idetape_wait_ready()
704 (tape->ascq == 1 || tape->ascq == 8))) in idetape_wait_ready()
705 return -EIO; in idetape_wait_ready()
708 return -EIO; in idetape_wait_ready()
713 struct ide_tape_obj *tape = drive->driver_data; in idetape_flush_tape_buffers()
714 struct ide_atapi_pc pc; in idetape_flush_tape_buffers() local
717 idetape_create_write_filemark_cmd(drive, &pc, 0); in idetape_flush_tape_buffers()
718 rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); in idetape_flush_tape_buffers()
727 idetape_tape_t *tape = drive->driver_data; in ide_tape_read_position()
728 struct ide_atapi_pc pc; in ide_tape_read_position() local
734 ide_init_pc(&pc); in ide_tape_read_position()
735 pc.c[0] = READ_POSITION; in ide_tape_read_position()
736 pc.req_xfer = 20; in ide_tape_read_position()
738 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) in ide_tape_read_position()
739 return -1; in ide_tape_read_position()
741 if (!pc.error) { in ide_tape_read_position()
742 ide_debug_log(IDE_DBG_FUNC, "BOP - %s", in ide_tape_read_position()
743 (buf[0] & 0x80) ? "Yes" : "No"); in ide_tape_read_position()
744 ide_debug_log(IDE_DBG_FUNC, "EOP - %s", in ide_tape_read_position()
745 (buf[0] & 0x40) ? "Yes" : "No"); in ide_tape_read_position()
748 printk(KERN_INFO "ide-tape: Block location is unknown" in ide_tape_read_position()
751 &drive->atapi_flags); in ide_tape_read_position()
752 return -1; in ide_tape_read_position()
757 tape->partition = buf[1]; in ide_tape_read_position()
758 tape->first_frame = be32_to_cpup((__be32 *)&buf[4]); in ide_tape_read_position()
760 &drive->atapi_flags); in ide_tape_read_position()
764 return tape->first_frame; in ide_tape_read_position()
768 struct ide_atapi_pc *pc, in idetape_create_locate_cmd() argument
771 ide_init_pc(pc); in idetape_create_locate_cmd()
772 pc->c[0] = POSITION_TO_ELEMENT; in idetape_create_locate_cmd()
773 pc->c[1] = 2; in idetape_create_locate_cmd()
774 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); in idetape_create_locate_cmd()
775 pc->c[8] = partition; in idetape_create_locate_cmd()
776 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_locate_cmd()
781 idetape_tape_t *tape = drive->driver_data; in __ide_tape_discard_merge_buffer()
783 if (tape->chrdev_dir != IDETAPE_DIR_READ) in __ide_tape_discard_merge_buffer()
786 clear_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags); in __ide_tape_discard_merge_buffer()
787 tape->valid = 0; in __ide_tape_discard_merge_buffer()
788 if (tape->buf != NULL) { in __ide_tape_discard_merge_buffer()
789 kfree(tape->buf); in __ide_tape_discard_merge_buffer()
790 tape->buf = NULL; in __ide_tape_discard_merge_buffer()
793 tape->chrdev_dir = IDETAPE_DIR_NONE; in __ide_tape_discard_merge_buffer()
805 idetape_tape_t *tape = drive->driver_data; in idetape_position_tape()
806 struct gendisk *disk = tape->disk; in idetape_position_tape()
808 struct ide_atapi_pc pc; in idetape_position_tape() local
810 if (tape->chrdev_dir == IDETAPE_DIR_READ) in idetape_position_tape()
813 idetape_create_locate_cmd(drive, &pc, block, partition, skip); in idetape_position_tape()
814 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_position_tape()
827 idetape_tape_t *tape = drive->driver_data; in ide_tape_discard_merge_buffer()
835 printk(KERN_INFO "ide-tape: %s: position_tape failed in" in ide_tape_discard_merge_buffer()
836 " %s\n", tape->name, __func__); in ide_tape_discard_merge_buffer()
843 * Generate a read/write request for the block device interface and wait for it
848 idetape_tape_t *tape = drive->driver_data; in idetape_queue_rw_tail()
855 BUG_ON(size < 0 || size % tape->blk_size); in idetape_queue_rw_tail()
857 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); in idetape_queue_rw_tail()
858 ide_req(rq)->type = ATA_PRIV_MISC; in idetape_queue_rw_tail()
859 scsi_req(rq)->cmd[13] = cmd; in idetape_queue_rw_tail()
860 rq->rq_disk = tape->disk; in idetape_queue_rw_tail()
861 rq->__sector = tape->first_frame; in idetape_queue_rw_tail()
864 ret = blk_rq_map_kern(drive->queue, rq, tape->buf, size, in idetape_queue_rw_tail()
870 blk_execute_rq(drive->queue, tape->disk, rq, 0); in idetape_queue_rw_tail()
873 size -= scsi_req(rq)->resid_len; in idetape_queue_rw_tail()
874 tape->cur = tape->buf; in idetape_queue_rw_tail()
876 tape->valid = size; in idetape_queue_rw_tail()
878 tape->valid = 0; in idetape_queue_rw_tail()
881 if (scsi_req(rq)->result == IDE_DRV_ERROR_GENERAL) in idetape_queue_rw_tail()
882 ret = -EIO; in idetape_queue_rw_tail()
888 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) in idetape_create_inquiry_cmd() argument
890 ide_init_pc(pc); in idetape_create_inquiry_cmd()
891 pc->c[0] = INQUIRY; in idetape_create_inquiry_cmd()
892 pc->c[4] = 254; in idetape_create_inquiry_cmd()
893 pc->req_xfer = 254; in idetape_create_inquiry_cmd()
897 struct ide_atapi_pc *pc) in idetape_create_rewind_cmd() argument
899 ide_init_pc(pc); in idetape_create_rewind_cmd()
900 pc->c[0] = REZERO_UNIT; in idetape_create_rewind_cmd()
901 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_rewind_cmd()
904 static void idetape_create_erase_cmd(struct ide_atapi_pc *pc) in idetape_create_erase_cmd() argument
906 ide_init_pc(pc); in idetape_create_erase_cmd()
907 pc->c[0] = ERASE; in idetape_create_erase_cmd()
908 pc->c[1] = 1; in idetape_create_erase_cmd()
909 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_erase_cmd()
912 static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd) in idetape_create_space_cmd() argument
914 ide_init_pc(pc); in idetape_create_space_cmd()
915 pc->c[0] = SPACE; in idetape_create_space_cmd()
916 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); in idetape_create_space_cmd()
917 pc->c[1] = cmd; in idetape_create_space_cmd()
918 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_space_cmd()
923 idetape_tape_t *tape = drive->driver_data; in ide_tape_flush_merge_buffer()
925 if (tape->chrdev_dir != IDETAPE_DIR_WRITE) { in ide_tape_flush_merge_buffer()
926 printk(KERN_ERR "ide-tape: bug: Trying to empty merge buffer" in ide_tape_flush_merge_buffer()
930 if (tape->buf) { in ide_tape_flush_merge_buffer()
931 size_t aligned = roundup(tape->valid, tape->blk_size); in ide_tape_flush_merge_buffer()
933 memset(tape->cur, 0, aligned - tape->valid); in ide_tape_flush_merge_buffer()
935 kfree(tape->buf); in ide_tape_flush_merge_buffer()
936 tape->buf = NULL; in ide_tape_flush_merge_buffer()
938 tape->chrdev_dir = IDETAPE_DIR_NONE; in ide_tape_flush_merge_buffer()
943 idetape_tape_t *tape = drive->driver_data; in idetape_init_rw()
948 if (tape->chrdev_dir == dir) in idetape_init_rw()
951 if (tape->chrdev_dir == IDETAPE_DIR_READ) in idetape_init_rw()
953 else if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { in idetape_init_rw()
958 if (tape->buf || tape->valid) { in idetape_init_rw()
959 printk(KERN_ERR "ide-tape: valid should be 0 now\n"); in idetape_init_rw()
960 tape->valid = 0; in idetape_init_rw()
963 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); in idetape_init_rw()
964 if (!tape->buf) in idetape_init_rw()
965 return -ENOMEM; in idetape_init_rw()
966 tape->chrdev_dir = dir; in idetape_init_rw()
967 tape->cur = tape->buf; in idetape_init_rw()
971 * switched from completion mode to buffer available mode. No in idetape_init_rw()
975 if (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) { in idetape_init_rw()
981 kfree(tape->buf); in idetape_init_rw()
982 tape->buf = NULL; in idetape_init_rw()
983 tape->chrdev_dir = IDETAPE_DIR_NONE; in idetape_init_rw()
993 idetape_tape_t *tape = drive->driver_data; in idetape_pad_zeros()
995 memset(tape->buf, 0, tape->buffer_size); in idetape_pad_zeros()
998 unsigned int count = min(tape->buffer_size, bcount); in idetape_pad_zeros()
1001 bcount -= count; in idetape_pad_zeros()
1011 struct ide_tape_obj *tape = drive->driver_data; in idetape_rewind_tape()
1012 struct gendisk *disk = tape->disk; in idetape_rewind_tape()
1013 struct ide_atapi_pc pc; in idetape_rewind_tape() local
1018 idetape_create_rewind_cmd(drive, &pc); in idetape_rewind_tape()
1019 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_rewind_tape()
1033 idetape_tape_t *tape = drive->driver_data; in idetape_blkdev_ioctl()
1047 return -EFAULT; in idetape_blkdev_ioctl()
1048 tape->best_dsc_rw_freq = config.dsc_rw_frequency; in idetape_blkdev_ioctl()
1052 config.dsc_rw_frequency = (int) tape->best_dsc_rw_freq; in idetape_blkdev_ioctl()
1055 return -EFAULT; in idetape_blkdev_ioctl()
1058 return -EIO; in idetape_blkdev_ioctl()
1066 idetape_tape_t *tape = drive->driver_data; in idetape_space_over_filemarks()
1067 struct gendisk *disk = tape->disk; in idetape_space_over_filemarks()
1068 struct ide_atapi_pc pc; in idetape_space_over_filemarks() local
1070 int sprev = !!(tape->caps[4] & 0x20); in idetape_space_over_filemarks()
1079 return -EIO; in idetape_space_over_filemarks()
1080 mt_count = -mt_count; in idetape_space_over_filemarks()
1083 if (tape->chrdev_dir == IDETAPE_DIR_READ) { in idetape_space_over_filemarks()
1084 tape->valid = 0; in idetape_space_over_filemarks()
1086 &drive->atapi_flags)) in idetape_space_over_filemarks()
1094 idetape_create_space_cmd(&pc, mt_count - count, in idetape_space_over_filemarks()
1096 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_space_over_filemarks()
1100 return -EIO; in idetape_space_over_filemarks()
1102 mt_count - count); in idetape_space_over_filemarks()
1105 count = (MTBSFM == mt_op ? 1 : -1); in idetape_space_over_filemarks()
1108 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", in idetape_space_over_filemarks()
1110 return -EIO; in idetape_space_over_filemarks()
1115 * Our character device read / write functions.
1122 * continuous view of the media - any mix of block sizes (even 1 byte) on the
1126 * (slightly) increased driver overhead, but will no longer hit performance.
1132 struct ide_tape_obj *tape = file->private_data; in idetape_chrdev_read()
1133 ide_drive_t *drive = tape->drive; in idetape_chrdev_read()
1140 if (tape->chrdev_dir != IDETAPE_DIR_READ) { in idetape_chrdev_read()
1141 if (test_bit(ilog2(IDE_AFLAG_DETECT_BS), &drive->atapi_flags)) in idetape_chrdev_read()
1142 if (count > tape->blk_size && in idetape_chrdev_read()
1143 (count % tape->blk_size) == 0) in idetape_chrdev_read()
1144 tape->user_bs_factor = count / tape->blk_size; in idetape_chrdev_read()
1155 if (!tape->valid) { in idetape_chrdev_read()
1158 &drive->atapi_flags)) in idetape_chrdev_read()
1162 tape->buffer_size) <= 0) in idetape_chrdev_read()
1167 todo = min_t(size_t, count - done, tape->valid); in idetape_chrdev_read()
1168 if (copy_to_user(buf + done, tape->cur, todo)) in idetape_chrdev_read()
1169 ret = -EFAULT; in idetape_chrdev_read()
1171 tape->cur += todo; in idetape_chrdev_read()
1172 tape->valid -= todo; in idetape_chrdev_read()
1176 if (!done && test_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags)) { in idetape_chrdev_read()
1187 struct ide_tape_obj *tape = file->private_data; in idetape_chrdev_write()
1188 ide_drive_t *drive = tape->drive; in idetape_chrdev_write()
1193 /* The drive is write protected. */ in idetape_chrdev_write()
1194 if (tape->write_prot) in idetape_chrdev_write()
1195 return -EACCES; in idetape_chrdev_write()
1199 /* Initialize write operation */ in idetape_chrdev_write()
1208 if (tape->valid == tape->buffer_size && in idetape_chrdev_write()
1210 tape->buffer_size) <= 0) in idetape_chrdev_write()
1214 todo = min_t(size_t, count - done, in idetape_chrdev_write()
1215 tape->buffer_size - tape->valid); in idetape_chrdev_write()
1216 if (copy_from_user(tape->cur, buf + done, todo)) in idetape_chrdev_write()
1217 ret = -EFAULT; in idetape_chrdev_write()
1219 tape->cur += todo; in idetape_chrdev_write()
1220 tape->valid += todo; in idetape_chrdev_write()
1229 struct ide_tape_obj *tape = drive->driver_data; in idetape_write_filemark()
1230 struct ide_atapi_pc pc; in idetape_write_filemark() local
1232 /* Write a filemark */ in idetape_write_filemark()
1233 idetape_create_write_filemark_cmd(drive, &pc, 1); in idetape_write_filemark()
1234 if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { in idetape_write_filemark()
1235 printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); in idetape_write_filemark()
1236 return -EIO; in idetape_write_filemark()
1256 idetape_tape_t *tape = drive->driver_data; in idetape_mtioctop()
1257 struct gendisk *disk = tape->disk; in idetape_mtioctop()
1258 struct ide_atapi_pc pc; in idetape_mtioctop() local
1278 if (tape->write_prot) in idetape_mtioctop()
1279 return -EACCES; in idetape_mtioctop()
1290 return -EIO; in idetape_mtioctop()
1301 if (tape->door_locked) { in idetape_mtioctop()
1303 tape->door_locked = DOOR_UNLOCKED; in idetape_mtioctop()
1309 &drive->atapi_flags); in idetape_mtioctop()
1319 idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); in idetape_mtioctop()
1320 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_mtioctop()
1323 idetape_create_erase_cmd(&pc); in idetape_mtioctop()
1324 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_mtioctop()
1327 if (mt_count < tape->blk_size || in idetape_mtioctop()
1328 mt_count % tape->blk_size) in idetape_mtioctop()
1329 return -EIO; in idetape_mtioctop()
1330 tape->user_bs_factor = mt_count / tape->blk_size; in idetape_mtioctop()
1332 &drive->atapi_flags); in idetape_mtioctop()
1335 &drive->atapi_flags); in idetape_mtioctop()
1340 mt_count * tape->user_bs_factor, tape->partition, 0); in idetape_mtioctop()
1350 tape->door_locked = DOOR_EXPLICITLY_LOCKED; in idetape_mtioctop()
1356 tape->door_locked = DOOR_UNLOCKED; in idetape_mtioctop()
1359 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", in idetape_mtioctop()
1361 return -EIO; in idetape_mtioctop()
1368 * ide-tape ioctls are supported on both interfaces.
1373 struct ide_tape_obj *tape = file->private_data; in do_idetape_chrdev_ioctl()
1374 ide_drive_t *drive = tape->drive; in do_idetape_chrdev_ioctl()
1378 int block_offset = 0, position = tape->first_frame; in do_idetape_chrdev_ioctl()
1383 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { in do_idetape_chrdev_ioctl()
1388 block_offset = tape->valid / in do_idetape_chrdev_ioctl()
1389 (tape->blk_size * tape->user_bs_factor); in do_idetape_chrdev_ioctl()
1392 return -EIO; in do_idetape_chrdev_ioctl()
1397 return -EFAULT; in do_idetape_chrdev_ioctl()
1402 mtget.mt_blkno = position / tape->user_bs_factor - block_offset; in do_idetape_chrdev_ioctl()
1404 ((tape->blk_size * tape->user_bs_factor) in do_idetape_chrdev_ioctl()
1407 if (tape->drv_write_prot) in do_idetape_chrdev_ioctl()
1411 return -EFAULT; in do_idetape_chrdev_ioctl()
1414 mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; in do_idetape_chrdev_ioctl()
1416 return -EFAULT; in do_idetape_chrdev_ioctl()
1419 if (tape->chrdev_dir == IDETAPE_DIR_READ) in do_idetape_chrdev_ioctl()
1441 idetape_tape_t *tape = drive->driver_data; in ide_tape_get_bsize_from_bdesc()
1442 struct ide_atapi_pc pc; in ide_tape_get_bsize_from_bdesc() local
1445 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); in ide_tape_get_bsize_from_bdesc()
1446 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { in ide_tape_get_bsize_from_bdesc()
1447 printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); in ide_tape_get_bsize_from_bdesc()
1448 if (tape->blk_size == 0) { in ide_tape_get_bsize_from_bdesc()
1449 printk(KERN_WARNING "ide-tape: Cannot deal with zero " in ide_tape_get_bsize_from_bdesc()
1451 tape->blk_size = 32768; in ide_tape_get_bsize_from_bdesc()
1455 tape->blk_size = (buf[4 + 5] << 16) + in ide_tape_get_bsize_from_bdesc()
1458 tape->drv_write_prot = (buf[2] & 0x80) >> 7; in ide_tape_get_bsize_from_bdesc()
1461 tape->blk_size, tape->drv_write_prot); in ide_tape_get_bsize_from_bdesc()
1472 return -ENXIO; in idetape_chrdev_open()
1479 return -ENXIO; in idetape_chrdev_open()
1482 drive = tape->drive; in idetape_chrdev_open()
1483 filp->private_data = tape; in idetape_chrdev_open()
1492 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); in idetape_chrdev_open()
1495 if (test_and_set_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags)) { in idetape_chrdev_open()
1496 retval = -EBUSY; in idetape_chrdev_open()
1502 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); in idetape_chrdev_open()
1503 printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); in idetape_chrdev_open()
1508 if (!test_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), &drive->atapi_flags)) in idetape_chrdev_open()
1511 /* Read block size and write protect status from drive. */ in idetape_chrdev_open()
1514 /* Set write protect flag if device is opened as read-only. */ in idetape_chrdev_open()
1515 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) in idetape_chrdev_open()
1516 tape->write_prot = 1; in idetape_chrdev_open()
1518 tape->write_prot = tape->drv_write_prot; in idetape_chrdev_open()
1520 /* Make sure drive isn't write protected if user wants to write. */ in idetape_chrdev_open()
1521 if (tape->write_prot) { in idetape_chrdev_open()
1522 if ((filp->f_flags & O_ACCMODE) == O_WRONLY || in idetape_chrdev_open()
1523 (filp->f_flags & O_ACCMODE) == O_RDWR) { in idetape_chrdev_open()
1524 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); in idetape_chrdev_open()
1525 retval = -EROFS; in idetape_chrdev_open()
1531 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { in idetape_chrdev_open()
1532 if (!ide_set_media_lock(drive, tape->disk, 1)) { in idetape_chrdev_open()
1533 if (tape->door_locked != DOOR_EXPLICITLY_LOCKED) in idetape_chrdev_open()
1534 tape->door_locked = DOOR_LOCKED; in idetape_chrdev_open()
1551 idetape_tape_t *tape = drive->driver_data; in idetape_write_release()
1554 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); in idetape_write_release()
1555 if (tape->buf != NULL) { in idetape_write_release()
1556 idetape_pad_zeros(drive, tape->blk_size * in idetape_write_release()
1557 (tape->user_bs_factor - 1)); in idetape_write_release()
1558 kfree(tape->buf); in idetape_write_release()
1559 tape->buf = NULL; in idetape_write_release()
1568 struct ide_tape_obj *tape = filp->private_data; in idetape_chrdev_release()
1569 ide_drive_t *drive = tape->drive; in idetape_chrdev_release()
1574 tape = drive->driver_data; in idetape_chrdev_release()
1578 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) in idetape_chrdev_release()
1580 if (tape->chrdev_dir == IDETAPE_DIR_READ) { in idetape_chrdev_release()
1586 &drive->atapi_flags)) in idetape_chrdev_release()
1589 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { in idetape_chrdev_release()
1590 if (tape->door_locked == DOOR_LOCKED) { in idetape_chrdev_release()
1591 if (!ide_set_media_lock(drive, tape->disk, 0)) in idetape_chrdev_release()
1592 tape->door_locked = DOOR_UNLOCKED; in idetape_chrdev_release()
1595 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); in idetape_chrdev_release()
1605 idetape_tape_t *tape = drive->driver_data; in idetape_get_inquiry_results()
1606 struct ide_atapi_pc pc; in idetape_get_inquiry_results() local
1610 idetape_create_inquiry_cmd(&pc); in idetape_get_inquiry_results()
1611 if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { in idetape_get_inquiry_results()
1612 printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", in idetape_get_inquiry_results()
1613 tape->name); in idetape_get_inquiry_results()
1624 printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n", in idetape_get_inquiry_results()
1625 drive->name, tape->name, vendor_id, product_id, fw_rev); in idetape_get_inquiry_results()
1634 idetape_tape_t *tape = drive->driver_data; in idetape_get_mode_sense_results()
1635 struct ide_atapi_pc pc; in idetape_get_mode_sense_results() local
1639 idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); in idetape_get_mode_sense_results()
1640 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { in idetape_get_mode_sense_results()
1641 printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" in idetape_get_mode_sense_results()
1643 tape->blk_size = 512; in idetape_get_mode_sense_results()
1644 put_unaligned(52, (u16 *)&tape->caps[12]); in idetape_get_mode_sense_results()
1645 put_unaligned(540, (u16 *)&tape->caps[14]); in idetape_get_mode_sense_results()
1646 put_unaligned(6*52, (u16 *)&tape->caps[16]); in idetape_get_mode_sense_results()
1661 printk(KERN_INFO "ide-tape: %s: invalid tape speed " in idetape_get_mode_sense_results()
1662 "(assuming 650KB/sec)\n", drive->name); in idetape_get_mode_sense_results()
1666 printk(KERN_INFO "ide-tape: %s: invalid max_speed " in idetape_get_mode_sense_results()
1667 "(assuming 650KB/sec)\n", drive->name); in idetape_get_mode_sense_results()
1671 memcpy(&tape->caps, caps, 20); in idetape_get_mode_sense_results()
1675 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; in idetape_get_mode_sense_results()
1678 tape->blk_size = 512; in idetape_get_mode_sense_results()
1680 tape->blk_size = 1024; in idetape_get_mode_sense_results()
1687 idetape_tape_t *tape = drive->driver_data; \
1688 return tape->field; \
1694 idetape_tape_t *tape = drive->driver_data; \
1695 tape->field = arg; \
1749 u16 *ctl = (u16 *)&tape->caps[12]; in idetape_setup()
1753 drive->pc_callback = ide_tape_callback; in idetape_setup()
1755 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; in idetape_setup()
1757 if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { in idetape_setup()
1758 printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", in idetape_setup()
1759 tape->name); in idetape_setup()
1760 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; in idetape_setup()
1764 if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401")) in idetape_setup()
1765 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; in idetape_setup()
1767 tape->minor = minor; in idetape_setup()
1768 tape->name[0] = 'h'; in idetape_setup()
1769 tape->name[1] = 't'; in idetape_setup()
1770 tape->name[2] = '0' + minor; in idetape_setup()
1771 tape->chrdev_dir = IDETAPE_DIR_NONE; in idetape_setup()
1776 tape->user_bs_factor = 1; in idetape_setup()
1777 tape->buffer_size = *ctl * tape->blk_size; in idetape_setup()
1778 while (tape->buffer_size > 0xffff) { in idetape_setup()
1779 printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); in idetape_setup()
1781 tape->buffer_size = *ctl * tape->blk_size; in idetape_setup()
1784 /* select the "best" DSC read/write polling freq */ in idetape_setup()
1785 speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]); in idetape_setup()
1787 t = (IDETAPE_FIFO_THRESHOLD * tape->buffer_size * HZ) / (speed * 1000); in idetape_setup()
1793 tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN, in idetape_setup()
1795 printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " in idetape_setup()
1797 drive->name, tape->name, *(u16 *)&tape->caps[14], in idetape_setup()
1798 (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, in idetape_setup()
1799 tape->buffer_size / 1024, in idetape_setup()
1800 jiffies_to_msecs(tape->best_dsc_rw_freq), in idetape_setup()
1801 (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); in idetape_setup()
1803 ide_proc_register_driver(drive, tape->driver); in idetape_setup()
1808 idetape_tape_t *tape = drive->driver_data; in ide_tape_remove()
1810 ide_proc_unregister_driver(drive, tape->driver); in ide_tape_remove()
1811 device_del(&tape->dev); in ide_tape_remove()
1812 ide_unregister_region(tape->disk); in ide_tape_remove()
1815 put_device(&tape->dev); in ide_tape_remove()
1822 ide_drive_t *drive = tape->drive; in ide_tape_release()
1823 struct gendisk *g = tape->disk; in ide_tape_release()
1825 BUG_ON(tape->valid); in ide_tape_release()
1827 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; in ide_tape_release()
1828 drive->driver_data = NULL; in ide_tape_release()
1829 device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor)); in ide_tape_release()
1831 MKDEV(IDETAPE_MAJOR, tape->minor + 128)); in ide_tape_release()
1832 idetape_devs[tape->minor] = NULL; in ide_tape_release()
1833 g->private_data = NULL; in ide_tape_release()
1841 ide_drive_t *drive = (ide_drive_t *) m->private; in idetape_name_proc_show()
1842 idetape_tape_t *tape = drive->driver_data; in idetape_name_proc_show()
1844 seq_printf(m, "%s\n", tape->name); in idetape_name_proc_show()
1870 .name = "ide-tape",
1887 .write = idetape_chrdev_write,
1899 tape = ide_tape_get(bdev->bd_disk, false, 0); in idetape_open()
1903 return -ENXIO; in idetape_open()
1920 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); in idetape_ioctl()
1921 ide_drive_t *drive = tape->drive; in idetape_ioctl()
1926 if (err == -EINVAL) in idetape_ioctl()
1948 if (!strstr(DRV_NAME, drive->driver_req)) in ide_tape_probe()
1951 if (drive->media != ide_tape) in ide_tape_probe()
1954 if ((drive->dev_flags & IDE_DFLAG_ID_READ) && in ide_tape_probe()
1956 printk(KERN_ERR "ide-tape: %s: not supported by this version of" in ide_tape_probe()
1957 " the driver\n", drive->name); in ide_tape_probe()
1962 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape struct\n", in ide_tape_probe()
1963 drive->name); in ide_tape_probe()
1973 tape->dev.parent = &drive->gendev; in ide_tape_probe()
1974 tape->dev.release = ide_tape_release; in ide_tape_probe()
1975 dev_set_name(&tape->dev, "%s", dev_name(&drive->gendev)); in ide_tape_probe()
1977 if (device_register(&tape->dev)) in ide_tape_probe()
1980 tape->drive = drive; in ide_tape_probe()
1981 tape->driver = &idetape_driver; in ide_tape_probe()
1982 tape->disk = g; in ide_tape_probe()
1984 g->private_data = &tape->driver; in ide_tape_probe()
1986 drive->driver_data = tape; in ide_tape_probe()
1996 device_create(idetape_sysfs_class, &drive->gendev, in ide_tape_probe()
1997 MKDEV(IDETAPE_MAJOR, minor), NULL, "%s", tape->name); in ide_tape_probe()
1998 device_create(idetape_sysfs_class, &drive->gendev, in ide_tape_probe()
2000 "n%s", tape->name); in ide_tape_probe()
2002 g->fops = &idetape_block_ops; in ide_tape_probe()
2012 return -ENODEV; in ide_tape_probe()
2029 error = -EBUSY; in idetape_init()
2034 printk(KERN_ERR "ide-tape: Failed to register chrdev" in idetape_init()
2036 error = -EBUSY; in idetape_init()
2054 MODULE_ALIAS("ide:*m-tape*");