2  *  Copyright (C) 1996-98  Erik Andersen
 
   3  *  Copyright (C) 1998-2000 Jens Axboe
 
   8 #include <linux/cdrom.h>
 
   9 #include <asm/byteorder.h>
 
  12  * typical timeout for packet command
 
  14 #define ATAPI_WAIT_PC           (60 * HZ)
 
  15 #define ATAPI_WAIT_WRITE_BUSY   (10 * HZ)
 
  17 /************************************************************************/
 
  21 #define SECTOR_SIZE             (1 << SECTOR_BITS)
 
  23 #define SECTORS_PER_FRAME       (CD_FRAMESIZE >> SECTOR_BITS)
 
  24 #define SECTOR_BUFFER_SIZE      (CD_FRAMESIZE * 32)
 
  26 /* Capabilities Page size including 8 bytes of Mode Page Header */
 
  27 #define ATAPI_CAPABILITIES_PAGE_SIZE            (8 + 20)
 
  28 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE        4
 
  30 /* Structure of a MSF cdrom address. */
 
  38 /* Space to hold the disk TOC. */
 
  40 struct atapi_toc_header {
 
  41         unsigned short toc_length;
 
  46 struct atapi_toc_entry {
 
  48 #if defined(__BIG_ENDIAN_BITFIELD)
 
  51 #elif defined(__LITTLE_ENDIAN_BITFIELD)
 
  55 #error "Please fix <asm/byteorder.h>"
 
  68         unsigned long capacity;
 
  69         struct atapi_toc_header hdr;
 
  70         struct atapi_toc_entry  ent[MAX_TRACKS+1];
 
  71           /* One extra for the leadout. */
 
  74 /* Extra per-device info for cdrom drives. */
 
  81         /* Buffer for table of contents.  NULL if we haven't allocated
 
  82            a TOC buffer for this device yet. */
 
  84         struct atapi_toc *toc;
 
  86         /* The result of the last successful request sense command
 
  88         struct request_sense sense_data;
 
  90         struct request request_sense_request;
 
  92         unsigned long last_block;
 
  93         unsigned long start_seek;
 
  95         u8 max_speed;           /* Max speed of the drive. */
 
  96         u8 current_speed;       /* Current speed of the drive. */
 
  98         /* Per-device info needed by cdrom.c generic driver. */
 
  99         struct cdrom_device_info devinfo;
 
 101         unsigned long write_timeout;
 
 104 /* ide-cd_verbose.c */
 
 105 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
 
 107 /* ide-cd.c functions used by ide-cd_ioctl.c */
 
 108 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
 
 109                     unsigned *, struct request_sense *, int, unsigned int);
 
 110 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
 
 111 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
 
 112 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
 
 113 int cdrom_check_status(ide_drive_t *, struct request_sense *);
 
 116 int ide_cdrom_open_real(struct cdrom_device_info *, int);
 
 117 void ide_cdrom_release_real(struct cdrom_device_info *);
 
 118 int ide_cdrom_drive_status(struct cdrom_device_info *, int);
 
 119 int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int);
 
 120 int ide_cdrom_tray_move(struct cdrom_device_info *, int);
 
 121 int ide_cdrom_lock_door(struct cdrom_device_info *, int);
 
 122 int ide_cdrom_select_speed(struct cdrom_device_info *, int);
 
 123 int ide_cdrom_get_last_session(struct cdrom_device_info *,
 
 124                                struct cdrom_multisession *);
 
 125 int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
 
 126 int ide_cdrom_reset(struct cdrom_device_info *cdi);
 
 127 int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
 
 128 int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *);
 
 130 #endif /* _IDE_CD_H */