2 * linux/drivers/ide/ide_cd.h
4 * Copyright (C) 1996-98 Erik Andersen
5 * Copyright (C) 1998-2000 Jens Axboe
10 #include <linux/cdrom.h>
11 #include <asm/byteorder.h>
14 * typical timeout for packet command
16 #define ATAPI_WAIT_PC (60 * HZ)
17 #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
19 /************************************************************************/
23 #define SECTOR_SIZE (1 << SECTOR_BITS)
25 #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)
26 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
28 /* Capabilities Page size including 8 bytes of Mode Page Header */
29 #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
30 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
33 /* Device sends an interrupt when ready for a packet command. */
34 IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0),
35 /* Drive cannot lock the door. */
36 IDE_CD_FLAG_NO_DOORLOCK = (1 << 1),
37 /* Drive cannot eject the disc. */
38 IDE_CD_FLAG_NO_EJECT = (1 << 2),
39 /* Drive is a pre ATAPI 1.2 drive. */
40 IDE_CD_FLAG_PRE_ATAPI12 = (1 << 3),
41 /* TOC addresses are in BCD. */
42 IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4),
43 /* TOC track numbers are in BCD. */
44 IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5),
46 * Drive does not provide data in multiples of SECTOR_SIZE
47 * when more than one interrupt is needed.
49 IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6),
50 /* Seeking in progress. */
51 IDE_CD_FLAG_SEEKING = (1 << 7),
52 /* Driver has noticed a media change. */
53 IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8),
54 /* Saved TOC information is current. */
55 IDE_CD_FLAG_TOC_VALID = (1 << 9),
56 /* We think that the drive door is locked. */
57 IDE_CD_FLAG_DOOR_LOCKED = (1 << 10),
58 /* SET_CD_SPEED command is unsupported. */
59 IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11),
60 IDE_CD_FLAG_VERTOS_300_SSD = (1 << 12),
61 IDE_CD_FLAG_VERTOS_600_ESD = (1 << 13),
62 IDE_CD_FLAG_SANYO_3CD = (1 << 14),
63 IDE_CD_FLAG_FULL_CAPS_PAGE = (1 << 15),
64 IDE_CD_FLAG_PLAY_AUDIO_OK = (1 << 16),
65 IDE_CD_FLAG_LE_SPEED_FIELDS = (1 << 17),
68 /* Structure of a MSF cdrom address. */
76 /* Space to hold the disk TOC. */
78 struct atapi_toc_header {
79 unsigned short toc_length;
84 struct atapi_toc_entry {
86 #if defined(__BIG_ENDIAN_BITFIELD)
89 #elif defined(__LITTLE_ENDIAN_BITFIELD)
93 #error "Please fix <asm/byteorder.h>"
104 int last_session_lba;
106 unsigned long capacity;
107 struct atapi_toc_header hdr;
108 struct atapi_toc_entry ent[MAX_TRACKS+1];
109 /* One extra for the leadout. */
112 /* Extra per-device info for cdrom drives. */
115 ide_driver_t *driver;
116 struct gendisk *disk;
119 /* Buffer for table of contents. NULL if we haven't allocated
120 a TOC buffer for this device yet. */
122 struct atapi_toc *toc;
124 unsigned long sector_buffered;
125 unsigned long nsectors_buffered;
126 unsigned char *buffer;
128 /* The result of the last successful request sense command
130 struct request_sense sense_data;
132 struct request request_sense_request;
134 unsigned long last_block;
135 unsigned long start_seek;
137 unsigned int cd_flags;
139 u8 max_speed; /* Max speed of the drive. */
140 u8 current_speed; /* Current speed of the drive. */
142 /* Per-device info needed by cdrom.c generic driver. */
143 struct cdrom_device_info devinfo;
145 unsigned long write_timeout;
148 /* ide-cd_verbose.c */
149 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
151 #endif /* _IDE_CD_H */