aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c390
1 files changed, 252 insertions, 138 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f16bb4667238..42ab6d8715f2 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -23,6 +23,9 @@
23 * Documentation/ide/ChangeLog.ide-cd.1994-2004 23 * Documentation/ide/ChangeLog.ide-cd.1994-2004
24 */ 24 */
25 25
26#define DRV_NAME "ide-cd"
27#define PFX DRV_NAME ": "
28
26#define IDECD_VERSION "5.00" 29#define IDECD_VERSION "5.00"
27 30
28#include <linux/module.h> 31#include <linux/module.h>
@@ -50,12 +53,15 @@
50 53
51#include "ide-cd.h" 54#include "ide-cd.h"
52 55
53static DEFINE_MUTEX(idecd_ref_mutex); 56#define IDECD_DEBUG_LOG 1
54 57
55#define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref) 58#if IDECD_DEBUG_LOG
59#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
60#else
61#define ide_debug_log(lvl, fmt, args...) do {} while (0)
62#endif
56 63
57#define ide_cd_g(disk) \ 64static DEFINE_MUTEX(idecd_ref_mutex);
58 container_of((disk)->private_data, struct cdrom_info, driver)
59 65
60static void ide_cd_release(struct kref *); 66static void ide_cd_release(struct kref *);
61 67
@@ -64,7 +70,7 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
64 struct cdrom_info *cd = NULL; 70 struct cdrom_info *cd = NULL;
65 71
66 mutex_lock(&idecd_ref_mutex); 72 mutex_lock(&idecd_ref_mutex);
67 cd = ide_cd_g(disk); 73 cd = ide_drv_g(disk, cdrom_info);
68 if (cd) { 74 if (cd) {
69 if (ide_device_get(cd->drive)) 75 if (ide_device_get(cd->drive))
70 cd = NULL; 76 cd = NULL;
@@ -93,7 +99,7 @@ static void ide_cd_put(struct cdrom_info *cd)
93/* Mark that we've seen a media change and invalidate our internal buffers. */ 99/* Mark that we've seen a media change and invalidate our internal buffers. */
94static void cdrom_saw_media_change(ide_drive_t *drive) 100static void cdrom_saw_media_change(ide_drive_t *drive)
95{ 101{
96 drive->atapi_flags |= IDE_AFLAG_MEDIA_CHANGED; 102 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
97 drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; 103 drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
98} 104}
99 105
@@ -102,6 +108,9 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
102{ 108{
103 int log = 0; 109 int log = 0;
104 110
111 ide_debug_log(IDE_DBG_SENSE, "Call %s, sense_key: 0x%x\n", __func__,
112 sense->sense_key);
113
105 if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) 114 if (!sense || !rq || (rq->cmd_flags & REQ_QUIET))
106 return 0; 115 return 0;
107 116
@@ -150,6 +159,14 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
150 unsigned long bio_sectors; 159 unsigned long bio_sectors;
151 struct cdrom_info *info = drive->driver_data; 160 struct cdrom_info *info = drive->driver_data;
152 161
162 ide_debug_log(IDE_DBG_SENSE, "Call %s, error_code: 0x%x, "
163 "sense_key: 0x%x\n", __func__, sense->error_code,
164 sense->sense_key);
165
166 if (failed_command)
167 ide_debug_log(IDE_DBG_SENSE, "%s: failed cmd: 0x%x\n",
168 __func__, failed_command->cmd[0]);
169
153 if (!cdrom_log_sense(drive, failed_command, sense)) 170 if (!cdrom_log_sense(drive, failed_command, sense))
154 return; 171 return;
155 172
@@ -200,6 +217,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
200 struct cdrom_info *info = drive->driver_data; 217 struct cdrom_info *info = drive->driver_data;
201 struct request *rq = &info->request_sense_request; 218 struct request *rq = &info->request_sense_request;
202 219
220 ide_debug_log(IDE_DBG_SENSE, "Call %s\n", __func__);
221
203 if (sense == NULL) 222 if (sense == NULL)
204 sense = &info->sense_data; 223 sense = &info->sense_data;
205 224
@@ -219,6 +238,10 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
219 /* NOTE! Save the failed command in "rq->buffer" */ 238 /* NOTE! Save the failed command in "rq->buffer" */
220 rq->buffer = (void *) failed_command; 239 rq->buffer = (void *) failed_command;
221 240
241 if (failed_command)
242 ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x\n",
243 failed_command->cmd[0]);
244
222 ide_do_drive_cmd(drive, rq); 245 ide_do_drive_cmd(drive, rq);
223} 246}
224 247
@@ -227,6 +250,10 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate)
227 struct request *rq = HWGROUP(drive)->rq; 250 struct request *rq = HWGROUP(drive)->rq;
228 int nsectors = rq->hard_cur_sectors; 251 int nsectors = rq->hard_cur_sectors;
229 252
253 ide_debug_log(IDE_DBG_FUNC, "Call %s, cmd: 0x%x, uptodate: 0x%x, "
254 "nsectors: %d\n", __func__, rq->cmd[0], uptodate,
255 nsectors);
256
230 if (blk_sense_request(rq) && uptodate) { 257 if (blk_sense_request(rq) && uptodate) {
231 /* 258 /*
232 * For REQ_TYPE_SENSE, "rq->buffer" points to the original 259 * For REQ_TYPE_SENSE, "rq->buffer" points to the original
@@ -269,6 +296,9 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate)
269 if (!nsectors) 296 if (!nsectors)
270 nsectors = 1; 297 nsectors = 1;
271 298
299 ide_debug_log(IDE_DBG_FUNC, "Exit %s, uptodate: 0x%x, nsectors: %d\n",
300 __func__, uptodate, nsectors);
301
272 ide_end_request(drive, uptodate, nsectors); 302 ide_end_request(drive, uptodate, nsectors);
273} 303}
274 304
@@ -304,11 +334,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
304 sense_key = err >> 4; 334 sense_key = err >> 4;
305 335
306 if (rq == NULL) { 336 if (rq == NULL) {
307 printk(KERN_ERR "%s: missing rq in %s\n", 337 printk(KERN_ERR PFX "%s: missing rq in %s\n",
308 drive->name, __func__); 338 drive->name, __func__);
309 return 1; 339 return 1;
310 } 340 }
311 341
342 ide_debug_log(IDE_DBG_RQ, "%s: stat: 0x%x, good_stat: 0x%x, "
343 "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x, err: 0x%x\n",
344 __func__, stat, good_stat, rq->cmd[0], rq->cmd_type, err);
345
312 if (blk_sense_request(rq)) { 346 if (blk_sense_request(rq)) {
313 /* 347 /*
314 * We got an error trying to get sense info from the drive 348 * We got an error trying to get sense info from the drive
@@ -374,7 +408,8 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
374 cdrom_saw_media_change(drive); 408 cdrom_saw_media_change(drive);
375 409
376 /* fail the request */ 410 /* fail the request */
377 printk(KERN_ERR "%s: tray open\n", drive->name); 411 printk(KERN_ERR PFX "%s: tray open\n",
412 drive->name);
378 do_end_request = 1; 413 do_end_request = 1;
379 } else { 414 } else {
380 struct cdrom_info *info = drive->driver_data; 415 struct cdrom_info *info = drive->driver_data;
@@ -436,7 +471,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
436 ide_dump_status_no_sense(drive, "media error (blank)", 471 ide_dump_status_no_sense(drive, "media error (blank)",
437 stat); 472 stat);
438 do_end_request = 1; 473 do_end_request = 1;
439 } else if ((err & ~ABRT_ERR) != 0) { 474 } else if ((err & ~ATA_ABORTED) != 0) {
440 /* go to the default handler for other errors */ 475 /* go to the default handler for other errors */
441 ide_error(drive, "cdrom_decode_status", stat); 476 ide_error(drive, "cdrom_decode_status", stat);
442 return 1; 477 return 1;
@@ -457,10 +492,10 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
457 * If we got a CHECK_CONDITION status, queue 492 * If we got a CHECK_CONDITION status, queue
458 * a request sense command. 493 * a request sense command.
459 */ 494 */
460 if (stat & ERR_STAT) 495 if (stat & ATA_ERR)
461 cdrom_queue_request_sense(drive, NULL, NULL); 496 cdrom_queue_request_sense(drive, NULL, NULL);
462 } else { 497 } else {
463 blk_dump_rq_flags(rq, "ide-cd: bad rq"); 498 blk_dump_rq_flags(rq, PFX "bad rq");
464 cdrom_end_request(drive, 0); 499 cdrom_end_request(drive, 0);
465 } 500 }
466 501
@@ -468,7 +503,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
468 return 1; 503 return 1;
469 504
470end_request: 505end_request:
471 if (stat & ERR_STAT) { 506 if (stat & ATA_ERR) {
472 unsigned long flags; 507 unsigned long flags;
473 508
474 spin_lock_irqsave(&ide_lock, flags); 509 spin_lock_irqsave(&ide_lock, flags);
@@ -488,6 +523,9 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
488 struct request *rq = HWGROUP(drive)->rq; 523 struct request *rq = HWGROUP(drive)->rq;
489 unsigned long wait = 0; 524 unsigned long wait = 0;
490 525
526 ide_debug_log(IDE_DBG_RQ, "Call %s: rq->cmd[0]: 0x%x\n", __func__,
527 rq->cmd[0]);
528
491 /* 529 /*
492 * Some commands are *slow* and normally take a long time to complete. 530 * Some commands are *slow* and normally take a long time to complete.
493 * Usually we can use the ATAPI "disconnect" to bypass this, but not all 531 * Usually we can use the ATAPI "disconnect" to bypass this, but not all
@@ -504,7 +542,7 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
504 break; 542 break;
505 default: 543 default:
506 if (!(rq->cmd_flags & REQ_QUIET)) 544 if (!(rq->cmd_flags & REQ_QUIET))
507 printk(KERN_INFO "ide-cd: cmd 0x%x timed out\n", 545 printk(KERN_INFO PFX "cmd 0x%x timed out\n",
508 rq->cmd[0]); 546 rq->cmd[0]);
509 wait = 0; 547 wait = 0;
510 break; 548 break;
@@ -524,24 +562,25 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
524 int xferlen, 562 int xferlen,
525 ide_handler_t *handler) 563 ide_handler_t *handler)
526{ 564{
527 struct cdrom_info *info = drive->driver_data;
528 ide_hwif_t *hwif = drive->hwif; 565 ide_hwif_t *hwif = drive->hwif;
529 566
567 ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen);
568
530 /* FIXME: for Virtual DMA we must check harder */ 569 /* FIXME: for Virtual DMA we must check harder */
531 if (info->dma) 570 if (drive->dma)
532 info->dma = !hwif->dma_ops->dma_setup(drive); 571 drive->dma = !hwif->dma_ops->dma_setup(drive);
533 572
534 /* set up the controller registers */ 573 /* set up the controller registers */
535 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, 574 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,
536 xferlen, info->dma); 575 xferlen, drive->dma);
537 576
538 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { 577 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
539 /* waiting for CDB interrupt, not DMA yet. */ 578 /* waiting for CDB interrupt, not DMA yet. */
540 if (info->dma) 579 if (drive->dma)
541 drive->waiting_for_dma = 0; 580 drive->waiting_for_dma = 0;
542 581
543 /* packet command */ 582 /* packet command */
544 ide_execute_command(drive, WIN_PACKETCMD, handler, 583 ide_execute_command(drive, ATA_CMD_PACKET, handler,
545 ATAPI_WAIT_PC, cdrom_timer_expiry); 584 ATAPI_WAIT_PC, cdrom_timer_expiry);
546 return ide_started; 585 return ide_started;
547 } else { 586 } else {
@@ -564,9 +603,10 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
564{ 603{
565 ide_hwif_t *hwif = drive->hwif; 604 ide_hwif_t *hwif = drive->hwif;
566 int cmd_len; 605 int cmd_len;
567 struct cdrom_info *info = drive->driver_data;
568 ide_startstop_t startstop; 606 ide_startstop_t startstop;
569 607
608 ide_debug_log(IDE_DBG_PC, "Call %s\n", __func__);
609
570 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { 610 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
571 /* 611 /*
572 * Here we should have been called after receiving an interrupt 612 * Here we should have been called after receiving an interrupt
@@ -574,16 +614,16 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
574 */ 614 */
575 615
576 /* check for errors */ 616 /* check for errors */
577 if (cdrom_decode_status(drive, DRQ_STAT, NULL)) 617 if (cdrom_decode_status(drive, ATA_DRQ, NULL))
578 return ide_stopped; 618 return ide_stopped;
579 619
580 /* ok, next interrupt will be DMA interrupt */ 620 /* ok, next interrupt will be DMA interrupt */
581 if (info->dma) 621 if (drive->dma)
582 drive->waiting_for_dma = 1; 622 drive->waiting_for_dma = 1;
583 } else { 623 } else {
584 /* otherwise, we must wait for DRQ to get set */ 624 /* otherwise, we must wait for DRQ to get set */
585 if (ide_wait_stat(&startstop, drive, DRQ_STAT, 625 if (ide_wait_stat(&startstop, drive, ATA_DRQ,
586 BUSY_STAT, WAIT_READY)) 626 ATA_BUSY, WAIT_READY))
587 return startstop; 627 return startstop;
588 } 628 }
589 629
@@ -599,7 +639,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
599 hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len); 639 hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);
600 640
601 /* start the DMA if need be */ 641 /* start the DMA if need be */
602 if (info->dma) 642 if (drive->dma)
603 hwif->dma_ops->dma_start(drive); 643 hwif->dma_ops->dma_start(drive);
604 644
605 return ide_started; 645 return ide_started;
@@ -615,6 +655,9 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
615{ 655{
616 ide_hwif_t *hwif = drive->hwif; 656 ide_hwif_t *hwif = drive->hwif;
617 657
658 ide_debug_log(IDE_DBG_FUNC, "Call %s, ireason: 0x%x, rw: 0x%x\n",
659 __func__, ireason, rw);
660
618 /* 661 /*
619 * ireason == 0: the drive wants to receive data from us 662 * ireason == 0: the drive wants to receive data from us
620 * ireason == 2: the drive is expecting to transfer data to us 663 * ireason == 2: the drive is expecting to transfer data to us
@@ -624,7 +667,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
624 else if (ireason == (rw << 1)) { 667 else if (ireason == (rw << 1)) {
625 668
626 /* whoops... */ 669 /* whoops... */
627 printk(KERN_ERR "%s: %s: wrong transfer direction!\n", 670 printk(KERN_ERR PFX "%s: %s: wrong transfer direction!\n",
628 drive->name, __func__); 671 drive->name, __func__);
629 672
630 ide_pad_transfer(drive, rw, len); 673 ide_pad_transfer(drive, rw, len);
@@ -637,7 +680,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
637 return 0; 680 return 0;
638 } else { 681 } else {
639 /* drive wants a command packet, or invalid ireason... */ 682 /* drive wants a command packet, or invalid ireason... */
640 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n", 683 printk(KERN_ERR PFX "%s: %s: bad interrupt reason 0x%02x\n",
641 drive->name, __func__, ireason); 684 drive->name, __func__, ireason);
642 } 685 }
643 686
@@ -654,17 +697,19 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
654 */ 697 */
655static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) 698static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)
656{ 699{
700 ide_debug_log(IDE_DBG_FUNC, "Call %s, len: %d\n", __func__, len);
701
657 if ((len % SECTOR_SIZE) == 0) 702 if ((len % SECTOR_SIZE) == 0)
658 return 0; 703 return 0;
659 704
660 printk(KERN_ERR "%s: %s: Bad transfer size %d\n", 705 printk(KERN_ERR PFX "%s: %s: Bad transfer size %d\n", drive->name,
661 drive->name, __func__, len); 706 __func__, len);
662 707
663 if (drive->atapi_flags & IDE_AFLAG_LIMIT_NFRAMES) 708 if (drive->atapi_flags & IDE_AFLAG_LIMIT_NFRAMES)
664 printk(KERN_ERR " This drive is not supported by " 709 printk(KERN_ERR PFX "This drive is not supported by this "
665 "this version of the driver\n"); 710 "version of the driver\n");
666 else { 711 else {
667 printk(KERN_ERR " Trying to limit transfer sizes\n"); 712 printk(KERN_ERR PFX "Trying to limit transfer sizes\n");
668 drive->atapi_flags |= IDE_AFLAG_LIMIT_NFRAMES; 713 drive->atapi_flags |= IDE_AFLAG_LIMIT_NFRAMES;
669 } 714 }
670 715
@@ -676,6 +721,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);
676static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, 721static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
677 struct request *rq) 722 struct request *rq)
678{ 723{
724 ide_debug_log(IDE_DBG_RQ, "Call %s: rq->cmd_flags: 0x%x\n", __func__,
725 rq->cmd_flags);
726
679 if (rq_data_dir(rq) == READ) { 727 if (rq_data_dir(rq) == READ) {
680 unsigned short sectors_per_frame = 728 unsigned short sectors_per_frame =
681 queue_hardsect_size(drive->queue) >> SECTOR_BITS; 729 queue_hardsect_size(drive->queue) >> SECTOR_BITS;
@@ -695,7 +743,7 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
695 /* sanity check... */ 743 /* sanity check... */
696 if (rq->current_nr_sectors != 744 if (rq->current_nr_sectors !=
697 bio_cur_sectors(rq->bio)) { 745 bio_cur_sectors(rq->bio)) {
698 printk(KERN_ERR "%s: %s: buffer botch (%u)\n", 746 printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
699 drive->name, __func__, 747 drive->name, __func__,
700 rq->current_nr_sectors); 748 rq->current_nr_sectors);
701 cdrom_end_request(drive, 0); 749 cdrom_end_request(drive, 0);
@@ -704,11 +752,7 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
704 rq->current_nr_sectors += nskip; 752 rq->current_nr_sectors += nskip;
705 } 753 }
706 } 754 }
707#if 0 755
708 else
709 /* the immediate bit */
710 rq->cmd[1] = 1 << 3;
711#endif
712 /* set up the command */ 756 /* set up the command */
713 rq->timeout = ATAPI_WAIT_PC; 757 rq->timeout = ATAPI_WAIT_PC;
714 758
@@ -739,6 +783,8 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive)
739 int stat; 783 int stat;
740 static int retry = 10; 784 static int retry = 10;
741 785
786 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
787
742 if (cdrom_decode_status(drive, 0, &stat)) 788 if (cdrom_decode_status(drive, 0, &stat))
743 return ide_stopped; 789 return ide_stopped;
744 790
@@ -746,7 +792,7 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive)
746 792
747 if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { 793 if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) {
748 if (--retry == 0) 794 if (--retry == 0)
749 drive->dsc_overlap = 0; 795 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP;
750 } 796 }
751 return ide_stopped; 797 return ide_stopped;
752} 798}
@@ -755,6 +801,8 @@ static void ide_cd_prepare_seek_request(ide_drive_t *drive, struct request *rq)
755{ 801{
756 sector_t frame = rq->sector; 802 sector_t frame = rq->sector;
757 803
804 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
805
758 sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS); 806 sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);
759 807
760 memset(rq->cmd, 0, BLK_MAX_CDB); 808 memset(rq->cmd, 0, BLK_MAX_CDB);
@@ -775,8 +823,11 @@ static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)
775 * Fix up a possibly partially-processed request so that we can start it over 823 * Fix up a possibly partially-processed request so that we can start it over
776 * entirely, or even put it back on the request queue. 824 * entirely, or even put it back on the request queue.
777 */ 825 */
778static void restore_request(struct request *rq) 826static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq)
779{ 827{
828
829 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
830
780 if (rq->buffer != bio_data(rq->bio)) { 831 if (rq->buffer != bio_data(rq->bio)) {
781 sector_t n = 832 sector_t n =
782 (rq->buffer - (char *)bio_data(rq->bio)) / SECTOR_SIZE; 833 (rq->buffer - (char *)bio_data(rq->bio)) / SECTOR_SIZE;
@@ -792,11 +843,11 @@ static void restore_request(struct request *rq)
792 rq->q->prep_rq_fn(rq->q, rq); 843 rq->q->prep_rq_fn(rq->q, rq);
793} 844}
794 845
795/* 846static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq)
796 * All other packet commands.
797 */
798static void ide_cd_request_sense_fixup(struct request *rq)
799{ 847{
848 ide_debug_log(IDE_DBG_FUNC, "Call %s, rq->cmd[0]: 0x%x\n",
849 __func__, rq->cmd[0]);
850
800 /* 851 /*
801 * Some of the trailing request sense fields are optional, 852 * Some of the trailing request sense fields are optional,
802 * and some drives don't send them. Sigh. 853 * and some drives don't send them. Sigh.
@@ -822,6 +873,10 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
822 if (!sense) 873 if (!sense)
823 sense = &local_sense; 874 sense = &local_sense;
824 875
876 ide_debug_log(IDE_DBG_PC, "Call %s, cmd[0]: 0x%x, write: 0x%x, "
877 "timeout: %d, cmd_flags: 0x%x\n", __func__, cmd[0], write,
878 timeout, cmd_flags);
879
825 /* start of retry loop */ 880 /* start of retry loop */
826 do { 881 do {
827 struct request *rq; 882 struct request *rq;
@@ -895,7 +950,6 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
895static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) 950static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
896{ 951{
897 ide_hwif_t *hwif = drive->hwif; 952 ide_hwif_t *hwif = drive->hwif;
898 struct cdrom_info *info = drive->driver_data;
899 struct request *rq = HWGROUP(drive)->rq; 953 struct request *rq = HWGROUP(drive)->rq;
900 xfer_func_t *xferfunc; 954 xfer_func_t *xferfunc;
901 ide_expiry_t *expiry = NULL; 955 ide_expiry_t *expiry = NULL;
@@ -905,13 +959,16 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
905 u16 len; 959 u16 len;
906 u8 ireason; 960 u8 ireason;
907 961
962 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x\n",
963 __func__, rq->cmd[0], write);
964
908 /* check for errors */ 965 /* check for errors */
909 dma = info->dma; 966 dma = drive->dma;
910 if (dma) { 967 if (dma) {
911 info->dma = 0; 968 drive->dma = 0;
912 dma_error = hwif->dma_ops->dma_end(drive); 969 dma_error = hwif->dma_ops->dma_end(drive);
913 if (dma_error) { 970 if (dma_error) {
914 printk(KERN_ERR "%s: DMA %s error\n", drive->name, 971 printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name,
915 write ? "write" : "read"); 972 write ? "write" : "read");
916 ide_dma_off(drive); 973 ide_dma_off(drive);
917 } 974 }
@@ -937,8 +994,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
937 if (thislen > len) 994 if (thislen > len)
938 thislen = len; 995 thislen = len;
939 996
997 ide_debug_log(IDE_DBG_PC, "%s: DRQ: stat: 0x%x, thislen: %d\n",
998 __func__, stat, thislen);
999
940 /* If DRQ is clear, the command has completed. */ 1000 /* If DRQ is clear, the command has completed. */
941 if ((stat & DRQ_STAT) == 0) { 1001 if ((stat & ATA_DRQ) == 0) {
942 if (blk_fs_request(rq)) { 1002 if (blk_fs_request(rq)) {
943 /* 1003 /*
944 * If we're not done reading/writing, complain. 1004 * If we're not done reading/writing, complain.
@@ -946,7 +1006,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
946 */ 1006 */
947 uptodate = 1; 1007 uptodate = 1;
948 if (rq->current_nr_sectors > 0) { 1008 if (rq->current_nr_sectors > 0) {
949 printk(KERN_ERR "%s: %s: data underrun " 1009 printk(KERN_ERR PFX "%s: %s: data underrun "
950 "(%d blocks)\n", 1010 "(%d blocks)\n",
951 drive->name, __func__, 1011 drive->name, __func__,
952 rq->current_nr_sectors); 1012 rq->current_nr_sectors);
@@ -957,7 +1017,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
957 cdrom_end_request(drive, uptodate); 1017 cdrom_end_request(drive, uptodate);
958 return ide_stopped; 1018 return ide_stopped;
959 } else if (!blk_pc_request(rq)) { 1019 } else if (!blk_pc_request(rq)) {
960 ide_cd_request_sense_fixup(rq); 1020 ide_cd_request_sense_fixup(drive, rq);
961 /* complain if we still have data left to transfer */ 1021 /* complain if we still have data left to transfer */
962 uptodate = rq->data_len ? 0 : 1; 1022 uptodate = rq->data_len ? 0 : 1;
963 } 1023 }
@@ -1000,6 +1060,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1000 xferfunc = hwif->tp_ops->input_data; 1060 xferfunc = hwif->tp_ops->input_data;
1001 } 1061 }
1002 1062
1063 ide_debug_log(IDE_DBG_PC, "%s: data transfer, rq->cmd_type: 0x%x, "
1064 "ireason: 0x%x\n", __func__, rq->cmd_type, ireason);
1065
1003 /* transfer data */ 1066 /* transfer data */
1004 while (thislen > 0) { 1067 while (thislen > 0) {
1005 u8 *ptr = blk_fs_request(rq) ? NULL : rq->data; 1068 u8 *ptr = blk_fs_request(rq) ? NULL : rq->data;
@@ -1024,7 +1087,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1024 */ 1087 */
1025 ide_pad_transfer(drive, 0, thislen); 1088 ide_pad_transfer(drive, 0, thislen);
1026 else { 1089 else {
1027 printk(KERN_ERR "%s: confused, missing data\n", 1090 printk(KERN_ERR PFX "%s: confused, missing data\n",
1028 drive->name); 1091 drive->name);
1029 blk_dump_rq_flags(rq, rq_data_dir(rq) 1092 blk_dump_rq_flags(rq, rq_data_dir(rq)
1030 ? "cdrom_newpc_intr, write" 1093 ? "cdrom_newpc_intr, write"
@@ -1111,9 +1174,13 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
1111 unsigned short sectors_per_frame = 1174 unsigned short sectors_per_frame =
1112 queue_hardsect_size(drive->queue) >> SECTOR_BITS; 1175 queue_hardsect_size(drive->queue) >> SECTOR_BITS;
1113 1176
1177 ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x, "
1178 "secs_per_frame: %u\n",
1179 __func__, rq->cmd[0], write, sectors_per_frame);
1180
1114 if (write) { 1181 if (write) {
1115 /* disk has become write protected */ 1182 /* disk has become write protected */
1116 if (cd->disk->policy) { 1183 if (get_disk_ro(cd->disk)) {
1117 cdrom_end_request(drive, 0); 1184 cdrom_end_request(drive, 0);
1118 return ide_stopped; 1185 return ide_stopped;
1119 } 1186 }
@@ -1122,7 +1189,7 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
1122 * We may be retrying this request after an error. Fix up any 1189 * We may be retrying this request after an error. Fix up any
1123 * weirdness which might be present in the request packet. 1190 * weirdness which might be present in the request packet.
1124 */ 1191 */
1125 restore_request(rq); 1192 ide_cd_restore_request(drive, rq);
1126 } 1193 }
1127 1194
1128 /* use DMA, if possible / writes *must* be hardware frame aligned */ 1195 /* use DMA, if possible / writes *must* be hardware frame aligned */
@@ -1132,9 +1199,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
1132 cdrom_end_request(drive, 0); 1199 cdrom_end_request(drive, 0);
1133 return ide_stopped; 1200 return ide_stopped;
1134 } 1201 }
1135 cd->dma = 0; 1202 drive->dma = 0;
1136 } else 1203 } else
1137 cd->dma = drive->using_dma; 1204 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
1138 1205
1139 if (write) 1206 if (write)
1140 cd->devinfo.media_written = 1; 1207 cd->devinfo.media_written = 1;
@@ -1151,28 +1218,30 @@ static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)
1151 1218
1152static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) 1219static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1153{ 1220{
1154 struct cdrom_info *info = drive->driver_data; 1221
1222 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, "
1223 "rq->cmd_type: 0x%x\n", __func__, rq->cmd[0],
1224 rq->cmd_type);
1155 1225
1156 if (blk_pc_request(rq)) 1226 if (blk_pc_request(rq))
1157 rq->cmd_flags |= REQ_QUIET; 1227 rq->cmd_flags |= REQ_QUIET;
1158 else 1228 else
1159 rq->cmd_flags &= ~REQ_FAILED; 1229 rq->cmd_flags &= ~REQ_FAILED;
1160 1230
1161 info->dma = 0; 1231 drive->dma = 0;
1162 1232
1163 /* sg request */ 1233 /* sg request */
1164 if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) { 1234 if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) {
1165 struct request_queue *q = drive->queue; 1235 struct request_queue *q = drive->queue;
1166 unsigned int alignment; 1236 unsigned int alignment;
1167 unsigned long addr; 1237 char *buf;
1168 unsigned long stack_mask = ~(THREAD_SIZE - 1);
1169 1238
1170 if (rq->bio) 1239 if (rq->bio)
1171 addr = (unsigned long)bio_data(rq->bio); 1240 buf = bio_data(rq->bio);
1172 else 1241 else
1173 addr = (unsigned long)rq->data; 1242 buf = rq->data;
1174 1243
1175 info->dma = drive->using_dma; 1244 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
1176 1245
1177 /* 1246 /*
1178 * check if dma is safe 1247 * check if dma is safe
@@ -1181,18 +1250,13 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1181 * separate masks. 1250 * separate masks.
1182 */ 1251 */
1183 alignment = queue_dma_alignment(q) | q->dma_pad_mask; 1252 alignment = queue_dma_alignment(q) | q->dma_pad_mask;
1184 if (addr & alignment || rq->data_len & alignment) 1253 if ((unsigned long)buf & alignment
1185 info->dma = 0; 1254 || rq->data_len & q->dma_pad_mask
1186 1255 || object_is_on_stack(buf))
1187 if (!((addr & stack_mask) ^ 1256 drive->dma = 0;
1188 ((unsigned long)current->stack & stack_mask)))
1189 info->dma = 0;
1190 } 1257 }
1191} 1258}
1192 1259
1193/*
1194 * cdrom driver request routine.
1195 */
1196static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, 1260static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1197 sector_t block) 1261 sector_t block)
1198{ 1262{
@@ -1200,19 +1264,24 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1200 ide_handler_t *fn; 1264 ide_handler_t *fn;
1201 int xferlen; 1265 int xferlen;
1202 1266
1267 ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, "
1268 "rq->cmd_type: 0x%x, block: %llu\n",
1269 __func__, rq->cmd[0], rq->cmd_type,
1270 (unsigned long long)block);
1271
1203 if (blk_fs_request(rq)) { 1272 if (blk_fs_request(rq)) {
1204 if (drive->atapi_flags & IDE_AFLAG_SEEKING) { 1273 if (drive->atapi_flags & IDE_AFLAG_SEEKING) {
1205 ide_hwif_t *hwif = drive->hwif; 1274 ide_hwif_t *hwif = drive->hwif;
1206 unsigned long elapsed = jiffies - info->start_seek; 1275 unsigned long elapsed = jiffies - info->start_seek;
1207 int stat = hwif->tp_ops->read_status(hwif); 1276 int stat = hwif->tp_ops->read_status(hwif);
1208 1277
1209 if ((stat & SEEK_STAT) != SEEK_STAT) { 1278 if ((stat & ATA_DSC) != ATA_DSC) {
1210 if (elapsed < IDECD_SEEK_TIMEOUT) { 1279 if (elapsed < IDECD_SEEK_TIMEOUT) {
1211 ide_stall_queue(drive, 1280 ide_stall_queue(drive,
1212 IDECD_SEEK_TIMER); 1281 IDECD_SEEK_TIMER);
1213 return ide_stopped; 1282 return ide_stopped;
1214 } 1283 }
1215 printk(KERN_ERR "%s: DSC timeout\n", 1284 printk(KERN_ERR PFX "%s: DSC timeout\n",
1216 drive->name); 1285 drive->name);
1217 } 1286 }
1218 drive->atapi_flags &= ~IDE_AFLAG_SEEKING; 1287 drive->atapi_flags &= ~IDE_AFLAG_SEEKING;
@@ -1220,11 +1289,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1220 if (rq_data_dir(rq) == READ && 1289 if (rq_data_dir(rq) == READ &&
1221 IDE_LARGE_SEEK(info->last_block, block, 1290 IDE_LARGE_SEEK(info->last_block, block,
1222 IDECD_SEEK_THRESHOLD) && 1291 IDECD_SEEK_THRESHOLD) &&
1223 drive->dsc_overlap) { 1292 (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP)) {
1224 xferlen = 0; 1293 xferlen = 0;
1225 fn = cdrom_start_seek_continuation; 1294 fn = cdrom_start_seek_continuation;
1226 1295
1227 info->dma = 0; 1296 drive->dma = 0;
1228 info->start_seek = jiffies; 1297 info->start_seek = jiffies;
1229 1298
1230 ide_cd_prepare_seek_request(drive, rq); 1299 ide_cd_prepare_seek_request(drive, rq);
@@ -1253,7 +1322,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1253 cdrom_end_request(drive, 1); 1322 cdrom_end_request(drive, 1);
1254 return ide_stopped; 1323 return ide_stopped;
1255 } else { 1324 } else {
1256 blk_dump_rq_flags(rq, "ide-cd bad flags"); 1325 blk_dump_rq_flags(rq, DRV_NAME " bad flags");
1257 cdrom_end_request(drive, 0); 1326 cdrom_end_request(drive, 0);
1258 return ide_stopped; 1327 return ide_stopped;
1259 } 1328 }
@@ -1283,6 +1352,8 @@ int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
1283 struct cdrom_device_info *cdi = &info->devinfo; 1352 struct cdrom_device_info *cdi = &info->devinfo;
1284 unsigned char cmd[BLK_MAX_CDB]; 1353 unsigned char cmd[BLK_MAX_CDB];
1285 1354
1355 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1356
1286 memset(cmd, 0, BLK_MAX_CDB); 1357 memset(cmd, 0, BLK_MAX_CDB);
1287 cmd[0] = GPCMD_TEST_UNIT_READY; 1358 cmd[0] = GPCMD_TEST_UNIT_READY;
1288 1359
@@ -1309,6 +1380,8 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
1309 unsigned len = sizeof(capbuf); 1380 unsigned len = sizeof(capbuf);
1310 u32 blocklen; 1381 u32 blocklen;
1311 1382
1383 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1384
1312 memset(cmd, 0, BLK_MAX_CDB); 1385 memset(cmd, 0, BLK_MAX_CDB);
1313 cmd[0] = GPCMD_READ_CDVD_CAPACITY; 1386 cmd[0] = GPCMD_READ_CDVD_CAPACITY;
1314 1387
@@ -1328,16 +1401,20 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
1328 case 4096: 1401 case 4096:
1329 break; 1402 break;
1330 default: 1403 default:
1331 printk(KERN_ERR "%s: weird block size %u\n", 1404 printk(KERN_ERR PFX "%s: weird block size %u\n",
1332 drive->name, blocklen); 1405 drive->name, blocklen);
1333 printk(KERN_ERR "%s: default to 2kb block size\n", 1406 printk(KERN_ERR PFX "%s: default to 2kb block size\n",
1334 drive->name); 1407 drive->name);
1335 blocklen = 2048; 1408 blocklen = 2048;
1336 break; 1409 break;
1337 } 1410 }
1338 1411
1339 *capacity = 1 + be32_to_cpu(capbuf.lba); 1412 *capacity = 1 + be32_to_cpu(capbuf.lba);
1340 *sectors_per_frame = blocklen >> SECTOR_BITS; 1413 *sectors_per_frame = blocklen >> SECTOR_BITS;
1414
1415 ide_debug_log(IDE_DBG_PROBE, "%s: cap: %lu, sectors_per_frame: %lu\n",
1416 __func__, *capacity, *sectors_per_frame);
1417
1341 return 0; 1418 return 0;
1342} 1419}
1343 1420
@@ -1347,6 +1424,8 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
1347{ 1424{
1348 unsigned char cmd[BLK_MAX_CDB]; 1425 unsigned char cmd[BLK_MAX_CDB];
1349 1426
1427 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1428
1350 memset(cmd, 0, BLK_MAX_CDB); 1429 memset(cmd, 0, BLK_MAX_CDB);
1351 1430
1352 cmd[0] = GPCMD_READ_TOC_PMA_ATIP; 1431 cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
@@ -1375,11 +1454,13 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense)
1375 long last_written; 1454 long last_written;
1376 unsigned long sectors_per_frame = SECTORS_PER_FRAME; 1455 unsigned long sectors_per_frame = SECTORS_PER_FRAME;
1377 1456
1457 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1458
1378 if (toc == NULL) { 1459 if (toc == NULL) {
1379 /* try to allocate space */ 1460 /* try to allocate space */
1380 toc = kmalloc(sizeof(struct atapi_toc), GFP_KERNEL); 1461 toc = kmalloc(sizeof(struct atapi_toc), GFP_KERNEL);
1381 if (toc == NULL) { 1462 if (toc == NULL) {
1382 printk(KERN_ERR "%s: No cdrom TOC buffer!\n", 1463 printk(KERN_ERR PFX "%s: No cdrom TOC buffer!\n",
1383 drive->name); 1464 drive->name);
1384 return -ENOMEM; 1465 return -ENOMEM;
1385 } 1466 }
@@ -1535,6 +1616,8 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, u8 *buf)
1535 struct packet_command cgc; 1616 struct packet_command cgc;
1536 int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; 1617 int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE;
1537 1618
1619 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1620
1538 if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0) 1621 if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0)
1539 size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; 1622 size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE;
1540 1623
@@ -1553,6 +1636,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
1553 struct cdrom_info *cd = drive->driver_data; 1636 struct cdrom_info *cd = drive->driver_data;
1554 u16 curspeed, maxspeed; 1637 u16 curspeed, maxspeed;
1555 1638
1639 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1640
1556 if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) { 1641 if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) {
1557 curspeed = le16_to_cpup((__le16 *)&buf[8 + 14]); 1642 curspeed = le16_to_cpup((__le16 *)&buf[8 + 14]);
1558 maxspeed = le16_to_cpup((__le16 *)&buf[8 + 8]); 1643 maxspeed = le16_to_cpup((__le16 *)&buf[8 + 8]);
@@ -1561,6 +1646,9 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
1561 maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]); 1646 maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]);
1562 } 1647 }
1563 1648
1649 ide_debug_log(IDE_DBG_PROBE, "%s: curspeed: %u, maxspeed: %u\n",
1650 __func__, curspeed, maxspeed);
1651
1564 cd->current_speed = (curspeed + (176/2)) / 176; 1652 cd->current_speed = (curspeed + (176/2)) / 176;
1565 cd->max_speed = (maxspeed + (176/2)) / 176; 1653 cd->max_speed = (maxspeed + (176/2)) / 176;
1566} 1654}
@@ -1593,6 +1681,8 @@ static int ide_cdrom_register(ide_drive_t *drive, int nslots)
1593 struct cdrom_info *info = drive->driver_data; 1681 struct cdrom_info *info = drive->driver_data;
1594 struct cdrom_device_info *devinfo = &info->devinfo; 1682 struct cdrom_device_info *devinfo = &info->devinfo;
1595 1683
1684 ide_debug_log(IDE_DBG_PROBE, "Call %s, nslots: %d\n", __func__, nslots);
1685
1596 devinfo->ops = &ide_cdrom_dops; 1686 devinfo->ops = &ide_cdrom_dops;
1597 devinfo->speed = info->current_speed; 1687 devinfo->speed = info->current_speed;
1598 devinfo->capacity = nslots; 1688 devinfo->capacity = nslots;
@@ -1614,13 +1704,17 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1614 mechtype_t mechtype; 1704 mechtype_t mechtype;
1615 int nslots = 1; 1705 int nslots = 1;
1616 1706
1707 ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->media: 0x%x, "
1708 "drive->atapi_flags: 0x%lx\n", __func__, drive->media,
1709 drive->atapi_flags);
1710
1617 cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | 1711 cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R |
1618 CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO | 1712 CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO |
1619 CDC_MO_DRIVE | CDC_RAM); 1713 CDC_MO_DRIVE | CDC_RAM);
1620 1714
1621 if (drive->media == ide_optical) { 1715 if (drive->media == ide_optical) {
1622 cdi->mask &= ~(CDC_MO_DRIVE | CDC_RAM); 1716 cdi->mask &= ~(CDC_MO_DRIVE | CDC_RAM);
1623 printk(KERN_ERR "%s: ATAPI magneto-optical drive\n", 1717 printk(KERN_ERR PFX "%s: ATAPI magneto-optical drive\n",
1624 drive->name); 1718 drive->name);
1625 return nslots; 1719 return nslots;
1626 } 1720 }
@@ -1644,7 +1738,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1644 return 0; 1738 return 0;
1645 1739
1646 if ((buf[8 + 6] & 0x01) == 0) 1740 if ((buf[8 + 6] & 0x01) == 0)
1647 drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK; 1741 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;
1648 if (buf[8 + 6] & 0x08) 1742 if (buf[8 + 6] & 0x08)
1649 drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT; 1743 drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT;
1650 if (buf[8 + 3] & 0x01) 1744 if (buf[8 + 3] & 0x01)
@@ -1678,7 +1772,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1678 1772
1679 ide_cdrom_update_speed(drive, buf); 1773 ide_cdrom_update_speed(drive, buf);
1680 1774
1681 printk(KERN_INFO "%s: ATAPI", drive->name); 1775 printk(KERN_INFO PFX "%s: ATAPI", drive->name);
1682 1776
1683 /* don't print speed if the drive reported 0 */ 1777 /* don't print speed if the drive reported 0 */
1684 if (cd->max_speed) 1778 if (cd->max_speed)
@@ -1689,7 +1783,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1689 if ((cdi->mask & CDC_DVD_R) == 0 || (cdi->mask & CDC_DVD_RAM) == 0) 1783 if ((cdi->mask & CDC_DVD_R) == 0 || (cdi->mask & CDC_DVD_RAM) == 0)
1690 printk(KERN_CONT " DVD%s%s", 1784 printk(KERN_CONT " DVD%s%s",
1691 (cdi->mask & CDC_DVD_R) ? "" : "-R", 1785 (cdi->mask & CDC_DVD_R) ? "" : "-R",
1692 (cdi->mask & CDC_DVD_RAM) ? "" : "-RAM"); 1786 (cdi->mask & CDC_DVD_RAM) ? "" : "/RAM");
1693 1787
1694 if ((cdi->mask & CDC_CD_R) == 0 || (cdi->mask & CDC_CD_RW) == 0) 1788 if ((cdi->mask & CDC_CD_R) == 0 || (cdi->mask & CDC_CD_RW) == 0)
1695 printk(KERN_CONT " CD%s%s", 1789 printk(KERN_CONT " CD%s%s",
@@ -1701,7 +1795,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1701 else 1795 else
1702 printk(KERN_CONT " drive"); 1796 printk(KERN_CONT " drive");
1703 1797
1704 printk(KERN_CONT ", %dkB Cache\n", be16_to_cpup((__be16 *)&buf[8 + 12])); 1798 printk(KERN_CONT ", %dkB Cache\n",
1799 be16_to_cpup((__be16 *)&buf[8 + 12]));
1705 1800
1706 return nslots; 1801 return nslots;
1707} 1802}
@@ -1813,13 +1908,22 @@ static ide_proc_entry_t idecd_proc[] = {
1813 { NULL, 0, NULL, NULL } 1908 { NULL, 0, NULL, NULL }
1814}; 1909};
1815 1910
1816static void ide_cdrom_add_settings(ide_drive_t *drive) 1911ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP);
1912
1913static const struct ide_proc_devset idecd_settings[] = {
1914 IDE_PROC_DEVSET(dsc_overlap, 0, 1),
1915 { 0 },
1916};
1917
1918static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
1817{ 1919{
1818 ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, 1920 return idecd_proc;
1819 &drive->dsc_overlap, NULL); 1921}
1922
1923static const struct ide_proc_devset *ide_cd_proc_devsets(ide_drive_t *drive)
1924{
1925 return idecd_settings;
1820} 1926}
1821#else
1822static inline void ide_cdrom_add_settings(ide_drive_t *drive) { ; }
1823#endif 1927#endif
1824 1928
1825static const struct cd_list_entry ide_cd_quirks_list[] = { 1929static const struct cd_list_entry ide_cd_quirks_list[] = {
@@ -1863,17 +1967,18 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
1863 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1967 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1864 { "Optiarc DVD RW AD-7200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1968 { "Optiarc DVD RW AD-7200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1865 { "Optiarc DVD RW AD-7543A", NULL, IDE_AFLAG_NO_AUTOCLOSE }, 1969 { "Optiarc DVD RW AD-7543A", NULL, IDE_AFLAG_NO_AUTOCLOSE },
1970 { "TEAC CD-ROM CD-224E", NULL, IDE_AFLAG_NO_AUTOCLOSE },
1866 { NULL, NULL, 0 } 1971 { NULL, NULL, 0 }
1867}; 1972};
1868 1973
1869static unsigned int ide_cd_flags(struct hd_driveid *id) 1974static unsigned int ide_cd_flags(u16 *id)
1870{ 1975{
1871 const struct cd_list_entry *cle = ide_cd_quirks_list; 1976 const struct cd_list_entry *cle = ide_cd_quirks_list;
1872 1977
1873 while (cle->id_model) { 1978 while (cle->id_model) {
1874 if (strcmp(cle->id_model, id->model) == 0 && 1979 if (strcmp(cle->id_model, (char *)&id[ATA_ID_PROD]) == 0 &&
1875 (cle->id_firmware == NULL || 1980 (cle->id_firmware == NULL ||
1876 strstr(id->fw_rev, cle->id_firmware))) 1981 strstr((char *)&id[ATA_ID_FW_REV], cle->id_firmware)))
1877 return cle->cd_flags; 1982 return cle->cd_flags;
1878 cle++; 1983 cle++;
1879 } 1984 }
@@ -1885,9 +1990,12 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1885{ 1990{
1886 struct cdrom_info *cd = drive->driver_data; 1991 struct cdrom_info *cd = drive->driver_data;
1887 struct cdrom_device_info *cdi = &cd->devinfo; 1992 struct cdrom_device_info *cdi = &cd->devinfo;
1888 struct hd_driveid *id = drive->id; 1993 u16 *id = drive->id;
1994 char *fw_rev = (char *)&id[ATA_ID_FW_REV];
1889 int nslots; 1995 int nslots;
1890 1996
1997 ide_debug_log(IDE_DBG_PROBE, "Call %s\n", __func__);
1998
1891 blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); 1999 blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn);
1892 blk_queue_dma_alignment(drive->queue, 31); 2000 blk_queue_dma_alignment(drive->queue, 31);
1893 blk_queue_update_dma_pad(drive->queue, 15); 2001 blk_queue_update_dma_pad(drive->queue, 15);
@@ -1895,20 +2003,15 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1895 if (!drive->queue->unplug_delay) 2003 if (!drive->queue->unplug_delay)
1896 drive->queue->unplug_delay = 1; 2004 drive->queue->unplug_delay = 1;
1897 2005
1898 drive->special.all = 0; 2006 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
1899 2007 drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id);
1900 drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT |
1901 ide_cd_flags(id);
1902
1903 if ((id->config & 0x0060) == 0x20)
1904 drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
1905 2008
1906 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) && 2009 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) &&
1907 id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') 2010 fw_rev[4] == '1' && fw_rev[6] <= '2')
1908 drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD | 2011 drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD |
1909 IDE_AFLAG_TOCADDR_AS_BCD); 2012 IDE_AFLAG_TOCADDR_AS_BCD);
1910 else if ((drive->atapi_flags & IDE_AFLAG_VERTOS_600_ESD) && 2013 else if ((drive->atapi_flags & IDE_AFLAG_VERTOS_600_ESD) &&
1911 id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') 2014 fw_rev[4] == '1' && fw_rev[6] <= '2')
1912 drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD; 2015 drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD;
1913 else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD) 2016 else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD)
1914 /* 3 => use CD in slot 0 */ 2017 /* 3 => use CD in slot 0 */
@@ -1919,15 +2022,19 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1919 /* set correct block size */ 2022 /* set correct block size */
1920 blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE); 2023 blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE);
1921 2024
1922 drive->dsc_overlap = (drive->next != drive); 2025 if (drive->next != drive)
2026 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP;
2027 else
2028 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP;
1923 2029
1924 if (ide_cdrom_register(drive, nslots)) { 2030 if (ide_cdrom_register(drive, nslots)) {
1925 printk(KERN_ERR "%s: %s failed to register device with the" 2031 printk(KERN_ERR PFX "%s: %s failed to register device with the"
1926 " cdrom driver.\n", drive->name, __func__); 2032 " cdrom driver.\n", drive->name, __func__);
1927 cd->devinfo.handle = NULL; 2033 cd->devinfo.handle = NULL;
1928 return 1; 2034 return 1;
1929 } 2035 }
1930 ide_cdrom_add_settings(drive); 2036
2037 ide_proc_register_driver(drive, cd->driver);
1931 return 0; 2038 return 0;
1932} 2039}
1933 2040
@@ -1935,6 +2042,8 @@ static void ide_cd_remove(ide_drive_t *drive)
1935{ 2042{
1936 struct cdrom_info *info = drive->driver_data; 2043 struct cdrom_info *info = drive->driver_data;
1937 2044
2045 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
2046
1938 ide_proc_unregister_driver(drive, info->driver); 2047 ide_proc_unregister_driver(drive, info->driver);
1939 2048
1940 del_gendisk(info->disk); 2049 del_gendisk(info->disk);
@@ -1944,15 +2053,17 @@ static void ide_cd_remove(ide_drive_t *drive)
1944 2053
1945static void ide_cd_release(struct kref *kref) 2054static void ide_cd_release(struct kref *kref)
1946{ 2055{
1947 struct cdrom_info *info = to_ide_cd(kref); 2056 struct cdrom_info *info = to_ide_drv(kref, cdrom_info);
1948 struct cdrom_device_info *devinfo = &info->devinfo; 2057 struct cdrom_device_info *devinfo = &info->devinfo;
1949 ide_drive_t *drive = info->drive; 2058 ide_drive_t *drive = info->drive;
1950 struct gendisk *g = info->disk; 2059 struct gendisk *g = info->disk;
1951 2060
2061 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
2062
1952 kfree(info->toc); 2063 kfree(info->toc);
1953 if (devinfo->handle == drive) 2064 if (devinfo->handle == drive)
1954 unregister_cdrom(devinfo); 2065 unregister_cdrom(devinfo);
1955 drive->dsc_overlap = 0; 2066 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP;
1956 drive->driver_data = NULL; 2067 drive->driver_data = NULL;
1957 blk_queue_prep_rq(drive->queue, NULL); 2068 blk_queue_prep_rq(drive->queue, NULL);
1958 g->private_data = NULL; 2069 g->private_data = NULL;
@@ -1971,27 +2082,24 @@ static ide_driver_t ide_cdrom_driver = {
1971 .probe = ide_cd_probe, 2082 .probe = ide_cd_probe,
1972 .remove = ide_cd_remove, 2083 .remove = ide_cd_remove,
1973 .version = IDECD_VERSION, 2084 .version = IDECD_VERSION,
1974 .media = ide_cdrom,
1975 .supports_dsc_overlap = 1,
1976 .do_request = ide_cd_do_request, 2085 .do_request = ide_cd_do_request,
1977 .end_request = ide_end_request, 2086 .end_request = ide_end_request,
1978 .error = __ide_error, 2087 .error = __ide_error,
1979#ifdef CONFIG_IDE_PROC_FS 2088#ifdef CONFIG_IDE_PROC_FS
1980 .proc = idecd_proc, 2089 .proc_entries = ide_cd_proc_entries,
2090 .proc_devsets = ide_cd_proc_devsets,
1981#endif 2091#endif
1982}; 2092};
1983 2093
1984static int idecd_open(struct inode *inode, struct file *file) 2094static int idecd_open(struct block_device *bdev, fmode_t mode)
1985{ 2095{
1986 struct gendisk *disk = inode->i_bdev->bd_disk; 2096 struct cdrom_info *info = ide_cd_get(bdev->bd_disk);
1987 struct cdrom_info *info;
1988 int rc = -ENOMEM; 2097 int rc = -ENOMEM;
1989 2098
1990 info = ide_cd_get(disk);
1991 if (!info) 2099 if (!info)
1992 return -ENXIO; 2100 return -ENXIO;
1993 2101
1994 rc = cdrom_open(&info->devinfo, inode, file); 2102 rc = cdrom_open(&info->devinfo, bdev, mode);
1995 2103
1996 if (rc < 0) 2104 if (rc < 0)
1997 ide_cd_put(info); 2105 ide_cd_put(info);
@@ -1999,12 +2107,11 @@ static int idecd_open(struct inode *inode, struct file *file)
1999 return rc; 2107 return rc;
2000} 2108}
2001 2109
2002static int idecd_release(struct inode *inode, struct file *file) 2110static int idecd_release(struct gendisk *disk, fmode_t mode)
2003{ 2111{
2004 struct gendisk *disk = inode->i_bdev->bd_disk; 2112 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2005 struct cdrom_info *info = ide_cd_g(disk);
2006 2113
2007 cdrom_release(&info->devinfo, file); 2114 cdrom_release(&info->devinfo, mode);
2008 2115
2009 ide_cd_put(info); 2116 ide_cd_put(info);
2010 2117
@@ -2050,11 +2157,10 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg)
2050 return 0; 2157 return 0;
2051} 2158}
2052 2159
2053static int idecd_ioctl(struct inode *inode, struct file *file, 2160static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
2054 unsigned int cmd, unsigned long arg) 2161 unsigned int cmd, unsigned long arg)
2055{ 2162{
2056 struct block_device *bdev = inode->i_bdev; 2163 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
2057 struct cdrom_info *info = ide_cd_g(bdev->bd_disk);
2058 int err; 2164 int err;
2059 2165
2060 switch (cmd) { 2166 switch (cmd) {
@@ -2066,22 +2172,22 @@ static int idecd_ioctl(struct inode *inode, struct file *file,
2066 break; 2172 break;
2067 } 2173 }
2068 2174
2069 err = generic_ide_ioctl(info->drive, file, bdev, cmd, arg); 2175 err = generic_ide_ioctl(info->drive, bdev, cmd, arg);
2070 if (err == -EINVAL) 2176 if (err == -EINVAL)
2071 err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg); 2177 err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg);
2072 2178
2073 return err; 2179 return err;
2074} 2180}
2075 2181
2076static int idecd_media_changed(struct gendisk *disk) 2182static int idecd_media_changed(struct gendisk *disk)
2077{ 2183{
2078 struct cdrom_info *info = ide_cd_g(disk); 2184 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2079 return cdrom_media_changed(&info->devinfo); 2185 return cdrom_media_changed(&info->devinfo);
2080} 2186}
2081 2187
2082static int idecd_revalidate_disk(struct gendisk *disk) 2188static int idecd_revalidate_disk(struct gendisk *disk)
2083{ 2189{
2084 struct cdrom_info *info = ide_cd_g(disk); 2190 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2085 struct request_sense sense; 2191 struct request_sense sense;
2086 2192
2087 ide_cd_read_toc(info->drive, &sense); 2193 ide_cd_read_toc(info->drive, &sense);
@@ -2093,15 +2199,18 @@ static struct block_device_operations idecd_ops = {
2093 .owner = THIS_MODULE, 2199 .owner = THIS_MODULE,
2094 .open = idecd_open, 2200 .open = idecd_open,
2095 .release = idecd_release, 2201 .release = idecd_release,
2096 .ioctl = idecd_ioctl, 2202 .locked_ioctl = idecd_ioctl,
2097 .media_changed = idecd_media_changed, 2203 .media_changed = idecd_media_changed,
2098 .revalidate_disk = idecd_revalidate_disk 2204 .revalidate_disk = idecd_revalidate_disk
2099}; 2205};
2100 2206
2101/* module options */ 2207/* module options */
2102static char *ignore; 2208static char *ignore;
2103
2104module_param(ignore, charp, 0400); 2209module_param(ignore, charp, 0400);
2210
2211static unsigned long debug_mask;
2212module_param(debug_mask, ulong, 0644);
2213
2105MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); 2214MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
2106 2215
2107static int ide_cd_probe(ide_drive_t *drive) 2216static int ide_cd_probe(ide_drive_t *drive)
@@ -2110,23 +2219,30 @@ static int ide_cd_probe(ide_drive_t *drive)
2110 struct gendisk *g; 2219 struct gendisk *g;
2111 struct request_sense sense; 2220 struct request_sense sense;
2112 2221
2222 ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->driver_req: %s, "
2223 "drive->media: 0x%x\n", __func__, drive->driver_req,
2224 drive->media);
2225
2113 if (!strstr("ide-cdrom", drive->driver_req)) 2226 if (!strstr("ide-cdrom", drive->driver_req))
2114 goto failed; 2227 goto failed;
2115 if (!drive->present) 2228
2116 goto failed;
2117 if (drive->media != ide_cdrom && drive->media != ide_optical) 2229 if (drive->media != ide_cdrom && drive->media != ide_optical)
2118 goto failed; 2230 goto failed;
2231
2119 /* skip drives that we were told to ignore */ 2232 /* skip drives that we were told to ignore */
2120 if (ignore != NULL) { 2233 if (ignore != NULL) {
2121 if (strstr(ignore, drive->name)) { 2234 if (strstr(ignore, drive->name)) {
2122 printk(KERN_INFO "ide-cd: ignoring drive %s\n", 2235 printk(KERN_INFO PFX "ignoring drive %s\n",
2123 drive->name); 2236 drive->name);
2124 goto failed; 2237 goto failed;
2125 } 2238 }
2126 } 2239 }
2240
2241 drive->debug_mask = debug_mask;
2242
2127 info = kzalloc(sizeof(struct cdrom_info), GFP_KERNEL); 2243 info = kzalloc(sizeof(struct cdrom_info), GFP_KERNEL);
2128 if (info == NULL) { 2244 if (info == NULL) {
2129 printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", 2245 printk(KERN_ERR PFX "%s: Can't allocate a cdrom structure\n",
2130 drive->name); 2246 drive->name);
2131 goto failed; 2247 goto failed;
2132 } 2248 }
@@ -2137,8 +2253,6 @@ static int ide_cd_probe(ide_drive_t *drive)
2137 2253
2138 ide_init_disk(g, drive); 2254 ide_init_disk(g, drive);
2139 2255
2140 ide_proc_register_driver(drive, &ide_cdrom_driver);
2141
2142 kref_init(&info->kref); 2256 kref_init(&info->kref);
2143 2257
2144 info->drive = drive; 2258 info->drive = drive;
@@ -2153,7 +2267,6 @@ static int ide_cd_probe(ide_drive_t *drive)
2153 g->driverfs_dev = &drive->gendev; 2267 g->driverfs_dev = &drive->gendev;
2154 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 2268 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
2155 if (ide_cdrom_setup(drive)) { 2269 if (ide_cdrom_setup(drive)) {
2156 ide_proc_unregister_driver(drive, &ide_cdrom_driver);
2157 ide_cd_release(&info->kref); 2270 ide_cd_release(&info->kref);
2158 goto failed; 2271 goto failed;
2159 } 2272 }
@@ -2177,6 +2290,7 @@ static void __exit ide_cdrom_exit(void)
2177 2290
2178static int __init ide_cdrom_init(void) 2291static int __init ide_cdrom_init(void)
2179{ 2292{
2293 printk(KERN_INFO DRV_NAME " driver " IDECD_VERSION "\n");
2180 return driver_register(&ide_cdrom_driver.gen_driver); 2294 return driver_register(&ide_cdrom_driver.gen_driver);
2181} 2295}
2182 2296