bnx2x: Potential race after iSCSI boot
[linux-2.6/mini2440.git] / drivers / ide / ide-cd.h
blobac40d6cb90a240725ae40d661e428e27ebc36aef
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
19 #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
21 /************************************************************************/
23 #define SECTOR_BITS 9
24 #ifndef SECTOR_SIZE
25 #define SECTOR_SIZE (1 << SECTOR_BITS)
26 #endif
27 #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)
28 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
30 /* Capabilities Page size including 8 bytes of Mode Page Header */
31 #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
32 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
34 /* Structure of a MSF cdrom address. */
35 struct atapi_msf {
36 u8 reserved;
37 u8 minute;
38 u8 second;
39 u8 frame;
42 /* Space to hold the disk TOC. */
43 #define MAX_TRACKS 99
44 struct atapi_toc_header {
45 unsigned short toc_length;
46 u8 first_track;
47 u8 last_track;
50 struct atapi_toc_entry {
51 u8 reserved1;
52 #if defined(__BIG_ENDIAN_BITFIELD)
53 u8 adr : 4;
54 u8 control : 4;
55 #elif defined(__LITTLE_ENDIAN_BITFIELD)
56 u8 control : 4;
57 u8 adr : 4;
58 #else
59 #error "Please fix <asm/byteorder.h>"
60 #endif
61 u8 track;
62 u8 reserved2;
63 union {
64 unsigned lba;
65 struct atapi_msf msf;
66 } addr;
69 struct atapi_toc {
70 int last_session_lba;
71 int xa_flag;
72 unsigned long capacity;
73 struct atapi_toc_header hdr;
74 struct atapi_toc_entry ent[MAX_TRACKS+1];
75 /* One extra for the leadout. */
78 /* Extra per-device info for cdrom drives. */
79 struct cdrom_info {
80 ide_drive_t *drive;
81 struct ide_driver *driver;
82 struct gendisk *disk;
83 struct kref kref;
85 /* Buffer for table of contents. NULL if we haven't allocated
86 a TOC buffer for this device yet. */
88 struct atapi_toc *toc;
90 /* The result of the last successful request sense command
91 on this device. */
92 struct request_sense sense_data;
94 struct request request_sense_request;
96 u8 max_speed; /* Max speed of the drive. */
97 u8 current_speed; /* Current speed of the drive. */
99 /* Per-device info needed by cdrom.c generic driver. */
100 struct cdrom_device_info devinfo;
102 unsigned long write_timeout;
105 /* ide-cd_verbose.c */
106 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
108 /* ide-cd.c functions used by ide-cd_ioctl.c */
109 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
110 unsigned *, struct request_sense *, int, unsigned int);
111 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
112 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
113 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
114 int cdrom_check_status(ide_drive_t *, struct request_sense *);
116 /* ide-cd_ioctl.c */
117 int ide_cdrom_open_real(struct cdrom_device_info *, int);
118 void ide_cdrom_release_real(struct cdrom_device_info *);
119 int ide_cdrom_drive_status(struct cdrom_device_info *, int);
120 int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int);
121 int ide_cdrom_tray_move(struct cdrom_device_info *, int);
122 int ide_cdrom_lock_door(struct cdrom_device_info *, int);
123 int ide_cdrom_select_speed(struct cdrom_device_info *, int);
124 int ide_cdrom_get_last_session(struct cdrom_device_info *,
125 struct cdrom_multisession *);
126 int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
127 int ide_cdrom_reset(struct cdrom_device_info *cdi);
128 int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
129 int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *);
131 #endif /* _IDE_CD_H */