xref: /titanic_41/usr/src/cmd/cdrw/mmc.h (revision b36bd5c006a9e77300173b89e361a64db9b1fa94)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*b36bd5c0Szk194757  * Common Development and Distribution License (the "License").
6*b36bd5c0Szk194757  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22c9be8e69Sec158148  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_MMC_H
277c478bd9Sstevel@tonic-gate #define	_MMC_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
3598584592Sarutz /* bytelengths for some SCSI data structures */
367c478bd9Sstevel@tonic-gate #define	SENSE_DATA_SIZE		16
377c478bd9Sstevel@tonic-gate #define	TRACK_INFO_SIZE		36
387c478bd9Sstevel@tonic-gate #define	DISC_INFO_BLOCK_SIZE	32
397c478bd9Sstevel@tonic-gate #define	INQUIRY_DATA_LENGTH	96
407c478bd9Sstevel@tonic-gate #define	GET_PERF_DATA_LEN	24
417c478bd9Sstevel@tonic-gate #define	SET_STREAM_DATA_LEN	28
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	DEFAULT_SCSI_TIMEOUT    60
447c478bd9Sstevel@tonic-gate 
45c9be8e69Sec158148 #define	MMC_FTR_HDR_LEN		8	/* byte len of Feature Header */
46c9be8e69Sec158148 /*
47c9be8e69Sec158148  * byte length of the static part of a Feature Descriptor
48c9be8e69Sec158148  */
49c9be8e69Sec158148 #define	MMC_FTR_DSCRPTR_BASE_LEN	4
50c9be8e69Sec158148 #define	MMC_PRFL_DSCRPTR_LEN	4	/* byte len of Profile Descriptor */
51c9be8e69Sec158148 /*
52c9be8e69Sec158148  * MMC Features; can be added to over time
53c9be8e69Sec158148  */
54c9be8e69Sec158148 #define	MMC_FTR_PRFL_LIST	0x0000	/* Profile List Feature */
55c9be8e69Sec158148 #define	MMC_FTR_CORE		0x0001	/* Core Feature */
56c9be8e69Sec158148 #define	MMC_FTR_MORPHING	0x0002	/* Morphing Feature */
57c9be8e69Sec158148 #define	MMC_FTR_REM_MED		0x0003	/* Removable Medium Feature */
58c9be8e69Sec158148 #define	MMC_FTR_WR_PROTECT	0x0004	/* Write Protect Feature */
59c9be8e69Sec158148 #define	MMC_FTR_RAND_READ	0x0010	/* Random Readable Feature */
60c9be8e69Sec158148 #define	MMC_FTR_MULTI_READ	0x001D	/* Multi-Read Feature */
61c9be8e69Sec158148 #define	MMC_FTR_CD_READ		0x001E	/* CD Read Feature */
62c9be8e69Sec158148 #define	MMC_FTR_DVD_READ	0x001F	/* DVD Read Feature */
63c9be8e69Sec158148 #define	MMC_FTR_RAND_WR		0x0020	/* Random Writable Feature */
64c9be8e69Sec158148 #define	MMC_FTR_INC_STR_WR	0x0021	/* Incremental Streaming Writable */
65c9be8e69Sec158148 #define	MMC_FTR_SCTR_ERSBL	0x0022	/* Sector Erasable Feature */
66c9be8e69Sec158148 #define	MMC_FTR_FORMATTABLE	0x0023	/* Formattable Feature */
67c9be8e69Sec158148 #define	MMC_FTR_DFCT_MNGMNT	0x0024	/* Hardware Defect Management Feature */
68c9be8e69Sec158148 #define	MMC_FTR_RT_STREAM	0x0107	/* Real Time Streaming Feature */
69c9be8e69Sec158148 
707c478bd9Sstevel@tonic-gate int test_unit_ready(int fd);
717c478bd9Sstevel@tonic-gate int inquiry(int fd, uchar_t *inq);
727c478bd9Sstevel@tonic-gate int read_capacity(int fd, uchar_t *capbuf);
737c478bd9Sstevel@tonic-gate int read_track_info(int fd, int trackno, uchar_t *ti);
747c478bd9Sstevel@tonic-gate int mode_sense(int fd, uchar_t pc, int dbd, int page_len, uchar_t *buffer);
757c478bd9Sstevel@tonic-gate int mode_select(int fd, int page_len, uchar_t *buffer);
767c478bd9Sstevel@tonic-gate int read_toc(int fd, int format, int trackno, int buflen, uchar_t *buf);
777c478bd9Sstevel@tonic-gate int read_disc_info(int fd, uchar_t *di);
787c478bd9Sstevel@tonic-gate int get_configuration(int fd, uint16_t feature, int bufsize, uchar_t *buf);
797c478bd9Sstevel@tonic-gate int read10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
807c478bd9Sstevel@tonic-gate     uint32_t bufsize);
817c478bd9Sstevel@tonic-gate int write10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
827c478bd9Sstevel@tonic-gate     uint32_t bufsize);
837c478bd9Sstevel@tonic-gate int close_track(int fd, int trackno, int close_session, int immediate);
847c478bd9Sstevel@tonic-gate int blank_disc(int fd, int type, int immediate);
857c478bd9Sstevel@tonic-gate int read_cd(int fd, uint32_t start_blk, uint16_t nblk, uchar_t sector_type,
867c478bd9Sstevel@tonic-gate     uchar_t *buf, uint32_t bufsize);
877c478bd9Sstevel@tonic-gate int load_unload(int fd, int load);
887c478bd9Sstevel@tonic-gate int prevent_allow_mr(int fd, int op);
897c478bd9Sstevel@tonic-gate int read_header(int fd, uint32_t lba, uchar_t *buf);
907c478bd9Sstevel@tonic-gate int set_cd_speed(int fd, uint16_t read_speed, uint16_t write_speed);
917c478bd9Sstevel@tonic-gate int get_performance(int fd, int get_write_performance, uchar_t *perf);
927c478bd9Sstevel@tonic-gate int set_streaming(int fd, uchar_t *buf);
937c478bd9Sstevel@tonic-gate int rezero_unit(int fd);
947c478bd9Sstevel@tonic-gate int start_stop(int fd, int start);
957c478bd9Sstevel@tonic-gate int flush_cache(int fd);
967c478bd9Sstevel@tonic-gate int set_reservation(int fd, ulong_t size);
977c478bd9Sstevel@tonic-gate int format_media(int fd);
987c478bd9Sstevel@tonic-gate uint32_t read_format_capacity(int fd, uint_t *bsize);
99*b36bd5c0Szk194757 void reset_dev(int fd);
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate int uscsi_error;		/* used for debugging failed uscsi */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #define	REZERO_UNIT_CMD 	0x01
1047c478bd9Sstevel@tonic-gate #define	FORMAT_UNIT_CMD		0x04
1057c478bd9Sstevel@tonic-gate #define	INQUIRY_CMD		0x12
1067c478bd9Sstevel@tonic-gate #define	MODE_SELECT_6_CMD	0x15
1077c478bd9Sstevel@tonic-gate #define	MODE_SENSE_6_CMD	0x1A
1087c478bd9Sstevel@tonic-gate #define	START_STOP_CMD		0x1B
1097c478bd9Sstevel@tonic-gate #define	PREVENT_ALLOW_CMD	0x1E
1107c478bd9Sstevel@tonic-gate #define	READ_FORMAT_CAP_CMD	0x23
1117c478bd9Sstevel@tonic-gate #define	READ_CAP_CMD		0x25
1127c478bd9Sstevel@tonic-gate #define	READ_10_CMD		0x28
1137c478bd9Sstevel@tonic-gate #define	WRITE_10_CMD		0x2A
1147c478bd9Sstevel@tonic-gate #define	SYNC_CACHE_CMD		0x35
1157c478bd9Sstevel@tonic-gate #define	READ_TOC_CMD		0x43
1167c478bd9Sstevel@tonic-gate #define	MODE_SELECT_10_CMD	0x55
1177c478bd9Sstevel@tonic-gate #define	MODE_SENSE_10_CMD	0x5A
1187c478bd9Sstevel@tonic-gate #define	READ_HDR_CMD		0x44
1197c478bd9Sstevel@tonic-gate #define	GET_CONFIG_CMD		0x46
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #define	READ_INFO_CMD		0x51
1227c478bd9Sstevel@tonic-gate #define	READ_TRACK_CMD		0x52
1237c478bd9Sstevel@tonic-gate #define	SET_RESERVATION_CMD	0x53
1247c478bd9Sstevel@tonic-gate #define	CLOSE_TRACK_CMD		0x5B
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #define	BLANK_CMD		0xA1
1277c478bd9Sstevel@tonic-gate #define	GET_PERFORMANCE_CMD	0xAC
1287c478bd9Sstevel@tonic-gate #define	READ_DVD_STRUCTURE	0xAD
1297c478bd9Sstevel@tonic-gate #define	READ_CD_CMD		0xBE
1307c478bd9Sstevel@tonic-gate #define	SET_CD_SPEED		0xBB
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate #define	STREAM_CMD		0xB6
1337c478bd9Sstevel@tonic-gate #define	READ_AUDIO_CMD		0xD8
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1367c478bd9Sstevel@tonic-gate }
1377c478bd9Sstevel@tonic-gate #endif
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #endif /* _MMC_H */
140