FreeBSD/Linux Kernel Cross Reference
sys/sqtsec/scsi.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 Sequent Computer Systems
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
12 *
13 * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
14 * THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
15 * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /*
30 * HISTORY
31 * $Log: scsi.h,v $
32 * Revision 2.3 91/07/31 18:07:04 dbg
33 * Changed copyright.
34 * [91/07/31 dbg]
35 *
36 * Revision 2.2 91/05/08 13:06:26 dbg
37 * Added, from Sequent SYMMETRY sources.
38 * [91/02/26 dbg]
39 *
40 */
41
42 /*
43 * $Header: scsi.h,v 2.3 91/07/31 18:07:04 dbg Exp $
44 *
45 * Supported SCSI commands
46 */
47
48 /*
49 * Revision 1.1 89/07/05 13:20:13 kak
50 * Initial revision
51 *
52 */
53
54 #ifndef _SQT_SCSI_H_
55 #define _SQT_SCSI_H_
56
57 /* class 00 commands */
58 #define SCSI_TEST 0x00 /* test unit ready */
59 #define SCSI_REZERO 0x01 /* rezero unit */
60 #define SCSI_RSENSE 0x03 /* request sense */
61 #define SCSI_FORMAT 0x04 /* format unit */
62 #define SCSI_READ 0x08 /* read */
63 #define SCSI_WRITE 0x0a /* write */
64 #define SCSI_SEEK 0x0b /* seek */
65 #define SCSI_TRAN 0x0f /* translate logical to phys */
66 #define SCSI_INQUIRY 0x12 /* do inquiry */
67 #define SCSI_WRITEB 0x13 /* write buffer */
68 #define SCSI_READB 0x14 /* read buffer */
69 #define SCSI_MODES 0x15 /* mode select */
70 #define SCSI_RESRV 0x16 /* reserve unit */
71 #define SCSI_RELSE 0x17 /* release unit */
72 #define SCSI_MSENSE 0x1a /* mode sense */
73 #define SCSI_STARTOP 0x1b /* start/stop unit */
74 #define SCSI_START_UNIT 0x01
75 #define SCSI_STOP_UNIT 0x00
76 #define SCSI_RDIAG 0x1c /* receive diagnostic */
77 #define SCSI_SDIAG 0x1d /* send diagnostic */
78 #define SCSI_SDIAG_REINIT 0x60
79 #define SCSI_SDIAG_DUMP_HW 0x61
80 #define SCSI_SDIAG_DUMP_RAM 0x62
81 #define SCSI_SDIAG_PATCH_HW 0x63
82 #define SCSI_SDIAG_PATCH_RAM 0x64
83 #define SCSI_SDIAG_SET_RD_ERR 0x65
84 #define SCSI_SDIAG_RD_ERR_DEF 0x00
85 #define SCSI_SDIAG_RD_ERR_RPT 0x01
86 #define SCSI_SDIAG_RD_ERR_NOC 0x02
87
88 /* class 01 commands */
89 #define SCSI_READC 0x25 /* read capacity */
90 #define SCSI_FULL_CAP 0x00
91 #define SCSI_PART_CAP 0x01
92
93 /*
94 * unsupported SCSI commands
95 */
96 #define SCSI_SET_THRESHOLD 0x10
97 #define SCSI_RD_USAGE_CTRS 0x11
98 #define SCSI_READ_EXTENDED 0x28
99 #define SCSI_WRITE_EXTENDED 0x2A
100 #define SCSI_WRITE_AND_VERIFY 0x2E
101 #define SCSI_VERIFY 0x2F
102 #define SCSI_SEARCH_DATA_EQUAL 0x31
103 #define SCSI_SET_LIMITS 0x33
104
105 /*
106 * Tape commands
107 */
108 #define SCSI_REWIND 0x01 /* Rewind command */
109 #define SCSI_RETENSION 0x02 /* Retention a tape */
110 #define SCSI_WFM 0x10 /* Write a file mark */
111 #define SCSI_SPACE 0x11 /* Space (default blocks) fwd */
112 #define SCSI_ERASE 0x19 /* Erase a tape */
113
114 /*
115 * Sizes of data transferred for some standard commands
116 */
117 #define SIZE_CAP 8 /* nbr bytes in Read Capacity input data */
118 #define SIZE_TRANS 8 /* nbr bytes in Translate input data */
119
120 /*
121 * structure for SCSI mode select command
122 */
123 #define SCSI_MODES_ILEN 22 /* bytes in data block */
124 #define SCSI_MODES_DLEN 8 /* length of extent descriptor list */
125
126 struct scsi_modes {
127 /* command list */
128 u_char m_type; /* command type */
129 u_char m_unit; /* upper 3 bits are unit */
130 u_char m_pad1[2]; /* reserved */
131 u_char m_ilen; /* length of info passed */
132 u_char m_cont; /* control byte */
133 /* parameter list */
134 u_char m_pad2[3]; /* reserved */
135 u_char m_dlen; /* length of descript list */
136 /* extent descriptor list */
137 u_char m_density; /* density code */
138 u_char m_pad3[4]; /* reserved */
139 u_char m_bsize[3]; /* block size */
140 /* drive parameter list */
141 u_char m_fcode; /* format code */
142 u_char m_cyls[2]; /* cylinder count */
143 u_char m_heads; /* data head count */
144 u_char m_rwcc[2]; /* reduced write current cylinder */
145 u_char m_wpc[2]; /* write precompensation cylinder */
146 char m_lzone; /* landing zone position */
147 u_char m_srate; /* step pulse output rate code */
148 };
149
150 /*
151 * structures for SCSI format command
152 */
153 struct dlist { /* defect list entries */
154 u_char d_cyls[3]; /* cyl of defect */
155 u_char d_heads; /* head nbr */
156 u_char d_bytes[4]; /* bytes from index */
157 };
158
159 #define FORMAT_BUF 1024 /* max bytes for Format Data */
160 #define MAX_DEFECTS (FORMAT_BUF / sizeof(struct dlist))
161
162 struct scsi_fmt {
163 /* command list */
164 u_char f_type; /* command type */
165 u_char f_misc; /* 3 bit unit, data flag, complete list bits */
166 u_char f_data; /* data pattern */
167 u_char f_ileave[2]; /* interleave */
168 u_char f_pad1; /* reserved */
169 /* defect list */
170 u_char f_full; /* full or cyl flag */
171 u_char f_spares; /* nbr spares/cyl */
172 u_char f_dlen[2]; /* length of defect list blocks */
173 struct dlist dlist[MAX_DEFECTS]; /* blocks of defect list */
174 };
175
176 /*
177 * scsi_fmt.f_misc flags
178 */
179 #define FMT_BBL_DATA 0x10 /* bbl data exists */
180 #define FMT_CMPLT 0x08 /* bbl data is complete */
181 #define FMT_USER_FMT 0x04 /* use user-supplied fmt data */
182 #define FMT_DATA 0x02 /* use user-supplied data pattern */
183 #define FMT_ALL (FMT_BBL_DATA | FMT_CMPLT | FMT_USER_FMT | FMT_DATA)
184
185 /*
186 * scsi_fmt.f_data
187 */
188 #define FMT_PAT 0x6D /* worst winchester data */
189
190 /*
191 * scsi_fmt.f_full flags
192 */
193 #define FMT_FULL 0x00 /* complete drive */
194 #define FMT_CYL 0x01 /* single cylinder */
195
196 /*
197 * scsi_fmt.f_code
198 */
199 #define FMT_FCODE 0x01 /* must be 1 */
200
201 /*
202 * SCSI_UNIT Macro:
203 * bits 0-2: unit number on the hardware (up to 8)
204 * bits 3-5: target number (up to 8)
205 * bits 6-8: drive type (up to 8), index into configuration table
206 * bits 9-11: SEC board number
207 *
208 * On embedded SCSI, the unit number is always 0.
209 */
210 #define SCSI_UNIT(x) (((x)>>0)&7)
211 #define SCSI_TARGET(x) (((x)>>3)&7)
212 #define SCSI_TYPE(x) (((x)>>6)&7)
213 #define SCSI_BOARD(x) (((x)>>9)&7)
214 #define SCSI_DEVNO(x) (SDEV_SCSISTART + (SCSI_TARGET((x))<<3) + (SCSI_UNIT((x))) )
215
216 #endif /* _SQT_SCSI_H_ */
Cache object: 2225075bd61866543f4be26cbe2c8716
|