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(scsi_req(rq)->cmd, pc->c, 12); in ide_tape_create_rw_cmd()
571 struct ide_atapi_pc *pc = NULL; in idetape_do_request() local
585 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { in idetape_do_request()
586 pc = drive->failed_pc; 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()
637 pc = &tape->queued_pc; in idetape_do_request()
638 ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); in idetape_do_request()
642 pc = (struct ide_atapi_pc *)rq->special; in idetape_do_request()
667 return ide_tape_issue_pc(drive, &cmd, pc); in idetape_do_request()
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()
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()
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()
741 if (!pc.error) { 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()
808 struct ide_atapi_pc pc; in idetape_position_tape() local
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()
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()
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()
1068 struct ide_atapi_pc pc; in idetape_space_over_filemarks() local
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()
1230 struct ide_atapi_pc pc; in idetape_write_filemark() local
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()
1258 struct ide_atapi_pc pc; in idetape_mtioctop() local
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()
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()
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()
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()