Deleted Added
full compact
mlxreg.h (52225) mlxreg.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/mlxreg.h 52225 1999-10-14 02:54:06Z msmith $
26 * $FreeBSD: head/sys/dev/mlx/mlxreg.h 52544 1999-10-26 23:20:43Z msmith $
27 */
28
27 */
28
29#define MLX_CFG_BASE0 0x10 /* first region */
30#define MLX_CFG_BASE1 0x14 /* second region (type 3 only) */
31
32#define MLX_BLKSIZE 512 /* fixed feature */
33
29/*
30 * Selected command codes.
31 */
32#define MLX_CMD_ENQUIRY 0x53
33#define MLX_CMD_ENQUIRY2 0x1c
34#define MLX_CMD_ENQSYSDRIVE 0x19
35#define MLX_CMD_READOLDSG 0xb6
36#define MLX_CMD_WRITEOLDSG 0xb7

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

240
241struct mlx_rebuild_stat /* MLX_CMD_REBUILDSTAT */
242{
243 u_int32_t rb_drive;
244 u_int32_t rb_size;
245 u_int32_t rb_remaining;
246} __attribute__ ((packed));
247
34/*
35 * Selected command codes.
36 */
37#define MLX_CMD_ENQUIRY 0x53
38#define MLX_CMD_ENQUIRY2 0x1c
39#define MLX_CMD_ENQSYSDRIVE 0x19
40#define MLX_CMD_READOLDSG 0xb6
41#define MLX_CMD_WRITEOLDSG 0xb7

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

245
246struct mlx_rebuild_stat /* MLX_CMD_REBUILDSTAT */
247{
248 u_int32_t rb_drive;
249 u_int32_t rb_size;
250 u_int32_t rb_remaining;
251} __attribute__ ((packed));
252
253/*
254 * Inlines to build various command structures
255 */
256static __inline void
257mlx_make_type1(struct mlx_command *mc,
258 u_int8_t code,
259 u_int16_t f1,
260 u_int32_t f2,
261 u_int8_t f3,
262 u_int32_t f4,
263 u_int8_t f5)
264{
265 mc->mc_mailbox[0x0] = code;
266 mc->mc_mailbox[0x2] = f1 & 0xff;
267 mc->mc_mailbox[0x3] = (((f2 >> 24) & 0x3) << 6) | ((f1 >> 8) & 0x3f);
268 mc->mc_mailbox[0x4] = f2 & 0xff;
269 mc->mc_mailbox[0x5] = (f2 >> 8) & 0xff;
270 mc->mc_mailbox[0x6] = (f2 >> 16) & 0xff;
271 mc->mc_mailbox[0x7] = f3;
272 mc->mc_mailbox[0x8] = f4 & 0xff;
273 mc->mc_mailbox[0x9] = (f4 >> 8) & 0xff;
274 mc->mc_mailbox[0xa] = (f4 >> 16) & 0xff;
275 mc->mc_mailbox[0xb] = (f4 >> 24) & 0xff;
276 mc->mc_mailbox[0xc] = f5;
277}
278
279static __inline void
280mlx_make_type2(struct mlx_command *mc,
281 u_int8_t code,
282 u_int8_t f1,
283 u_int8_t f2,
284 u_int8_t f3,
285 u_int8_t f4,
286 u_int8_t f5,
287 u_int8_t f6,
288 u_int32_t f7,
289 u_int8_t f8)
290{
291 mc->mc_mailbox[0x0] = code;
292 mc->mc_mailbox[0x2] = f1;
293 mc->mc_mailbox[0x3] = f2;
294 mc->mc_mailbox[0x4] = f3;
295 mc->mc_mailbox[0x5] = f4;
296 mc->mc_mailbox[0x6] = f5;
297 mc->mc_mailbox[0x7] = f6;
298 mc->mc_mailbox[0x8] = f7 & 0xff;
299 mc->mc_mailbox[0x9] = (f7 >> 8) & 0xff;
300 mc->mc_mailbox[0xa] = (f7 >> 16) & 0xff;
301 mc->mc_mailbox[0xb] = (f7 >> 24) & 0xff;
302 mc->mc_mailbox[0xc] = f8;
303}
304
305static __inline void
306mlx_make_type3(struct mlx_command *mc,
307 u_int8_t code,
308 u_int8_t f1,
309 u_int8_t f2,
310 u_int16_t f3,
311 u_int8_t f4,
312 u_int8_t f5,
313 u_int32_t f6,
314 u_int8_t f7)
315{
316 mc->mc_mailbox[0x0] = code;
317 mc->mc_mailbox[0x2] = f1;
318 mc->mc_mailbox[0x3] = f2;
319 mc->mc_mailbox[0x4] = f3 & 0xff;
320 mc->mc_mailbox[0x5] = (f3 >> 8) & 0xff;
321 mc->mc_mailbox[0x6] = f4;
322 mc->mc_mailbox[0x7] = f5;
323 mc->mc_mailbox[0x8] = f6 & 0xff;
324 mc->mc_mailbox[0x9] = (f6 >> 8) & 0xff;
325 mc->mc_mailbox[0xa] = (f6 >> 16) & 0xff;
326 mc->mc_mailbox[0xb] = (f6 >> 24) & 0xff;
327 mc->mc_mailbox[0xc] = f7;
328}
329
330static __inline void
331mlx_make_type4(struct mlx_command *mc,
332 u_int8_t code,
333 u_int16_t f1,
334 u_int32_t f2,
335 u_int32_t f3,
336 u_int8_t f4)
337{
338 mc->mc_mailbox[0x0] = code;
339 mc->mc_mailbox[0x2] = f1 & 0xff;
340 mc->mc_mailbox[0x3] = (f1 >> 8) & 0xff;
341 mc->mc_mailbox[0x4] = f2 & 0xff;
342 mc->mc_mailbox[0x5] = (f2 >> 8) & 0xff;
343 mc->mc_mailbox[0x6] = (f2 >> 16) & 0xff;
344 mc->mc_mailbox[0x7] = (f2 >> 24) & 0xff;
345 mc->mc_mailbox[0x8] = f3 & 0xff;
346 mc->mc_mailbox[0x9] = (f3 >> 8) & 0xff;
347 mc->mc_mailbox[0xa] = (f3 >> 16) & 0xff;
348 mc->mc_mailbox[0xb] = (f3 >> 24) & 0xff;
349 mc->mc_mailbox[0xc] = f4;
350}
351
352static __inline void
353mlx_make_type5(struct mlx_command *mc,
354 u_int8_t code,
355 u_int8_t f1,
356 u_int8_t f2,
357 u_int32_t f3,
358 u_int32_t f4,
359 u_int8_t f5)
360{
361 mc->mc_mailbox[0x0] = code;
362 mc->mc_mailbox[0x2] = f1;
363 mc->mc_mailbox[0x3] = f2;
364 mc->mc_mailbox[0x4] = f3 & 0xff;
365 mc->mc_mailbox[0x5] = (f3 >> 8) & 0xff;
366 mc->mc_mailbox[0x6] = (f3 >> 16) & 0xff;
367 mc->mc_mailbox[0x7] = (f3 >> 24) & 0xff;
368 mc->mc_mailbox[0x8] = f4 & 0xff;
369 mc->mc_mailbox[0x9] = (f4 >> 8) & 0xff;
370 mc->mc_mailbox[0xa] = (f4 >> 16) & 0xff;
371 mc->mc_mailbox[0xb] = (f4 >> 24) & 0xff;
372 mc->mc_mailbox[0xc] = f5;
373}