Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / sys / dvdio.h @ 14

History | View | Annotate | Download (3.75 KB)

1 13 up20180614
/*        $NetBSD: dvdio.h,v 1.8 2005/12/26 18:41:36 perry Exp $        */
2
3
#ifndef _SYS_DVDIO_H_
4
#define _SYS_DVDIO_H_
5
6
#include <sys/types.h>
7
#include <sys/ioccom.h>
8
9
/* DVD-ROM Specific ioctls */
10
#define DVD_READ_STRUCT                _IOWR('d', 0, dvd_struct)
11
#define DVD_WRITE_STRUCT        _IOWR('d', 1, dvd_struct)
12
#define DVD_AUTH                _IOWR('d', 2, dvd_authinfo)
13
14
#define GPCMD_READ_DVD_STRUCTURE        0xad
15
#define GPCMD_SEND_DVD_STRUCTURE        0xad
16
#define GPCMD_REPORT_KEY                0xa4
17
#define GPCMD_SEND_KEY                        0xa3
18
19
/* DVD struct types */
20
#define DVD_STRUCT_PHYSICAL                0x00
21
#define DVD_STRUCT_COPYRIGHT                0x01
22
#define DVD_STRUCT_DISCKEY                0x02
23
#define DVD_STRUCT_BCA                        0x03
24
#define DVD_STRUCT_MANUFACT                0x04
25
26
struct dvd_layer {
27
        uint8_t book_version        : 4;
28
        uint8_t book_type        : 4;
29
        uint8_t min_rate        : 4;
30
        uint8_t disc_size        : 4;
31
        uint8_t layer_type        : 4;
32
        uint8_t track_path        : 1;
33
        uint8_t nlayers        : 2;
34
        uint8_t track_density        : 4;
35
        uint8_t linear_density        : 4;
36
        uint8_t bca                : 1;
37
        uint32_t start_sector;
38
        uint32_t end_sector;
39
        uint32_t end_sector_l0;
40
};
41
42
struct dvd_physical {
43
        uint8_t type;
44
        uint8_t layer_num;
45
        struct dvd_layer layer[4];
46
};
47
48
struct dvd_copyright {
49
        uint8_t type;
50
51
        uint8_t layer_num;
52
        uint8_t cpst;
53
        uint8_t rmi;
54
};
55
56
struct dvd_disckey {
57
        uint8_t type;
58
59
        unsigned agid                : 2;
60
        uint8_t value[2048];
61
};
62
63
struct dvd_bca {
64
        uint8_t type;
65
66
        int len;
67
        uint8_t value[188];
68
};
69
70
struct dvd_manufact {
71
        uint8_t type;
72
73
        uint8_t layer_num;
74
        int len;
75
        uint8_t value[2048];
76
};
77
78
typedef union {
79
        uint8_t type;
80
81
        struct dvd_physical        physical;
82
        struct dvd_copyright        copyright;
83
        struct dvd_disckey        disckey;
84
        struct dvd_bca                bca;
85
        struct dvd_manufact        manufact;
86
} dvd_struct;
87
88
/*
89
 * DVD authentication ioctl
90
 */
91
92
/* Authentication states */
93
#define DVD_LU_SEND_AGID        0
94
#define DVD_HOST_SEND_CHALLENGE        1
95
#define DVD_LU_SEND_KEY1        2
96
#define DVD_LU_SEND_CHALLENGE        3
97
#define DVD_HOST_SEND_KEY2        4
98
99
/* Termination states */
100
#define DVD_AUTH_ESTABLISHED        5
101
#define DVD_AUTH_FAILURE        6
102
103
/* Other functions */
104
#define DVD_LU_SEND_TITLE_KEY        7
105
#define DVD_LU_SEND_ASF                8
106
#define DVD_INVALIDATE_AGID        9
107
#define DVD_LU_SEND_RPC_STATE        10
108
#define DVD_HOST_SEND_RPC_STATE        11
109
110
/* State data */
111
typedef uint8_t dvd_key[5];                /* 40-bit value, MSB is first elem. */
112
typedef uint8_t dvd_challenge[10];        /* 80-bit value, MSB is first elem. */
113
114
struct dvd_lu_send_agid {
115
        uint8_t type;
116
        unsigned agid                : 2;
117
};
118
119
struct dvd_host_send_challenge {
120
        uint8_t type;
121
        unsigned agid                : 2;
122
123
        dvd_challenge chal;
124
};
125
126
struct dvd_send_key {
127
        uint8_t type;
128
        unsigned agid                : 2;
129
130
        dvd_key key;
131
};
132
133
struct dvd_lu_send_challenge {
134
        uint8_t type;
135
        unsigned agid                : 2;
136
137
        dvd_challenge chal;
138
};
139
140
#define DVD_CPM_NO_COPYRIGHT        0
141
#define DVD_CPM_COPYRIGHTED        1
142
143
#define DVD_CP_SEC_NONE                0
144
#define DVD_CP_SEC_EXIST        1
145
146
#define DVD_CGMS_UNRESTRICTED        0
147
#define DVD_CGMS_SINGLE                2
148
#define DVD_CGMS_RESTRICTED        3
149
150
struct dvd_lu_send_title_key {
151
        uint8_t type;
152
        unsigned agid                : 2;
153
154
        dvd_key title_key;
155
        int lba;
156
        unsigned cpm                : 1;
157
        unsigned cp_sec                : 1;
158
        unsigned cgms                : 2;
159
};
160
161
struct dvd_lu_send_asf {
162
        uint8_t type;
163
        unsigned agid                : 2;
164
165
        unsigned asf                : 1;
166
};
167
168
struct dvd_host_send_rpcstate {
169
        uint8_t type;
170
        uint8_t pdrc;
171
};
172
173
struct dvd_lu_send_rpcstate {
174
        uint8_t type                : 2;
175
        uint8_t vra                : 3;
176
        uint8_t ucca                : 3;
177
        uint8_t region_mask;
178
        uint8_t rpc_scheme;
179
};
180
181
typedef union {
182
        uint8_t type;
183
184
        struct dvd_lu_send_agid                lsa;
185
        struct dvd_host_send_challenge        hsc;
186
        struct dvd_send_key                lsk;
187
        struct dvd_lu_send_challenge        lsc;
188
        struct dvd_send_key                hsk;
189
        struct dvd_lu_send_title_key        lstk;
190
        struct dvd_lu_send_asf                lsasf;
191
        struct dvd_host_send_rpcstate        hrpcs;
192
        struct dvd_lu_send_rpcstate        lrpcs;
193
} dvd_authinfo;
194
195
typedef struct {
196
        uint16_t report_key_length;
197
        uint8_t reserved1[2];
198
        uint8_t ucca                : 3;
199
        uint8_t vra                : 3;
200
        uint8_t type_code        : 2;
201
        uint8_t region_mask;
202
        uint8_t rpc_scheme;
203
        uint8_t reserved2;
204
} dvd_rpc_state_t;
205
206
#endif /* _SYS_DVDIO_H_ */