diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
commit | bbb20089a3275a19e475dbc21320c3742e3ca423 (patch) | |
tree | 216fdc1cbef450ca688135c5b8969169482d9a48 /drivers/ide/ide-cd.c | |
parent | 3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff) | |
parent | 657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff) |
Merge branch 'dmaengine' into async-tx-next
Conflicts:
crypto/async_tx/async_xor.c
drivers/dma/ioat/dma_v2.h
drivers/dma/ioat/pci.c
drivers/md/raid5.c
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 230 |
1 files changed, 62 insertions, 168 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 925eb9e245d1..4a19686fcfe9 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -92,16 +92,16 @@ static void cdrom_saw_media_change(ide_drive_t *drive) | |||
92 | drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; | 92 | drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, | 95 | static int cdrom_log_sense(ide_drive_t *drive, struct request *rq) |
96 | struct request_sense *sense) | ||
97 | { | 96 | { |
97 | struct request_sense *sense = &drive->sense_data; | ||
98 | int log = 0; | 98 | int log = 0; |
99 | 99 | ||
100 | ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key); | ||
101 | |||
102 | if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) | 100 | if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) |
103 | return 0; | 101 | return 0; |
104 | 102 | ||
103 | ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key); | ||
104 | |||
105 | switch (sense->sense_key) { | 105 | switch (sense->sense_key) { |
106 | case NO_SENSE: | 106 | case NO_SENSE: |
107 | case RECOVERED_ERROR: | 107 | case RECOVERED_ERROR: |
@@ -140,12 +140,12 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, | |||
140 | } | 140 | } |
141 | 141 | ||
142 | static void cdrom_analyze_sense_data(ide_drive_t *drive, | 142 | static void cdrom_analyze_sense_data(ide_drive_t *drive, |
143 | struct request *failed_command, | 143 | struct request *failed_command) |
144 | struct request_sense *sense) | ||
145 | { | 144 | { |
145 | struct request_sense *sense = &drive->sense_data; | ||
146 | struct cdrom_info *info = drive->driver_data; | ||
146 | unsigned long sector; | 147 | unsigned long sector; |
147 | unsigned long bio_sectors; | 148 | unsigned long bio_sectors; |
148 | struct cdrom_info *info = drive->driver_data; | ||
149 | 149 | ||
150 | ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x", | 150 | ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x", |
151 | sense->error_code, sense->sense_key); | 151 | sense->error_code, sense->sense_key); |
@@ -154,7 +154,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
154 | ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x", | 154 | ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x", |
155 | failed_command->cmd[0]); | 155 | failed_command->cmd[0]); |
156 | 156 | ||
157 | if (!cdrom_log_sense(drive, failed_command, sense)) | 157 | if (!cdrom_log_sense(drive, failed_command)) |
158 | return; | 158 | return; |
159 | 159 | ||
160 | /* | 160 | /* |
@@ -182,7 +182,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
182 | (sense->information[2] << 8) | | 182 | (sense->information[2] << 8) | |
183 | (sense->information[3]); | 183 | (sense->information[3]); |
184 | 184 | ||
185 | if (drive->queue->hardsect_size == 2048) | 185 | if (queue_logical_block_size(drive->queue) == 2048) |
186 | /* device sector size is 2K */ | 186 | /* device sector size is 2K */ |
187 | sector <<= 2; | 187 | sector <<= 2; |
188 | 188 | ||
@@ -206,63 +206,33 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
206 | ide_cd_log_error(drive->name, failed_command, sense); | 206 | ide_cd_log_error(drive->name, failed_command, sense); |
207 | } | 207 | } |
208 | 208 | ||
209 | static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | ||
210 | struct request *failed_command) | ||
211 | { | ||
212 | struct cdrom_info *info = drive->driver_data; | ||
213 | struct request *rq = &drive->request_sense_rq; | ||
214 | |||
215 | ide_debug_log(IDE_DBG_SENSE, "enter"); | ||
216 | |||
217 | if (sense == NULL) | ||
218 | sense = &info->sense_data; | ||
219 | |||
220 | /* stuff the sense request in front of our current request */ | ||
221 | blk_rq_init(NULL, rq); | ||
222 | rq->cmd_type = REQ_TYPE_ATA_PC; | ||
223 | rq->rq_disk = info->disk; | ||
224 | |||
225 | rq->data = sense; | ||
226 | rq->cmd[0] = GPCMD_REQUEST_SENSE; | ||
227 | rq->cmd[4] = 18; | ||
228 | rq->data_len = 18; | ||
229 | |||
230 | rq->cmd_type = REQ_TYPE_SENSE; | ||
231 | rq->cmd_flags |= REQ_PREEMPT; | ||
232 | |||
233 | /* NOTE! Save the failed command in "rq->buffer" */ | ||
234 | rq->buffer = (void *) failed_command; | ||
235 | |||
236 | if (failed_command) | ||
237 | ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x", | ||
238 | failed_command->cmd[0]); | ||
239 | |||
240 | drive->hwif->rq = NULL; | ||
241 | |||
242 | elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0); | ||
243 | } | ||
244 | |||
245 | static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | 209 | static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) |
246 | { | 210 | { |
247 | /* | 211 | /* |
248 | * For REQ_TYPE_SENSE, "rq->buffer" points to the original | 212 | * For REQ_TYPE_SENSE, "rq->special" points to the original |
249 | * failed request | 213 | * failed request. Also, the sense data should be read |
214 | * directly from rq which might be different from the original | ||
215 | * sense buffer if it got copied during mapping. | ||
250 | */ | 216 | */ |
251 | struct request *failed = (struct request *)rq->buffer; | 217 | struct request *failed = (struct request *)rq->special; |
252 | struct cdrom_info *info = drive->driver_data; | 218 | void *sense = bio_data(rq->bio); |
253 | void *sense = &info->sense_data; | ||
254 | 219 | ||
255 | if (failed) { | 220 | if (failed) { |
256 | if (failed->sense) { | 221 | if (failed->sense) { |
257 | sense = failed->sense; | 222 | /* |
223 | * Sense is always read into drive->sense_data. | ||
224 | * Copy back if the failed request has its | ||
225 | * sense pointer set. | ||
226 | */ | ||
227 | memcpy(failed->sense, sense, 18); | ||
258 | failed->sense_len = rq->sense_len; | 228 | failed->sense_len = rq->sense_len; |
259 | } | 229 | } |
260 | cdrom_analyze_sense_data(drive, failed, sense); | 230 | cdrom_analyze_sense_data(drive, failed); |
261 | 231 | ||
262 | if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) | 232 | if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) |
263 | BUG(); | 233 | BUG(); |
264 | } else | 234 | } else |
265 | cdrom_analyze_sense_data(drive, NULL, sense); | 235 | cdrom_analyze_sense_data(drive, NULL); |
266 | } | 236 | } |
267 | 237 | ||
268 | 238 | ||
@@ -428,70 +398,17 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
428 | 398 | ||
429 | /* if we got a CHECK_CONDITION status, queue a request sense command */ | 399 | /* if we got a CHECK_CONDITION status, queue a request sense command */ |
430 | if (stat & ATA_ERR) | 400 | if (stat & ATA_ERR) |
431 | cdrom_queue_request_sense(drive, NULL, NULL); | 401 | return ide_queue_sense_rq(drive, NULL) ? 2 : 1; |
432 | return 1; | 402 | return 1; |
433 | 403 | ||
434 | end_request: | 404 | end_request: |
435 | if (stat & ATA_ERR) { | 405 | if (stat & ATA_ERR) { |
436 | struct request_queue *q = drive->queue; | ||
437 | unsigned long flags; | ||
438 | |||
439 | spin_lock_irqsave(q->queue_lock, flags); | ||
440 | blkdev_dequeue_request(rq); | ||
441 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
442 | |||
443 | hwif->rq = NULL; | 406 | hwif->rq = NULL; |
444 | 407 | return ide_queue_sense_rq(drive, rq) ? 2 : 1; | |
445 | cdrom_queue_request_sense(drive, rq->sense, rq); | ||
446 | return 1; | ||
447 | } else | 408 | } else |
448 | return 2; | 409 | return 2; |
449 | } | 410 | } |
450 | 411 | ||
451 | /* | ||
452 | * Check the contents of the interrupt reason register from the cdrom | ||
453 | * and attempt to recover if there are problems. Returns 0 if everything's | ||
454 | * ok; nonzero if the request has been terminated. | ||
455 | */ | ||
456 | static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, | ||
457 | int len, int ireason, int rw) | ||
458 | { | ||
459 | ide_hwif_t *hwif = drive->hwif; | ||
460 | |||
461 | ide_debug_log(IDE_DBG_FUNC, "ireason: 0x%x, rw: 0x%x", ireason, rw); | ||
462 | |||
463 | /* | ||
464 | * ireason == 0: the drive wants to receive data from us | ||
465 | * ireason == 2: the drive is expecting to transfer data to us | ||
466 | */ | ||
467 | if (ireason == (!rw << 1)) | ||
468 | return 0; | ||
469 | else if (ireason == (rw << 1)) { | ||
470 | |||
471 | /* whoops... */ | ||
472 | printk(KERN_ERR PFX "%s: %s: wrong transfer direction!\n", | ||
473 | drive->name, __func__); | ||
474 | |||
475 | ide_pad_transfer(drive, rw, len); | ||
476 | } else if (rw == 0 && ireason == 1) { | ||
477 | /* | ||
478 | * Some drives (ASUS) seem to tell us that status info is | ||
479 | * available. Just get it and ignore. | ||
480 | */ | ||
481 | (void)hwif->tp_ops->read_status(hwif); | ||
482 | return 0; | ||
483 | } else { | ||
484 | /* drive wants a command packet, or invalid ireason... */ | ||
485 | printk(KERN_ERR PFX "%s: %s: bad interrupt reason 0x%02x\n", | ||
486 | drive->name, __func__, ireason); | ||
487 | } | ||
488 | |||
489 | if (rq->cmd_type == REQ_TYPE_ATA_PC) | ||
490 | rq->cmd_flags |= REQ_FAILED; | ||
491 | |||
492 | return -1; | ||
493 | } | ||
494 | |||
495 | static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd) | 412 | static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd) |
496 | { | 413 | { |
497 | struct request *rq = cmd->rq; | 414 | struct request *rq = cmd->rq; |
@@ -503,14 +420,8 @@ static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd) | |||
503 | * and some drives don't send them. Sigh. | 420 | * and some drives don't send them. Sigh. |
504 | */ | 421 | */ |
505 | if (rq->cmd[0] == GPCMD_REQUEST_SENSE && | 422 | if (rq->cmd[0] == GPCMD_REQUEST_SENSE && |
506 | cmd->nleft > 0 && cmd->nleft <= 5) { | 423 | cmd->nleft > 0 && cmd->nleft <= 5) |
507 | unsigned int ofs = cmd->nbytes - cmd->nleft; | 424 | cmd->nleft = 0; |
508 | |||
509 | while (cmd->nleft > 0) { | ||
510 | *((u8 *)rq->data + ofs++) = 0; | ||
511 | cmd->nleft--; | ||
512 | } | ||
513 | } | ||
514 | } | 425 | } |
515 | 426 | ||
516 | int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | 427 | int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, |
@@ -543,14 +454,18 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
543 | rq->cmd_flags |= cmd_flags; | 454 | rq->cmd_flags |= cmd_flags; |
544 | rq->timeout = timeout; | 455 | rq->timeout = timeout; |
545 | if (buffer) { | 456 | if (buffer) { |
546 | rq->data = buffer; | 457 | error = blk_rq_map_kern(drive->queue, rq, buffer, |
547 | rq->data_len = *bufflen; | 458 | *bufflen, GFP_NOIO); |
459 | if (error) { | ||
460 | blk_put_request(rq); | ||
461 | return error; | ||
462 | } | ||
548 | } | 463 | } |
549 | 464 | ||
550 | error = blk_execute_rq(drive->queue, info->disk, rq, 0); | 465 | error = blk_execute_rq(drive->queue, info->disk, rq, 0); |
551 | 466 | ||
552 | if (buffer) | 467 | if (buffer) |
553 | *bufflen = rq->data_len; | 468 | *bufflen = rq->resid_len; |
554 | 469 | ||
555 | flags = rq->cmd_flags; | 470 | flags = rq->cmd_flags; |
556 | blk_put_request(rq); | 471 | blk_put_request(rq); |
@@ -608,7 +523,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
608 | struct request *rq = hwif->rq; | 523 | struct request *rq = hwif->rq; |
609 | ide_expiry_t *expiry = NULL; | 524 | ide_expiry_t *expiry = NULL; |
610 | int dma_error = 0, dma, thislen, uptodate = 0; | 525 | int dma_error = 0, dma, thislen, uptodate = 0; |
611 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors; | 526 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; |
612 | int sense = blk_sense_request(rq); | 527 | int sense = blk_sense_request(rq); |
613 | unsigned int timeout; | 528 | unsigned int timeout; |
614 | u16 len; | 529 | u16 len; |
@@ -685,8 +600,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
685 | goto out_end; | 600 | goto out_end; |
686 | } | 601 | } |
687 | 602 | ||
688 | /* check which way to transfer data */ | 603 | rc = ide_check_ireason(drive, rq, len, ireason, write); |
689 | rc = ide_cd_check_ireason(drive, rq, len, ireason, write); | ||
690 | if (rc) | 604 | if (rc) |
691 | goto out_end; | 605 | goto out_end; |
692 | 606 | ||
@@ -738,13 +652,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
738 | 652 | ||
739 | out_end: | 653 | out_end: |
740 | if (blk_pc_request(rq) && rc == 0) { | 654 | if (blk_pc_request(rq) && rc == 0) { |
741 | unsigned int dlen = rq->data_len; | 655 | rq->resid_len = 0; |
742 | 656 | blk_end_request_all(rq, 0); | |
743 | rq->data_len = 0; | ||
744 | |||
745 | if (blk_end_request(rq, 0, dlen)) | ||
746 | BUG(); | ||
747 | |||
748 | hwif->rq = NULL; | 657 | hwif->rq = NULL; |
749 | } else { | 658 | } else { |
750 | if (sense && uptodate) | 659 | if (sense && uptodate) |
@@ -758,25 +667,17 @@ out_end: | |||
758 | rq->errors = -EIO; | 667 | rq->errors = -EIO; |
759 | } | 668 | } |
760 | 669 | ||
761 | if (uptodate == 0) | 670 | if (uptodate == 0 && rq->bio) |
762 | ide_cd_error_cmd(drive, cmd); | 671 | ide_cd_error_cmd(drive, cmd); |
763 | 672 | ||
764 | /* make sure it's fully ended */ | 673 | /* make sure it's fully ended */ |
765 | if (blk_pc_request(rq)) | ||
766 | nsectors = (rq->data_len + 511) >> 9; | ||
767 | else | ||
768 | nsectors = rq->hard_nr_sectors; | ||
769 | |||
770 | if (nsectors == 0) | ||
771 | nsectors = 1; | ||
772 | |||
773 | if (blk_fs_request(rq) == 0) { | 674 | if (blk_fs_request(rq) == 0) { |
774 | rq->data_len -= (cmd->nbytes - cmd->nleft); | 675 | rq->resid_len -= cmd->nbytes - cmd->nleft; |
775 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 676 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
776 | rq->data_len += cmd->last_xfer_len; | 677 | rq->resid_len += cmd->last_xfer_len; |
777 | } | 678 | } |
778 | 679 | ||
779 | ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); | 680 | ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq)); |
780 | 681 | ||
781 | if (sense && rc == 2) | 682 | if (sense && rc == 2) |
782 | ide_error(drive, "request sense failure", stat); | 683 | ide_error(drive, "request sense failure", stat); |
@@ -790,7 +691,7 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
790 | struct request_queue *q = drive->queue; | 691 | struct request_queue *q = drive->queue; |
791 | int write = rq_data_dir(rq) == WRITE; | 692 | int write = rq_data_dir(rq) == WRITE; |
792 | unsigned short sectors_per_frame = | 693 | unsigned short sectors_per_frame = |
793 | queue_hardsect_size(q) >> SECTOR_BITS; | 694 | queue_logical_block_size(q) >> SECTOR_BITS; |
794 | 695 | ||
795 | ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, rq->cmd_flags: 0x%x, " | 696 | ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, rq->cmd_flags: 0x%x, " |
796 | "secs_per_frame: %u", | 697 | "secs_per_frame: %u", |
@@ -809,8 +710,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
809 | } | 710 | } |
810 | 711 | ||
811 | /* fs requests *must* be hardware frame aligned */ | 712 | /* fs requests *must* be hardware frame aligned */ |
812 | if ((rq->nr_sectors & (sectors_per_frame - 1)) || | 713 | if ((blk_rq_sectors(rq) & (sectors_per_frame - 1)) || |
813 | (rq->sector & (sectors_per_frame - 1))) | 714 | (blk_rq_pos(rq) & (sectors_per_frame - 1))) |
814 | return ide_stopped; | 715 | return ide_stopped; |
815 | 716 | ||
816 | /* use DMA, if possible */ | 717 | /* use DMA, if possible */ |
@@ -838,15 +739,10 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
838 | drive->dma = 0; | 739 | drive->dma = 0; |
839 | 740 | ||
840 | /* sg request */ | 741 | /* sg request */ |
841 | if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) { | 742 | if (rq->bio) { |
842 | struct request_queue *q = drive->queue; | 743 | struct request_queue *q = drive->queue; |
744 | char *buf = bio_data(rq->bio); | ||
843 | unsigned int alignment; | 745 | unsigned int alignment; |
844 | char *buf; | ||
845 | |||
846 | if (rq->bio) | ||
847 | buf = bio_data(rq->bio); | ||
848 | else | ||
849 | buf = rq->data; | ||
850 | 746 | ||
851 | drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); | 747 | drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); |
852 | 748 | ||
@@ -858,7 +754,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
858 | */ | 754 | */ |
859 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; | 755 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; |
860 | if ((unsigned long)buf & alignment | 756 | if ((unsigned long)buf & alignment |
861 | || rq->data_len & q->dma_pad_mask | 757 | || blk_rq_bytes(rq) & q->dma_pad_mask |
862 | || object_is_on_stack(buf)) | 758 | || object_is_on_stack(buf)) |
863 | drive->dma = 0; | 759 | drive->dma = 0; |
864 | } | 760 | } |
@@ -889,12 +785,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
889 | /* right now this can only be a reset... */ | 785 | /* right now this can only be a reset... */ |
890 | uptodate = 1; | 786 | uptodate = 1; |
891 | goto out_end; | 787 | goto out_end; |
892 | } else { | 788 | } else |
893 | blk_dump_rq_flags(rq, DRV_NAME " bad flags"); | 789 | BUG(); |
894 | if (rq->errors == 0) | 790 | |
895 | rq->errors = -EIO; | 791 | /* prepare sense request for this command */ |
896 | goto out_end; | 792 | ide_prep_sense(drive, rq); |
897 | } | ||
898 | 793 | ||
899 | memset(&cmd, 0, sizeof(cmd)); | 794 | memset(&cmd, 0, sizeof(cmd)); |
900 | 795 | ||
@@ -903,15 +798,14 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
903 | 798 | ||
904 | cmd.rq = rq; | 799 | cmd.rq = rq; |
905 | 800 | ||
906 | if (blk_fs_request(rq) || rq->data_len) { | 801 | if (blk_fs_request(rq) || blk_rq_bytes(rq)) { |
907 | ide_init_sg_cmd(&cmd, blk_fs_request(rq) ? (rq->nr_sectors << 9) | 802 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
908 | : rq->data_len); | ||
909 | ide_map_sg(drive, &cmd); | 803 | ide_map_sg(drive, &cmd); |
910 | } | 804 | } |
911 | 805 | ||
912 | return ide_issue_pc(drive, &cmd); | 806 | return ide_issue_pc(drive, &cmd); |
913 | out_end: | 807 | out_end: |
914 | nsectors = rq->hard_nr_sectors; | 808 | nsectors = blk_rq_sectors(rq); |
915 | 809 | ||
916 | if (nsectors == 0) | 810 | if (nsectors == 0) |
917 | nsectors = 1; | 811 | nsectors = 1; |
@@ -1077,8 +971,8 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1077 | /* save a private copy of the TOC capacity for error handling */ | 971 | /* save a private copy of the TOC capacity for error handling */ |
1078 | drive->probed_capacity = toc->capacity * sectors_per_frame; | 972 | drive->probed_capacity = toc->capacity * sectors_per_frame; |
1079 | 973 | ||
1080 | blk_queue_hardsect_size(drive->queue, | 974 | blk_queue_logical_block_size(drive->queue, |
1081 | sectors_per_frame << SECTOR_BITS); | 975 | sectors_per_frame << SECTOR_BITS); |
1082 | 976 | ||
1083 | /* first read just the header, so we know how long the TOC is */ | 977 | /* first read just the header, so we know how long the TOC is */ |
1084 | stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr, | 978 | stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr, |
@@ -1394,9 +1288,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1394 | /* standard prep_rq_fn that builds 10 byte cmds */ | 1288 | /* standard prep_rq_fn that builds 10 byte cmds */ |
1395 | static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) | 1289 | static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) |
1396 | { | 1290 | { |
1397 | int hard_sect = queue_hardsect_size(q); | 1291 | int hard_sect = queue_logical_block_size(q); |
1398 | long block = (long)rq->hard_sector / (hard_sect >> 9); | 1292 | long block = (long)blk_rq_pos(rq) / (hard_sect >> 9); |
1399 | unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9); | 1293 | unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9); |
1400 | 1294 | ||
1401 | memset(rq->cmd, 0, BLK_MAX_CDB); | 1295 | memset(rq->cmd, 0, BLK_MAX_CDB); |
1402 | 1296 | ||
@@ -1599,7 +1493,7 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1599 | 1493 | ||
1600 | nslots = ide_cdrom_probe_capabilities(drive); | 1494 | nslots = ide_cdrom_probe_capabilities(drive); |
1601 | 1495 | ||
1602 | blk_queue_hardsect_size(q, CD_FRAMESIZE); | 1496 | blk_queue_logical_block_size(q, CD_FRAMESIZE); |
1603 | 1497 | ||
1604 | if (ide_cdrom_register(drive, nslots)) { | 1498 | if (ide_cdrom_register(drive, nslots)) { |
1605 | printk(KERN_ERR PFX "%s: %s failed to register device with the" | 1499 | printk(KERN_ERR PFX "%s: %s failed to register device with the" |