Deleted Added
full compact
mlxvar.h (52225) mlxvar.h (52544)
1/*-
2 * Copyright (c) 1999 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/mlx/mlxvar.h 52225 1999-10-14 02:54:06Z msmith $
26 * $FreeBSD: head/sys/dev/mlx/mlxvar.h 52544 1999-10-26 23:20:43Z msmith $
27 */
28
29/*
30 * We could actually use all 33 segments, but using only 32 means that
31 * each scatter/gather map is 256 bytes in size, and thus we don't have to worry about
32 * maps crossing page boundaries.
33 */
34#define MLX_NSEG 32 /* max scatter/gather segments we use */
35#define MLX_NSLOTS 256 /* max number of command slots */
36
27 */
28
29/*
30 * We could actually use all 33 segments, but using only 32 means that
31 * each scatter/gather map is 256 bytes in size, and thus we don't have to worry about
32 * maps crossing page boundaries.
33 */
34#define MLX_NSEG 32 /* max scatter/gather segments we use */
35#define MLX_NSLOTS 256 /* max number of command slots */
36
37#define MLX_CFG_BASE0 0x10 /* first region */
38#define MLX_CFG_BASE1 0x14 /* second region (type 3 only) */
39
40#define MLX_MAXDRIVES 32
41
37#define MLX_MAXDRIVES 32
38
42#define MLX_BLKSIZE 512 /* fixed feature */
43
44/*
45 * Structure describing a System Drive as attached to the controller.
46 */
47struct mlx_sysdrive
48{
49 /* from MLX_CMD_ENQSYSDRIVE */
50 u_int32_t ms_size;
51 int ms_state;

--- 64 unchanged lines hidden (view full) ---

116 int mlx_maxtarg; /* maximum number of targets per channel */
117 int mlx_maxtags; /* maximum number of tags per device */
118 int mlx_scsicap; /* SCSI capabilities */
119 int mlx_feature; /* controller features/quirks */
120#define MLX_FEAT_PAUSEWORKS (1<<0) /* channel pause works as expected */
121
122 /* controller queues and arrays */
123 TAILQ_HEAD(, mlx_command) mlx_freecmds; /* command structures available for reuse */
39/*
40 * Structure describing a System Drive as attached to the controller.
41 */
42struct mlx_sysdrive
43{
44 /* from MLX_CMD_ENQSYSDRIVE */
45 u_int32_t ms_size;
46 int ms_state;

--- 64 unchanged lines hidden (view full) ---

111 int mlx_maxtarg; /* maximum number of targets per channel */
112 int mlx_maxtags; /* maximum number of tags per device */
113 int mlx_scsicap; /* SCSI capabilities */
114 int mlx_feature; /* controller features/quirks */
115#define MLX_FEAT_PAUSEWORKS (1<<0) /* channel pause works as expected */
116
117 /* controller queues and arrays */
118 TAILQ_HEAD(, mlx_command) mlx_freecmds; /* command structures available for reuse */
124 TAILQ_HEAD(, mlx_command) mlx_donecmd; /* commands waiting for completion processing */
119 TAILQ_HEAD(, mlx_command) mlx_work; /* active commands */
125 struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */
126 int mlx_busycmds; /* count of busy commands */
127 struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */
128 struct buf_queue_head mlx_bufq; /* outstanding I/O operations */
129 int mlx_waitbufs; /* number of bufs awaiting commands */
130
131 /* controller status */
132 u_int8_t mlx_fwminor; /* firmware revision */

--- 64 unchanged lines hidden (view full) ---

197/*
198 * Interface between driver core and disk driver (should be using a bus?)
199 */
200extern int mlx_submit_buf(struct mlx_softc *sc, struct buf *bp);
201extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd,
202 caddr_t addr, int32_t flag, struct proc *p);
203extern void mlxd_intr(void *data);
204
120 struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */
121 int mlx_busycmds; /* count of busy commands */
122 struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */
123 struct buf_queue_head mlx_bufq; /* outstanding I/O operations */
124 int mlx_waitbufs; /* number of bufs awaiting commands */
125
126 /* controller status */
127 u_int8_t mlx_fwminor; /* firmware revision */

--- 64 unchanged lines hidden (view full) ---

192/*
193 * Interface between driver core and disk driver (should be using a bus?)
194 */
195extern int mlx_submit_buf(struct mlx_softc *sc, struct buf *bp);
196extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd,
197 caddr_t addr, int32_t flag, struct proc *p);
198extern void mlxd_intr(void *data);
199
205/*
206 * Inlines to build various command structures
207 */
208static __inline void
209mlx_make_type1(struct mlx_command *mc,
210 u_int8_t code,
211 u_int16_t f1,
212 u_int32_t f2,
213 u_int8_t f3,
214 u_int32_t f4,
215 u_int8_t f5)
216{
217 mc->mc_mailbox[0x0] = code;
218 mc->mc_mailbox[0x2] = f1 & 0xff;
219 mc->mc_mailbox[0x3] = (((f2 >> 24) & 0x3) << 6) | ((f1 >> 8) & 0x3f);
220 mc->mc_mailbox[0x4] = f2 & 0xff;
221 mc->mc_mailbox[0x5] = (f2 >> 8) & 0xff;
222 mc->mc_mailbox[0x6] = (f2 >> 16) & 0xff;
223 mc->mc_mailbox[0x7] = f3;
224 mc->mc_mailbox[0x8] = f4 & 0xff;
225 mc->mc_mailbox[0x9] = (f4 >> 8) & 0xff;
226 mc->mc_mailbox[0xa] = (f4 >> 16) & 0xff;
227 mc->mc_mailbox[0xb] = (f4 >> 24) & 0xff;
228 mc->mc_mailbox[0xc] = f5;
229}
230
200
231static __inline void
232mlx_make_type2(struct mlx_command *mc,
233 u_int8_t code,
234 u_int8_t f1,
235 u_int8_t f2,
236 u_int8_t f3,
237 u_int8_t f4,
238 u_int8_t f5,
239 u_int8_t f6,
240 u_int32_t f7,
241 u_int8_t f8)
242{
243 mc->mc_mailbox[0x0] = code;
244 mc->mc_mailbox[0x2] = f1;
245 mc->mc_mailbox[0x3] = f2;
246 mc->mc_mailbox[0x4] = f3;
247 mc->mc_mailbox[0x5] = f4;
248 mc->mc_mailbox[0x6] = f5;
249 mc->mc_mailbox[0x7] = f6;
250 mc->mc_mailbox[0x8] = f7 & 0xff;
251 mc->mc_mailbox[0x9] = (f7 >> 8) & 0xff;
252 mc->mc_mailbox[0xa] = (f7 >> 16) & 0xff;
253 mc->mc_mailbox[0xb] = (f7 >> 24) & 0xff;
254 mc->mc_mailbox[0xc] = f8;
255}
256
257static __inline void
258mlx_make_type3(struct mlx_command *mc,
259 u_int8_t code,
260 u_int8_t f1,
261 u_int8_t f2,
262 u_int16_t f3,
263 u_int8_t f4,
264 u_int8_t f5,
265 u_int32_t f6,
266 u_int8_t f7)
267{
268 mc->mc_mailbox[0x0] = code;
269 mc->mc_mailbox[0x2] = f1;
270 mc->mc_mailbox[0x3] = f2;
271 mc->mc_mailbox[0x4] = f3 & 0xff;
272 mc->mc_mailbox[0x5] = (f3 >> 8) & 0xff;
273 mc->mc_mailbox[0x6] = f4;
274 mc->mc_mailbox[0x7] = f5;
275 mc->mc_mailbox[0x8] = f6 & 0xff;
276 mc->mc_mailbox[0x9] = (f6 >> 8) & 0xff;
277 mc->mc_mailbox[0xa] = (f6 >> 16) & 0xff;
278 mc->mc_mailbox[0xb] = (f6 >> 24) & 0xff;
279 mc->mc_mailbox[0xc] = f7;
280}
281
282static __inline void
283mlx_make_type4(struct mlx_command *mc,
284 u_int8_t code,
285 u_int16_t f1,
286 u_int32_t f2,
287 u_int32_t f3,
288 u_int8_t f4)
289{
290 mc->mc_mailbox[0x0] = code;
291 mc->mc_mailbox[0x2] = f1 & 0xff;
292 mc->mc_mailbox[0x3] = (f1 >> 8) & 0xff;
293 mc->mc_mailbox[0x4] = f2 & 0xff;
294 mc->mc_mailbox[0x5] = (f2 >> 8) & 0xff;
295 mc->mc_mailbox[0x6] = (f2 >> 16) & 0xff;
296 mc->mc_mailbox[0x7] = (f2 >> 24) & 0xff;
297 mc->mc_mailbox[0x8] = f3 & 0xff;
298 mc->mc_mailbox[0x9] = (f3 >> 8) & 0xff;
299 mc->mc_mailbox[0xa] = (f3 >> 16) & 0xff;
300 mc->mc_mailbox[0xb] = (f3 >> 24) & 0xff;
301 mc->mc_mailbox[0xc] = f4;
302}
303
304static __inline void
305mlx_make_type5(struct mlx_command *mc,
306 u_int8_t code,
307 u_int8_t f1,
308 u_int8_t f2,
309 u_int32_t f3,
310 u_int32_t f4,
311 u_int8_t f5)
312{
313 mc->mc_mailbox[0x0] = code;
314 mc->mc_mailbox[0x2] = f1;
315 mc->mc_mailbox[0x3] = f2;
316 mc->mc_mailbox[0x4] = f3 & 0xff;
317 mc->mc_mailbox[0x5] = (f3 >> 8) & 0xff;
318 mc->mc_mailbox[0x6] = (f3 >> 16) & 0xff;
319 mc->mc_mailbox[0x7] = (f3 >> 24) & 0xff;
320 mc->mc_mailbox[0x8] = f4 & 0xff;
321 mc->mc_mailbox[0x9] = (f4 >> 8) & 0xff;
322 mc->mc_mailbox[0xa] = (f4 >> 16) & 0xff;
323 mc->mc_mailbox[0xb] = (f4 >> 24) & 0xff;
324 mc->mc_mailbox[0xc] = f5;
325}
326