1570af302Sopenharmony_ci#ifndef _SYS_MTIO_H
2570af302Sopenharmony_ci#define _SYS_MTIO_H
3570af302Sopenharmony_ci
4570af302Sopenharmony_ci#include <sys/types.h>
5570af302Sopenharmony_ci#include <sys/ioctl.h>
6570af302Sopenharmony_ci
7570af302Sopenharmony_cistruct mtop {
8570af302Sopenharmony_ci	short mt_op;
9570af302Sopenharmony_ci	int mt_count;
10570af302Sopenharmony_ci};
11570af302Sopenharmony_ci
12570af302Sopenharmony_ci#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
13570af302Sopenharmony_ci#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
14570af302Sopenharmony_ci#define _IOT_mtpos _IOT_SIMPLE (long)
15570af302Sopenharmony_ci#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
16570af302Sopenharmony_ci
17570af302Sopenharmony_ci
18570af302Sopenharmony_ci#define MTRESET 0
19570af302Sopenharmony_ci#define MTFSF	1
20570af302Sopenharmony_ci#define MTBSF	2
21570af302Sopenharmony_ci#define MTFSR	3
22570af302Sopenharmony_ci#define MTBSR	4
23570af302Sopenharmony_ci#define MTWEOF	5
24570af302Sopenharmony_ci#define MTREW	6
25570af302Sopenharmony_ci#define MTOFFL	7
26570af302Sopenharmony_ci#define MTNOP	8
27570af302Sopenharmony_ci#define MTRETEN 9
28570af302Sopenharmony_ci#define MTBSFM	10
29570af302Sopenharmony_ci#define MTFSFM  11
30570af302Sopenharmony_ci#define MTEOM	12
31570af302Sopenharmony_ci#define MTERASE 13
32570af302Sopenharmony_ci#define MTRAS1  14
33570af302Sopenharmony_ci#define MTRAS2	15
34570af302Sopenharmony_ci#define MTRAS3  16
35570af302Sopenharmony_ci#define MTSETBLK 20
36570af302Sopenharmony_ci#define MTSETDENSITY 21
37570af302Sopenharmony_ci#define MTSEEK	22
38570af302Sopenharmony_ci#define MTTELL	23
39570af302Sopenharmony_ci#define MTSETDRVBUFFER 24
40570af302Sopenharmony_ci#define MTFSS	25
41570af302Sopenharmony_ci#define MTBSS	26
42570af302Sopenharmony_ci#define MTWSM	27
43570af302Sopenharmony_ci#define MTLOCK  28
44570af302Sopenharmony_ci#define MTUNLOCK 29
45570af302Sopenharmony_ci#define MTLOAD  30
46570af302Sopenharmony_ci#define MTUNLOAD 31
47570af302Sopenharmony_ci#define MTCOMPRESSION 32
48570af302Sopenharmony_ci#define MTSETPART 33
49570af302Sopenharmony_ci#define MTMKPART  34
50570af302Sopenharmony_ci
51570af302Sopenharmony_cistruct mtget {
52570af302Sopenharmony_ci	long mt_type;
53570af302Sopenharmony_ci	long mt_resid;
54570af302Sopenharmony_ci	long mt_dsreg;
55570af302Sopenharmony_ci	long mt_gstat;
56570af302Sopenharmony_ci	long mt_erreg;
57570af302Sopenharmony_ci	int mt_fileno;
58570af302Sopenharmony_ci	int mt_blkno;
59570af302Sopenharmony_ci};
60570af302Sopenharmony_ci
61570af302Sopenharmony_ci#define MT_ISUNKNOWN		0x01
62570af302Sopenharmony_ci#define MT_ISQIC02		0x02
63570af302Sopenharmony_ci#define MT_ISWT5150		0x03
64570af302Sopenharmony_ci#define MT_ISARCHIVE_5945L2	0x04
65570af302Sopenharmony_ci#define MT_ISCMSJ500		0x05
66570af302Sopenharmony_ci#define MT_ISTDC3610		0x06
67570af302Sopenharmony_ci#define MT_ISARCHIVE_VP60I	0x07
68570af302Sopenharmony_ci#define MT_ISARCHIVE_2150L	0x08
69570af302Sopenharmony_ci#define MT_ISARCHIVE_2060L	0x09
70570af302Sopenharmony_ci#define MT_ISARCHIVESC499	0x0A
71570af302Sopenharmony_ci#define MT_ISQIC02_ALL_FEATURES	0x0F
72570af302Sopenharmony_ci#define MT_ISWT5099EEN24	0x11
73570af302Sopenharmony_ci#define MT_ISTEAC_MT2ST		0x12
74570af302Sopenharmony_ci#define MT_ISEVEREX_FT40A	0x32
75570af302Sopenharmony_ci#define MT_ISDDS1		0x51
76570af302Sopenharmony_ci#define MT_ISDDS2		0x52
77570af302Sopenharmony_ci#define MT_ISSCSI1		0x71
78570af302Sopenharmony_ci#define MT_ISSCSI2		0x72
79570af302Sopenharmony_ci#define MT_ISFTAPE_UNKNOWN	0x800000
80570af302Sopenharmony_ci#define MT_ISFTAPE_FLAG		0x800000
81570af302Sopenharmony_ci
82570af302Sopenharmony_cistruct mt_tape_info {
83570af302Sopenharmony_ci	long t_type;
84570af302Sopenharmony_ci	char *t_name;
85570af302Sopenharmony_ci};
86570af302Sopenharmony_ci
87570af302Sopenharmony_ci#define MT_TAPE_INFO \
88570af302Sopenharmony_ci{									      \
89570af302Sopenharmony_ci	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
90570af302Sopenharmony_ci	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
91570af302Sopenharmony_ci	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
92570af302Sopenharmony_ci	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
93570af302Sopenharmony_ci	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
94570af302Sopenharmony_ci	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
95570af302Sopenharmony_ci	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
96570af302Sopenharmony_ci	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
97570af302Sopenharmony_ci	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
98570af302Sopenharmony_ci	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
99570af302Sopenharmony_ci	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
100570af302Sopenharmony_ci	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
101570af302Sopenharmony_ci	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
102570af302Sopenharmony_ci	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
103570af302Sopenharmony_ci	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
104570af302Sopenharmony_ci	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
105570af302Sopenharmony_ci	{0, 0}								      \
106570af302Sopenharmony_ci}
107570af302Sopenharmony_ci
108570af302Sopenharmony_cistruct mtpos {
109570af302Sopenharmony_ci	long mt_blkno;
110570af302Sopenharmony_ci};
111570af302Sopenharmony_ci
112570af302Sopenharmony_cistruct mtconfiginfo  {
113570af302Sopenharmony_ci	long mt_type;
114570af302Sopenharmony_ci	long ifc_type;
115570af302Sopenharmony_ci	unsigned short irqnr;
116570af302Sopenharmony_ci	unsigned short dmanr;
117570af302Sopenharmony_ci	unsigned short port;
118570af302Sopenharmony_ci	unsigned long debug;
119570af302Sopenharmony_ci	unsigned have_dens:1;
120570af302Sopenharmony_ci	unsigned have_bsf:1;
121570af302Sopenharmony_ci	unsigned have_fsr:1;
122570af302Sopenharmony_ci	unsigned have_bsr:1;
123570af302Sopenharmony_ci	unsigned have_eod:1;
124570af302Sopenharmony_ci	unsigned have_seek:1;
125570af302Sopenharmony_ci	unsigned have_tell:1;
126570af302Sopenharmony_ci	unsigned have_ras1:1;
127570af302Sopenharmony_ci	unsigned have_ras2:1;
128570af302Sopenharmony_ci	unsigned have_ras3:1;
129570af302Sopenharmony_ci	unsigned have_qfa:1;
130570af302Sopenharmony_ci	unsigned pad1:5;
131570af302Sopenharmony_ci	char reserved[10];
132570af302Sopenharmony_ci};
133570af302Sopenharmony_ci
134570af302Sopenharmony_ci#define	MTIOCTOP _IOW('m', 1, struct mtop)
135570af302Sopenharmony_ci#define	MTIOCGET _IOR('m', 2, struct mtget)
136570af302Sopenharmony_ci#define	MTIOCPOS _IOR('m', 3, struct mtpos)
137570af302Sopenharmony_ci
138570af302Sopenharmony_ci#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
139570af302Sopenharmony_ci#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
140570af302Sopenharmony_ci
141570af302Sopenharmony_ci#define GMT_EOF(x)              ((x) & 0x80000000)
142570af302Sopenharmony_ci#define GMT_BOT(x)              ((x) & 0x40000000)
143570af302Sopenharmony_ci#define GMT_EOT(x)              ((x) & 0x20000000)
144570af302Sopenharmony_ci#define GMT_SM(x)               ((x) & 0x10000000)
145570af302Sopenharmony_ci#define GMT_EOD(x)              ((x) & 0x08000000)
146570af302Sopenharmony_ci#define GMT_WR_PROT(x)          ((x) & 0x04000000)
147570af302Sopenharmony_ci#define GMT_ONLINE(x)           ((x) & 0x01000000)
148570af302Sopenharmony_ci#define GMT_D_6250(x)           ((x) & 0x00800000)
149570af302Sopenharmony_ci#define GMT_D_1600(x)           ((x) & 0x00400000)
150570af302Sopenharmony_ci#define GMT_D_800(x)            ((x) & 0x00200000)
151570af302Sopenharmony_ci#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
152570af302Sopenharmony_ci#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
153570af302Sopenharmony_ci
154570af302Sopenharmony_ci#define MT_ST_BLKSIZE_SHIFT	0
155570af302Sopenharmony_ci#define MT_ST_BLKSIZE_MASK	0xffffff
156570af302Sopenharmony_ci#define MT_ST_DENSITY_SHIFT	24
157570af302Sopenharmony_ci#define MT_ST_DENSITY_MASK	0xff000000
158570af302Sopenharmony_ci#define MT_ST_SOFTERR_SHIFT	0
159570af302Sopenharmony_ci#define MT_ST_SOFTERR_MASK	0xffff
160570af302Sopenharmony_ci#define MT_ST_OPTIONS		0xf0000000
161570af302Sopenharmony_ci#define MT_ST_BOOLEANS		0x10000000
162570af302Sopenharmony_ci#define MT_ST_SETBOOLEANS	0x30000000
163570af302Sopenharmony_ci#define MT_ST_CLEARBOOLEANS	0x40000000
164570af302Sopenharmony_ci#define MT_ST_WRITE_THRESHOLD	0x20000000
165570af302Sopenharmony_ci#define MT_ST_DEF_BLKSIZE	0x50000000
166570af302Sopenharmony_ci#define MT_ST_DEF_OPTIONS	0x60000000
167570af302Sopenharmony_ci#define MT_ST_BUFFER_WRITES	0x1
168570af302Sopenharmony_ci#define MT_ST_ASYNC_WRITES	0x2
169570af302Sopenharmony_ci#define MT_ST_READ_AHEAD	0x4
170570af302Sopenharmony_ci#define MT_ST_DEBUGGING		0x8
171570af302Sopenharmony_ci#define MT_ST_TWO_FM		0x10
172570af302Sopenharmony_ci#define MT_ST_FAST_MTEOM	0x20
173570af302Sopenharmony_ci#define MT_ST_AUTO_LOCK		0x40
174570af302Sopenharmony_ci#define MT_ST_DEF_WRITES	0x80
175570af302Sopenharmony_ci#define MT_ST_CAN_BSR		0x100
176570af302Sopenharmony_ci#define MT_ST_NO_BLKLIMS	0x200
177570af302Sopenharmony_ci#define MT_ST_CAN_PARTITIONS    0x400
178570af302Sopenharmony_ci#define MT_ST_SCSI2LOGICAL      0x800
179570af302Sopenharmony_ci#define MT_ST_CLEAR_DEFAULT	0xfffff
180570af302Sopenharmony_ci#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
181570af302Sopenharmony_ci#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
182570af302Sopenharmony_ci#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
183570af302Sopenharmony_ci#define MT_ST_HPLOADER_OFFSET 10000
184570af302Sopenharmony_ci#ifndef DEFTAPE
185570af302Sopenharmony_ci# define DEFTAPE	"/dev/tape"
186570af302Sopenharmony_ci#endif
187570af302Sopenharmony_ci
188570af302Sopenharmony_ci#endif
189