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.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3308b1cd3a33..13265a8827da 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -99,7 +99,7 @@ static void ide_cd_put(struct cdrom_info *cd)
99/* 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. */
100static void cdrom_saw_media_change(ide_drive_t *drive) 100static void cdrom_saw_media_change(ide_drive_t *drive)
101{ 101{
102 drive->atapi_flags |= IDE_AFLAG_MEDIA_CHANGED; 102 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
103 drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; 103 drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
104} 104}
105 105
@@ -340,8 +340,8 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
340 } 340 }
341 341
342 ide_debug_log(IDE_DBG_RQ, "%s: stat: 0x%x, good_stat: 0x%x, " 342 ide_debug_log(IDE_DBG_RQ, "%s: stat: 0x%x, good_stat: 0x%x, "
343 "rq->cmd_type: 0x%x, err: 0x%x\n", __func__, stat, 343 "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x, err: 0x%x\n",
344 good_stat, rq->cmd_type, err); 344 __func__, stat, good_stat, rq->cmd[0], rq->cmd_type, err);
345 345
346 if (blk_sense_request(rq)) { 346 if (blk_sense_request(rq)) {
347 /* 347 /*
@@ -843,13 +843,10 @@ static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq)
843 rq->q->prep_rq_fn(rq->q, rq); 843 rq->q->prep_rq_fn(rq->q, rq);
844} 844}
845 845
846/*
847 * All other packet commands.
848 */
849static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq) 846static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq)
850{ 847{
851 848 ide_debug_log(IDE_DBG_FUNC, "Call %s, rq->cmd[0]: 0x%x\n",
852 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); 849 __func__, rq->cmd[0]);
853 850
854 /* 851 /*
855 * Some of the trailing request sense fields are optional, 852 * Some of the trailing request sense fields are optional,
@@ -876,7 +873,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
876 if (!sense) 873 if (!sense)
877 sense = &local_sense; 874 sense = &local_sense;
878 875
879 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x, " 876 ide_debug_log(IDE_DBG_PC, "Call %s, cmd[0]: 0x%x, write: 0x%x, "
880 "timeout: %d, cmd_flags: 0x%x\n", __func__, cmd[0], write, 877 "timeout: %d, cmd_flags: 0x%x\n", __func__, cmd[0], write,
881 timeout, cmd_flags); 878 timeout, cmd_flags);
882 879
@@ -1177,8 +1174,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
1177 unsigned short sectors_per_frame = 1174 unsigned short sectors_per_frame =
1178 queue_hardsect_size(drive->queue) >> SECTOR_BITS; 1175 queue_hardsect_size(drive->queue) >> SECTOR_BITS;
1179 1176
1180 ide_debug_log(IDE_DBG_RQ, "Call %s, write: 0x%x, secs_per_frame: %u\n", 1177 ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x, "
1181 __func__, write, sectors_per_frame); 1178 "secs_per_frame: %u\n",
1179 __func__, rq->cmd[0], write, sectors_per_frame);
1182 1180
1183 if (write) { 1181 if (write) {
1184 /* disk has become write protected */ 1182 /* disk has become write protected */
@@ -1221,7 +1219,8 @@ static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)
1221static 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)
1222{ 1220{
1223 1221
1224 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd_type: 0x%x\n", __func__, 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],
1225 rq->cmd_type); 1224 rq->cmd_type);
1226 1225
1227 if (blk_pc_request(rq)) 1226 if (blk_pc_request(rq))
@@ -1257,9 +1256,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1257 } 1256 }
1258} 1257}
1259 1258
1260/*
1261 * cdrom driver request routine.
1262 */
1263static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, 1259static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1264 sector_t block) 1260 sector_t block)
1265{ 1261{
@@ -1267,8 +1263,10 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1267 ide_handler_t *fn; 1263 ide_handler_t *fn;
1268 int xferlen; 1264 int xferlen;
1269 1265
1270 ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd_type: 0x%x, block: %llu\n", 1266 ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, "
1271 __func__, rq->cmd_type, (unsigned long long)block); 1267 "rq->cmd_type: 0x%x, block: %llu\n",
1268 __func__, rq->cmd[0], rq->cmd_type,
1269 (unsigned long long)block);
1272 1270
1273 if (blk_fs_request(rq)) { 1271 if (blk_fs_request(rq)) {
1274 if (drive->atapi_flags & IDE_AFLAG_SEEKING) { 1272 if (drive->atapi_flags & IDE_AFLAG_SEEKING) {
@@ -1412,6 +1410,10 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
1412 1410
1413 *capacity = 1 + be32_to_cpu(capbuf.lba); 1411 *capacity = 1 + be32_to_cpu(capbuf.lba);
1414 *sectors_per_frame = blocklen >> SECTOR_BITS; 1412 *sectors_per_frame = blocklen >> SECTOR_BITS;
1413
1414 ide_debug_log(IDE_DBG_PROBE, "%s: cap: %lu, sectors_per_frame: %lu\n",
1415 __func__, *capacity, *sectors_per_frame);
1416
1415 return 0; 1417 return 0;
1416} 1418}
1417 1419
@@ -1643,6 +1645,9 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
1643 maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]); 1645 maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]);
1644 } 1646 }
1645 1647
1648 ide_debug_log(IDE_DBG_PROBE, "%s: curspeed: %u, maxspeed: %u\n",
1649 __func__, curspeed, maxspeed);
1650
1646 cd->current_speed = (curspeed + (176/2)) / 176; 1651 cd->current_speed = (curspeed + (176/2)) / 176;
1647 cd->max_speed = (maxspeed + (176/2)) / 176; 1652 cd->max_speed = (maxspeed + (176/2)) / 176;
1648} 1653}
@@ -1732,7 +1737,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1732 return 0; 1737 return 0;
1733 1738
1734 if ((buf[8 + 6] & 0x01) == 0) 1739 if ((buf[8 + 6] & 0x01) == 0)
1735 drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK; 1740 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;
1736 if (buf[8 + 6] & 0x08) 1741 if (buf[8 + 6] & 0x08)
1737 drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT; 1742 drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT;
1738 if (buf[8 + 3] & 0x01) 1743 if (buf[8 + 3] & 0x01)
@@ -1777,7 +1782,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1777 if ((cdi->mask & CDC_DVD_R) == 0 || (cdi->mask & CDC_DVD_RAM) == 0) 1782 if ((cdi->mask & CDC_DVD_R) == 0 || (cdi->mask & CDC_DVD_RAM) == 0)
1778 printk(KERN_CONT " DVD%s%s", 1783 printk(KERN_CONT " DVD%s%s",
1779 (cdi->mask & CDC_DVD_R) ? "" : "-R", 1784 (cdi->mask & CDC_DVD_R) ? "" : "-R",
1780 (cdi->mask & CDC_DVD_RAM) ? "" : "-RAM"); 1785 (cdi->mask & CDC_DVD_RAM) ? "" : "/RAM");
1781 1786
1782 if ((cdi->mask & CDC_CD_R) == 0 || (cdi->mask & CDC_CD_RW) == 0) 1787 if ((cdi->mask & CDC_CD_R) == 0 || (cdi->mask & CDC_CD_RW) == 0)
1783 printk(KERN_CONT " CD%s%s", 1788 printk(KERN_CONT " CD%s%s",
@@ -1908,6 +1913,16 @@ static const struct ide_proc_devset idecd_settings[] = {
1908 IDE_PROC_DEVSET(dsc_overlap, 0, 1), 1913 IDE_PROC_DEVSET(dsc_overlap, 0, 1),
1909 { 0 }, 1914 { 0 },
1910}; 1915};
1916
1917static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
1918{
1919 return idecd_proc;
1920}
1921
1922static const struct ide_proc_devset *ide_cd_proc_devsets(ide_drive_t *drive)
1923{
1924 return idecd_settings;
1925}
1911#endif 1926#endif
1912 1927
1913static const struct cd_list_entry ide_cd_quirks_list[] = { 1928static const struct cd_list_entry ide_cd_quirks_list[] = {
@@ -1986,8 +2001,8 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1986 if (!drive->queue->unplug_delay) 2001 if (!drive->queue->unplug_delay)
1987 drive->queue->unplug_delay = 1; 2002 drive->queue->unplug_delay = 1;
1988 2003
1989 drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT | 2004 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
1990 ide_cd_flags(id); 2005 drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id);
1991 2006
1992 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) && 2007 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) &&
1993 fw_rev[4] == '1' && fw_rev[6] <= '2') 2008 fw_rev[4] == '1' && fw_rev[6] <= '2')
@@ -2069,8 +2084,8 @@ static ide_driver_t ide_cdrom_driver = {
2069 .end_request = ide_end_request, 2084 .end_request = ide_end_request,
2070 .error = __ide_error, 2085 .error = __ide_error,
2071#ifdef CONFIG_IDE_PROC_FS 2086#ifdef CONFIG_IDE_PROC_FS
2072 .proc = idecd_proc, 2087 .proc_entries = ide_cd_proc_entries,
2073 .settings = idecd_settings, 2088 .proc_devsets = ide_cd_proc_devsets,
2074#endif 2089#endif
2075}; 2090};
2076 2091