ide-cd: move debug defines into header
[linux-2.6/linux-2.6-openrd.git] / drivers / ide / ide-cd.h
blob389faa42eaa16f4ba42f12e90f1e190dc50e7214
1 /*
2 * Copyright (C) 1996-98 Erik Andersen
3 * Copyright (C) 1998-2000 Jens Axboe
4 */
5 #ifndef _IDE_CD_H
6 #define _IDE_CD_H
8 #include <linux/cdrom.h>
9 #include <asm/byteorder.h>
11 #define IDECD_DEBUG_LOG 0
13 #if IDECD_DEBUG_LOG
14 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
15 #else
16 #define ide_debug_log(lvl, fmt, args...) do {} while (0)
17 #endif
20 * typical timeout for packet command
22 #define ATAPI_WAIT_PC (60 * HZ)
23 #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
25 /************************************************************************/
27 #define SECTOR_BITS 9
28 #ifndef SECTOR_SIZE
29 #define SECTOR_SIZE (1 << SECTOR_BITS)
30 #endif
31 #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)
32 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
34 /* Capabilities Page size including 8 bytes of Mode Page Header */
35 #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
36 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
38 /* Structure of a MSF cdrom address. */
39 struct atapi_msf {
40 byte reserved;
41 byte minute;
42 byte second;
43 byte frame;
46 /* Space to hold the disk TOC. */
47 #define MAX_TRACKS 99
48 struct atapi_toc_header {
49 unsigned short toc_length;
50 byte first_track;
51 byte last_track;
54 struct atapi_toc_entry {
55 byte reserved1;
56 #if defined(__BIG_ENDIAN_BITFIELD)
57 __u8 adr : 4;
58 __u8 control : 4;
59 #elif defined(__LITTLE_ENDIAN_BITFIELD)
60 __u8 control : 4;
61 __u8 adr : 4;
62 #else
63 #error "Please fix <asm/byteorder.h>"
64 #endif
65 byte track;
66 byte reserved2;
67 union {
68 unsigned lba;
69 struct atapi_msf msf;
70 } addr;
73 struct atapi_toc {
74 int last_session_lba;
75 int xa_flag;
76 unsigned long capacity;
77 struct atapi_toc_header hdr;
78 struct atapi_toc_entry ent[MAX_TRACKS+1];
79 /* One extra for the leadout. */
82 /* Extra per-device info for cdrom drives. */
83 struct cdrom_info {
84 ide_drive_t *drive;
85 ide_driver_t *driver;
86 struct gendisk *disk;
87 struct kref kref;
89 /* Buffer for table of contents. NULL if we haven't allocated
90 a TOC buffer for this device yet. */
92 struct atapi_toc *toc;
94 /* The result of the last successful request sense command
95 on this device. */
96 struct request_sense sense_data;
98 struct request request_sense_request;
100 u8 max_speed; /* Max speed of the drive. */
101 u8 current_speed; /* Current speed of the drive. */
103 /* Per-device info needed by cdrom.c generic driver. */
104 struct cdrom_device_info devinfo;
106 unsigned long write_timeout;
109 /* ide-cd_verbose.c */
110 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
112 /* ide-cd.c functions used by ide-cd_ioctl.c */
113 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
114 unsigned *, struct request_sense *, int, unsigned int);
115 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
116 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
117 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
118 int cdrom_check_status(ide_drive_t *, struct request_sense *);
120 /* ide-cd_ioctl.c */
121 int ide_cdrom_open_real(struct cdrom_device_info *, int);
122 void ide_cdrom_release_real(struct cdrom_device_info *);
123 int ide_cdrom_drive_status(struct cdrom_device_info *, int);
124 int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int);
125 int ide_cdrom_tray_move(struct cdrom_device_info *, int);
126 int ide_cdrom_lock_door(struct cdrom_device_info *, int);
127 int ide_cdrom_select_speed(struct cdrom_device_info *, int);
128 int ide_cdrom_get_last_session(struct cdrom_device_info *,
129 struct cdrom_multisession *);
130 int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
131 int ide_cdrom_reset(struct cdrom_device_info *cdi);
132 int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
133 int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *);
135 #endif /* _IDE_CD_H */