diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-06-13 06:00:54 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-06-13 06:00:54 -0400 |
commit | 8dcce4081305d3d1629190edd112e6473c315cbc (patch) | |
tree | 343c7167f6a3d2a77b01d50cf54c67bdd6faccd1 /drivers/ide/ide-tape.c | |
parent | f3ad116588151b3371ae4e092290e4f48e62b8bb (diff) | |
parent | 103f7033bd0f7b65ff3e0a5ea72449d08010b031 (diff) |
Merge branch 'bp-remove-pc-buf' into for-next
Conflicts:
drivers/ide/ide-tape.c
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 174 |
1 files changed, 83 insertions, 91 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 4b447a8a49d4..bb71e1e99dad 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -279,10 +279,12 @@ static void ide_tape_put(struct ide_tape_obj *tape) | |||
279 | * called on each failed packet command retry to analyze the request sense. We | 279 | * called on each failed packet command retry to analyze the request sense. We |
280 | * currently do not utilize this information. | 280 | * currently do not utilize this information. |
281 | */ | 281 | */ |
282 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | 282 | static void idetape_analyze_error(ide_drive_t *drive) |
283 | { | 283 | { |
284 | idetape_tape_t *tape = drive->driver_data; | 284 | idetape_tape_t *tape = drive->driver_data; |
285 | struct ide_atapi_pc *pc = drive->failed_pc; | 285 | struct ide_atapi_pc *pc = drive->failed_pc; |
286 | struct request *rq = drive->hwif->rq; | ||
287 | u8 *sense = bio_data(rq->bio); | ||
286 | 288 | ||
287 | tape->sense_key = sense[2] & 0xF; | 289 | tape->sense_key = sense[2] & 0xF; |
288 | tape->asc = sense[12]; | 290 | tape->asc = sense[12]; |
@@ -291,11 +293,9 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | |||
291 | debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", | 293 | debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", |
292 | pc->c[0], tape->sense_key, tape->asc, tape->ascq); | 294 | pc->c[0], tape->sense_key, tape->asc, tape->ascq); |
293 | 295 | ||
294 | /* Correct pc->xferred by asking the tape. */ | 296 | /* correct remaining bytes to transfer */ |
295 | if (pc->flags & PC_FLAG_DMA_ERROR) | 297 | if (pc->flags & PC_FLAG_DMA_ERROR) |
296 | pc->xferred = pc->req_xfer - | 298 | rq->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); |
297 | tape->blk_size * | ||
298 | get_unaligned_be32(&sense[3]); | ||
299 | 299 | ||
300 | /* | 300 | /* |
301 | * If error was the result of a zero-length read or write command, | 301 | * If error was the result of a zero-length read or write command, |
@@ -329,7 +329,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | |||
329 | pc->flags |= PC_FLAG_ABORT; | 329 | pc->flags |= PC_FLAG_ABORT; |
330 | } | 330 | } |
331 | if (!(pc->flags & PC_FLAG_ABORT) && | 331 | if (!(pc->flags & PC_FLAG_ABORT) && |
332 | pc->xferred) | 332 | (blk_rq_bytes(rq) - rq->resid_len)) |
333 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; | 333 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; |
334 | } | 334 | } |
335 | } | 335 | } |
@@ -354,12 +354,13 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc) | |||
354 | 354 | ||
355 | if (pc->c[0] == REQUEST_SENSE) { | 355 | if (pc->c[0] == REQUEST_SENSE) { |
356 | if (uptodate) | 356 | if (uptodate) |
357 | idetape_analyze_error(drive, pc->buf); | 357 | idetape_analyze_error(drive); |
358 | else | 358 | else |
359 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " | 359 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " |
360 | "itself - Aborting request!\n"); | 360 | "itself - Aborting request!\n"); |
361 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { | 361 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
362 | int blocks = pc->xferred / tape->blk_size; | 362 | unsigned int blocks = |
363 | (blk_rq_bytes(rq) - rq->resid_len) / tape->blk_size; | ||
363 | 364 | ||
364 | tape->avg_size += blocks * tape->blk_size; | 365 | tape->avg_size += blocks * tape->blk_size; |
365 | 366 | ||
@@ -371,38 +372,12 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc) | |||
371 | } | 372 | } |
372 | 373 | ||
373 | tape->first_frame += blocks; | 374 | tape->first_frame += blocks; |
374 | rq->resid_len -= blocks * tape->blk_size; | ||
375 | 375 | ||
376 | if (pc->error) { | 376 | if (pc->error) { |
377 | uptodate = 0; | 377 | uptodate = 0; |
378 | err = pc->error; | 378 | err = pc->error; |
379 | } | 379 | } |
380 | } else if (pc->c[0] == READ_POSITION && uptodate) { | ||
381 | u8 *readpos = pc->buf; | ||
382 | |||
383 | debug_log(DBG_SENSE, "BOP - %s\n", | ||
384 | (readpos[0] & 0x80) ? "Yes" : "No"); | ||
385 | debug_log(DBG_SENSE, "EOP - %s\n", | ||
386 | (readpos[0] & 0x40) ? "Yes" : "No"); | ||
387 | |||
388 | if (readpos[0] & 0x4) { | ||
389 | printk(KERN_INFO "ide-tape: Block location is unknown" | ||
390 | "to the tape\n"); | ||
391 | clear_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), | ||
392 | &drive->atapi_flags); | ||
393 | uptodate = 0; | ||
394 | err = IDE_DRV_ERROR_GENERAL; | ||
395 | } else { | ||
396 | debug_log(DBG_SENSE, "Block Location - %u\n", | ||
397 | be32_to_cpup((__be32 *)&readpos[4])); | ||
398 | |||
399 | tape->partition = readpos[1]; | ||
400 | tape->first_frame = be32_to_cpup((__be32 *)&readpos[4]); | ||
401 | set_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), | ||
402 | &drive->atapi_flags); | ||
403 | } | ||
404 | } | 380 | } |
405 | |||
406 | rq->errors = err; | 381 | rq->errors = err; |
407 | 382 | ||
408 | return uptodate; | 383 | return uptodate; |
@@ -477,6 +452,7 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, | |||
477 | struct ide_atapi_pc *pc) | 452 | struct ide_atapi_pc *pc) |
478 | { | 453 | { |
479 | idetape_tape_t *tape = drive->driver_data; | 454 | idetape_tape_t *tape = drive->driver_data; |
455 | struct request *rq = drive->hwif->rq; | ||
480 | 456 | ||
481 | if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) | 457 | if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) |
482 | drive->failed_pc = pc; | 458 | drive->failed_pc = pc; |
@@ -486,7 +462,6 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, | |||
486 | 462 | ||
487 | if (pc->retries > IDETAPE_MAX_PC_RETRIES || | 463 | if (pc->retries > IDETAPE_MAX_PC_RETRIES || |
488 | (pc->flags & PC_FLAG_ABORT)) { | 464 | (pc->flags & PC_FLAG_ABORT)) { |
489 | unsigned int done = blk_rq_bytes(drive->hwif->rq); | ||
490 | 465 | ||
491 | /* | 466 | /* |
492 | * We will "abort" retrying a packet command in case legitimate | 467 | * We will "abort" retrying a packet command in case legitimate |
@@ -510,7 +485,7 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, | |||
510 | 485 | ||
511 | drive->failed_pc = NULL; | 486 | drive->failed_pc = NULL; |
512 | drive->pc_callback(drive, 0); | 487 | drive->pc_callback(drive, 0); |
513 | ide_complete_rq(drive, -EIO, done); | 488 | ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); |
514 | return ide_stopped; | 489 | return ide_stopped; |
515 | } | 490 | } |
516 | debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); | 491 | debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); |
@@ -579,15 +554,13 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape, | |||
579 | struct ide_atapi_pc *pc, struct request *rq, | 554 | struct ide_atapi_pc *pc, struct request *rq, |
580 | u8 opcode) | 555 | u8 opcode) |
581 | { | 556 | { |
582 | unsigned int length = blk_rq_sectors(rq); | 557 | unsigned int length = blk_rq_sectors(rq) / (tape->blk_size >> 9); |
583 | 558 | ||
584 | ide_init_pc(pc); | 559 | ide_init_pc(pc); |
585 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); | 560 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
586 | pc->c[1] = 1; | 561 | pc->c[1] = 1; |
587 | pc->buf = NULL; | 562 | |
588 | pc->buf_size = length * tape->blk_size; | 563 | if (blk_rq_bytes(rq) == tape->buffer_size) |
589 | pc->req_xfer = pc->buf_size; | ||
590 | if (pc->req_xfer == tape->buffer_size) | ||
591 | pc->flags |= PC_FLAG_DMA_OK; | 564 | pc->flags |= PC_FLAG_DMA_OK; |
592 | 565 | ||
593 | if (opcode == READ_6) | 566 | if (opcode == READ_6) |
@@ -713,7 +686,7 @@ out: | |||
713 | 686 | ||
714 | cmd.rq = rq; | 687 | cmd.rq = rq; |
715 | 688 | ||
716 | ide_init_sg_cmd(&cmd, pc->req_xfer); | 689 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
717 | ide_map_sg(drive, &cmd); | 690 | ide_map_sg(drive, &cmd); |
718 | 691 | ||
719 | return ide_tape_issue_pc(drive, &cmd, pc); | 692 | return ide_tape_issue_pc(drive, &cmd, pc); |
@@ -767,33 +740,53 @@ static int idetape_flush_tape_buffers(ide_drive_t *drive) | |||
767 | int rc; | 740 | int rc; |
768 | 741 | ||
769 | idetape_create_write_filemark_cmd(drive, &pc, 0); | 742 | idetape_create_write_filemark_cmd(drive, &pc, 0); |
770 | rc = ide_queue_pc_tail(drive, tape->disk, &pc); | 743 | rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); |
771 | if (rc) | 744 | if (rc) |
772 | return rc; | 745 | return rc; |
773 | idetape_wait_ready(drive, 60 * 5 * HZ); | 746 | idetape_wait_ready(drive, 60 * 5 * HZ); |
774 | return 0; | 747 | return 0; |
775 | } | 748 | } |
776 | 749 | ||
777 | static void idetape_create_read_position_cmd(struct ide_atapi_pc *pc) | 750 | static int ide_tape_read_position(ide_drive_t *drive) |
778 | { | ||
779 | ide_init_pc(pc); | ||
780 | pc->c[0] = READ_POSITION; | ||
781 | pc->req_xfer = 20; | ||
782 | } | ||
783 | |||
784 | static int idetape_read_position(ide_drive_t *drive) | ||
785 | { | 751 | { |
786 | idetape_tape_t *tape = drive->driver_data; | 752 | idetape_tape_t *tape = drive->driver_data; |
787 | struct ide_atapi_pc pc; | 753 | struct ide_atapi_pc pc; |
788 | int position; | 754 | u8 buf[20]; |
789 | 755 | ||
790 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 756 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
791 | 757 | ||
792 | idetape_create_read_position_cmd(&pc); | 758 | /* prep cmd */ |
793 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) | 759 | ide_init_pc(&pc); |
760 | pc.c[0] = READ_POSITION; | ||
761 | pc.req_xfer = 20; | ||
762 | |||
763 | if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) | ||
794 | return -1; | 764 | return -1; |
795 | position = tape->first_frame; | 765 | |
796 | return position; | 766 | if (!pc.error) { |
767 | debug_log(DBG_SENSE, "BOP - %s\n", | ||
768 | (buf[0] & 0x80) ? "Yes" : "No"); | ||
769 | debug_log(DBG_SENSE, "EOP - %s\n", | ||
770 | (buf[0] & 0x40) ? "Yes" : "No"); | ||
771 | |||
772 | if (buf[0] & 0x4) { | ||
773 | printk(KERN_INFO "ide-tape: Block location is unknown" | ||
774 | "to the tape\n"); | ||
775 | clear_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), | ||
776 | &drive->atapi_flags); | ||
777 | return -1; | ||
778 | } else { | ||
779 | debug_log(DBG_SENSE, "Block Location - %u\n", | ||
780 | be32_to_cpup((__be32 *)&buf[4])); | ||
781 | |||
782 | tape->partition = buf[1]; | ||
783 | tape->first_frame = be32_to_cpup((__be32 *)&buf[4]); | ||
784 | set_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), | ||
785 | &drive->atapi_flags); | ||
786 | } | ||
787 | } | ||
788 | |||
789 | return tape->first_frame; | ||
797 | } | 790 | } |
798 | 791 | ||
799 | static void idetape_create_locate_cmd(ide_drive_t *drive, | 792 | static void idetape_create_locate_cmd(ide_drive_t *drive, |
@@ -836,19 +829,21 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block, | |||
836 | { | 829 | { |
837 | idetape_tape_t *tape = drive->driver_data; | 830 | idetape_tape_t *tape = drive->driver_data; |
838 | struct gendisk *disk = tape->disk; | 831 | struct gendisk *disk = tape->disk; |
839 | int retval; | 832 | int ret; |
840 | struct ide_atapi_pc pc; | 833 | struct ide_atapi_pc pc; |
841 | 834 | ||
842 | if (tape->chrdev_dir == IDETAPE_DIR_READ) | 835 | if (tape->chrdev_dir == IDETAPE_DIR_READ) |
843 | __ide_tape_discard_merge_buffer(drive); | 836 | __ide_tape_discard_merge_buffer(drive); |
844 | idetape_wait_ready(drive, 60 * 5 * HZ); | 837 | idetape_wait_ready(drive, 60 * 5 * HZ); |
845 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); | 838 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); |
846 | retval = ide_queue_pc_tail(drive, disk, &pc); | 839 | ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
847 | if (retval) | 840 | if (ret) |
848 | return (retval); | 841 | return ret; |
849 | 842 | ||
850 | idetape_create_read_position_cmd(&pc); | 843 | ret = ide_tape_read_position(drive); |
851 | return ide_queue_pc_tail(drive, disk, &pc); | 844 | if (ret < 0) |
845 | return ret; | ||
846 | return 0; | ||
852 | } | 847 | } |
853 | 848 | ||
854 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, | 849 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, |
@@ -859,7 +854,7 @@ static void ide_tape_discard_merge_buffer(ide_drive_t *drive, | |||
859 | 854 | ||
860 | __ide_tape_discard_merge_buffer(drive); | 855 | __ide_tape_discard_merge_buffer(drive); |
861 | if (restore_position) { | 856 | if (restore_position) { |
862 | position = idetape_read_position(drive); | 857 | position = ide_tape_read_position(drive); |
863 | seek = position > 0 ? position : 0; | 858 | seek = position > 0 ? position : 0; |
864 | if (idetape_position_tape(drive, seek, 0, 0)) { | 859 | if (idetape_position_tape(drive, seek, 0, 0)) { |
865 | printk(KERN_INFO "ide-tape: %s: position_tape failed in" | 860 | printk(KERN_INFO "ide-tape: %s: position_tape failed in" |
@@ -1039,20 +1034,19 @@ static int idetape_rewind_tape(ide_drive_t *drive) | |||
1039 | { | 1034 | { |
1040 | struct ide_tape_obj *tape = drive->driver_data; | 1035 | struct ide_tape_obj *tape = drive->driver_data; |
1041 | struct gendisk *disk = tape->disk; | 1036 | struct gendisk *disk = tape->disk; |
1042 | int retval; | ||
1043 | struct ide_atapi_pc pc; | 1037 | struct ide_atapi_pc pc; |
1038 | int ret; | ||
1044 | 1039 | ||
1045 | debug_log(DBG_SENSE, "Enter %s\n", __func__); | 1040 | debug_log(DBG_SENSE, "Enter %s\n", __func__); |
1046 | 1041 | ||
1047 | idetape_create_rewind_cmd(drive, &pc); | 1042 | idetape_create_rewind_cmd(drive, &pc); |
1048 | retval = ide_queue_pc_tail(drive, disk, &pc); | 1043 | ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1049 | if (retval) | 1044 | if (ret) |
1050 | return retval; | 1045 | return ret; |
1051 | 1046 | ||
1052 | idetape_create_read_position_cmd(&pc); | 1047 | ret = ide_tape_read_position(drive); |
1053 | retval = ide_queue_pc_tail(drive, disk, &pc); | 1048 | if (ret < 0) |
1054 | if (retval) | 1049 | return ret; |
1055 | return retval; | ||
1056 | return 0; | 1050 | return 0; |
1057 | } | 1051 | } |
1058 | 1052 | ||
@@ -1119,7 +1113,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
1119 | case MTBSF: | 1113 | case MTBSF: |
1120 | idetape_create_space_cmd(&pc, mt_count - count, | 1114 | idetape_create_space_cmd(&pc, mt_count - count, |
1121 | IDETAPE_SPACE_OVER_FILEMARK); | 1115 | IDETAPE_SPACE_OVER_FILEMARK); |
1122 | return ide_queue_pc_tail(drive, disk, &pc); | 1116 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1123 | case MTFSFM: | 1117 | case MTFSFM: |
1124 | case MTBSFM: | 1118 | case MTBSFM: |
1125 | if (!sprev) | 1119 | if (!sprev) |
@@ -1259,7 +1253,7 @@ static int idetape_write_filemark(ide_drive_t *drive) | |||
1259 | 1253 | ||
1260 | /* Write a filemark */ | 1254 | /* Write a filemark */ |
1261 | idetape_create_write_filemark_cmd(drive, &pc, 1); | 1255 | idetape_create_write_filemark_cmd(drive, &pc, 1); |
1262 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { | 1256 | if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { |
1263 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); | 1257 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); |
1264 | return -EIO; | 1258 | return -EIO; |
1265 | } | 1259 | } |
@@ -1345,11 +1339,11 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
1345 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); | 1339 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); |
1346 | case MTEOM: | 1340 | case MTEOM: |
1347 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); | 1341 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); |
1348 | return ide_queue_pc_tail(drive, disk, &pc); | 1342 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1349 | case MTERASE: | 1343 | case MTERASE: |
1350 | (void)idetape_rewind_tape(drive); | 1344 | (void)idetape_rewind_tape(drive); |
1351 | idetape_create_erase_cmd(&pc); | 1345 | idetape_create_erase_cmd(&pc); |
1352 | return ide_queue_pc_tail(drive, disk, &pc); | 1346 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1353 | case MTSETBLK: | 1347 | case MTSETBLK: |
1354 | if (mt_count) { | 1348 | if (mt_count) { |
1355 | if (mt_count < tape->blk_size || | 1349 | if (mt_count < tape->blk_size || |
@@ -1415,7 +1409,7 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, | |||
1415 | if (cmd == MTIOCGET || cmd == MTIOCPOS) { | 1409 | if (cmd == MTIOCGET || cmd == MTIOCPOS) { |
1416 | block_offset = tape->valid / | 1410 | block_offset = tape->valid / |
1417 | (tape->blk_size * tape->user_bs_factor); | 1411 | (tape->blk_size * tape->user_bs_factor); |
1418 | position = idetape_read_position(drive); | 1412 | position = ide_tape_read_position(drive); |
1419 | if (position < 0) | 1413 | if (position < 0) |
1420 | return -EIO; | 1414 | return -EIO; |
1421 | } | 1415 | } |
@@ -1458,9 +1452,10 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | |||
1458 | { | 1452 | { |
1459 | idetape_tape_t *tape = drive->driver_data; | 1453 | idetape_tape_t *tape = drive->driver_data; |
1460 | struct ide_atapi_pc pc; | 1454 | struct ide_atapi_pc pc; |
1455 | u8 buf[12]; | ||
1461 | 1456 | ||
1462 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | 1457 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); |
1463 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { | 1458 | if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { |
1464 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | 1459 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); |
1465 | if (tape->blk_size == 0) { | 1460 | if (tape->blk_size == 0) { |
1466 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " | 1461 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " |
@@ -1469,10 +1464,10 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | |||
1469 | } | 1464 | } |
1470 | return; | 1465 | return; |
1471 | } | 1466 | } |
1472 | tape->blk_size = (pc.buf[4 + 5] << 16) + | 1467 | tape->blk_size = (buf[4 + 5] << 16) + |
1473 | (pc.buf[4 + 6] << 8) + | 1468 | (buf[4 + 6] << 8) + |
1474 | pc.buf[4 + 7]; | 1469 | buf[4 + 7]; |
1475 | tape->drv_write_prot = (pc.buf[2] & 0x80) >> 7; | 1470 | tape->drv_write_prot = (buf[2] & 0x80) >> 7; |
1476 | } | 1471 | } |
1477 | 1472 | ||
1478 | static int idetape_chrdev_open(struct inode *inode, struct file *filp) | 1473 | static int idetape_chrdev_open(struct inode *inode, struct file *filp) |
@@ -1615,17 +1610,14 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
1615 | char fw_rev[4], vendor_id[8], product_id[16]; | 1610 | char fw_rev[4], vendor_id[8], product_id[16]; |
1616 | 1611 | ||
1617 | idetape_create_inquiry_cmd(&pc); | 1612 | idetape_create_inquiry_cmd(&pc); |
1618 | pc.buf = &pc_buf[0]; | 1613 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { |
1619 | pc.buf_size = sizeof(pc_buf); | ||
1620 | |||
1621 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { | ||
1622 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", | 1614 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", |
1623 | tape->name); | 1615 | tape->name); |
1624 | return; | 1616 | return; |
1625 | } | 1617 | } |
1626 | memcpy(vendor_id, &pc.buf[8], 8); | 1618 | memcpy(vendor_id, &pc_buf[8], 8); |
1627 | memcpy(product_id, &pc.buf[16], 16); | 1619 | memcpy(product_id, &pc_buf[16], 16); |
1628 | memcpy(fw_rev, &pc.buf[32], 4); | 1620 | memcpy(fw_rev, &pc_buf[32], 4); |
1629 | 1621 | ||
1630 | ide_fixstring(vendor_id, 8, 0); | 1622 | ide_fixstring(vendor_id, 8, 0); |
1631 | ide_fixstring(product_id, 16, 0); | 1623 | ide_fixstring(product_id, 16, 0); |
@@ -1643,11 +1635,11 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
1643 | { | 1635 | { |
1644 | idetape_tape_t *tape = drive->driver_data; | 1636 | idetape_tape_t *tape = drive->driver_data; |
1645 | struct ide_atapi_pc pc; | 1637 | struct ide_atapi_pc pc; |
1646 | u8 *caps; | 1638 | u8 buf[24], *caps; |
1647 | u8 speed, max_speed; | 1639 | u8 speed, max_speed; |
1648 | 1640 | ||
1649 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); | 1641 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); |
1650 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { | 1642 | if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { |
1651 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" | 1643 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" |
1652 | " some default values\n"); | 1644 | " some default values\n"); |
1653 | tape->blk_size = 512; | 1645 | tape->blk_size = 512; |
@@ -1656,7 +1648,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
1656 | put_unaligned(6*52, (u16 *)&tape->caps[16]); | 1648 | put_unaligned(6*52, (u16 *)&tape->caps[16]); |
1657 | return; | 1649 | return; |
1658 | } | 1650 | } |
1659 | caps = pc.buf + 4 + pc.buf[3]; | 1651 | caps = buf + 4 + buf[3]; |
1660 | 1652 | ||
1661 | /* convert to host order and save for later use */ | 1653 | /* convert to host order and save for later use */ |
1662 | speed = be16_to_cpup((__be16 *)&caps[14]); | 1654 | speed = be16_to_cpup((__be16 *)&caps[14]); |