rdreg.h revision 1.1 1 /*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1982, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
39 *
40 * @(#)rdreg.h 7.3 (Berkeley) 2/25/91
41 */
42
43 struct rd_iocmd {
44 char c_pad;
45 char c_unit;
46 char c_volume;
47 char c_saddr;
48 short c_hiaddr;
49 long c_addr;
50 char c_nop2;
51 char c_slen;
52 long c_len;
53 char c_cmd;
54 char c_pad2;
55 };
56
57 struct rd_rscmd {
58 char c_unit;
59 char c_sram;
60 char c_ram;
61 char c_cmd;
62 };
63
64 struct rd_stat {
65 char c_vu;
66 char c_pend;
67 short c_ref;
68 short c_fef;
69 short c_aef;
70 short c_ief;
71 union {
72 char cu_raw[10];
73 struct {
74 short cu_msw;
75 long cu_lsl;
76 } cu_sva;
77 struct {
78 long cu_cyhd;
79 short cu_sect;
80 } cu_tva;
81 } c_pf;
82 };
83 #define c_raw c_pf.cu_raw
84 #define c_blk c_pf.cu_sva.cu_lsl /* for now */
85 #define c_tva c_pf.cu_tva
86
87 struct rd_ssmcmd {
88 char c_unit;
89 char c_cmd;
90 short c_refm;
91 short c_fefm;
92 short c_aefm;
93 short c_iefm;
94 };
95
96 struct rd_srcmd {
97 char c_unit;
98 char c_nop;
99 char c_cmd;
100 char c_param;
101 };
102
103 struct rd_clearcmd {
104 char c_unit;
105 char c_cmd;
106 };
107
108 struct rd_describe {
109 u_int d_iuw:16, /* controller: installed unit word */
110 d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
111 d_ctype:8, /* controller: controller type */
112 d_utype:8, /* unit: unit type */
113 d_name:24, /* unit: name (6 BCD digits) */
114 d_sectsize:16, /* unit: # of bytes per block (sector) */
115 d_blkbuf:8, /* unit: # of blocks which can be buffered */
116 d_burstsize:8, /* unit: recommended burst size */
117 d_blocktime:16, /* unit: block time (u-sec) */
118 d_uavexfr:16, /* unit: average transfer rate (Kb) */
119 d_retry:16, /* unit: optimal retry time (1/100-sec) */
120 d_access:16, /* unit: access time param (1/100-sec) */
121 d_maxint:8, /* unit: maximum interleave */
122 d_fvbyte:8, /* unit: fixed volume byte */
123 d_rvbyte:8, /* unit: removeable volume byte */
124 d_maxcyl:24, /* volume: maximum cylinder */
125 d_maxhead:8, /* volume: maximum head */
126 d_maxsect:16, /* volume: maximum sector on track */
127 d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
128 d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
129 d_interleave:8; /* volume: current interleave */
130 };
131
132 /* indicies into rdinfo -- order is arbitrary */
133 #define RD7945A 0
134 #define RD9134D 1
135 #define RD9122S 2
136 #define RD7912P 3
137 #define RD7914P 4
138 #define RD7958A 5
139 #define RD7957A 6
140 #define RD7933H 7
141 #define RD9134L 8
142 #define RD7936H 9
143 #define RD7937H 10
144 #define RD7914CT 11
145 #define RD7946A 12
146 #define RD9122D 13
147 #define RD7957B 14
148 #define RD7958B 15
149 #define RD7959B 16
150
151 /* HW ids */
152 #define RD7946AID 0x220 /* also 7945A */
153 #define RD9134DID 0x221 /* also 9122S */
154 #define RD9134LID 0x222 /* also 9122D */
155 #define RD7912PID 0x209
156 #define RD7914CTID 0x20A
157 #define RD7914PID 0x20B
158 #define RD7958AID 0x22B
159 #define RD7957AID 0x22A
160 #define RD7933HID 0x212
161 #define RD7936HID 0x213 /* just guessing -- as of yet unknown */
162 #define RD7937HID 0x214
163 #define RD7957BID 0x22C /* another guess based on 7958B */
164 #define RD7958BID 0x22D
165 #define RD7959BID 0x22E /* another guess based on 7958B */
166 #define RD2200AID 0x22F
167 #define RD2203AID 0x230 /* yet another guess */
168
169 #define NRD7945ABPT (32 >> (DEV_BSHIFT-8))
170 #define NRD7945ATRK 7
171 #define NRD9134DBPT (32 >> (DEV_BSHIFT-8))
172 #define NRD9134DTRK 6
173 #define NRD9122SBPT (16 >> (DEV_BSHIFT-8))
174 #define NRD9122STRK 2
175 #define NRD7912PBPT (64 >> (DEV_BSHIFT-8))
176 #define NRD7912PTRK 7
177 #define NRD7914PBPT (64 >> (DEV_BSHIFT-8))
178 #define NRD7914PTRK 7
179 #define NRD7933HBPT (92 >> (DEV_BSHIFT-8))
180 #define NRD7933HTRK 13
181 #define NRD9134LBPT (32 >> (DEV_BSHIFT-8))
182 #define NRD9134LTRK 5
183
184 /*
185 * Several HP drives have an odd number of 256 byte sectors per track.
186 * This makes it rather difficult to break them into 512 and 1024 byte blocks.
187 * So...we just do like HPUX and don't bother to respect hardware track/head
188 * boundries -- we just mold the disk so that we use the entire capacity.
189 * HPUX also sometimes doen't abide by cylinder boundries, we attempt to
190 * whenever possible.
191 *
192 * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
193 * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
194 * ----- --------------- --------------- --------------
195 * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
196 * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
197 *
198 * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
199 * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
200 *
201 * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269
202 * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786
203 * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572
204 *
205 * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449
206 * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
207 */
208 #if DEV_BSIZE == 512
209 # define NRD7936HBPT 123
210 # define NRD7936HTRK 7
211 # define NRD7937HBPT 123
212 # define NRD7937HTRK 13
213 # define NRD7957ABPT 22
214 # define NRD7957ATRK 7
215 # define NRD7958ABPT 36
216 # define NRD7958ATRK 7
217 # define NRD7957BBPT 18
218 # define NRD7957BTRK 7
219 # define NRD7958BBPT 42
220 # define NRD7958BTRK 9
221 # define NRD7959BBPT 42
222 # define NRD7959BTRK 9
223 # define NRD2200ABPT 113
224 # define NRD2200ATRK 4
225 # define NRD2203ABPT 113
226 # define NRD2203ATRK 8
227 #endif
228 #if DEV_BSIZE == 1024
229 # define NRD7957ABPT 11
230 # define NRD7957ATRK 7
231 # define NRD7958ABPT 21
232 # define NRD7958ATRK 6
233 # define NRD7957BBPT 9
234 # define NRD7957BTRK 7
235 # define NRD7958BBPT 21
236 # define NRD7958BTRK 9
237 # define NRD7959BBPT 21
238 # define NRD7959BTRK 9
239 # define NRD2200ABPT 113
240 # define NRD2200ATRK 2
241 # define NRD2203ABPT 113
242 # define NRD2203ATRK 4
243 #endif
244
245 /* controller "unit" number */
246 #define RDCTLR 15
247
248 /* convert 512 byte count into DEV_BSIZE count */
249 #define RDSZ(x) ((x) >> (DEV_BSHIFT-9))
250
251 /* convert block number into sector number and back */
252 #define RDBTOS(x) ((x) << (DEV_BSHIFT-8))
253 #define RDSTOB(x) ((x) >> (DEV_BSHIFT-8))
254
255 /* extract cyl/head/sect info from three-vector address */
256 #define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
257 #define RDHEAD(tva) ((tva).cu_cyhd & 0xFF)
258 #define RDSECT(tva) ((tva).cu_sect)
259
260 #define REF_MASK 0x0
261 #define FEF_MASK 0x0
262 #define AEF_MASK 0x0
263 #define IEF_MASK 0xF970
264
265 #define FEF_CU 0x4000 /* cross-unit */
266 #define FEF_DR 0x0080 /* diagnostic result */
267 #define FEF_IMR 0x0008 /* internal maintenance release */
268 #define FEF_PF 0x0002 /* power fail */
269 #define FEF_REXMT 0x0001 /* retransmit */
270 #define AEF_UD 0x0040 /* unrecoverable data */
271 #define IEF_RRMASK 0xe000 /* request release bits */
272 #define IEF_MD 0x0020 /* marginal data */
273 #define IEF_RD 0x0010 /* recoverable data */
274
275 #define C_READ 0x00
276 #define C_RAM 0x00 /* single vector (i.e. sector number) */
277 #define C_WRITE 0x02
278 #define C_CLEAR 0x08
279 #define C_STATUS 0x0d
280 #define C_SADDR 0x10
281 #define C_SLEN 0x18
282 #define C_SUNIT(x) (0x20 | (x))
283 #define C_SVOL(x) (0x40 | (x))
284 #define C_NOP 0x34
285 #define C_DESC 0x35
286 #define C_SREL 0x3b
287 #define C_SSM 0x3e
288 #define C_SRAM 0x48
289 #define C_REL 0x140
290
291 #define C_CMD 0x05
292 #define C_EXEC 0x0e
293 #define C_QSTAT 0x10
294 #define C_TCMD 0x12
295