xref: /netbsd-src/sys/dev/scsipi/scsi_changer.h (revision ce0bb6e8d2e560ecacbe865a848624f94498063b)
1 /*	$NetBSD: scsi_changer.h,v 1.5 1994/12/28 19:42:59 mycroft 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         u_char  opcode;
32 	u_char	byte2;
33 #define	SRES_ELEM_TYPE_CODE 	0x0F
34 #define	SRES_ELEM_VOLTAG 	0x10
35 	u_char	starting_element_addr[2];
36 	u_char	number_of_elements[2];
37 	u_char	resv1;
38 	u_char	allocation_length[3];
39 	u_char	resv2;
40 	u_char	control;
41 };
42 #define RE_ALL_ELEMENTS			0
43 #define RE_MEDIUM_TRANSPORT_ELEMENT	1
44 #define RE_STORAGE_ELEMENT		2
45 #define RE_IMPORT_EXPORT		3
46 #define RE_DATA_TRANSFER_ELEMENT	4
47 
48 struct scsi_move_medium {
49 	u_char  opcode;
50 	u_char	byte2;
51 	u_char  transport_element_address[2];
52 	u_char  source_address[2];
53 	u_char  destination_address[2];
54 	u_char  rsvd[2];
55 	u_char  invert;
56 	u_char	control;
57 };
58 
59 struct scsi_position_to_element {
60 	u_char  opcode;
61         u_char  byte2;
62 	u_char  transport_element_address[2];
63 	u_char  source_address[2];
64 	u_char  rsvd[2];
65 	u_char  invert;
66 	u_char	control;
67 };
68 
69 /*
70  * Opcodes
71  */
72 #define POSITION_TO_ELEMENT     0x2b
73 #define MOVE_MEDIUM             0xa5
74 #define READ_ELEMENT_STATUS     0xb8
75 
76 struct scsi_element_status_data {
77 	u_char	first_element_reported[2];
78 	u_char	number_of_elements_reported[2];
79 	u_char  rsvd;
80 	u_char	byte_count_of_report[3];
81 };
82 
83 struct element_status_page {
84 	u_char	element_type_code;
85 	u_char	flags;
86 #define	ESP_AVOLTAG	0x40
87 #define	ESP_PVOLTAG	0x80
88 	u_char element_descriptor_length[2];
89 	u_char rsvd;
90 	u_char byte_count_of_descriptor_data[3];
91 };
92 
93 #endif /* _SCSI_SCSI_CHANGER_H */
94 
95