/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * -- <linux/cdrom.h> * General header file for linux CD-ROM drivers * Copyright (C) 1992 David Giller, [email protected] * 1994, 1995 Eberhard Mönkeberg, [email protected] * 1996 David van Leeuwen, [email protected] * 1997, 1998 Erik Andersen, [email protected] * 1998-2002 Jens Axboe, [email protected] */ #ifndef _UAPI_LINUX_CDROM_H #define _UAPI_LINUX_CDROM_H #include <linux/types.h> #include <asm/byteorder.h> /******************************************************* * As of Linux 2.1.x, all Linux CD-ROM application programs will use this * (and only this) include file. It is my hope to provide Linux with * a uniform interface between software accessing CD-ROMs and the various * device drivers that actually talk to the drives. There may still be * 23 different kinds of strange CD-ROM drives, but at least there will * now be one, and only one, Linux CD-ROM interface. * * Additionally, as of Linux 2.1.x, all Linux application programs * should use the O_NONBLOCK option when opening a CD-ROM device * for subsequent ioctl commands. This allows for neat system errors * like "No medium found" or "Wrong medium type" upon attempting to * mount or play an empty slot, mount an audio disc, or play a data disc. * Generally, changing an application program to support O_NONBLOCK * is as easy as the following: * - drive = open("/dev/cdrom", O_RDONLY); * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); * It is worth the small change. * * Patches for many common CD programs (provided by David A. van Leeuwen) * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ * *******************************************************/ /* When a driver supports a certain function, but the cdrom drive we are * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will * borrow the "Operation not supported" error from the network folks to * accomplish this. Maybe someday we will get a more targeted error code, * but this will do for now... */ #define EDRIVE_CANT_DO_THIS … /******************************************************* * The CD-ROM IOCTL commands -- these should be supported by * all the various cdrom drivers. For the CD-ROM ioctls, we * will commandeer byte 0x53, or 'S'. *******************************************************/ #define CDROMPAUSE … #define CDROMRESUME … #define CDROMPLAYMSF … #define CDROMPLAYTRKIND … #define CDROMREADTOCHDR … #define CDROMREADTOCENTRY … #define CDROMSTOP … #define CDROMSTART … #define CDROMEJECT … #define CDROMVOLCTRL … #define CDROMSUBCHNL … #define CDROMREADMODE2 … #define CDROMREADMODE1 … #define CDROMREADAUDIO … #define CDROMEJECT_SW … #define CDROMMULTISESSION … #define CDROM_GET_MCN … #define CDROM_GET_UPC … #define CDROMRESET … #define CDROMVOLREAD … #define CDROMREADRAW … /* * These ioctls are used only used in aztcd.c and optcd.c */ #define CDROMREADCOOKED … #define CDROMSEEK … /* * This ioctl is only used by the scsi-cd driver. It is for playing audio in logical block addressing mode. */ #define CDROMPLAYBLK … /* * These ioctls are only used in optcd.c */ #define CDROMREADALL … /* * These ioctls were only in (now removed) ide-cd.c for controlling * drive spindown time. They should be implemented in the * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... * -Erik */ #define CDROMGETSPINDOWN … #define CDROMSETSPINDOWN … /* * These ioctls are implemented through the uniform CD-ROM driver * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ #define CDROMCLOSETRAY … #define CDROM_SET_OPTIONS … #define CDROM_CLEAR_OPTIONS … #define CDROM_SELECT_SPEED … #define CDROM_SELECT_DISC … #define CDROM_MEDIA_CHANGED … #define CDROM_DRIVE_STATUS … #define CDROM_DISC_STATUS … #define CDROM_CHANGER_NSLOTS … #define CDROM_LOCKDOOR … #define CDROM_DEBUG … #define CDROM_GET_CAPABILITY … /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ /* This ioctl is only used by sbpcd at the moment */ #define CDROMAUDIOBUFSIZ … /* conflict with SCSI_IOCTL_GET_IDLUN */ /* DVD-ROM Specific ioctls */ #define DVD_READ_STRUCT … #define DVD_WRITE_STRUCT … #define DVD_AUTH … #define CDROM_SEND_PACKET … #define CDROM_NEXT_WRITABLE … #define CDROM_LAST_WRITTEN … #define CDROM_TIMED_MEDIA_CHANGE … /******************************************************* * CDROM IOCTL structures *******************************************************/ /* Address in MSF format */ struct cdrom_msf0 { … }; /* Address in either MSF or logical format */ cdrom_addr; /* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { … }; /* This struct is used by the CDROMPLAYTRKIND ioctl */ struct cdrom_ti { … }; /* This struct is used by the CDROMREADTOCHDR ioctl */ struct cdrom_tochdr { … }; /* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ struct cdrom_volctrl { … }; /* This struct is used by the CDROMSUBCHNL ioctl */ struct cdrom_subchnl { … }; /* This struct is used by the CDROMREADTOCENTRY ioctl */ struct cdrom_tocentry { … }; /* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ struct cdrom_read { … }; /* This struct is used by the CDROMREADAUDIO ioctl */ struct cdrom_read_audio { … }; /* This struct is used with the CDROMMULTISESSION ioctl */ struct cdrom_multisession { … }; /* This struct is used with the CDROM_GET_MCN ioctl. * Very few audio discs actually have Universal Product Code information, * which should just be the Medium Catalog Number on the box. Also note * that the way the codeis written on CD is _not_ uniform across all discs! */ struct cdrom_mcn { … }; /* This is used by the CDROMPLAYBLK ioctl */ struct cdrom_blk { … }; #define CDROM_PACKET_SIZE … #define CGC_DATA_UNKNOWN … #define CGC_DATA_WRITE … #define CGC_DATA_READ … #define CGC_DATA_NONE … /* for CDROM_PACKET_COMMAND ioctl */ struct cdrom_generic_command { … }; /* This struct is used by CDROM_TIMED_MEDIA_CHANGE */ struct cdrom_timed_media_change_info { … }; #define MEDIA_CHANGED_FLAG … /* other bits of media_flags available for future use */ /* * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, * 2340, or 2352 bytes long. * Sector types of the standard CD-ROM data formats: * * format sector type user data size (bytes) * ----------------------------------------------------------------------------- * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) * * * The layout of the standard CD-ROM data formats: * ----------------------------------------------------------------------------- * - audio (red): | audio_sample_bytes | * | 2352 | * * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | * | 12 - 4 - 2048 - 4 - 8 - 276 | * * - data (yellow, mode2): | sync - head - data | * | 12 - 4 - 2336 | * * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | * | 12 - 4 - 8 - 2048 - 4 - 276 | * * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | * | 12 - 4 - 8 - 2324 - 4 | * */ /* Some generally useful CD-ROM information -- mostly based on the above */ #define CD_MINS … #define CD_SECS … #define CD_FRAMES … #define CD_SYNC_SIZE … #define CD_MSF_OFFSET … #define CD_CHUNK_SIZE … #define CD_NUM_OF_CHUNKS … #define CD_FRAMESIZE_SUB … #define CD_HEAD_SIZE … #define CD_SUBHEAD_SIZE … #define CD_EDC_SIZE … #define CD_ZERO_SIZE … #define CD_ECC_SIZE … #define CD_FRAMESIZE … #define CD_FRAMESIZE_RAW … #define CD_FRAMESIZE_RAWER … /* most drives don't deliver everything: */ #define CD_FRAMESIZE_RAW1 … #define CD_FRAMESIZE_RAW0 … #define CD_XA_HEAD … #define CD_XA_TAIL … #define CD_XA_SYNC_HEAD … /* CD-ROM address types (cdrom_tocentry.cdte_format) */ #define CDROM_LBA … #define CDROM_MSF … /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ #define CDROM_DATA_TRACK … /* The leadout track is always 0xAA, regardless of # of tracks on disc */ #define CDROM_LEADOUT … /* audio states (from SCSI-2, but seen with other drives, too) */ #define CDROM_AUDIO_INVALID … #define CDROM_AUDIO_PLAY … #define CDROM_AUDIO_PAUSED … #define CDROM_AUDIO_COMPLETED … #define CDROM_AUDIO_ERROR … #define CDROM_AUDIO_NO_STATUS … /* capability flags used with the uniform CD-ROM driver */ #define CDC_CLOSE_TRAY … #define CDC_OPEN_TRAY … #define CDC_LOCK … #define CDC_SELECT_SPEED … #define CDC_SELECT_DISC … #define CDC_MULTI_SESSION … #define CDC_MCN … #define CDC_MEDIA_CHANGED … #define CDC_PLAY_AUDIO … #define CDC_RESET … #define CDC_DRIVE_STATUS … #define CDC_GENERIC_PACKET … #define CDC_CD_R … #define CDC_CD_RW … #define CDC_DVD … #define CDC_DVD_R … #define CDC_DVD_RAM … #define CDC_MO_DRIVE … #define CDC_MRW … #define CDC_MRW_W … #define CDC_RAM … /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO … #define CDS_NO_DISC … #define CDS_TRAY_OPEN … #define CDS_DRIVE_NOT_READY … #define CDS_DISC_OK … /* return values for the CDROM_DISC_STATUS ioctl */ /* can also return CDS_NO_[INFO|DISC], from above */ #define CDS_AUDIO … #define CDS_DATA_1 … #define CDS_DATA_2 … #define CDS_XA_2_1 … #define CDS_XA_2_2 … #define CDS_MIXED … /* User-configurable behavior options for the uniform CD-ROM driver */ #define CDO_AUTO_CLOSE … #define CDO_AUTO_EJECT … #define CDO_USE_FFLAGS … #define CDO_LOCK … #define CDO_CHECK_TYPE … /* Special codes used when specifying changer slots. */ #define CDSL_NONE … #define CDSL_CURRENT … /* For partition based multisession access. IDE can handle 64 partitions * per drive - SCSI CD-ROM's use minors to differentiate between the * various drives, so we can't do multisessions the same way there. * Use the -o session=x option to mount on them. */ #define CD_PART_MAX … #define CD_PART_MASK … /********************************************************************* * Generic Packet commands, MMC commands, and such *********************************************************************/ /* The generic packet command opcodes for CD/DVD Logical Units, * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ #define GPCMD_BLANK … #define GPCMD_CLOSE_TRACK … #define GPCMD_FLUSH_CACHE … #define GPCMD_FORMAT_UNIT … #define GPCMD_GET_CONFIGURATION … #define GPCMD_GET_EVENT_STATUS_NOTIFICATION … #define GPCMD_GET_PERFORMANCE … #define GPCMD_INQUIRY … #define GPCMD_LOAD_UNLOAD … #define GPCMD_MECHANISM_STATUS … #define GPCMD_MODE_SELECT_10 … #define GPCMD_MODE_SENSE_10 … #define GPCMD_PAUSE_RESUME … #define GPCMD_PLAY_AUDIO_10 … #define GPCMD_PLAY_AUDIO_MSF … #define GPCMD_PLAY_AUDIO_TI … #define GPCMD_PLAY_CD … #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL … #define GPCMD_READ_10 … #define GPCMD_READ_12 … #define GPCMD_READ_BUFFER … #define GPCMD_READ_BUFFER_CAPACITY … #define GPCMD_READ_CDVD_CAPACITY … #define GPCMD_READ_CD … #define GPCMD_READ_CD_MSF … #define GPCMD_READ_DISC_INFO … #define GPCMD_READ_DVD_STRUCTURE … #define GPCMD_READ_FORMAT_CAPACITIES … #define GPCMD_READ_HEADER … #define GPCMD_READ_TRACK_RZONE_INFO … #define GPCMD_READ_SUBCHANNEL … #define GPCMD_READ_TOC_PMA_ATIP … #define GPCMD_REPAIR_RZONE_TRACK … #define GPCMD_REPORT_KEY … #define GPCMD_REQUEST_SENSE … #define GPCMD_RESERVE_RZONE_TRACK … #define GPCMD_SEND_CUE_SHEET … #define GPCMD_SCAN … #define GPCMD_SEEK … #define GPCMD_SEND_DVD_STRUCTURE … #define GPCMD_SEND_EVENT … #define GPCMD_SEND_KEY … #define GPCMD_SEND_OPC … #define GPCMD_SET_READ_AHEAD … #define GPCMD_SET_STREAMING … #define GPCMD_START_STOP_UNIT … #define GPCMD_STOP_PLAY_SCAN … #define GPCMD_TEST_UNIT_READY … #define GPCMD_VERIFY_10 … #define GPCMD_WRITE_10 … #define GPCMD_WRITE_12 … #define GPCMD_WRITE_AND_VERIFY_10 … #define GPCMD_WRITE_BUFFER … /* This is listed as optional in ATAPI 2.6, but is (curiously) * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji * Table 377 as an MMC command for SCSi devices though... Most ATAPI * drives support it. */ #define GPCMD_SET_SPEED … /* This seems to be a SCSI specific CD-ROM opcode * to play data at track/index */ #define GPCMD_PLAYAUDIO_TI … /* * From MS Media Status Notification Support Specification. For * older drives only. */ #define GPCMD_GET_MEDIA_STATUS … /* Mode page codes for mode sense/set */ #define GPMODE_VENDOR_PAGE … #define GPMODE_R_W_ERROR_PAGE … #define GPMODE_WRITE_PARMS_PAGE … #define GPMODE_WCACHING_PAGE … #define GPMODE_AUDIO_CTL_PAGE … #define GPMODE_POWER_PAGE … #define GPMODE_FAULT_FAIL_PAGE … #define GPMODE_TO_PROTECT_PAGE … #define GPMODE_CAPABILITIES_PAGE … #define GPMODE_ALL_PAGES … /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor * of MODE_SENSE_POWER_PAGE */ #define GPMODE_CDROM_PAGE … /* DVD struct types */ #define DVD_STRUCT_PHYSICAL … #define DVD_STRUCT_COPYRIGHT … #define DVD_STRUCT_DISCKEY … #define DVD_STRUCT_BCA … #define DVD_STRUCT_MANUFACT … struct dvd_layer { … }; #define DVD_LAYERS … struct dvd_physical { … }; struct dvd_copyright { … }; struct dvd_disckey { … }; struct dvd_bca { … }; struct dvd_manufact { … }; dvd_struct; /* * DVD authentication ioctl */ /* Authentication states */ #define DVD_LU_SEND_AGID … #define DVD_HOST_SEND_CHALLENGE … #define DVD_LU_SEND_KEY1 … #define DVD_LU_SEND_CHALLENGE … #define DVD_HOST_SEND_KEY2 … /* Termination states */ #define DVD_AUTH_ESTABLISHED … #define DVD_AUTH_FAILURE … /* Other functions */ #define DVD_LU_SEND_TITLE_KEY … #define DVD_LU_SEND_ASF … #define DVD_INVALIDATE_AGID … #define DVD_LU_SEND_RPC_STATE … #define DVD_HOST_SEND_RPC_STATE … /* State data */ dvd_key; /* 40-bit value, MSB is first elem. */ dvd_challenge; /* 80-bit value, MSB is first elem. */ struct dvd_lu_send_agid { … }; struct dvd_host_send_challenge { … }; struct dvd_send_key { … }; struct dvd_lu_send_challenge { … }; #define DVD_CPM_NO_COPYRIGHT … #define DVD_CPM_COPYRIGHTED … #define DVD_CP_SEC_NONE … #define DVD_CP_SEC_EXIST … #define DVD_CGMS_UNRESTRICTED … #define DVD_CGMS_SINGLE … #define DVD_CGMS_RESTRICTED … struct dvd_lu_send_title_key { … }; struct dvd_lu_send_asf { … }; struct dvd_host_send_rpcstate { … }; struct dvd_lu_send_rpcstate { … }; dvd_authinfo; struct request_sense { … }; /* * feature profile */ #define CDF_RWRT … #define CDF_HWDM … #define CDF_MRW … /* * media status bits */ #define CDM_MRW_NOTMRW … #define CDM_MRW_BGFORMAT_INACTIVE … #define CDM_MRW_BGFORMAT_ACTIVE … #define CDM_MRW_BGFORMAT_COMPLETE … /* * mrw address spaces */ #define MRW_LBA_DMA … #define MRW_LBA_GAA … /* * mrw mode pages (first is deprecated) -- probed at init time and * cdi->mrw_mode_page is set */ #define MRW_MODE_PC_PRE1 … #define MRW_MODE_PC … struct mrw_feature_desc { … }; /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ struct rwrt_feature_desc { … }; disc_information; track_information; struct feature_header { … }; struct mode_page_header { … }; /* removable medium feature descriptor */ struct rm_feature_desc { … }; #endif /* _UAPI_LINUX_CDROM_H */