chio.h revision 4
1/*
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)chio.h	7.6 (Berkeley) 2/5/91
34 *
35 * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
36 * --------------------         -----   ----------------------
37 * CURRENT PATCH LEVEL:         1       00098
38 * --------------------         -----   ----------------------
39 *
40 * 16 Feb 93	Julian Elischer		ADDED for SCSI system
41 */
42
43/* This is a "convertet" mtio.h from 386BSD
44   Stefan Grefen grefen@goofy.zdv.uni-mainz.de
45 */
46
47/*
48 * Structures and definitions for changer io control commands
49 */
50#ifndef _CHIO_H_
51#define _CHIO_H_
52
53#define CH_INVERT		0x10000
54#define CH_ADDR_MASK		0xffff
55struct chop {
56	short	ch_op;		/* operations defined below */
57	short	result;		/* The result		    */
58	union {
59	   struct {
60		int chm;		/* Transport element */
61		int from;
62		int to;
63	   } move;
64	   struct {
65		int chm;		/* Transport element */
66		int to;
67	   } position;
68	   struct {
69	        short   chmo;                   /* Offset of first CHM */
70	        short   chms;                   /* No. of CHM */
71	        short   slots;                  /* No. of Storage Elements */
72                short   sloto;                  /* Offset of first SE */
73                short   imexs;                  /* No. of Import/Export Slots */
74                short   imexo;                  /* Offset of first IM/EX */
75                short   drives;                 /* No. of CTS */
76                short   driveo;                 /* Offset of first CTS */
77                short   rot;                    /* CHM can rotate */
78	   } getparam;
79	   struct {
80		int type;
81#define CH_CHM	1
82#define CH_STOR	2
83#define CH_IMEX	3
84#define CH_CTS	4
85		int from;
86		struct {
87			u_char elema_1;
88			u_char elema_0;
89			u_char full:1;
90			u_char rsvd:1;
91			u_char except:1;
92			u_char :5;
93			u_char rsvd2;
94			union {
95				struct {
96				u_char add_sense_code;
97				u_char add_sense_code_qualifier;
98				} specs;
99				short add_sense;
100/* WARINING LSB only */
101#define CH_CHOLDER	0x0290	/* Cartridge holder is missing */
102#define CH_STATUSQ	0x0390	/* Status is questionable */
103#define CH_CTS_CLOSED	0x0490	/* CTS door is closed */
104
105			} ch_add_sense;
106			u_char rsvd3[3];
107			u_char :6;
108			u_char invert:1;
109			u_char svalid:1;
110			u_char source_1;
111			u_char source_0;
112			u_char rsvd4[4];
113			} elem_data;
114		} get_elem_stat;
115	} u;
116};
117
118/* operations */
119#define CHMOVE				1
120#define CHPOSITION			2
121#define CHGETPARAM			3
122#define CHGETELEM			4
123
124
125/* Changer IO control command */
126#define	CHIOOP	_IOWR('c', 1, struct chop)	/* do a mag tape op */
127#endif
128