xref: /titanic_51/usr/src/uts/common/sys/mtio.h (revision d25b227d625c14c6f10a2d2d769b1e004d525b4d)
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*d25b227dSzl149053  * Common Development and Distribution License (the "License").
6*d25b227dSzl149053  * 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 /*
22*d25b227dSzl149053  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  *	Copyright (c) 1983-1989 by AT&T.
267c478bd9Sstevel@tonic-gate  *	All rights reserved.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
317c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef	_SYS_MTIO_H
357c478bd9Sstevel@tonic-gate #define	_SYS_MTIO_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Structures and definitions for mag tape io control commands
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * structure for MTIOCTOP - mag tape op command
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate struct mtop	{
537c478bd9Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
547c478bd9Sstevel@tonic-gate 	daddr_t		mt_count;	/* how many of them */
557c478bd9Sstevel@tonic-gate };
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
587c478bd9Sstevel@tonic-gate struct mtop32	{
597c478bd9Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
607c478bd9Sstevel@tonic-gate 	daddr32_t	mt_count;	/* how many of them */
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * values for mt_op
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate #define	MTWEOF		0	/* write an end-of-file record */
697c478bd9Sstevel@tonic-gate #define	MTFSF		1	/* forward space over file mark */
707c478bd9Sstevel@tonic-gate #define	MTBSF		2	/* backward space over file mark (1/2" only ) */
717c478bd9Sstevel@tonic-gate #define	MTFSR		3	/* forward space to inter-record gap */
727c478bd9Sstevel@tonic-gate #define	MTBSR		4	/* backward space to inter-record gap */
737c478bd9Sstevel@tonic-gate #define	MTREW		5	/* rewind */
747c478bd9Sstevel@tonic-gate #define	MTOFFL		6	/* rewind and put the drive offline */
757c478bd9Sstevel@tonic-gate #define	MTNOP		7	/* no operation, sets status only */
767c478bd9Sstevel@tonic-gate #define	MTRETEN		8	/* retension the tape (cartridge tape only) */
777c478bd9Sstevel@tonic-gate #define	MTERASE		9	/* erase the entire tape */
787c478bd9Sstevel@tonic-gate #define	MTEOM		10	/* position to end of media */
797c478bd9Sstevel@tonic-gate #define	MTNBSF		11	/* backward space file to BOF */
807c478bd9Sstevel@tonic-gate #define	MTSRSZ		12	/* set record size */
817c478bd9Sstevel@tonic-gate #define	MTGRSZ		13	/* get record size */
827c478bd9Sstevel@tonic-gate #define	MTLOAD		14	/* for loading a tape (use o_delay to open */
837c478bd9Sstevel@tonic-gate 				/* the tape device) */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * structure for MTIOCGET - mag tape get status command
877c478bd9Sstevel@tonic-gate  */
887c478bd9Sstevel@tonic-gate struct mtget	{
897c478bd9Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
907c478bd9Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
917c478bd9Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
927c478bd9Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
937c478bd9Sstevel@tonic-gate 	/* optional error info. */
947c478bd9Sstevel@tonic-gate 	daddr_t		mt_resid;	/* residual count */
957c478bd9Sstevel@tonic-gate 	daddr_t		mt_fileno;	/* file number of current position */
967c478bd9Sstevel@tonic-gate 	daddr_t		mt_blkno;	/* block number of current position */
977c478bd9Sstevel@tonic-gate 	ushort_t	mt_flags;
987c478bd9Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
997c478bd9Sstevel@tonic-gate };
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1027c478bd9Sstevel@tonic-gate struct mtget32	{
1037c478bd9Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
1047c478bd9Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
1057c478bd9Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
1067c478bd9Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
1077c478bd9Sstevel@tonic-gate 	/* optional error info. */
1087c478bd9Sstevel@tonic-gate 	daddr32_t	mt_resid;	/* residual count */
1097c478bd9Sstevel@tonic-gate 	daddr32_t	mt_fileno;	/* file number of current position */
1107c478bd9Sstevel@tonic-gate 	daddr32_t	mt_blkno;	/* block number of current position */
1117c478bd9Sstevel@tonic-gate 	ushort_t	mt_flags;
1127c478bd9Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
1137c478bd9Sstevel@tonic-gate };
1147c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #define	MT_NDENSITIES	4
1177c478bd9Sstevel@tonic-gate #define	MT_NSPEEDS	4
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * struct for MTIOCGETDRIVETYPE - get tape config data
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate struct mtdrivetype {
1237c478bd9Sstevel@tonic-gate 	char    name[64];		/* Name, for debug */
1247c478bd9Sstevel@tonic-gate 	char    vid[25];		/* Vendor id and model (product) id */
1257c478bd9Sstevel@tonic-gate 	char    type;			/* Drive type for driver */
1267c478bd9Sstevel@tonic-gate 	int	bsize;			/* Block size */
1277c478bd9Sstevel@tonic-gate 	int	options;		/* Drive options */
1287c478bd9Sstevel@tonic-gate 	int	max_rretries;		/* Max read retries */
1297c478bd9Sstevel@tonic-gate 	int	max_wretries;		/* Max write retries */
1307c478bd9Sstevel@tonic-gate 	uchar_t densities[MT_NDENSITIES];	/* density codes, low->hi */
1317c478bd9Sstevel@tonic-gate 	uchar_t	default_density;	/* Default density chosen */
1327c478bd9Sstevel@tonic-gate 	uchar_t speeds[MT_NSPEEDS];	/* speed codes, low->hi */
1337c478bd9Sstevel@tonic-gate 	ushort_t non_motion_timeout;    /* Inquiry type commands */
1347c478bd9Sstevel@tonic-gate 	ushort_t io_timeout;		/* io timeout. seconds */
1357c478bd9Sstevel@tonic-gate 	ushort_t rewind_timeout;	/* rewind timeout. seconds */
1367c478bd9Sstevel@tonic-gate 	ushort_t space_timeout;		/* space cmd timeout. seconds */
1377c478bd9Sstevel@tonic-gate 	ushort_t load_timeout;		/* load tape time in seconds */
1387c478bd9Sstevel@tonic-gate 	ushort_t unload_timeout;	/* Unload tape time in scounds */
1397c478bd9Sstevel@tonic-gate 	ushort_t erase_timeout;		/* erase timeout. seconds */
1407c478bd9Sstevel@tonic-gate };
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate struct mtdrivetype_request {
1447c478bd9Sstevel@tonic-gate 	int	size;
1457c478bd9Sstevel@tonic-gate 	struct  mtdrivetype *mtdtp;
1467c478bd9Sstevel@tonic-gate };
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1497c478bd9Sstevel@tonic-gate struct mtdrivetype_request32 {
1507c478bd9Sstevel@tonic-gate 	int		size;
1517c478bd9Sstevel@tonic-gate 	caddr32_t	mtdtp;
1527c478bd9Sstevel@tonic-gate };
1537c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * values for mt_flags
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate #define	MTF_SCSI	0x01
1607c478bd9Sstevel@tonic-gate #define	MTF_REEL	0x02
1617c478bd9Sstevel@tonic-gate #define	MTF_ASF		0x04
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate #define	MTF_TAPE_HEAD_DIRTY	0x08
1647c478bd9Sstevel@tonic-gate #define	MTF_TAPE_CLN_SUPPORTED	0x10
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate /*
1677c478bd9Sstevel@tonic-gate  * Constants for mt_type byte (these are somewhat obsolete)
1687c478bd9Sstevel@tonic-gate  */
1697c478bd9Sstevel@tonic-gate #define	MT_ISTS		0x01		/* vax: unibus ts-11 */
1707c478bd9Sstevel@tonic-gate #define	MT_ISHT		0x02		/* vax: massbus tu77, etc */
1717c478bd9Sstevel@tonic-gate #define	MT_ISTM		0x03		/* vax: unibus tm-11 */
1727c478bd9Sstevel@tonic-gate #define	MT_ISMT		0x04		/* vax: massbus tu78 */
1737c478bd9Sstevel@tonic-gate #define	MT_ISUT		0x05		/* vax: unibus gcr */
1747c478bd9Sstevel@tonic-gate #define	MT_ISCPC	0x06		/* sun: multibus cpc */
1757c478bd9Sstevel@tonic-gate #define	MT_ISAR		0x07		/* sun: multibus archive */
1767c478bd9Sstevel@tonic-gate #define	MT_ISSC		0x08		/* sun: SCSI archive */
1777c478bd9Sstevel@tonic-gate #define	MT_ISSYSGEN11	0x10		/* sun: SCSI Sysgen, QIC-11 only */
1787c478bd9Sstevel@tonic-gate #define	MT_ISSYSGEN	0x11		/* sun: SCSI Sysgen QIC-24/11 */
1797c478bd9Sstevel@tonic-gate #define	MT_ISDEFAULT	0x12		/* sun: SCSI default CCS */
1807c478bd9Sstevel@tonic-gate #define	MT_ISCCS3	0x13		/* sun: SCSI generic (unknown) CCS */
1817c478bd9Sstevel@tonic-gate #define	MT_ISMT02	0x14		/* sun: SCSI Emulex MT02 */
1827c478bd9Sstevel@tonic-gate #define	MT_ISVIPER1	0x15		/* sun: SCSI Archive QIC-150 Viper */
1837c478bd9Sstevel@tonic-gate #define	MT_ISWANGTEK1	0x16		/* sun: SCSI Wangtek QIC-150 */
1847c478bd9Sstevel@tonic-gate #define	MT_ISCCS7	0x17		/* sun: SCSI generic (unknown) CCS */
1857c478bd9Sstevel@tonic-gate #define	MT_ISCCS8	0x18		/* sun: SCSI generic (unknown) CCS */
1867c478bd9Sstevel@tonic-gate #define	MT_ISCCS9	0x19		/* sun: SCSI generic (unknown) CCS */
1877c478bd9Sstevel@tonic-gate #define	MT_ISCCS11	0x1a		/* sun: SCSI generic (unknown) CCS */
1887c478bd9Sstevel@tonic-gate #define	MT_ISCCS12	0x1b		/* sun: SCSI generic (unknown) CCS */
1897c478bd9Sstevel@tonic-gate #define	MT_ISCCS13	0x1c		/* sun: SCSI generic (unknown) CCS */
1907c478bd9Sstevel@tonic-gate #define	MT_ISCCS14	0x1d		/* sun: SCSI generic (unknown) CCS */
1917c478bd9Sstevel@tonic-gate #define	MT_ISCCS15	0x1e		/* sun: SCSI generic (unknown) CCS */
1927c478bd9Sstevel@tonic-gate #define	MT_ISCCS16	0x1f		/* sun: SCSI generic (unknown) CCS */
1937c478bd9Sstevel@tonic-gate #define	MT_ISCDC	0x20		/* sun: SCSI CDC 1/2" cartridge */
1947c478bd9Sstevel@tonic-gate #define	MT_ISFUJI	0x21		/* sun: SCSI Fujitsu 1/2" cartridge */
1957c478bd9Sstevel@tonic-gate #define	MT_ISKENNEDY	0x22		/* sun: SCSI Kennedy 1/2" reel */
1967c478bd9Sstevel@tonic-gate #define	MT_ISHP		0x23		/* sun: SCSI HP 1/2" reel */
1977c478bd9Sstevel@tonic-gate #define	MT_ISSTC	0x24		/* sun: SCSI IBM STC 3490 */
1987c478bd9Sstevel@tonic-gate #define	MT_ISANRITSU	0x25		/* nihon sun: Anritsu 1/2" reel */
1997c478bd9Sstevel@tonic-gate #define	MT_ISCCS23	0x26		/* sun: SCSI generic  1/2" */
2007c478bd9Sstevel@tonic-gate #define	MT_ISCCS24	0x27		/* sun: SCSI generic  1/2" */
2017c478bd9Sstevel@tonic-gate #define	MT_ISEXABYTE	0x28		/* sun: SCSI Exabyte 8mm cartridge */
2027c478bd9Sstevel@tonic-gate #define	MT_ISEXB8500	0x29		/* sun: SCSI Exabyte 8500 8mm cart */
2037c478bd9Sstevel@tonic-gate #define	MT_ISWANGTHS	0x2a		/* sun: SCSI Wangtek 6130HS RDAT */
2047c478bd9Sstevel@tonic-gate #define	MT_ISWANGDAT	0x2b		/* sun: SCSI WangDAT */
2057c478bd9Sstevel@tonic-gate #define	MT_ISPYTHON	0x2c		/* sun: SCSI Archive Python DAT  */
2067c478bd9Sstevel@tonic-gate #define	MT_ISCCS28	0x2d		/* sun: SCSI generic DAT CCS */
2077c478bd9Sstevel@tonic-gate #define	MT_ISCCS29	0x2e		/* sun: SCSI generic (unknown) CCS */
2087c478bd9Sstevel@tonic-gate #define	MT_ISCCS30	0x2f		/* sun: SCSI generic (unknown) CCS */
2097c478bd9Sstevel@tonic-gate #define	MT_ISCCS31	0x30		/* sun: SCSI generic (unknown) CCS */
2107c478bd9Sstevel@tonic-gate #define	MT_ISCCS32	0x31		/* sun: SCSI generic (unknown) CCS */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate /*
2147c478bd9Sstevel@tonic-gate  * these are recommended
2157c478bd9Sstevel@tonic-gate  */
2167c478bd9Sstevel@tonic-gate #define	MT_ISQIC	0x32		/* generic QIC tape drive */
2177c478bd9Sstevel@tonic-gate #define	MT_ISREEL	0x33		/* generic reel tape drive */
2187c478bd9Sstevel@tonic-gate #define	MT_ISDAT	0x34		/* generic DAT tape drive */
2197c478bd9Sstevel@tonic-gate #define	MT_IS8MM	0x35		/* generic 8mm tape drive */
2207c478bd9Sstevel@tonic-gate #define	MT_ISOTHER	0x36		/* generic other type of tape drive */
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate /* more Sun devices */
2237c478bd9Sstevel@tonic-gate #define	MT_ISTAND25G	0x37		/* sun: SCSI Tandberg 2.5 Gig QIC */
2247c478bd9Sstevel@tonic-gate #define	MT_ISDLT	0x38		/* sun: SCSI DLT tape drive */
2257c478bd9Sstevel@tonic-gate #define	MT_ISSTK9840	0x39		/* sun: STK 9840, 9940, 9840B */
2267c478bd9Sstevel@tonic-gate #define	MT_ISBMDLT1	0x3a		/* sun: Benchmark DLT1 */
2277c478bd9Sstevel@tonic-gate #define	MT_LTO		0x3b		/* sun: LTO,s by Hp, Seagate, IBM .. */
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate /*
2307c478bd9Sstevel@tonic-gate  * Device table structure and data for looking tape name from
2317c478bd9Sstevel@tonic-gate  * tape id number.  Used by mt.c.
2327c478bd9Sstevel@tonic-gate  */
2337c478bd9Sstevel@tonic-gate struct mt_tape_info {
2347c478bd9Sstevel@tonic-gate 	short	t_type;		/* type of magtape device */
2357c478bd9Sstevel@tonic-gate 	char	*t_name;	/* printing name */
2367c478bd9Sstevel@tonic-gate 	char	*t_dsbits;	/* "drive status" register */
2377c478bd9Sstevel@tonic-gate 	char	*t_erbits;	/* "error" register */
2387c478bd9Sstevel@tonic-gate };
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * this table is now obsolete, use MTIOCGETDRIVETYPE ioctl
2427c478bd9Sstevel@tonic-gate  *
2437c478bd9Sstevel@tonic-gate  * WARNING: this table will be eliminated in some future release
2447c478bd9Sstevel@tonic-gate  */
2457c478bd9Sstevel@tonic-gate #define	MT_TAPE_INFO  {\
2467c478bd9Sstevel@tonic-gate { MT_ISSYSGEN11,	"Sysgen QIC-11",		0, 0 }, \
2477c478bd9Sstevel@tonic-gate { MT_ISSYSGEN,		"Sysgen QIC-24",		0, 0 }, \
2487c478bd9Sstevel@tonic-gate { MT_ISMT02,		"Emulex MT-02 QIC-24",		0, 0 }, \
2497c478bd9Sstevel@tonic-gate { MT_ISVIPER1,		"Archive QIC-150",		0, 0 }, \
2507c478bd9Sstevel@tonic-gate { MT_ISWANGTEK1,	"Wangtek QIC-150",		0, 0 }, \
2517c478bd9Sstevel@tonic-gate { MT_ISKENNEDY,		"Kennedy 9612 1/2-inch",	0, 0 }, \
2527c478bd9Sstevel@tonic-gate { MT_ISANRITSU,		"Anritsu 1/2-inch",		0, 0 }, \
2537c478bd9Sstevel@tonic-gate { MT_ISHP,		"HP 88780 1/2-inch",		0, 0 }, \
2547c478bd9Sstevel@tonic-gate { MT_ISEXABYTE,		"Exabyte EXB-8200 8mm",		0, 0 }, \
2557c478bd9Sstevel@tonic-gate { MT_ISEXB8500,		"Exabyte EXB-8500 8mm",		0, 0 }, \
2567c478bd9Sstevel@tonic-gate { MT_ISWANGDAT,		"WangDAT 3.81mm",		0, 0 }, \
2577c478bd9Sstevel@tonic-gate { MT_ISWANGTHS,		"Wangtek 4mm RDAT",		0, 0 }, \
2587c478bd9Sstevel@tonic-gate { MT_ISPYTHON,		"Archive Python 4mm Helical Scan",	0, 0 }, \
2597c478bd9Sstevel@tonic-gate { MT_ISSTC,		"STC 1/2\" Cartridge",		0, 0}, \
2607c478bd9Sstevel@tonic-gate { MT_ISTAND25G,		"Tandberg 2.5 Gig QIC",		0, 0}, \
2617c478bd9Sstevel@tonic-gate { MT_ISQIC,		"QIC",		0, 0}, \
2627c478bd9Sstevel@tonic-gate { MT_ISREEL,		"REEL",		0, 0}, \
2637c478bd9Sstevel@tonic-gate { MT_ISDAT,		"DAT",		0, 0}, \
2647c478bd9Sstevel@tonic-gate { MT_IS8MM,		"8mm",		0, 0}, \
2657c478bd9Sstevel@tonic-gate { MT_ISOTHER,		"Other",	0, 0}, \
2667c478bd9Sstevel@tonic-gate { 0 } \
2677c478bd9Sstevel@tonic-gate }
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /* mag tape io control commands */
2707c478bd9Sstevel@tonic-gate #define	MTIOC			('m'<<8)
2717c478bd9Sstevel@tonic-gate #define	MTIOCTOP		(MTIOC|1)	/* do a mag tape op */
2727c478bd9Sstevel@tonic-gate #define	MTIOCGET		(MTIOC|2)	/* get tape status */
2737c478bd9Sstevel@tonic-gate #define	MTIOCGETDRIVETYPE	(MTIOC|3)	/* get tape config data */
2747c478bd9Sstevel@tonic-gate #define	MTIOCPERSISTENT		(MTIOC|4)	/* turn on persistent errors */
2757c478bd9Sstevel@tonic-gate #define	MTIOCPERSISTENTSTATUS	(MTIOC|5)	/* query persis. err status */
2767c478bd9Sstevel@tonic-gate #define	MTIOCLRERR		(MTIOC|6)	/* clear a persitent error */
2777c478bd9Sstevel@tonic-gate #define	MTIOCGUARANTEEDORDER	(MTIOC|7)	/* check for guaranteed order */
2787c478bd9Sstevel@tonic-gate #define	MTIOCRESERVE		(MTIOC|8)	/* preserve reserve */
2797c478bd9Sstevel@tonic-gate #define	MTIOCRELEASE		(MTIOC|9)	/* turnoff preserve reserve */
2807c478bd9Sstevel@tonic-gate #define	MTIOCFORCERESERVE	(MTIOC|10)	/* break reservation drive */
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate #define	MTIOCSTATE		(MTIOC|13)	/* Inquire insert/eject state */
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate #define	MTIOCREADIGNOREILI  	(MTIOC|14)	/* Enable/Disable ILI */
2857c478bd9Sstevel@tonic-gate #define	MTIOCREADIGNOREEOFS 	(MTIOC|15)	/* Enable/Disable Ignore EOF */
2867c478bd9Sstevel@tonic-gate #define	MTIOCSHORTFMK		(MTIOC|16)	/* Enable/Disable Short FMK */
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate /*
2897c478bd9Sstevel@tonic-gate  * This state enum is the argument passed to the MTIOCSTATE ioctl.
2907c478bd9Sstevel@tonic-gate  */
2917c478bd9Sstevel@tonic-gate enum mtio_state { MTIO_NONE, MTIO_EJECTED, MTIO_INSERTED };
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate #ifndef KERNEL
2947c478bd9Sstevel@tonic-gate /*
2957c478bd9Sstevel@tonic-gate  * don't use DEFTAPE.
2967c478bd9Sstevel@tonic-gate  */
2977c478bd9Sstevel@tonic-gate #define	DEFTAPE	"/dev/rmt/0"
2987c478bd9Sstevel@tonic-gate #endif
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate /*
3017c478bd9Sstevel@tonic-gate  * Layout of minor device byte
3027c478bd9Sstevel@tonic-gate  * 15 - 8    7    6    5    4    3    2    1    0
3037c478bd9Sstevel@tonic-gate  * --------------------------------------------
3047c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |    |    |    |----| Unit #. lower 2 bits
3057c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |    |    |---------- No rewind on close bit....
3067c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |----|--------------- Density Select
3077c478bd9Sstevel@tonic-gate  * |    |    |    |    |------------------------- Resrvd.(add. campus dens. bit)
3087c478bd9Sstevel@tonic-gate  * |    |    |    |------------------------------ BSD behavior
3097c478bd9Sstevel@tonic-gate  * |----|----|----------------------------------- Unit #  bit 2-6
3107c478bd9Sstevel@tonic-gate  */
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate #define	MTUNIT(dev)	(((getminor(dev) & 0xff80) >> 5) + \
3137c478bd9Sstevel@tonic-gate 			    (getminor(dev) & 0x3))
3147c478bd9Sstevel@tonic-gate #define	MT_NOREWIND	(1 <<2)
3157c478bd9Sstevel@tonic-gate #define	MT_DENSITY_MASK	(3 <<3)
3167c478bd9Sstevel@tonic-gate #define	MT_DENSITY1	(0 <<3)		/* Lowest density/format */
3177c478bd9Sstevel@tonic-gate #define	MT_DENSITY2	(1 <<3)
3187c478bd9Sstevel@tonic-gate #define	MT_DENSITY3	(2 <<3)
3197c478bd9Sstevel@tonic-gate #define	MT_DENSITY4	(3 <<3)		/* Highest density/format */
320*d25b227dSzl149053 #define	MTMINOR(unit)	((((unit) & 0x7fc) << 5) + ((unit) & 0x3))
3217c478bd9Sstevel@tonic-gate #define	MT_BSD		(1 <<6)		/* BSD behavior on close */
3227c478bd9Sstevel@tonic-gate #define	MT_DENSITY(dev) ((getminor(dev) & MT_DENSITY_MASK) >> 3)
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3267c478bd9Sstevel@tonic-gate }
3277c478bd9Sstevel@tonic-gate #endif
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate #endif /* _SYS_MTIO_H */
330