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