| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | 
 | 7 |  | 
 | 8 | #include <linux/cdrom.h> | 
 | 9 | #include <asm/byteorder.h> | 
 | 10 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | /* | 
 | 12 |  * typical timeout for packet command | 
 | 13 |  */ | 
 | 14 | #define ATAPI_WAIT_PC		(60 * HZ) | 
 | 15 | #define ATAPI_WAIT_WRITE_BUSY	(10 * HZ) | 
 | 16 |  | 
 | 17 | /************************************************************************/ | 
 | 18 |  | 
 | 19 | #define SECTOR_BITS 		9 | 
 | 20 | #ifndef SECTOR_SIZE | 
 | 21 | #define SECTOR_SIZE		(1 << SECTOR_BITS) | 
 | 22 | #endif | 
 | 23 | #define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS) | 
 | 24 | #define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 |  | 
| Bartlomiej Zolnierkiewicz | 455d80a | 2008-02-01 23:09:21 +0100 | [diff] [blame] | 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 | 
 | 29 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | /* Structure of a MSF cdrom address. */ | 
 | 31 | struct atapi_msf { | 
 | 32 | 	byte reserved; | 
 | 33 | 	byte minute; | 
 | 34 | 	byte second; | 
 | 35 | 	byte frame; | 
 | 36 | }; | 
 | 37 |  | 
 | 38 | /* Space to hold the disk TOC. */ | 
 | 39 | #define MAX_TRACKS 99 | 
 | 40 | struct atapi_toc_header { | 
 | 41 | 	unsigned short toc_length; | 
 | 42 | 	byte first_track; | 
 | 43 | 	byte last_track; | 
 | 44 | }; | 
 | 45 |  | 
 | 46 | struct atapi_toc_entry { | 
 | 47 | 	byte reserved1; | 
 | 48 | #if defined(__BIG_ENDIAN_BITFIELD) | 
 | 49 | 	__u8 adr     : 4; | 
 | 50 | 	__u8 control : 4; | 
 | 51 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | 
 | 52 | 	__u8 control : 4; | 
 | 53 | 	__u8 adr     : 4; | 
 | 54 | #else | 
 | 55 | #error "Please fix <asm/byteorder.h>" | 
 | 56 | #endif | 
 | 57 | 	byte track; | 
 | 58 | 	byte reserved2; | 
 | 59 | 	union { | 
 | 60 | 		unsigned lba; | 
 | 61 | 		struct atapi_msf msf; | 
 | 62 | 	} addr; | 
 | 63 | }; | 
 | 64 |  | 
 | 65 | struct atapi_toc { | 
 | 66 | 	int    last_session_lba; | 
 | 67 | 	int    xa_flag; | 
 | 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. */ | 
 | 72 | }; | 
 | 73 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | /* Extra per-device info for cdrom drives. */ | 
 | 75 | struct cdrom_info { | 
 | 76 | 	ide_drive_t	*drive; | 
 | 77 | 	ide_driver_t	*driver; | 
 | 78 | 	struct gendisk	*disk; | 
 | 79 | 	struct kref	kref; | 
 | 80 |  | 
 | 81 | 	/* Buffer for table of contents.  NULL if we haven't allocated | 
 | 82 | 	   a TOC buffer for this device yet. */ | 
 | 83 |  | 
 | 84 | 	struct atapi_toc *toc; | 
 | 85 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | 	/* The result of the last successful request sense command | 
 | 87 | 	   on this device. */ | 
 | 88 | 	struct request_sense sense_data; | 
 | 89 |  | 
 | 90 | 	struct request request_sense_request; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | 	unsigned long last_block; | 
 | 92 | 	unsigned long start_seek; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 |  | 
| Bartlomiej Zolnierkiewicz | 2bc4cf2 | 2008-02-01 23:09:22 +0100 | [diff] [blame] | 94 | 	u8 max_speed;		/* Max speed of the drive. */ | 
 | 95 | 	u8 current_speed;	/* Current speed of the drive. */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 |  | 
 | 97 |         /* Per-device info needed by cdrom.c generic driver. */ | 
 | 98 |         struct cdrom_device_info devinfo; | 
 | 99 |  | 
 | 100 | 	unsigned long write_timeout; | 
 | 101 | }; | 
 | 102 |  | 
| Bartlomiej Zolnierkiewicz | 972560f | 2008-02-01 23:09:23 +0100 | [diff] [blame] | 103 | /* ide-cd_verbose.c */ | 
 | 104 | void ide_cd_log_error(const char *, struct request *, struct request_sense *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 |  | 
| Bartlomiej Zolnierkiewicz | 1780299 | 2008-02-01 23:09:25 +0100 | [diff] [blame] | 106 | /* ide-cd.c functions used by ide-cd_ioctl.c */ | 
| FUJITA Tomonori | 5f82854 | 2008-07-15 21:21:42 +0200 | [diff] [blame] | 107 | int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *, | 
 | 108 | 		    unsigned *, struct request_sense *, int, unsigned int); | 
| Bartlomiej Zolnierkiewicz | 1780299 | 2008-02-01 23:09:25 +0100 | [diff] [blame] | 109 | int ide_cd_read_toc(ide_drive_t *, struct request_sense *); | 
 | 110 | int ide_cdrom_get_capabilities(ide_drive_t *, u8 *); | 
 | 111 | void ide_cdrom_update_speed(ide_drive_t *, u8 *); | 
| Borislav Petkov | f9afd18 | 2008-02-01 23:09:29 +0100 | [diff] [blame] | 112 | int cdrom_check_status(ide_drive_t *, struct request_sense *); | 
| Bartlomiej Zolnierkiewicz | 1780299 | 2008-02-01 23:09:25 +0100 | [diff] [blame] | 113 |  | 
 | 114 | /* ide-cd_ioctl.c */ | 
| Borislav Petkov | f9afd18 | 2008-02-01 23:09:29 +0100 | [diff] [blame] | 115 | int ide_cdrom_open_real(struct cdrom_device_info *, int); | 
 | 116 | void ide_cdrom_release_real(struct cdrom_device_info *); | 
 | 117 | int ide_cdrom_drive_status(struct cdrom_device_info *, int); | 
 | 118 | int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int); | 
 | 119 | int ide_cdrom_tray_move(struct cdrom_device_info *, int); | 
| Bartlomiej Zolnierkiewicz | 1780299 | 2008-02-01 23:09:25 +0100 | [diff] [blame] | 120 | int ide_cdrom_lock_door(struct cdrom_device_info *, int); | 
 | 121 | int ide_cdrom_select_speed(struct cdrom_device_info *, int); | 
 | 122 | int ide_cdrom_get_last_session(struct cdrom_device_info *, | 
 | 123 | 			       struct cdrom_multisession *); | 
 | 124 | int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *); | 
 | 125 | int ide_cdrom_reset(struct cdrom_device_info *cdi); | 
 | 126 | int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *); | 
| Borislav Petkov | f9afd18 | 2008-02-01 23:09:29 +0100 | [diff] [blame] | 127 | int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *); | 
| Bartlomiej Zolnierkiewicz | 1780299 | 2008-02-01 23:09:25 +0100 | [diff] [blame] | 128 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | #endif /* _IDE_CD_H */ |