scsi_disk.h revision 1.3 1 /*
2 * SCSI interface description
3 *
4 * Some lines of this file comes from a file of the name "scsi.h"
5 * distributed by OSF as part of mach2.5,
6 * so the following disclaimer has been kept.
7 *
8 * Copyright 1990 by Open Software Foundation,
9 * Grenoble, FRANCE
10 *
11 * All Rights Reserved
12 *
13 * Permission to use, copy, modify, and distribute this software and
14 * its documentation for any purpose and without fee is hereby granted,
15 * provided that the above copyright notice appears in all copies and
16 * that both the copyright notice and this permission notice appear in
17 * supporting documentation, and that the name of OSF or Open Software
18 * Foundation not be used in advertising or publicity pertaining to
19 * distribution of the software without specific, written prior
20 * permission.
21 *
22 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
23 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
24 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
25 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
27 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
28 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 */
30
31 /*
32 * Largely written by Julian Elischer (julian (at) tfs.com)
33 * for TRW Financial Systems.
34 *
35 * TRW Financial Systems, in accordance with their agreement with Carnegie
36 * Mellon University, makes this software available to CMU to distribute
37 * or use in any manner that they see fit as long as this message is kept with
38 * the software. For this reason TFS also grants any other persons or
39 * organisations permission to use or modify this software.
40 *
41 * TFS supplies this software to be publicly redistributed
42 * on the understanding that TFS is not responsible for the correct
43 * functioning of this software in any circumstances.
44 *
45 * $Id: scsi_disk.h,v 1.3 1993/05/20 03:46:32 cgd Exp $
46 */
47
48 /*
49 * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
50 */
51
52 /*
53 * SCSI command format
54 */
55
56
57 struct scsi_reassign_blocks
58 {
59 u_char op_code;
60 u_char :5;
61 u_char lun:3;
62 u_char unused[3];
63 u_char link:1;
64 u_char flag:1;
65 u_char :6;
66 };
67
68 struct scsi_rw
69 {
70 u_char op_code;
71 u_char addr_2:5; /* Most significant */
72 u_char lun:3;
73 u_char addr_1;
74 u_char addr_0; /* least significant */
75 u_char length;
76 u_char link:1;
77 u_char flag:1;
78 u_char :6;
79 };
80
81 struct scsi_rw_big
82 {
83 u_char op_code;
84 u_char rel_addr:1;
85 u_char :4; /* Most significant */
86 u_char lun:3;
87 u_char addr_3;
88 u_char addr_2;
89 u_char addr_1;
90 u_char addr_0; /* least significant */
91 u_char reserved;;
92 u_char length2;
93 u_char length1;
94 u_char link:1;
95 u_char flag:1;
96 u_char :4;
97 u_char vendor:2;
98 };
99
100 struct scsi_read_capacity
101 {
102 u_char op_code;
103 u_char :5;
104 u_char lun:3;
105 u_char addr_3; /* Most Significant */
106 u_char addr_2;
107 u_char addr_1;
108 u_char addr_0; /* Least Significant */
109 u_char unused[3];
110 u_char link:1;
111 u_char flag:1;
112 u_char :6;
113 };
114
115 struct scsi_start_stop
116 {
117 u_char op_code;
118 u_char :5;
119 u_char lun:3;
120 u_char unused[2];
121 u_char start:1;
122 u_char loej:1;
123 u_char :6;
124 u_char link:1;
125 u_char flag:1;
126 u_char :6;
127 };
128
129
130
131 /*
132 * Opcodes
133 */
134
135 #define FORMAT_DISK 0x04
136 #define REASSIGN_BLOCKS 0x07
137 #define READ_COMMAND 0x08
138 #define WRITE_COMMAND 0x0a
139 #define MODE_SELECT 0x15
140 #define MODE_SENSE 0x1a
141 #define START_STOP 0x1b
142 #define PREVENT_ALLOW 0x1e
143 #define READ_CAPACITY 0x25
144 #define READ_BIG 0x28
145 #define WRITE_BIG 0x2a
146
147
148 struct scsi_format_parms { /* physical BFI format */
149 u_short reserved;
150 u_short list_len;
151 struct defect {
152 unsigned cyl : 24;
153 unsigned head : 8;
154 long bytes_from_index;
155 } defect[127];
156 } format_parms;
157
158
159 struct scsi_read_cap_data
160 {
161 u_char addr_3; /* Most significant */
162 u_char addr_2;
163 u_char addr_1;
164 u_char addr_0; /* Least significant */
165 u_char length_3; /* Most significant */
166 u_char length_2;
167 u_char length_1;
168 u_char length_0; /* Least significant */
169 };
170
171 struct scsi_reassign_blocks_data
172 {
173 u_char reserved[2];
174 u_char length_msb;
175 u_char length_lsb;
176 struct
177 {
178 u_char dlbaddr_3; /* defect logical block address (MSB) */
179 u_char dlbaddr_2;
180 u_char dlbaddr_1;
181 u_char dlbaddr_0; /* defect logical block address (LSB) */
182 } defect_descriptor[1];
183 };
184
185 union disk_pages /* this is the structure copied from osf */
186 {
187 struct page_disk_format {
188 u_char pg_code:6; /* page code (should be 3) */
189 u_char :2;
190 u_char pg_length; /* page length (should be 0x16) */
191 u_char trk_z_1; /* tracks per zone (MSB) */
192 u_char trk_z_0; /* tracks per zone (LSB) */
193 u_char alt_sec_1; /* alternate sectors per zone (MSB) */
194 u_char alt_sec_0; /* alternate sectors per zone (LSB) */
195 u_char alt_trk_z_1; /* alternate tracks per zone (MSB) */
196 u_char alt_trk_z_0; /* alternate tracks per zone (LSB) */
197 u_char alt_trk_v_1; /* alternate tracks per volume (MSB) */
198 u_char alt_trk_v_0; /* alternate tracks per volume (LSB) */
199 u_char ph_sec_t_1; /* physical sectors per track (MSB) */
200 u_char ph_sec_t_0; /* physical sectors per track (LSB) */
201 u_char bytes_s_1; /* bytes per sector (MSB) */
202 u_char bytes_s_0; /* bytes per sector (LSB) */
203 u_char interleave_1;/* interleave (MSB) */
204 u_char interleave_0;/* interleave (LSB) */
205 u_char trk_skew_1; /* track skew factor (MSB) */
206 u_char trk_skew_0; /* track skew factor (LSB) */
207 u_char cyl_skew_1; /* cylinder skew (MSB) */
208 u_char cyl_skew_0; /* cylinder skew (LSB) */
209 u_char reserved1:4;
210 u_char surf:1;
211 u_char rmb:1;
212 u_char hsec:1;
213 u_char ssec:1;
214 u_char reserved2;
215 u_char reserved3;
216 } disk_format;
217 struct page_rigid_geometry {
218 u_char pg_code:7; /* page code (should be 4) */
219 u_char mbone:1; /* must be one */
220 u_char pg_length; /* page length (should be 0x16) */
221 u_char ncyl_2; /* number of cylinders (MSB) */
222 u_char ncyl_1; /* number of cylinders */
223 u_char ncyl_0; /* number of cylinders (LSB) */
224 u_char nheads; /* number of heads */
225 u_char st_cyl_wp_2; /* starting cyl., write precomp (MSB) */
226 u_char st_cyl_wp_1; /* starting cyl., write precomp */
227 u_char st_cyl_wp_0; /* starting cyl., write precomp (LSB) */
228 u_char st_cyl_rwc_2;/* starting cyl., red. write cur (MSB)*/
229 u_char st_cyl_rwc_1;/* starting cyl., red. write cur */
230 u_char st_cyl_rwc_0;/* starting cyl., red. write cur (LSB)*/
231 u_char driv_step_1; /* drive step rate (MSB) */
232 u_char driv_step_0; /* drive step rate (LSB) */
233 u_char land_zone_2; /* landing zone cylinder (MSB) */
234 u_char land_zone_1; /* landing zone cylinder */
235 u_char land_zone_0; /* landing zone cylinder (LSB) */
236 u_char reserved1;
237 u_char reserved2;
238 u_char reserved3;
239 } rigid_geometry;
240 } ;
241