1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * sr.h by David Giller 41da177e4SLinus Torvalds * CD-ROM disk driver header file 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * adapted from: 71da177e4SLinus Torvalds * sd.h Copyright (C) 1992 Drew Eckhardt 81da177e4SLinus Torvalds * SCSI disk driver header file by 91da177e4SLinus Torvalds * Drew Eckhardt 101da177e4SLinus Torvalds * 111da177e4SLinus Torvalds * <drew@colorado.edu> 121da177e4SLinus Torvalds * 131da177e4SLinus Torvalds * Modified by Eric Youngdale eric@andante.org to 141da177e4SLinus Torvalds * add scatter-gather, multiple outstanding request, and other 151da177e4SLinus Torvalds * enhancements. 161da177e4SLinus Torvalds */ 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds #ifndef _SR_H 191da177e4SLinus Torvalds #define _SR_H 201da177e4SLinus Torvalds 21*51a85881SMerlijn Wajer #include <linux/mutex.h> 221da177e4SLinus Torvalds 23210ba1d1SJames Bottomley #define MAX_RETRIES 3 24210ba1d1SJames Bottomley #define SR_TIMEOUT (30 * HZ) 25210ba1d1SJames Bottomley 261da177e4SLinus Torvalds struct scsi_device; 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds /* The CDROM is fairly slow, so we need a little extra time */ 291da177e4SLinus Torvalds /* In fact, it is very slow if it has to spin up first */ 301da177e4SLinus Torvalds #define IOCTL_TIMEOUT 30*HZ 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds typedef struct scsi_cd { 341da177e4SLinus Torvalds unsigned capacity; /* size in blocks */ 351da177e4SLinus Torvalds struct scsi_device *device; 361da177e4SLinus Torvalds unsigned int vendor; /* vendor code, see sr_vendor.c */ 371da177e4SLinus Torvalds unsigned long ms_offset; /* for reading multisession-CD's */ 38fd2eb903SChristoph Hellwig unsigned writeable : 1; 391da177e4SLinus Torvalds unsigned use:1; /* is this device still supportable */ 401da177e4SLinus Torvalds unsigned xa_flag:1; /* CD has XA sectors ? */ 411da177e4SLinus Torvalds unsigned readcd_known:1; /* drive supports READ_CD (0xbe) */ 421da177e4SLinus Torvalds unsigned readcd_cdda:1; /* reading audio data using READ_CD */ 4393aae17aSTejun Heo unsigned media_present:1; /* media is present */ 4479b9677dSKay Sievers 4579b9677dSKay Sievers /* GET_EVENT spurious event handling, blk layer guarantees exclusion */ 4679b9677dSKay Sievers int tur_mismatch; /* nr of get_event TUR mismatches */ 4779b9677dSKay Sievers bool tur_changed:1; /* changed according to TUR */ 4879b9677dSKay Sievers bool get_event_changed:1; /* changed according to GET_EVENT */ 4979b9677dSKay Sievers bool ignore_get_event:1; /* GET_EVENT is unreliable, use TUR */ 5079b9677dSKay Sievers 511da177e4SLinus Torvalds struct cdrom_device_info cdi; 52*51a85881SMerlijn Wajer struct mutex lock; 531da177e4SLinus Torvalds struct gendisk *disk; 541da177e4SLinus Torvalds } Scsi_CD; 551da177e4SLinus Torvalds 5696eefad2SHannes Reinecke #define sr_printk(prefix, cd, fmt, a...) \ 5722e0d994SHannes Reinecke sdev_prefix_printk(prefix, (cd)->device, (cd)->cdi.name, fmt, ##a) 5896eefad2SHannes Reinecke 591da177e4SLinus Torvalds int sr_do_ioctl(Scsi_CD *, struct packet_command *); 601da177e4SLinus Torvalds 611da177e4SLinus Torvalds int sr_lock_door(struct cdrom_device_info *, int); 621da177e4SLinus Torvalds int sr_tray_move(struct cdrom_device_info *, int); 631da177e4SLinus Torvalds int sr_drive_status(struct cdrom_device_info *, int); 641da177e4SLinus Torvalds int sr_disk_status(struct cdrom_device_info *); 651da177e4SLinus Torvalds int sr_get_last_session(struct cdrom_device_info *, struct cdrom_multisession *); 661da177e4SLinus Torvalds int sr_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *); 671da177e4SLinus Torvalds int sr_reset(struct cdrom_device_info *); 681da177e4SLinus Torvalds int sr_select_speed(struct cdrom_device_info *cdi, unsigned long speed); 691da177e4SLinus Torvalds int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *); 701da177e4SLinus Torvalds 711da177e4SLinus Torvalds int sr_is_xa(Scsi_CD *); 721da177e4SLinus Torvalds 731da177e4SLinus Torvalds /* sr_vendor.c */ 741da177e4SLinus Torvalds void sr_vendor_init(Scsi_CD *); 751da177e4SLinus Torvalds int sr_cd_check(struct cdrom_device_info *); 761da177e4SLinus Torvalds int sr_set_blocklength(Scsi_CD *, int blocklength); 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds #endif 79