Lines Matching refs:pc
271 struct ide_atapi_pc *pc = drive->failed_pc; in idetape_analyze_error() local
284 if (pc->flags & PC_FLAG_DMA_ERROR) 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()
297 pc->error = 0; 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()
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()
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()
320 pc->retries = IDETAPE_MAX_PC_RETRIES + 1; in idetape_analyze_error()
329 struct ide_atapi_pc *pc = drive->pc; in ide_tape_callback() local
331 int uptodate = pc->error ? 0 : 1; in ide_tape_callback()
340 if (drive->failed_pc == pc) in ide_tape_callback()
343 if (pc->c[0] == REQUEST_SENSE) { in ide_tape_callback()
349 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { in ide_tape_callback()
364 if (pc->error) { in ide_tape_callback()
366 err = pc->error; in ide_tape_callback()
441 struct ide_atapi_pc *pc) in ide_tape_issue_pc() argument
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()
467 tape->name, pc->c[0], in ide_tape_issue_pc()
472 pc->error = IDE_DRV_ERROR_GENERAL; 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()
495 pc->c[1] = 8; in idetape_create_mode_sense_cmd()
496 pc->c[2] = page_code; 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()
519 struct ide_atapi_pc *pc = drive->pc; in idetape_media_access_finished() local
527 if (pc->c[0] != TEST_UNIT_READY) 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()
544 struct ide_atapi_pc *pc, struct request *rq, in ide_tape_create_rw_cmd() argument
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()
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(rq->cmd, pc->c, 12); in ide_tape_create_rw_cmd()
571 struct ide_atapi_pc *pc = NULL; in idetape_do_request() local
583 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { in idetape_do_request()
584 pc = drive->failed_pc; in idetape_do_request()
630 pc = &tape->queued_pc; in idetape_do_request()
631 ide_tape_create_rw_cmd(tape, pc, rq, READ_6); in idetape_do_request()
635 pc = &tape->queued_pc; in idetape_do_request()
636 ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); in idetape_do_request()
640 pc = (struct ide_atapi_pc *)rq->special; in idetape_do_request()
665 return ide_tape_issue_pc(drive, &cmd, pc); in idetape_do_request()
673 struct ide_atapi_pc *pc, int write_filemark) in idetape_create_write_filemark_cmd() argument
675 ide_init_pc(pc); in idetape_create_write_filemark_cmd()
676 pc->c[0] = WRITE_FILEMARKS; in idetape_create_write_filemark_cmd()
677 pc->c[4] = write_filemark; in idetape_create_write_filemark_cmd()
678 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_write_filemark_cmd()
712 struct ide_atapi_pc pc; in idetape_flush_tape_buffers() local
715 idetape_create_write_filemark_cmd(drive, &pc, 0); in idetape_flush_tape_buffers()
716 rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); in idetape_flush_tape_buffers()
726 struct ide_atapi_pc pc; in ide_tape_read_position() local
732 ide_init_pc(&pc); in ide_tape_read_position()
733 pc.c[0] = READ_POSITION; in ide_tape_read_position()
734 pc.req_xfer = 20; in ide_tape_read_position()
736 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) in ide_tape_read_position()
739 if (!pc.error) { in ide_tape_read_position()
766 struct ide_atapi_pc *pc, in idetape_create_locate_cmd() argument
769 ide_init_pc(pc); in idetape_create_locate_cmd()
770 pc->c[0] = POSITION_TO_ELEMENT; in idetape_create_locate_cmd()
771 pc->c[1] = 2; in idetape_create_locate_cmd()
772 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); in idetape_create_locate_cmd()
773 pc->c[8] = partition; in idetape_create_locate_cmd()
774 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_locate_cmd()
806 struct ide_atapi_pc pc; in idetape_position_tape() local
811 idetape_create_locate_cmd(drive, &pc, block, partition, skip); in idetape_position_tape()
812 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_position_tape()
886 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) in idetape_create_inquiry_cmd() argument
888 ide_init_pc(pc); in idetape_create_inquiry_cmd()
889 pc->c[0] = INQUIRY; in idetape_create_inquiry_cmd()
890 pc->c[4] = 254; in idetape_create_inquiry_cmd()
891 pc->req_xfer = 254; in idetape_create_inquiry_cmd()
895 struct ide_atapi_pc *pc) in idetape_create_rewind_cmd() argument
897 ide_init_pc(pc); in idetape_create_rewind_cmd()
898 pc->c[0] = REZERO_UNIT; in idetape_create_rewind_cmd()
899 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_rewind_cmd()
902 static void idetape_create_erase_cmd(struct ide_atapi_pc *pc) in idetape_create_erase_cmd() argument
904 ide_init_pc(pc); in idetape_create_erase_cmd()
905 pc->c[0] = ERASE; in idetape_create_erase_cmd()
906 pc->c[1] = 1; in idetape_create_erase_cmd()
907 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_erase_cmd()
910 static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd) in idetape_create_space_cmd() argument
912 ide_init_pc(pc); in idetape_create_space_cmd()
913 pc->c[0] = SPACE; in idetape_create_space_cmd()
914 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); in idetape_create_space_cmd()
915 pc->c[1] = cmd; in idetape_create_space_cmd()
916 pc->flags |= PC_FLAG_WAIT_FOR_DSC; in idetape_create_space_cmd()
1011 struct ide_atapi_pc pc; in idetape_rewind_tape() local
1016 idetape_create_rewind_cmd(drive, &pc); in idetape_rewind_tape()
1017 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_rewind_tape()
1066 struct ide_atapi_pc pc; in idetape_space_over_filemarks() local
1092 idetape_create_space_cmd(&pc, mt_count - count, in idetape_space_over_filemarks()
1094 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_space_over_filemarks()
1228 struct ide_atapi_pc pc; in idetape_write_filemark() local
1231 idetape_create_write_filemark_cmd(drive, &pc, 1); in idetape_write_filemark()
1232 if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { in idetape_write_filemark()
1256 struct ide_atapi_pc pc; in idetape_mtioctop() local
1317 idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); in idetape_mtioctop()
1318 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_mtioctop()
1321 idetape_create_erase_cmd(&pc); in idetape_mtioctop()
1322 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); in idetape_mtioctop()
1440 struct ide_atapi_pc pc; in ide_tape_get_bsize_from_bdesc() local
1443 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); in ide_tape_get_bsize_from_bdesc()
1444 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { in ide_tape_get_bsize_from_bdesc()
1604 struct ide_atapi_pc pc; in idetape_get_inquiry_results() local
1608 idetape_create_inquiry_cmd(&pc); in idetape_get_inquiry_results()
1609 if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { in idetape_get_inquiry_results()
1633 struct ide_atapi_pc pc; in idetape_get_mode_sense_results() local
1637 idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); in idetape_get_mode_sense_results()
1638 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { in idetape_get_mode_sense_results()