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.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index b34fd2bde96f..fe9df38f62cc 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -142,7 +142,6 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
142{ 142{
143 unsigned long sector; 143 unsigned long sector;
144 unsigned long bio_sectors; 144 unsigned long bio_sectors;
145 unsigned long valid;
146 struct cdrom_info *info = drive->driver_data; 145 struct cdrom_info *info = drive->driver_data;
147 146
148 if (!cdrom_log_sense(drive, failed_command, sense)) 147 if (!cdrom_log_sense(drive, failed_command, sense))
@@ -173,17 +172,13 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
173 (sense->information[2] << 8) | 172 (sense->information[2] << 8) |
174 (sense->information[3]); 173 (sense->information[3]);
175 174
176 bio_sectors = bio_sectors(failed_command->bio);
177 if (bio_sectors < 4)
178 bio_sectors = 4;
179 if (drive->queue->hardsect_size == 2048) 175 if (drive->queue->hardsect_size == 2048)
180 /* device sector size is 2K */ 176 /* device sector size is 2K */
181 sector <<= 2; 177 sector <<= 2;
178
179 bio_sectors = max(bio_sectors(failed_command->bio), 4U);
182 sector &= ~(bio_sectors - 1); 180 sector &= ~(bio_sectors - 1);
183 valid = (sector - failed_command->sector) << 9;
184 181
185 if (valid < 0)
186 valid = 0;
187 if (sector < get_capacity(info->disk) && 182 if (sector < get_capacity(info->disk) &&
188 drive->probed_capacity - sector < 4 * 75) 183 drive->probed_capacity - sector < 4 * 75)
189 set_capacity(info->disk, sector); 184 set_capacity(info->disk, sector);
@@ -555,14 +550,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
555 ATAPI_WAIT_PC, cdrom_timer_expiry); 550 ATAPI_WAIT_PC, cdrom_timer_expiry);
556 return ide_started; 551 return ide_started;
557 } else { 552 } else {
558 unsigned long flags; 553 ide_execute_pkt_cmd(drive);
559
560 /* packet command */
561 spin_lock_irqsave(&ide_lock, flags);
562 hwif->OUTBSYNC(drive, WIN_PACKETCMD,
563 hwif->io_ports.command_addr);
564 ndelay(400);
565 spin_unlock_irqrestore(&ide_lock, flags);
566 554
567 return (*handler) (drive); 555 return (*handler) (drive);
568 } 556 }
@@ -613,7 +601,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
613 cmd_len = ATAPI_MIN_CDB_BYTES; 601 cmd_len = ATAPI_MIN_CDB_BYTES;
614 602
615 /* send the command to the device */ 603 /* send the command to the device */
616 HWIF(drive)->atapi_output_bytes(drive, rq->cmd, cmd_len); 604 hwif->output_data(drive, NULL, rq->cmd, cmd_len);
617 605
618 /* start the DMA if need be */ 606 /* start the DMA if need be */
619 if (info->dma) 607 if (info->dma)
@@ -629,7 +617,7 @@ static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len)
629{ 617{
630 while (len > 0) { 618 while (len > 0) {
631 int dum = 0; 619 int dum = 0;
632 xf(drive, &dum, sizeof(dum)); 620 xf(drive, NULL, &dum, sizeof(dum));
633 len -= sizeof(dum); 621 len -= sizeof(dum);
634 } 622 }
635} 623}
@@ -639,7 +627,7 @@ static void ide_cd_drain_data(ide_drive_t *drive, int nsects)
639 while (nsects > 0) { 627 while (nsects > 0) {
640 static char dum[SECTOR_SIZE]; 628 static char dum[SECTOR_SIZE];
641 629
642 drive->hwif->atapi_input_bytes(drive, dum, sizeof(dum)); 630 drive->hwif->input_data(drive, NULL, dum, sizeof(dum));
643 nsects--; 631 nsects--;
644 } 632 }
645} 633}
@@ -666,7 +654,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
666 printk(KERN_ERR "%s: %s: wrong transfer direction!\n", 654 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
667 drive->name, __func__); 655 drive->name, __func__);
668 656
669 xf = rw ? hwif->atapi_output_bytes : hwif->atapi_input_bytes; 657 xf = rw ? hwif->output_data : hwif->input_data;
670 ide_cd_pad_transfer(drive, xf, len); 658 ide_cd_pad_transfer(drive, xf, len);
671 } else if (rw == 0 && ireason == 1) { 659 } else if (rw == 0 && ireason == 1) {
672 /* 660 /*
@@ -1019,10 +1007,10 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1019 1007
1020 if (ireason == 0) { 1008 if (ireason == 0) {
1021 write = 1; 1009 write = 1;
1022 xferfunc = HWIF(drive)->atapi_output_bytes; 1010 xferfunc = hwif->output_data;
1023 } else { 1011 } else {
1024 write = 0; 1012 write = 0;
1025 xferfunc = HWIF(drive)->atapi_input_bytes; 1013 xferfunc = hwif->input_data;
1026 } 1014 }
1027 1015
1028 /* transfer data */ 1016 /* transfer data */
@@ -1061,7 +1049,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1061 if (blen > thislen) 1049 if (blen > thislen)
1062 blen = thislen; 1050 blen = thislen;
1063 1051
1064 xferfunc(drive, ptr, blen); 1052 xferfunc(drive, NULL, ptr, blen);
1065 1053
1066 thislen -= blen; 1054 thislen -= blen;
1067 len -= blen; 1055 len -= blen;