xref: /csrg-svn/sys/dev/scsi/tape.h (revision 63144)
154882Storek /*
2*63144Sbostic  * Copyright (c) 1992, 1993
3*63144Sbostic  *	The Regents of the University of California.  All rights reserved.
454882Storek  *
554882Storek  * This software was developed by the Computer Systems Engineering group
654882Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
754882Storek  * contributed to Berkeley.
854882Storek  *
955559Storek  * All advertising materials mentioning features or use of this software
1055559Storek  * must display the following acknowledgement:
1155559Storek  *	This product includes software developed by the University of
1255559Storek  *	California, Lawrence Berkeley Laboratories.
1355559Storek  *
1454882Storek  * %sccs.include.redist.c%
1554882Storek  *
16*63144Sbostic  *	@(#)tape.h	8.1 (Berkeley) 06/10/93
1754882Storek  *
1857760Storek  * from: $Header: tape.h,v 1.3 92/12/02 03:53:14 torek Exp $ (LBL)
1954882Storek  */
2054882Storek 
2154882Storek /*
2254882Storek  * SCSI definitions for Sequential Access Devices (tapes).
2357760Storek  *
2457760Storek  * Commands defined in common headers (scsi.h or disktape.h) are omitted.
2554882Storek  */
2654882Storek #define	CMD_REWIND		0x01	/* rewind */
2754882Storek #define	CMD_READ_BLOCK_LIMITS	0x05	/* read block limits */
2854882Storek #define	CMD_READ		0x08	/* read */
2954882Storek #define	CMD_WRITE		0x0a	/* write */
3054882Storek #define	CMD_TRACK_SELECT	0x0b	/* track select */
3154882Storek #define	CMD_READ_REVERSE	0x0f	/* read reverse */
3254882Storek #define	CMD_WRITE_FILEMARK	0x10	/* write file marks */
3354882Storek #define	CMD_SPACE		0x11	/* space */
3454882Storek #define	CMD_VERIFY		0x13	/* verify */
3554882Storek #define	CMD_RBD			0x14	/* recover buffered data */
3654882Storek #define	CMD_RESERVE_UNIT	0x16	/* reserve unit */
3754882Storek #define	CMD_RELEASE_UNIT	0x17	/* release unit */
3854882Storek /*	CMD_COPY		0x18	   copy (common to all scsi devs) */
3954882Storek #define	CMD_ERASE		0x19	/* erase */
4054882Storek #define	CMD_LOAD_UNLOAD		0x1b	/* load/unload */
4154882Storek #define	CMD_PAMR		0x1e	/* prevent/allow medium removal */
4254882Storek 
4354882Storek /*
4454882Storek  * Structure of READ, WRITE, READ REVERSE, RECOVER BUFFERED DATA
4554882Storek  * commands (i.e., the cdb).
4654882Storek  * Also used for VERIFY commands.
4754882Storek  */
4854882Storek struct scsi_cdb_rw {
4954882Storek 	u_char	cdb_cmd,	/* 0x08 or 0x0a or 0x0f or 0x13 or 0x14 */
5057760Storek 		cdb_lun_bf,	/* LUN + reserved + bytecmp + fixed */
5154882Storek 		cdb_lenh,	/* transfer length (MSB) */
5254882Storek 		cdb_lenm,	/* transfer length */
5354882Storek 		cdb_lenl,	/* transfer length (LSB) */
5454882Storek 		cdb_ctrl;	/* control byte */
5554882Storek };
5657760Storek #define	SCSI_RW_BYTECMP		0x02	/* byte compare flag if verify */
5757760Storek #define	SCSI_RW_FIXEDBLK	0x01	/* fixed block size for read/write */
5854882Storek 
5954882Storek /*
6054882Storek  * Structure of a TRACK SELECT command.
6154882Storek  */
6254882Storek struct scsi_cdb_ts {
6354882Storek 	u_char	cdb_cmd,	/* 0x0b */
6457760Storek 		cdb_lun_xxx,	/* logical unit number + reserved */
6554882Storek 		cdb_xxx1,	/* reserved */
6654882Storek 		cdb_xxx2,	/* reserved */
6754882Storek 		cdb_track,	/* track value */
6854882Storek 		cdb_ctrl;	/* control byte */
6954882Storek };
7054882Storek 
7154882Storek /*
7254882Storek  * Structure of a WRITE FILEMARKS command.
7354882Storek  */
7454882Storek struct scsi_cdb_wfm {
7554882Storek 	u_char	cdb_cmd,	/* 0x0b */
7657760Storek 		cdb_lun_xxx,	/* logical unit number + reserved */
7754882Storek 		cdb_nfh,	/* number of filemarks (MSB) */
7854882Storek 		cdb_nfm,	/* number of filemarks */
7954882Storek 		cdb_nfl,	/* number of filemarks (LSB) */
8054882Storek 		cdb_ctrl;	/* control byte */
8154882Storek };
8254882Storek 
8354882Storek /*
8454882Storek  * Structure of a SPACE command.
8554882Storek  */
8654882Storek struct scsi_cdb_space {
8754882Storek 	u_char	cdb_cmd,	/* 0x0b */
8857760Storek 		cdb_lun_code,	/* LUN + reserved + 2-bit code */
8954882Storek 		cdb_counth,	/* count (MSB) */
9054882Storek 		cdb_countm,	/* count */
9154882Storek 		cdb_countl,	/* count (LSB) */
9254882Storek 		cdb_ctrl;	/* control byte */
9354882Storek };
9454882Storek #define	SCSI_CMD_SPACE_BLOCKS	0	/* skip blocks */
9554882Storek #define	SCSI_CMD_SPACE_FMS	1	/* skip file marks */
9654882Storek #define	SCSI_CMD_SPACE_SFMS	2	/* skip sequential file marks */
9754882Storek #define	SCSI_CMD_SPACE_PEOD	3	/* skip to physical end of data */
9854882Storek 
9954882Storek /*
10054882Storek  * Structure of an ERASE command.
10154882Storek  */
10254882Storek struct scsi_cdb_erase {
10354882Storek 	u_char	cdb_cmd,	/* 0x0b */
10457760Storek 		cdb_lun_long,	/* LUN + reserved + long-erase flag */
10554882Storek 		cdb_xxx1,	/* reserved */
10654882Storek 		cdb_xxx2,	/* reserved */
10754882Storek 		cdb_xxx3,	/* reserved */
10854882Storek 		cdb_ctrl;	/* control byte */
10954882Storek };
11054882Storek 
11154882Storek /*
11254882Storek  * Structure of a LOAD/UNLOAD command.
11354882Storek  */
11454882Storek struct scsi_cdb_lu {
11554882Storek 	u_char	cdb_cmd,	/* 0x1b */
11657760Storek 		cdb_lun_immed,	/* LUN + reserved + immediate flag */
11754882Storek 		cdb_xxx1,	/* reserved */
11854882Storek 		cdb_xxx2,	/* reserved */
11957760Storek 		cdb_rl,		/* reserved + retension flag + load flag */
12054882Storek 		cdb_ctrl;	/* control byte */
12154882Storek };
12257760Storek #define	SCSI_LU_RL_RETEN	0x02	/* retension */
12357760Storek #define	SCSI_LU_RL_LOAD		0x01	/* load */
12457760Storek #define	SCSI_LU_RL_UNLOAD	0x00	/* unload (pseudo flag) */
125