ide-cd.h revision 972560fb9d9ea7bc7082c0c79c99c24e3f56606c
1/* 2 * linux/drivers/ide/ide_cd.h 3 * 4 * Copyright (C) 1996-98 Erik Andersen 5 * Copyright (C) 1998-2000 Jens Axboe 6 */ 7#ifndef _IDE_CD_H 8#define _IDE_CD_H 9 10#include <linux/cdrom.h> 11#include <asm/byteorder.h> 12 13/* 14 * typical timeout for packet command 15 */ 16#define ATAPI_WAIT_PC (60 * HZ) 17#define ATAPI_WAIT_WRITE_BUSY (10 * HZ) 18 19/************************************************************************/ 20 21#define SECTOR_BITS 9 22#ifndef SECTOR_SIZE 23#define SECTOR_SIZE (1 << SECTOR_BITS) 24#endif 25#define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS) 26#define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32) 27 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 31 32enum { 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), 45 /* 46 * Drive does not provide data in multiples of SECTOR_SIZE 47 * when more than one interrupt is needed. 48 */ 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), 66}; 67 68/* Structure of a MSF cdrom address. */ 69struct atapi_msf { 70 byte reserved; 71 byte minute; 72 byte second; 73 byte frame; 74}; 75 76/* Space to hold the disk TOC. */ 77#define MAX_TRACKS 99 78struct atapi_toc_header { 79 unsigned short toc_length; 80 byte first_track; 81 byte last_track; 82}; 83 84struct atapi_toc_entry { 85 byte reserved1; 86#if defined(__BIG_ENDIAN_BITFIELD) 87 __u8 adr : 4; 88 __u8 control : 4; 89#elif defined(__LITTLE_ENDIAN_BITFIELD) 90 __u8 control : 4; 91 __u8 adr : 4; 92#else 93#error "Please fix <asm/byteorder.h>" 94#endif 95 byte track; 96 byte reserved2; 97 union { 98 unsigned lba; 99 struct atapi_msf msf; 100 } addr; 101}; 102 103struct atapi_toc { 104 int last_session_lba; 105 int xa_flag; 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. */ 110}; 111 112/* Extra per-device info for cdrom drives. */ 113struct cdrom_info { 114 ide_drive_t *drive; 115 ide_driver_t *driver; 116 struct gendisk *disk; 117 struct kref kref; 118 119 /* Buffer for table of contents. NULL if we haven't allocated 120 a TOC buffer for this device yet. */ 121 122 struct atapi_toc *toc; 123 124 unsigned long sector_buffered; 125 unsigned long nsectors_buffered; 126 unsigned char *buffer; 127 128 /* The result of the last successful request sense command 129 on this device. */ 130 struct request_sense sense_data; 131 132 struct request request_sense_request; 133 int dma; 134 unsigned long last_block; 135 unsigned long start_seek; 136 137 unsigned int cd_flags; 138 139 u8 max_speed; /* Max speed of the drive. */ 140 u8 current_speed; /* Current speed of the drive. */ 141 142 /* Per-device info needed by cdrom.c generic driver. */ 143 struct cdrom_device_info devinfo; 144 145 unsigned long write_timeout; 146}; 147 148/* ide-cd_verbose.c */ 149void ide_cd_log_error(const char *, struct request *, struct request_sense *); 150 151#endif /* _IDE_CD_H */ 152