diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 43 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 91 | ||||
-rw-r--r-- | drivers/ide/ide-cd_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-cd_verbose.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-devsets.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-eh.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-ioctls.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-park.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-pm.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 36 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 32 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 1 | ||||
-rw-r--r-- | drivers/ide/sis5513.c | 2 |
16 files changed, 144 insertions, 107 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f90ea221f7f2..7c826ecbd276 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -93,6 +93,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
93 | int error; | 93 | int error; |
94 | 94 | ||
95 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 95 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
96 | scsi_req_init(rq); | ||
96 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 97 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
97 | rq->special = (char *)pc; | 98 | rq->special = (char *)pc; |
98 | 99 | ||
@@ -103,9 +104,9 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
103 | goto put_req; | 104 | goto put_req; |
104 | } | 105 | } |
105 | 106 | ||
106 | memcpy(rq->cmd, pc->c, 12); | 107 | memcpy(scsi_req(rq)->cmd, pc->c, 12); |
107 | if (drive->media == ide_tape) | 108 | if (drive->media == ide_tape) |
108 | rq->cmd[13] = REQ_IDETAPE_PC1; | 109 | scsi_req(rq)->cmd[13] = REQ_IDETAPE_PC1; |
109 | error = blk_execute_rq(drive->queue, disk, rq, 0); | 110 | error = blk_execute_rq(drive->queue, disk, rq, 0); |
110 | put_req: | 111 | put_req: |
111 | blk_put_request(rq); | 112 | blk_put_request(rq); |
@@ -171,7 +172,8 @@ EXPORT_SYMBOL_GPL(ide_create_request_sense_cmd); | |||
171 | void ide_prep_sense(ide_drive_t *drive, struct request *rq) | 172 | void ide_prep_sense(ide_drive_t *drive, struct request *rq) |
172 | { | 173 | { |
173 | struct request_sense *sense = &drive->sense_data; | 174 | struct request_sense *sense = &drive->sense_data; |
174 | struct request *sense_rq = &drive->sense_rq; | 175 | struct request *sense_rq = drive->sense_rq; |
176 | struct scsi_request *req = scsi_req(sense_rq); | ||
175 | unsigned int cmd_len, sense_len; | 177 | unsigned int cmd_len, sense_len; |
176 | int err; | 178 | int err; |
177 | 179 | ||
@@ -197,6 +199,7 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) | |||
197 | memset(sense, 0, sizeof(*sense)); | 199 | memset(sense, 0, sizeof(*sense)); |
198 | 200 | ||
199 | blk_rq_init(rq->q, sense_rq); | 201 | blk_rq_init(rq->q, sense_rq); |
202 | scsi_req_init(sense_rq); | ||
200 | 203 | ||
201 | err = blk_rq_map_kern(drive->queue, sense_rq, sense, sense_len, | 204 | err = blk_rq_map_kern(drive->queue, sense_rq, sense, sense_len, |
202 | GFP_NOIO); | 205 | GFP_NOIO); |
@@ -208,13 +211,13 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) | |||
208 | } | 211 | } |
209 | 212 | ||
210 | sense_rq->rq_disk = rq->rq_disk; | 213 | sense_rq->rq_disk = rq->rq_disk; |
211 | sense_rq->cmd[0] = GPCMD_REQUEST_SENSE; | ||
212 | sense_rq->cmd[4] = cmd_len; | ||
213 | sense_rq->cmd_type = REQ_TYPE_ATA_SENSE; | 214 | sense_rq->cmd_type = REQ_TYPE_ATA_SENSE; |
214 | sense_rq->rq_flags |= RQF_PREEMPT; | 215 | sense_rq->rq_flags |= RQF_PREEMPT; |
215 | 216 | ||
217 | req->cmd[0] = GPCMD_REQUEST_SENSE; | ||
218 | req->cmd[4] = cmd_len; | ||
216 | if (drive->media == ide_tape) | 219 | if (drive->media == ide_tape) |
217 | sense_rq->cmd[13] = REQ_IDETAPE_PC1; | 220 | req->cmd[13] = REQ_IDETAPE_PC1; |
218 | 221 | ||
219 | drive->sense_rq_armed = true; | 222 | drive->sense_rq_armed = true; |
220 | } | 223 | } |
@@ -229,12 +232,12 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special) | |||
229 | return -ENOMEM; | 232 | return -ENOMEM; |
230 | } | 233 | } |
231 | 234 | ||
232 | drive->sense_rq.special = special; | 235 | drive->sense_rq->special = special; |
233 | drive->sense_rq_armed = false; | 236 | drive->sense_rq_armed = false; |
234 | 237 | ||
235 | drive->hwif->rq = NULL; | 238 | drive->hwif->rq = NULL; |
236 | 239 | ||
237 | elv_add_request(drive->queue, &drive->sense_rq, ELEVATOR_INSERT_FRONT); | 240 | elv_add_request(drive->queue, drive->sense_rq, ELEVATOR_INSERT_FRONT); |
238 | return 0; | 241 | return 0; |
239 | } | 242 | } |
240 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | 243 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); |
@@ -247,14 +250,14 @@ EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | |||
247 | void ide_retry_pc(ide_drive_t *drive) | 250 | void ide_retry_pc(ide_drive_t *drive) |
248 | { | 251 | { |
249 | struct request *failed_rq = drive->hwif->rq; | 252 | struct request *failed_rq = drive->hwif->rq; |
250 | struct request *sense_rq = &drive->sense_rq; | 253 | struct request *sense_rq = drive->sense_rq; |
251 | struct ide_atapi_pc *pc = &drive->request_sense_pc; | 254 | struct ide_atapi_pc *pc = &drive->request_sense_pc; |
252 | 255 | ||
253 | (void)ide_read_error(drive); | 256 | (void)ide_read_error(drive); |
254 | 257 | ||
255 | /* init pc from sense_rq */ | 258 | /* init pc from sense_rq */ |
256 | ide_init_pc(pc); | 259 | ide_init_pc(pc); |
257 | memcpy(pc->c, sense_rq->cmd, 12); | 260 | memcpy(pc->c, scsi_req(sense_rq)->cmd, 12); |
258 | 261 | ||
259 | if (drive->media == ide_tape) | 262 | if (drive->media == ide_tape) |
260 | drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; | 263 | drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; |
@@ -286,7 +289,7 @@ int ide_cd_expiry(ide_drive_t *drive) | |||
286 | * commands/drives support that. Let ide_timer_expiry keep polling us | 289 | * commands/drives support that. Let ide_timer_expiry keep polling us |
287 | * for these. | 290 | * for these. |
288 | */ | 291 | */ |
289 | switch (rq->cmd[0]) { | 292 | switch (scsi_req(rq)->cmd[0]) { |
290 | case GPCMD_BLANK: | 293 | case GPCMD_BLANK: |
291 | case GPCMD_FORMAT_UNIT: | 294 | case GPCMD_FORMAT_UNIT: |
292 | case GPCMD_RESERVE_RZONE_TRACK: | 295 | case GPCMD_RESERVE_RZONE_TRACK: |
@@ -297,7 +300,7 @@ int ide_cd_expiry(ide_drive_t *drive) | |||
297 | default: | 300 | default: |
298 | if (!(rq->rq_flags & RQF_QUIET)) | 301 | if (!(rq->rq_flags & RQF_QUIET)) |
299 | printk(KERN_INFO PFX "cmd 0x%x timed out\n", | 302 | printk(KERN_INFO PFX "cmd 0x%x timed out\n", |
300 | rq->cmd[0]); | 303 | scsi_req(rq)->cmd[0]); |
301 | wait = 0; | 304 | wait = 0; |
302 | break; | 305 | break; |
303 | } | 306 | } |
@@ -420,7 +423,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
420 | ? "write" : "read"); | 423 | ? "write" : "read"); |
421 | pc->flags |= PC_FLAG_DMA_ERROR; | 424 | pc->flags |= PC_FLAG_DMA_ERROR; |
422 | } else | 425 | } else |
423 | rq->resid_len = 0; | 426 | scsi_req(rq)->resid_len = 0; |
424 | debug_log("%s: DMA finished\n", drive->name); | 427 | debug_log("%s: DMA finished\n", drive->name); |
425 | } | 428 | } |
426 | 429 | ||
@@ -436,7 +439,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
436 | local_irq_enable_in_hardirq(); | 439 | local_irq_enable_in_hardirq(); |
437 | 440 | ||
438 | if (drive->media == ide_tape && | 441 | if (drive->media == ide_tape && |
439 | (stat & ATA_ERR) && rq->cmd[0] == REQUEST_SENSE) | 442 | (stat & ATA_ERR) && scsi_req(rq)->cmd[0] == REQUEST_SENSE) |
440 | stat &= ~ATA_ERR; | 443 | stat &= ~ATA_ERR; |
441 | 444 | ||
442 | if ((stat & ATA_ERR) || (pc->flags & PC_FLAG_DMA_ERROR)) { | 445 | if ((stat & ATA_ERR) || (pc->flags & PC_FLAG_DMA_ERROR)) { |
@@ -446,7 +449,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
446 | if (drive->media != ide_tape) | 449 | if (drive->media != ide_tape) |
447 | pc->rq->errors++; | 450 | pc->rq->errors++; |
448 | 451 | ||
449 | if (rq->cmd[0] == REQUEST_SENSE) { | 452 | if (scsi_req(rq)->cmd[0] == REQUEST_SENSE) { |
450 | printk(KERN_ERR PFX "%s: I/O error in request " | 453 | printk(KERN_ERR PFX "%s: I/O error in request " |
451 | "sense command\n", drive->name); | 454 | "sense command\n", drive->name); |
452 | return ide_do_reset(drive); | 455 | return ide_do_reset(drive); |
@@ -512,7 +515,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
512 | ide_pio_bytes(drive, cmd, write, done); | 515 | ide_pio_bytes(drive, cmd, write, done); |
513 | 516 | ||
514 | /* Update transferred byte count */ | 517 | /* Update transferred byte count */ |
515 | rq->resid_len -= done; | 518 | scsi_req(rq)->resid_len -= done; |
516 | 519 | ||
517 | bcount -= done; | 520 | bcount -= done; |
518 | 521 | ||
@@ -520,7 +523,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
520 | ide_pad_transfer(drive, write, bcount); | 523 | ide_pad_transfer(drive, write, bcount); |
521 | 524 | ||
522 | debug_log("[cmd %x] transferred %d bytes, padded %d bytes, resid: %u\n", | 525 | debug_log("[cmd %x] transferred %d bytes, padded %d bytes, resid: %u\n", |
523 | rq->cmd[0], done, bcount, rq->resid_len); | 526 | rq->cmd[0], done, bcount, scsi_req(rq)->resid_len); |
524 | 527 | ||
525 | /* And set the interrupt handler again */ | 528 | /* And set the interrupt handler again */ |
526 | ide_set_handler(drive, ide_pc_intr, timeout); | 529 | ide_set_handler(drive, ide_pc_intr, timeout); |
@@ -603,7 +606,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
603 | 606 | ||
604 | if (dev_is_idecd(drive)) { | 607 | if (dev_is_idecd(drive)) { |
605 | /* ATAPI commands get padded out to 12 bytes minimum */ | 608 | /* ATAPI commands get padded out to 12 bytes minimum */ |
606 | cmd_len = COMMAND_SIZE(rq->cmd[0]); | 609 | cmd_len = COMMAND_SIZE(scsi_req(rq)->cmd[0]); |
607 | if (cmd_len < ATAPI_MIN_CDB_BYTES) | 610 | if (cmd_len < ATAPI_MIN_CDB_BYTES) |
608 | cmd_len = ATAPI_MIN_CDB_BYTES; | 611 | cmd_len = ATAPI_MIN_CDB_BYTES; |
609 | 612 | ||
@@ -650,7 +653,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
650 | 653 | ||
651 | /* Send the actual packet */ | 654 | /* Send the actual packet */ |
652 | if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0) | 655 | if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0) |
653 | hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len); | 656 | hwif->tp_ops->output_data(drive, NULL, scsi_req(rq)->cmd, cmd_len); |
654 | 657 | ||
655 | /* Begin DMA, if necessary */ | 658 | /* Begin DMA, if necessary */ |
656 | if (dev_is_idecd(drive)) { | 659 | if (dev_is_idecd(drive)) { |
@@ -695,7 +698,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
695 | bytes, 63 * 1024)); | 698 | bytes, 63 * 1024)); |
696 | 699 | ||
697 | /* We haven't transferred any data yet */ | 700 | /* We haven't transferred any data yet */ |
698 | rq->resid_len = bcount; | 701 | scsi_req(rq)->resid_len = bcount; |
699 | 702 | ||
700 | if (pc->flags & PC_FLAG_DMA_ERROR) { | 703 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
701 | pc->flags &= ~PC_FLAG_DMA_ERROR; | 704 | pc->flags &= ~PC_FLAG_DMA_ERROR; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 9cbd217bc0c9..6eb98725e194 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -121,7 +121,7 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq) | |||
121 | * don't log START_STOP unit with LoEj set, since we cannot | 121 | * don't log START_STOP unit with LoEj set, since we cannot |
122 | * reliably check if drive can auto-close | 122 | * reliably check if drive can auto-close |
123 | */ | 123 | */ |
124 | if (rq->cmd[0] == GPCMD_START_STOP_UNIT && sense->asc == 0x24) | 124 | if (scsi_req(rq)->cmd[0] == GPCMD_START_STOP_UNIT && sense->asc == 0x24) |
125 | break; | 125 | break; |
126 | log = 1; | 126 | log = 1; |
127 | break; | 127 | break; |
@@ -163,7 +163,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
163 | * toc has not been recorded yet, it will fail with 05/24/00 (which is a | 163 | * toc has not been recorded yet, it will fail with 05/24/00 (which is a |
164 | * confusing error) | 164 | * confusing error) |
165 | */ | 165 | */ |
166 | if (failed_command && failed_command->cmd[0] == GPCMD_READ_TOC_PMA_ATIP) | 166 | if (failed_command && scsi_req(failed_command)->cmd[0] == GPCMD_READ_TOC_PMA_ATIP) |
167 | if (sense->sense_key == 0x05 && sense->asc == 0x24) | 167 | if (sense->sense_key == 0x05 && sense->asc == 0x24) |
168 | return; | 168 | return; |
169 | 169 | ||
@@ -219,15 +219,12 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | |||
219 | void *sense = bio_data(rq->bio); | 219 | void *sense = bio_data(rq->bio); |
220 | 220 | ||
221 | if (failed) { | 221 | if (failed) { |
222 | if (failed->sense) { | 222 | /* |
223 | /* | 223 | * Sense is always read into drive->sense_data, copy back to the |
224 | * Sense is always read into drive->sense_data. | 224 | * original request. |
225 | * Copy back if the failed request has its | 225 | */ |
226 | * sense pointer set. | 226 | memcpy(scsi_req(failed)->sense, sense, 18); |
227 | */ | 227 | scsi_req(failed)->sense_len = scsi_req(rq)->sense_len; |
228 | memcpy(failed->sense, sense, 18); | ||
229 | failed->sense_len = rq->sense_len; | ||
230 | } | ||
231 | cdrom_analyze_sense_data(drive, failed); | 228 | cdrom_analyze_sense_data(drive, failed); |
232 | 229 | ||
233 | if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) | 230 | if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) |
@@ -338,7 +335,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
338 | * | 335 | * |
339 | * cdrom_log_sense() knows this! | 336 | * cdrom_log_sense() knows this! |
340 | */ | 337 | */ |
341 | if (rq->cmd[0] == GPCMD_START_STOP_UNIT) | 338 | if (scsi_req(rq)->cmd[0] == GPCMD_START_STOP_UNIT) |
342 | break; | 339 | break; |
343 | /* fall-through */ | 340 | /* fall-through */ |
344 | case DATA_PROTECT: | 341 | case DATA_PROTECT: |
@@ -414,7 +411,7 @@ static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd) | |||
414 | * Some of the trailing request sense fields are optional, | 411 | * Some of the trailing request sense fields are optional, |
415 | * and some drives don't send them. Sigh. | 412 | * and some drives don't send them. Sigh. |
416 | */ | 413 | */ |
417 | if (rq->cmd[0] == GPCMD_REQUEST_SENSE && | 414 | if (scsi_req(rq)->cmd[0] == GPCMD_REQUEST_SENSE && |
418 | cmd->nleft > 0 && cmd->nleft <= 5) | 415 | cmd->nleft > 0 && cmd->nleft <= 5) |
419 | cmd->nleft = 0; | 416 | cmd->nleft = 0; |
420 | } | 417 | } |
@@ -425,12 +422,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
425 | req_flags_t rq_flags) | 422 | req_flags_t rq_flags) |
426 | { | 423 | { |
427 | struct cdrom_info *info = drive->driver_data; | 424 | struct cdrom_info *info = drive->driver_data; |
428 | struct request_sense local_sense; | ||
429 | int retries = 10; | 425 | int retries = 10; |
430 | req_flags_t flags = 0; | 426 | bool failed; |
431 | |||
432 | if (!sense) | ||
433 | sense = &local_sense; | ||
434 | 427 | ||
435 | ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x, timeout: %d, " | 428 | ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x, timeout: %d, " |
436 | "rq_flags: 0x%x", | 429 | "rq_flags: 0x%x", |
@@ -440,12 +433,12 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
440 | do { | 433 | do { |
441 | struct request *rq; | 434 | struct request *rq; |
442 | int error; | 435 | int error; |
436 | bool delay = false; | ||
443 | 437 | ||
444 | rq = blk_get_request(drive->queue, write, __GFP_RECLAIM); | 438 | rq = blk_get_request(drive->queue, write, __GFP_RECLAIM); |
445 | 439 | scsi_req_init(rq); | |
446 | memcpy(rq->cmd, cmd, BLK_MAX_CDB); | 440 | memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); |
447 | rq->cmd_type = REQ_TYPE_ATA_PC; | 441 | rq->cmd_type = REQ_TYPE_ATA_PC; |
448 | rq->sense = sense; | ||
449 | rq->rq_flags |= rq_flags; | 442 | rq->rq_flags |= rq_flags; |
450 | rq->timeout = timeout; | 443 | rq->timeout = timeout; |
451 | if (buffer) { | 444 | if (buffer) { |
@@ -460,21 +453,21 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
460 | error = blk_execute_rq(drive->queue, info->disk, rq, 0); | 453 | error = blk_execute_rq(drive->queue, info->disk, rq, 0); |
461 | 454 | ||
462 | if (buffer) | 455 | if (buffer) |
463 | *bufflen = rq->resid_len; | 456 | *bufflen = scsi_req(rq)->resid_len; |
464 | 457 | if (sense) | |
465 | flags = rq->rq_flags; | 458 | memcpy(sense, scsi_req(rq)->sense, sizeof(*sense)); |
466 | blk_put_request(rq); | ||
467 | 459 | ||
468 | /* | 460 | /* |
469 | * FIXME: we should probably abort/retry or something in case of | 461 | * FIXME: we should probably abort/retry or something in case of |
470 | * failure. | 462 | * failure. |
471 | */ | 463 | */ |
472 | if (flags & RQF_FAILED) { | 464 | failed = (rq->rq_flags & RQF_FAILED) != 0; |
465 | if (failed) { | ||
473 | /* | 466 | /* |
474 | * The request failed. Retry if it was due to a unit | 467 | * The request failed. Retry if it was due to a unit |
475 | * attention status (usually means media was changed). | 468 | * attention status (usually means media was changed). |
476 | */ | 469 | */ |
477 | struct request_sense *reqbuf = sense; | 470 | struct request_sense *reqbuf = scsi_req(rq)->sense; |
478 | 471 | ||
479 | if (reqbuf->sense_key == UNIT_ATTENTION) | 472 | if (reqbuf->sense_key == UNIT_ATTENTION) |
480 | cdrom_saw_media_change(drive); | 473 | cdrom_saw_media_change(drive); |
@@ -485,19 +478,20 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
485 | * a disk. Retry, but wait a little to give | 478 | * a disk. Retry, but wait a little to give |
486 | * the drive time to complete the load. | 479 | * the drive time to complete the load. |
487 | */ | 480 | */ |
488 | ssleep(2); | 481 | delay = true; |
489 | } else { | 482 | } else { |
490 | /* otherwise, don't retry */ | 483 | /* otherwise, don't retry */ |
491 | retries = 0; | 484 | retries = 0; |
492 | } | 485 | } |
493 | --retries; | 486 | --retries; |
494 | } | 487 | } |
495 | 488 | blk_put_request(rq); | |
496 | /* end of retry loop */ | 489 | if (delay) |
497 | } while ((flags & RQF_FAILED) && retries >= 0); | 490 | ssleep(2); |
491 | } while (failed && retries >= 0); | ||
498 | 492 | ||
499 | /* return an error if the command failed */ | 493 | /* return an error if the command failed */ |
500 | return (flags & RQF_FAILED) ? -EIO : 0; | 494 | return failed ? -EIO : 0; |
501 | } | 495 | } |
502 | 496 | ||
503 | /* | 497 | /* |
@@ -636,7 +630,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
636 | len -= blen; | 630 | len -= blen; |
637 | 631 | ||
638 | if (sense && write == 0) | 632 | if (sense && write == 0) |
639 | rq->sense_len += blen; | 633 | scsi_req(rq)->sense_len += blen; |
640 | } | 634 | } |
641 | 635 | ||
642 | /* pad, if necessary */ | 636 | /* pad, if necessary */ |
@@ -664,7 +658,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
664 | 658 | ||
665 | out_end: | 659 | out_end: |
666 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) { | 660 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) { |
667 | rq->resid_len = 0; | 661 | scsi_req(rq)->resid_len = 0; |
668 | blk_end_request_all(rq, 0); | 662 | blk_end_request_all(rq, 0); |
669 | hwif->rq = NULL; | 663 | hwif->rq = NULL; |
670 | } else { | 664 | } else { |
@@ -685,9 +679,9 @@ out_end: | |||
685 | 679 | ||
686 | /* make sure it's fully ended */ | 680 | /* make sure it's fully ended */ |
687 | if (rq->cmd_type != REQ_TYPE_FS) { | 681 | if (rq->cmd_type != REQ_TYPE_FS) { |
688 | rq->resid_len -= cmd->nbytes - cmd->nleft; | 682 | scsi_req(rq)->resid_len -= cmd->nbytes - cmd->nleft; |
689 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 683 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
690 | rq->resid_len += cmd->last_xfer_len; | 684 | scsi_req(rq)->resid_len += cmd->last_xfer_len; |
691 | } | 685 | } |
692 | 686 | ||
693 | ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq)); | 687 | ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq)); |
@@ -1312,28 +1306,29 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) | |||
1312 | int hard_sect = queue_logical_block_size(q); | 1306 | int hard_sect = queue_logical_block_size(q); |
1313 | long block = (long)blk_rq_pos(rq) / (hard_sect >> 9); | 1307 | long block = (long)blk_rq_pos(rq) / (hard_sect >> 9); |
1314 | unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9); | 1308 | unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9); |
1309 | struct scsi_request *req = scsi_req(rq); | ||
1315 | 1310 | ||
1316 | memset(rq->cmd, 0, BLK_MAX_CDB); | 1311 | memset(req->cmd, 0, BLK_MAX_CDB); |
1317 | 1312 | ||
1318 | if (rq_data_dir(rq) == READ) | 1313 | if (rq_data_dir(rq) == READ) |
1319 | rq->cmd[0] = GPCMD_READ_10; | 1314 | req->cmd[0] = GPCMD_READ_10; |
1320 | else | 1315 | else |
1321 | rq->cmd[0] = GPCMD_WRITE_10; | 1316 | req->cmd[0] = GPCMD_WRITE_10; |
1322 | 1317 | ||
1323 | /* | 1318 | /* |
1324 | * fill in lba | 1319 | * fill in lba |
1325 | */ | 1320 | */ |
1326 | rq->cmd[2] = (block >> 24) & 0xff; | 1321 | req->cmd[2] = (block >> 24) & 0xff; |
1327 | rq->cmd[3] = (block >> 16) & 0xff; | 1322 | req->cmd[3] = (block >> 16) & 0xff; |
1328 | rq->cmd[4] = (block >> 8) & 0xff; | 1323 | req->cmd[4] = (block >> 8) & 0xff; |
1329 | rq->cmd[5] = block & 0xff; | 1324 | req->cmd[5] = block & 0xff; |
1330 | 1325 | ||
1331 | /* | 1326 | /* |
1332 | * and transfer length | 1327 | * and transfer length |
1333 | */ | 1328 | */ |
1334 | rq->cmd[7] = (blocks >> 8) & 0xff; | 1329 | req->cmd[7] = (blocks >> 8) & 0xff; |
1335 | rq->cmd[8] = blocks & 0xff; | 1330 | req->cmd[8] = blocks & 0xff; |
1336 | rq->cmd_len = 10; | 1331 | req->cmd_len = 10; |
1337 | return BLKPREP_OK; | 1332 | return BLKPREP_OK; |
1338 | } | 1333 | } |
1339 | 1334 | ||
@@ -1343,7 +1338,7 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) | |||
1343 | */ | 1338 | */ |
1344 | static int ide_cdrom_prep_pc(struct request *rq) | 1339 | static int ide_cdrom_prep_pc(struct request *rq) |
1345 | { | 1340 | { |
1346 | u8 *c = rq->cmd; | 1341 | u8 *c = scsi_req(rq)->cmd; |
1347 | 1342 | ||
1348 | /* transform 6-byte read/write commands to the 10-byte version */ | 1343 | /* transform 6-byte read/write commands to the 10-byte version */ |
1349 | if (c[0] == READ_6 || c[0] == WRITE_6) { | 1344 | if (c[0] == READ_6 || c[0] == WRITE_6) { |
@@ -1354,7 +1349,7 @@ static int ide_cdrom_prep_pc(struct request *rq) | |||
1354 | c[2] = 0; | 1349 | c[2] = 0; |
1355 | c[1] &= 0xe0; | 1350 | c[1] &= 0xe0; |
1356 | c[0] += (READ_10 - READ_6); | 1351 | c[0] += (READ_10 - READ_6); |
1357 | rq->cmd_len = 10; | 1352 | scsi_req(rq)->cmd_len = 10; |
1358 | return BLKPREP_OK; | 1353 | return BLKPREP_OK; |
1359 | } | 1354 | } |
1360 | 1355 | ||
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index f085e3a2e1d6..da0aa0153fb1 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -304,6 +304,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) | |||
304 | int ret; | 304 | int ret; |
305 | 305 | ||
306 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 306 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
307 | scsi_req_init(rq); | ||
307 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 308 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
308 | rq->rq_flags = RQF_QUIET; | 309 | rq->rq_flags = RQF_QUIET; |
309 | ret = blk_execute_rq(drive->queue, cd->disk, rq, 0); | 310 | ret = blk_execute_rq(drive->queue, cd->disk, rq, 0); |
diff --git a/drivers/ide/ide-cd_verbose.c b/drivers/ide/ide-cd_verbose.c index f079ca2f260b..58a6feb74c02 100644 --- a/drivers/ide/ide-cd_verbose.c +++ b/drivers/ide/ide-cd_verbose.c | |||
@@ -315,12 +315,12 @@ void ide_cd_log_error(const char *name, struct request *failed_command, | |||
315 | while (hi > lo) { | 315 | while (hi > lo) { |
316 | mid = (lo + hi) / 2; | 316 | mid = (lo + hi) / 2; |
317 | if (packet_command_texts[mid].packet_command == | 317 | if (packet_command_texts[mid].packet_command == |
318 | failed_command->cmd[0]) { | 318 | scsi_req(failed_command)->cmd[0]) { |
319 | s = packet_command_texts[mid].text; | 319 | s = packet_command_texts[mid].text; |
320 | break; | 320 | break; |
321 | } | 321 | } |
322 | if (packet_command_texts[mid].packet_command > | 322 | if (packet_command_texts[mid].packet_command > |
323 | failed_command->cmd[0]) | 323 | scsi_req(failed_command)->cmd[0]) |
324 | hi = mid; | 324 | hi = mid; |
325 | else | 325 | else |
326 | lo = mid + 1; | 326 | lo = mid + 1; |
@@ -329,7 +329,7 @@ void ide_cd_log_error(const char *name, struct request *failed_command, | |||
329 | printk(KERN_ERR " The failed \"%s\" packet command " | 329 | printk(KERN_ERR " The failed \"%s\" packet command " |
330 | "was: \n \"", s); | 330 | "was: \n \"", s); |
331 | for (i = 0; i < BLK_MAX_CDB; i++) | 331 | for (i = 0; i < BLK_MAX_CDB; i++) |
332 | printk(KERN_CONT "%02x ", failed_command->cmd[i]); | 332 | printk(KERN_CONT "%02x ", scsi_req(failed_command)->cmd[i]); |
333 | printk(KERN_CONT "\"\n"); | 333 | printk(KERN_CONT "\"\n"); |
334 | } | 334 | } |
335 | 335 | ||
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index 0dd43b4fcec6..fd56c9dd9bc7 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c | |||
@@ -166,10 +166,11 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, | |||
166 | return setting->set(drive, arg); | 166 | return setting->set(drive, arg); |
167 | 167 | ||
168 | rq = blk_get_request(q, READ, __GFP_RECLAIM); | 168 | rq = blk_get_request(q, READ, __GFP_RECLAIM); |
169 | scsi_req_init(rq); | ||
169 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 170 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
170 | rq->cmd_len = 5; | 171 | scsi_req(rq)->cmd_len = 5; |
171 | rq->cmd[0] = REQ_DEVSET_EXEC; | 172 | scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; |
172 | *(int *)&rq->cmd[1] = arg; | 173 | *(int *)&scsi_req(rq)->cmd[1] = arg; |
173 | rq->special = setting->set; | 174 | rq->special = setting->set; |
174 | 175 | ||
175 | if (blk_execute_rq(q, NULL, rq, 0)) | 176 | if (blk_execute_rq(q, NULL, rq, 0)) |
@@ -183,7 +184,7 @@ ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) | |||
183 | { | 184 | { |
184 | int err, (*setfunc)(ide_drive_t *, int) = rq->special; | 185 | int err, (*setfunc)(ide_drive_t *, int) = rq->special; |
185 | 186 | ||
186 | err = setfunc(drive, *(int *)&rq->cmd[1]); | 187 | err = setfunc(drive, *(int *)&scsi_req(rq)->cmd[1]); |
187 | if (err) | 188 | if (err) |
188 | rq->errors = err; | 189 | rq->errors = err; |
189 | ide_complete_rq(drive, err, blk_rq_bytes(rq)); | 190 | ide_complete_rq(drive, err, blk_rq_bytes(rq)); |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 5ceace542b77..3437c5b28599 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -478,6 +478,7 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
478 | return -EBUSY; | 478 | return -EBUSY; |
479 | 479 | ||
480 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 480 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
481 | scsi_req_init(rq); | ||
481 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 482 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
482 | 483 | ||
483 | drive->mult_req = arg; | 484 | drive->mult_req = arg; |
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index d6da011299f5..35e5b892f9d7 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c | |||
@@ -148,7 +148,7 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) | |||
148 | struct request *rq = drive->hwif->rq; | 148 | struct request *rq = drive->hwif->rq; |
149 | 149 | ||
150 | if (rq && rq->cmd_type == REQ_TYPE_DRV_PRIV && | 150 | if (rq && rq->cmd_type == REQ_TYPE_DRV_PRIV && |
151 | rq->cmd[0] == REQ_DRIVE_RESET) { | 151 | scsi_req(rq)->cmd[0] == REQ_DRIVE_RESET) { |
152 | if (err <= 0 && rq->errors == 0) | 152 | if (err <= 0 && rq->errors == 0) |
153 | rq->errors = -EIO; | 153 | rq->errors = -EIO; |
154 | ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); | 154 | ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f079d8d1d856..3bd678ad3519 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -203,7 +203,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive, | |||
203 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); | 203 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); |
204 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); | 204 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); |
205 | 205 | ||
206 | memcpy(rq->cmd, pc->c, 12); | 206 | memcpy(scsi_req(rq)->cmd, pc->c, 12); |
207 | 207 | ||
208 | pc->rq = rq; | 208 | pc->rq = rq; |
209 | if (cmd == WRITE) | 209 | if (cmd == WRITE) |
@@ -216,7 +216,7 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy, | |||
216 | struct ide_atapi_pc *pc, struct request *rq) | 216 | struct ide_atapi_pc *pc, struct request *rq) |
217 | { | 217 | { |
218 | ide_init_pc(pc); | 218 | ide_init_pc(pc); |
219 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); | 219 | memcpy(pc->c, scsi_req(rq)->cmd, sizeof(pc->c)); |
220 | pc->rq = rq; | 220 | pc->rq = rq; |
221 | if (blk_rq_bytes(rq)) { | 221 | if (blk_rq_bytes(rq)) { |
222 | pc->flags |= PC_FLAG_DMA_OK; | 222 | pc->flags |= PC_FLAG_DMA_OK; |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 201e43fcbc94..3378503afed4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -279,7 +279,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
279 | 279 | ||
280 | static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq) | 280 | static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq) |
281 | { | 281 | { |
282 | u8 cmd = rq->cmd[0]; | 282 | u8 cmd = scsi_req(rq)->cmd[0]; |
283 | 283 | ||
284 | switch (cmd) { | 284 | switch (cmd) { |
285 | case REQ_PARK_HEADS: | 285 | case REQ_PARK_HEADS: |
@@ -545,6 +545,7 @@ repeat: | |||
545 | goto plug_device; | 545 | goto plug_device; |
546 | } | 546 | } |
547 | 547 | ||
548 | scsi_req(rq)->resid_len = blk_rq_bytes(rq); | ||
548 | hwif->rq = rq; | 549 | hwif->rq = rq; |
549 | 550 | ||
550 | spin_unlock_irq(&hwif->lock); | 551 | spin_unlock_irq(&hwif->lock); |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index d05db2469209..a5d22c6e956a 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -126,6 +126,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
126 | struct request *rq; | 126 | struct request *rq; |
127 | 127 | ||
128 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 128 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
129 | scsi_req_init(rq); | ||
129 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 130 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
130 | err = blk_execute_rq(drive->queue, NULL, rq, 0); | 131 | err = blk_execute_rq(drive->queue, NULL, rq, 0); |
131 | blk_put_request(rq); | 132 | blk_put_request(rq); |
@@ -222,9 +223,10 @@ static int generic_drive_reset(ide_drive_t *drive) | |||
222 | int ret = 0; | 223 | int ret = 0; |
223 | 224 | ||
224 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 225 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
226 | scsi_req_init(rq); | ||
225 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 227 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
226 | rq->cmd_len = 1; | 228 | scsi_req(rq)->cmd_len = 1; |
227 | rq->cmd[0] = REQ_DRIVE_RESET; | 229 | scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; |
228 | if (blk_execute_rq(drive->queue, NULL, rq, 1)) | 230 | if (blk_execute_rq(drive->queue, NULL, rq, 1)) |
229 | ret = rq->errors; | 231 | ret = rq->errors; |
230 | blk_put_request(rq); | 232 | blk_put_request(rq); |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 2d7dca56dd24..c37604a75097 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -32,8 +32,9 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
32 | spin_unlock_irq(&hwif->lock); | 32 | spin_unlock_irq(&hwif->lock); |
33 | 33 | ||
34 | rq = blk_get_request(q, READ, __GFP_RECLAIM); | 34 | rq = blk_get_request(q, READ, __GFP_RECLAIM); |
35 | rq->cmd[0] = REQ_PARK_HEADS; | 35 | scsi_req_init(rq); |
36 | rq->cmd_len = 1; | 36 | scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; |
37 | scsi_req(rq)->cmd_len = 1; | ||
37 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 38 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
38 | rq->special = &timeout; | 39 | rq->special = &timeout; |
39 | rc = blk_execute_rq(q, NULL, rq, 1); | 40 | rc = blk_execute_rq(q, NULL, rq, 1); |
@@ -46,11 +47,12 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
46 | * timeout has expired, so power management will be reenabled. | 47 | * timeout has expired, so power management will be reenabled. |
47 | */ | 48 | */ |
48 | rq = blk_get_request(q, READ, GFP_NOWAIT); | 49 | rq = blk_get_request(q, READ, GFP_NOWAIT); |
50 | scsi_req_init(rq); | ||
49 | if (IS_ERR(rq)) | 51 | if (IS_ERR(rq)) |
50 | goto out; | 52 | goto out; |
51 | 53 | ||
52 | rq->cmd[0] = REQ_UNPARK_HEADS; | 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; |
53 | rq->cmd_len = 1; | 55 | scsi_req(rq)->cmd_len = 1; |
54 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 56 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
55 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); | 57 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); |
56 | 58 | ||
@@ -64,7 +66,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) | |||
64 | struct ide_taskfile *tf = &cmd.tf; | 66 | struct ide_taskfile *tf = &cmd.tf; |
65 | 67 | ||
66 | memset(&cmd, 0, sizeof(cmd)); | 68 | memset(&cmd, 0, sizeof(cmd)); |
67 | if (rq->cmd[0] == REQ_PARK_HEADS) { | 69 | if (scsi_req(rq)->cmd[0] == REQ_PARK_HEADS) { |
68 | drive->sleep = *(unsigned long *)rq->special; | 70 | drive->sleep = *(unsigned long *)rq->special; |
69 | drive->dev_flags |= IDE_DFLAG_SLEEPING; | 71 | drive->dev_flags |= IDE_DFLAG_SLEEPING; |
70 | tf->command = ATA_CMD_IDLEIMMEDIATE; | 72 | tf->command = ATA_CMD_IDLEIMMEDIATE; |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index a015acdffb39..f6767aba7cfb 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -19,6 +19,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
19 | 19 | ||
20 | memset(&rqpm, 0, sizeof(rqpm)); | 20 | memset(&rqpm, 0, sizeof(rqpm)); |
21 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 21 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
22 | scsi_req_init(rq); | ||
22 | rq->cmd_type = REQ_TYPE_ATA_PM_SUSPEND; | 23 | rq->cmd_type = REQ_TYPE_ATA_PM_SUSPEND; |
23 | rq->special = &rqpm; | 24 | rq->special = &rqpm; |
24 | rqpm.pm_step = IDE_PM_START_SUSPEND; | 25 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
@@ -89,6 +90,7 @@ int generic_ide_resume(struct device *dev) | |||
89 | 90 | ||
90 | memset(&rqpm, 0, sizeof(rqpm)); | 91 | memset(&rqpm, 0, sizeof(rqpm)); |
91 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 92 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
93 | scsi_req_init(rq); | ||
92 | rq->cmd_type = REQ_TYPE_ATA_PM_RESUME; | 94 | rq->cmd_type = REQ_TYPE_ATA_PM_RESUME; |
93 | rq->rq_flags |= RQF_PREEMPT; | 95 | rq->rq_flags |= RQF_PREEMPT; |
94 | rq->special = &rqpm; | 96 | rq->special = &rqpm; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 330e319419e6..a74ae8df4bb8 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -741,6 +741,14 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | static int ide_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp) | ||
745 | { | ||
746 | struct ide_request *req = blk_mq_rq_to_pdu(rq); | ||
747 | |||
748 | req->sreq.sense = req->sense; | ||
749 | return 0; | ||
750 | } | ||
751 | |||
744 | /* | 752 | /* |
745 | * init request queue | 753 | * init request queue |
746 | */ | 754 | */ |
@@ -758,11 +766,18 @@ static int ide_init_queue(ide_drive_t *drive) | |||
758 | * limits and LBA48 we could raise it but as yet | 766 | * limits and LBA48 we could raise it but as yet |
759 | * do not. | 767 | * do not. |
760 | */ | 768 | */ |
761 | 769 | q = blk_alloc_queue_node(GFP_KERNEL, hwif_to_node(hwif)); | |
762 | q = blk_init_queue_node(do_ide_request, NULL, hwif_to_node(hwif)); | ||
763 | if (!q) | 770 | if (!q) |
764 | return 1; | 771 | return 1; |
765 | 772 | ||
773 | q->request_fn = do_ide_request; | ||
774 | q->init_rq_fn = ide_init_rq; | ||
775 | q->cmd_size = sizeof(struct ide_request); | ||
776 | if (blk_init_allocated_queue(q) < 0) { | ||
777 | blk_cleanup_queue(q); | ||
778 | return 1; | ||
779 | } | ||
780 | |||
766 | q->queuedata = drive; | 781 | q->queuedata = drive; |
767 | blk_queue_segment_boundary(q, 0xffff); | 782 | blk_queue_segment_boundary(q, 0xffff); |
768 | 783 | ||
@@ -1131,10 +1146,12 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif) | |||
1131 | ide_port_for_each_dev(i, drive, hwif) { | 1146 | ide_port_for_each_dev(i, drive, hwif) { |
1132 | u8 j = (hwif->index * MAX_DRIVES) + i; | 1147 | u8 j = (hwif->index * MAX_DRIVES) + i; |
1133 | u16 *saved_id = drive->id; | 1148 | u16 *saved_id = drive->id; |
1149 | struct request *saved_sense_rq = drive->sense_rq; | ||
1134 | 1150 | ||
1135 | memset(drive, 0, sizeof(*drive)); | 1151 | memset(drive, 0, sizeof(*drive)); |
1136 | memset(saved_id, 0, SECTOR_SIZE); | 1152 | memset(saved_id, 0, SECTOR_SIZE); |
1137 | drive->id = saved_id; | 1153 | drive->id = saved_id; |
1154 | drive->sense_rq = saved_sense_rq; | ||
1138 | 1155 | ||
1139 | drive->media = ide_disk; | 1156 | drive->media = ide_disk; |
1140 | drive->select = (i << 4) | ATA_DEVICE_OBS; | 1157 | drive->select = (i << 4) | ATA_DEVICE_OBS; |
@@ -1241,6 +1258,7 @@ static void ide_port_free_devices(ide_hwif_t *hwif) | |||
1241 | int i; | 1258 | int i; |
1242 | 1259 | ||
1243 | ide_port_for_each_dev(i, drive, hwif) { | 1260 | ide_port_for_each_dev(i, drive, hwif) { |
1261 | kfree(drive->sense_rq); | ||
1244 | kfree(drive->id); | 1262 | kfree(drive->id); |
1245 | kfree(drive); | 1263 | kfree(drive); |
1246 | } | 1264 | } |
@@ -1248,11 +1266,10 @@ static void ide_port_free_devices(ide_hwif_t *hwif) | |||
1248 | 1266 | ||
1249 | static int ide_port_alloc_devices(ide_hwif_t *hwif, int node) | 1267 | static int ide_port_alloc_devices(ide_hwif_t *hwif, int node) |
1250 | { | 1268 | { |
1269 | ide_drive_t *drive; | ||
1251 | int i; | 1270 | int i; |
1252 | 1271 | ||
1253 | for (i = 0; i < MAX_DRIVES; i++) { | 1272 | for (i = 0; i < MAX_DRIVES; i++) { |
1254 | ide_drive_t *drive; | ||
1255 | |||
1256 | drive = kzalloc_node(sizeof(*drive), GFP_KERNEL, node); | 1273 | drive = kzalloc_node(sizeof(*drive), GFP_KERNEL, node); |
1257 | if (drive == NULL) | 1274 | if (drive == NULL) |
1258 | goto out_nomem; | 1275 | goto out_nomem; |
@@ -1267,12 +1284,21 @@ static int ide_port_alloc_devices(ide_hwif_t *hwif, int node) | |||
1267 | */ | 1284 | */ |
1268 | drive->id = kzalloc_node(SECTOR_SIZE, GFP_KERNEL, node); | 1285 | drive->id = kzalloc_node(SECTOR_SIZE, GFP_KERNEL, node); |
1269 | if (drive->id == NULL) | 1286 | if (drive->id == NULL) |
1270 | goto out_nomem; | 1287 | goto out_free_drive; |
1288 | |||
1289 | drive->sense_rq = kmalloc(sizeof(struct request) + | ||
1290 | sizeof(struct ide_request), GFP_KERNEL); | ||
1291 | if (!drive->sense_rq) | ||
1292 | goto out_free_id; | ||
1271 | 1293 | ||
1272 | hwif->devices[i] = drive; | 1294 | hwif->devices[i] = drive; |
1273 | } | 1295 | } |
1274 | return 0; | 1296 | return 0; |
1275 | 1297 | ||
1298 | out_free_id: | ||
1299 | kfree(drive->id); | ||
1300 | out_free_drive: | ||
1301 | kfree(drive); | ||
1276 | out_nomem: | 1302 | out_nomem: |
1277 | ide_port_free_devices(hwif); | 1303 | ide_port_free_devices(hwif); |
1278 | return -ENOMEM; | 1304 | return -ENOMEM; |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 9ecf4e35adcd..f6bc1e2bb035 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -282,7 +282,7 @@ static void idetape_analyze_error(ide_drive_t *drive) | |||
282 | 282 | ||
283 | /* correct remaining bytes to transfer */ | 283 | /* correct remaining bytes to transfer */ |
284 | if (pc->flags & PC_FLAG_DMA_ERROR) | 284 | if (pc->flags & PC_FLAG_DMA_ERROR) |
285 | rq->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); | 285 | scsi_req(rq)->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * If error was the result of a zero-length read or write command, | 288 | * If error was the result of a zero-length read or write command, |
@@ -316,7 +316,7 @@ static void idetape_analyze_error(ide_drive_t *drive) | |||
316 | pc->flags |= PC_FLAG_ABORT; | 316 | pc->flags |= PC_FLAG_ABORT; |
317 | } | 317 | } |
318 | if (!(pc->flags & PC_FLAG_ABORT) && | 318 | if (!(pc->flags & PC_FLAG_ABORT) && |
319 | (blk_rq_bytes(rq) - rq->resid_len)) | 319 | (blk_rq_bytes(rq) - scsi_req(rq)->resid_len)) |
320 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; | 320 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; |
321 | } | 321 | } |
322 | } | 322 | } |
@@ -348,7 +348,7 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc) | |||
348 | "itself - Aborting request!\n"); | 348 | "itself - Aborting request!\n"); |
349 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { | 349 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
350 | unsigned int blocks = | 350 | unsigned int blocks = |
351 | (blk_rq_bytes(rq) - rq->resid_len) / tape->blk_size; | 351 | (blk_rq_bytes(rq) - scsi_req(rq)->resid_len) / tape->blk_size; |
352 | 352 | ||
353 | tape->avg_size += blocks * tape->blk_size; | 353 | tape->avg_size += blocks * tape->blk_size; |
354 | 354 | ||
@@ -560,7 +560,7 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape, | |||
560 | pc->flags |= PC_FLAG_WRITING; | 560 | pc->flags |= PC_FLAG_WRITING; |
561 | } | 561 | } |
562 | 562 | ||
563 | memcpy(rq->cmd, pc->c, 12); | 563 | memcpy(scsi_req(rq)->cmd, pc->c, 12); |
564 | } | 564 | } |
565 | 565 | ||
566 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, | 566 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, |
@@ -570,10 +570,11 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
570 | idetape_tape_t *tape = drive->driver_data; | 570 | idetape_tape_t *tape = drive->driver_data; |
571 | struct ide_atapi_pc *pc = NULL; | 571 | struct ide_atapi_pc *pc = NULL; |
572 | struct ide_cmd cmd; | 572 | struct ide_cmd cmd; |
573 | struct scsi_request *req = scsi_req(rq); | ||
573 | u8 stat; | 574 | u8 stat; |
574 | 575 | ||
575 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, sector: %llu, nr_sectors: %u", | 576 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, sector: %llu, nr_sectors: %u", |
576 | rq->cmd[0], (unsigned long long)blk_rq_pos(rq), | 577 | req->cmd[0], (unsigned long long)blk_rq_pos(rq), |
577 | blk_rq_sectors(rq)); | 578 | blk_rq_sectors(rq)); |
578 | 579 | ||
579 | BUG_ON(!(rq->cmd_type == REQ_TYPE_DRV_PRIV || | 580 | BUG_ON(!(rq->cmd_type == REQ_TYPE_DRV_PRIV || |
@@ -592,7 +593,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
592 | stat = hwif->tp_ops->read_status(hwif); | 593 | stat = hwif->tp_ops->read_status(hwif); |
593 | 594 | ||
594 | if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && | 595 | if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && |
595 | (rq->cmd[13] & REQ_IDETAPE_PC2) == 0) | 596 | (req->cmd[13] & REQ_IDETAPE_PC2) == 0) |
596 | drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; | 597 | drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; |
597 | 598 | ||
598 | if (drive->dev_flags & IDE_DFLAG_POST_RESET) { | 599 | if (drive->dev_flags & IDE_DFLAG_POST_RESET) { |
@@ -609,7 +610,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
609 | } else if (time_after(jiffies, tape->dsc_timeout)) { | 610 | } else if (time_after(jiffies, tape->dsc_timeout)) { |
610 | printk(KERN_ERR "ide-tape: %s: DSC timeout\n", | 611 | printk(KERN_ERR "ide-tape: %s: DSC timeout\n", |
611 | tape->name); | 612 | tape->name); |
612 | if (rq->cmd[13] & REQ_IDETAPE_PC2) { | 613 | if (req->cmd[13] & REQ_IDETAPE_PC2) { |
613 | idetape_media_access_finished(drive); | 614 | idetape_media_access_finished(drive); |
614 | return ide_stopped; | 615 | return ide_stopped; |
615 | } else { | 616 | } else { |
@@ -626,23 +627,23 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
626 | tape->postponed_rq = false; | 627 | tape->postponed_rq = false; |
627 | } | 628 | } |
628 | 629 | ||
629 | if (rq->cmd[13] & REQ_IDETAPE_READ) { | 630 | if (req->cmd[13] & REQ_IDETAPE_READ) { |
630 | pc = &tape->queued_pc; | 631 | pc = &tape->queued_pc; |
631 | ide_tape_create_rw_cmd(tape, pc, rq, READ_6); | 632 | ide_tape_create_rw_cmd(tape, pc, rq, READ_6); |
632 | goto out; | 633 | goto out; |
633 | } | 634 | } |
634 | if (rq->cmd[13] & REQ_IDETAPE_WRITE) { | 635 | if (req->cmd[13] & REQ_IDETAPE_WRITE) { |
635 | pc = &tape->queued_pc; | 636 | pc = &tape->queued_pc; |
636 | ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); | 637 | ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); |
637 | goto out; | 638 | goto out; |
638 | } | 639 | } |
639 | if (rq->cmd[13] & REQ_IDETAPE_PC1) { | 640 | if (req->cmd[13] & REQ_IDETAPE_PC1) { |
640 | pc = (struct ide_atapi_pc *)rq->special; | 641 | pc = (struct ide_atapi_pc *)rq->special; |
641 | rq->cmd[13] &= ~(REQ_IDETAPE_PC1); | 642 | req->cmd[13] &= ~(REQ_IDETAPE_PC1); |
642 | rq->cmd[13] |= REQ_IDETAPE_PC2; | 643 | req->cmd[13] |= REQ_IDETAPE_PC2; |
643 | goto out; | 644 | goto out; |
644 | } | 645 | } |
645 | if (rq->cmd[13] & REQ_IDETAPE_PC2) { | 646 | if (req->cmd[13] & REQ_IDETAPE_PC2) { |
646 | idetape_media_access_finished(drive); | 647 | idetape_media_access_finished(drive); |
647 | return ide_stopped; | 648 | return ide_stopped; |
648 | } | 649 | } |
@@ -853,8 +854,9 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) | |||
853 | BUG_ON(size < 0 || size % tape->blk_size); | 854 | BUG_ON(size < 0 || size % tape->blk_size); |
854 | 855 | ||
855 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 856 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); |
857 | scsi_req_init(rq); | ||
856 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 858 | rq->cmd_type = REQ_TYPE_DRV_PRIV; |
857 | rq->cmd[13] = cmd; | 859 | scsi_req(rq)->cmd[13] = cmd; |
858 | rq->rq_disk = tape->disk; | 860 | rq->rq_disk = tape->disk; |
859 | rq->__sector = tape->first_frame; | 861 | rq->__sector = tape->first_frame; |
860 | 862 | ||
@@ -868,7 +870,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) | |||
868 | blk_execute_rq(drive->queue, tape->disk, rq, 0); | 870 | blk_execute_rq(drive->queue, tape->disk, rq, 0); |
869 | 871 | ||
870 | /* calculate the number of transferred bytes and update buffer state */ | 872 | /* calculate the number of transferred bytes and update buffer state */ |
871 | size -= rq->resid_len; | 873 | size -= scsi_req(rq)->resid_len; |
872 | tape->cur = tape->buf; | 874 | tape->cur = tape->buf; |
873 | if (cmd == REQ_IDETAPE_READ) | 875 | if (cmd == REQ_IDETAPE_READ) |
874 | tape->valid = size; | 876 | tape->valid = size; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a716693417a3..a393e13b8007 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -431,6 +431,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, | |||
431 | int rw = !(cmd->tf_flags & IDE_TFLAG_WRITE) ? READ : WRITE; | 431 | int rw = !(cmd->tf_flags & IDE_TFLAG_WRITE) ? READ : WRITE; |
432 | 432 | ||
433 | rq = blk_get_request(drive->queue, rw, __GFP_RECLAIM); | 433 | rq = blk_get_request(drive->queue, rw, __GFP_RECLAIM); |
434 | scsi_req_init(rq); | ||
434 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 435 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
435 | 436 | ||
436 | /* | 437 | /* |
diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c index 247853ea1368..c3062b53056f 100644 --- a/drivers/ide/sis5513.c +++ b/drivers/ide/sis5513.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #define DRV_NAME "sis5513" | 54 | #define DRV_NAME "sis5513" |
55 | 55 | ||
56 | /* registers layout and init values are chipset family dependent */ | 56 | /* registers layout and init values are chipset family dependent */ |
57 | 57 | #undef ATA_16 | |
58 | #define ATA_16 0x01 | 58 | #define ATA_16 0x01 |
59 | #define ATA_33 0x02 | 59 | #define ATA_33 0x02 |
60 | #define ATA_66 0x03 | 60 | #define ATA_66 0x03 |