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