xref: /illumos-gate/usr/src/uts/common/sys/mtio.h (revision 2d6eb4a5)
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
5d25b227dSzl149053  * Common Development and Distribution License (the "License").
6d25b227dSzl149053  * 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*602b746eSyl194034  * Copyright 2008 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 #include <sys/types.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Structures and definitions for mag tape io control commands
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * structure for MTIOCTOP - mag tape op command
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate struct mtop	{
517c478bd9Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
527c478bd9Sstevel@tonic-gate 	daddr_t		mt_count;	/* how many of them */
537c478bd9Sstevel@tonic-gate };
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
567c478bd9Sstevel@tonic-gate struct mtop32	{
577c478bd9Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
587c478bd9Sstevel@tonic-gate 	daddr32_t	mt_count;	/* how many of them */
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
617c478bd9Sstevel@tonic-gate 
62c6914c10Srralphs /*
63c6914c10Srralphs  * structure for MTIOCLTOP - mag tape op command
64c6914c10Srralphs  */
65c6914c10Srralphs struct mtlop	{
66c6914c10Srralphs 	short		mt_op;
67c6914c10Srralphs 	short		pad[3];
68c6914c10Srralphs 	int64_t		mt_count;
69c6914c10Srralphs };
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * values for mt_op
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate #define	MTWEOF		0	/* write an end-of-file record */
757c478bd9Sstevel@tonic-gate #define	MTFSF		1	/* forward space over file mark */
767c478bd9Sstevel@tonic-gate #define	MTBSF		2	/* backward space over file mark (1/2" only ) */
777c478bd9Sstevel@tonic-gate #define	MTFSR		3	/* forward space to inter-record gap */
787c478bd9Sstevel@tonic-gate #define	MTBSR		4	/* backward space to inter-record gap */
797c478bd9Sstevel@tonic-gate #define	MTREW		5	/* rewind */
807c478bd9Sstevel@tonic-gate #define	MTOFFL		6	/* rewind and put the drive offline */
817c478bd9Sstevel@tonic-gate #define	MTNOP		7	/* no operation, sets status only */
827c478bd9Sstevel@tonic-gate #define	MTRETEN		8	/* retension the tape (cartridge tape only) */
837c478bd9Sstevel@tonic-gate #define	MTERASE		9	/* erase the entire tape */
847c478bd9Sstevel@tonic-gate #define	MTEOM		10	/* position to end of media */
857c478bd9Sstevel@tonic-gate #define	MTNBSF		11	/* backward space file to BOF */
867c478bd9Sstevel@tonic-gate #define	MTSRSZ		12	/* set record size */
877c478bd9Sstevel@tonic-gate #define	MTGRSZ		13	/* get record size */
887c478bd9Sstevel@tonic-gate #define	MTLOAD		14	/* for loading a tape (use o_delay to open */
897c478bd9Sstevel@tonic-gate 				/* the tape device) */
90c6914c10Srralphs #define	MTBSSF		15	/* Backward space to x sequential filemarks */
91c6914c10Srralphs #define	MTFSSF		16	/* Forward space to x sequential filemarks */
92c6914c10Srralphs #define	MTTELL		17	/* get current logical block position */
93c6914c10Srralphs #define	MTSEEK		18	/* position to logical block position */
94c6914c10Srralphs #define	MTLOCK		19	/* lock media */
95c6914c10Srralphs #define	MTUNLOCK	20	/* unlock media */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  * structure for MTIOCGET - mag tape get status command
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate struct mtget	{
1017c478bd9Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
1027c478bd9Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
1037c478bd9Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
1047c478bd9Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
1057c478bd9Sstevel@tonic-gate 	/* optional error info. */
1067c478bd9Sstevel@tonic-gate 	daddr_t		mt_resid;	/* residual count */
1077c478bd9Sstevel@tonic-gate 	daddr_t		mt_fileno;	/* file number of current position */
1087c478bd9Sstevel@tonic-gate 	daddr_t		mt_blkno;	/* block number of current position */
1097c478bd9Sstevel@tonic-gate 	ushort_t	mt_flags;
1107c478bd9Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
1117c478bd9Sstevel@tonic-gate };
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1147c478bd9Sstevel@tonic-gate struct mtget32	{
1157c478bd9Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
1167c478bd9Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
1177c478bd9Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
1187c478bd9Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
1197c478bd9Sstevel@tonic-gate 	/* optional error info. */
1207c478bd9Sstevel@tonic-gate 	daddr32_t	mt_resid;	/* residual count */
1217c478bd9Sstevel@tonic-gate 	daddr32_t	mt_fileno;	/* file number of current position */
1227c478bd9Sstevel@tonic-gate 	daddr32_t	mt_blkno;	/* block number of current position */
1237c478bd9Sstevel@tonic-gate 	ushort_t	mt_flags;
1247c478bd9Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
1257c478bd9Sstevel@tonic-gate };
1267c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	MT_NDENSITIES	4
1297c478bd9Sstevel@tonic-gate #define	MT_NSPEEDS	4
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /*
1327c478bd9Sstevel@tonic-gate  * struct for MTIOCGETDRIVETYPE - get tape config data
1337c478bd9Sstevel@tonic-gate  */
1347c478bd9Sstevel@tonic-gate struct mtdrivetype {
1357c478bd9Sstevel@tonic-gate 	char    name[64];		/* Name, for debug */
1367c478bd9Sstevel@tonic-gate 	char    vid[25];		/* Vendor id and model (product) id */
1377c478bd9Sstevel@tonic-gate 	char    type;			/* Drive type for driver */
1387c478bd9Sstevel@tonic-gate 	int	bsize;			/* Block size */
1397c478bd9Sstevel@tonic-gate 	int	options;		/* Drive options */
1407c478bd9Sstevel@tonic-gate 	int	max_rretries;		/* Max read retries */
1417c478bd9Sstevel@tonic-gate 	int	max_wretries;		/* Max write retries */
1427c478bd9Sstevel@tonic-gate 	uchar_t densities[MT_NDENSITIES];	/* density codes, low->hi */
1437c478bd9Sstevel@tonic-gate 	uchar_t	default_density;	/* Default density chosen */
1447c478bd9Sstevel@tonic-gate 	uchar_t speeds[MT_NSPEEDS];	/* speed codes, low->hi */
1457c478bd9Sstevel@tonic-gate 	ushort_t non_motion_timeout;    /* Inquiry type commands */
1467c478bd9Sstevel@tonic-gate 	ushort_t io_timeout;		/* io timeout. seconds */
1477c478bd9Sstevel@tonic-gate 	ushort_t rewind_timeout;	/* rewind timeout. seconds */
1487c478bd9Sstevel@tonic-gate 	ushort_t space_timeout;		/* space cmd timeout. seconds */
1497c478bd9Sstevel@tonic-gate 	ushort_t load_timeout;		/* load tape time in seconds */
1507c478bd9Sstevel@tonic-gate 	ushort_t unload_timeout;	/* Unload tape time in scounds */
1517c478bd9Sstevel@tonic-gate 	ushort_t erase_timeout;		/* erase timeout. seconds */
1527c478bd9Sstevel@tonic-gate };
1537c478bd9Sstevel@tonic-gate 
154fa4c0ec8Sbz211116 /*
155fa4c0ec8Sbz211116  * struct for MTIOCGETERROR - get recent error entry command
156fa4c0ec8Sbz211116  */
157fa4c0ec8Sbz211116 struct mterror_entry {
158fa4c0ec8Sbz211116 	size_t mtee_cdb_len;			/* CDB length */
159fa4c0ec8Sbz211116 	uchar_t *mtee_cdb_buf;			/* CDB sent to the device */
160fa4c0ec8Sbz211116 	size_t mtee_arq_status_len;		/* length of scsi arq status */
161fa4c0ec8Sbz211116 	struct scsi_arq_status *mtee_arq_status;
162fa4c0ec8Sbz211116 						/* scsi arq status buffer */
163fa4c0ec8Sbz211116 };
164fa4c0ec8Sbz211116 
165fa4c0ec8Sbz211116 #define	MTERROR_ENTRY_SIZE_64 (sizeof (struct mterror_entry))
166fa4c0ec8Sbz211116 
167fa4c0ec8Sbz211116 #if defined(_SYSCALL32)
168fa4c0ec8Sbz211116 struct mterror_entry32 {
169fa4c0ec8Sbz211116 	size32_t mtee_cdb_len;			/* CDB length */
170fa4c0ec8Sbz211116 	caddr32_t mtee_cdb_buf;			/* CDB sent to the device */
171fa4c0ec8Sbz211116 	size32_t mtee_arq_status_len;		/* length of scsi arq status */
172fa4c0ec8Sbz211116 	caddr32_t mtee_arq_status;
173fa4c0ec8Sbz211116 						/* scsi arq status buffer */
174fa4c0ec8Sbz211116 };
175fa4c0ec8Sbz211116 
176fa4c0ec8Sbz211116 #define	MTERROR_ENTRY_SIZE_32 (sizeof (struct mterror_entry32))
177fa4c0ec8Sbz211116 
178fa4c0ec8Sbz211116 #endif /* _SYSCALL32 */
179fa4c0ec8Sbz211116 
180fa4c0ec8Sbz211116 /*
181fa4c0ec8Sbz211116  * error entry stack
182fa4c0ec8Sbz211116  */
183fa4c0ec8Sbz211116 struct mterror_entry_stack {
184fa4c0ec8Sbz211116 	struct mterror_entry mtees_entry;
185fa4c0ec8Sbz211116 	struct mterror_entry_stack *mtees_nextp;
186fa4c0ec8Sbz211116 };
187fa4c0ec8Sbz211116 
188fa4c0ec8Sbz211116 #define	MTERROR_LINK_ENTRY_SIZE (sizeof (struct mterror_entry_stack))
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate struct mtdrivetype_request {
1917c478bd9Sstevel@tonic-gate 	int	size;
1927c478bd9Sstevel@tonic-gate 	struct  mtdrivetype *mtdtp;
1937c478bd9Sstevel@tonic-gate };
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1967c478bd9Sstevel@tonic-gate struct mtdrivetype_request32 {
1977c478bd9Sstevel@tonic-gate 	int		size;
1987c478bd9Sstevel@tonic-gate 	caddr32_t	mtdtp;
1997c478bd9Sstevel@tonic-gate };
2007c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate /*
2047c478bd9Sstevel@tonic-gate  * values for mt_flags
2057c478bd9Sstevel@tonic-gate  */
2067c478bd9Sstevel@tonic-gate #define	MTF_SCSI		0x01
2077c478bd9Sstevel@tonic-gate #define	MTF_REEL		0x02
2087c478bd9Sstevel@tonic-gate #define	MTF_ASF			0x04
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate #define	MTF_TAPE_HEAD_DIRTY	0x08
2117c478bd9Sstevel@tonic-gate #define	MTF_TAPE_CLN_SUPPORTED	0x10
2125988135dSrralphs #define	MTF_WORM_MEDIA		0x20
213c6914c10Srralphs #define	MTF_LOGICAL_BLOCK	0x40
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate /*
2167c478bd9Sstevel@tonic-gate  * Constants for mt_type byte (these are somewhat obsolete)
2177c478bd9Sstevel@tonic-gate  */
2187c478bd9Sstevel@tonic-gate #define	MT_ISTS		0x01		/* vax: unibus ts-11 */
2197c478bd9Sstevel@tonic-gate #define	MT_ISHT		0x02		/* vax: massbus tu77, etc */
2207c478bd9Sstevel@tonic-gate #define	MT_ISTM		0x03		/* vax: unibus tm-11 */
2217c478bd9Sstevel@tonic-gate #define	MT_ISMT		0x04		/* vax: massbus tu78 */
2227c478bd9Sstevel@tonic-gate #define	MT_ISUT		0x05		/* vax: unibus gcr */
2237c478bd9Sstevel@tonic-gate #define	MT_ISCPC	0x06		/* sun: multibus cpc */
2247c478bd9Sstevel@tonic-gate #define	MT_ISAR		0x07		/* sun: multibus archive */
2257c478bd9Sstevel@tonic-gate #define	MT_ISSC		0x08		/* sun: SCSI archive */
2267c478bd9Sstevel@tonic-gate #define	MT_ISSYSGEN11	0x10		/* sun: SCSI Sysgen, QIC-11 only */
2277c478bd9Sstevel@tonic-gate #define	MT_ISSYSGEN	0x11		/* sun: SCSI Sysgen QIC-24/11 */
2287c478bd9Sstevel@tonic-gate #define	MT_ISDEFAULT	0x12		/* sun: SCSI default CCS */
2297c478bd9Sstevel@tonic-gate #define	MT_ISCCS3	0x13		/* sun: SCSI generic (unknown) CCS */
2307c478bd9Sstevel@tonic-gate #define	MT_ISMT02	0x14		/* sun: SCSI Emulex MT02 */
2317c478bd9Sstevel@tonic-gate #define	MT_ISVIPER1	0x15		/* sun: SCSI Archive QIC-150 Viper */
2327c478bd9Sstevel@tonic-gate #define	MT_ISWANGTEK1	0x16		/* sun: SCSI Wangtek QIC-150 */
2337c478bd9Sstevel@tonic-gate #define	MT_ISCCS7	0x17		/* sun: SCSI generic (unknown) CCS */
2347c478bd9Sstevel@tonic-gate #define	MT_ISCCS8	0x18		/* sun: SCSI generic (unknown) CCS */
2357c478bd9Sstevel@tonic-gate #define	MT_ISCCS9	0x19		/* sun: SCSI generic (unknown) CCS */
2367c478bd9Sstevel@tonic-gate #define	MT_ISCCS11	0x1a		/* sun: SCSI generic (unknown) CCS */
2377c478bd9Sstevel@tonic-gate #define	MT_ISCCS12	0x1b		/* sun: SCSI generic (unknown) CCS */
2387c478bd9Sstevel@tonic-gate #define	MT_ISCCS13	0x1c		/* sun: SCSI generic (unknown) CCS */
2397c478bd9Sstevel@tonic-gate #define	MT_ISCCS14	0x1d		/* sun: SCSI generic (unknown) CCS */
2407c478bd9Sstevel@tonic-gate #define	MT_ISCCS15	0x1e		/* sun: SCSI generic (unknown) CCS */
2417c478bd9Sstevel@tonic-gate #define	MT_ISCCS16	0x1f		/* sun: SCSI generic (unknown) CCS */
2427c478bd9Sstevel@tonic-gate #define	MT_ISCDC	0x20		/* sun: SCSI CDC 1/2" cartridge */
2437c478bd9Sstevel@tonic-gate #define	MT_ISFUJI	0x21		/* sun: SCSI Fujitsu 1/2" cartridge */
2447c478bd9Sstevel@tonic-gate #define	MT_ISKENNEDY	0x22		/* sun: SCSI Kennedy 1/2" reel */
2457c478bd9Sstevel@tonic-gate #define	MT_ISHP		0x23		/* sun: SCSI HP 1/2" reel */
2467c478bd9Sstevel@tonic-gate #define	MT_ISSTC	0x24		/* sun: SCSI IBM STC 3490 */
2477c478bd9Sstevel@tonic-gate #define	MT_ISANRITSU	0x25		/* nihon sun: Anritsu 1/2" reel */
2487c478bd9Sstevel@tonic-gate #define	MT_ISCCS23	0x26		/* sun: SCSI generic  1/2" */
2497c478bd9Sstevel@tonic-gate #define	MT_ISCCS24	0x27		/* sun: SCSI generic  1/2" */
2507c478bd9Sstevel@tonic-gate #define	MT_ISEXABYTE	0x28		/* sun: SCSI Exabyte 8mm cartridge */
2517c478bd9Sstevel@tonic-gate #define	MT_ISEXB8500	0x29		/* sun: SCSI Exabyte 8500 8mm cart */
2527c478bd9Sstevel@tonic-gate #define	MT_ISWANGTHS	0x2a		/* sun: SCSI Wangtek 6130HS RDAT */
2537c478bd9Sstevel@tonic-gate #define	MT_ISWANGDAT	0x2b		/* sun: SCSI WangDAT */
2547c478bd9Sstevel@tonic-gate #define	MT_ISPYTHON	0x2c		/* sun: SCSI Archive Python DAT  */
2557c478bd9Sstevel@tonic-gate #define	MT_ISCCS28	0x2d		/* sun: SCSI generic DAT CCS */
2567c478bd9Sstevel@tonic-gate #define	MT_ISCCS29	0x2e		/* sun: SCSI generic (unknown) CCS */
2577c478bd9Sstevel@tonic-gate #define	MT_ISCCS30	0x2f		/* sun: SCSI generic (unknown) CCS */
2587c478bd9Sstevel@tonic-gate #define	MT_ISCCS31	0x30		/* sun: SCSI generic (unknown) CCS */
2597c478bd9Sstevel@tonic-gate #define	MT_ISCCS32	0x31		/* sun: SCSI generic (unknown) CCS */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /*
2637c478bd9Sstevel@tonic-gate  * these are recommended
2647c478bd9Sstevel@tonic-gate  */
2657c478bd9Sstevel@tonic-gate #define	MT_ISQIC	0x32		/* generic QIC tape drive */
2667c478bd9Sstevel@tonic-gate #define	MT_ISREEL	0x33		/* generic reel tape drive */
2677c478bd9Sstevel@tonic-gate #define	MT_ISDAT	0x34		/* generic DAT tape drive */
2687c478bd9Sstevel@tonic-gate #define	MT_IS8MM	0x35		/* generic 8mm tape drive */
2697c478bd9Sstevel@tonic-gate #define	MT_ISOTHER	0x36		/* generic other type of tape drive */
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate /* more Sun devices */
2727c478bd9Sstevel@tonic-gate #define	MT_ISTAND25G	0x37		/* sun: SCSI Tandberg 2.5 Gig QIC */
2737c478bd9Sstevel@tonic-gate #define	MT_ISDLT	0x38		/* sun: SCSI DLT tape drive */
2747c478bd9Sstevel@tonic-gate #define	MT_ISSTK9840	0x39		/* sun: STK 9840, 9940, 9840B */
2757c478bd9Sstevel@tonic-gate #define	MT_ISBMDLT1	0x3a		/* sun: Benchmark DLT1 */
2767c478bd9Sstevel@tonic-gate #define	MT_LTO		0x3b		/* sun: LTO,s by Hp, Seagate, IBM .. */
2775988135dSrralphs #define	MT_ISAIT	0x3c		/* Sony: AIT I II III and SAIT */
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate /*
2807c478bd9Sstevel@tonic-gate  * Device table structure and data for looking tape name from
2817c478bd9Sstevel@tonic-gate  * tape id number.  Used by mt.c.
2827c478bd9Sstevel@tonic-gate  */
2837c478bd9Sstevel@tonic-gate struct mt_tape_info {
2847c478bd9Sstevel@tonic-gate 	short	t_type;		/* type of magtape device */
2857c478bd9Sstevel@tonic-gate 	char	*t_name;	/* printing name */
2867c478bd9Sstevel@tonic-gate 	char	*t_dsbits;	/* "drive status" register */
2877c478bd9Sstevel@tonic-gate 	char	*t_erbits;	/* "error" register */
2887c478bd9Sstevel@tonic-gate };
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate /* mag tape io control commands */
2927c478bd9Sstevel@tonic-gate #define	MTIOC			('m'<<8)
2937c478bd9Sstevel@tonic-gate #define	MTIOCTOP		(MTIOC|1)	/* do a mag tape op */
2947c478bd9Sstevel@tonic-gate #define	MTIOCGET		(MTIOC|2)	/* get tape status */
2957c478bd9Sstevel@tonic-gate #define	MTIOCGETDRIVETYPE	(MTIOC|3)	/* get tape config data */
2967c478bd9Sstevel@tonic-gate #define	MTIOCPERSISTENT		(MTIOC|4)	/* turn on persistent errors */
2977c478bd9Sstevel@tonic-gate #define	MTIOCPERSISTENTSTATUS	(MTIOC|5)	/* query persis. err status */
2987c478bd9Sstevel@tonic-gate #define	MTIOCLRERR		(MTIOC|6)	/* clear a persitent error */
2997c478bd9Sstevel@tonic-gate #define	MTIOCGUARANTEEDORDER	(MTIOC|7)	/* check for guaranteed order */
3007c478bd9Sstevel@tonic-gate #define	MTIOCRESERVE		(MTIOC|8)	/* preserve reserve */
3017c478bd9Sstevel@tonic-gate #define	MTIOCRELEASE		(MTIOC|9)	/* turnoff preserve reserve */
3027c478bd9Sstevel@tonic-gate #define	MTIOCFORCERESERVE	(MTIOC|10)	/* break reservation drive */
303fa4c0ec8Sbz211116 #define	MTIOCGETERROR		(MTIOC|11)	/* Get recently error record */
3047c478bd9Sstevel@tonic-gate #define	MTIOCSTATE		(MTIOC|13)	/* Inquire insert/eject state */
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate #define	MTIOCREADIGNOREILI  	(MTIOC|14)	/* Enable/Disable ILI */
3077c478bd9Sstevel@tonic-gate #define	MTIOCREADIGNOREEOFS 	(MTIOC|15)	/* Enable/Disable Ignore EOF */
3087c478bd9Sstevel@tonic-gate #define	MTIOCSHORTFMK		(MTIOC|16)	/* Enable/Disable Short FMK */
309c6914c10Srralphs #define	MTIOCGETPOS		(MTIOC|17)	/* Get drive position */
310c6914c10Srralphs #define	MTIOCRESTPOS		(MTIOC|18)	/* Go back to position */
311c6914c10Srralphs #define	MTIOCLTOP		(MTIOC|19)	/* do a mag tape op */
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate /*
3147c478bd9Sstevel@tonic-gate  * This state enum is the argument passed to the MTIOCSTATE ioctl.
3157c478bd9Sstevel@tonic-gate  */
3167c478bd9Sstevel@tonic-gate enum mtio_state { MTIO_NONE, MTIO_EJECTED, MTIO_INSERTED };
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate #ifndef KERNEL
3197c478bd9Sstevel@tonic-gate /*
3207c478bd9Sstevel@tonic-gate  * don't use DEFTAPE.
3217c478bd9Sstevel@tonic-gate  */
3227c478bd9Sstevel@tonic-gate #define	DEFTAPE	"/dev/rmt/0"
3237c478bd9Sstevel@tonic-gate #endif
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate /*
3267c478bd9Sstevel@tonic-gate  * Layout of minor device byte
3277c478bd9Sstevel@tonic-gate  * 15 - 8    7    6    5    4    3    2    1    0
3287c478bd9Sstevel@tonic-gate  * --------------------------------------------
3297c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |    |    |    |----| Unit #. lower 2 bits
3307c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |    |    |---------- No rewind on close bit....
3317c478bd9Sstevel@tonic-gate  * |    |    |    |    |    |----|--------------- Density Select
3327c478bd9Sstevel@tonic-gate  * |    |    |    |    |------------------------- Resrvd.(add. campus dens. bit)
3337c478bd9Sstevel@tonic-gate  * |    |    |    |------------------------------ BSD behavior
334*602b746eSyl194034  * |----|----|----------------------------------- Unit #  bit 2-10
3357c478bd9Sstevel@tonic-gate  */
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate #define	MTUNIT(dev)	(((getminor(dev) & 0xff80) >> 5) + \
3387c478bd9Sstevel@tonic-gate 			    (getminor(dev) & 0x3))
3397c478bd9Sstevel@tonic-gate #define	MT_NOREWIND	(1 <<2)
3407c478bd9Sstevel@tonic-gate #define	MT_DENSITY_MASK	(3 <<3)
3417c478bd9Sstevel@tonic-gate #define	MT_DENSITY1	(0 <<3)		/* Lowest density/format */
3427c478bd9Sstevel@tonic-gate #define	MT_DENSITY2	(1 <<3)
3437c478bd9Sstevel@tonic-gate #define	MT_DENSITY3	(2 <<3)
3447c478bd9Sstevel@tonic-gate #define	MT_DENSITY4	(3 <<3)		/* Highest density/format */
345d25b227dSzl149053 #define	MTMINOR(unit)	((((unit) & 0x7fc) << 5) + ((unit) & 0x3))
3467c478bd9Sstevel@tonic-gate #define	MT_BSD		(1 <<6)		/* BSD behavior on close */
3477c478bd9Sstevel@tonic-gate #define	MT_DENSITY(dev) ((getminor(dev) & MT_DENSITY_MASK) >> 3)
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3507c478bd9Sstevel@tonic-gate }
3517c478bd9Sstevel@tonic-gate #endif
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate #endif /* _SYS_MTIO_H */
354