Merge from vendor branch PKGSRC:
[netbsd-mini2440.git] / sys / dev / gpib / rdreg.h
blob226f26b014b89c10a9f9ba95b3328b66c3fe4521
1 /* $NetBSD: rdreg.h,v 1.4 2005/12/11 12:21:21 christos 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
41 * Copyright (c) 1988 University of Utah.
43 * This code is derived from software contributed to Berkeley by
44 * the Systems Programming Group of the University of Utah Computer
45 * Science Department.
47 * Redistribution and use in source and binary forms, with or without
48 * modification, are permitted provided that the following conditions
49 * are met:
50 * 1. Redistributions of source code must retain the above copyright
51 * notice, this list of conditions and the following disclaimer.
52 * 2. Redistributions in binary form must reproduce the above copyright
53 * notice, this list of conditions and the following disclaimer in the
54 * documentation and/or other materials provided with the distribution.
55 * 3. All advertising materials mentioning features or use of this software
56 * must display the following acknowledgement:
57 * This product includes software developed by the University of
58 * California, Berkeley and its contributors.
59 * 4. Neither the name of the University nor the names of its contributors
60 * may be used to endorse or promote products derived from this software
61 * without specific prior written permission.
63 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
64 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
65 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
66 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
67 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
68 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
69 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
70 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
71 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
72 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
73 * SUCH DAMAGE.
75 * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
77 * @(#)rdreg.h 8.1 (Berkeley) 6/10/93
80 struct rd_iocmd {
81 u_int8_t c_pad; /* alignment */
82 u_int8_t c_unit; /* punit */
83 u_int8_t c_volume; /* CS80CMD_SVOL(0) */
84 u_int8_t c_saddr; /* CS80CMD_SADDR */
85 u_int16_t c_hiaddr; /* always 0 */
86 u_int32_t c_addr; /* blkno */
87 u_int8_t c_nop2; /* CS80CMD_NOP - 32-bit alignment */
88 u_int8_t c_slen; /* CS80CMD_SLEN */
89 u_int32_t c_len; /* number of sectors */
90 u_int8_t c_cmd; /* CS80CMD_READ/CS80CMD_WRITE */
91 } __packed;
93 struct rd_rscmd { /* different */
94 u_int8_t c_unit;
95 u_int8_t c_sram;
96 u_int8_t c_ram;
97 u_int8_t c_cmd;
98 } __packed;
100 /* HW ids */
101 #define RD7946AID 0x220 /* also 7945A */
102 #define RD9134DID 0x221 /* also 9122S */
103 #define RD9134LID 0x222 /* also 9122D */
104 #define RD7912PID 0x209
105 #define RD7914CTID 0x20A
106 #define RD7914PID 0x20B
107 #define RD7958AID 0x22B
108 #define RD7957AID 0x22A
109 #define RD7933HID 0x212
110 #define RD7936HID 0x213 /* just guessing -- as of yet unknown */
111 #define RD7937HID 0x214
112 #define RD7957BID 0x22C /* another guess based on 7958B */
113 #define RD7958BID 0x22D
114 #define RD7959BID 0x22E /* another guess based on 7958B */
115 #define RD2200AID 0x22F
116 #define RD2203AID 0x230 /* yet another guess */
118 /* SW ids -- indicies into rdidentinfo, order is arbitrary */
119 #define RD7945A 0
120 #define RD9134D 1
121 #define RD9122S 2
122 #define RD7912P 3
123 #define RD7914P 4
124 #define RD7958A 5
125 #define RD7957A 6
126 #define RD7933H 7
127 #define RD9134L 8
128 #define RD7936H 9
129 #define RD7937H 10
130 #define RD7914CT 11
131 #define RD7946A 12
132 #define RD9122D 13
133 #define RD7957B 14
134 #define RD7958B 15
135 #define RD7959B 16
137 #define NRD7945ABPT 16
138 #define NRD7945ATRK 7
139 #define NRD9134DBPT 16
140 #define NRD9134DTRK 6
141 #define NRD9122SBPT 8
142 #define NRD9122STRK 2
143 #define NRD7912PBPT 32
144 #define NRD7912PTRK 7
145 #define NRD7914PBPT 32
146 #define NRD7914PTRK 7
147 #define NRD7933HBPT 46
148 #define NRD7933HTRK 13
149 #define NRD9134LBPT 16
150 #define NRD9134LTRK 5
153 * Several HP drives have an odd number of 256 byte sectors per track.
154 * This makes it rather difficult to break them into 512 and 1024 byte blocks.
155 * So...we just do like HPUX and don't bother to respect hardware track/head
156 * boundaries -- we just mold the disk so that we use the entire capacity.
157 * HPUX also sometimes doesn't abide by cylinder boundaries, we attempt to
158 * whenever possible.
160 * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
161 * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
162 * ----- --------------- --------------- --------------
163 * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
164 * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
166 * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
167 * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
169 * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269
170 * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786
171 * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572
173 * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449
174 * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
176 #define NRD7936HBPT 123
177 #define NRD7936HTRK 7
178 #define NRD7937HBPT 123
179 #define NRD7937HTRK 13
180 #define NRD7957ABPT 22
181 #define NRD7957ATRK 7
182 #define NRD7958ABPT 36
183 #define NRD7958ATRK 7
184 #define NRD7957BBPT 18
185 #define NRD7957BTRK 7
186 #define NRD7958BBPT 42
187 #define NRD7958BTRK 9
188 #define NRD7959BBPT 42
189 #define NRD7959BTRK 9
190 #define NRD2200ABPT 113
191 #define NRD2200ATRK 4
192 #define NRD2203ABPT 113
193 #define NRD2203ATRK 8
195 /* convert 512 byte count into DEV_BSIZE count */
196 #define RDSZ(x) ((x) >> (DEV_BSHIFT-9))
198 /* convert block number into sector number and back */
199 #define RDBTOS(x) ((x) << (DEV_BSHIFT-8))
200 #define RDSTOB(x) ((x) >> (DEV_BSHIFT-8))
202 /* extract cyl/head/sect info from three-vector address */
203 #define RDCYL(tva) ((u_int32_t)(tva).cu_cyhd >> 8)
204 #define RDHEAD(tva) ((tva).cu_cyhd & 0xFF)
205 #define RDSECT(tva) ((tva).cu_sect)