xref: /onnv-gate/usr/src/uts/common/sys/mtio.h (revision 6756:eb1684736e37)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52083Szl149053  * Common Development and Distribution License (the "License").
62083Szl149053  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6756Syl194034  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  *
250Sstevel@tonic-gate  *	Copyright (c) 1983-1989 by AT&T.
260Sstevel@tonic-gate  *	All rights reserved.
270Sstevel@tonic-gate  */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
310Sstevel@tonic-gate  * under license from the Regents of the University of California.
320Sstevel@tonic-gate  */
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifndef	_SYS_MTIO_H
350Sstevel@tonic-gate #define	_SYS_MTIO_H
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #include <sys/types.h>
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #ifdef	__cplusplus
420Sstevel@tonic-gate extern "C" {
430Sstevel@tonic-gate #endif
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Structures and definitions for mag tape io control commands
470Sstevel@tonic-gate  */
480Sstevel@tonic-gate 
490Sstevel@tonic-gate /*
500Sstevel@tonic-gate  * structure for MTIOCTOP - mag tape op command
510Sstevel@tonic-gate  */
520Sstevel@tonic-gate struct mtop	{
530Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
540Sstevel@tonic-gate 	daddr_t		mt_count;	/* how many of them */
550Sstevel@tonic-gate };
560Sstevel@tonic-gate 
570Sstevel@tonic-gate #if defined(_SYSCALL32)
580Sstevel@tonic-gate struct mtop32	{
590Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
600Sstevel@tonic-gate 	daddr32_t	mt_count;	/* how many of them */
610Sstevel@tonic-gate };
620Sstevel@tonic-gate #endif /* _SYSCALL32 */
630Sstevel@tonic-gate 
644549Srralphs /*
654549Srralphs  * structure for MTIOCLTOP - mag tape op command
664549Srralphs  */
674549Srralphs struct mtlop	{
684549Srralphs 	short		mt_op;
694549Srralphs 	short		pad[3];
704549Srralphs 	int64_t		mt_count;
714549Srralphs };
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /*
740Sstevel@tonic-gate  * values for mt_op
750Sstevel@tonic-gate  */
760Sstevel@tonic-gate #define	MTWEOF		0	/* write an end-of-file record */
770Sstevel@tonic-gate #define	MTFSF		1	/* forward space over file mark */
780Sstevel@tonic-gate #define	MTBSF		2	/* backward space over file mark (1/2" only ) */
790Sstevel@tonic-gate #define	MTFSR		3	/* forward space to inter-record gap */
800Sstevel@tonic-gate #define	MTBSR		4	/* backward space to inter-record gap */
810Sstevel@tonic-gate #define	MTREW		5	/* rewind */
820Sstevel@tonic-gate #define	MTOFFL		6	/* rewind and put the drive offline */
830Sstevel@tonic-gate #define	MTNOP		7	/* no operation, sets status only */
840Sstevel@tonic-gate #define	MTRETEN		8	/* retension the tape (cartridge tape only) */
850Sstevel@tonic-gate #define	MTERASE		9	/* erase the entire tape */
860Sstevel@tonic-gate #define	MTEOM		10	/* position to end of media */
870Sstevel@tonic-gate #define	MTNBSF		11	/* backward space file to BOF */
880Sstevel@tonic-gate #define	MTSRSZ		12	/* set record size */
890Sstevel@tonic-gate #define	MTGRSZ		13	/* get record size */
900Sstevel@tonic-gate #define	MTLOAD		14	/* for loading a tape (use o_delay to open */
910Sstevel@tonic-gate 				/* the tape device) */
924549Srralphs #define	MTBSSF		15	/* Backward space to x sequential filemarks */
934549Srralphs #define	MTFSSF		16	/* Forward space to x sequential filemarks */
944549Srralphs #define	MTTELL		17	/* get current logical block position */
954549Srralphs #define	MTSEEK		18	/* position to logical block position */
964549Srralphs #define	MTLOCK		19	/* lock media */
974549Srralphs #define	MTUNLOCK	20	/* unlock media */
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /*
1000Sstevel@tonic-gate  * structure for MTIOCGET - mag tape get status command
1010Sstevel@tonic-gate  */
1020Sstevel@tonic-gate struct mtget	{
1030Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
1040Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
1050Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
1060Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
1070Sstevel@tonic-gate 	/* optional error info. */
1080Sstevel@tonic-gate 	daddr_t		mt_resid;	/* residual count */
1090Sstevel@tonic-gate 	daddr_t		mt_fileno;	/* file number of current position */
1100Sstevel@tonic-gate 	daddr_t		mt_blkno;	/* block number of current position */
1110Sstevel@tonic-gate 	ushort_t	mt_flags;
1120Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
1130Sstevel@tonic-gate };
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #if defined(_SYSCALL32)
1160Sstevel@tonic-gate struct mtget32	{
1170Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
1180Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
1190Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
1200Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
1210Sstevel@tonic-gate 	/* optional error info. */
1220Sstevel@tonic-gate 	daddr32_t	mt_resid;	/* residual count */
1230Sstevel@tonic-gate 	daddr32_t	mt_fileno;	/* file number of current position */
1240Sstevel@tonic-gate 	daddr32_t	mt_blkno;	/* block number of current position */
1250Sstevel@tonic-gate 	ushort_t	mt_flags;
1260Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
1270Sstevel@tonic-gate };
1280Sstevel@tonic-gate #endif /* _SYSCALL32 */
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate #define	MT_NDENSITIES	4
1310Sstevel@tonic-gate #define	MT_NSPEEDS	4
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate /*
1340Sstevel@tonic-gate  * struct for MTIOCGETDRIVETYPE - get tape config data
1350Sstevel@tonic-gate  */
1360Sstevel@tonic-gate struct mtdrivetype {
1370Sstevel@tonic-gate 	char    name[64];		/* Name, for debug */
1380Sstevel@tonic-gate 	char    vid[25];		/* Vendor id and model (product) id */
1390Sstevel@tonic-gate 	char    type;			/* Drive type for driver */
1400Sstevel@tonic-gate 	int	bsize;			/* Block size */
1410Sstevel@tonic-gate 	int	options;		/* Drive options */
1420Sstevel@tonic-gate 	int	max_rretries;		/* Max read retries */
1430Sstevel@tonic-gate 	int	max_wretries;		/* Max write retries */
1440Sstevel@tonic-gate 	uchar_t densities[MT_NDENSITIES];	/* density codes, low->hi */
1450Sstevel@tonic-gate 	uchar_t	default_density;	/* Default density chosen */
1460Sstevel@tonic-gate 	uchar_t speeds[MT_NSPEEDS];	/* speed codes, low->hi */
1470Sstevel@tonic-gate 	ushort_t non_motion_timeout;    /* Inquiry type commands */
1480Sstevel@tonic-gate 	ushort_t io_timeout;		/* io timeout. seconds */
1490Sstevel@tonic-gate 	ushort_t rewind_timeout;	/* rewind timeout. seconds */
1500Sstevel@tonic-gate 	ushort_t space_timeout;		/* space cmd timeout. seconds */
1510Sstevel@tonic-gate 	ushort_t load_timeout;		/* load tape time in seconds */
1520Sstevel@tonic-gate 	ushort_t unload_timeout;	/* Unload tape time in scounds */
1530Sstevel@tonic-gate 	ushort_t erase_timeout;		/* erase timeout. seconds */
1540Sstevel@tonic-gate };
1550Sstevel@tonic-gate 
1565077Sbz211116 /*
1575077Sbz211116  * struct for MTIOCGETERROR - get recent error entry command
1585077Sbz211116  */
1595077Sbz211116 struct mterror_entry {
1605077Sbz211116 	size_t mtee_cdb_len;			/* CDB length */
1615077Sbz211116 	uchar_t *mtee_cdb_buf;			/* CDB sent to the device */
1625077Sbz211116 	size_t mtee_arq_status_len;		/* length of scsi arq status */
1635077Sbz211116 	struct scsi_arq_status *mtee_arq_status;
1645077Sbz211116 						/* scsi arq status buffer */
1655077Sbz211116 };
1665077Sbz211116 
1675077Sbz211116 #define	MTERROR_ENTRY_SIZE_64 (sizeof (struct mterror_entry))
1685077Sbz211116 
1695077Sbz211116 #if defined(_SYSCALL32)
1705077Sbz211116 struct mterror_entry32 {
1715077Sbz211116 	size32_t mtee_cdb_len;			/* CDB length */
1725077Sbz211116 	caddr32_t mtee_cdb_buf;			/* CDB sent to the device */
1735077Sbz211116 	size32_t mtee_arq_status_len;		/* length of scsi arq status */
1745077Sbz211116 	caddr32_t mtee_arq_status;
1755077Sbz211116 						/* scsi arq status buffer */
1765077Sbz211116 };
1775077Sbz211116 
1785077Sbz211116 #define	MTERROR_ENTRY_SIZE_32 (sizeof (struct mterror_entry32))
1795077Sbz211116 
1805077Sbz211116 #endif /* _SYSCALL32 */
1815077Sbz211116 
1825077Sbz211116 /*
1835077Sbz211116  * error entry stack
1845077Sbz211116  */
1855077Sbz211116 struct mterror_entry_stack {
1865077Sbz211116 	struct mterror_entry mtees_entry;
1875077Sbz211116 	struct mterror_entry_stack *mtees_nextp;
1885077Sbz211116 };
1895077Sbz211116 
1905077Sbz211116 #define	MTERROR_LINK_ENTRY_SIZE (sizeof (struct mterror_entry_stack))
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate struct mtdrivetype_request {
1930Sstevel@tonic-gate 	int	size;
1940Sstevel@tonic-gate 	struct  mtdrivetype *mtdtp;
1950Sstevel@tonic-gate };
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate #if defined(_SYSCALL32)
1980Sstevel@tonic-gate struct mtdrivetype_request32 {
1990Sstevel@tonic-gate 	int		size;
2000Sstevel@tonic-gate 	caddr32_t	mtdtp;
2010Sstevel@tonic-gate };
2020Sstevel@tonic-gate #endif /* _SYSCALL32 */
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate /*
2060Sstevel@tonic-gate  * values for mt_flags
2070Sstevel@tonic-gate  */
2084549Srralphs #define	MTF_SCSI		0x01
2094549Srralphs #define	MTF_REEL		0x02
2104549Srralphs #define	MTF_ASF			0x04
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate #define	MTF_TAPE_HEAD_DIRTY	0x08
2130Sstevel@tonic-gate #define	MTF_TAPE_CLN_SUPPORTED	0x10
2142537Srralphs #define	MTF_WORM_MEDIA		0x20
2154549Srralphs #define	MTF_LOGICAL_BLOCK	0x40
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate /*
2180Sstevel@tonic-gate  * Constants for mt_type byte (these are somewhat obsolete)
2190Sstevel@tonic-gate  */
2200Sstevel@tonic-gate #define	MT_ISTS		0x01		/* vax: unibus ts-11 */
2210Sstevel@tonic-gate #define	MT_ISHT		0x02		/* vax: massbus tu77, etc */
2220Sstevel@tonic-gate #define	MT_ISTM		0x03		/* vax: unibus tm-11 */
2230Sstevel@tonic-gate #define	MT_ISMT		0x04		/* vax: massbus tu78 */
2240Sstevel@tonic-gate #define	MT_ISUT		0x05		/* vax: unibus gcr */
2250Sstevel@tonic-gate #define	MT_ISCPC	0x06		/* sun: multibus cpc */
2260Sstevel@tonic-gate #define	MT_ISAR		0x07		/* sun: multibus archive */
2270Sstevel@tonic-gate #define	MT_ISSC		0x08		/* sun: SCSI archive */
2280Sstevel@tonic-gate #define	MT_ISSYSGEN11	0x10		/* sun: SCSI Sysgen, QIC-11 only */
2290Sstevel@tonic-gate #define	MT_ISSYSGEN	0x11		/* sun: SCSI Sysgen QIC-24/11 */
2300Sstevel@tonic-gate #define	MT_ISDEFAULT	0x12		/* sun: SCSI default CCS */
2310Sstevel@tonic-gate #define	MT_ISCCS3	0x13		/* sun: SCSI generic (unknown) CCS */
2320Sstevel@tonic-gate #define	MT_ISMT02	0x14		/* sun: SCSI Emulex MT02 */
2330Sstevel@tonic-gate #define	MT_ISVIPER1	0x15		/* sun: SCSI Archive QIC-150 Viper */
2340Sstevel@tonic-gate #define	MT_ISWANGTEK1	0x16		/* sun: SCSI Wangtek QIC-150 */
2350Sstevel@tonic-gate #define	MT_ISCCS7	0x17		/* sun: SCSI generic (unknown) CCS */
2360Sstevel@tonic-gate #define	MT_ISCCS8	0x18		/* sun: SCSI generic (unknown) CCS */
2370Sstevel@tonic-gate #define	MT_ISCCS9	0x19		/* sun: SCSI generic (unknown) CCS */
2380Sstevel@tonic-gate #define	MT_ISCCS11	0x1a		/* sun: SCSI generic (unknown) CCS */
2390Sstevel@tonic-gate #define	MT_ISCCS12	0x1b		/* sun: SCSI generic (unknown) CCS */
2400Sstevel@tonic-gate #define	MT_ISCCS13	0x1c		/* sun: SCSI generic (unknown) CCS */
2410Sstevel@tonic-gate #define	MT_ISCCS14	0x1d		/* sun: SCSI generic (unknown) CCS */
2420Sstevel@tonic-gate #define	MT_ISCCS15	0x1e		/* sun: SCSI generic (unknown) CCS */
2430Sstevel@tonic-gate #define	MT_ISCCS16	0x1f		/* sun: SCSI generic (unknown) CCS */
2440Sstevel@tonic-gate #define	MT_ISCDC	0x20		/* sun: SCSI CDC 1/2" cartridge */
2450Sstevel@tonic-gate #define	MT_ISFUJI	0x21		/* sun: SCSI Fujitsu 1/2" cartridge */
2460Sstevel@tonic-gate #define	MT_ISKENNEDY	0x22		/* sun: SCSI Kennedy 1/2" reel */
2470Sstevel@tonic-gate #define	MT_ISHP		0x23		/* sun: SCSI HP 1/2" reel */
2480Sstevel@tonic-gate #define	MT_ISSTC	0x24		/* sun: SCSI IBM STC 3490 */
2490Sstevel@tonic-gate #define	MT_ISANRITSU	0x25		/* nihon sun: Anritsu 1/2" reel */
2500Sstevel@tonic-gate #define	MT_ISCCS23	0x26		/* sun: SCSI generic  1/2" */
2510Sstevel@tonic-gate #define	MT_ISCCS24	0x27		/* sun: SCSI generic  1/2" */
2520Sstevel@tonic-gate #define	MT_ISEXABYTE	0x28		/* sun: SCSI Exabyte 8mm cartridge */
2530Sstevel@tonic-gate #define	MT_ISEXB8500	0x29		/* sun: SCSI Exabyte 8500 8mm cart */
2540Sstevel@tonic-gate #define	MT_ISWANGTHS	0x2a		/* sun: SCSI Wangtek 6130HS RDAT */
2550Sstevel@tonic-gate #define	MT_ISWANGDAT	0x2b		/* sun: SCSI WangDAT */
2560Sstevel@tonic-gate #define	MT_ISPYTHON	0x2c		/* sun: SCSI Archive Python DAT  */
2570Sstevel@tonic-gate #define	MT_ISCCS28	0x2d		/* sun: SCSI generic DAT CCS */
2580Sstevel@tonic-gate #define	MT_ISCCS29	0x2e		/* sun: SCSI generic (unknown) CCS */
2590Sstevel@tonic-gate #define	MT_ISCCS30	0x2f		/* sun: SCSI generic (unknown) CCS */
2600Sstevel@tonic-gate #define	MT_ISCCS31	0x30		/* sun: SCSI generic (unknown) CCS */
2610Sstevel@tonic-gate #define	MT_ISCCS32	0x31		/* sun: SCSI generic (unknown) CCS */
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate /*
2650Sstevel@tonic-gate  * these are recommended
2660Sstevel@tonic-gate  */
2670Sstevel@tonic-gate #define	MT_ISQIC	0x32		/* generic QIC tape drive */
2680Sstevel@tonic-gate #define	MT_ISREEL	0x33		/* generic reel tape drive */
2690Sstevel@tonic-gate #define	MT_ISDAT	0x34		/* generic DAT tape drive */
2700Sstevel@tonic-gate #define	MT_IS8MM	0x35		/* generic 8mm tape drive */
2710Sstevel@tonic-gate #define	MT_ISOTHER	0x36		/* generic other type of tape drive */
2720Sstevel@tonic-gate 
2730Sstevel@tonic-gate /* more Sun devices */
2740Sstevel@tonic-gate #define	MT_ISTAND25G	0x37		/* sun: SCSI Tandberg 2.5 Gig QIC */
2750Sstevel@tonic-gate #define	MT_ISDLT	0x38		/* sun: SCSI DLT tape drive */
2760Sstevel@tonic-gate #define	MT_ISSTK9840	0x39		/* sun: STK 9840, 9940, 9840B */
2770Sstevel@tonic-gate #define	MT_ISBMDLT1	0x3a		/* sun: Benchmark DLT1 */
2780Sstevel@tonic-gate #define	MT_LTO		0x3b		/* sun: LTO,s by Hp, Seagate, IBM .. */
2792537Srralphs #define	MT_ISAIT	0x3c		/* Sony: AIT I II III and SAIT */
2800Sstevel@tonic-gate 
2810Sstevel@tonic-gate /*
2820Sstevel@tonic-gate  * Device table structure and data for looking tape name from
2830Sstevel@tonic-gate  * tape id number.  Used by mt.c.
2840Sstevel@tonic-gate  */
2850Sstevel@tonic-gate struct mt_tape_info {
2860Sstevel@tonic-gate 	short	t_type;		/* type of magtape device */
2870Sstevel@tonic-gate 	char	*t_name;	/* printing name */
2880Sstevel@tonic-gate 	char	*t_dsbits;	/* "drive status" register */
2890Sstevel@tonic-gate 	char	*t_erbits;	/* "error" register */
2900Sstevel@tonic-gate };
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate /* mag tape io control commands */
2940Sstevel@tonic-gate #define	MTIOC			('m'<<8)
2950Sstevel@tonic-gate #define	MTIOCTOP		(MTIOC|1)	/* do a mag tape op */
2960Sstevel@tonic-gate #define	MTIOCGET		(MTIOC|2)	/* get tape status */
2970Sstevel@tonic-gate #define	MTIOCGETDRIVETYPE	(MTIOC|3)	/* get tape config data */
2980Sstevel@tonic-gate #define	MTIOCPERSISTENT		(MTIOC|4)	/* turn on persistent errors */
2990Sstevel@tonic-gate #define	MTIOCPERSISTENTSTATUS	(MTIOC|5)	/* query persis. err status */
3000Sstevel@tonic-gate #define	MTIOCLRERR		(MTIOC|6)	/* clear a persitent error */
3010Sstevel@tonic-gate #define	MTIOCGUARANTEEDORDER	(MTIOC|7)	/* check for guaranteed order */
3020Sstevel@tonic-gate #define	MTIOCRESERVE		(MTIOC|8)	/* preserve reserve */
3030Sstevel@tonic-gate #define	MTIOCRELEASE		(MTIOC|9)	/* turnoff preserve reserve */
3040Sstevel@tonic-gate #define	MTIOCFORCERESERVE	(MTIOC|10)	/* break reservation drive */
3055077Sbz211116 #define	MTIOCGETERROR		(MTIOC|11)	/* Get recently error record */
3060Sstevel@tonic-gate #define	MTIOCSTATE		(MTIOC|13)	/* Inquire insert/eject state */
3070Sstevel@tonic-gate 
3080Sstevel@tonic-gate #define	MTIOCREADIGNOREILI  	(MTIOC|14)	/* Enable/Disable ILI */
3090Sstevel@tonic-gate #define	MTIOCREADIGNOREEOFS 	(MTIOC|15)	/* Enable/Disable Ignore EOF */
3100Sstevel@tonic-gate #define	MTIOCSHORTFMK		(MTIOC|16)	/* Enable/Disable Short FMK */
3114549Srralphs #define	MTIOCGETPOS		(MTIOC|17)	/* Get drive position */
3124549Srralphs #define	MTIOCRESTPOS		(MTIOC|18)	/* Go back to position */
3134549Srralphs #define	MTIOCLTOP		(MTIOC|19)	/* do a mag tape op */
3140Sstevel@tonic-gate 
3150Sstevel@tonic-gate /*
3160Sstevel@tonic-gate  * This state enum is the argument passed to the MTIOCSTATE ioctl.
3170Sstevel@tonic-gate  */
3180Sstevel@tonic-gate enum mtio_state { MTIO_NONE, MTIO_EJECTED, MTIO_INSERTED };
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate #ifndef KERNEL
3210Sstevel@tonic-gate /*
3220Sstevel@tonic-gate  * don't use DEFTAPE.
3230Sstevel@tonic-gate  */
3240Sstevel@tonic-gate #define	DEFTAPE	"/dev/rmt/0"
3250Sstevel@tonic-gate #endif
3260Sstevel@tonic-gate 
3270Sstevel@tonic-gate /*
3280Sstevel@tonic-gate  * Layout of minor device byte
3290Sstevel@tonic-gate  * 15 - 8    7    6    5    4    3    2    1    0
3300Sstevel@tonic-gate  * --------------------------------------------
3310Sstevel@tonic-gate  * |    |    |    |    |    |    |    |    |----| Unit #. lower 2 bits
3320Sstevel@tonic-gate  * |    |    |    |    |    |    |    |---------- No rewind on close bit....
3330Sstevel@tonic-gate  * |    |    |    |    |    |----|--------------- Density Select
3340Sstevel@tonic-gate  * |    |    |    |    |------------------------- Resrvd.(add. campus dens. bit)
3350Sstevel@tonic-gate  * |    |    |    |------------------------------ BSD behavior
336*6756Syl194034  * |----|----|----------------------------------- Unit #  bit 2-10
3370Sstevel@tonic-gate  */
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate #define	MTUNIT(dev)	(((getminor(dev) & 0xff80) >> 5) + \
3400Sstevel@tonic-gate 			    (getminor(dev) & 0x3))
3410Sstevel@tonic-gate #define	MT_NOREWIND	(1 <<2)
3420Sstevel@tonic-gate #define	MT_DENSITY_MASK	(3 <<3)
3430Sstevel@tonic-gate #define	MT_DENSITY1	(0 <<3)		/* Lowest density/format */
3440Sstevel@tonic-gate #define	MT_DENSITY2	(1 <<3)
3450Sstevel@tonic-gate #define	MT_DENSITY3	(2 <<3)
3460Sstevel@tonic-gate #define	MT_DENSITY4	(3 <<3)		/* Highest density/format */
3472083Szl149053 #define	MTMINOR(unit)	((((unit) & 0x7fc) << 5) + ((unit) & 0x3))
3480Sstevel@tonic-gate #define	MT_BSD		(1 <<6)		/* BSD behavior on close */
3490Sstevel@tonic-gate #define	MT_DENSITY(dev) ((getminor(dev) & MT_DENSITY_MASK) >> 3)
3500Sstevel@tonic-gate 
3510Sstevel@tonic-gate #ifdef	__cplusplus
3520Sstevel@tonic-gate }
3530Sstevel@tonic-gate #endif
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate #endif /* _SYS_MTIO_H */
356