xref: /netbsd-src/sys/dev/scsipi/scsi_changer.h (revision 6ea46cb5e46c49111a6ecf3bcbe3c7e2730fe9f6)
1 /*	$NetBSD: scsi_changer.h,v 1.4 1994/06/29 06:43:02 cgd Exp $	*/
2 
3 /*
4  * SCSI changer interface description
5  */
6 
7 /*
8  * Written by Stefan Grefen   (grefen@goofy.zdv.uni-mainz.de soon grefen@convex.com)
9  * based on the SCSI System by written Julian Elischer (julian@tfs.com)
10  * for TRW Financial Systems.
11  *
12  * TRW Financial Systems, in accordance with their agreement with Carnegie
13  * Mellon University, makes this software available to CMU to distribute
14  * or use in any manner that they see fit as long as this message is kept with
15  * the software. For this reason TFS also grants any other persons or
16  * organisations permission to use or modify this software.
17  *
18  * TFS supplies this software to be publicly redistributed
19  * on the understanding that TFS is not responsible for the correct
20  * functioning of this software in any circumstances.
21  *
22  * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
23  */
24 #ifndef _SCSI_SCSI_CHANGER_H
25 #define _SCSI_SCSI_CHANGER_H 1
26 
27 /*
28  * SCSI command format
29  */
30 struct scsi_read_element_status
31 {
32         u_char  op_code;
33 	u_char	byte2;
34 #define	SRES_ELEM_TYPE_CODE 	0x0F
35 #define	SRES_ELEM_VOLTAG 	0x10
36 	u_char	starting_element_addr[2];
37 	u_char	number_of_elements[2];
38 	u_char	resv1;
39 	u_char	allocation_length[3];
40 	u_char	resv2;
41 	u_char	control;
42 };
43 #define RE_ALL_ELEMENTS			0
44 #define RE_MEDIUM_TRANSPORT_ELEMENT	1
45 #define RE_STORAGE_ELEMENT		2
46 #define RE_IMPORT_EXPORT		3
47 #define RE_DATA_TRANSFER_ELEMENT	4
48 
49 struct scsi_move_medium
50 {
51 	u_char  op_code;
52 	u_char	byte2;
53 	u_char  transport_element_address[2];
54 	u_char  source_address[2];
55 	u_char  destination_address[2];
56 	u_char  rsvd[2];
57 	u_char  invert;
58 	u_char	control;
59 };
60 
61 struct scsi_position_to_element
62 {
63 	u_char  op_code;
64         u_char  byte2;
65 	u_char  transport_element_address[2];
66 	u_char  source_address[2];
67 	u_char  rsvd[2];
68 	u_char  invert;
69 	u_char	control;
70 };
71 
72 /*
73  * Opcodes
74  */
75 #define POSITION_TO_ELEMENT     0x2b
76 #define MOVE_MEDIUM             0xa5
77 #define READ_ELEMENT_STATUS     0xb8
78 
79 struct scsi_element_status_data
80 {
81 	u_char	first_element_reported[2];
82 	u_char	number_of_elements_reported[2];
83 	u_char  rsvd;
84 	u_char	byte_count_of_report[3];
85 };
86 
87 struct element_status_page
88 {
89 	u_char	element_type_code;
90 	u_char	flags;
91 #define	ESP_AVOLTAG	0x40
92 #define	ESP_PVOLTAG	0x80
93 	u_char element_descriptor_length[2];
94 	u_char rsvd;
95 	u_char byte_count_of_descriptor_data[3];
96 };
97 #endif /*_SCSI_SCSI_CHANGER_H*/
98 
99