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