sr.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * sr.h by David Giller
  4. * CD-ROM disk driver header file
  5. *
  6. * adapted from:
  7. * sd.h Copyright (C) 1992 Drew Eckhardt
  8. * SCSI disk driver header file by
  9. * Drew Eckhardt
  10. *
  11. * <[email protected]>
  12. *
  13. * Modified by Eric Youngdale [email protected] to
  14. * add scatter-gather, multiple outstanding request, and other
  15. * enhancements.
  16. */
  17. #ifndef _SR_H
  18. #define _SR_H
  19. #include <linux/mutex.h>
  20. #define MAX_RETRIES 3
  21. #define SR_TIMEOUT (30 * HZ)
  22. struct scsi_device;
  23. /* The CDROM is fairly slow, so we need a little extra time */
  24. /* In fact, it is very slow if it has to spin up first */
  25. #define IOCTL_TIMEOUT 30*HZ
  26. typedef struct scsi_cd {
  27. unsigned capacity; /* size in blocks */
  28. struct scsi_device *device;
  29. unsigned int vendor; /* vendor code, see sr_vendor.c */
  30. unsigned long ms_offset; /* for reading multisession-CD's */
  31. unsigned writeable : 1;
  32. unsigned use:1; /* is this device still supportable */
  33. unsigned xa_flag:1; /* CD has XA sectors ? */
  34. unsigned readcd_known:1; /* drive supports READ_CD (0xbe) */
  35. unsigned readcd_cdda:1; /* reading audio data using READ_CD */
  36. unsigned media_present:1; /* media is present */
  37. /* GET_EVENT spurious event handling, blk layer guarantees exclusion */
  38. int tur_mismatch; /* nr of get_event TUR mismatches */
  39. bool tur_changed:1; /* changed according to TUR */
  40. bool get_event_changed:1; /* changed according to GET_EVENT */
  41. bool ignore_get_event:1; /* GET_EVENT is unreliable, use TUR */
  42. struct cdrom_device_info cdi;
  43. struct mutex lock;
  44. struct gendisk *disk;
  45. } Scsi_CD;
  46. #define sr_printk(prefix, cd, fmt, a...) \
  47. sdev_prefix_printk(prefix, (cd)->device, (cd)->cdi.name, fmt, ##a)
  48. int sr_do_ioctl(Scsi_CD *, struct packet_command *);
  49. int sr_lock_door(struct cdrom_device_info *, int);
  50. int sr_tray_move(struct cdrom_device_info *, int);
  51. int sr_drive_status(struct cdrom_device_info *, int);
  52. int sr_disk_status(struct cdrom_device_info *);
  53. int sr_get_last_session(struct cdrom_device_info *, struct cdrom_multisession *);
  54. int sr_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
  55. int sr_reset(struct cdrom_device_info *);
  56. int sr_select_speed(struct cdrom_device_info *cdi, int speed);
  57. int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
  58. int sr_is_xa(Scsi_CD *);
  59. /* sr_vendor.c */
  60. void sr_vendor_init(Scsi_CD *);
  61. int sr_cd_check(struct cdrom_device_info *);
  62. int sr_set_blocklength(Scsi_CD *, int blocklength);
  63. #endif