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