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