diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-07-23 13:56:02 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:56:02 -0400 |
commit | 570f89ea5f3ee93756dc2293b83bdfedb8d35348 (patch) | |
tree | 60fa058726e1900cd3066244b62183c98086a970 | |
parent | ac77ef8b03677c8ae8afe77bccc5f6a969193a79 (diff) |
ide-cd: convert to using the new atapi_flags
There should be no functionality change resulting from this patch.
[bart: IDE_FLAG_* -> IDE_AFLAG_*, dev_flags -> atapi_flags]
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-cd.c | 108 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 38 | ||||
-rw-r--r-- | drivers/ide/ide-cd_ioctl.c | 27 |
3 files changed, 64 insertions, 109 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d9798ca433ba..52fe3b95dc92 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -85,10 +85,8 @@ static void ide_cd_put(struct cdrom_info *cd) | |||
85 | /* Mark that we've seen a media change and invalidate our internal buffers. */ | 85 | /* Mark that we've seen a media change and invalidate our internal buffers. */ |
86 | static void cdrom_saw_media_change(ide_drive_t *drive) | 86 | static void cdrom_saw_media_change(ide_drive_t *drive) |
87 | { | 87 | { |
88 | struct cdrom_info *cd = drive->driver_data; | 88 | drive->atapi_flags |= IDE_AFLAG_MEDIA_CHANGED; |
89 | 89 | drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; | |
90 | cd->cd_flags |= IDE_CD_FLAG_MEDIA_CHANGED; | ||
91 | cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID; | ||
92 | } | 90 | } |
93 | 91 | ||
94 | static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, | 92 | static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, |
@@ -529,7 +527,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, | |||
529 | ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, | 527 | ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, |
530 | xferlen, info->dma); | 528 | xferlen, info->dma); |
531 | 529 | ||
532 | if (info->cd_flags & IDE_CD_FLAG_DRQ_INTERRUPT) { | 530 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { |
533 | /* waiting for CDB interrupt, not DMA yet. */ | 531 | /* waiting for CDB interrupt, not DMA yet. */ |
534 | if (info->dma) | 532 | if (info->dma) |
535 | drive->waiting_for_dma = 0; | 533 | drive->waiting_for_dma = 0; |
@@ -561,7 +559,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, | |||
561 | struct cdrom_info *info = drive->driver_data; | 559 | struct cdrom_info *info = drive->driver_data; |
562 | ide_startstop_t startstop; | 560 | ide_startstop_t startstop; |
563 | 561 | ||
564 | if (info->cd_flags & IDE_CD_FLAG_DRQ_INTERRUPT) { | 562 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { |
565 | /* | 563 | /* |
566 | * Here we should have been called after receiving an interrupt | 564 | * Here we should have been called after receiving an interrupt |
567 | * from the device. DRQ should how be set. | 565 | * from the device. DRQ should how be set. |
@@ -648,20 +646,18 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, | |||
648 | */ | 646 | */ |
649 | static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) | 647 | static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) |
650 | { | 648 | { |
651 | struct cdrom_info *cd = drive->driver_data; | ||
652 | |||
653 | if ((len % SECTOR_SIZE) == 0) | 649 | if ((len % SECTOR_SIZE) == 0) |
654 | return 0; | 650 | return 0; |
655 | 651 | ||
656 | printk(KERN_ERR "%s: %s: Bad transfer size %d\n", | 652 | printk(KERN_ERR "%s: %s: Bad transfer size %d\n", |
657 | drive->name, __func__, len); | 653 | drive->name, __func__, len); |
658 | 654 | ||
659 | if (cd->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES) | 655 | if (drive->atapi_flags & IDE_AFLAG_LIMIT_NFRAMES) |
660 | printk(KERN_ERR " This drive is not supported by " | 656 | printk(KERN_ERR " This drive is not supported by " |
661 | "this version of the driver\n"); | 657 | "this version of the driver\n"); |
662 | else { | 658 | else { |
663 | printk(KERN_ERR " Trying to limit transfer sizes\n"); | 659 | printk(KERN_ERR " Trying to limit transfer sizes\n"); |
664 | cd->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES; | 660 | drive->atapi_flags |= IDE_AFLAG_LIMIT_NFRAMES; |
665 | } | 661 | } |
666 | 662 | ||
667 | return 1; | 663 | return 1; |
@@ -738,7 +734,7 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive) | |||
738 | if (cdrom_decode_status(drive, 0, &stat)) | 734 | if (cdrom_decode_status(drive, 0, &stat)) |
739 | return ide_stopped; | 735 | return ide_stopped; |
740 | 736 | ||
741 | info->cd_flags |= IDE_CD_FLAG_SEEKING; | 737 | drive->atapi_flags |= IDE_AFLAG_SEEKING; |
742 | 738 | ||
743 | if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { | 739 | if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { |
744 | if (--retry == 0) | 740 | if (--retry == 0) |
@@ -1197,7 +1193,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1197 | int xferlen; | 1193 | int xferlen; |
1198 | 1194 | ||
1199 | if (blk_fs_request(rq)) { | 1195 | if (blk_fs_request(rq)) { |
1200 | if (info->cd_flags & IDE_CD_FLAG_SEEKING) { | 1196 | if (drive->atapi_flags & IDE_AFLAG_SEEKING) { |
1201 | ide_hwif_t *hwif = drive->hwif; | 1197 | ide_hwif_t *hwif = drive->hwif; |
1202 | unsigned long elapsed = jiffies - info->start_seek; | 1198 | unsigned long elapsed = jiffies - info->start_seek; |
1203 | int stat = hwif->tp_ops->read_status(hwif); | 1199 | int stat = hwif->tp_ops->read_status(hwif); |
@@ -1211,7 +1207,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1211 | printk(KERN_ERR "%s: DSC timeout\n", | 1207 | printk(KERN_ERR "%s: DSC timeout\n", |
1212 | drive->name); | 1208 | drive->name); |
1213 | } | 1209 | } |
1214 | info->cd_flags &= ~IDE_CD_FLAG_SEEKING; | 1210 | drive->atapi_flags &= ~IDE_AFLAG_SEEKING; |
1215 | } | 1211 | } |
1216 | if (rq_data_dir(rq) == READ && | 1212 | if (rq_data_dir(rq) == READ && |
1217 | IDE_LARGE_SEEK(info->last_block, block, | 1213 | IDE_LARGE_SEEK(info->last_block, block, |
@@ -1369,7 +1365,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1369 | */ | 1365 | */ |
1370 | (void) cdrom_check_status(drive, sense); | 1366 | (void) cdrom_check_status(drive, sense); |
1371 | 1367 | ||
1372 | if (info->cd_flags & IDE_CD_FLAG_TOC_VALID) | 1368 | if (drive->atapi_flags & IDE_AFLAG_TOC_VALID) |
1373 | return 0; | 1369 | return 0; |
1374 | 1370 | ||
1375 | /* try to get the total cdrom capacity and sector size */ | 1371 | /* try to get the total cdrom capacity and sector size */ |
@@ -1391,7 +1387,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1391 | if (stat) | 1387 | if (stat) |
1392 | return stat; | 1388 | return stat; |
1393 | 1389 | ||
1394 | if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { | 1390 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
1395 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); | 1391 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); |
1396 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); | 1392 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); |
1397 | } | 1393 | } |
@@ -1432,7 +1428,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1432 | if (stat) | 1428 | if (stat) |
1433 | return stat; | 1429 | return stat; |
1434 | 1430 | ||
1435 | if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { | 1431 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
1436 | toc->hdr.first_track = (u8)BIN2BCD(CDROM_LEADOUT); | 1432 | toc->hdr.first_track = (u8)BIN2BCD(CDROM_LEADOUT); |
1437 | toc->hdr.last_track = (u8)BIN2BCD(CDROM_LEADOUT); | 1433 | toc->hdr.last_track = (u8)BIN2BCD(CDROM_LEADOUT); |
1438 | } else { | 1434 | } else { |
@@ -1446,14 +1442,14 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1446 | 1442 | ||
1447 | toc->hdr.toc_length = be16_to_cpu(toc->hdr.toc_length); | 1443 | toc->hdr.toc_length = be16_to_cpu(toc->hdr.toc_length); |
1448 | 1444 | ||
1449 | if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { | 1445 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
1450 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); | 1446 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); |
1451 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); | 1447 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); |
1452 | } | 1448 | } |
1453 | 1449 | ||
1454 | for (i = 0; i <= ntracks; i++) { | 1450 | for (i = 0; i <= ntracks; i++) { |
1455 | if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) { | 1451 | if (drive->atapi_flags & IDE_AFLAG_TOCADDR_AS_BCD) { |
1456 | if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) | 1452 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) |
1457 | toc->ent[i].track = BCD2BIN(toc->ent[i].track); | 1453 | toc->ent[i].track = BCD2BIN(toc->ent[i].track); |
1458 | msf_from_bcd(&toc->ent[i].addr.msf); | 1454 | msf_from_bcd(&toc->ent[i].addr.msf); |
1459 | } | 1455 | } |
@@ -1476,7 +1472,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1476 | toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */ | 1472 | toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */ |
1477 | } | 1473 | } |
1478 | 1474 | ||
1479 | if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) { | 1475 | if (drive->atapi_flags & IDE_AFLAG_TOCADDR_AS_BCD) { |
1480 | /* re-read multisession information using MSF format */ | 1476 | /* re-read multisession information using MSF format */ |
1481 | stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp, | 1477 | stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp, |
1482 | sizeof(ms_tmp), sense); | 1478 | sizeof(ms_tmp), sense); |
@@ -1500,7 +1496,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1500 | } | 1496 | } |
1501 | 1497 | ||
1502 | /* Remember that we've read this stuff. */ | 1498 | /* Remember that we've read this stuff. */ |
1503 | info->cd_flags |= IDE_CD_FLAG_TOC_VALID; | 1499 | drive->atapi_flags |= IDE_AFLAG_TOC_VALID; |
1504 | 1500 | ||
1505 | return 0; | 1501 | return 0; |
1506 | } | 1502 | } |
@@ -1512,7 +1508,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, u8 *buf) | |||
1512 | struct packet_command cgc; | 1508 | struct packet_command cgc; |
1513 | int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; | 1509 | int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; |
1514 | 1510 | ||
1515 | if ((info->cd_flags & IDE_CD_FLAG_FULL_CAPS_PAGE) == 0) | 1511 | if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0) |
1516 | size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; | 1512 | size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; |
1517 | 1513 | ||
1518 | init_cdrom_command(&cgc, buf, size, CGC_DATA_UNKNOWN); | 1514 | init_cdrom_command(&cgc, buf, size, CGC_DATA_UNKNOWN); |
@@ -1533,7 +1529,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) | |||
1533 | curspeed = *(u16 *)&buf[8 + 14]; | 1529 | curspeed = *(u16 *)&buf[8 + 14]; |
1534 | maxspeed = *(u16 *)&buf[8 + 8]; | 1530 | maxspeed = *(u16 *)&buf[8 + 8]; |
1535 | 1531 | ||
1536 | if (cd->cd_flags & IDE_CD_FLAG_LE_SPEED_FIELDS) { | 1532 | if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) { |
1537 | curspeed = le16_to_cpu(curspeed); | 1533 | curspeed = le16_to_cpu(curspeed); |
1538 | maxspeed = le16_to_cpu(maxspeed); | 1534 | maxspeed = le16_to_cpu(maxspeed); |
1539 | } else { | 1535 | } else { |
@@ -1579,7 +1575,7 @@ static int ide_cdrom_register(ide_drive_t *drive, int nslots) | |||
1579 | devinfo->handle = drive; | 1575 | devinfo->handle = drive; |
1580 | strcpy(devinfo->name, drive->name); | 1576 | strcpy(devinfo->name, drive->name); |
1581 | 1577 | ||
1582 | if (info->cd_flags & IDE_CD_FLAG_NO_SPEED_SELECT) | 1578 | if (drive->atapi_flags & IDE_AFLAG_NO_SPEED_SELECT) |
1583 | devinfo->mask |= CDC_SELECT_SPEED; | 1579 | devinfo->mask |= CDC_SELECT_SPEED; |
1584 | 1580 | ||
1585 | devinfo->disk = info->disk; | 1581 | devinfo->disk = info->disk; |
@@ -1605,8 +1601,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1605 | return nslots; | 1601 | return nslots; |
1606 | } | 1602 | } |
1607 | 1603 | ||
1608 | if (cd->cd_flags & IDE_CD_FLAG_PRE_ATAPI12) { | 1604 | if (drive->atapi_flags & IDE_AFLAG_PRE_ATAPI12) { |
1609 | cd->cd_flags &= ~IDE_CD_FLAG_NO_EJECT; | 1605 | drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT; |
1610 | cdi->mask &= ~CDC_PLAY_AUDIO; | 1606 | cdi->mask &= ~CDC_PLAY_AUDIO; |
1611 | return nslots; | 1607 | return nslots; |
1612 | } | 1608 | } |
@@ -1624,9 +1620,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1624 | return 0; | 1620 | return 0; |
1625 | 1621 | ||
1626 | if ((buf[8 + 6] & 0x01) == 0) | 1622 | if ((buf[8 + 6] & 0x01) == 0) |
1627 | cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK; | 1623 | drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK; |
1628 | if (buf[8 + 6] & 0x08) | 1624 | if (buf[8 + 6] & 0x08) |
1629 | cd->cd_flags &= ~IDE_CD_FLAG_NO_EJECT; | 1625 | drive->atapi_flags &= ~IDE_AFLAG_NO_EJECT; |
1630 | if (buf[8 + 3] & 0x01) | 1626 | if (buf[8 + 3] & 0x01) |
1631 | cdi->mask &= ~CDC_CD_R; | 1627 | cdi->mask &= ~CDC_CD_R; |
1632 | if (buf[8 + 3] & 0x02) | 1628 | if (buf[8 + 3] & 0x02) |
@@ -1637,7 +1633,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1637 | cdi->mask &= ~(CDC_DVD_RAM | CDC_RAM); | 1633 | cdi->mask &= ~(CDC_DVD_RAM | CDC_RAM); |
1638 | if (buf[8 + 3] & 0x10) | 1634 | if (buf[8 + 3] & 0x10) |
1639 | cdi->mask &= ~CDC_DVD_R; | 1635 | cdi->mask &= ~CDC_DVD_R; |
1640 | if ((buf[8 + 4] & 0x01) || (cd->cd_flags & IDE_CD_FLAG_PLAY_AUDIO_OK)) | 1636 | if ((buf[8 + 4] & 0x01) || (drive->atapi_flags & IDE_AFLAG_PLAY_AUDIO_OK)) |
1641 | cdi->mask &= ~CDC_PLAY_AUDIO; | 1637 | cdi->mask &= ~CDC_PLAY_AUDIO; |
1642 | 1638 | ||
1643 | mechtype = buf[8 + 6] >> 5; | 1639 | mechtype = buf[8 + 6] >> 5; |
@@ -1802,43 +1798,43 @@ static inline void ide_cdrom_add_settings(ide_drive_t *drive) { ; } | |||
1802 | 1798 | ||
1803 | static const struct cd_list_entry ide_cd_quirks_list[] = { | 1799 | static const struct cd_list_entry ide_cd_quirks_list[] = { |
1804 | /* Limit transfer size per interrupt. */ | 1800 | /* Limit transfer size per interrupt. */ |
1805 | { "SAMSUNG CD-ROM SCR-2430", NULL, IDE_CD_FLAG_LIMIT_NFRAMES }, | 1801 | { "SAMSUNG CD-ROM SCR-2430", NULL, IDE_AFLAG_LIMIT_NFRAMES }, |
1806 | { "SAMSUNG CD-ROM SCR-2432", NULL, IDE_CD_FLAG_LIMIT_NFRAMES }, | 1802 | { "SAMSUNG CD-ROM SCR-2432", NULL, IDE_AFLAG_LIMIT_NFRAMES }, |
1807 | /* SCR-3231 doesn't support the SET_CD_SPEED command. */ | 1803 | /* SCR-3231 doesn't support the SET_CD_SPEED command. */ |
1808 | { "SAMSUNG CD-ROM SCR-3231", NULL, IDE_CD_FLAG_NO_SPEED_SELECT }, | 1804 | { "SAMSUNG CD-ROM SCR-3231", NULL, IDE_AFLAG_NO_SPEED_SELECT }, |
1809 | /* Old NEC260 (not R) was released before ATAPI 1.2 spec. */ | 1805 | /* Old NEC260 (not R) was released before ATAPI 1.2 spec. */ |
1810 | { "NEC CD-ROM DRIVE:260", "1.01", IDE_CD_FLAG_TOCADDR_AS_BCD | | 1806 | { "NEC CD-ROM DRIVE:260", "1.01", IDE_AFLAG_TOCADDR_AS_BCD | |
1811 | IDE_CD_FLAG_PRE_ATAPI12, }, | 1807 | IDE_AFLAG_PRE_ATAPI12, }, |
1812 | /* Vertos 300, some versions of this drive like to talk BCD. */ | 1808 | /* Vertos 300, some versions of this drive like to talk BCD. */ |
1813 | { "V003S0DS", NULL, IDE_CD_FLAG_VERTOS_300_SSD, }, | 1809 | { "V003S0DS", NULL, IDE_AFLAG_VERTOS_300_SSD, }, |
1814 | /* Vertos 600 ESD. */ | 1810 | /* Vertos 600 ESD. */ |
1815 | { "V006E0DS", NULL, IDE_CD_FLAG_VERTOS_600_ESD, }, | 1811 | { "V006E0DS", NULL, IDE_AFLAG_VERTOS_600_ESD, }, |
1816 | /* | 1812 | /* |
1817 | * Sanyo 3 CD changer uses a non-standard command for CD changing | 1813 | * Sanyo 3 CD changer uses a non-standard command for CD changing |
1818 | * (by default standard ATAPI support for CD changers is used). | 1814 | * (by default standard ATAPI support for CD changers is used). |
1819 | */ | 1815 | */ |
1820 | { "CD-ROM CDR-C3 G", NULL, IDE_CD_FLAG_SANYO_3CD }, | 1816 | { "CD-ROM CDR-C3 G", NULL, IDE_AFLAG_SANYO_3CD }, |
1821 | { "CD-ROM CDR-C3G", NULL, IDE_CD_FLAG_SANYO_3CD }, | 1817 | { "CD-ROM CDR-C3G", NULL, IDE_AFLAG_SANYO_3CD }, |
1822 | { "CD-ROM CDR_C36", NULL, IDE_CD_FLAG_SANYO_3CD }, | 1818 | { "CD-ROM CDR_C36", NULL, IDE_AFLAG_SANYO_3CD }, |
1823 | /* Stingray 8X CD-ROM. */ | 1819 | /* Stingray 8X CD-ROM. */ |
1824 | { "STINGRAY 8422 IDE 8X CD-ROM 7-27-95", NULL, IDE_CD_FLAG_PRE_ATAPI12}, | 1820 | { "STINGRAY 8422 IDE 8X CD-ROM 7-27-95", NULL, IDE_AFLAG_PRE_ATAPI12 }, |
1825 | /* | 1821 | /* |
1826 | * ACER 50X CD-ROM and WPI 32X CD-ROM require the full spec length | 1822 | * ACER 50X CD-ROM and WPI 32X CD-ROM require the full spec length |
1827 | * mode sense page capabilities size, but older drives break. | 1823 | * mode sense page capabilities size, but older drives break. |
1828 | */ | 1824 | */ |
1829 | { "ATAPI CD ROM DRIVE 50X MAX", NULL, IDE_CD_FLAG_FULL_CAPS_PAGE }, | 1825 | { "ATAPI CD ROM DRIVE 50X MAX", NULL, IDE_AFLAG_FULL_CAPS_PAGE }, |
1830 | { "WPI CDS-32X", NULL, IDE_CD_FLAG_FULL_CAPS_PAGE }, | 1826 | { "WPI CDS-32X", NULL, IDE_AFLAG_FULL_CAPS_PAGE }, |
1831 | /* ACER/AOpen 24X CD-ROM has the speed fields byte-swapped. */ | 1827 | /* ACER/AOpen 24X CD-ROM has the speed fields byte-swapped. */ |
1832 | { "", "241N", IDE_CD_FLAG_LE_SPEED_FIELDS }, | 1828 | { "", "241N", IDE_AFLAG_LE_SPEED_FIELDS }, |
1833 | /* | 1829 | /* |
1834 | * Some drives used by Apple don't advertise audio play | 1830 | * Some drives used by Apple don't advertise audio play |
1835 | * but they do support reading TOC & audio datas. | 1831 | * but they do support reading TOC & audio datas. |
1836 | */ | 1832 | */ |
1837 | { "MATSHITADVD-ROM SR-8187", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, | 1833 | { "MATSHITADVD-ROM SR-8187", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, |
1838 | { "MATSHITADVD-ROM SR-8186", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, | 1834 | { "MATSHITADVD-ROM SR-8186", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, |
1839 | { "MATSHITADVD-ROM SR-8176", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, | 1835 | { "MATSHITADVD-ROM SR-8176", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, |
1840 | { "MATSHITADVD-ROM SR-8174", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, | 1836 | { "MATSHITADVD-ROM SR-8174", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, |
1841 | { "Optiarc DVD RW AD-5200A", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, | 1837 | { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, |
1842 | { NULL, NULL, 0 } | 1838 | { NULL, NULL, 0 } |
1843 | }; | 1839 | }; |
1844 | 1840 | ||
@@ -1873,20 +1869,20 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1873 | 1869 | ||
1874 | drive->special.all = 0; | 1870 | drive->special.all = 0; |
1875 | 1871 | ||
1876 | cd->cd_flags = IDE_CD_FLAG_MEDIA_CHANGED | IDE_CD_FLAG_NO_EJECT | | 1872 | drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT | |
1877 | ide_cd_flags(id); | 1873 | ide_cd_flags(id); |
1878 | 1874 | ||
1879 | if ((id->config & 0x0060) == 0x20) | 1875 | if ((id->config & 0x0060) == 0x20) |
1880 | cd->cd_flags |= IDE_CD_FLAG_DRQ_INTERRUPT; | 1876 | drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT; |
1881 | 1877 | ||
1882 | if ((cd->cd_flags & IDE_CD_FLAG_VERTOS_300_SSD) && | 1878 | if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) && |
1883 | id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') | 1879 | id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') |
1884 | cd->cd_flags |= (IDE_CD_FLAG_TOCTRACKS_AS_BCD | | 1880 | drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD | |
1885 | IDE_CD_FLAG_TOCADDR_AS_BCD); | 1881 | IDE_AFLAG_TOCADDR_AS_BCD); |
1886 | else if ((cd->cd_flags & IDE_CD_FLAG_VERTOS_600_ESD) && | 1882 | else if ((drive->atapi_flags & IDE_AFLAG_VERTOS_600_ESD) && |
1887 | id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') | 1883 | id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') |
1888 | cd->cd_flags |= IDE_CD_FLAG_TOCTRACKS_AS_BCD; | 1884 | drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD; |
1889 | else if (cd->cd_flags & IDE_CD_FLAG_SANYO_3CD) | 1885 | else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD) |
1890 | /* 3 => use CD in slot 0 */ | 1886 | /* 3 => use CD in slot 0 */ |
1891 | cdi->sanyo_slot = 3; | 1887 | cdi->sanyo_slot = 3; |
1892 | 1888 | ||
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index fe0ea36e4124..61a4599b77db 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -27,42 +27,6 @@ | |||
27 | #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20) | 27 | #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20) |
28 | #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4 | 28 | #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4 |
29 | 29 | ||
30 | enum { | ||
31 | /* Device sends an interrupt when ready for a packet command. */ | ||
32 | IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0), | ||
33 | /* Drive cannot lock the door. */ | ||
34 | IDE_CD_FLAG_NO_DOORLOCK = (1 << 1), | ||
35 | /* Drive cannot eject the disc. */ | ||
36 | IDE_CD_FLAG_NO_EJECT = (1 << 2), | ||
37 | /* Drive is a pre ATAPI 1.2 drive. */ | ||
38 | IDE_CD_FLAG_PRE_ATAPI12 = (1 << 3), | ||
39 | /* TOC addresses are in BCD. */ | ||
40 | IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4), | ||
41 | /* TOC track numbers are in BCD. */ | ||
42 | IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5), | ||
43 | /* | ||
44 | * Drive does not provide data in multiples of SECTOR_SIZE | ||
45 | * when more than one interrupt is needed. | ||
46 | */ | ||
47 | IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6), | ||
48 | /* Seeking in progress. */ | ||
49 | IDE_CD_FLAG_SEEKING = (1 << 7), | ||
50 | /* Driver has noticed a media change. */ | ||
51 | IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8), | ||
52 | /* Saved TOC information is current. */ | ||
53 | IDE_CD_FLAG_TOC_VALID = (1 << 9), | ||
54 | /* We think that the drive door is locked. */ | ||
55 | IDE_CD_FLAG_DOOR_LOCKED = (1 << 10), | ||
56 | /* SET_CD_SPEED command is unsupported. */ | ||
57 | IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11), | ||
58 | IDE_CD_FLAG_VERTOS_300_SSD = (1 << 12), | ||
59 | IDE_CD_FLAG_VERTOS_600_ESD = (1 << 13), | ||
60 | IDE_CD_FLAG_SANYO_3CD = (1 << 14), | ||
61 | IDE_CD_FLAG_FULL_CAPS_PAGE = (1 << 15), | ||
62 | IDE_CD_FLAG_PLAY_AUDIO_OK = (1 << 16), | ||
63 | IDE_CD_FLAG_LE_SPEED_FIELDS = (1 << 17), | ||
64 | }; | ||
65 | |||
66 | /* Structure of a MSF cdrom address. */ | 30 | /* Structure of a MSF cdrom address. */ |
67 | struct atapi_msf { | 31 | struct atapi_msf { |
68 | byte reserved; | 32 | byte reserved; |
@@ -128,8 +92,6 @@ struct cdrom_info { | |||
128 | unsigned long last_block; | 92 | unsigned long last_block; |
129 | unsigned long start_seek; | 93 | unsigned long start_seek; |
130 | 94 | ||
131 | unsigned int cd_flags; | ||
132 | |||
133 | u8 max_speed; /* Max speed of the drive. */ | 95 | u8 max_speed; /* Max speed of the drive. */ |
134 | u8 current_speed; /* Current speed of the drive. */ | 96 | u8 current_speed; /* Current speed of the drive. */ |
135 | 97 | ||
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 24d002addf73..085442a47418 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -27,10 +27,9 @@ int ide_cdrom_open_real(struct cdrom_device_info *cdi, int purpose) | |||
27 | void ide_cdrom_release_real(struct cdrom_device_info *cdi) | 27 | void ide_cdrom_release_real(struct cdrom_device_info *cdi) |
28 | { | 28 | { |
29 | ide_drive_t *drive = cdi->handle; | 29 | ide_drive_t *drive = cdi->handle; |
30 | struct cdrom_info *cd = drive->driver_data; | ||
31 | 30 | ||
32 | if (!cdi->use_count) | 31 | if (!cdi->use_count) |
33 | cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID; | 32 | drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; |
34 | } | 33 | } |
35 | 34 | ||
36 | /* | 35 | /* |
@@ -83,13 +82,12 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, | |||
83 | int slot_nr) | 82 | int slot_nr) |
84 | { | 83 | { |
85 | ide_drive_t *drive = cdi->handle; | 84 | ide_drive_t *drive = cdi->handle; |
86 | struct cdrom_info *cd = drive->driver_data; | ||
87 | int retval; | 85 | int retval; |
88 | 86 | ||
89 | if (slot_nr == CDSL_CURRENT) { | 87 | if (slot_nr == CDSL_CURRENT) { |
90 | (void) cdrom_check_status(drive, NULL); | 88 | (void) cdrom_check_status(drive, NULL); |
91 | retval = (cd->cd_flags & IDE_CD_FLAG_MEDIA_CHANGED) ? 1 : 0; | 89 | retval = (drive->atapi_flags & IDE_AFLAG_MEDIA_CHANGED) ? 1 : 0; |
92 | cd->cd_flags &= ~IDE_CD_FLAG_MEDIA_CHANGED; | 90 | drive->atapi_flags &= ~IDE_AFLAG_MEDIA_CHANGED; |
93 | return retval; | 91 | return retval; |
94 | } else { | 92 | } else { |
95 | return -EINVAL; | 93 | return -EINVAL; |
@@ -107,11 +105,11 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag, | |||
107 | char loej = 0x02; | 105 | char loej = 0x02; |
108 | unsigned char cmd[BLK_MAX_CDB]; | 106 | unsigned char cmd[BLK_MAX_CDB]; |
109 | 107 | ||
110 | if ((cd->cd_flags & IDE_CD_FLAG_NO_EJECT) && !ejectflag) | 108 | if ((drive->atapi_flags & IDE_AFLAG_NO_EJECT) && !ejectflag) |
111 | return -EDRIVE_CANT_DO_THIS; | 109 | return -EDRIVE_CANT_DO_THIS; |
112 | 110 | ||
113 | /* reload fails on some drives, if the tray is locked */ | 111 | /* reload fails on some drives, if the tray is locked */ |
114 | if ((cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) && ejectflag) | 112 | if ((drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED) && ejectflag) |
115 | return 0; | 113 | return 0; |
116 | 114 | ||
117 | /* only tell drive to close tray if open, if it can do that */ | 115 | /* only tell drive to close tray if open, if it can do that */ |
@@ -131,7 +129,6 @@ static | |||
131 | int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, | 129 | int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, |
132 | struct request_sense *sense) | 130 | struct request_sense *sense) |
133 | { | 131 | { |
134 | struct cdrom_info *cd = drive->driver_data; | ||
135 | struct request_sense my_sense; | 132 | struct request_sense my_sense; |
136 | int stat; | 133 | int stat; |
137 | 134 | ||
@@ -139,7 +136,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, | |||
139 | sense = &my_sense; | 136 | sense = &my_sense; |
140 | 137 | ||
141 | /* If the drive cannot lock the door, just pretend. */ | 138 | /* If the drive cannot lock the door, just pretend. */ |
142 | if (cd->cd_flags & IDE_CD_FLAG_NO_DOORLOCK) { | 139 | if (drive->atapi_flags & IDE_AFLAG_NO_DOORLOCK) { |
143 | stat = 0; | 140 | stat = 0; |
144 | } else { | 141 | } else { |
145 | unsigned char cmd[BLK_MAX_CDB]; | 142 | unsigned char cmd[BLK_MAX_CDB]; |
@@ -160,7 +157,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, | |||
160 | (sense->asc == 0x24 || sense->asc == 0x20)) { | 157 | (sense->asc == 0x24 || sense->asc == 0x20)) { |
161 | printk(KERN_ERR "%s: door locking not supported\n", | 158 | printk(KERN_ERR "%s: door locking not supported\n", |
162 | drive->name); | 159 | drive->name); |
163 | cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK; | 160 | drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK; |
164 | stat = 0; | 161 | stat = 0; |
165 | } | 162 | } |
166 | 163 | ||
@@ -170,9 +167,9 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, | |||
170 | 167 | ||
171 | if (stat == 0) { | 168 | if (stat == 0) { |
172 | if (lockflag) | 169 | if (lockflag) |
173 | cd->cd_flags |= IDE_CD_FLAG_DOOR_LOCKED; | 170 | drive->atapi_flags |= IDE_AFLAG_DOOR_LOCKED; |
174 | else | 171 | else |
175 | cd->cd_flags &= ~IDE_CD_FLAG_DOOR_LOCKED; | 172 | drive->atapi_flags &= ~IDE_AFLAG_DOOR_LOCKED; |
176 | } | 173 | } |
177 | 174 | ||
178 | return stat; | 175 | return stat; |
@@ -250,7 +247,7 @@ int ide_cdrom_get_last_session(struct cdrom_device_info *cdi, | |||
250 | struct request_sense sense; | 247 | struct request_sense sense; |
251 | int ret; | 248 | int ret; |
252 | 249 | ||
253 | if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0 || !info->toc) { | 250 | if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0 || !info->toc) { |
254 | ret = ide_cd_read_toc(drive, &sense); | 251 | ret = ide_cd_read_toc(drive, &sense); |
255 | if (ret) | 252 | if (ret) |
256 | return ret; | 253 | return ret; |
@@ -308,7 +305,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) | |||
308 | * A reset will unlock the door. If it was previously locked, | 305 | * A reset will unlock the door. If it was previously locked, |
309 | * lock it again. | 306 | * lock it again. |
310 | */ | 307 | */ |
311 | if (cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) | 308 | if (drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED) |
312 | (void)ide_cd_lockdoor(drive, 1, &sense); | 309 | (void)ide_cd_lockdoor(drive, 1, &sense); |
313 | 310 | ||
314 | return ret; | 311 | return ret; |
@@ -324,7 +321,7 @@ static int ide_cd_get_toc_entry(ide_drive_t *drive, int track, | |||
324 | /* | 321 | /* |
325 | * don't serve cached data, if the toc isn't valid | 322 | * don't serve cached data, if the toc isn't valid |
326 | */ | 323 | */ |
327 | if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0) | 324 | if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0) |
328 | return -EINVAL; | 325 | return -EINVAL; |
329 | 326 | ||
330 | /* Check validity of requested track number. */ | 327 | /* Check validity of requested track number. */ |