154272Ssos/*-
2230132Suqs * Copyright (c) 1999,2000,2001,2002 S��ren Schmidt <sos@FreeBSD.org>
354272Ssos * All rights reserved.
454272Ssos *
554272Ssos * Redistribution and use in source and binary forms, with or without
654272Ssos * modification, are permitted provided that the following conditions
754272Ssos * are met:
854272Ssos * 1. Redistributions of source code must retain the above copyright
954272Ssos *    notice, this list of conditions and the following disclaimer,
1054272Ssos *    without modification, immediately at the beginning of the file.
1154272Ssos * 2. Redistributions in binary form must reproduce the above copyright
1254272Ssos *    notice, this list of conditions and the following disclaimer in the
1354272Ssos *    documentation and/or other materials provided with the distribution.
1454272Ssos * 3. The name of the author may not be used to endorse or promote products
1554272Ssos *    derived from this software without specific prior written permission.
1654272Ssos *
1754272Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1854272Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1954272Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2054272Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2154272Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2254272Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2354272Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2454272Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2554272Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2654272Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2754272Ssos *
2854272Ssos * $FreeBSD$
2954272Ssos */
3054272Ssos
3155522Ssos#ifndef _SYS_DVDIO_H_
3255522Ssos#define _SYS_DVDIO_H_
3355522Ssos
3454272Ssosstruct dvd_layer {
3554272Ssos	u_int8_t book_type	:4;
3654272Ssos	u_int8_t book_version	:4;
3754272Ssos	u_int8_t disc_size	:4;
3854272Ssos	u_int8_t max_rate	:4;
3954272Ssos	u_int8_t nlayers	:2;
4054272Ssos	u_int8_t track_path	:1;
4154272Ssos	u_int8_t layer_type	:4;
4254272Ssos	u_int8_t linear_density	:4;
4354272Ssos	u_int8_t track_density	:4;
4454272Ssos	u_int8_t bca		:1;
4554272Ssos	u_int32_t start_sector;
4654272Ssos	u_int32_t end_sector;
4754272Ssos	u_int32_t end_sector_l0;
4854272Ssos};
4954272Ssos
5054272Ssosstruct dvd_struct {
5154272Ssos	u_char format;
5254272Ssos	u_char layer_num;
5354272Ssos	u_char cpst;
5454272Ssos	u_char rmi;
5554272Ssos	u_int8_t agid		:2;
5654272Ssos	u_int32_t length;
5754272Ssos	u_char data[2048];
5854272Ssos};
5954272Ssos
6054272Ssosstruct dvd_authinfo {
6154272Ssos	unsigned char format;
6254272Ssos	u_int8_t agid		:2;
6354272Ssos	u_int8_t asf		:1;
6454272Ssos	u_int8_t cpm		:1;
6554272Ssos	u_int8_t cp_sec		:1;
6654272Ssos	u_int8_t cgms		:2;
6754272Ssos	u_int8_t reg_type	:2;
6854272Ssos	u_int8_t vend_rsts	:3;
6954272Ssos	u_int8_t user_rsts	:3;
7054272Ssos	u_int8_t region;
7154272Ssos	u_int8_t rpc_scheme;
7254272Ssos	u_int32_t lba;
7354272Ssos	u_char keychal[10];
7454272Ssos};
7554272Ssos
7654272Ssos#define DVD_STRUCT_PHYSICAL	0x00
7754272Ssos#define DVD_STRUCT_COPYRIGHT	0x01
7854272Ssos#define DVD_STRUCT_DISCKEY	0x02
7954272Ssos#define DVD_STRUCT_BCA		0x03
8054272Ssos#define DVD_STRUCT_MANUFACT	0x04
8154272Ssos#define DVD_STRUCT_CMI		0x05
8254272Ssos#define DVD_STRUCT_PROTDISCID	0x06
8354272Ssos#define DVD_STRUCT_DISCKEYBLOCK	0x07
8454272Ssos#define DVD_STRUCT_DDS		0x08
8560422Sken#define DVD_STRUCT_MEDIUM_STAT	0x09
8660422Sken#define DVD_STRUCT_SPARE_AREA	0x0A
8754272Ssos#define DVD_STRUCT_RMD_LAST	0x0C
8854272Ssos#define DVD_STRUCT_RMD_RMA	0x0D
8954272Ssos#define DVD_STRUCT_PRERECORDED	0x0E
9054272Ssos#define DVD_STRUCT_UNIQUEID	0x0F
9154272Ssos#define DVD_STRUCT_DCB		0x30
9254272Ssos#define DVD_STRUCT_LIST		0xFF
9354272Ssos
9454272Ssos#define DVD_REPORT_AGID		0
9554272Ssos#define DVD_REPORT_CHALLENGE	1
9654272Ssos#define DVD_REPORT_KEY1		2
9754272Ssos#define DVD_REPORT_TITLE_KEY	4
9854272Ssos#define DVD_REPORT_ASF		5
9954272Ssos#define DVD_REPORT_RPC		8
10054272Ssos#define DVD_INVALIDATE_AGID	0x3f
10154272Ssos
10254272Ssos#define DVD_SEND_CHALLENGE	1
10354272Ssos#define DVD_SEND_KEY2		3
10454272Ssos#define DVD_SEND_RPC		6
10555522Ssos
10655522Ssos#define DVDIOCREPORTKEY		_IOWR('c', 200, struct dvd_authinfo)
10755522Ssos#define DVDIOCSENDKEY		_IOWR('c', 201, struct dvd_authinfo)
10855522Ssos#define DVDIOCREADSTRUCTURE	_IOWR('c', 202, struct dvd_struct)
10955522Ssos
11083266Speter#endif /* _SYS_DVDIO_H_ */
111