cleanup
[unix-history] / usr / src / sys / hp300 / dev / rdreg.h
CommitLineData
60f56dfc
KM
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 * %sccs.include.redist.c%
11 *
12 * from: Utah $Hdr: rdreg.h 1.14 89/02/27$
13 *
14 * @(#)rdreg.h 7.1 (Berkeley) %G%
15 */
16
17struct rd_iocmd {
18 char c_pad;
19 char c_unit;
20 char c_volume;
21 char c_saddr;
22 short c_hiaddr;
23 long c_addr;
24 char c_nop2;
25 char c_slen;
26 long c_len;
27 char c_cmd;
28 char c_pad2;
29};
30
31struct rd_rscmd {
32 char c_unit;
33 char c_sram;
34 char c_ram;
35 char c_cmd;
36};
37
38struct rd_stat {
39 char c_vu;
40 char c_pend;
41 short c_ref;
42 short c_fef;
43 short c_aef;
44 short c_ief;
45 union {
46 char cu_raw[10];
47 struct {
48 short cu_msw;
49 long cu_lsl;
50 } cu_sva;
51 struct {
52 long cu_cyhd;
53 short cu_sect;
54 } cu_tva;
55 } c_pf;
56};
57#define c_raw c_pf.cu_raw
58#define c_blk c_pf.cu_sva.cu_lsl /* for now */
59#define c_tva c_pf.cu_tva
60
61struct rd_ssmcmd {
62 char c_unit;
63 char c_cmd;
64 short c_refm;
65 short c_fefm;
66 short c_aefm;
67 short c_iefm;
68};
69
70struct rd_srcmd {
71 char c_unit;
72 char c_nop;
73 char c_cmd;
74 char c_param;
75};
76
77struct rd_clearcmd {
78 char c_unit;
79 char c_cmd;
80};
81
82struct rd_describe {
83 u_int d_iuw:16, /* controller: installed unit word */
84 d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
85 d_ctype:8, /* controller: controller type */
86 d_utype:8, /* unit: unit type */
87 d_name:24, /* unit: name (6 BCD digits) */
88 d_sectsize:16, /* unit: # of bytes per block (sector) */
89 d_blkbuf:8, /* unit: # of blocks which can be buffered */
90 d_burstsize:8, /* unit: recommended burst size */
91 d_blocktime:16, /* unit: block time (u-sec) */
92 d_uavexfr:16, /* unit: average transfer rate (Kb) */
93 d_retry:16, /* unit: optimal retry time (1/100-sec) */
94 d_access:16, /* unit: access time param (1/100-sec) */
95 d_maxint:8, /* unit: maximum interleave */
96 d_fvbyte:8, /* unit: fixed volume byte */
97 d_rvbyte:8, /* unit: removeable volume byte */
98 d_maxcyl:24, /* volume: maximum cylinder */
99 d_maxhead:8, /* volume: maximum head */
100 d_maxsect:16, /* volume: maximum sector on track */
101 d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
102 d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
103 d_interleave:8; /* volume: current interleave */
104 };
105
106/* indicies into rdinfo -- order is arbitrary */
107#define RD7945A 0
108#define RD9134D 1
109#define RD9122S 2
110#define RD7912P 3
111#define RD7914P 4
112#define RD7958A 5
113#define RD7957A 6
114#define RD7933H 7
115#define RD9134L 8
116#define RD7936H 9
117#define RD7937H 10
118#define RD7914CT 11
119#define RD7946A 12
120#define RD9122D 13
121#define RD7957B 14
122#define RD7958B 15
123#define RD7959B 16
124
125/* HW ids */
126#define RD7946AID 0x220 /* also 7945A */
127#define RD9134DID 0x221 /* also 9122S */
128#define RD9134LID 0x222 /* also 9122D */
129#define RD7912PID 0x209
130#define RD7914CTID 0x20A
131#define RD7914PID 0x20B
132#define RD7958AID 0x22B
133#define RD7957AID 0x22A
134#define RD7933HID 0x212
135#define RD7936HID 0x213 /* just guessing -- as of yet unknown */
136#define RD7937HID 0x214
137#define RD7957BID 0x22C /* another guess based on 7958B */
138#define RD7958BID 0x22D
139#define RD7959BID 0x22E /* another guess based on 7958B */
140
141#define NRD7945ABPT (32 >> (DEV_BSHIFT-8))
142#define NRD7945ATRK 7
143#define NRD9134DBPT (32 >> (DEV_BSHIFT-8))
144#define NRD9134DTRK 6
145#define NRD9122SBPT (16 >> (DEV_BSHIFT-8))
146#define NRD9122STRK 2
147#define NRD7912PBPT (64 >> (DEV_BSHIFT-8))
148#define NRD7912PTRK 7
149#define NRD7914PBPT (64 >> (DEV_BSHIFT-8))
150#define NRD7914PTRK 7
151#define NRD7933HBPT (92 >> (DEV_BSHIFT-8))
152#define NRD7933HTRK 13
153#define NRD9134LBPT (32 >> (DEV_BSHIFT-8))
154#define NRD9134LTRK 5
155
156/*
157 * Several HP drives have an odd number of 256 byte sectors per track.
158 * This makes it rather difficult to break them into 512 and 1024 byte blocks.
159 * So...we just do like HPUX and don't bother to respect hardware track/head
160 * boundries -- we just mold the disk so that we use the entire capacity.
161 * HPUX also sometimes doen't abide by cylinder boundries, we attempt to
162 * whenever possible.
163 *
164 * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
165 * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
166 * ----- --------------- --------------- --------------
167 * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
168 * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
169 *
170 * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
171 * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
172 *
173 * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269
174 * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786
175 * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572
176 */
177#if DEV_BSIZE == 512
178# define NRD7936HBPT 123
179# define NRD7936HTRK 7
180# define NRD7937HBPT 123
181# define NRD7937HTRK 13
182# define NRD7957ABPT 22
183# define NRD7957ATRK 7
184# define NRD7958ABPT 36
185# define NRD7958ATRK 7
186# define NRD7957BBPT 18
187# define NRD7957BTRK 7
188# define NRD7958BBPT 42
189# define NRD7958BTRK 9
190# define NRD7959BBPT 42
191# define NRD7959BTRK 9
192#endif
193#if DEV_BSIZE == 1024
194# define NRD7957ABPT 11
195# define NRD7957ATRK 7
196# define NRD7958ABPT 21
197# define NRD7958ATRK 6
198# define NRD7957BBPT 9
199# define NRD7957BTRK 7
200# define NRD7958BBPT 21
201# define NRD7958BTRK 9
202# define NRD7959BBPT 21
203# define NRD7959BTRK 9
204#endif
205
206/* controller "unit" number */
207#define RDCTLR 15
208
209/* convert 512 byte count into DEV_BSIZE count */
210#define RDSZ(x) ((x) >> (DEV_BSHIFT-9))
211
212/* convert block number into sector number and back */
213#define RDBTOS(x) ((x) << (DEV_BSHIFT-8))
214#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8))
215
216/* extract cyl/head/sect info from three-vector address */
217#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
218#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF)
219#define RDSECT(tva) ((tva).cu_sect)
220
221#define REF_MASK 0x0
222#define FEF_MASK 0x0
223#define AEF_MASK 0x0
224#define IEF_MASK 0xF970
225
226#define FEF_CU 0x4000 /* cross-unit */
227#define FEF_DR 0x0080 /* diagnostic result */
228#define FEF_IMR 0x0008 /* internal maintenance release */
229#define FEF_PF 0x0002 /* power fail */
230#define FEF_REXMT 0x0001 /* retransmit */
231#define AEF_UD 0x0040 /* unrecoverable data */
232#define IEF_RRMASK 0xe000 /* request release bits */
233#define IEF_MD 0x0020 /* marginal data */
234#define IEF_RD 0x0010 /* recoverable data */
235
236#define C_READ 0x00
237#define C_RAM 0x00 /* single vector (i.e. sector number) */
238#define C_WRITE 0x02
239#define C_CLEAR 0x08
240#define C_STATUS 0x0d
241#define C_SADDR 0x10
242#define C_SLEN 0x18
243#define C_SUNIT(x) (0x20 | (x))
244#define C_SVOL(x) (0x40 | (x))
245#define C_NOP 0x34
246#define C_DESC 0x35
247#define C_SREL 0x3b
248#define C_SSM 0x3e
249#define C_SRAM 0x48
250#define C_REL 0x140
251
252#define C_CMD 0x05
253#define C_EXEC 0x0e
254#define C_QSTAT 0x10
255#define C_TCMD 0x12