xref: /freebsd/sys/sys/dvdio.h (revision 4f52dfbb)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1999,2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer,
12  *    without modification, immediately at the beginning of the file.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32 
33 #ifndef _SYS_DVDIO_H_
34 #define _SYS_DVDIO_H_
35 
36 struct dvd_layer {
37 	u_int8_t book_type	:4;
38 	u_int8_t book_version	:4;
39 	u_int8_t disc_size	:4;
40 	u_int8_t max_rate	:4;
41 	u_int8_t nlayers	:2;
42 	u_int8_t track_path	:1;
43 	u_int8_t layer_type	:4;
44 	u_int8_t linear_density	:4;
45 	u_int8_t track_density	:4;
46 	u_int8_t bca		:1;
47 	u_int32_t start_sector;
48 	u_int32_t end_sector;
49 	u_int32_t end_sector_l0;
50 };
51 
52 struct dvd_struct {
53 	u_char format;
54 	u_char layer_num;
55 	u_char cpst;
56 	u_char rmi;
57 	u_int8_t agid		:2;
58 	u_int32_t length;
59 	u_char data[2048];
60 };
61 
62 struct dvd_authinfo {
63 	unsigned char format;
64 	u_int8_t agid		:2;
65 	u_int8_t asf		:1;
66 	u_int8_t cpm		:1;
67 	u_int8_t cp_sec		:1;
68 	u_int8_t cgms		:2;
69 	u_int8_t reg_type	:2;
70 	u_int8_t vend_rsts	:3;
71 	u_int8_t user_rsts	:3;
72 	u_int8_t region;
73 	u_int8_t rpc_scheme;
74 	u_int32_t lba;
75 	u_char keychal[10];
76 };
77 
78 #define DVD_STRUCT_PHYSICAL	0x00
79 #define DVD_STRUCT_COPYRIGHT	0x01
80 #define DVD_STRUCT_DISCKEY	0x02
81 #define DVD_STRUCT_BCA		0x03
82 #define DVD_STRUCT_MANUFACT	0x04
83 #define DVD_STRUCT_CMI		0x05
84 #define DVD_STRUCT_PROTDISCID	0x06
85 #define DVD_STRUCT_DISCKEYBLOCK	0x07
86 #define DVD_STRUCT_DDS		0x08
87 #define DVD_STRUCT_MEDIUM_STAT	0x09
88 #define DVD_STRUCT_SPARE_AREA	0x0A
89 #define DVD_STRUCT_RMD_LAST	0x0C
90 #define DVD_STRUCT_RMD_RMA	0x0D
91 #define DVD_STRUCT_PRERECORDED	0x0E
92 #define DVD_STRUCT_UNIQUEID	0x0F
93 #define DVD_STRUCT_DCB		0x30
94 #define DVD_STRUCT_LIST		0xFF
95 
96 #define DVD_REPORT_AGID		0
97 #define DVD_REPORT_CHALLENGE	1
98 #define DVD_REPORT_KEY1		2
99 #define DVD_REPORT_TITLE_KEY	4
100 #define DVD_REPORT_ASF		5
101 #define DVD_REPORT_RPC		8
102 #define DVD_INVALIDATE_AGID	0x3f
103 
104 #define DVD_SEND_CHALLENGE	1
105 #define DVD_SEND_KEY2		3
106 #define DVD_SEND_RPC		6
107 
108 #define DVDIOCREPORTKEY		_IOWR('c', 200, struct dvd_authinfo)
109 #define DVDIOCSENDKEY		_IOWR('c', 201, struct dvd_authinfo)
110 #define DVDIOCREADSTRUCTURE	_IOWR('c', 202, struct dvd_struct)
111 
112 #endif /* _SYS_DVDIO_H_ */
113