xref: /netbsd-src/sys/dev/scsipi/scsi_changer.h (revision cda4f8f6ee55684e8d311b86c99ea59191e6b74f)
1 /*
2  * SCSI changer interface description
3  *
4  * Written by Stefan Grefen   (grefen@goofy.zdv.uni-mainz.de soon grefen@convex.com)
5  * based on the SCSI System by written Julian Elischer (julian@tfs.com)
6  * for TRW Financial Systems.
7  *
8  * TRW Financial Systems, in accordance with their agreement with Carnegie
9  * Mellon University, makes this software available to CMU to distribute
10  * or use in any manner that they see fit as long as this message is kept with
11  * the software. For this reason TFS also grants any other persons or
12  * organisations permission to use or modify this software.
13  *
14  * TFS supplies this software to be publicly redistributed
15  * on the understanding that TFS is not responsible for the correct
16  * functioning of this software in any circumstances.
17  *
18  *	$Id: scsi_changer.h,v 1.2 1993/05/20 03:46:30 cgd Exp $
19  */
20 
21 /*
22  * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
23  */
24 
25 /*
26  * SCSI command format
27  */
28 struct scsi_read_element_status
29 {
30         u_char  op_code;
31 	u_char	element_type_code:4;
32 	u_char  voltag:1;
33         u_char  lun:3;
34 	u_char	starting_element_addr[2];
35 	u_char	number_of_elements[2];
36 	u_char	resv1;
37 	u_char	allocation_length[3];
38 	u_char	resv2;
39         u_char  link:1;
40         u_char  flag:1;
41         u_char  :6;
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	:5;
53 	u_char	lun:3;
54 	u_char  transport_element_address[2];
55 	u_char  source_address[2];
56 	u_char  destination_address[2];
57 	u_char  rsvd[2];
58 	u_char  invert:1;
59 	u_char	:7;
60         u_char  link:1;
61         u_char  flag:1;
62         u_char  :6;
63 };
64 
65 struct scsi_position_to_element
66 {
67 	u_char  op_code;
68 	u_char	:5;
69 	u_char	lun:3;
70 	u_char  transport_element_address[2];
71 	u_char  source_address[2];
72 	u_char  rsvd[2];
73 	u_char  invert:1;
74 	u_char	:7;
75         u_char  link:1;
76         u_char  flag:1;
77         u_char  :6;
78 };
79 
80 /*
81  * Opcodes
82  */
83 #define POSITION_TO_ELEMENT     0x2b
84 #define MOVE_MEDIUM             0xa5
85 #define READ_ELEMENT_STATUS     0xb8
86 
87 struct scsi_element_status_data
88 {
89 	u_char	first_element_reported[2];
90 	u_char	number_of_elements_reported[2];
91 	u_char  rsvd;
92 	u_char	byte_count_of_report[3];
93 };
94 
95 struct element_status_page
96 {
97 	u_char	element_type_code;
98 	u_char	:5;
99 	u_char avoltag:1;
100 	u_char pvoltag:1;
101 	u_char element_descriptor_length[2];
102 	u_char rsvd;
103 	u_char byte_count_of_descriptor_data[3];
104 };
105 
106