diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 5969cec58dc1..45a928c058cf 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -687,15 +687,8 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 sta | |||
687 | static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | 687 | static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) |
688 | { | 688 | { |
689 | struct request *rq = HWGROUP(drive)->rq; | 689 | struct request *rq = HWGROUP(drive)->rq; |
690 | ide_hwif_t *hwif = HWIF(drive); | ||
691 | int stat, err, sense_key; | 690 | int stat, err, sense_key; |
692 | 691 | ||
693 | /* We may have bogus DMA interrupts in PIO state here */ | ||
694 | if (HWIF(drive)->dma_status && hwif->atapi_irq_bogon) { | ||
695 | stat = hwif->INB(hwif->dma_status); | ||
696 | /* Should we force the bit as well ? */ | ||
697 | hwif->OUTB(stat, hwif->dma_status); | ||
698 | } | ||
699 | /* Check for errors. */ | 692 | /* Check for errors. */ |
700 | stat = HWIF(drive)->INB(IDE_STATUS_REG); | 693 | stat = HWIF(drive)->INB(IDE_STATUS_REG); |
701 | if (stat_ret) | 694 | if (stat_ret) |
@@ -930,6 +923,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, | |||
930 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | 923 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); |
931 | 924 | ||
932 | if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { | 925 | if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { |
926 | /* waiting for CDB interrupt, not DMA yet. */ | ||
927 | if (info->dma) | ||
928 | drive->waiting_for_dma = 0; | ||
929 | |||
933 | /* packet command */ | 930 | /* packet command */ |
934 | ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry); | 931 | ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry); |
935 | return ide_started; | 932 | return ide_started; |
@@ -972,6 +969,10 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, | |||
972 | /* Check for errors. */ | 969 | /* Check for errors. */ |
973 | if (cdrom_decode_status(drive, DRQ_STAT, NULL)) | 970 | if (cdrom_decode_status(drive, DRQ_STAT, NULL)) |
974 | return ide_stopped; | 971 | return ide_stopped; |
972 | |||
973 | /* Ok, next interrupt will be DMA interrupt. */ | ||
974 | if (info->dma) | ||
975 | drive->waiting_for_dma = 1; | ||
975 | } else { | 976 | } else { |
976 | /* Otherwise, we must wait for DRQ to get set. */ | 977 | /* Otherwise, we must wait for DRQ to get set. */ |
977 | if (ide_wait_stat(&startstop, drive, DRQ_STAT, | 978 | if (ide_wait_stat(&startstop, drive, DRQ_STAT, |
@@ -1103,7 +1104,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) | |||
1103 | if (dma) { | 1104 | if (dma) { |
1104 | info->dma = 0; | 1105 | info->dma = 0; |
1105 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) | 1106 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) |
1106 | __ide_dma_off(drive); | 1107 | ide_dma_off(drive); |
1107 | } | 1108 | } |
1108 | 1109 | ||
1109 | if (cdrom_decode_status(drive, 0, &stat)) | 1110 | if (cdrom_decode_status(drive, 0, &stat)) |
@@ -1699,7 +1700,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
1699 | if (dma) { | 1700 | if (dma) { |
1700 | if (dma_error) { | 1701 | if (dma_error) { |
1701 | printk(KERN_ERR "ide-cd: dma error\n"); | 1702 | printk(KERN_ERR "ide-cd: dma error\n"); |
1702 | __ide_dma_off(drive); | 1703 | ide_dma_off(drive); |
1703 | return ide_error(drive, "dma error", stat); | 1704 | return ide_error(drive, "dma error", stat); |
1704 | } | 1705 | } |
1705 | 1706 | ||
@@ -1825,7 +1826,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) | |||
1825 | info->dma = 0; | 1826 | info->dma = 0; |
1826 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { | 1827 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { |
1827 | printk(KERN_ERR "ide-cd: write dma error\n"); | 1828 | printk(KERN_ERR "ide-cd: write dma error\n"); |
1828 | __ide_dma_off(drive); | 1829 | ide_dma_off(drive); |
1829 | } | 1830 | } |
1830 | } | 1831 | } |
1831 | 1832 | ||
@@ -3254,14 +3255,6 @@ int ide_cdrom_setup (ide_drive_t *drive) | |||
3254 | if (drive->autotune == IDE_TUNE_DEFAULT || | 3255 | if (drive->autotune == IDE_TUNE_DEFAULT || |
3255 | drive->autotune == IDE_TUNE_AUTO) | 3256 | drive->autotune == IDE_TUNE_AUTO) |
3256 | drive->dsc_overlap = (drive->next != drive); | 3257 | drive->dsc_overlap = (drive->next != drive); |
3257 | #if 0 | ||
3258 | drive->dsc_overlap = (HWIF(drive)->no_dsc) ? 0 : 1; | ||
3259 | if (HWIF(drive)->no_dsc) { | ||
3260 | printk(KERN_INFO "ide-cd: %s: disabling DSC overlap\n", | ||
3261 | drive->name); | ||
3262 | drive->dsc_overlap = 0; | ||
3263 | } | ||
3264 | #endif | ||
3265 | 3258 | ||
3266 | if (ide_cdrom_register(drive, nslots)) { | 3259 | if (ide_cdrom_register(drive, nslots)) { |
3267 | printk (KERN_ERR "%s: ide_cdrom_setup failed to register device with the cdrom driver.\n", drive->name); | 3260 | printk (KERN_ERR "%s: ide_cdrom_setup failed to register device with the cdrom driver.\n", drive->name); |
@@ -3360,21 +3353,16 @@ static int idecd_open(struct inode * inode, struct file * file) | |||
3360 | { | 3353 | { |
3361 | struct gendisk *disk = inode->i_bdev->bd_disk; | 3354 | struct gendisk *disk = inode->i_bdev->bd_disk; |
3362 | struct cdrom_info *info; | 3355 | struct cdrom_info *info; |
3363 | ide_drive_t *drive; | ||
3364 | int rc = -ENOMEM; | 3356 | int rc = -ENOMEM; |
3365 | 3357 | ||
3366 | if (!(info = ide_cd_get(disk))) | 3358 | if (!(info = ide_cd_get(disk))) |
3367 | return -ENXIO; | 3359 | return -ENXIO; |
3368 | 3360 | ||
3369 | drive = info->drive; | ||
3370 | |||
3371 | drive->usage++; | ||
3372 | |||
3373 | if (!info->buffer) | 3361 | if (!info->buffer) |
3374 | info->buffer = kmalloc(SECTOR_BUFFER_SIZE, | 3362 | info->buffer = kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL|__GFP_REPEAT); |
3375 | GFP_KERNEL|__GFP_REPEAT); | 3363 | |
3376 | if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file))) | 3364 | if (info->buffer) |
3377 | drive->usage--; | 3365 | rc = cdrom_open(&info->devinfo, inode, file); |
3378 | 3366 | ||
3379 | if (rc < 0) | 3367 | if (rc < 0) |
3380 | ide_cd_put(info); | 3368 | ide_cd_put(info); |
@@ -3386,10 +3374,8 @@ static int idecd_release(struct inode * inode, struct file * file) | |||
3386 | { | 3374 | { |
3387 | struct gendisk *disk = inode->i_bdev->bd_disk; | 3375 | struct gendisk *disk = inode->i_bdev->bd_disk; |
3388 | struct cdrom_info *info = ide_cd_g(disk); | 3376 | struct cdrom_info *info = ide_cd_g(disk); |
3389 | ide_drive_t *drive = info->drive; | ||
3390 | 3377 | ||
3391 | cdrom_release (&info->devinfo, file); | 3378 | cdrom_release (&info->devinfo, file); |
3392 | drive->usage--; | ||
3393 | 3379 | ||
3394 | ide_cd_put(info); | 3380 | ide_cd_put(info); |
3395 | 3381 | ||