9 #include <machine/endian.h>
10 #include <sys/ioctl.h>
13 int dvd_cdrom_ioctl(int, unsigned long, void *);
14 int cdrom_blocksize(int, int);
15 void dvd_cdrom_debug(int);
18 #define ioctl(a,b,c) dvd_cdrom_ioctl((a),(b),(c))
20 typedef unsigned char __u8
;
21 typedef unsigned short __u16
;
22 typedef unsigned int __u32
;
24 #define DVD_READ_STRUCT 0x5390 /* Read structure */
25 #define DVD_WRITE_STRUCT 0x5391 /* Write structure */
26 #define DVD_AUTH 0x5392 /* Authentication */
28 #define DVD_STRUCT_PHYSICAL 0x00
29 #define DVD_STRUCT_COPYRIGHT 0x01
30 #define DVD_STRUCT_DISCKEY 0x02
31 #define DVD_STRUCT_BCA 0x03
32 #define DVD_STRUCT_MANUFACT 0x04
35 __u8 book_version
: 4;
42 __u8 track_density
: 4;
43 __u8 linear_density
: 4;
53 struct dvd_layer layer
[4];
56 struct dvd_copyright
{
89 struct dvd_physical physical
;
90 struct dvd_copyright copyright
;
91 struct dvd_disckey disckey
;
93 struct dvd_manufact manufact
;
97 * DVD authentication ioctl
100 /* Authentication states */
101 #define DVD_LU_SEND_AGID 0
102 #define DVD_HOST_SEND_CHALLENGE 1
103 #define DVD_LU_SEND_KEY1 2
104 #define DVD_LU_SEND_CHALLENGE 3
105 #define DVD_HOST_SEND_KEY2 4
107 /* Termination states */
108 #define DVD_AUTH_ESTABLISHED 5
109 #define DVD_AUTH_FAILURE 6
111 /* Other functions */
112 #define DVD_LU_SEND_TITLE_KEY 7
113 #define DVD_LU_SEND_ASF 8
114 #define DVD_INVALIDATE_AGID 9
115 #define DVD_LU_SEND_RPC_STATE 10
116 #define DVD_HOST_SEND_RPC_STATE 11
119 typedef __u8 dvd_key
[5]; /* 40-bit value, MSB is first elem. */
120 typedef __u8 dvd_challenge
[10]; /* 80-bit value, MSB is first elem. */
122 struct dvd_lu_send_agid
{
127 struct dvd_host_send_challenge
{
134 struct dvd_send_key
{
141 struct dvd_lu_send_challenge
{
148 #define DVD_CPM_NO_COPYRIGHT 0
149 #define DVD_CPM_COPYRIGHTED 1
151 #define DVD_CP_SEC_NONE 0
152 #define DVD_CP_SEC_EXIST 1
154 #define DVD_CGMS_UNRESTRICTED 0
155 #define DVD_CGMS_SINGLE 2
156 #define DVD_CGMS_RESTRICTED 3
158 struct dvd_lu_send_title_key
{
169 struct dvd_lu_send_asf
{
176 struct dvd_host_send_rpcstate
{
181 struct dvd_lu_send_rpcstate
{
192 struct dvd_lu_send_agid lsa
;
193 struct dvd_host_send_challenge hsc
;
194 struct dvd_send_key lsk
;
195 struct dvd_lu_send_challenge lsc
;
196 struct dvd_send_key hsk
;
197 struct dvd_lu_send_title_key lstk
;
198 struct dvd_lu_send_asf lsasf
;
199 struct dvd_host_send_rpcstate hrpcs
;
200 struct dvd_lu_send_rpcstate lrpcs
;
205 __u16 report_key_length
;
208 #if BYTE_ORDER == BIG_ENDIAN
212 #elif BYTE_ORDER == LITTLE_ENDIAN
223 * Stuff for the CDROM ioctls
226 #define CDROMREADTOCHDR 0x5305 /* Read TOC header (cdrom_tochdr) */
227 #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (cdrom_tocentry) */
228 #define CDROMEJECT 0x5309 /* Ejects the cdrom media */
229 #define CDROMCLOSETRAY 0x5319 /* Reverse of CDROMEJECT */
230 #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
231 #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
232 #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) */
233 #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) */
234 #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 bytes) */
236 #define CD_MINS 74 /* max. minutes per CD, not really a limit */
237 #define CD_SECS 60 /* seconds per minute */
238 #define CD_FRAMES 75 /* frames per second */
239 #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
241 #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
242 #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
243 #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
244 #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
245 #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
246 #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
248 /* CD-ROM address types (cdrom_tocentry.cdte_format) */
249 #define CDROM_LBA 0x01 /* logical block: first frame is #0 */
250 #define CDROM_MSF 0x02 /* minute-second-frame: binary. not bcd here!*/
252 /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */
253 #define CDROM_DATA_TRACK 0x04
255 /* The leadout track is always 0xAA, regardless of # of tracks on disc */
256 #define CDROM_LEADOUT 0xAA
258 /* drive status returned by CDROM_DRIVE_STATUS ioctl */
259 #define CDS_NO_INFO 0 /* if not implemented */
260 #define CDS_NO_DISC 1
261 #define CDS_TRAY_OPEN 2
262 #define CDS_DRIVE_NOT_READY 3
263 #define CDS_DISC_OK 4
266 * Return values for CDROM_DISC_STATUS ioctl.
267 * Can also return CDS_NO_INFO and CDS_NO_DISC from above
269 #define CDS_AUDIO 100
270 #define CDS_DATA_1 101
271 #define CDS_DATA_2 102
272 #define CDS_XA_2_1 103
273 #define CDS_XA_2_2 104
274 #define CDS_MIXED 105
276 /* For compile compatibility only - we don't support changers */
277 #define CDSL_NONE ((int) (~0U>>1)-1)
278 #define CDSL_CURRENT ((int) (~0U>>1))
282 __u8 cdmsf_min0
; /* start minute */
283 __u8 cdmsf_sec0
; /* start second */
284 __u8 cdmsf_frame0
; /* start frame */
285 __u8 cdmsf_min1
; /* end minute */
286 __u8 cdmsf_sec1
; /* end second */
287 __u8 cdmsf_frame1
; /* end frame */
292 __u8 cdth_trk0
; /* start track */
293 __u8 cdth_trk1
; /* end track */
305 struct cdrom_msf0 msf
;
309 struct cdrom_tocentry
315 union cdrom_addr cdte_addr
;
324 __u8 block_desc_length
;
326 __u8 number_of_blocks_hi
;
327 __u8 number_of_blocks_med
;
328 __u8 number_of_blocks_lo
;
330 __u8 block_length_hi
;
331 __u8 block_length_med
;
332 __u8 block_length_lo
;