diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-04-17 18:46:27 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:27 -0400 |
commit | 1c065787c0359fc3b438c1c0aa2fcfd514fef07a (patch) | |
tree | 0b06acf2d947099286baa9e23d2a752143f15b4a /drivers/scsi/ide-scsi.c | |
parent | 8e555123911cc912427bd25b52ebfb7b6c08e39a (diff) |
ide-scsi: convert driver to using generic ide_atapi_pc
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 133 |
1 files changed, 62 insertions, 71 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 7fea769cf291..5ec421c988d4 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -60,23 +60,6 @@ | |||
60 | 60 | ||
61 | #define IDESCSI_DEBUG_LOG 0 | 61 | #define IDESCSI_DEBUG_LOG 0 |
62 | 62 | ||
63 | typedef struct idescsi_pc_s { | ||
64 | u8 c[12]; /* Actual packet bytes */ | ||
65 | int request_transfer; /* Bytes to transfer */ | ||
66 | int actually_transferred; /* Bytes actually transferred */ | ||
67 | int buffer_size; /* Size of our data buffer */ | ||
68 | struct request *rq; /* The corresponding request */ | ||
69 | u8 *buffer; /* Data buffer */ | ||
70 | u8 *current_position; /* Pointer into the above buffer */ | ||
71 | struct scatterlist *sg; /* Scatter gather table */ | ||
72 | unsigned int sg_cnt; /* Number of entries in sg */ | ||
73 | int b_count; /* Bytes transferred from current entry */ | ||
74 | struct scsi_cmnd *scsi_cmd; /* SCSI command */ | ||
75 | void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ | ||
76 | unsigned long flags; /* Status/Action flags */ | ||
77 | unsigned long timeout; /* Command timeout */ | ||
78 | } idescsi_pc_t; | ||
79 | |||
80 | /* | 63 | /* |
81 | * Packet command status bits. | 64 | * Packet command status bits. |
82 | */ | 65 | */ |
@@ -101,14 +84,15 @@ typedef struct ide_scsi_obj { | |||
101 | struct gendisk *disk; | 84 | struct gendisk *disk; |
102 | struct Scsi_Host *host; | 85 | struct Scsi_Host *host; |
103 | 86 | ||
104 | idescsi_pc_t *pc; /* Current packet command */ | 87 | struct ide_atapi_pc *pc; /* Current packet command */ |
105 | unsigned long flags; /* Status/Action flags */ | 88 | unsigned long flags; /* Status/Action flags */ |
106 | unsigned long transform; /* SCSI cmd translation layer */ | 89 | unsigned long transform; /* SCSI cmd translation layer */ |
107 | unsigned long log; /* log flags */ | 90 | unsigned long log; /* log flags */ |
108 | } idescsi_scsi_t; | 91 | } idescsi_scsi_t; |
109 | 92 | ||
110 | static DEFINE_MUTEX(idescsi_ref_mutex); | 93 | static DEFINE_MUTEX(idescsi_ref_mutex); |
111 | static int idescsi_nocd; /* Set by module param to skip cd */ | 94 | /* Set by module param to skip cd */ |
95 | static int idescsi_nocd; | ||
112 | 96 | ||
113 | #define ide_scsi_g(disk) \ | 97 | #define ide_scsi_g(disk) \ |
114 | container_of((disk)->private_data, struct ide_scsi_obj, driver) | 98 | container_of((disk)->private_data, struct ide_scsi_obj, driver) |
@@ -155,7 +139,8 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive) | |||
155 | /* | 139 | /* |
156 | * PIO data transfer routines using the scatter gather table. | 140 | * PIO data transfer routines using the scatter gather table. |
157 | */ | 141 | */ |
158 | static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount) | 142 | static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
143 | unsigned int bcount) | ||
159 | { | 144 | { |
160 | int count; | 145 | int count; |
161 | char *buf; | 146 | char *buf; |
@@ -192,7 +177,8 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne | |||
192 | } | 177 | } |
193 | } | 178 | } |
194 | 179 | ||
195 | static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount) | 180 | static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
181 | unsigned int bcount) | ||
196 | { | 182 | { |
197 | int count; | 183 | int count; |
198 | char *buf; | 184 | char *buf; |
@@ -234,15 +220,16 @@ static void ide_scsi_hex_dump(u8 *data, int len) | |||
234 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); | 220 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); |
235 | } | 221 | } |
236 | 222 | ||
237 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) | 223 | static int idescsi_check_condition(ide_drive_t *drive, |
224 | struct request *failed_cmd) | ||
238 | { | 225 | { |
239 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 226 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
240 | idescsi_pc_t *pc; | 227 | struct ide_atapi_pc *pc; |
241 | struct request *rq; | 228 | struct request *rq; |
242 | u8 *buf; | 229 | u8 *buf; |
243 | 230 | ||
244 | /* stuff a sense request in front of our current request */ | 231 | /* stuff a sense request in front of our current request */ |
245 | pc = kzalloc(sizeof(idescsi_pc_t), GFP_ATOMIC); | 232 | pc = kzalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); |
246 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); | 233 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); |
247 | buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); | 234 | buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); |
248 | if (!pc || !rq || !buf) { | 235 | if (!pc || !rq || !buf) { |
@@ -254,14 +241,14 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co | |||
254 | ide_init_drive_cmd(rq); | 241 | ide_init_drive_cmd(rq); |
255 | rq->special = (char *) pc; | 242 | rq->special = (char *) pc; |
256 | pc->rq = rq; | 243 | pc->rq = rq; |
257 | pc->buffer = buf; | 244 | pc->buf = buf; |
258 | pc->c[0] = REQUEST_SENSE; | 245 | pc->c[0] = REQUEST_SENSE; |
259 | pc->c[4] = pc->request_transfer = pc->buffer_size = SCSI_SENSE_BUFFERSIZE; | 246 | pc->c[4] = pc->req_xfer = pc->buf_size = SCSI_SENSE_BUFFERSIZE; |
260 | rq->cmd_type = REQ_TYPE_SENSE; | 247 | rq->cmd_type = REQ_TYPE_SENSE; |
261 | pc->timeout = jiffies + WAIT_READY; | 248 | pc->timeout = jiffies + WAIT_READY; |
262 | /* NOTE! Save the failed packet command in "rq->buffer" */ | 249 | /* NOTE! Save the failed packet command in "rq->buffer" */ |
263 | rq->buffer = (void *) failed_command->special; | 250 | rq->buffer = (void *) failed_cmd->special; |
264 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; | 251 | pc->scsi_cmd = ((struct ide_atapi_pc *) failed_cmd->special)->scsi_cmd; |
265 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 252 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
266 | printk ("ide-scsi: %s: queue cmd = ", drive->name); | 253 | printk ("ide-scsi: %s: queue cmd = ", drive->name); |
267 | ide_scsi_hex_dump(pc->c, 6); | 254 | ide_scsi_hex_dump(pc->c, 6); |
@@ -294,7 +281,7 @@ idescsi_atapi_abort(ide_drive_t *drive, struct request *rq) | |||
294 | { | 281 | { |
295 | #if IDESCSI_DEBUG_LOG | 282 | #if IDESCSI_DEBUG_LOG |
296 | printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", | 283 | printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", |
297 | ((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number); | 284 | ((struct ide_atapi_pc *) rq->special)->scsi_cmd->serial_number); |
298 | #endif | 285 | #endif |
299 | rq->errors |= ERROR_MAX; | 286 | rq->errors |= ERROR_MAX; |
300 | 287 | ||
@@ -307,7 +294,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
307 | { | 294 | { |
308 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 295 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
309 | struct request *rq = HWGROUP(drive)->rq; | 296 | struct request *rq = HWGROUP(drive)->rq; |
310 | idescsi_pc_t *pc = (idescsi_pc_t *) rq->special; | 297 | struct ide_atapi_pc *pc = (struct ide_atapi_pc *) rq->special; |
311 | int log = test_bit(IDESCSI_LOG_CMD, &scsi->log); | 298 | int log = test_bit(IDESCSI_LOG_CMD, &scsi->log); |
312 | struct Scsi_Host *host; | 299 | struct Scsi_Host *host; |
313 | int errors = rq->errors; | 300 | int errors = rq->errors; |
@@ -319,13 +306,14 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
319 | } | 306 | } |
320 | ide_end_drive_cmd (drive, 0, 0); | 307 | ide_end_drive_cmd (drive, 0, 0); |
321 | if (blk_sense_request(rq)) { | 308 | if (blk_sense_request(rq)) { |
322 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; | 309 | struct ide_atapi_pc *opc = (struct ide_atapi_pc *) rq->buffer; |
323 | if (log) { | 310 | if (log) { |
324 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); | 311 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); |
325 | ide_scsi_hex_dump(pc->buffer, 16); | 312 | ide_scsi_hex_dump(pc->buf, 16); |
326 | } | 313 | } |
327 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); | 314 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buf, |
328 | kfree(pc->buffer); | 315 | SCSI_SENSE_BUFFERSIZE); |
316 | kfree(pc->buf); | ||
329 | kfree(pc); | 317 | kfree(pc); |
330 | kfree(rq); | 318 | kfree(rq); |
331 | pc = opc; | 319 | pc = opc; |
@@ -361,7 +349,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
361 | return 0; | 349 | return 0; |
362 | } | 350 | } |
363 | 351 | ||
364 | static inline unsigned long get_timeout(idescsi_pc_t *pc) | 352 | static inline unsigned long get_timeout(struct ide_atapi_pc *pc) |
365 | { | 353 | { |
366 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | 354 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); |
367 | } | 355 | } |
@@ -369,7 +357,7 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc) | |||
369 | static int idescsi_expiry(ide_drive_t *drive) | 357 | static int idescsi_expiry(ide_drive_t *drive) |
370 | { | 358 | { |
371 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 359 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
372 | idescsi_pc_t *pc = scsi->pc; | 360 | struct ide_atapi_pc *pc = scsi->pc; |
373 | 361 | ||
374 | #if IDESCSI_DEBUG_LOG | 362 | #if IDESCSI_DEBUG_LOG |
375 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); | 363 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); |
@@ -386,7 +374,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
386 | { | 374 | { |
387 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 375 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
388 | ide_hwif_t *hwif = drive->hwif; | 376 | ide_hwif_t *hwif = drive->hwif; |
389 | idescsi_pc_t *pc = scsi->pc; | 377 | struct ide_atapi_pc *pc = scsi->pc; |
390 | struct request *rq = pc->rq; | 378 | struct request *rq = pc->rq; |
391 | unsigned int temp; | 379 | unsigned int temp; |
392 | u16 bcount; | 380 | u16 bcount; |
@@ -409,7 +397,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
409 | #if IDESCSI_DEBUG_LOG | 397 | #if IDESCSI_DEBUG_LOG |
410 | printk ("ide-scsi: %s: DMA complete\n", drive->name); | 398 | printk ("ide-scsi: %s: DMA complete\n", drive->name); |
411 | #endif /* IDESCSI_DEBUG_LOG */ | 399 | #endif /* IDESCSI_DEBUG_LOG */ |
412 | pc->actually_transferred=pc->request_transfer; | 400 | pc->xferred = pc->req_xfer; |
413 | (void) HWIF(drive)->ide_dma_end(drive); | 401 | (void) HWIF(drive)->ide_dma_end(drive); |
414 | } | 402 | } |
415 | 403 | ||
@@ -419,7 +407,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
419 | if ((stat & DRQ_STAT) == 0) { | 407 | if ((stat & DRQ_STAT) == 0) { |
420 | /* No more interrupts */ | 408 | /* No more interrupts */ |
421 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) | 409 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) |
422 | printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred); | 410 | printk(KERN_INFO "Packet command completed, %d bytes" |
411 | " transferred\n", pc->xferred); | ||
423 | local_irq_enable_in_hardirq(); | 412 | local_irq_enable_in_hardirq(); |
424 | if (stat & ERR_STAT) | 413 | if (stat & ERR_STAT) |
425 | rq->errors++; | 414 | rq->errors++; |
@@ -435,25 +424,26 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
435 | return ide_do_reset (drive); | 424 | return ide_do_reset (drive); |
436 | } | 425 | } |
437 | if (ireason & IO) { | 426 | if (ireason & IO) { |
438 | temp = pc->actually_transferred + bcount; | 427 | temp = pc->xferred + bcount; |
439 | if (temp > pc->request_transfer) { | 428 | if (temp > pc->req_xfer) { |
440 | if (temp > pc->buffer_size) { | 429 | if (temp > pc->buf_size) { |
441 | printk(KERN_ERR "ide-scsi: The scsi wants to " | 430 | printk(KERN_ERR "ide-scsi: The scsi wants to " |
442 | "send us more data than expected " | 431 | "send us more data than expected " |
443 | "- discarding data\n"); | 432 | "- discarding data\n"); |
444 | temp = pc->buffer_size - pc->actually_transferred; | 433 | temp = pc->buf_size - pc->xferred; |
445 | if (temp) { | 434 | if (temp) { |
446 | clear_bit(PC_WRITING, &pc->flags); | 435 | clear_bit(PC_WRITING, &pc->flags); |
447 | if (pc->sg) | 436 | if (pc->sg) |
448 | idescsi_input_buffers(drive, pc, temp); | 437 | idescsi_input_buffers(drive, pc, |
438 | temp); | ||
449 | else | 439 | else |
450 | drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); | 440 | drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp); |
451 | printk(KERN_ERR "ide-scsi: transferred" | 441 | printk(KERN_ERR "ide-scsi: transferred" |
452 | " %d of %d bytes\n", | 442 | " %d of %d bytes\n", |
453 | temp, bcount); | 443 | temp, bcount); |
454 | } | 444 | } |
455 | pc->actually_transferred += temp; | 445 | pc->xferred += temp; |
456 | pc->current_position += temp; | 446 | pc->cur_pos += temp; |
457 | ide_atapi_discard_data(drive, bcount - temp); | 447 | ide_atapi_discard_data(drive, bcount - temp); |
458 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 448 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
459 | return ide_started; | 449 | return ide_started; |
@@ -468,19 +458,19 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
468 | if (pc->sg) | 458 | if (pc->sg) |
469 | idescsi_input_buffers(drive, pc, bcount); | 459 | idescsi_input_buffers(drive, pc, bcount); |
470 | else | 460 | else |
471 | hwif->atapi_input_bytes(drive, pc->current_position, | 461 | hwif->atapi_input_bytes(drive, pc->cur_pos, |
472 | bcount); | 462 | bcount); |
473 | } else { | 463 | } else { |
474 | set_bit(PC_WRITING, &pc->flags); | 464 | set_bit(PC_WRITING, &pc->flags); |
475 | if (pc->sg) | 465 | if (pc->sg) |
476 | idescsi_output_buffers(drive, pc, bcount); | 466 | idescsi_output_buffers(drive, pc, bcount); |
477 | else | 467 | else |
478 | hwif->atapi_output_bytes(drive, pc->current_position, | 468 | hwif->atapi_output_bytes(drive, pc->cur_pos, |
479 | bcount); | 469 | bcount); |
480 | } | 470 | } |
481 | /* Update the current position */ | 471 | /* Update the current position */ |
482 | pc->actually_transferred += bcount; | 472 | pc->xferred += bcount; |
483 | pc->current_position += bcount; | 473 | pc->cur_pos += bcount; |
484 | 474 | ||
485 | /* And set the interrupt handler again */ | 475 | /* And set the interrupt handler again */ |
486 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 476 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
@@ -491,7 +481,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
491 | { | 481 | { |
492 | ide_hwif_t *hwif = drive->hwif; | 482 | ide_hwif_t *hwif = drive->hwif; |
493 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 483 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
494 | idescsi_pc_t *pc = scsi->pc; | 484 | struct ide_atapi_pc *pc = scsi->pc; |
495 | ide_startstop_t startstop; | 485 | ide_startstop_t startstop; |
496 | u8 ireason; | 486 | u8 ireason; |
497 | 487 | ||
@@ -518,7 +508,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
518 | return ide_started; | 508 | return ide_started; |
519 | } | 509 | } |
520 | 510 | ||
521 | static inline int idescsi_set_direction(idescsi_pc_t *pc) | 511 | static inline int idescsi_set_direction(struct ide_atapi_pc *pc) |
522 | { | 512 | { |
523 | switch (pc->c[0]) { | 513 | switch (pc->c[0]) { |
524 | case READ_6: case READ_10: case READ_12: | 514 | case READ_6: case READ_10: case READ_12: |
@@ -532,13 +522,13 @@ static inline int idescsi_set_direction(idescsi_pc_t *pc) | |||
532 | } | 522 | } |
533 | } | 523 | } |
534 | 524 | ||
535 | static int idescsi_map_sg(ide_drive_t *drive, idescsi_pc_t *pc) | 525 | static int idescsi_map_sg(ide_drive_t *drive, struct ide_atapi_pc *pc) |
536 | { | 526 | { |
537 | ide_hwif_t *hwif = drive->hwif; | 527 | ide_hwif_t *hwif = drive->hwif; |
538 | struct scatterlist *sg, *scsi_sg; | 528 | struct scatterlist *sg, *scsi_sg; |
539 | int segments; | 529 | int segments; |
540 | 530 | ||
541 | if (!pc->request_transfer || pc->request_transfer % 1024) | 531 | if (!pc->req_xfer || pc->req_xfer % 1024) |
542 | return 1; | 532 | return 1; |
543 | 533 | ||
544 | if (idescsi_set_direction(pc)) | 534 | if (idescsi_set_direction(pc)) |
@@ -557,21 +547,21 @@ static int idescsi_map_sg(ide_drive_t *drive, idescsi_pc_t *pc) | |||
557 | return 0; | 547 | return 0; |
558 | } | 548 | } |
559 | 549 | ||
560 | /* | 550 | static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive, |
561 | * Issue a packet command | 551 | struct ide_atapi_pc *pc) |
562 | */ | ||
563 | static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | ||
564 | { | 552 | { |
565 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 553 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
566 | ide_hwif_t *hwif = drive->hwif; | 554 | ide_hwif_t *hwif = drive->hwif; |
567 | u16 bcount; | 555 | u16 bcount; |
568 | u8 dma = 0; | 556 | u8 dma = 0; |
569 | 557 | ||
570 | scsi->pc=pc; /* Set the current packet command */ | 558 | /* Set the current packet command */ |
571 | pc->actually_transferred=0; /* We haven't transferred any data yet */ | 559 | scsi->pc = pc; |
572 | pc->current_position=pc->buffer; | 560 | /* We haven't transferred any data yet */ |
561 | pc->xferred = 0; | ||
562 | pc->cur_pos = pc->buf; | ||
573 | /* Request to transfer the entire buffer at once */ | 563 | /* Request to transfer the entire buffer at once */ |
574 | bcount = min(pc->request_transfer, 63 * 1024); | 564 | bcount = min(pc->req_xfer, 63 * 1024); |
575 | 565 | ||
576 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { | 566 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { |
577 | hwif->sg_mapped = 1; | 567 | hwif->sg_mapped = 1; |
@@ -606,7 +596,8 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
606 | #endif /* IDESCSI_DEBUG_LOG */ | 596 | #endif /* IDESCSI_DEBUG_LOG */ |
607 | 597 | ||
608 | if (blk_sense_request(rq) || blk_special_request(rq)) { | 598 | if (blk_sense_request(rq) || blk_special_request(rq)) { |
609 | return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->special); | 599 | return idescsi_issue_pc(drive, |
600 | (struct ide_atapi_pc *) rq->special); | ||
610 | } | 601 | } |
611 | blk_dump_rq_flags(rq, "ide-scsi: unsup command"); | 602 | blk_dump_rq_flags(rq, "ide-scsi: unsup command"); |
612 | idescsi_end_request (drive, 0, 0); | 603 | idescsi_end_request (drive, 0, 0); |
@@ -764,15 +755,15 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
764 | idescsi_scsi_t *scsi = scsihost_to_idescsi(host); | 755 | idescsi_scsi_t *scsi = scsihost_to_idescsi(host); |
765 | ide_drive_t *drive = scsi->drive; | 756 | ide_drive_t *drive = scsi->drive; |
766 | struct request *rq = NULL; | 757 | struct request *rq = NULL; |
767 | idescsi_pc_t *pc = NULL; | 758 | struct ide_atapi_pc *pc = NULL; |
768 | 759 | ||
769 | if (!drive) { | 760 | if (!drive) { |
770 | scmd_printk (KERN_ERR, cmd, "drive not present\n"); | 761 | scmd_printk (KERN_ERR, cmd, "drive not present\n"); |
771 | goto abort; | 762 | goto abort; |
772 | } | 763 | } |
773 | scsi = drive_to_idescsi(drive); | 764 | scsi = drive_to_idescsi(drive); |
774 | pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC); | 765 | pc = kmalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); |
775 | rq = kmalloc (sizeof (struct request), GFP_ATOMIC); | 766 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); |
776 | if (rq == NULL || pc == NULL) { | 767 | if (rq == NULL || pc == NULL) { |
777 | printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); | 768 | printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); |
778 | goto abort; | 769 | goto abort; |
@@ -782,11 +773,11 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
782 | pc->flags = 0; | 773 | pc->flags = 0; |
783 | pc->rq = rq; | 774 | pc->rq = rq; |
784 | memcpy (pc->c, cmd->cmnd, cmd->cmd_len); | 775 | memcpy (pc->c, cmd->cmnd, cmd->cmd_len); |
785 | pc->buffer = NULL; | 776 | pc->buf = NULL; |
786 | pc->sg = scsi_sglist(cmd); | 777 | pc->sg = scsi_sglist(cmd); |
787 | pc->sg_cnt = scsi_sg_count(cmd); | 778 | pc->sg_cnt = scsi_sg_count(cmd); |
788 | pc->b_count = 0; | 779 | pc->b_count = 0; |
789 | pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd); | 780 | pc->req_xfer = pc->buf_size = scsi_bufflen(cmd); |
790 | pc->scsi_cmd = cmd; | 781 | pc->scsi_cmd = cmd; |
791 | pc->done = done; | 782 | pc->done = done; |
792 | pc->timeout = jiffies + cmd->timeout_per_command; | 783 | pc->timeout = jiffies + cmd->timeout_per_command; |
@@ -857,7 +848,7 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) | |||
857 | printk (KERN_ERR "ide-scsi: cmd aborted!\n"); | 848 | printk (KERN_ERR "ide-scsi: cmd aborted!\n"); |
858 | 849 | ||
859 | if (blk_sense_request(scsi->pc->rq)) | 850 | if (blk_sense_request(scsi->pc->rq)) |
860 | kfree(scsi->pc->buffer); | 851 | kfree(scsi->pc->buf); |
861 | kfree(scsi->pc->rq); | 852 | kfree(scsi->pc->rq); |
862 | kfree(scsi->pc); | 853 | kfree(scsi->pc); |
863 | scsi->pc = NULL; | 854 | scsi->pc = NULL; |
@@ -907,7 +898,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
907 | if (__blk_end_request(req, -EIO, 0)) | 898 | if (__blk_end_request(req, -EIO, 0)) |
908 | BUG(); | 899 | BUG(); |
909 | if (blk_sense_request(req)) | 900 | if (blk_sense_request(req)) |
910 | kfree(scsi->pc->buffer); | 901 | kfree(scsi->pc->buf); |
911 | kfree(scsi->pc); | 902 | kfree(scsi->pc); |
912 | scsi->pc = NULL; | 903 | scsi->pc = NULL; |
913 | kfree(req); | 904 | kfree(req); |