aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c251
1 files changed, 114 insertions, 137 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index ce3a23e18ce9..3f9dcca6f092 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -181,34 +181,6 @@ struct idetape_bh {
181 char *b_data; 181 char *b_data;
182}; 182};
183 183
184typedef struct idetape_packet_command_s {
185 /* Actual packet bytes */
186 u8 c[12];
187 /* On each retry, we increment retries */
188 int retries;
189 /* Error code */
190 int error;
191 /* Bytes to transfer */
192 int request_transfer;
193 /* Bytes actually transferred */
194 int actually_transferred;
195 /* Size of our data buffer */
196 int buffer_size;
197 struct idetape_bh *bh;
198 char *b_data;
199 int b_count;
200 /* Data buffer */
201 u8 *buffer;
202 /* Pointer into the above buffer */
203 u8 *current_position;
204 /* Called when this packet command is completed */
205 ide_startstop_t (*callback) (ide_drive_t *);
206 /* Temporary buffer */
207 u8 pc_buffer[IDETAPE_PC_BUFFER_SIZE];
208 /* Status/Action bit flags: long for set_bit */
209 unsigned long flags;
210} idetape_pc_t;
211
212/* Packet command flag bits. */ 184/* Packet command flag bits. */
213enum { 185enum {
214 /* Set when an error is considered normal - We won't retry */ 186 /* Set when an error is considered normal - We won't retry */
@@ -316,11 +288,11 @@ typedef struct ide_tape_obj {
316 * retry, to get detailed information on what went wrong. 288 * retry, to get detailed information on what went wrong.
317 */ 289 */
318 /* Current packet command */ 290 /* Current packet command */
319 idetape_pc_t *pc; 291 struct ide_atapi_pc *pc;
320 /* Last failed packet command */ 292 /* Last failed packet command */
321 idetape_pc_t *failed_pc; 293 struct ide_atapi_pc *failed_pc;
322 /* Packet command stack */ 294 /* Packet command stack */
323 idetape_pc_t pc_stack[IDETAPE_PC_STACK]; 295 struct ide_atapi_pc pc_stack[IDETAPE_PC_STACK];
324 /* Next free packet command storage space */ 296 /* Next free packet command storage space */
325 int pc_stack_index; 297 int pc_stack_index;
326 struct request rq_stack[IDETAPE_PC_STACK]; 298 struct request rq_stack[IDETAPE_PC_STACK];
@@ -524,7 +496,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i)
524 return tape; 496 return tape;
525} 497}
526 498
527static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, 499static void idetape_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
528 unsigned int bcount) 500 unsigned int bcount)
529{ 501{
530 struct idetape_bh *bh = pc->bh; 502 struct idetape_bh *bh = pc->bh;
@@ -553,7 +525,7 @@ static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc,
553 pc->bh = bh; 525 pc->bh = bh;
554} 526}
555 527
556static void idetape_output_buffers(ide_drive_t *drive, idetape_pc_t *pc, 528static void idetape_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
557 unsigned int bcount) 529 unsigned int bcount)
558{ 530{
559 struct idetape_bh *bh = pc->bh; 531 struct idetape_bh *bh = pc->bh;
@@ -581,11 +553,11 @@ static void idetape_output_buffers(ide_drive_t *drive, idetape_pc_t *pc,
581 } 553 }
582} 554}
583 555
584static void idetape_update_buffers(idetape_pc_t *pc) 556static void idetape_update_buffers(struct ide_atapi_pc *pc)
585{ 557{
586 struct idetape_bh *bh = pc->bh; 558 struct idetape_bh *bh = pc->bh;
587 int count; 559 int count;
588 unsigned int bcount = pc->actually_transferred; 560 unsigned int bcount = pc->xferred;
589 561
590 if (pc->flags & PC_FLAG_WRITING) 562 if (pc->flags & PC_FLAG_WRITING)
591 return; 563 return;
@@ -610,7 +582,7 @@ static void idetape_update_buffers(idetape_pc_t *pc)
610 * driver. A storage space for a maximum of IDETAPE_PC_STACK packet 582 * driver. A storage space for a maximum of IDETAPE_PC_STACK packet
611 * commands is allocated at initialization time. 583 * commands is allocated at initialization time.
612 */ 584 */
613static idetape_pc_t *idetape_next_pc_storage(ide_drive_t *drive) 585static struct ide_atapi_pc *idetape_next_pc_storage(ide_drive_t *drive)
614{ 586{
615 idetape_tape_t *tape = drive->driver_data; 587 idetape_tape_t *tape = drive->driver_data;
616 588
@@ -645,14 +617,14 @@ static struct request *idetape_next_rq_storage(ide_drive_t *drive)
645 return (&tape->rq_stack[tape->rq_stack_index++]); 617 return (&tape->rq_stack[tape->rq_stack_index++]);
646} 618}
647 619
648static void idetape_init_pc(idetape_pc_t *pc) 620static void idetape_init_pc(struct ide_atapi_pc *pc)
649{ 621{
650 memset(pc->c, 0, 12); 622 memset(pc->c, 0, 12);
651 pc->retries = 0; 623 pc->retries = 0;
652 pc->flags = 0; 624 pc->flags = 0;
653 pc->request_transfer = 0; 625 pc->req_xfer = 0;
654 pc->buffer = pc->pc_buffer; 626 pc->buf = pc->pc_buf;
655 pc->buffer_size = IDETAPE_PC_BUFFER_SIZE; 627 pc->buf_size = IDETAPE_PC_BUFFER_SIZE;
656 pc->bh = NULL; 628 pc->bh = NULL;
657 pc->b_data = NULL; 629 pc->b_data = NULL;
658} 630}
@@ -664,7 +636,7 @@ static void idetape_init_pc(idetape_pc_t *pc)
664static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) 636static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
665{ 637{
666 idetape_tape_t *tape = drive->driver_data; 638 idetape_tape_t *tape = drive->driver_data;
667 idetape_pc_t *pc = tape->failed_pc; 639 struct ide_atapi_pc *pc = tape->failed_pc;
668 640
669 tape->sense_key = sense[2] & 0xF; 641 tape->sense_key = sense[2] & 0xF;
670 tape->asc = sense[12]; 642 tape->asc = sense[12];
@@ -673,9 +645,9 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
673 debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", 645 debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n",
674 pc->c[0], tape->sense_key, tape->asc, tape->ascq); 646 pc->c[0], tape->sense_key, tape->asc, tape->ascq);
675 647
676 /* Correct pc->actually_transferred by asking the tape. */ 648 /* Correct pc->xferred by asking the tape. */
677 if (pc->flags & PC_FLAG_DMA_ERROR) { 649 if (pc->flags & PC_FLAG_DMA_ERROR) {
678 pc->actually_transferred = pc->request_transfer - 650 pc->xferred = pc->req_xfer -
679 tape->blk_size * 651 tape->blk_size *
680 be32_to_cpu(get_unaligned((u32 *)&sense[3])); 652 be32_to_cpu(get_unaligned((u32 *)&sense[3]));
681 idetape_update_buffers(pc); 653 idetape_update_buffers(pc);
@@ -713,7 +685,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
713 pc->flags |= PC_FLAG_ABORT; 685 pc->flags |= PC_FLAG_ABORT;
714 } 686 }
715 if (!(pc->flags & PC_FLAG_ABORT) && 687 if (!(pc->flags & PC_FLAG_ABORT) &&
716 pc->actually_transferred) 688 pc->xferred)
717 pc->retries = IDETAPE_MAX_PC_RETRIES + 1; 689 pc->retries = IDETAPE_MAX_PC_RETRIES + 1;
718 } 690 }
719} 691}
@@ -922,7 +894,7 @@ static ide_startstop_t idetape_request_sense_callback(ide_drive_t *drive)
922 debug_log(DBG_PROCS, "Enter %s\n", __func__); 894 debug_log(DBG_PROCS, "Enter %s\n", __func__);
923 895
924 if (!tape->pc->error) { 896 if (!tape->pc->error) {
925 idetape_analyze_error(drive, tape->pc->buffer); 897 idetape_analyze_error(drive, tape->pc->buf);
926 idetape_end_request(drive, 1, 0); 898 idetape_end_request(drive, 1, 0);
927 } else { 899 } else {
928 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - " 900 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - "
@@ -932,13 +904,13 @@ static ide_startstop_t idetape_request_sense_callback(ide_drive_t *drive)
932 return ide_stopped; 904 return ide_stopped;
933} 905}
934 906
935static void idetape_create_request_sense_cmd(idetape_pc_t *pc) 907static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
936{ 908{
937 idetape_init_pc(pc); 909 idetape_init_pc(pc);
938 pc->c[0] = REQUEST_SENSE; 910 pc->c[0] = REQUEST_SENSE;
939 pc->c[4] = 20; 911 pc->c[4] = 20;
940 pc->request_transfer = 20; 912 pc->req_xfer = 20;
941 pc->callback = &idetape_request_sense_callback; 913 pc->idetape_callback = &idetape_request_sense_callback;
942} 914}
943 915
944static void idetape_init_rq(struct request *rq, u8 cmd) 916static void idetape_init_rq(struct request *rq, u8 cmd)
@@ -963,7 +935,7 @@ static void idetape_init_rq(struct request *rq, u8 cmd)
963 * handling functions should queue request to the lower level part and wait for 935 * handling functions should queue request to the lower level part and wait for
964 * their completion using idetape_queue_pc_tail or idetape_queue_rw_tail. 936 * their completion using idetape_queue_pc_tail or idetape_queue_rw_tail.
965 */ 937 */
966static void idetape_queue_pc_head(ide_drive_t *drive, idetape_pc_t *pc, 938static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
967 struct request *rq) 939 struct request *rq)
968{ 940{
969 struct ide_tape_obj *tape = drive->driver_data; 941 struct ide_tape_obj *tape = drive->driver_data;
@@ -982,7 +954,7 @@ static void idetape_queue_pc_head(ide_drive_t *drive, idetape_pc_t *pc,
982static ide_startstop_t idetape_retry_pc (ide_drive_t *drive) 954static ide_startstop_t idetape_retry_pc (ide_drive_t *drive)
983{ 955{
984 idetape_tape_t *tape = drive->driver_data; 956 idetape_tape_t *tape = drive->driver_data;
985 idetape_pc_t *pc; 957 struct ide_atapi_pc *pc;
986 struct request *rq; 958 struct request *rq;
987 959
988 (void)ide_read_error(drive); 960 (void)ide_read_error(drive);
@@ -1008,7 +980,7 @@ static void idetape_postpone_request(ide_drive_t *drive)
1008 ide_stall_queue(drive, tape->dsc_poll_freq); 980 ide_stall_queue(drive, tape->dsc_poll_freq);
1009} 981}
1010 982
1011typedef void idetape_io_buf(ide_drive_t *, idetape_pc_t *, unsigned int); 983typedef void idetape_io_buf(ide_drive_t *, struct ide_atapi_pc *, unsigned int);
1012 984
1013/* 985/*
1014 * This is the usual interrupt handler which will be called during a packet 986 * This is the usual interrupt handler which will be called during a packet
@@ -1021,7 +993,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1021{ 993{
1022 ide_hwif_t *hwif = drive->hwif; 994 ide_hwif_t *hwif = drive->hwif;
1023 idetape_tape_t *tape = drive->driver_data; 995 idetape_tape_t *tape = drive->driver_data;
1024 idetape_pc_t *pc = tape->pc; 996 struct ide_atapi_pc *pc = tape->pc;
1025 xfer_func_t *xferfunc; 997 xfer_func_t *xferfunc;
1026 idetape_io_buf *iobuf; 998 idetape_io_buf *iobuf;
1027 unsigned int temp; 999 unsigned int temp;
@@ -1061,7 +1033,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1061 */ 1033 */
1062 pc->flags |= PC_FLAG_DMA_ERROR; 1034 pc->flags |= PC_FLAG_DMA_ERROR;
1063 } else { 1035 } else {
1064 pc->actually_transferred = pc->request_transfer; 1036 pc->xferred = pc->req_xfer;
1065 idetape_update_buffers(pc); 1037 idetape_update_buffers(pc);
1066 } 1038 }
1067 debug_log(DBG_PROCS, "DMA finished\n"); 1039 debug_log(DBG_PROCS, "DMA finished\n");
@@ -1071,7 +1043,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1071 /* No more interrupts */ 1043 /* No more interrupts */
1072 if ((stat & DRQ_STAT) == 0) { 1044 if ((stat & DRQ_STAT) == 0) {
1073 debug_log(DBG_SENSE, "Packet command completed, %d bytes" 1045 debug_log(DBG_SENSE, "Packet command completed, %d bytes"
1074 " transferred\n", pc->actually_transferred); 1046 " transferred\n", pc->xferred);
1075 1047
1076 pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; 1048 pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
1077 local_irq_enable(); 1049 local_irq_enable();
@@ -1115,7 +1087,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1115 if (tape->failed_pc == pc) 1087 if (tape->failed_pc == pc)
1116 tape->failed_pc = NULL; 1088 tape->failed_pc = NULL;
1117 /* Command finished - Call the callback function */ 1089 /* Command finished - Call the callback function */
1118 return pc->callback(drive); 1090 return pc->idetape_callback(drive);
1119 } 1091 }
1120 1092
1121 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { 1093 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -1146,9 +1118,9 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1146 } 1118 }
1147 if (!(pc->flags & PC_FLAG_WRITING)) { 1119 if (!(pc->flags & PC_FLAG_WRITING)) {
1148 /* Reading - Check that we have enough space */ 1120 /* Reading - Check that we have enough space */
1149 temp = pc->actually_transferred + bcount; 1121 temp = pc->xferred + bcount;
1150 if (temp > pc->request_transfer) { 1122 if (temp > pc->req_xfer) {
1151 if (temp > pc->buffer_size) { 1123 if (temp > pc->buf_size) {
1152 printk(KERN_ERR "ide-tape: The tape wants to " 1124 printk(KERN_ERR "ide-tape: The tape wants to "
1153 "send us more data than expected " 1125 "send us more data than expected "
1154 "- discarding data\n"); 1126 "- discarding data\n");
@@ -1170,11 +1142,11 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
1170 if (pc->bh) 1142 if (pc->bh)
1171 iobuf(drive, pc, bcount); 1143 iobuf(drive, pc, bcount);
1172 else 1144 else
1173 xferfunc(drive, pc->current_position, bcount); 1145 xferfunc(drive, pc->cur_pos, bcount);
1174 1146
1175 /* Update the current position */ 1147 /* Update the current position */
1176 pc->actually_transferred += bcount; 1148 pc->xferred += bcount;
1177 pc->current_position += bcount; 1149 pc->cur_pos += bcount;
1178 1150
1179 debug_log(DBG_SENSE, "[cmd %x] transferred %d bytes on that intr.\n", 1151 debug_log(DBG_SENSE, "[cmd %x] transferred %d bytes on that intr.\n",
1180 pc->c[0], bcount); 1152 pc->c[0], bcount);
@@ -1224,7 +1196,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
1224{ 1196{
1225 ide_hwif_t *hwif = drive->hwif; 1197 ide_hwif_t *hwif = drive->hwif;
1226 idetape_tape_t *tape = drive->driver_data; 1198 idetape_tape_t *tape = drive->driver_data;
1227 idetape_pc_t *pc = tape->pc; 1199 struct ide_atapi_pc *pc = tape->pc;
1228 int retries = 100; 1200 int retries = 100;
1229 ide_startstop_t startstop; 1201 ide_startstop_t startstop;
1230 u8 ireason; 1202 u8 ireason;
@@ -1264,7 +1236,8 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
1264 return ide_started; 1236 return ide_started;
1265} 1237}
1266 1238
1267static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, idetape_pc_t *pc) 1239static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
1240 struct ide_atapi_pc *pc)
1268{ 1241{
1269 ide_hwif_t *hwif = drive->hwif; 1242 ide_hwif_t *hwif = drive->hwif;
1270 idetape_tape_t *tape = drive->driver_data; 1243 idetape_tape_t *tape = drive->driver_data;
@@ -1304,16 +1277,16 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, idetape_pc_t *pc)
1304 pc->error = IDETAPE_ERROR_GENERAL; 1277 pc->error = IDETAPE_ERROR_GENERAL;
1305 } 1278 }
1306 tape->failed_pc = NULL; 1279 tape->failed_pc = NULL;
1307 return pc->callback(drive); 1280 return pc->idetape_callback(drive);
1308 } 1281 }
1309 debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); 1282 debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
1310 1283
1311 pc->retries++; 1284 pc->retries++;
1312 /* We haven't transferred any data yet */ 1285 /* We haven't transferred any data yet */
1313 pc->actually_transferred = 0; 1286 pc->xferred = 0;
1314 pc->current_position = pc->buffer; 1287 pc->cur_pos = pc->buf;
1315 /* Request to transfer the entire buffer at once */ 1288 /* Request to transfer the entire buffer at once */
1316 bcount = pc->request_transfer; 1289 bcount = pc->req_xfer;
1317 1290
1318 if (pc->flags & PC_FLAG_DMA_ERROR) { 1291 if (pc->flags & PC_FLAG_DMA_ERROR) {
1319 pc->flags &= ~PC_FLAG_DMA_ERROR; 1292 pc->flags &= ~PC_FLAG_DMA_ERROR;
@@ -1351,7 +1324,7 @@ static ide_startstop_t idetape_pc_callback(ide_drive_t *drive)
1351} 1324}
1352 1325
1353/* A mode sense command is used to "sense" tape parameters. */ 1326/* A mode sense command is used to "sense" tape parameters. */
1354static void idetape_create_mode_sense_cmd(idetape_pc_t *pc, u8 page_code) 1327static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code)
1355{ 1328{
1356 idetape_init_pc(pc); 1329 idetape_init_pc(pc);
1357 pc->c[0] = MODE_SENSE; 1330 pc->c[0] = MODE_SENSE;
@@ -1370,12 +1343,12 @@ static void idetape_create_mode_sense_cmd(idetape_pc_t *pc, u8 page_code)
1370 /* We will just discard data in that case */ 1343 /* We will just discard data in that case */
1371 pc->c[4] = 255; 1344 pc->c[4] = 255;
1372 if (page_code == IDETAPE_BLOCK_DESCRIPTOR) 1345 if (page_code == IDETAPE_BLOCK_DESCRIPTOR)
1373 pc->request_transfer = 12; 1346 pc->req_xfer = 12;
1374 else if (page_code == IDETAPE_CAPABILITIES_PAGE) 1347 else if (page_code == IDETAPE_CAPABILITIES_PAGE)
1375 pc->request_transfer = 24; 1348 pc->req_xfer = 24;
1376 else 1349 else
1377 pc->request_transfer = 50; 1350 pc->req_xfer = 50;
1378 pc->callback = &idetape_pc_callback; 1351 pc->idetape_callback = &idetape_pc_callback;
1379} 1352}
1380 1353
1381static void idetape_calculate_speeds(ide_drive_t *drive) 1354static void idetape_calculate_speeds(ide_drive_t *drive)
@@ -1444,7 +1417,7 @@ static void idetape_calculate_speeds(ide_drive_t *drive)
1444static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) 1417static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
1445{ 1418{
1446 idetape_tape_t *tape = drive->driver_data; 1419 idetape_tape_t *tape = drive->driver_data;
1447 idetape_pc_t *pc = tape->pc; 1420 struct ide_atapi_pc *pc = tape->pc;
1448 u8 stat; 1421 u8 stat;
1449 1422
1450 stat = ide_read_status(drive); 1423 stat = ide_read_status(drive);
@@ -1465,14 +1438,14 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
1465 pc->error = IDETAPE_ERROR_GENERAL; 1438 pc->error = IDETAPE_ERROR_GENERAL;
1466 tape->failed_pc = NULL; 1439 tape->failed_pc = NULL;
1467 } 1440 }
1468 return pc->callback(drive); 1441 return pc->idetape_callback(drive);
1469} 1442}
1470 1443
1471static ide_startstop_t idetape_rw_callback(ide_drive_t *drive) 1444static ide_startstop_t idetape_rw_callback(ide_drive_t *drive)
1472{ 1445{
1473 idetape_tape_t *tape = drive->driver_data; 1446 idetape_tape_t *tape = drive->driver_data;
1474 struct request *rq = HWGROUP(drive)->rq; 1447 struct request *rq = HWGROUP(drive)->rq;
1475 int blocks = tape->pc->actually_transferred / tape->blk_size; 1448 int blocks = tape->pc->xferred / tape->blk_size;
1476 1449
1477 tape->avg_size += blocks * tape->blk_size; 1450 tape->avg_size += blocks * tape->blk_size;
1478 tape->insert_size += blocks * tape->blk_size; 1451 tape->insert_size += blocks * tape->blk_size;
@@ -1504,39 +1477,41 @@ static ide_startstop_t idetape_rw_callback(ide_drive_t *drive)
1504 return ide_stopped; 1477 return ide_stopped;
1505} 1478}
1506 1479
1507static void idetape_create_read_cmd(idetape_tape_t *tape, idetape_pc_t *pc, 1480static void idetape_create_read_cmd(idetape_tape_t *tape,
1481 struct ide_atapi_pc *pc,
1508 unsigned int length, struct idetape_bh *bh) 1482 unsigned int length, struct idetape_bh *bh)
1509{ 1483{
1510 idetape_init_pc(pc); 1484 idetape_init_pc(pc);
1511 pc->c[0] = READ_6; 1485 pc->c[0] = READ_6;
1512 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 1486 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
1513 pc->c[1] = 1; 1487 pc->c[1] = 1;
1514 pc->callback = &idetape_rw_callback; 1488 pc->idetape_callback = &idetape_rw_callback;
1515 pc->bh = bh; 1489 pc->bh = bh;
1516 atomic_set(&bh->b_count, 0); 1490 atomic_set(&bh->b_count, 0);
1517 pc->buffer = NULL; 1491 pc->buf = NULL;
1518 pc->buffer_size = length * tape->blk_size; 1492 pc->buf_size = length * tape->blk_size;
1519 pc->request_transfer = pc->buffer_size; 1493 pc->req_xfer = pc->buf_size;
1520 if (pc->request_transfer == tape->stage_size) 1494 if (pc->req_xfer == tape->stage_size)
1521 pc->flags |= PC_FLAG_DMA_RECOMMENDED; 1495 pc->flags |= PC_FLAG_DMA_RECOMMENDED;
1522} 1496}
1523 1497
1524static void idetape_create_write_cmd(idetape_tape_t *tape, idetape_pc_t *pc, 1498static void idetape_create_write_cmd(idetape_tape_t *tape,
1499 struct ide_atapi_pc *pc,
1525 unsigned int length, struct idetape_bh *bh) 1500 unsigned int length, struct idetape_bh *bh)
1526{ 1501{
1527 idetape_init_pc(pc); 1502 idetape_init_pc(pc);
1528 pc->c[0] = WRITE_6; 1503 pc->c[0] = WRITE_6;
1529 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 1504 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
1530 pc->c[1] = 1; 1505 pc->c[1] = 1;
1531 pc->callback = &idetape_rw_callback; 1506 pc->idetape_callback = &idetape_rw_callback;
1532 pc->flags |= PC_FLAG_WRITING; 1507 pc->flags |= PC_FLAG_WRITING;
1533 pc->bh = bh; 1508 pc->bh = bh;
1534 pc->b_data = bh->b_data; 1509 pc->b_data = bh->b_data;
1535 pc->b_count = atomic_read(&bh->b_count); 1510 pc->b_count = atomic_read(&bh->b_count);
1536 pc->buffer = NULL; 1511 pc->buf = NULL;
1537 pc->buffer_size = length * tape->blk_size; 1512 pc->buf_size = length * tape->blk_size;
1538 pc->request_transfer = pc->buffer_size; 1513 pc->req_xfer = pc->buf_size;
1539 if (pc->request_transfer == tape->stage_size) 1514 if (pc->req_xfer == tape->stage_size)
1540 pc->flags |= PC_FLAG_DMA_RECOMMENDED; 1515 pc->flags |= PC_FLAG_DMA_RECOMMENDED;
1541} 1516}
1542 1517
@@ -1544,7 +1519,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
1544 struct request *rq, sector_t block) 1519 struct request *rq, sector_t block)
1545{ 1520{
1546 idetape_tape_t *tape = drive->driver_data; 1521 idetape_tape_t *tape = drive->driver_data;
1547 idetape_pc_t *pc = NULL; 1522 struct ide_atapi_pc *pc = NULL;
1548 struct request *postponed_rq = tape->postponed_rq; 1523 struct request *postponed_rq = tape->postponed_rq;
1549 u8 stat; 1524 u8 stat;
1550 1525
@@ -1631,7 +1606,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
1631 goto out; 1606 goto out;
1632 } 1607 }
1633 if (rq->cmd[0] & REQ_IDETAPE_PC1) { 1608 if (rq->cmd[0] & REQ_IDETAPE_PC1) {
1634 pc = (idetape_pc_t *) rq->buffer; 1609 pc = (struct ide_atapi_pc *) rq->buffer;
1635 rq->cmd[0] &= ~(REQ_IDETAPE_PC1); 1610 rq->cmd[0] &= ~(REQ_IDETAPE_PC1);
1636 rq->cmd[0] |= REQ_IDETAPE_PC2; 1611 rq->cmd[0] |= REQ_IDETAPE_PC2;
1637 goto out; 1612 goto out;
@@ -1883,7 +1858,7 @@ static void idetape_wait_for_request(ide_drive_t *drive, struct request *rq)
1883static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) 1858static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive)
1884{ 1859{
1885 idetape_tape_t *tape = drive->driver_data; 1860 idetape_tape_t *tape = drive->driver_data;
1886 u8 *readpos = tape->pc->buffer; 1861 u8 *readpos = tape->pc->buf;
1887 1862
1888 debug_log(DBG_PROCS, "Enter %s\n", __func__); 1863 debug_log(DBG_PROCS, "Enter %s\n", __func__);
1889 1864
@@ -1919,20 +1894,20 @@ static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive)
1919 * writing a filemark otherwise. 1894 * writing a filemark otherwise.
1920 */ 1895 */
1921static void idetape_create_write_filemark_cmd(ide_drive_t *drive, 1896static void idetape_create_write_filemark_cmd(ide_drive_t *drive,
1922 idetape_pc_t *pc, int write_filemark) 1897 struct ide_atapi_pc *pc, int write_filemark)
1923{ 1898{
1924 idetape_init_pc(pc); 1899 idetape_init_pc(pc);
1925 pc->c[0] = WRITE_FILEMARKS; 1900 pc->c[0] = WRITE_FILEMARKS;
1926 pc->c[4] = write_filemark; 1901 pc->c[4] = write_filemark;
1927 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 1902 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
1928 pc->callback = &idetape_pc_callback; 1903 pc->idetape_callback = &idetape_pc_callback;
1929} 1904}
1930 1905
1931static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) 1906static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc)
1932{ 1907{
1933 idetape_init_pc(pc); 1908 idetape_init_pc(pc);
1934 pc->c[0] = TEST_UNIT_READY; 1909 pc->c[0] = TEST_UNIT_READY;
1935 pc->callback = &idetape_pc_callback; 1910 pc->idetape_callback = &idetape_pc_callback;
1936} 1911}
1937 1912
1938/* 1913/*
@@ -1948,7 +1923,7 @@ static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc)
1948 * to the request list without waiting for it to be serviced! In that case, we 1923 * to the request list without waiting for it to be serviced! In that case, we
1949 * usually use idetape_queue_pc_head(). 1924 * usually use idetape_queue_pc_head().
1950 */ 1925 */
1951static int __idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc) 1926static int __idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc)
1952{ 1927{
1953 struct ide_tape_obj *tape = drive->driver_data; 1928 struct ide_tape_obj *tape = drive->driver_data;
1954 struct request rq; 1929 struct request rq;
@@ -1959,20 +1934,20 @@ static int __idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc)
1959 return ide_do_drive_cmd(drive, &rq, ide_wait); 1934 return ide_do_drive_cmd(drive, &rq, ide_wait);
1960} 1935}
1961 1936
1962static void idetape_create_load_unload_cmd(ide_drive_t *drive, idetape_pc_t *pc, 1937static void idetape_create_load_unload_cmd(ide_drive_t *drive,
1963 int cmd) 1938 struct ide_atapi_pc *pc, int cmd)
1964{ 1939{
1965 idetape_init_pc(pc); 1940 idetape_init_pc(pc);
1966 pc->c[0] = START_STOP; 1941 pc->c[0] = START_STOP;
1967 pc->c[4] = cmd; 1942 pc->c[4] = cmd;
1968 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 1943 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
1969 pc->callback = &idetape_pc_callback; 1944 pc->idetape_callback = &idetape_pc_callback;
1970} 1945}
1971 1946
1972static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) 1947static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout)
1973{ 1948{
1974 idetape_tape_t *tape = drive->driver_data; 1949 idetape_tape_t *tape = drive->driver_data;
1975 idetape_pc_t pc; 1950 struct ide_atapi_pc pc;
1976 int load_attempted = 0; 1951 int load_attempted = 0;
1977 1952
1978 /* Wait for the tape to become ready */ 1953 /* Wait for the tape to become ready */
@@ -2000,14 +1975,14 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout)
2000 return -EIO; 1975 return -EIO;
2001} 1976}
2002 1977
2003static int idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc) 1978static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc)
2004{ 1979{
2005 return __idetape_queue_pc_tail(drive, pc); 1980 return __idetape_queue_pc_tail(drive, pc);
2006} 1981}
2007 1982
2008static int idetape_flush_tape_buffers(ide_drive_t *drive) 1983static int idetape_flush_tape_buffers(ide_drive_t *drive)
2009{ 1984{
2010 idetape_pc_t pc; 1985 struct ide_atapi_pc pc;
2011 int rc; 1986 int rc;
2012 1987
2013 idetape_create_write_filemark_cmd(drive, &pc, 0); 1988 idetape_create_write_filemark_cmd(drive, &pc, 0);
@@ -2018,18 +1993,18 @@ static int idetape_flush_tape_buffers(ide_drive_t *drive)
2018 return 0; 1993 return 0;
2019} 1994}
2020 1995
2021static void idetape_create_read_position_cmd(idetape_pc_t *pc) 1996static void idetape_create_read_position_cmd(struct ide_atapi_pc *pc)
2022{ 1997{
2023 idetape_init_pc(pc); 1998 idetape_init_pc(pc);
2024 pc->c[0] = READ_POSITION; 1999 pc->c[0] = READ_POSITION;
2025 pc->request_transfer = 20; 2000 pc->req_xfer = 20;
2026 pc->callback = &idetape_read_position_callback; 2001 pc->idetape_callback = &idetape_read_position_callback;
2027} 2002}
2028 2003
2029static int idetape_read_position(ide_drive_t *drive) 2004static int idetape_read_position(ide_drive_t *drive)
2030{ 2005{
2031 idetape_tape_t *tape = drive->driver_data; 2006 idetape_tape_t *tape = drive->driver_data;
2032 idetape_pc_t pc; 2007 struct ide_atapi_pc pc;
2033 int position; 2008 int position;
2034 2009
2035 debug_log(DBG_PROCS, "Enter %s\n", __func__); 2010 debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -2041,7 +2016,8 @@ static int idetape_read_position(ide_drive_t *drive)
2041 return position; 2016 return position;
2042} 2017}
2043 2018
2044static void idetape_create_locate_cmd(ide_drive_t *drive, idetape_pc_t *pc, 2019static void idetape_create_locate_cmd(ide_drive_t *drive,
2020 struct ide_atapi_pc *pc,
2045 unsigned int block, u8 partition, int skip) 2021 unsigned int block, u8 partition, int skip)
2046{ 2022{
2047 idetape_init_pc(pc); 2023 idetape_init_pc(pc);
@@ -2050,11 +2026,11 @@ static void idetape_create_locate_cmd(ide_drive_t *drive, idetape_pc_t *pc,
2050 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); 2026 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]);
2051 pc->c[8] = partition; 2027 pc->c[8] = partition;
2052 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 2028 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
2053 pc->callback = &idetape_pc_callback; 2029 pc->idetape_callback = &idetape_pc_callback;
2054} 2030}
2055 2031
2056static int idetape_create_prevent_cmd(ide_drive_t *drive, idetape_pc_t *pc, 2032static int idetape_create_prevent_cmd(ide_drive_t *drive,
2057 int prevent) 2033 struct ide_atapi_pc *pc, int prevent)
2058{ 2034{
2059 idetape_tape_t *tape = drive->driver_data; 2035 idetape_tape_t *tape = drive->driver_data;
2060 2036
@@ -2065,7 +2041,7 @@ static int idetape_create_prevent_cmd(ide_drive_t *drive, idetape_pc_t *pc,
2065 idetape_init_pc(pc); 2041 idetape_init_pc(pc);
2066 pc->c[0] = ALLOW_MEDIUM_REMOVAL; 2042 pc->c[0] = ALLOW_MEDIUM_REMOVAL;
2067 pc->c[4] = prevent; 2043 pc->c[4] = prevent;
2068 pc->callback = &idetape_pc_callback; 2044 pc->idetape_callback = &idetape_pc_callback;
2069 return 1; 2045 return 1;
2070} 2046}
2071 2047
@@ -2126,7 +2102,7 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block,
2126{ 2102{
2127 idetape_tape_t *tape = drive->driver_data; 2103 idetape_tape_t *tape = drive->driver_data;
2128 int retval; 2104 int retval;
2129 idetape_pc_t pc; 2105 struct ide_atapi_pc pc;
2130 2106
2131 if (tape->chrdev_dir == IDETAPE_DIR_READ) 2107 if (tape->chrdev_dir == IDETAPE_DIR_READ)
2132 __idetape_discard_read_pipeline(drive); 2108 __idetape_discard_read_pipeline(drive);
@@ -2209,40 +2185,41 @@ static void idetape_plug_pipeline(ide_drive_t *drive)
2209 } 2185 }
2210} 2186}
2211 2187
2212static void idetape_create_inquiry_cmd(idetape_pc_t *pc) 2188static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc)
2213{ 2189{
2214 idetape_init_pc(pc); 2190 idetape_init_pc(pc);
2215 pc->c[0] = INQUIRY; 2191 pc->c[0] = INQUIRY;
2216 pc->c[4] = 254; 2192 pc->c[4] = 254;
2217 pc->request_transfer = 254; 2193 pc->req_xfer = 254;
2218 pc->callback = &idetape_pc_callback; 2194 pc->idetape_callback = &idetape_pc_callback;
2219} 2195}
2220 2196
2221static void idetape_create_rewind_cmd(ide_drive_t *drive, idetape_pc_t *pc) 2197static void idetape_create_rewind_cmd(ide_drive_t *drive,
2198 struct ide_atapi_pc *pc)
2222{ 2199{
2223 idetape_init_pc(pc); 2200 idetape_init_pc(pc);
2224 pc->c[0] = REZERO_UNIT; 2201 pc->c[0] = REZERO_UNIT;
2225 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 2202 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
2226 pc->callback = &idetape_pc_callback; 2203 pc->idetape_callback = &idetape_pc_callback;
2227} 2204}
2228 2205
2229static void idetape_create_erase_cmd(idetape_pc_t *pc) 2206static void idetape_create_erase_cmd(struct ide_atapi_pc *pc)
2230{ 2207{
2231 idetape_init_pc(pc); 2208 idetape_init_pc(pc);
2232 pc->c[0] = ERASE; 2209 pc->c[0] = ERASE;
2233 pc->c[1] = 1; 2210 pc->c[1] = 1;
2234 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 2211 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
2235 pc->callback = &idetape_pc_callback; 2212 pc->idetape_callback = &idetape_pc_callback;
2236} 2213}
2237 2214
2238static void idetape_create_space_cmd(idetape_pc_t *pc, int count, u8 cmd) 2215static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd)
2239{ 2216{
2240 idetape_init_pc(pc); 2217 idetape_init_pc(pc);
2241 pc->c[0] = SPACE; 2218 pc->c[0] = SPACE;
2242 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); 2219 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]);
2243 pc->c[1] = cmd; 2220 pc->c[1] = cmd;
2244 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 2221 pc->flags |= PC_FLAG_WAIT_FOR_DSC;
2245 pc->callback = &idetape_pc_callback; 2222 pc->idetape_callback = &idetape_pc_callback;
2246} 2223}
2247 2224
2248static void idetape_wait_first_stage(ide_drive_t *drive) 2225static void idetape_wait_first_stage(ide_drive_t *drive)
@@ -2620,7 +2597,7 @@ static int idetape_pipeline_size(ide_drive_t *drive)
2620static int idetape_rewind_tape(ide_drive_t *drive) 2597static int idetape_rewind_tape(ide_drive_t *drive)
2621{ 2598{
2622 int retval; 2599 int retval;
2623 idetape_pc_t pc; 2600 struct ide_atapi_pc pc;
2624 idetape_tape_t *tape; 2601 idetape_tape_t *tape;
2625 tape = drive->driver_data; 2602 tape = drive->driver_data;
2626 2603
@@ -2683,7 +2660,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op,
2683 int mt_count) 2660 int mt_count)
2684{ 2661{
2685 idetape_tape_t *tape = drive->driver_data; 2662 idetape_tape_t *tape = drive->driver_data;
2686 idetape_pc_t pc; 2663 struct ide_atapi_pc pc;
2687 unsigned long flags; 2664 unsigned long flags;
2688 int retval, count = 0; 2665 int retval, count = 0;
2689 int sprev = !!(tape->caps[4] & 0x20); 2666 int sprev = !!(tape->caps[4] & 0x20);
@@ -2941,7 +2918,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
2941 2918
2942static int idetape_write_filemark(ide_drive_t *drive) 2919static int idetape_write_filemark(ide_drive_t *drive)
2943{ 2920{
2944 idetape_pc_t pc; 2921 struct ide_atapi_pc pc;
2945 2922
2946 /* Write a filemark */ 2923 /* Write a filemark */
2947 idetape_create_write_filemark_cmd(drive, &pc, 1); 2924 idetape_create_write_filemark_cmd(drive, &pc, 1);
@@ -2969,7 +2946,7 @@ static int idetape_write_filemark(ide_drive_t *drive)
2969static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) 2946static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
2970{ 2947{
2971 idetape_tape_t *tape = drive->driver_data; 2948 idetape_tape_t *tape = drive->driver_data;
2972 idetape_pc_t pc; 2949 struct ide_atapi_pc pc;
2973 int i, retval; 2950 int i, retval;
2974 2951
2975 debug_log(DBG_ERR, "Handling MTIOCTOP ioctl: mt_op=%d, mt_count=%d\n", 2952 debug_log(DBG_ERR, "Handling MTIOCTOP ioctl: mt_op=%d, mt_count=%d\n",
@@ -3152,7 +3129,7 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file,
3152static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) 3129static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive)
3153{ 3130{
3154 idetape_tape_t *tape = drive->driver_data; 3131 idetape_tape_t *tape = drive->driver_data;
3155 idetape_pc_t pc; 3132 struct ide_atapi_pc pc;
3156 3133
3157 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); 3134 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR);
3158 if (idetape_queue_pc_tail(drive, &pc)) { 3135 if (idetape_queue_pc_tail(drive, &pc)) {
@@ -3164,10 +3141,10 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive)
3164 } 3141 }
3165 return; 3142 return;
3166 } 3143 }
3167 tape->blk_size = (pc.buffer[4 + 5] << 16) + 3144 tape->blk_size = (pc.buf[4 + 5] << 16) +
3168 (pc.buffer[4 + 6] << 8) + 3145 (pc.buf[4 + 6] << 8) +
3169 pc.buffer[4 + 7]; 3146 pc.buf[4 + 7];
3170 tape->drv_write_prot = (pc.buffer[2] & 0x80) >> 7; 3147 tape->drv_write_prot = (pc.buf[2] & 0x80) >> 7;
3171} 3148}
3172 3149
3173static int idetape_chrdev_open(struct inode *inode, struct file *filp) 3150static int idetape_chrdev_open(struct inode *inode, struct file *filp)
@@ -3175,7 +3152,7 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
3175 unsigned int minor = iminor(inode), i = minor & ~0xc0; 3152 unsigned int minor = iminor(inode), i = minor & ~0xc0;
3176 ide_drive_t *drive; 3153 ide_drive_t *drive;
3177 idetape_tape_t *tape; 3154 idetape_tape_t *tape;
3178 idetape_pc_t pc; 3155 struct ide_atapi_pc pc;
3179 int retval; 3156 int retval;
3180 3157
3181 if (i >= MAX_HWIFS * MAX_DRIVES) 3158 if (i >= MAX_HWIFS * MAX_DRIVES)
@@ -3275,7 +3252,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
3275{ 3252{
3276 struct ide_tape_obj *tape = ide_tape_f(filp); 3253 struct ide_tape_obj *tape = ide_tape_f(filp);
3277 ide_drive_t *drive = tape->drive; 3254 ide_drive_t *drive = tape->drive;
3278 idetape_pc_t pc; 3255 struct ide_atapi_pc pc;
3279 unsigned int minor = iminor(inode); 3256 unsigned int minor = iminor(inode);
3280 3257
3281 lock_kernel(); 3258 lock_kernel();
@@ -3353,7 +3330,7 @@ static int idetape_identify_device(ide_drive_t *drive)
3353static void idetape_get_inquiry_results(ide_drive_t *drive) 3330static void idetape_get_inquiry_results(ide_drive_t *drive)
3354{ 3331{
3355 idetape_tape_t *tape = drive->driver_data; 3332 idetape_tape_t *tape = drive->driver_data;
3356 idetape_pc_t pc; 3333 struct ide_atapi_pc pc;
3357 char fw_rev[6], vendor_id[10], product_id[18]; 3334 char fw_rev[6], vendor_id[10], product_id[18];
3358 3335
3359 idetape_create_inquiry_cmd(&pc); 3336 idetape_create_inquiry_cmd(&pc);
@@ -3362,9 +3339,9 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
3362 tape->name); 3339 tape->name);
3363 return; 3340 return;
3364 } 3341 }
3365 memcpy(vendor_id, &pc.buffer[8], 8); 3342 memcpy(vendor_id, &pc.buf[8], 8);
3366 memcpy(product_id, &pc.buffer[16], 16); 3343 memcpy(product_id, &pc.buf[16], 16);
3367 memcpy(fw_rev, &pc.buffer[32], 4); 3344 memcpy(fw_rev, &pc.buf[32], 4);
3368 3345
3369 ide_fixstring(vendor_id, 10, 0); 3346 ide_fixstring(vendor_id, 10, 0);
3370 ide_fixstring(product_id, 18, 0); 3347 ide_fixstring(product_id, 18, 0);
@@ -3381,7 +3358,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
3381static void idetape_get_mode_sense_results(ide_drive_t *drive) 3358static void idetape_get_mode_sense_results(ide_drive_t *drive)
3382{ 3359{
3383 idetape_tape_t *tape = drive->driver_data; 3360 idetape_tape_t *tape = drive->driver_data;
3384 idetape_pc_t pc; 3361 struct ide_atapi_pc pc;
3385 u8 *caps; 3362 u8 *caps;
3386 u8 speed, max_speed; 3363 u8 speed, max_speed;
3387 3364
@@ -3395,7 +3372,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive)
3395 put_unaligned(6*52, (u16 *)&tape->caps[16]); 3372 put_unaligned(6*52, (u16 *)&tape->caps[16]);
3396 return; 3373 return;
3397 } 3374 }
3398 caps = pc.buffer + 4 + pc.buffer[3]; 3375 caps = pc.buf + 4 + pc.buf[3];
3399 3376
3400 /* convert to host order and save for later use */ 3377 /* convert to host order and save for later use */
3401 speed = be16_to_cpu(*(u16 *)&caps[14]); 3378 speed = be16_to_cpu(*(u16 *)&caps[14]);