aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:22 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:22 -0500
commit2bc4cf2d826cb497063f6a84ab444cff13537e5f (patch)
tree116b546ed0144349ba462ad80456e8887539ce07
parent455d80a9553915251b6392e31c39aeb8f8a94d68 (diff)
ide-cd: remove struct ide_cd_{config,state}_flags
* Remove unused ->{writing,reserved} fields from struct ide_cd_config_flags. * Move ->max_speed from struct ide_cd_config_flags to struct cdrom_info. * Move ->current_speed from struct ide_cd_state_flags to struct cdrom_info. * Add defines for config and state flags. * Add 'unsigned int cd_flags' to struct cdrom_info and use ->cd_flags instead of ->{config,state}_flags. * Remove no longer needed struct ide_cd_{config,state}_flags. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-cd.c106
-rw-r--r--drivers/ide/ide-cd.h62
2 files changed, 87 insertions, 81 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ab1cdce806ec..a049750ced16 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -95,8 +95,8 @@ static void cdrom_saw_media_change (ide_drive_t *drive)
95{ 95{
96 struct cdrom_info *cd = drive->driver_data; 96 struct cdrom_info *cd = drive->driver_data;
97 97
98 cd->state_flags.media_changed = 1; 98 cd->cd_flags |= IDE_CD_FLAG_MEDIA_CHANGED;
99 cd->state_flags.toc_valid = 0; 99 cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID;
100 cd->nsectors_buffered = 0; 100 cd->nsectors_buffered = 0;
101} 101}
102 102
@@ -658,7 +658,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
658 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL | 658 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
659 IDE_TFLAG_NO_SELECT_MASK, xferlen, info->dma); 659 IDE_TFLAG_NO_SELECT_MASK, xferlen, info->dma);
660 660
661 if (info->config_flags.drq_interrupt) { 661 if (info->cd_flags & IDE_CD_FLAG_DRQ_INTERRUPT) {
662 /* waiting for CDB interrupt, not DMA yet. */ 662 /* waiting for CDB interrupt, not DMA yet. */
663 if (info->dma) 663 if (info->dma)
664 drive->waiting_for_dma = 0; 664 drive->waiting_for_dma = 0;
@@ -694,7 +694,7 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
694 struct cdrom_info *info = drive->driver_data; 694 struct cdrom_info *info = drive->driver_data;
695 ide_startstop_t startstop; 695 ide_startstop_t startstop;
696 696
697 if (info->config_flags.drq_interrupt) { 697 if (info->cd_flags & IDE_CD_FLAG_DRQ_INTERRUPT) {
698 /* Here we should have been called after receiving an interrupt 698 /* Here we should have been called after receiving an interrupt
699 from the device. DRQ should how be set. */ 699 from the device. DRQ should how be set. */
700 700
@@ -893,11 +893,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
893 if ((len % SECTOR_SIZE) != 0) { 893 if ((len % SECTOR_SIZE) != 0) {
894 printk (KERN_ERR "%s: cdrom_read_intr: Bad transfer size %d\n", 894 printk (KERN_ERR "%s: cdrom_read_intr: Bad transfer size %d\n",
895 drive->name, len); 895 drive->name, len);
896 if (info->config_flags.limit_nframes) 896 if (info->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES)
897 printk (KERN_ERR " This drive is not supported by this version of the driver\n"); 897 printk (KERN_ERR " This drive is not supported by this version of the driver\n");
898 else { 898 else {
899 printk (KERN_ERR " Trying to limit transfer sizes\n"); 899 printk (KERN_ERR " Trying to limit transfer sizes\n");
900 info->config_flags.limit_nframes = 1; 900 info->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
901 } 901 }
902 cdrom_end_request(drive, 0); 902 cdrom_end_request(drive, 0);
903 return ide_stopped; 903 return ide_stopped;
@@ -1074,7 +1074,7 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
1074 if (cdrom_decode_status(drive, 0, &stat)) 1074 if (cdrom_decode_status(drive, 0, &stat))
1075 return ide_stopped; 1075 return ide_stopped;
1076 1076
1077 info->config_flags.seeking = 1; 1077 info->cd_flags |= IDE_CD_FLAG_SEEKING;
1078 1078
1079 if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { 1079 if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) {
1080 if (--retry == 0) { 1080 if (--retry == 0) {
@@ -1722,7 +1722,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t block)
1722 struct cdrom_info *info = drive->driver_data; 1722 struct cdrom_info *info = drive->driver_data;
1723 1723
1724 if (blk_fs_request(rq)) { 1724 if (blk_fs_request(rq)) {
1725 if (info->config_flags.seeking) { 1725 if (info->cd_flags & IDE_CD_FLAG_SEEKING) {
1726 unsigned long elapsed = jiffies - info->start_seek; 1726 unsigned long elapsed = jiffies - info->start_seek;
1727 int stat = HWIF(drive)->INB(IDE_STATUS_REG); 1727 int stat = HWIF(drive)->INB(IDE_STATUS_REG);
1728 1728
@@ -1733,7 +1733,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t block)
1733 } 1733 }
1734 printk (KERN_ERR "%s: DSC timeout\n", drive->name); 1734 printk (KERN_ERR "%s: DSC timeout\n", drive->name);
1735 } 1735 }
1736 info->config_flags.seeking = 0; 1736 info->cd_flags &= ~IDE_CD_FLAG_SEEKING;
1737 } 1737 }
1738 if ((rq_data_dir(rq) == READ) && IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap) { 1738 if ((rq_data_dir(rq) == READ) && IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap) {
1739 action = cdrom_start_seek(drive, block); 1739 action = cdrom_start_seek(drive, block);
@@ -1854,7 +1854,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
1854 sense = &my_sense; 1854 sense = &my_sense;
1855 1855
1856 /* If the drive cannot lock the door, just pretend. */ 1856 /* If the drive cannot lock the door, just pretend. */
1857 if (cd->config_flags.no_doorlock) { 1857 if (cd->cd_flags & IDE_CD_FLAG_NO_DOORLOCK) {
1858 stat = 0; 1858 stat = 0;
1859 } else { 1859 } else {
1860 cdrom_prepare_request(drive, &req); 1860 cdrom_prepare_request(drive, &req);
@@ -1871,7 +1871,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
1871 (sense->asc == 0x24 || sense->asc == 0x20)) { 1871 (sense->asc == 0x24 || sense->asc == 0x20)) {
1872 printk (KERN_ERR "%s: door locking not supported\n", 1872 printk (KERN_ERR "%s: door locking not supported\n",
1873 drive->name); 1873 drive->name);
1874 cd->config_flags.no_doorlock = 1; 1874 cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
1875 stat = 0; 1875 stat = 0;
1876 } 1876 }
1877 1877
@@ -1879,8 +1879,12 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
1879 if (stat != 0 && sense->sense_key == NOT_READY && sense->asc == 0x3a) 1879 if (stat != 0 && sense->sense_key == NOT_READY && sense->asc == 0x3a)
1880 stat = 0; 1880 stat = 0;
1881 1881
1882 if (stat == 0) 1882 if (stat == 0) {
1883 cd->state_flags.door_locked = lockflag; 1883 if (lockflag)
1884 cd->cd_flags |= IDE_CD_FLAG_DOOR_LOCKED;
1885 else
1886 cd->cd_flags &= ~IDE_CD_FLAG_DOOR_LOCKED;
1887 }
1884 1888
1885 return stat; 1889 return stat;
1886} 1890}
@@ -1896,11 +1900,11 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
1896 struct request req; 1900 struct request req;
1897 char loej = 0x02; 1901 char loej = 0x02;
1898 1902
1899 if (cd->config_flags.no_eject && !ejectflag) 1903 if ((cd->cd_flags & IDE_CD_FLAG_NO_EJECT) && !ejectflag)
1900 return -EDRIVE_CANT_DO_THIS; 1904 return -EDRIVE_CANT_DO_THIS;
1901 1905
1902 /* reload fails on some drives, if the tray is locked */ 1906 /* reload fails on some drives, if the tray is locked */
1903 if (cd->state_flags.door_locked && ejectflag) 1907 if ((cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) && ejectflag)
1904 return 0; 1908 return 0;
1905 1909
1906 cdrom_prepare_request(drive, &req); 1910 cdrom_prepare_request(drive, &req);
@@ -1998,7 +2002,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
1998 If it is, just return. */ 2002 If it is, just return. */
1999 (void) cdrom_check_status(drive, sense); 2003 (void) cdrom_check_status(drive, sense);
2000 2004
2001 if (info->state_flags.toc_valid) 2005 if (info->cd_flags & IDE_CD_FLAG_TOC_VALID)
2002 return 0; 2006 return 0;
2003 2007
2004 /* Try to get the total cdrom capacity and sector size. */ 2008 /* Try to get the total cdrom capacity and sector size. */
@@ -2021,7 +2025,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2021 return stat; 2025 return stat;
2022 2026
2023#if ! STANDARD_ATAPI 2027#if ! STANDARD_ATAPI
2024 if (info->config_flags.toctracks_as_bcd) { 2028 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2025 toc->hdr.first_track = bcd2bin(toc->hdr.first_track); 2029 toc->hdr.first_track = bcd2bin(toc->hdr.first_track);
2026 toc->hdr.last_track = bcd2bin(toc->hdr.last_track); 2030 toc->hdr.last_track = bcd2bin(toc->hdr.last_track);
2027 } 2031 }
@@ -2061,7 +2065,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2061 return stat; 2065 return stat;
2062 } 2066 }
2063#if ! STANDARD_ATAPI 2067#if ! STANDARD_ATAPI
2064 if (info->config_flags.toctracks_as_bcd) { 2068 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2065 toc->hdr.first_track = bin2bcd(CDROM_LEADOUT); 2069 toc->hdr.first_track = bin2bcd(CDROM_LEADOUT);
2066 toc->hdr.last_track = bin2bcd(CDROM_LEADOUT); 2070 toc->hdr.last_track = bin2bcd(CDROM_LEADOUT);
2067 } else 2071 } else
@@ -2078,7 +2082,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2078 toc->hdr.toc_length = ntohs (toc->hdr.toc_length); 2082 toc->hdr.toc_length = ntohs (toc->hdr.toc_length);
2079 2083
2080#if ! STANDARD_ATAPI 2084#if ! STANDARD_ATAPI
2081 if (info->config_flags.toctracks_as_bcd) { 2085 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2082 toc->hdr.first_track = bcd2bin(toc->hdr.first_track); 2086 toc->hdr.first_track = bcd2bin(toc->hdr.first_track);
2083 toc->hdr.last_track = bcd2bin(toc->hdr.last_track); 2087 toc->hdr.last_track = bcd2bin(toc->hdr.last_track);
2084 } 2088 }
@@ -2086,8 +2090,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2086 2090
2087 for (i=0; i<=ntracks; i++) { 2091 for (i=0; i<=ntracks; i++) {
2088#if ! STANDARD_ATAPI 2092#if ! STANDARD_ATAPI
2089 if (info->config_flags.tocaddr_as_bcd) { 2093 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) {
2090 if (info->config_flags.toctracks_as_bcd) 2094 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD)
2091 toc->ent[i].track = bcd2bin(toc->ent[i].track); 2095 toc->ent[i].track = bcd2bin(toc->ent[i].track);
2092 msf_from_bcd(&toc->ent[i].addr.msf); 2096 msf_from_bcd(&toc->ent[i].addr.msf);
2093 } 2097 }
@@ -2112,7 +2116,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2112 } 2116 }
2113 2117
2114#if ! STANDARD_ATAPI 2118#if ! STANDARD_ATAPI
2115 if (info->config_flags.tocaddr_as_bcd) { 2119 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) {
2116 /* Re-read multisession information using MSF format */ 2120 /* Re-read multisession information using MSF format */
2117 stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp, 2121 stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
2118 sizeof(ms_tmp), sense); 2122 sizeof(ms_tmp), sense);
@@ -2137,7 +2141,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2137 } 2141 }
2138 2142
2139 /* Remember that we've read this stuff. */ 2143 /* Remember that we've read this stuff. */
2140 info->state_flags.toc_valid = 1; 2144 info->cd_flags |= IDE_CD_FLAG_TOC_VALID;
2141 2145
2142 return 0; 2146 return 0;
2143} 2147}
@@ -2219,7 +2223,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
2219 /* 2223 /*
2220 * don't serve cached data, if the toc isn't valid 2224 * don't serve cached data, if the toc isn't valid
2221 */ 2225 */
2222 if (!info->state_flags.toc_valid) 2226 if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0)
2223 return -EINVAL; 2227 return -EINVAL;
2224 2228
2225 /* Check validity of requested track number. */ 2229 /* Check validity of requested track number. */
@@ -2365,7 +2369,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
2365 * A reset will unlock the door. If it was previously locked, 2369 * A reset will unlock the door. If it was previously locked,
2366 * lock it again. 2370 * lock it again.
2367 */ 2371 */
2368 if (cd->state_flags.door_locked) 2372 if (cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED)
2369 (void) cdrom_lockdoor(drive, 1, &sense); 2373 (void) cdrom_lockdoor(drive, 1, &sense);
2370 2374
2371 return ret; 2375 return ret;
@@ -2436,8 +2440,8 @@ static void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
2436 maxspeed = be16_to_cpu(maxspeed); 2440 maxspeed = be16_to_cpu(maxspeed);
2437 } 2441 }
2438 2442
2439 cd->state_flags.current_speed = (curspeed + (176/2)) / 176; 2443 cd->current_speed = (curspeed + (176/2)) / 176;
2440 cd->config_flags.max_speed = (maxspeed + (176/2)) / 176; 2444 cd->max_speed = (maxspeed + (176/2)) / 176;
2441} 2445}
2442 2446
2443static 2447static
@@ -2454,7 +2458,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
2454 2458
2455 if (!ide_cdrom_get_capabilities(drive, buf)) { 2459 if (!ide_cdrom_get_capabilities(drive, buf)) {
2456 ide_cdrom_update_speed(drive, buf); 2460 ide_cdrom_update_speed(drive, buf);
2457 cdi->speed = cd->state_flags.current_speed; 2461 cdi->speed = cd->current_speed;
2458 } 2462 }
2459 return 0; 2463 return 0;
2460} 2464}
@@ -2515,7 +2519,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi,
2515 struct request_sense sense; 2519 struct request_sense sense;
2516 int ret; 2520 int ret;
2517 2521
2518 if (!info->state_flags.toc_valid || info->toc == NULL) 2522 if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0 || info->toc == NULL)
2519 if ((ret = cdrom_read_toc(drive, &sense))) 2523 if ((ret = cdrom_read_toc(drive, &sense)))
2520 return ret; 2524 return ret;
2521 2525
@@ -2562,8 +2566,8 @@ int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi,
2562 2566
2563 if (slot_nr == CDSL_CURRENT) { 2567 if (slot_nr == CDSL_CURRENT) {
2564 (void) cdrom_check_status(drive, NULL); 2568 (void) cdrom_check_status(drive, NULL);
2565 retval = cd->state_flags.media_changed; 2569 retval = (cd->cd_flags & IDE_CD_FLAG_MEDIA_CHANGED) ? 1 : 0;
2566 cd->state_flags.media_changed = 0; 2570 cd->cd_flags &= ~IDE_CD_FLAG_MEDIA_CHANGED;
2567 return retval; 2571 return retval;
2568 } else { 2572 } else {
2569 return -EINVAL; 2573 return -EINVAL;
@@ -2588,7 +2592,7 @@ void ide_cdrom_release_real (struct cdrom_device_info *cdi)
2588 struct cdrom_info *cd = drive->driver_data; 2592 struct cdrom_info *cd = drive->driver_data;
2589 2593
2590 if (!cdi->use_count) 2594 if (!cdi->use_count)
2591 cd->state_flags.toc_valid = 0; 2595 cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID;
2592} 2596}
2593 2597
2594#define IDE_CD_CAPABILITIES \ 2598#define IDE_CD_CAPABILITIES \
@@ -2620,12 +2624,12 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2620 struct cdrom_device_info *devinfo = &info->devinfo; 2624 struct cdrom_device_info *devinfo = &info->devinfo;
2621 2625
2622 devinfo->ops = &ide_cdrom_dops; 2626 devinfo->ops = &ide_cdrom_dops;
2623 devinfo->speed = info->state_flags.current_speed; 2627 devinfo->speed = info->current_speed;
2624 devinfo->capacity = nslots; 2628 devinfo->capacity = nslots;
2625 devinfo->handle = drive; 2629 devinfo->handle = drive;
2626 strcpy(devinfo->name, drive->name); 2630 strcpy(devinfo->name, drive->name);
2627 2631
2628 if (info->config_flags.no_speed_select) 2632 if (info->cd_flags & IDE_CD_FLAG_NO_SPEED_SELECT)
2629 devinfo->mask |= CDC_SELECT_SPEED; 2633 devinfo->mask |= CDC_SELECT_SPEED;
2630 2634
2631 devinfo->disk = info->disk; 2635 devinfo->disk = info->disk;
@@ -2651,9 +2655,9 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2651 return nslots; 2655 return nslots;
2652 } 2656 }
2653 2657
2654 if (cd->config_flags.nec260 || 2658 if ((cd->cd_flags & IDE_CD_FLAG_NEC260) ||
2655 !strcmp(drive->id->model,"STINGRAY 8422 IDE 8X CD-ROM 7-27-95")) { 2659 !strcmp(drive->id->model,"STINGRAY 8422 IDE 8X CD-ROM 7-27-95")) {
2656 cd->config_flags.no_eject = 0; 2660 cd->cd_flags &= ~IDE_CD_FLAG_NO_EJECT;
2657 cdi->mask &= ~CDC_PLAY_AUDIO; 2661 cdi->mask &= ~CDC_PLAY_AUDIO;
2658 return nslots; 2662 return nslots;
2659 } 2663 }
@@ -2672,9 +2676,9 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2672 return 0; 2676 return 0;
2673 2677
2674 if ((buf[8 + 6] & 0x01) == 0) 2678 if ((buf[8 + 6] & 0x01) == 0)
2675 cd->config_flags.no_doorlock = 1; 2679 cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
2676 if (buf[8 + 6] & 0x08) 2680 if (buf[8 + 6] & 0x08)
2677 cd->config_flags.no_eject = 0; 2681 cd->cd_flags &= ~IDE_CD_FLAG_NO_EJECT;
2678 if (buf[8 + 3] & 0x01) 2682 if (buf[8 + 3] & 0x01)
2679 cdi->mask &= ~CDC_CD_R; 2683 cdi->mask &= ~CDC_CD_R;
2680 if (buf[8 + 3] & 0x02) 2684 if (buf[8 + 3] & 0x02)
@@ -2721,8 +2725,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2721 printk(KERN_INFO "%s: ATAPI", drive->name); 2725 printk(KERN_INFO "%s: ATAPI", drive->name);
2722 2726
2723 /* don't print speed if the drive reported 0 */ 2727 /* don't print speed if the drive reported 0 */
2724 if (cd->config_flags.max_speed) 2728 if (cd->max_speed)
2725 printk(KERN_CONT " %dX", cd->config_flags.max_speed); 2729 printk(KERN_CONT " %dX", cd->max_speed);
2726 2730
2727 printk(KERN_CONT " %s", (cdi->mask & CDC_DVD) ? "CD-ROM" : "DVD-ROM"); 2731 printk(KERN_CONT " %s", (cdi->mask & CDC_DVD) ? "CD-ROM" : "DVD-ROM");
2728 2732
@@ -2849,23 +2853,23 @@ int ide_cdrom_setup (ide_drive_t *drive)
2849 2853
2850 drive->special.all = 0; 2854 drive->special.all = 0;
2851 2855
2852 cd->state_flags.media_changed = 1; 2856 cd->cd_flags |= IDE_CD_FLAG_MEDIA_CHANGED;
2853 2857
2854#if NO_DOOR_LOCKING 2858#if NO_DOOR_LOCKING
2855 cd->config_flags.no_doorlock = 1; 2859 cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
2856#endif 2860#endif
2857 if ((drive->id->config & 0x0060) == 0x20) 2861 if ((drive->id->config & 0x0060) == 0x20)
2858 cd->config_flags.drq_interrupt = 1; 2862 cd->cd_flags |= IDE_CD_FLAG_DRQ_INTERRUPT;
2859 cd->config_flags.no_eject = 1; 2863 cd->cd_flags |= IDE_CD_FLAG_NO_EJECT;
2860 2864
2861 /* limit transfer size per interrupt. */ 2865 /* limit transfer size per interrupt. */
2862 /* a testament to the nice quality of Samsung drives... */ 2866 /* a testament to the nice quality of Samsung drives... */
2863 if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430") || 2867 if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430") ||
2864 !strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432")) 2868 !strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432"))
2865 cd->config_flags.limit_nframes = 1; 2869 cd->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
2866 /* the 3231 model does not support the SET_CD_SPEED command */ 2870 /* the 3231 model does not support the SET_CD_SPEED command */
2867 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) 2871 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
2868 cd->config_flags.no_speed_select = 1; 2872 cd->cd_flags |= IDE_CD_FLAG_NO_SPEED_SELECT;
2869 2873
2870#if ! STANDARD_ATAPI 2874#if ! STANDARD_ATAPI
2871 if (strcmp (drive->id->model, "V003S0DS") == 0 && 2875 if (strcmp (drive->id->model, "V003S0DS") == 0 &&
@@ -2873,22 +2877,22 @@ int ide_cdrom_setup (ide_drive_t *drive)
2873 drive->id->fw_rev[6] <= '2') { 2877 drive->id->fw_rev[6] <= '2') {
2874 /* Vertos 300. 2878 /* Vertos 300.
2875 Some versions of this drive like to talk BCD. */ 2879 Some versions of this drive like to talk BCD. */
2876 cd->config_flags.toctracks_as_bcd = 1; 2880 cd->cd_flags |= (IDE_CD_FLAG_TOCTRACKS_AS_BCD |
2877 cd->config_flags.tocaddr_as_bcd = 1; 2881 IDE_CD_FLAG_TOCADDR_AS_BCD);
2878 } 2882 }
2879 else if (strcmp (drive->id->model, "V006E0DS") == 0 && 2883 else if (strcmp (drive->id->model, "V006E0DS") == 0 &&
2880 drive->id->fw_rev[4] == '1' && 2884 drive->id->fw_rev[4] == '1' &&
2881 drive->id->fw_rev[6] <= '2') { 2885 drive->id->fw_rev[6] <= '2') {
2882 /* Vertos 600 ESD. */ 2886 /* Vertos 600 ESD. */
2883 cd->config_flags.toctracks_as_bcd = 1; 2887 cd->cd_flags |= IDE_CD_FLAG_TOCTRACKS_AS_BCD;
2884 } 2888 }
2885 else if (strcmp(drive->id->model, "NEC CD-ROM DRIVE:260") == 0 && 2889 else if (strcmp(drive->id->model, "NEC CD-ROM DRIVE:260") == 0 &&
2886 strncmp(drive->id->fw_rev, "1.01", 4) == 0) { /* FIXME */ 2890 strncmp(drive->id->fw_rev, "1.01", 4) == 0) { /* FIXME */
2887 /* Old NEC260 (not R). 2891 /* Old NEC260 (not R).
2888 This drive was released before the 1.2 version 2892 This drive was released before the 1.2 version
2889 of the spec. */ 2893 of the spec. */
2890 cd->config_flags.tocaddr_as_bcd = 1; 2894 cd->cd_flags |= (IDE_CD_FLAG_TOCADDR_AS_BCD |
2891 cd->config_flags.nec260 = 1; 2895 IDE_CD_FLAG_NEC260);
2892 } 2896 }
2893 /* 2897 /*
2894 * Sanyo 3 CD changer uses a non-standard command for CD changing 2898 * Sanyo 3 CD changer uses a non-standard command for CD changing
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 9d88b1a7ffe5..c19aa23255d1 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -54,34 +54,34 @@
54#define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20) 54#define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
55#define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4 55#define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
56 56
57/* Configuration flags. These describe the capabilities of the drive. 57enum {
58 They generally do not change after initialization, unless we learn 58 /* Device sends an interrupt when ready for a packet command. */
59 more about the drive from stuff failing. */ 59 IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0),
60struct ide_cd_config_flags { 60 /* Drive cannot lock the door. */
61 __u8 drq_interrupt : 1; /* Device sends an interrupt when ready 61 IDE_CD_FLAG_NO_DOORLOCK = (1 << 1),
62 for a packet command. */ 62 /* Drive cannot eject the disc. */
63 __u8 no_doorlock : 1; /* Drive cannot lock the door. */ 63 IDE_CD_FLAG_NO_EJECT = (1 << 2),
64 __u8 no_eject : 1; /* Drive cannot eject the disc. */ 64 /* Drive is a pre-1.2 NEC 260 drive. */
65 __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ 65 IDE_CD_FLAG_NEC260 = (1 << 3),
66 __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ 66 /* TOC addresses are in BCD. */
67 __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ 67 IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4),
68 __u8 limit_nframes : 1; /* Drive does not provide data in 68 /* TOC track numbers are in BCD. */
69 multiples of SECTOR_SIZE when more 69 IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5),
70 than one interrupt is needed. */ 70 /*
71 __u8 seeking : 1; /* Seeking in progress */ 71 * Drive does not provide data in multiples of SECTOR_SIZE
72 __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */ 72 * when more than one interrupt is needed.
73 byte max_speed; /* Max speed of the drive */ 73 */
74}; 74 IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6),
75 75 /* Seeking in progress. */
76/* State flags. These give information about the current state of the 76 IDE_CD_FLAG_SEEKING = (1 << 7),
77 drive, and will change during normal operation. */ 77 /* Driver has noticed a media change. */
78struct ide_cd_state_flags { 78 IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8),
79 __u8 media_changed : 1; /* Driver has noticed a media change. */ 79 /* Saved TOC information is current. */
80 __u8 toc_valid : 1; /* Saved TOC information is current. */ 80 IDE_CD_FLAG_TOC_VALID = (1 << 9),
81 __u8 door_locked : 1; /* We think that the drive door is locked. */ 81 /* We think that the drive door is locked. */
82 __u8 writing : 1; /* the drive is currently writing */ 82 IDE_CD_FLAG_DOOR_LOCKED = (1 << 10),
83 __u8 reserved : 4; 83 /* SET_CD_SPEED command is unsupported. */
84 byte current_speed; /* Current speed of the drive */ 84 IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11),
85}; 85};
86 86
87/* Structure of a MSF cdrom address. */ 87/* Structure of a MSF cdrom address. */
@@ -153,8 +153,10 @@ struct cdrom_info {
153 unsigned long last_block; 153 unsigned long last_block;
154 unsigned long start_seek; 154 unsigned long start_seek;
155 155
156 struct ide_cd_config_flags config_flags; 156 unsigned int cd_flags;
157 struct ide_cd_state_flags state_flags; 157
158 u8 max_speed; /* Max speed of the drive. */
159 u8 current_speed; /* Current speed of the drive. */
158 160
159 /* Per-device info needed by cdrom.c generic driver. */ 161 /* Per-device info needed by cdrom.c generic driver. */
160 struct cdrom_device_info devinfo; 162 struct cdrom_device_info devinfo;